/**
  *                     $product_list_params_obj
  *        PRODUCT_LIST_PARAMS   default                              .
  *
  *                                               $product_list_params_obj
  *                              .                             $product_list_params_obj
  *                 default                                                          ,
  *                                  . .
  *
  *    22        2009, Default                                                  :
  * -                           HOME                       ,
  * -                      - SORT_BY_PRODUCT_SORT_ORDER,  . .   ,                  AZ
  * -               ,  . .
  * -                  Customer Zone,                   online          ,
  * -                  Customer Zone,
  *                        HOME,  . .                         ,
  *             ,                                   ,
  * -                  Customer Zone     General Settings        ,
  *                     ,                                           :           Quantity
  *                                           ,                                                    ,
  *                                .
  *
  * @return CProductListFilter
  */
 function CProductListFilter()
 {
     global $application;
     $this->product_list_params_obj = new PRODUCT_LIST_PARAMS();
     $this->product_list_params_obj->category_id = 1;
     $this->product_list_params_obj->select_mode_recursiveness = IN_CATEGORY_ONLY;
     if (modApiFunc('Users', 'getZone') == "CustomerZone") {
         $this->product_list_params_obj->membership_filter = true;
         //                                           ,
         // Bestsellers, Related Products, Featured Products, Random Set
         $product_type_filter = modApiFunc('Catalog', 'getCurrentProductTypeFilter');
         if (is_array($product_type_filter) && !empty($product_type_filter)) {
             $this->product_list_params_obj->filter_product_type_id_list = $product_type_filter;
         }
         $this->product_list_params_obj->select_online_products_only = true;
         if (modApiFunc("Configuration", "getValue", SYSCONFIG_STORE_SHOW_ABSENT) == STORE_SHOW_ABSENT_NOT_SHOW_NOT_BUY) {
             $this->product_list_params_obj->filter_stock_level_min = 1;
         }
         $sort_by_from_config = $application->getAppIni('PRODUCT_LIST_SORTER_DEFAULT');
         $this->product_list_params_obj->sort_by = $sort_by_from_config;
         //                                  Storefront
         loadClass('CCategoryInfo');
         $cat =& $application->getInstance('CCategoryInfo', 1);
         if ($cat->getShowProductsRecursivelyStatus() == CATEGORY_SHOW_PRODUCTS_RECURSIVELY) {
             $this->product_list_params_obj->select_mode_recursiveness = IN_CATEGORY_RECURSIVELY;
         }
     } else {
         $this->product_list_params_obj->sort_direction = 'ASC';
     }
 }
Ejemplo n.º 2
0
 public function doLogin()
 {
     $curlObj = loadClass('zhCurl');
     //获取登陆页
     $loginSite = "https://www.zhihu.com/";
     $loginHtml = $curlObj->getWebPage($loginSite);
     $html = loadClass('parserDom', $loginHtml['content']);
     $xsrf = $html->find('input[name=_xsrf]', 0)->getAttr('value');
     unset($html);
     //获取验证码并从CLI输入
     $captcha = "https://www.zhihu.com/captcha.gif?r=" . time() . rand(200, 999);
     $result = $curlObj->getWebPage($captcha);
     $captchaFile = dirname(__FILE__) . '/../res/login.gif';
     $handle = fopen($captchaFile, 'w+');
     fwrite($handle, $result['content']);
     fclose($handle);
     fwrite(STDOUT, "Pleate check the login.gif in project 'res' foler and enter it:\n");
     $captchaContent = trim(fgets(STDIN));
     $postParam = array('_xsrf' => $xsrf, 'email' => getConfig('zhAccount'), 'password' => getConfig('zhPassword'), 'remember_me' => 'true', 'captcha' => $captchaContent);
     $postUrl = 'https://www.zhihu.com/login/email';
     $result = $curlObj->getWebPage($postUrl, array(CURLOPT_POSTFIELDS => buildParamFromArray($postParam)));
     $loginResult = json_decode($result['content'], TRUE);
     if ($loginResult['r'] == 0) {
         fwrite(STDOUT, "Login Success\n");
     } else {
         fwrite(STDOUT, "Login Failed: {$loginResult['msg']}\n");
     }
     return $xsrf;
 }
 /**
  * The view constructor.
  *
  * @ finish the functions on this page
  */
 function NavigationBar()
 {
     global $application;
     $this->pCatalog =& $application->getInstance('Catalog');
     $this->mTmplFiller =& $application->getInstance('TmplFiller');
     loadClass('CategoriesBrowserDynamic');
 }
