コード例 #1
0
ファイル: captcha.php プロジェクト: ValenokPC/tabernacms
 /**
  * Shows the image
  */
 public function show()
 {
     if (is_file($this->_kcaptchaFilename)) {
         include_once $this->_kcaptchaFilename;
         $this->_instanceCaptcha = new KCAPTCHA();
         rad_session::setVar($this->_sessionName, $this->_instanceCaptcha->getKeyString());
     } else {
         throw new rad_exception('KCaptcha library not found!');
     }
 }
コード例 #2
0
ファイル: changetheme.php プロジェクト: ValenokPC/tabernacms
 function __construct()
 {
     if ($this->request('t')) {
         if (rad_themer::themeExists($this->request('t'))) {
             rad_session::setVar('theme', $this->request('t'));
         }
     } else {
         rad_session::setVar('theme', $this->config('theme.default'));
     }
     if (isset($_SERVER['HTTP_REFERER'])) {
         $this->redirect($_SERVER['HTTP_REFERER']);
     } else {
         $this->redirect($this->makeURL('alias=' . $this->config('defaultAlias')));
     }
 }
コード例 #3
0
ファイル: class.loader.php プロジェクト: ValenokPC/tabernacms
 public static function getAliasByName(&$aliasname = '')
 {
     $result = self::getAliasRecord($aliasname);
     if (!$result->id || !$result->active) {
         rad_session::setVar('message', $aliasname);
         $aliasname = rad_config::getParam('alias.404');
         $result = self::getAliasRecord(self::$alias);
         header(rad_config::getParam('header.404'));
     }
     if ($result->ali_admin && !rad_session::adminAccess()) {
         rad_session::setVar('message', $aliasname);
         rad_session::logout();
         $aliasname = rad_config::getParam('alias.loginform');
         $result = self::getAliasRecord(self::$alias);
     }
     if ($result->id) {
         $result->includes = array();
         $themeId = $result->themeid ? $result->themeid : 0;
         $sqlParams = array('alias_1_id' => $result->id, 'theme_1_id' => $themeId);
         if ($result->group_id) {
             $sqlParams['alias_2_id'] = $result->group_id;
             $theme2Id = rad_dbpdo::query('SELECT theme_id FROM ' . RAD . 'themes WHERE theme_aliasid=? AND theme_folder=?', array($result->group_id, rad_themer::getCurrentTheme()));
             $theme2Id = !empty($theme2Id['theme_id']) ? (int) $theme2Id['theme_id'] : $themeId;
             $sqlParams['theme_2_id'] = $theme2Id;
         }
         $sql = 'SELECT inc_id,inc_name,inc_filename,controller,order_sort,rp_name,id_module,m_name,params_hash,ina.id as incinal_id,ina.params_presonal as params_presonal, ip.ip_params as original_params ' . 'FROM ' . RAD . 'includes_in_aliases ina ' . 'INNER JOIN ' . RAD . 'includes on include_id=inc_id ' . 'INNER JOIN ' . RAD . 'modules m on m.m_id=id_module ' . 'INNER JOIN ' . RAD . 'positions p on position_id=p.rp_id ' . 'LEFT JOIN ' . RAD . 'includes_params ip on ip.ip_incid=ina.include_id ' . 'WHERE alias_id=:alias_1_id' . ' AND ina.theme_id=:theme_1_id' . ($result->group_id ? ' UNION (SELECT inc_id,inc_name,inc_filename,controller,order_sort,rp_name,id_module,m_name,params_hash,ina.id as incinal_id,ina.params_presonal as params_presonal, ip.ip_params as original_params ' . 'FROM ' . RAD . 'includes_in_aliases ina ' . 'INNER JOIN ' . RAD . 'includes on include_id=inc_id ' . 'INNER JOIN ' . RAD . 'modules m on m.m_id=id_module ' . 'INNER JOIN ' . RAD . 'positions p on position_id=p.rp_id ' . 'LEFT JOIN ' . RAD . 'includes_params ip on ip.ip_incid=ina.include_id ' . 'WHERE alias_id=:alias_2_id' . ' AND ina.theme_id=:theme_2_id' . ')' : '') . ' ORDER BY order_sort, rp_name';
         foreach (rad_dbpdo::queryAll($sql, $sqlParams) as $id) {
             $result->includes[] = new struct_core_include($id);
         }
     } else {
         $result = NULL;
     }
     return $result;
 }
コード例 #4
0
 /**
  * Adds the product from add product form
  * full post request
  */
 function add()
 {
     $parent_id = (int) $this->request('parent_id');
     $this->product = $this->_assignProductFromRequest();
     $this->product->cat_datecreated = now();
     if (!empty($this->product->images_link)) {
         rad_session::setVar('iterator_init', max(array_keys($this->product->images_link)) + 1);
     }
     if ($this->product && $this->checkProduct()) {
         $model = rad_instances::get('model_corecatalog_catalog');
         if ($this->_have_sp or $this->_have_sphit or $this->_have_spnews or $this->_have_spoffer) {
             $model->setState('sp_offers', true);
         }
         $newItem = $model->insertItem($this->product);
         if (rad_config::getParam('cleanurl.on')) {
             rad_cleanurl::setAlias('product', $newItem->cat_id, $this->getContentLangID(), $this->post('url_alias'));
         }
         if ($this->request('returntorefferer') == '0') {
             $url = $this->makeURL('alias=' . SITE_ALIAS);
         } else {
             //if apply clicked
             $url = $this->makeURL('alias=' . SITE_ALIAS . '&action=editform&cat_id=' . $newItem->cat_id);
         }
         if (strlen($parent_id) > 0) {
             $url .= '#nic/' . $parent_id;
         }
         rad_session::setVar('iterator_init', NULL);
         $this->redirect($url);
     }
     return false;
 }
コード例 #5
0
ファイル: class.lang.php プロジェクト: ValenokPC/tabernacms
 /**
  * Change the content language
  * @param integer $newlangId
  * @return boolean
  */
 public static function changeContentLanguage($newlangId)
 {
     foreach (self::$allLanguages as $id) {
         if ($id->lng_id == $newlangId) {
             $user = rad_session::$user;
             if (isset($user->u_id) and $user->u_id) {
                 $paramsobject = rad_session::$user_params;
                 $paramsobject->_set('contentLng', $newlangId, 'string');
                 $user->u_params = $paramsobject->_hash();
                 if (!rad_instances::get('model_core_users')->updateItem($user)) {
                     echo 'alert("can\'t change language! some error!");';
                 }
                 rad_session::setVar('contentLng', $newlangId);
             }
             return rad_session::setVar('contentLng', $newlangId);
         }
     }
     $false = false;
     return $false;
 }