Exemplo n.º 1
0
 function getItem($id = NULL)
 {
     $id = $id ? $id : $this->getState('id');
     $this->setState('id', $id);
     $limit = $this->getState('limit') ? ' LIMIT ' . $this->getState('limit') : '';
     $q = $this->getListQuery($this->getStates());
     $item = new struct_core_alias($this->query($q->toString(), $q->getValues()));
     $theme_id = $item->themeid ? $item->themeid : 0;
     $theme2_id = $theme_id;
     if ($item->group_id) {
         $theme2_id = rad_dbpdo::query('SELECT theme_id FROM ' . RAD . 'themes WHERE theme_aliasid=? AND theme_folder=?', array($item->group_id, $item->themefolder));
         $theme2_id = !empty($theme2_id['theme_id']) ? (int) $theme2_id['theme_id'] : $theme_id;
     }
     if ($this->getState('join.aliasgroup')) {
         $table = new model_core_table('aliases');
         $ali_item = $table->getItem($id);
     }
     if (!$this->getState('without_joins')) {
         foreach ($this->queryAll('select params_presonal,inc_id,inc_name,inc_filename,controller,order_sort,rp_name,rp_id,id_module,m_name,ia.id as incinal_id, ia.params_hash as params_hash, 0 as is_ga ' . ($this->getState('join.original_params', false) ? ', ip_params AS original_params ' : '') . 'from ' . RAD . 'includes_in_aliases ia ' . '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 ' . ($this->getState('join.original_params', false) ? ' left join ' . RAD . 'includes_params ip ON ip.ip_incid=ia.include_id ' : '') . 'where alias_id=' . $id . ' and ia.theme_id=' . $theme_id . (($this->getState('join.aliasgroup') and isset($ali_item) and $ali_item->group_id) ? ' UNION (' . 'select params_presonal,inc_id,inc_name,inc_filename,controller,order_sort,rp_name,rp_id,id_module,m_name,ia.id as incinal_id, ia.params_hash as params_hash, 1 as is_ga ' . ($this->getState('join.original_params', false) ? ', ip_params AS original_params ' : '') . 'from ' . RAD . 'includes_in_aliases ia ' . '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 ' . ($this->getState('join.original_params', false) ? ' left join ' . RAD . 'includes_params ip ON ip.ip_incid=ia.include_id ' : '') . 'where alias_id=' . $ali_item->group_id . ' and ia.theme_id=' . $theme2_id . ')' : '') . ' order by rp_name, order_sort') as $idi) {
             $item->includes[] = new struct_core_include($idi);
             $item->includes[count($item->includes) - 1]->is_ga = (bool) $idi['is_ga'];
         }
     }
     if ($this->getState('join_description')) {
         $wlangid = $this->getState('ald_langid');
         $wlangid = $wlangid ? ' AND ald_langid=' . $wlangid : '';
         foreach ($this->queryAll('SELECT * FROM ' . RAD . 'aliases_description where ald_aliasid=' . $id . $wlangid) as $idd) {
             $item->description[$idd['ald_langid']] = new struct_core_aliases_description($idd);
         }
     }
     return $item;
 }
Exemplo n.º 2
0
 function getItem($id = NULL)
 {
     $id = $id ? $id : $this->getState('id', $this->getState('lng_id', NULL));
     if ($id) {
         $table = new model_core_table('lang');
         return $table->getItem($id);
     } else {
         $this->badRequest(__LINE__);
     }
 }
