@define('DEBUG', true); @define('DEBUG_EXTRA', true);
This will disable the caching of forum templates and will display errors that occur. 'components'=>array( 'phpBB'=>array( 'class'=>'ext.phpBB.phpBB', 'path'=>'webroot.forum', ), 'user'=>array( 'class'=>'PhpBBWebUser', 'loginUrl'=>array('/site/login'), // enable cookie-based authentication 'allowAutoLogin'=>true, ), 'request'=>array( // , , URL . 'baseUrl'=>$_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF'] != $_SERVER['SCRIPT_FILENAME'] ? 'http://'.$_SERVER['HTTP_HOST'] : '', // ... ), // ... ),
class user extends session { // ... function user() // ... }
turn into: class bbuser extends session { // ... function bbuser() // ... }
$user = new user();
on $user = new bbuser();
<?php class PhpBBWebUser extends WebUser{ /** @var UserIdentity */ private $_identity; public function login($identity, $duration=0) { $this->_identity = $identity; return parent::login($identity, $duration); } protected function afterLogin($fromCookie) { if ($this->_identity !== null) { if (Yii::app()->phpBB->login($this->_identity->username, $this->_identity->password) != 'SUCCESS') { Yii::log(" ({$this->_identity->username})", CLogger::LEVEL_ERROR); } } parent::afterLogin($fromCookie); } protected function afterLogout() { Yii::app()->phpBB->logout(); parent::afterLogout(); } }
protected function afterSave() { if ($this->isNewRecord) { // // , ( ), email, ID ( 2- , 5-) Yii::app()->phpBB->userAdd($this->login, $this->password, $this->email, 2); } parent::afterSave(); } protected function afterDelete() { // Yii::app()->phpBB->userDelete($this->login); parent::afterDelete(); }
Yii::app()->phpBB->changePassword($user_login, $user_new_password);
case 'register': header('location: /site/registration'); exit(); case 'login': header('location: /site/login'); exit(); case 'logout': header('location: /site/logout'); exit();
<?php // Yii- defined('DS') or define('DS', DIRECTORY_SEPARATOR); // change the following paths if necessary $yii = dirname(__FILE__).DS.'..'.DS.'yii'.DS.'framework'.DS.'yii.php'; $yii_config = dirname(__FILE__).DS.'..'.DS.'protected'.DS.'config'.DS.'main.php'; require_once($yii); Yii::createWebApplication($yii_config); // "/server/www/forum" "/server/www", Yii Yii::setPathOfAlias('webroot', Yii::getPathOfAlias('webroot').DS.'..'); // assets Yii::app()->assetManager->setBasePath(Yii::getPathOfAlias('webroot').DS.'assets');
/** * Yii */ include "yiiapp.php"; $controller = new Controller('bbforum'); // bbforum - Yii::app()->controller = $controller; ob_start(); // // ...
function page_footer($run_cron = true) { // ... garbage_collection(); if (class_exists('Yii', false) && Yii::app()->controller !== null) { $content = ob_get_clean(); Yii::app()->controller->renderPartial('//layouts/main', array('content'=>$content), false, true); } exit_handler(); }
Source: https://habr.com/ru/post/190868/
All Articles