Exemple #1
0
 function __construct()
 {
     if (!$this->config('referals.on')) {
         $this->redirect($this->makeUrl('alias=' . $this->config('defaultAlias')));
     }
     parent::__construct();
     $this->_cookieName = $this->config('referals.cookieName', $this->_cookieName);
     if ($this->getParamsObject()) {
         $params = $this->getParamsObject();
         $this->_cookieTime = $params->_get('cookie_time', $this->_cookieTime);
         $this->setVar('params', $params);
     }
     if ($this->cookie($this->_cookieName)) {
         //TODO обработать несуществующий куки, добавить значит по юзерайди.
         $model = rad_instances::get('model_coresession_referals');
         if ($item = $model->setState('cookie', $this->cookie($this->_cookieName))->getItem()) {
             $item->rrf_date = now();
             $item->rrf_time = now();
             setcookie($this->_cookieName, $item->rrf_cookie, time() + $this->_cookieTime, '/', $this->config('hostname'));
             $item->save();
         } else {
             if ($this->request('user_id')) {
                 if ($user = rad_instances::get('model_core_users')->getItem((int) $this->request('user_id'))) {
                     $this->_insertItem($user->u_id);
                 }
             }
         }
     } elseif ($this->request('user_id')) {
         if ($user = rad_instances::get('model_core_users')->getItem((int) $this->request('user_id'))) {
             $this->_insertItem($user->u_id);
         }
     }
     $this->redirect(SITE_URL);
 }
Exemple #2
0
 function __construct()
 {
     parent::__construct();
     if ($this->getCurrentUser()) {
         $this->setVar('user', $this->getCurrentUser());
     }
     if ($this->getParamsObject()) {
         $params = $this->getParamsObject();
         $this->_is_facebook = (bool) $params->_get('is_facebook', $this->_is_facebook);
         //$this->_is_twitter = (boolean) $params->_get('is_twitter', $this->_is_twitter);
         $this->setVar('params', $params);
     }
     $this->setVar('hash', $this->hash());
     $this->assignCurrency();
     $this->setVar('langs', $this->getAllLanguages());
     $this->setVar('currentLangId', $this->getCurrentLangID());
 }