Ejemplo n.º 4
0
 function onAction()
 {
     $request = new Request();
     $category_id = $request->getValueByKey('category_id');
     /*
      *       :
      *                                                     ,                     .
      *                                                         default
      *               AZ (                                 AZ).
      *
      *        :
      *                   Catalog::getProductListByGlobalFilter       ,
      *                                                                                      .
      *                                 default                     .
      */
     //              default
     loadClass('CProductListFilter');
     $f = new CProductListFilter();
     $params = $f->getProductListParamsObject();
     $params->category_id = $category_id;
     $params->select_mode_recursiveness = IN_CATEGORY_ONLY;
     //
     $products_array = modApiFunc('Catalog', 'getProductListByFilter', $params, RETURN_AS_ID_LIST);
     $products = array();
     if (!empty($products_array)) {
         foreach ($products_array as $pinfo) {
             $obj = new CProductInfo($pinfo['product_id']);
             $products[] = array('id' => $pinfo['product_id'], 'name' => $obj->getProductTagValue('Name'));
         }
     }
     global $_RESULT;
     $_RESULT['products'] = $products;
 }
Ejemplo n.º 5
0
 public function getList($page)
 {
     $url = $this->answerUrl . '?page=' . $page;
     $result = $this->curlObj->getWebPage($url, array(CURLOPT_HTTPGET => TRUE));
     $result['content'];
     $webSite = loadClass('parserDom', $result['content']);
     $webSite->find("#zh-profile-answer-list");
     $webSite = loadClass('parserDom', $result['content']);
     $answerList = $webSite->find("#zh-profile-answer-list", 0)->getChildList();
     unset($webSite);
     foreach ($answerList as $key => $val) {
         $arrInf = array();
         $tmp = $val->firstChild()->firstChild();
         $arrTmp = $this->dealAnswerHref($tmp->getAttr("href"));
         $arrInf['iQuestionId'] = $arrTmp['iQuestionId'];
         $arrInf['sContent'] = $tmp->getPlainText();
         $arrInf['sQuestionURL'] = $arrTmp['sQuestionURL'];
         $this->dbModel->addQuestion($arrInf);
         $arrInf = array('iQuestionId' => $arrTmp['iQuestionId'], 'iAnswerId' => $arrTmp['iAnswerId'], 'sAnswerURL' => $arrTmp['sAnswerURL']);
         unset($tmp, $arrTmp);
         $arrInf['sHashId'] = $this->hashId;
         $arrInf['sContent'] = ($tmp = $val->find("div.zm-item-rich-text", 0)) && ($tmp2 = $tmp->firstChild()) ? $tmp2->getPlainText() : '';
         $arrInf['iVoteUp'] = ($tmp = $val->find("button.up", 0)) && ($tmp2 = $tmp->getChild(1)) ? $tmp2->getPlainText() : 0;
         $this->dbModel->addAnswer($arrInf);
     }
 }
 function onAction()
 {
     loadClass('GiftCertificateCreator');
     $cr = new GiftCertificateCreator();
     //                                    ,                .             ,
     //         $map                 $_POST          .
     //                              ,                     .
     $cr->initByMap($_POST);
     //                     .
     $cr->save();
     if ($cr->isError()) {
         modApiFunc('Session', 'set', 'gc_update_action_result', 'failed');
         modApiFunc('Session', 'set', 'gc_update_action_errors', $cr->errors);
         modApiFunc('Session', 'set', 'SessionPost', $_POST);
     } else {
         modApiFunc('Session', 'set', 'gc_update_action_result', 'created');
         if ($cr->sendtype === GC_SENDTYPE_EMAIL && $cr->status === GC_STATUS_ACTIVE) {
             modApiFunc('EventsManager', 'throwEvent', 'GiftCertificateCreated', $cr);
         }
         $request = new Request();
         $request->setView('GiftCertificateEditView');
         $request->setKey('gc_code', $cr->code);
         global $application;
         $application->redirect($request);
     }
 }
 function onAction()
 {
     $gc_code = modApiFunc('Request', 'getValueByKey', 'gc_code');
     if (Validator::isNotEmpty($gc_code) && modApiFunc('GiftCertificateApi', 'isCodeValid', $gc_code) && modApiFunc('GiftCertificateApi', 'doesCodeExist', $gc_code)) {
         loadClass('GiftCertificateUpdater');
         //
         $cr = new GiftCertificateUpdater($gc_code);
         //         ,
         if ($cr->isError()) {
             modApiFunc('Session', 'set', 'gc_update_action_result', 'failed');
             modApiFunc('Session', 'set', 'gc_update_action_errors', $cr->errors);
             modApiFunc('Session', 'set', 'SessionPost', $_POST);
             return;
         }
         //                                    ,                .             ,
         //         $map                 $_POST          .
         //                              ,                     .
         $cr->initByMap($_POST);
         //                     .
         $cr->save();
         if ($cr->isError()) {
             modApiFunc('Session', 'set', 'gc_update_action_result', 'failed');
             modApiFunc('Session', 'set', 'gc_update_action_errors', $cr->errors);
             modApiFunc('Session', 'set', 'SessionPost', $_POST);
         } else {
             modApiFunc('Session', 'set', 'gc_update_action_result', 'updated');
             if ($cr->sendtype === GC_SENDTYPE_EMAIL && $cr->status === GC_STATUS_ACTIVE) {
                 modApiFunc('EventsManager', 'throwEvent', 'GiftCertificateCreated', $cr);
             }
         }
     }
 }
