Exemplo n.º 1
0
 /**
  * Parse the string using the given parser. If a match has been found, move the cursor to the last symbol of the
  * matched string.
  *
  * @param CParser   $parser
  * @param int       $tokenType
  *
  * @return CParserResult|bool		CParserResult object if a match has been found, false otherwise
  */
 protected function parseUsing(CParser $parser, $tokenType)
 {
     $j = $this->pos;
     $result = $parser->parse($this->expression, $j);
     if (!$result) {
         return false;
     }
     $this->pos += $result->length - 1;
     $this->result->addToken($tokenType, $result->match, $result->pos, $result->length);
     return $result;
 }
Exemplo n.º 2
0
$GLOBALS['smarty']->assign('prj_dir', $PRJ_DIR);
$GLOBALS['smarty']->assign('prj_ref', $PRJ_REF);
$GLOBALS['smarty']->assign('lib_dir', $LIB_DIR);
$GLOBALS['smarty']->assign('lib_ref', $LIB_REF);
$GLOBALS['smarty']->assign('theme_dir', $THEME_DIR);
$GLOBALS['smarty']->assign('theme_ref', $THEME_REF);
inc_lib('AdminInterface/AdminProtect.php');
inc_lib('db/DBTable.php');
inc_lib('db/DBRTTI.php');
if ($_SERVER['SCRIPT_NAME'] != '/restore.php') {
    if (file_exists($PRJ_DIR . '/restore.php')) {
        CUtils::raiseError('Удалите файл restore.php в корне сайта', ERROR_DIE);
    }
    // Включаем парсер URL
    inc_lib('CParser.php');
    $parser = new CParser();
    $GLOBALS['urlprops'] = $parser->getURLProps();
    // Инициализация текущего языка
    if (!isset($_SESSION['lang'])) {
        $_SESSION['lang'] = CUtils::_postVar('lang', false, 'ru');
    }
    if (CUtils::_postVar('lang') && $_SESSION['lang'] != CUtils::_postVar('lang')) {
        $_SESSION['lang'] = CUtils::_postVar('lang');
        header('location: ' . $GLOBALS['urlprops']['uri'] . ($_SERVER['QUERY_STRING'] ? '?' . $_SERVER['QUERY_STRING'] : ''));
    }
    $GLOBALS['smarty']->assign('slang', $GLOBALS['urlprops']['lang']);
    $GLOBALS['smarty']->assign('urlprops', $GLOBALS['urlprops']);
    if (!stristr($_SERVER['REQUEST_URI'], '/admin')) {
        /*if ((isset($GLOBALS['urlprops']['node'])) && $GLOBALS['urlprops']['node']['id'] == 82 && $GLOBALS['urlprops']['method'] == 'index') {
        			$cat = $GLOBALS['db']->getItem('get_cat',"SELECT id,filters FROM catalog_categories WHERE id=".$GLOBALS['urlprops']['params'][0]);
        			$filters = $GLOBALS['db']->getItems('get_filters', "SELECT id FROM catalog_features WHERE id IN(".$cat['filters'].")");
Exemplo n.º 3
0
 /**
  * Parse the string using the given parser. If a match has been found, move the cursor to the last symbol of the
  * matched string.
  *
  * @param CParser   $parser
  * @param int       $tokenType
  *
  * @return bool
  */
 protected function parseUsing(CParser $parser, $tokenType)
 {
     if ($parser->parse($this->expression, $this->pos) == CParser::PARSE_FAIL) {
         return false;
     }
     $this->result->addToken($tokenType, $parser->getMatch(), $this->pos, $parser->getLength());
     $this->pos += $parser->getLength() - 1;
     return true;
 }