Exemplo n.º 3
0
 function __construct()
 {
     if ($this->getParamsObject()) {
         $params = $this->getParamsObject();
         $this->_pid = $params->_get('treestart', $this->_pid, $this->getCurrentLangID());
         $this->showfirstifempty = $params->_get('showfirstifempty', $this->showfirstifempty);
         $this->_isshowpage = $params->_get('isshowpage', $this->_isshowpage);
         $this->_assignRubric = $params->_get('assignrubric', $this->_assignRubric, $this->getCurrentLangID());
         $this->setVar('params', $params);
     }
     if ($this->request('cp') or $this->request('pgid') or $this->_assignRubric) {
         $this->assignPage();
         if ($this->getVar('item')) {
             $this->assignRubrics($this->getVar('item'));
             $this->assignSuRubrics($this->getVar('item'));
         }
     } elseif ($this->request('title')) {
         $this->assignPageByName();
         if ($this->getVar('item')) {
             $this->assignRubrics($this->getVar('item'));
             $this->assignSuRubrics($this->getVar('item'));
         }
     } else {
         $this->assignLanguages();
     }
     if ($this->_isshowpage) {
         $table = new model_core_table('pages', 'corearticles');
         $page = $table->getItem($params->pgid);
         $this->setVar('item', $page);
         $this->addBC('pages', array($page));
     } elseif (!$this->_assignRubric) {
         $this->assignMenu();
         if ($this->showfirstifempty and !($this->request('cp') or $this->request('pgid')) and count($this->getVar('items'))) {
             $model = rad_instances::get('model_corearticles_pages');
             $items = $this->getVar('items');
             if (!empty($items)) {
                 $model->setState('tre_id', $items[0]->tre_id);
                 $pages = $model->getItems(1);
                 $this->setVar('pages', $pages);
                 $this->addBC('pages', $pages);
             }
             //if !empty items
         }
     } else {
         $this->setVar('title', rad_instances::get('model_coremenus_tree')->getItem((int) $this->_assignRubric));
     }
     $this->setVar('page', $this->request('page', 0));
 }
Exemplo n.º 4
0
 /**
  * @param struct_core_users $item
  */
 private function sendActivationCode($item)
 {
     rad_instances::get('model_coremail_subscribes')->removeExpired();
     $table = new model_core_table('subscribers_activationurl', 'coremail');
     $table->setStates(array('sac_scrid' => $item->u_id, 'sac_type' => 2, 'email' => $item->u_email, 'date_confirmed' => 0));
     $item_url = $table->getItem();
     if ($item_url->sac_id) {
         if ($item_url->date_created + 300 > time()) {
             // wow, spam
             return;
         }
         $item_url->date_created = time();
         $table->updateItem($item_url);
     } else {
         $item_url = new struct_coremail_subscribers_activationurl();
         $item_url->sac_url = md5(rad_session::genereCode(31) . now() . $item->u_id);
         $item_url->sac_scrid = $item->u_id;
         $item_url->sac_type = 2;
         $item_url->email = $item->u_email;
         $item_url->date_created = time();
         $table->insertItem($item_url);
     }
     rad_mailtemplate::send($item->u_email, $this->config('activate_email.template'), array('user' => $item, 'link' => $this->makeURL('alias=register&c=' . urlencode($item_url->sac_url)), 'clearpass' => ''), 'html');
 }
Exemplo n.º 5
0
 function addComment()
 {
     if ($this->request('hash') != $this->hash()) {
         return $this->redirect('404');
     }
     $item = new struct_coreresource_comments();
     $item->rcm_datetime = now();
     $item->rcm_type = 'product';
     $item->rcm_active = $this->_premoderation ? 0 : 1;
     //$item->rcm_parent_id = 0;
     $item->rcm_parent_id = strip_tags(stripslashes($this->request('parent_id')));
     if ($this->getCurrentUser() and $this->getCurrentUser()->u_id) {
         $item->rcm_nickname = $this->getCurrentUser()->u_login;
         $item->rcm_user_id = $this->getCurrentUser()->u_id;
     } else {
         // @TODO: What really should we do if user is anonymous?
         $item->rcm_nickname = strip_tags(stripslashes($this->request('nickname')));
         $item->rcm_user_id = 0;
     }
     $item->rcm_item_id = (int) $this->request('p');
     $item->rcm_text = strip_tags(stripslashes($this->request('txt')));
     $table = new model_core_table('comments', 'coreresource');
     $table->insertItem($item);
     $item->rcm_id = $table->inserted_id();
     $parentComm = $table->getItem($item->rcm_parent_id);
     $modelUser = rad_instances::get('model_core_users');
     if ($parentComm->rcm_user_id != 0) {
         $userCommParent = $modelUser->getItem($parentComm->rcm_user_id);
         if (filter_var($userCommParent->u_email, FILTER_VALIDATE_EMAIL)) {
             //$link_to_comment = $this->makeURL('alias=product&products_action=i&i='.$item->rcm_id);
             $link_to_comment = $this->makeURL('alias=product&p=' . $item->rcm_item_id);
             $this->_sendMail($userCommParent->u_email, $item->rcm_text, $parentComm->rcm_text, $link_to_comment);
         }
     }
     //$this->_sendMail($parent->rcm_user_id);
 }