Ejemplo n.º 8
0
 public function __construct()
 {
     $param = loadClass('param');
     define('M', $param->m());
     define('C', $param->c());
     define('A', $param->a());
     $this->init();
 }
Ejemplo n.º 9
0
 function output()
 {
     global $application;
     loadClass('GiftCertificateCreator');
     loadClass('GiftCertificateApi');
     $application->registerAttributes(array('Local_Items', 'Local_GC_id', 'Local_GC_Code', 'Local_GC_From', 'Local_GC_To', 'Local_GC_Amount', 'Local_GC_Remainder', 'Local_GC_Sendtype', 'Local_GC_Status', 'Local_GC_date_Created', 'AddGiftCertificateHref', 'Local_Dell_GC_Href'));
     $res = $this->filler->fill("", "container.tpl.html", array());
     return $res;
 }
 function CProductSetTagSettings()
 {
     global $application;
     $this->template = array('Directory' => 'catalog/product-set/default/', 'Container' => 'product-set-container.tpl.html', 'ContainerEmpty' => 'product-set-container-empty.tpl.html', 'Item' => 'product-set-item.tpl.html', 'ItemOutOfStock' => 'product-set-item-out-of-stock.tpl.html');
     //                c default
     loadClass('CProductListFilter');
     $f = new CProductListFilter();
     $this->filter = $f->getProductListParamsObject();
     $this->filter->use_paginator = true;
 }
Ejemplo n.º 11
0
 public function login()
 {
     if (isset($_GET['dosubmit'])) {
         echo '<pre>';
         print_r($_GET);
     } else {
         loadClass('form', '', 0);
         include $this->tpl('login');
     }
 }
Ejemplo n.º 12
0
 public static function checkRights($page, $action, $token)
 {
     loadClass('status');
     loadClass('token');
     loadClass('action');
     loadClass('right');
     loadClass('customer');
     if (is_null($action)) {
         Functions::setResponse(400);
     }
     $pagename = str_replace('.php', '', basename($page));
     $actionName = $pagename . '-' . $action;
     $whereClause = 'name=:name';
     $params = array(array('id' => ':name', 'value' => $actionName));
     $result = Action::search($whereClause, $params);
     if (!count($result)) {
         echo 'Please update actions and rights!';
         Functions::setResponse(500);
     }
     $action = $result[0];
     define('LOGGED_OUT_STATUS', 'standard');
     $loggedOut = false;
     if (is_null($token) || strtolower($token) == 'none') {
         $loggedOut = true;
     } else {
         $whereClause = 'value=:value';
         $params = array(array('id' => ':value', 'value' => $token));
         $result = Token::search($whereClause, $params);
         if (!count($result)) {
             Functions::setResponse(498);
         } else {
             $token = $result[0];
             $customer = new Customer($token->get('customerId'));
             $status = new Status($customer->get('statusId'));
         }
     }
     if ($loggedOut) {
         $whereClause = 'name=:name';
         $params = array(array('id' => ':name', 'value' => LOGGED_OUT_STATUS));
         $result = Status::search($whereClause, $params);
         if (!count($result)) {
             Functions::setResponse(500);
         }
         $status = $result[0];
     }
     $whereClause = 'action_id=:action_id AND status_id=:status_id';
     $params = array(array('id' => ':action_id', 'value' => $action->get('id')), array('id' => ':status_id', 'value' => $status->get('id')));
     $result = Right::search($whereClause, $params);
     if (!count($result)) {
         Functions::setResponse(401);
     }
     if ($result[0]->get('right') == 'deny') {
         Functions::setResponse(401);
     }
 }
