예제 #1
0
function ExecDispatcher($sExec, $aParams)
{
    //dbg($aParams, $sExec);
    $component_id = 0;
    if (isset($aParams['component_id'])) {
        $component_id = $aParams['component_id'];
    }
    //dbg($component_id,'$component_id');
    unset($aParams['component_id']);
    switch ($sExec) {
        case 'getAllTablesAndAliases':
            return cComponents::getAllTablesAndAliases();
            break;
        case 'getTables_Component':
            return cComponents::getTables_Component($component_id);
            break;
        case 'getModules_Component':
            return cComponents::getModules_Component($component_id);
            break;
        case 'getTpls_Component':
            return cComponents::getTpls_Component($component_id);
            break;
        case 'getPages_Component':
            return cp1251_to_utf(cComponents::getPages_Component($component_id));
            break;
        case 'delPage_Component':
            return cComponents::delLink_Component($component_id, $aParams, DB_TBL_COMPONENTS2PAGES, 'page_id');
            break;
        case 'delTable_Component':
            return cComponents::delLink_Component($component_id, $aParams, DB_TBL_COMPONENTS2TABLES, 'table_id');
            break;
        case 'delTpl_Component':
            return cComponents::delLink_Component($component_id, $aParams, DB_TBL_COMPONENTS2TPLS, 'tpl_id');
            break;
        case 'delModule_Component':
            return cComponents::delLink_Component($component_id, $aParams, DB_TBL_COMPONENTS2MODULES, 'module_id');
            break;
        case 'setPages_Component':
            return cComponents::setLink_Component($component_id, $aParams, DB_TBL_COMPONENTS2PAGES, 'page_id');
            break;
        case 'setTables_Component':
            return cComponents::setLink_Component($component_id, $aParams, DB_TBL_COMPONENTS2TABLES, 'table_id');
            break;
        case 'setTpls_Component':
            return cComponents::setLink_Component($component_id, $aParams, DB_TBL_COMPONENTS2TPLS, 'tpl_id');
            break;
        case 'setModules_Component':
            return cComponents::setLink_Component($component_id, $aParams, DB_TBL_COMPONENTS2MODULES, 'module_id');
            break;
        default:
            dbg($sParams, 'Execution Dispatcher Fault: ' . $sExec);
            return '';
            break;
    }
}
예제 #2
0
 function updateComponent($component_id)
 {
     return true;
     // Обновить шаблоны
     $aList = cComponents::getLink_Component($component_id, DB_TBL_COMPONENTS2TPLS, 'tpl_id', array('tpl_id'));
     foreach ($aList as $k => $v) {
         cTasks::mAddTask('updateTpl', $k);
     }
     // Обновить модули
     $aList = cComponents::getLink_Component($component_id, DB_TBL_COMPONENTS2MODULES, 'module_id', array('module_id'));
     foreach ($aList as $k => $v) {
         cTasks::mAddTask('updateModule', $k);
     }
     // Обновить таблицы
     $aList = cComponents::getLink_Component($component_id, DB_TBL_COMPONENTS2TABLES, 'table_id', array('table_id'));
     foreach ($aList as $k => $v) {
         cTasks::mAddTask('updateTable', $k);
     }
     // Обновить страницы
     $aList = cComponents::getLink_Component($component_id, DB_TBL_COMPONENTS2PAGES, 'page_id', array('page_id'));
     foreach ($aList as $k => $v) {
         cTasks::mAddTask('updatePage', $k);
     }
     return true;
 }
예제 #3
0
}
$sRequest = unslashify($url['path']);
$nRequest = strlen($sRequest);
$aRequest = explode('/', $sRequest);
// db connecting
$_db = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or my_die('database is down');
@mysql_select_db(DB_NAME) or my_die('dbconnect is down');
mysql_query('SET NAMES cp1251');
// libs, нужные в том числе и ядру
// Crud (SAL - Storage Abstraction Layer)
require_once FLGR_COMMON . '/crud.php';
require_once FLGR_COMMON . '/crud-perm.php';
// ***TODO***: удалить, т.к. не нужно
// Components // ***TODO***: Кэшировать в файле алиасы таблиц, чтобы не дергать каждый раз базу
require_once FLGR_COMMON . '/components.php';
$Components = new cComponents();
foreach ($Components->getAllTablesAndAliases() as $v) {
    $v['alias'] = 'DB_TBL_' . strtoupper($v['alias']);
    if (!defined($v['alias'])) {
        define($v['alias'], $v['name']);
        //dbg($v['alias']);
    }
}
// Stat - мало ли какие ошибки произойдут дальше, а статитистику мы сохраним
require_once FLGR_COMMON . '/stat.php';
if (!defined(LOCALHOST)) {
    //	cStat::bSaveStat();
}
// Cache - незачем крутить код дальше, если есть закешированные данные по этому запросу
if (defined('CACHE_ON')) {
    include_once FLGR_COMMON . '/cache.php';
예제 #4
0
 function getTpls_Component($component_id)
 {
     if (!is_numeric($component_id)) {
         return;
     }
     $aAllTpls = tblGetAll(DB_TBL_TPLS);
     $aLinkedTpls = cComponents::getLink_Component($component_id, DB_TBL_COMPONENTS2TPLS, 'tpl_id', array('tpl_id'));
     //dbg($aLinkedTpls);
     foreach ($aLinkedTpls as $k => $v) {
         $aAllTpls[$v['tpl_id']]['checked'] = 1;
     }
     //dbg($aAllTpls);
     $aClientTpls = array();
     $aAdminTpls = array();
     $aOtherTpls = array();
     $aReturn = array();
     foreach ($aAllTpls as $k => $v) {
         if (!isset($v['checked'])) {
             $v['checked'] = 0;
         }
         unset($v['file_id']);
         unset($v['file_id']);
         if ($v['type'] == 'client') {
             $aClientTpls[] = $v;
         } elseif ($v['type'] == 'admin') {
             $aAdminTpls[] = $v;
         } else {
             $aOtherTpls[] = $v;
         }
     }
     $aReturn = array($aClientTpls, $aAdminTpls, $aOtherTpls);
     return $aReturn;
 }