예제 #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
$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';
    $Cashe = new cCache($sRequest);