Ejemplo n.º 13
0
 function getCurrentGC()
 {
     loadClass('GiftCertificateCreator');
     $gc = new GiftCertificateCreator();
     if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
         $SessionPost = modApiFunc('Session', 'get', 'SessionPost');
         modApiFunc('Session', 'un_Set', 'SessionPost');
         $gc->initByMap($SessionPost);
     }
     return $gc;
 }
 function prepareData()
 {
     loadClass('CProductInfo');
     $this->__source->run();
     $render_data = array();
     while ($row = $this->__source->fetchRecord()) {
         $row['date'] = $this->__prepareDateToDisplay($row);
         $render_data[] = $row;
     }
     $this->__render_settings->setReportData($render_data);
 }
 /**
  *            .                                               .
  *                       (                 transaction tracking
  *       ) -                                        :
  *                            .
  */
 function TransactionTracking()
 {
     $BundledModules = TransactionTracking::getBundledModules();
     $InstalledModules = TransactionTracking::getInstalledModules();
     foreach ($BundledModules as $bundled_module_id) {
         if (!isset($InstalledModules[$bundled_module_id])) {
             //                        .
             loadClass('TransactionTrackingInstaller');
             TransactionTrackingInstaller::intstallModule($bundled_module_id);
         }
     }
 }
 /**
  * The main function to output the viewer
  */
 function output()
 {
     global $application;
     // filling params for product browser
     $pb_params = array('show_category_path' => true, 'buttons' => array('add' => array('label' => 'BTN_SELECT', 'callback' => 'selectProduct(%PID%, %PNAME%);', 'default_state' => 'disabled', 'enable_condition' => 'product_selected')), 'choosed_control_array' => 'product_array');
     // creating product browser class
     loadClass('ProductsBrowser');
     $this->pb_obj = new ProductsBrowser();
     $template_contents = array('Local_ProductsBrowser' => $this->pb_obj->output($pb_params), 'CallbackForm' => $this->_formname, 'CallbackIDField' => $this->_pidfield, 'CallbackNameField' => $this->_pnamefield, 'CallbackFunction' => $this->_use_callback, 'PrefilledPID' => $this->_prefilledPID);
     $this->_Template_Contents = $template_contents;
     $application->registerAttributes($this->_Template_Contents);
     return $this->mTmplFiller->fill('customer_reviews/select_product/', 'container.tpl.html', array());
 }
Ejemplo n.º 17
0
 public function connect($setting)
 {
     $object = null;
     switch ($this->_config[$setting]['type']) {
         case 'mysqli':
             $object = loadClass('mysqli_db');
             break;
         default:
             $object = loadClass('mysqli_db');
     }
     $object->open($this->_config[$setting]);
     //尝试连接数据库
     return $object;
 }