Exemple #3
0
 function __construct()
 {
     parent::__construct();
     if ($referer = $this->request('referer', !empty($_SERVER['HTTP_REFERER']) && rad_loader::getCurrentAlias()->alias == SITE_ALIAS ? $_SERVER['HTTP_REFERER'] : NULL)) {
         $this->setVar('referer', $referer);
     }
     if ($this->getCurrentUser() and $this->getCurrentUser()->u_id) {
         $this->setVar('user', $this->getCurrentUser());
     }
     if ($this->getParamsObject()) {
         $params = $this->getParamsObject();
         $this->_treestart = (int) $params->_get('treestart', $this->_treestart);
         $this->_is_facebook = (bool) $params->_get('is_facebook', $this->_is_facebook);
         //$this->_is_twitter = (boolean) $params->_get('is_twitter', $this->_is_twitter);
         $this->_fb_appkey = $params->_get('fb_appkey', $this->_fb_appkey);
         $this->_fb_secretkey = $params->_get('fb_secretkey', $this->_fb_secretkey);
         //$this->_tw_appkey = $params->_get('tw_appkey', $this->_tw_appkey);
         //$this->_tw_secretkey = $params->_get('tw_secretkey', $this->_tw_secretkey);
         $this->setVar('params', $params);
     }
     $this->setVar('hash', $this->hash());
     rad_autoload_register(array('controller_coresession_login', 'autoloadLibrary'));
     $this->makeConfig();
     switch ($this->request('action')) {
         case 'soc_login':
             $this->socialsLogin();
             break;
         case 'soc_endpoint':
             $this->socialsEndpoint();
             break;
         case 'soc_refresh':
             $this->socialsRefresh();
             break;
         default:
             if ($this->request('fromsite')) {
                 $this->loginFromSite();
             } else {
                 $this->manage();
             }
             break;
     }
 }
 function __construct()
 {
     parent::__construct();
     if ($this->getParamsObject()) {
         $params = $this->getParamsObject();
         $this->_treestart = $params->_get('treestart', $this->_treestart, $this->getContentLangID());
         $this->setVar('params', $params);
     }
     $this->setVar('hash', $this->hash());
     if ($this->request('action')) {
         $this->setVar('action', strtolower($this->request('action')));
         switch (strtolower($this->request('action'))) {
             case 'getjs':
                 $this->getJS();
                 break;
             case 'addedit':
                 if ($this->request('i')) {
                     $item = new struct_corecatalog_delivery(array('rdl_id' => (int) $this->request('i')));
                     $item->load();
                 } else {
                     $item = new struct_corecatalog_delivery();
                 }
                 if ($this->request('action_sub')) {
                     if ($this->request('hash') == $this->hash()) {
                         $item = $this->_assignFromRequest($item);
                         if ($item->save()) {
                             echo 'RADDelivery.message("' . $this->lang('-saved') . '");';
                         } else {
                             echo 'RADDelivery.message("' . $this->lang('-error') . '");';
                         }
                         die('RADDelivery.cancelWClick();RADDelivery.refresh();');
                     } else {
                         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
                     }
                 } else {
                     $this->setVar('item', $item);
                     $this->assignCurrency();
                 }
                 break;
             case 'deleteitem':
                 if ($this->request('hash') == $this->hash()) {
                     if ($this->request('i')) {
                         $item = new struct_corecatalog_delivery(array('rdl_id' => (int) $this->request('i')));
                         if ($item->load()->rdl_id and $item->remove()) {
                             die('RADDelivery.message("' . $this->lang('-deleted') . '");RADDelivery.refresh();');
                         }
                     } else {
                         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
                     }
                 } else {
                     $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
                 }
                 break;
             case 'getitems':
                 $this->assignItems();
                 break;
             case 'setactive':
                 $this->setActiveJS();
                 break;
             default:
                 $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
                 break;
         }
         //switch
     } else {
         $this->assignItems();
     }
 }
 function __construct()
 {
     parent::__construct();
     if ($this->request('search')) {
         $this->setVar('searchword', $this->request('search'));
     } else {
         $this->setVar('searchword', '');
     }
     $this->setVar('powercache', $this->config('cache.power', false));
     if ($this->getParamsObject()) {
         $params = $this->getParamsObject();
         $this->_banner_places = $params->treestart;
         $this->setVar('params', $params);
     }
     $this->setVar('hash', $this->hash());
     if ($this->request('action')) {
         $this->addBC('action', $this->request('action'));
         switch ($this->request('action')) {
             case 'edit':
                 $this->editRecord();
                 $this->_assignIncludesAndModules();
                 $this->assignPositions();
                 $this->assignThemes();
                 $this->assignAliasGroups();
                 break;
             case 'add':
                 $this->addAlias();
                 $this->assignThemes();
                 break;
             case 'addinc':
                 $this->addInclude();
                 break;
             case 'delinc':
                 $this->deleteInclude();
                 break;
             case 'delete':
                 $this->deleteAlias();
                 break;
             case 'search':
                 $this->search();
                 break;
             case 'getjs_aliaslist':
             case 'getjs':
                 $this->getJS();
                 break;
                 //ajax functions
             //ajax functions
             case 'save':
                 $this->saveAlias();
                 break;
             case 'applyinc':
                 $this->applyIncludes();
                 break;
             case 'addincludewindow':
                 $this->showAddWindow();
                 $this->_assignIncludesAndModules();
                 $this->assignPositions();
                 break;
             case 'addWinclude':
                 $this->addIncludeW();
                 break;
             case 'getincludeslist':
                 $this->editRecord();
                 $this->_assignIncludesAndModules();
                 $this->assignPositions();
                 break;
             case 'confinclude':
                 $this->configInclude();
                 if ($this->request('onlymain')) {
                     $this->setVar('onlymain', true);
                 }
                 break;
             case 'saveconfinclude':
                 $this->saveConfigInclude();
                 break;
             case 'getcontrollerjs':
                 $this->getControllerJS();
                 break;
             case 'showeditscript':
                 $this->showEditScript();
                 break;
             case 'saveeditscript':
                 $this->saveEditScript();
                 break;
             case 'refreshlist':
                 $this->showAliases();
                 break;
             case 'savedescription':
                 $this->saveDescription();
                 break;
             case 'descriptionwindow':
                 $this->descriptionWindow();
                 break;
             case 'createtheme':
                 $this->createTheme();
                 break;
             case 'deletetheme':
                 $this->deleteTheme();
                 break;
             case 'copycomponents':
                 $this->copyComponentsFromTheme();
                 break;
             default:
                 $this->badRequest();
                 $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
                 break;
         }
         $this->setVar('action', $this->request('action'));
     } else {
         //if action
         $this->showAliases();
     }
 }