public function init() { parent::init(); $this->currmenu = 'tournament'; header("Content-type: text/html; charset=utf-8"); TournamentTool::refresh_tournaments(); }
function beforeFilter() { # Call beforeFilter of MyController parent class parent::beforeFilter(); # Stop AfterFind actions in Review model $this->Review->rankList = false; }
function beforeFilter() { $this->name = 'groups'; // required for admin controllers # Call beforeFilter of MyAdminController parent class parent::beforeFilter(); }
function beforeFilter() { # Call beforeFilter of MyController parent class parent::beforeFilter(); $this->jr_lat = Sanitize::getString($this->Config, 'geomaps.latitude'); $this->jr_lon = Sanitize::getString($this->Config, 'geomaps.longitude'); }
function beforeFilter() { # Call beforeFilter of MyController parent class parent::beforeFilter(); # Make configuration available in models $this->Listing->Config =& $this->Config; }
function beforeFilter() { parent::beforeFilter(); if (Sanitize::getInt($this->data, 'OwnerReply')) { $this->review_id = Sanitize::getInt($this->data['OwnerReply'], 'id'); } else { $this->review_id = Sanitize::getInt($this->params, 'review_id'); } if (!$this->Config->owner_replies || $this->review_id == 0 || $this->_user->id == 0) { $this->denyAccess = true; return; } // Get the listing id and extension $this->_db->setQuery("\n SELECT \n Review.pid AS listing_id, Review.`mode` AS extension\n FROM \n #__jreviews_comments AS Review\n WHERE \n Review.id = " . $this->review_id); // Get listing owner id and check if it matches the current user if ($listing = current($this->_db->loadAssocList())) { // Automagically load and initialize Everywhere Model to check if user is listing owner App::import('Model', 'everywhere_' . $listing['extension'], 'jreviews'); $class_name = inflector::camelize('everywhere_' . $listing['extension']) . 'Model'; if (class_exists($class_name)) { $this->Listing = new $class_name(); $owner = $this->Listing->getListingOwner($listing['listing_id']); if ($this->_user->id != $owner['user_id']) { $this->denyAccess = true; return; } $this->data['Listing']['created_by'] = $owner['user_id']; // Used in the Activities component $this->data['Listing']['listing_id'] = $listing['listing_id']; // Used in the Activities component $this->data['Listing']['extension'] = $listing['extension']; // Used in the Activities component } } }
public function __construct() { parent::__construct(); $this->_sId = TWILIO_SID; $this->_token = TWILIO_TOKEN; $this->_number = TWILIO_NUMBER; $this->_client = new Services_Twilio($this->_sId, $this->_token); }
function beforeFilter() { parent::beforeFilter(); $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix'); # Set Theme $this->viewTheme = $this->Config->template; $this->viewImages = S2Paths::get($this->app, 'S2_THEMES_URL') . $this->viewTheme . _DS . 'theme_images' . _DS; }
function beforeFilter() { # Call beforeFilter of MyController parent class parent::beforeFilter(); $this->Directory->Config =& $this->Config; # Change render controller/view $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix'); }
function beforeFilter() { Configure::write('ListingEdit', false); # Call beforeFilter of MyController parent class parent::beforeFilter(); # Stop AfterFind actions in Review model $this->Review->rankList = false; }
protected function initializeController() { if (self::$shouldCallParentAndEcho) { parent::initializeController(); echo 'Controller' . PHP_EOL; } if (is_null($this->controller)) { $this->controller = MyController::getInstance(); } }
function afterFilter() { if (isset($this->review_fields)) { $Assets = RegisterClass::getInstance('AssetsHelper'); $Assets->assetParams['review_fields'] = $this->review_fields; $Assets->assetParams['owner_id'] = $this->owner_id; unset($this->review_fields); } parent::afterFilter(); }
function afterFilter() { $Assets = ClassRegistry::getClass('AssetsHelper'); if (isset($this->review_fields)) { $Assets->assetParams['review_fields'] = $this->review_fields; } unset($this->review_fields); isset($this->owner_id) and $Assets->assetParams['owner_id'] = $this->owner_id; parent::afterFilter(); }
function beforeFilter() { parent::beforeFilter(); $this->viewSuffix = Sanitize::getString($this->params['module'], 'tmpl_suffix'); # Set Theme $this->viewTheme = $this->Config->template; $this->viewImages = S2Paths::get('jreviews', 'S2_THEMES_URL') . $this->viewTheme . _DS . 'theme_images' . _DS; # Set Theme Vars $search_itemid = Sanitize::getInt($this->params['module'], 'search_itemid'); if ($search_itemid) { $this->set('search_itemid', $search_itemid); } }
/** * constructor */ public function __construct() { parent::__construct(); $this->portal = new MyPortal($GLOBALS['identifier']); $new_themes = PSUTheme::new_themes($this->portal->person->wp_id); $this->tpl->assign('new_themes', $new_themes); $this->tpl->body_style_classes[] = 'myplymouth'; if ($this->portal->is_fluid()) { $this->tpl->body_style_classes[] = 'fluid'; } //end if MyController::_detect_disabled_chat($this->portal, $this->tpl); }
function afterFilter() { App::import('Helper', 'assets', 'jreviews'); $Assets = RegisterClass::getInstance('AssetsHelper'); $Assets->name = $this->name; $Assets->action = $this->action; $Assets->params = $this->params; $Assets->Access = $this->Access; $Assets->Config = $this->Config; $Assets->assetParams['review_fields'] = $this->review_fields; unset($this->review_fields); parent::afterFilter(); }
public function authenticate() { $user = Player::model()->find('email=:user and password=:pass', array(':user' => $this->username, ':pass' => self::hashpwd($this->password))); if ($user) { $user->last_login_ip = MyController::getUserHostAddress(); $user->last_login_time = date('Y-m-d H:i:s'); $user->login_times++; $user->save(); Yii::app()->user->setState('id', $user->id); return true; } else { return false; } }
public function actionReg() { $email = trim(Yii::app()->request->getParam('email')); $nick = trim(Yii::app()->request->getParam('nickname')); $password = trim(Yii::app()->request->getParam('passwd')); $password2 = trim(Yii::app()->request->getParam('passwd2')); $refer = trim(Yii::app()->request->getParam('refer', '/')); if (!preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i', $email)) { $this->json_return(false, '请输入一个格式正确的Email地址'); } if (!$password || $password != $password2) { $this->json_return(false, '2次输入的密码不一致'); } if (!$nick) { $this->json_return(false, '请填写昵称'); } if (mb_strlen($nick, 'UTF-8') > 9) { $this->json_return(false, '昵称长度请限制在9个字之内'); } if (Player::model()->find('email=:email', array(':email' => $email))) { $this->json_return(false, '这个Email已经被注册了,您是否已经注册过了呢?'); } if (Player::model()->find('nickname=:nick', array(':nick' => $nick))) { $this->json_return(false, '这个昵称已经被注册了,换一个吧'); } $player = new Player(); $player->email = $email; $player->nickname = $nick; $player->password = MyUserIdentity::hashpwd($password); $player->login_times = 0; $player->b_win = 0; $player->b_lose = 0; $player->w_win = 0; $player->w_lose = 0; $player->draw = 0; $player->reg_time = date('Y-m-d H:i:s'); $player->reg_ip = MyController::getUserHostAddress(); $player->last_login_time = date('Y-m-d H:i:s'); $player->last_login_ip = MyController::getUserHostAddress(); $player->score = Yii::app()->params['init_score']; if ($player->save()) { $identity = new MyUserIdentity($email, $password); if ($identity->authenticate()) { Yii::app()->user->login($identity, 3600); $this->json_return(true, '恭喜您注册成功!', $refer); } } $this->json_return(false, '注册失败啦,请与管理员联系。'); }
/** * AppController::beforeRender() * * @return void */ public function beforeRender() { if ($this->request->is('ajax') && $this->layout === 'default') { $this->layout = 'ajax'; } # default title if (empty($this->pageTitle)) { $this->pageTitle = __(Inflector::humanize($this->request->action)) . ' | ' . __($this->name); } $this->set('title_for_layout', $this->pageTitle); $this->disableCache(); if ($m = $this->Session->read('Message.auth')) { $this->Flash->message($m['message'], 'error'); $this->Session->delete('Message.auth'); } parent::beforeRender(); }
/** * AppController::beforeFilter() * * @return void */ public function beforeFilter() { parent::beforeFilter(); $this->Auth->authenticate = array('Authenticate.MultiColumn' => array('fields' => array('username' => 'login', 'password' => 'password'), 'columns' => array('username', 'email'), 'userModel' => 'User')); $this->Auth->authorize = array('Tools.Tiny' => array()); $this->Auth->logoutRedirect = array('plugin' => false, 'admin' => false, 'controller' => 'overview', 'action' => 'index'); $this->Auth->loginRedirect = array('plugin' => false, 'admin' => false, 'controller' => 'overview', 'action' => 'index'); $this->Auth->loginAction = array('plugin' => false, 'admin' => false, 'controller' => 'account', 'action' => 'login'); // Do not allow access to these public actions when already logged in $allowed = array('Account' => array('login', 'lost_password', 'register')); if (!Auth::id()) { return; } foreach ($allowed as $controller => $actions) { if ($this->name === $controller && in_array($this->request->action, $actions)) { $this->Common->flashMessage('The page you tried to access is not relevant if you are already logged in. Redirected to main page.', 'info'); return $this->redirect($this->Auth->loginRedirect); } } $this->paginate['paramType'] = 'querystring'; }
function beforeFilter() { # Call beforeFilter of MyController parent class parent::beforeFilter(); }
/** * @access public * @return void */ public function __construct() { parent::__construct(); $this->_request["interval"] = "5m"; }
function beforeFilter() { parent::beforeFilter(); }
function beforeFilter() { # Call beforeFilter of MyController parent class parent::beforeFilter(); $this->Directory->Config =& $this->Config; }
function beforeFilter() { # Call beforeFilter of MyController parent class $this->activities = array('listing_new' => __t("submitted a new listing titled %s", true), 'review_new' => __t("wrote a review for %s", true), 'comment_new' => __t("posted a new comment", true), 'vote helpful' => __t("liked this review for %s", true)); parent::beforeFilter(); }
function beforeFilter() { $this->Access->init($this->Config); parent::beforeFilter(); }
function beforeFilter() { Configure::write('ListingEdit', false); # Call beforeFilter of MyController parent class parent::beforeFilter(); }
public function init() { parent::init(); $this->currmenu = 'main'; header("Content-type: text/html; charset=utf-8"); }
public function __construct() { parent::__construct(); $this->allow('members'); }
/** * @access public * @return void */ public function __construct() { parent::__construct(); $this->allow('manager'); }