Ejemplo n.º 18
0
 function init()
 {
     loadClass($this->__source_class_name);
     loadClass($this->__render_settings_class_name);
     loadClass($this->__render_class_name);
     $source_class = $this->__source_class_name;
     $this->__source = new $source_class();
     $this->initSource();
     $settings_class = $this->__render_settings_class_name;
     $this->__render_settings = new $settings_class();
     $this->__render_settings->setReportID(get_class($this));
     $render_class = $this->__render_class_name;
     $this->__render = new $render_class();
 }
 function install()
 {
     $query = new DB_Table_Create(Notifications::getTables());
     loadClass('Notifications_Installer');
     $installer = new Notifications_Installer();
     $installer->doInstall();
     $param_info = array('GROUP_NAME' => 'TIMELINE', 'PARAM_NAME' => 'LOG_EMAIL_SEND', 'PARAM_DESCRIPTION' => array('NAME' => array('NTFCTN', 'ADV_CFG_LOG_EMAIL_SEND_NAME'), 'DESCRIPTION' => array('NTFCTN', 'ADV_CFG_LOG_EMAIL_SEND_DESCR')), 'PARAM_TYPE' => PARAM_TYPE_LIST, 'PARAM_VALUE_LIST' => array(array('VALUE' => 'NO', 'VALUE_DESCRIPTION' => array('NAME' => array('NTFCTN', 'ADV_CFG_LOG_EMAIL_SEND_NO'), 'DESCRIPTION' => array('NTFCTN', 'ADV_CFG_LOG_EMAIL_SEND_NO'))), array('VALUE' => 'YES', 'VALUE_DESCRIPTION' => array('NAME' => array('NTFCTN', 'ADV_CFG_LOG_EMAIL_SEND_YES'), 'DESCRIPTION' => array('NTFCTN', 'ADV_CFG_LOG_EMAIL_SEND_YES')))), 'PARAM_CURRENT_VALUE' => 'YES', 'PARAM_DEFAULT_VALUE' => 'YES');
     modApiFunc('Settings', 'createParam', $param_info);
     $group_info = array('GROUP_NAME' => 'EMAIL_NOTIFICATION_SETTINGS', 'GROUP_DESCRIPTION' => array('NAME' => array('NTFCTN', 'ADV_CFG_NTFCTN_SETTINGS_GROUP_NAME'), 'DESCRIPTION' => array('NTFCTN', 'ADV_CFG_NTFCTN_SETTINGS_GROUP_DESCR')), 'GROUP_VISIBILITY' => 'SHOW');
     /*@ add to constants */
     modApiFunc('Settings', 'createGroup', $group_info);
     $param_info = array('GROUP_NAME' => $group_info['GROUP_NAME'], 'PARAM_NAME' => 'EMAIL_NOTIFICATION_FORMAT', 'PARAM_DESCRIPTION' => array('NAME' => array('NTFCTN', 'ADV_EMAIL_NOTIFICATION_NAME'), 'DESCRIPTION' => array('NTFCTN', 'ADV_EMAIL_NOTIFICATION_DESCR')), 'PARAM_TYPE' => PARAM_TYPE_LIST, 'PARAM_VALUE_LIST' => array(array('VALUE' => 'TEXT', 'VALUE_DESCRIPTION' => array('NAME' => array('NTFCTN', 'ADV_CFG_EMAIL_TEXT'), 'DESCRIPTION' => array('NTFCTN', 'ADV_CFG_EMAIL_TEXT'))), array('VALUE' => 'HTML', 'VALUE_DESCRIPTION' => array('NAME' => array('NTFCTN', 'ADV_CFG_EMAIL_HTML'), 'DESCRIPTION' => array('NTFCTN', 'ADV_CFG_EMAIL_HTML')))), 'PARAM_CURRENT_VALUE' => 'TEXT', 'PARAM_DEFAULT_VALUE' => 'TEXT');
     modApiFunc('Settings', 'createParam', $param_info);
 }
Ejemplo n.º 20
0
 private function _controller_init()
 {
     $classes = array('bank' => 'Bank', 'output' => 'Output', 'view' => 'View');
     foreach ($classes as $var => $class) {
         $this->{$var} =& loadClass($class);
     }
     $_toload = $this->bank->retrieve('config', 'functionality');
     if ($_toload != null && is_array($_toload)) {
         foreach ($_toload as $_toloado) {
             $this->{$_toloado} =& loadClass($_toloado);
         }
         unset($_toloado);
     }
     unset($_toload);
 }
Ejemplo n.º 21
0
 function onAction()
 {
     $request = new Request();
     $tree_str = $request->getValueByKey('tree_str');
     $tree_id = $request->getValueByKey('tree_id');
     $ctg_id = $request->getValueByKey('ctg_id');
     modApiFunc('Catalog', 'saveFullCategoriesStructure', $tree_str);
     modApiFunc('CProductListFilter', 'changeCurrentCategoryId', $ctg_id);
     global $_RESULT;
     loadClass('CategoriesBrowserDynamic');
     $cb_obj = new CategoriesBrowserDynamic(CB_MODE_MANAGE, $tree_id);
     $_RESULT['tree_json'] = $cb_obj->outputJSON();
     $_RESULT['ctg_id'] = modApiFunc('Catalog', 'getEditableCategoryID');
     $_RESULT['tree_id'] = $tree_id;
 }
