Beispiel #1
0
 /**
  * Set fields propeties
  */
 function readConfig()
 {
     if (!empty($this->props['fieldset']) && is_array($this->props['fieldset'])) {
         $this->fields = $this->props['fieldset'];
     } else {
         CUtils::raiseError('Table config file format error: ' . $this->name, ERROR_DIE);
     }
 }
Beispiel #2
0
 public function __construct($host, $user, $pass, $base)
 {
     $this->connection = null;
     $this->result = array();
     $this->base = $base;
     $this->host = $host;
     $this->user = $user;
     $this->pass = $pass;
     try {
         $this->connection = $this->openConnection();
     } catch (Exception $e) {
         CUtils::raiseError($e->getMessage(), ERROR_DIE);
     }
 }
 function getBaseTableKey()
 {
     if (!CUtils::_getVar('table')) {
         if (sizeof($this->unit->tables) > 0) {
             foreach ($this->unit->tables as $k => $v) {
                 $_GET['table'] = $k;
                 break;
             }
         } else {
             CUtils::raiseError('Tables not exists', ERROR_DIE);
         }
     }
     return CUtils::_getVar('table');
 }
Beispiel #4
0
 protected function getTemplate()
 {
     $where = "(tr.type='0' AND tr.cond='')";
     $where .= " OR (tr.type='T' AND ((tr.date_beg > 0 AND tr.date_beg <= NOW()) OR tr.date_beg = 0) AND (tr.date_end >= NOW() OR tr.date_end = 0))";
     //$where .= " OR (tr.type='U' AND LOCATE(tr.cond,'".$GLOBALS['db']->escapeStr($_SERVER['REQUEST_URI'])."')>0)";
     if (!empty($GLOBALS['urlprops']['node']['name'])) {
         $where .= " OR (tr.type='F' AND tr.cond='" . $GLOBALS['urlprops']['node']['name'] . "')";
     }
     $q = "SELECT tt.template FROM templates_templates tt JOIN templates_rules tr ON tt.id=tr.template_id WHERE tr.lang='" . $GLOBALS['urlprops']['lang'] . "' AND(" . $where . ") ORDER BY ord DESC";
     //		var_dump($q);
     if ($_template = $GLOBALS['rtti']->getNativeItem($q)) {
         if (!empty($_template['template']) && file_exists($GLOBALS['PRJ_DIR'] . $_template['template'])) {
             return $GLOBALS['PRJ_DIR'] . $_template['template'];
         } else {
             CUtils::raiseError('Template file error', ERROR_DIE);
         }
     } else {
         CUtils::raiseError('Template settings error', ERROR_DIE);
     }
 }
Beispiel #5
0
$GLOBALS['smarty']->compile_check = true;
$GLOBALS['smarty']->debugging = false;
$GLOBALS['smarty']->assign('prj_name', $PRJ_NAME);
$GLOBALS['smarty']->assign('prj_zone', $PRJ_ZONE);
$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']);
Beispiel #6
0
 public function cron($period)
 {
     if (!empty($period)) {
         set_time_limit(0);
         echo 'Cron (' . $period . '):';
         foreach ($this->units as $u) {
             echo ' ' . $u->unit->ocomponent['name'];
             $name = 'every' . $period;
             $u->unit->{$name}();
         }
     } else {
         CUtils::raiseError('Cron params error', ERROR_DIE);
     }
 }
Beispiel #7
0
 /**
  * Trigger a PEAR error
  */
 public function raiseError($msg, $code)
 {
     return CUtils::raiseError($msg, $this->_pearErrorMode);
 }
Beispiel #8
0
 function getClass($class)
 {
     $anames = explode('_', $class);
     $tname = str_replace('_', '', stristr($class, '_'));
     $component = $this->getComponent($anames[0]);
     $a = $this->getItem('table_tables', "name='" . $tname . "' AND module_id=" . $component['id']);
     if (sizeof($a) > 0) {
         return $a;
     } else {
         CUtils::raiseError('Class not exists: ' . $class, ERROR_DIE);
     }
 }