class WebUser extends CWebUser{ public $lastname; public $email; public $userid; public $phone; public function login($identity, $duration=0) { parent::login($identity, $duration); $user = $identity->getUser(); $this->id = $user["email"]; $this->name = $user["name"]; $this->setState("info", $user); $this->saveToCookie($duration); } protected function loadIdentityStates($states) { parent::loadIdentityStates($states); $this->loadVariables(); } public function loadVariables() { $info = $this->getState("info"); if ($info === null) { $this->userid = null; $this->lastname = null; $this->email = null; $this->phone = null; } $this->userid = $info["id"]; $this->name = $info["name"]; $this->lastname = $info["lastname"]; $this->email = $info["email"]; $this->phone = $info["phone"]; } public function get() { $this->loadVariables(); return $this; } public static function getCurrentUser() { return Yii::app()->user->get(); } public function getIsGuest() { if ($this->getState('info')===null) { return true; } /* $info = $this->getState("info"); if (!is_array($info) || !isset($info["id"]) || !isset($info["id"]) || !isset($info["name"]) || !isset($info["lastname"]) || !isset($info["email"]) || !isset($info["phone"])) { return true; } */ return false; } public function getOriginalDuration() { $request=Yii::app()->getRequest(); $cookies=$request->getCookies(); $cookie=$cookies->itemAt($this->getStateKeyPrefix()); if($cookie && !empty($cookie->value) && ($data=Yii::app()->getSecurityManager()->validateData($cookie->value))!==false) { $data=@unserialize($data); if(is_array($data) && isset($data[0],$data[1],$data[2],$data[3])) { // data is an array containing id, name, duration, states // so second index is the duration return $data[2]; } } return 0; } public function updateField($field, $value) { $info = $this->getState("info"); if (!isset($info[$field])) { return; } $info[$field] = $value; $this->setState("info", $info); $info = $this->getState("info", $info); if ($info[$field] !== $value) { throw new CException("not saved0"); } $this->loadVariables(); $duration = $this->getOriginalDuration(); $this->saveToCookie($duration); $this->renewCookie(); } } ?> class WebUser extends CWebUser{ public $lastname; public $email; public $userid; public $phone; public function login($identity, $duration=0) { parent::login($identity, $duration); $user = $identity->getUser(); $this->id = $user["email"]; $this->name = $user["name"]; $this->setState("info", $user); $this->saveToCookie($duration); } protected function loadIdentityStates($states) { parent::loadIdentityStates($states); $this->loadVariables(); } public function loadVariables() { $info = $this->getState("info"); if ($info === null) { $this->userid = null; $this->lastname = null; $this->email = null; $this->phone = null; } $this->userid = $info["id"]; $this->name = $info["name"]; $this->lastname = $info["lastname"]; $this->email = $info["email"]; $this->phone = $info["phone"]; } public function get() { $this->loadVariables(); return $this; } public static function getCurrentUser() { return Yii::app()->user->get(); } public function getIsGuest() { if ($this->getState('info')===null) { return true; } /* $info = $this->getState("info"); if (!is_array($info) || !isset($info["id"]) || !isset($info["id"]) || !isset($info["name"]) || !isset($info["lastname"]) || !isset($info["email"]) || !isset($info["phone"])) { return true; } */ return false; } public function getOriginalDuration() { $request=Yii::app()->getRequest(); $cookies=$request->getCookies(); $cookie=$cookies->itemAt($this->getStateKeyPrefix()); if($cookie && !empty($cookie->value) && ($data=Yii::app()->getSecurityManager()->validateData($cookie->value))!==false) { $data=@unserialize($data); if(is_array($data) && isset($data[0],$data[1],$data[2],$data[3])) { // data is an array containing id, name, duration, states // so second index is the duration return $data[2]; } } return 0; } public function updateField($field, $value) { $info = $this->getState("info"); if (!isset($info[$field])) { return; } $info[$field] = $value; $this->setState("info", $info); $info = $this->getState("info", $info); if ($info[$field] !== $value) { throw new CException("not saved0"); } $this->loadVariables(); $duration = $this->getOriginalDuration(); $this->saveToCookie($duration); $this->renewCookie(); } } ?>
/home/xgmexgme/public_html/basitpazar/protected/controllers/SiteController.php(59)
47 $this->jsFiles[] = 'site/login.js'; 48 $this->render('kayit'); 49 } 50 51 /** 52 * Logs out the current user and redirect to homepage. 53 */ 54 public function actionLogout() 55 { 56 $session = Yii::app()->session; 57 $session->destroy(); 58 59 Yii::app()->user->logout(); 60 61 $this->redirect(Yii::app()->homeUrl); 62 } 63 64 public function turnOnErrors() { 65 // You need to actually copy paste the lines below to the place you want 66 // to see the errors 67 ini_set('display_errors', 1); 68 ini_set('display_startup_errors', 1); 69 error_reporting(E_ALL); 70 } 71
| #0 |
+
–
/home/xgmexgme/public_html/yii/framework/base/CModule.php(386): YiiBase::createComponent() 381 $config=$this->_componentConfig[$id]; 382 if(!isset($config['enabled']) || $config['enabled']) 383 { 384 Yii::trace("Loading \"$id\" application component",'system.CModule'); 385 unset($config['enabled']); 386 $component=Yii::createComponent($config); 387 $component->init(); 388 return $this->_components[$id]=$component; 389 } 390 } 391 } |
| #1 |
+
–
/home/xgmexgme/public_html/yii/framework/base/CModule.php(103): CModule->getComponent() 098 * @return mixed the named property value 099 */ 100 public function __get($name) 101 { 102 if($this->hasComponent($name)) 103 return $this->getComponent($name); 104 else 105 return parent::__get($name); 106 } 107 108 /** |
| #2 |
+
–
/home/xgmexgme/public_html/basitpazar/protected/controllers/SiteController.php(59): CModule->__get() 54 public function actionLogout() 55 { 56 $session = Yii::app()->session; 57 $session->destroy(); 58 59 Yii::app()->user->logout(); 60 61 $this->redirect(Yii::app()->homeUrl); 62 } 63 64 public function turnOnErrors() { |
| #3 |
+
–
/home/xgmexgme/public_html/yii/framework/web/actions/CInlineAction.php(49): SiteController->actionLogout() 44 $controller=$this->getController(); 45 $method=new ReflectionMethod($controller, $methodName); 46 if($method->getNumberOfParameters()>0) 47 return $this->runWithParamsInternal($controller, $method, $params); 48 else 49 return $controller->$methodName(); 50 } 51 52 } |
| #4 |
+
–
/home/xgmexgme/public_html/yii/framework/web/CController.php(308): CInlineAction->runWithParams() 303 { 304 $priorAction=$this->_action; 305 $this->_action=$action; 306 if($this->beforeAction($action)) 307 { 308 if($action->runWithParams($this->getActionParams())===false) 309 $this->invalidActionParams($action); 310 else 311 $this->afterAction($action); 312 } 313 $this->_action=$priorAction; |
| #5 |
+
–
/home/xgmexgme/public_html/yii/framework/web/CController.php(286): CController->runAction() 281 * @see runAction 282 */ 283 public function runActionWithFilters($action,$filters) 284 { 285 if(empty($filters)) 286 $this->runAction($action); 287 else 288 { 289 $priorAction=$this->_action; 290 $this->_action=$action; 291 CFilterChain::create($this,$action,$filters)->run(); |
| #6 |
+
–
/home/xgmexgme/public_html/yii/framework/web/CController.php(265): CController->runActionWithFilters() 260 { 261 if(($parent=$this->getModule())===null) 262 $parent=Yii::app(); 263 if($parent->beforeControllerAction($this,$action)) 264 { 265 $this->runActionWithFilters($action,$this->filters()); 266 $parent->afterControllerAction($this,$action); 267 } 268 } 269 else 270 $this->missingAction($actionID); |
| #7 |
+
–
/home/xgmexgme/public_html/yii/framework/web/CWebApplication.php(282): CController->run() 277 { 278 list($controller,$actionID)=$ca; 279 $oldController=$this->_controller; 280 $this->_controller=$controller; 281 $controller->init(); 282 $controller->run($actionID); 283 $this->_controller=$oldController; 284 } 285 else 286 throw new CHttpException(404,Yii::t('yii','Unable to resolve the request "{route}".', 287 array('{route}'=>$route===''?$this->defaultController:$route))); |
| #8 |
+
–
/home/xgmexgme/public_html/yii/framework/web/CWebApplication.php(141): CWebApplication->runController() 136 foreach(array_splice($this->catchAllRequest,1) as $name=>$value) 137 $_GET[$name]=$value; 138 } 139 else 140 $route=$this->getUrlManager()->parseUrl($this->getRequest()); 141 $this->runController($route); 142 } 143 144 /** 145 * Registers the core application components. 146 * This method overrides the parent implementation by registering additional core components. |
| #9 |
+
–
/home/xgmexgme/public_html/yii/framework/base/CApplication.php(180): CWebApplication->processRequest() 175 public function run() 176 { 177 if($this->hasEventHandler('onBeginRequest')) 178 $this->onBeginRequest(new CEvent($this)); 179 register_shutdown_function(array($this,'end'),0,false); 180 $this->processRequest(); 181 if($this->hasEventHandler('onEndRequest')) 182 $this->onEndRequest(new CEvent($this)); 183 } 184 185 /** |
| #10 |
+
–
/home/xgmexgme/public_html/basitpazar/index.php(13): CApplication->run() 08 defined('YII_DEBUG') or define('YII_DEBUG',true); 09 // specify how many levels of call stack should be shown in each log message 10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3); 11 12 require_once($yii); 13 Yii::createWebApplication($config)->run(); |