Ejemplo n.º 22
0
 /**
  * load a model, stores it in $this-model, and returns it.
  * @param  [type]  $className [description]
  * @param  boolean $refName   [description]
  * @return [type]             [description]
  */
 public function loadModel($className, $refName = false)
 {
     // two versions of loaded model: with reference, and..without reference
     if ($refName) {
         $key = $refName;
     } else {
         $key = $modelName;
     }
     try {
         $this->model[$key] = loadClass($modelName, APP . Config::$model_path);
     } catch (ClassNotFoundException $e) {
         exit($e->getMessage());
     }
     return $this->model[$key];
 }
Ejemplo n.º 23
0
function findClass($names)
{
    for ($i = 0; $i < count($names); $i++) {
        if ($i + 1 == count($names)) {
            $class = $names[$i];
        } else {
            if ($i > 0) {
                if (isset($classPath)) {
                    $classPath .= DIRECTORY_SEPARATOR . $names[$i];
                } else {
                    $classPath = $names[$i];
                }
            }
        }
    }
    loadClass($class, $classPath);
}
Ejemplo n.º 24
0
 public function run()
 {
     $dbModel = loadClass('DBModel');
     $userPageParam = array();
     while (1) {
         //若为空则尝试自动获取
         if (count($userPageParam) <= 0 || !isset($userPageParam['url'])) {
             $userPageParam = $dbModel->getNext();
         }
         if (is_array($userPageParam) && count($userPageParam) > 0) {
             logMsg(SL_DEBUG, "Start to handle user : " . json_encode($userPageParam));
             loadClass('userPage', $userPageParam);
             $userPageParam = array();
         }
         usleep(500);
     }
 }
Ejemplo n.º 25
0
 public function getList($param)
 {
     $result = $this->curlObj->getWebPage($this->webUrl, array(CURLOPT_POSTFIELDS => $param));
     $content = json_decode($result['content'], TRUE);
     if (!empty($content['msg']) && $content['r'] == 0) {
         foreach ($content['msg'] as $val) {
             $webSite = loadClass('parserDom', str_replace(PHP_EOL, '', $val));
             $arrInf['hashId'] = $webSite->find("button.zm-rich-follow-btn", 0)->getAttr("data-id");
             $arrInf['url'] = $webSite->find("a.zg-link", 0)->getAttr("href") . '/followees';
             unset($webSite);
             $this->dbModel->addWait($arrInf['hashId'], $arrInf);
         }
         return TRUE;
     } else {
         return FALSE;
     }
 }
Ejemplo n.º 26
0
 function output()
 {
     loadClass('COrderTotalStatisticsByDays');
     $source = new COrderTotalStatisticsByDays();
     $period = modApiFunc('Reports', 'getTimestampPeriodByDatetimeLabel', DATETIME_PERIOD_DAY_THIS);
     if ($period !== null) {
         list($from, $to) = $period;
         $source->setDatetimePeriod(toMySQLDatetime($from), toMySQLDatetime($to));
     }
     $source->run();
     $row = $source->fetchRecord();
     if (isset($row['order_qty'])) {
         return modApiFunc("Localization", "num_format", $row['order_qty']);
     } else {
         return '';
     }
 }
Ejemplo n.º 27
0
 public function input($value)
 {
     $value = htmlspecialchars(strip_tags(trim($value), $tags));
     if (get_magic_quotes_gpc()) {
         $value = stripslashes($value);
     }
     if (!is_numeric($value)) {
         if (!isset($this->db)) {
             if ($_bank_inst->retrieve('db')) {
                 $this->db =& loadClass('db');
                 $value = mysqli_real_escape_string($this->db->conn, $value);
             }
         } else {
             $value = mysqli_real_escape_string($this->db->conn, $value);
         }
     }
     return $value;
 }
 function onAction()
 {
     global $zone;
     if ($zone == 'AdminZone') {
         $request_method = $this->_getRequestedMethod();
         if ($request_method == null) {
             $e = new REST_Errors();
             $e->UndefinedRequestType();
             $e->send();
             return;
         }
         $rest_query = $this->_getRESTQuery();
         if ($rest_query == false) {
             $e = new REST_Errors();
             $e->UndefinedRESTQuery();
             $e->send();
             return;
         }
         $handler = modApiFunc('RESTManager', 'getHandler', $request_method, $rest_query);
         if ($handler == null) {
             $e = new REST_Errors();
             $e->UndefinedHandler();
             $e->send();
             return;
         }
         $h_class = $handler['handler'][0];
         $h_method = $handler['handler'][1];
         loadClass($h_class);
         if (!class_exists($h_class)) {
             $e = new REST_Errors();
             $e->UndefinedHandlerClass();
             $e->send();
             return;
         }
         $o = new $h_class();
         $o->{$h_method}($handler['param']);
         $o->send();
         exit(0);
     }
 }