Exemplo n.º 6
0
 function assignItems()
 {
     $model = new model_core_table('delivery', 'corecatalog');
     $model->setState('where', 'rdl_lang=' . (int) $this->getContentLangID());
     $items = $model->getItems();
     $this->setVar('items', $items);
 }
Exemplo n.º 7
0
 function newOrdering()
 {
     if ($this->request('hash') == $this->hash()) {
         $new_ordering = (int) $this->request('no');
         $cat_id = (int) $this->request('c');
         if ($cat_id) {
             $product = model_core_table::getInstance('catalog', 'corecatalog')->getItem($cat_id);
             $product->cat_position = $new_ordering;
             $rows = model_core_table::getInstance('catalog', 'corecatalog')->updateItem($product);
             echo 'RADCatalogList.message("' . $this->lang('-saved') . '");';
             echo 'RADCatalogList.refresh();';
         } else {
             $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 8
0
 /**
  * Special offers module, for New products, Sales, hit of sales e t.c.
  *
  * @param unknown_type $item
  */
 function updateOffers(struct_corecatalog_catalog $item)
 {
     $table = new model_core_table('cat_special', 'corecatalog');
     $table->setState('where', 'cs_catid=' . (int) $item->cat_id);
     $offers = $table->getItems();
     $exist_offers = array();
     if (count($offers)) {
         for ($i = 0; $i < count($offers); $i++) {
             $exist_offers[$offers[$i]->cs_type] =& $offers[$i];
         }
     }
     //NEW PRODUCT
     if ($item->cat_special_spnews and !isset($exist_offers[1])) {
         $exist_offers[1] = new struct_corecatalog_cat_special();
         $exist_offers[1]->cs_type = 1;
         $exist_offers[1]->cs_catid = $item->cat_id;
         $exist_offers[1]->insert();
     } elseif (!$item->cat_special_spnews and isset($exist_offers[1])) {
         $exist_offers[1]->remove();
     }
     //SPECIAL OFFER
     if ($item->cat_special_sp and !isset($exist_offers[2])) {
         $exist_offers[2] = new struct_corecatalog_cat_special();
         $exist_offers[2]->cs_type = 2;
         $exist_offers[2]->cs_catid = $item->cat_id;
         $exist_offers[2]->insert();
     } elseif (!$item->cat_special_sp and isset($exist_offers[2])) {
         $exist_offers[2]->remove();
     }
     //SALES
     if ($item->cat_special_spoffer and !isset($exist_offers[3])) {
         $exist_offers[3] = new struct_corecatalog_cat_special();
         $exist_offers[3]->cs_type = 3;
         $exist_offers[3]->cs_catid = $item->cat_id;
         $exist_offers[3]->insert();
     } elseif (!$item->cat_special_spoffer and isset($exist_offers[3])) {
         $exist_offers[3]->remove();
     }
     //HIT OF SALES
     if ($item->cat_special_sphit and !isset($exist_offers[4])) {
         $exist_offers[4] = new struct_corecatalog_cat_special();
         $exist_offers[4]->cs_type = 4;
         $exist_offers[4]->cs_catid = $item->cat_id;
         $exist_offers[4]->insert();
     } elseif (!$item->cat_special_sphit and isset($exist_offers[4])) {
         $exist_offers[4]->remove();
     }
 }
Exemplo n.º 9
0
 /**
  * Assign Votes in category ans for showing on site
  */
 function assignRubricVotes()
 {
     $vt_id = (int) $this->request('v');
     if ($vt_id) {
         $this->setVar('$showOneVote', true);
         $this->showVoteRandom($vt_id);
     } else {
         $table = new model_core_table('votes', 'coreothers');
         $table->setState('where', 'vt_lngid=' . $this->getCurrentLangID() . ' and vt_treid=' . (int) $this->request('vcp', $this->_pid));
         $table->setState('showSQL', true);
         $items = $table->getItems();
         $this->setVar('votes', $items);
     }
 }
Exemplo n.º 10
0
 function deleteItem()
 {
     if ($this->request('hash') != $this->hash()) {
         $this->redirect('404');
     }
     if ((int) $this->request('i')) {
         $table = new model_core_table('comments', 'coreresource');
         $item = $table->getItem((int) $this->request('i'));
         if ($item->rcm_id) {
             $table->deleteItem($item);
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 11
0
 protected function activateUser()
 {
     $c = urldecode($this->request('c'));
     $this->setVar('onlymessage', true);
     if ($c) {
         $this->setVar('action', 'c');
         $model = rad_instances::get('model_core_users');
         $model->setState('code', $c);
         $user = $model->getItem();
         if (isset($user->u_id) and $user->u_id) {
             if ($user->u_email_confirmed) {
                 $table = new model_core_table('subscribers_activationurl', 'coremail');
                 $table->setState('sac_url', $c);
                 $activation = $table->getItem();
                 if ($activation) {
                     if ($model->emailExists($activation->email, $user->u_id)) {
                         $this->setVar('message', $this->lang('mail_alreadyregistred.registration.text', null, true));
                     } else {
                         $user->u_email = $activation->email;
                         $model->updateItem($user);
                         rad_session::updateUserData($user->u_id);
                         rad_instances::get('model_coremail_subscribes')->confirm($c);
                         $this->setVar('message', $this->lang('subscribers.mailactivated.text', null, true));
                     }
                 } else {
                     $this->setVar('message', $this->lang($this->config('registration.code_not_found')));
                 }
             } elseif (!($error = $this->beforeActivateUser($user))) {
                 $user->u_email_confirmed = 1;
                 $model->updateItem($user);
                 rad_instances::get('model_coremail_subscribes')->confirm($c);
                 /* make referals component */
                 if ($this->config('referals.on') and class_exists('struct_coresession_referals_users')) {
                     $this->setReferral($user);
                 }
                 $this->setVar('message', $this->lang($this->config('registration.mailactivated_text')));
                 //send message to user
                 $this->_sendMail($user, 'register_ok');
                 $this->_sendMail($user, 'send_admin');
             } else {
                 $this->setVar('message', is_array($error) ? implode('<br />', $error) : $error);
             }
         } else {
             //code not found
             $this->setVar('message', $this->lang($this->config('registration.code_not_found')));
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 12
0
 function getProductsWithCurrency()
 {
     $cur_id = (int) $this->request('cur_id');
     if ($cur_id) {
         $model = model_core_table::getInstance('catalog', 'corecatalog');
         $model->setState('select', 'count(*)');
         $model->setState('where', 'cat_currency_id=' . $cur_id);
         $cnt = (int) $model->getItem();
         echo $cnt;
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
         echo 'RADCurrency.message("' . $this->lang('-error') . '");';
     }
 }
Exemplo n.º 13
0
 /**
  * Deletes the answer from vote
  * @return JS
  */
 function deleteAnswer()
 {
     if ($this->request('hash') == $this->hash()) {
         $item_id = (int) $this->request('id', $this->request('i'));
         if ($item_id) {
             $model = new model_core_table('votes_questions', 'coreothers');
             $rows = $model->deleteItem(new struct_coreothers_votes_questions(array('vtq_id' => $item_id)));
             echo 'RADVotesQuestions.message("' . addslashes($this->lang('deletedrows.sustem.message')) . ': ' . $rows . '");';
             if ($rows) {
                 echo 'RADVotesQuestions.refresh();';
             }
         } else {
             $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 14
0
 function getItems($limit = NULL)
 {
     $table = new model_core_table('includes');
     $table->setState('left join', RAD . 'modules m on m.m_id = id_module');
     return $table->getItems($limit);
 }
Exemplo n.º 15
0
 /**
  * Copy components from theme
  */
 private function copyComponentsFromTheme()
 {
     $theme = trim($this->request('theme'));
     $alias_id = (int) $this->request('alias_id');
     $from = trim($this->request('from'));
     if ($alias_id && $theme != $from && (!$from || is_dir(THEMESPATH . $from)) && (!$theme || is_dir(THEMESPATH . $theme))) {
         $model = rad_instances::get('model_core_aliases');
         if (strlen($from)) {
             $model->setState('theme', $from);
         }
         $item = $model->getItem($alias_id);
         $struct = new struct_core_includes_in_aliases();
         if ($theme) {
             $table = new model_core_table('themes');
             $table->setState('where', 'theme_aliasid=' . $alias_id . ' and theme_folder="' . $theme . '"');
             $themes_obj = $table->getItem();
             $struct->theme_id = $themes_obj->theme_id;
         }
         $struct->alias_id = $alias_id;
         if (!empty($item->includes)) {
             $this->deleteComponentsFromTheme($alias_id, $theme);
             $ret = true;
             foreach ($item->includes as $include) {
                 /** @var struct_core_include $include */
                 $struct->include_id = $include->inc_id;
                 $struct->controller = $include->controller;
                 $struct->order_sort = $include->order_sort;
                 $struct->position_id = $include->rp_id;
                 $struct->params_hash = $include->params_hash;
                 $model = rad_instances::get('model_core_includes');
                 if (!$model->insertItem($struct)) {
                     $ret = false;
                     break;
                 }
             }
             $this->clearAliasCache(rad_instances::get('model_core_aliases')->getItem($struct->alias_id));
             if (!$ret) {
                 echo "ERROR!!!! '.__LINE__.' Problem in DB";
             }
         } else {
             echo $this->lang('nocomponentstocopy.aliases.error');
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 16
0
 function getItem($id = null)
 {
     $id = $id ? $id : $this->getState('id');
     $table = new model_core_table('langvalues');
     if ($this->getState('lang_id')) {
         $table->setState('lnv_id', $id);
     }
     return $table->getItem($id);
 }
Exemplo n.º 17
0
 function getQuestions($limit = NULL)
 {
     $item_id = (int) $this->getState('item_id', $this->getState('vt_id'));
     if ($item_id) {
         $table = new model_core_table('votes_questions', 'coreothers');
         $table->setState('where', 'vtq_vtid=' . $item_id);
         return $table->getItems($limit);
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 18
0
 /**
  * change the langs from change lang form
  * full post request
  *
  */
 function changeLangs()
 {
     if ($this->request('lang_id')) {
         $langs = model_core_table::getInstance('langvalues')->getItem($this->request('lang_id'));
         $langs->lnv_lang = $this->request('nl');
         $rows = model_core_table::getInstance('langvalues')->updateItem($langs);
         if ($rows) {
             echo 'RADLangList.message("' . $this->lang('-saved') . '");';
             echo 'RADLangList.refresh()';
         } else {
             echo 'RADLangList.message("' . $this->lang('-notsaved') . '");';
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 19
0
 /**
  * Saves the type showed fields
  * @param integer $type_id
  */
 private function saveTypeFieldsShow($type_id)
 {
     if ($type_id) {
         $model = new model_core_table('ct_showing', 'corecatalog');
         $model->setState('where', ' cts_vl_id=' . $type_id . ' ');
         $items = $model->getItems();
         if (count($items)) {
             foreach ($items as $id) {
                 $model->deleteItem($id);
             }
             //foreach
         }
         //if
         $added_items = array();
         if ($this->_showinlist) {
             if ($this->request('CTshowing_showinlist_catalog_option')) {
                 $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showinlistID));
             }
         }
         if ($this->_showindetail) {
             if ($this->request('CTshowing_showindetail_catalog_option')) {
                 $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showindetailID));
             }
         }
         if ($this->_showinbin) {
             if ($this->request('CTshowing_showinbin_catalog_option')) {
                 $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showinbinID));
             }
         }
         $rows = 0;
         if (count($added_items)) {
             foreach ($added_items as $id) {
                 $rows += $model->insertItem($id);
             }
             if (!count($rows)) {
                 throw new rad_exception('Can\'t save the showing type! file: ' . __FILE__ . ', line: ' . __LINE__);
             }
             return $rows;
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
Exemplo n.º 20
0
 function __construct()
 {
     if ($this->getParamsObject()) {
         $params = $this->getParamsObject();
         $this->setVar('params', $params);
     }
     $this->setVar('hash', $this->hash());
     if ($this->request('action')) {
         $this->addBC('action', $this->request('action'));
         $this->setVar('action', $this->request('action'));
         switch ($this->request('action')) {
             case 'install':
                 break;
             case 'network':
                 break;
             case 'getjs':
                 $this->setVar('main_action', $this->request('ma'));
                 $this->setVar('current_lang', $this->getCurrentLang());
                 break;
             case 'getnodes':
                 if ($this->request('ma') == 'install') {
                     $this->getLocalNodes();
                 } elseif ($this->request('ma') == 'network') {
                     $this->getNetworkNodes();
                 } else {
                     $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
                 }
                 break;
             case 'getinc':
                 //GETS the include
                 $this->getIncludeInfo();
                 break;
             case 'getmod':
                 //Gets the module
                 $this->setVar('subaction', 'getmod');
                 if ((int) $this->request('i')) {
                     $table = new model_core_table('modules');
                     $this->setVar('item', $table->getItem((int) $this->request('i')));
                 } else {
                     $this->setVar('i', $this->request('i'));
                 }
                 break;
             case 'getxmlparamsstring':
                 $this->getXMLParamsString();
                 break;
             case 'getParamsSettings':
                 $this->getParamsSettings();
                 break;
             case 'savexmlparamsstring':
                 $this->saveXMLParamsString();
                 break;
             case 'getfullxmlparams':
                 $this->getFullXMLParamsString();
                 break;
             case 'savefullxmlparams':
                 $this->saveFullXMLParamsString();
                 break;
             case 'installXML':
                 $this->installXML();
                 break;
             case 'saveinclude':
                 echo $this->saveInclude();
                 break;
             case 'getfile':
                 $this->setVar('params', '');
                 $system = new stdClass();
                 $system->module = new stdClass();
                 $system->module->folder = $this->request('folder');
                 $system->module->filename = $this->request('fn');
                 $this->setVar('system', $system);
                 $names = new stdClass();
                 $names->url = 'http://';
                 $this->setVar('names', $names);
                 break;
             case 'validateXML':
                 $this->validateXML();
                 break;
             case 'deleteComponent':
                 $this->deleteComponent();
                 break;
             default:
                 $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
                 break;
         }
     }
 }
Exemplo n.º 21
0
 function showFullComments()
 {
     if (!$this->request('t', false)) {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
     if (!(int) $this->request('item', false)) {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
     $this->setVar('typ', $this->request('t'));
     //Временная заглушка безопасности
     switch ($this->getVar('typ')) {
         case 'folknews':
         case 'news':
             $tbi = new model_core_table('news', 'corearticles');
             $toItem = $tbi->getItem((int) $this->request('item'));
             $this->setVar('item_title', $toItem->nw_title);
             $this->addBC('item_title', $toItem->nw_title);
             break;
         case 'articles':
             $tbi = new model_core_table('articles', 'corearticles');
             $toItem = $tbi->getItem((int) $this->request('item'));
             $this->setVar('item_title', $toItem->art_title);
             $this->addBC('item_title', $toItem->art_title);
             break;
         case 'product':
             $tbi = new model_core_table('catalog', 'corecatalog');
             $toItem = $tbi->getItem((int) $this->request('item'));
             $this->setVar('item_title', $toItem->cat_name);
             $this->addBC('item_title', $toItem->cat_name);
             break;
         default:
             $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
             break;
     }
     //switch
     $this->setVar('to_item', $toItem);
     $this->setVar('item_id', (int) $this->request('item'));
     $model = rad_instances::get('model_coreresource_comments')->setState('order by', 'rcm_datetime DESC')->setState('item_id', (int) $this->getVar('item_id'))->setState('type', $this->getVar('typ'))->setState('active', 1);
     //GETS THE COUNT
     $model->setState('select', 'count(*)');
     $itemsCount = $model->getItems();
     $model->unsetState('select');
     $limit = $this->_itemsperpage;
     if ((int) $this->request('page')) {
         $limit = ((int) $this->request('page') - 1) * $this->_itemsperpage . ',' . $this->_itemsperpage;
     }
     $this->setVar('items', $model->getItems($limit));
     $gp = 'comments_action=f&t=' . $this->request('t') . '&item=' . (int) $this->request('item') . '';
     $this->setVar('paginator', new rad_paginator(array('total' => $itemsCount, 'itemsperpage' => $this->_itemsperpage, 'getparams' => $gp)));
 }
Exemplo n.º 22
0
 function getItems()
 {
     $model = new model_core_table('measurement', 'corecatalog');
     $model->setState('where', 'ms_langid=' . (int) $this->getContentLangID());
     $this->setVar('items', $model->getItems());
 }