Ejemplo n.º 29
0
 /**
  * The view constructor.
  *
  * @ finish the functions on this page
  */
 function ProductList()
 {
     $this->CatID = modApiFunc('CProductListFilter', 'getCurrentCategoryId');
     $this->_Cat_Info = new CCategoryInfo($this->CatID);
     $this->psf_filter = array();
     if (modApiFunc('Session', 'is_set', 'SearchProductFormFilter')) {
         // if product search form is used
         $this->psf_filter = modApiFunc('Session', 'get', 'SearchProductFormFilter');
         // getting the PRODUCT_LIST_PARAMS object to manipulate
         $obj_params = new PRODUCT_LIST_PARAMS();
         $obj_params->category_id = 1;
         $obj_params->select_mode_recursiveness = IN_CATEGORY_RECURSIVELY;
         $obj_params->product_id_list_to_select = $this->psf_filter['result'];
         $obj_params->use_paginator = true;
         // setting the paginator
         $this->paginator_name = 'Catalog_ProdsList_PSF_' . count($this->psf_filter['result']);
         $paginator = modApiFunc('paginator', 'setCurrentPaginatorName', $this->paginator_name);
         // getting the products
         $this->pl = modApiFunc('Catalog', 'getProductListByFilter', $obj_params);
         $this->ProdNumInCat = count($this->psf_filter['result']) - 1;
     } else {
         // otherwise browsing by category
         $this->paginator_name = 'Catalog_ProdsList_' . $this->CatID;
         $paginator = modAPIFunc('paginator', 'setCurrentPaginatorName', $this->paginator_name);
         $this->pl = modApiFunc('Catalog', 'getProductListByGlobalFilter', PAGINATOR_ENABLE, RETURN_AS_ID_LIST);
         $this->ProdNumInCat = $this->_Cat_Info->getCategoryTagValue('productsnumber');
     }
     $SizeOfList = sizeof($this->pl);
     $paginator_offset = modApiFunc('paginator', 'getCurrentPaginatorOffset');
     if ($paginator_offset >= 0 && sizeof($this->pl) > 0) {
         $this->From = 1 + $paginator_offset;
         $this->To = -1 + $this->From + sizeof($this->pl);
     } else {
         $this->From = 0;
         $this->To = 0;
     }
     $this->_build_cats_paths();
     loadClass('CategoriesBrowser');
     $this->cb_params = array('show_category_path' => true, 'category_path_prefix' => '', 'show_products_count' => true, 'buttons' => array());
 }
 function output()
 {
     global $application;
     $this->msg_res =& $application->getInstance('MessageResources');
     $this->category_id = modApiFunc('CProductListFilter', 'getCurrentCategoryId');
     loadClass('CCategoryInfo');
     $cat_info = new CCategoryInfo($this->category_id);
     $this->_Current_Category =& $cat_info;
     $i_w = $cat_info->getCategoryTagValue('SmallImageWidth');
     $i_h = $cat_info->getCategoryTagValue('SmallImageHeight');
     $i_url = $cat_info->getCategoryTagValue('SmallImageSrc');
     if ($i_url == '' || $i_w == 0 || $i_h == 0) {
         $i_w = 100;
         $i_h = 100;
         $i_url = $this->no_image_url;
     }
     $cat_info->setAdditionalCategoryTag('AttributeImageWidth', $i_w);
     $cat_info->setAdditionalCategoryTag('AttributeImageHeight', $i_h);
     $cat_info->setAdditionalCategoryTag('AttributeImageURL', $i_url);
     $cat_info->setAdditionalCategoryTag('CategoryStatus', $cat_info->getCategoryTagValue('status', CATEGORYINFO_LOCALIZED_DATA));
     $application->registerAttributes($cat_info->getAdditionalCategoryTagList());
     $application->registerAttributes(array('CategoryProducts', 'CategoryProductsRec', 'FeaturedProducts', 'BestsellersProducts'));
     return modApiFunc('TmplFiller', 'fill', "catalog/category_review/", "review.tpl.html", array());
 }