$items = $area_sync($cat);
             $db->update($db_structure, array("structure_count" => (int) $items), "structure_code='" . $db->prep($cat) . "' AND structure_area='" . $db->prep($n) . "'");
         }
         $sql->closeCursor();
     }
     /* === Hook === */
     foreach (cot_getextplugins('admin.structure.resync.done') as $pl) {
         include $pl;
     }
     /* ===== */
     $res ? cot_message('Resynced') : cot_message("Error: function {$area_sync} doesn't exist.");
     // TODO i18n
     $cache && $cfg['cache_' . $n] && $cache->page->clear($n);
     cot_redirect(cot_url('admin', 'm=structure&n=' . $n . '&mode=' . $mode . '&d=' . $durl, '', true));
 }
 $ext_info = cot_get_extensionparams($n, true);
 $adminpath[] = array(cot_url('admin', 'm=extensions'), $L['Extensions']);
 $adminpath[] = array($is_module ? cot_url('admin', 'm=' . $n) : cot_url('admin', 'm=extensions&a=details&pl=' . $n), $ext_info['name']);
 $adminpath[] = array(cot_url('admin', 'm=structure&n=' . $n), $L['Structure']);
 if ($id > 0 || !empty($al)) {
     $where = $id > 0 ? 'structure_id=' . (int) $id : "structure_code='" . $db->prep($al) . "'";
     $sql = $db->query("SELECT * FROM {$db_structure} WHERE {$where} LIMIT 1");
     cot_die($sql->rowCount() == 0);
 } elseif ($mode && ($mode == 'all' || $structure[$n][$mode])) {
     $sqlmask = $mode == 'all' ? "structure_path NOT LIKE '%.%'" : "structure_path LIKE '" . $db->prep($structure[$n][$mode]['rpath']) . ".%' AND structure_path NOT LIKE '" . $db->prep($structure[$n][$mode]['rpath']) . ".%.%'";
     $sql = $db->query("SELECT * FROM {$db_structure} WHERE structure_area='" . $db->prep($n) . "' AND {$sqlmask} ORDER BY structure_path ASC, structure_code ASC LIMIT {$d}, " . $maxrowsperpage);
     $totalitems = $db->query("SELECT COUNT(*) FROM {$db_structure} WHERE structure_area='" . $db->prep($n) . "' AND {$sqlmask}")->fetchColumn();
     $pagenav = cot_pagenav('admin', 'm=structure&n=' . $n . '&mode=' . $mode, $d, $totalitems, $maxrowsperpage, 'd', '', $cfg['jquery'] && $cfg['turnajax']);
 } else {
     $sql = $db->query("SELECT * FROM {$db_structure} WHERE structure_area='" . $db->prep($n) . "' ORDER BY structure_path ASC, structure_code ASC LIMIT {$d}, " . $maxrowsperpage);
     $totalitems = $db->query("SELECT COUNT(*) FROM {$db_structure} WHERE structure_area='" . $db->prep($n) . "'")->fetchColumn();
/**
 * pagecattree Plugin for Cotonti CMF
 *
 * @version 2.0.0
 * @author esclkm, http://www.littledev.ru
 * @copyright (c) 2008-2011 esclkm, http://www.littledev.ru
 */
defined('COT_CODE') or die('Wrong URL.');
$adminpath[] = array(cot_url('admin', 'm=structure'), $L['Structure']);
// Show available module list
if (is_array($extension_structure) && count($extension_structure) > 0) {
    foreach ($extension_structure as $code) {
        $parse = false;
        if (cot_plugin_active($code)) {
            $is_module = false;
            $parse = true;
        }
        if (cot_module_active($code)) {
            $is_module = true;
            $parse = true;
        }
        if ($parse) {
            $ext_info = cot_get_extensionparams($code, $is_module);
            $t->assign(array('ADMIN_STRUCTURE_EXT_URL' => cot_url('admin', 'm=other&p=cateditor&n=' . $code), 'ADMIN_STRUCTURE_EXT_ICO' => $ext_info['icon'], 'ADMIN_STRUCTURE_EXT_NAME' => $ext_info['name']));
            $t->parse('MAIN.ADMIN_STRUCTURE_EXT');
        }
    }
} else {
    $t->parse('MAIN.ADMIN_STRUCTURE_EMPTY');
}
$t->assign(array('ADMIN_STRUCTURE_EXFLDS_URL' => cot_url('admin', 'm=extrafields')));
        $table = current($row);
        if (!in_array($table, $extra_blacklist)) {
            if (cot_import('alltables', 'G', 'BOL')) {
                $tablelist[] = $table;
            } elseif (isset($extra_whitelist[$table])) {
                $tablelist[] = $table;
            }
        }
    }
    cot_import('alltables', 'G', 'BOL') && ($adminpath[] = array(cot_url('admin', 'm=extrafields&alltables=1'), $L['adm_extrafields_all']));
    $ii = 0;
    foreach ($tablelist as $table) {
        $name = '';
        $ext_info = array();
        if ($extra_whitelist[$table]['type'] == 'module' || $extra_whitelist[$table]['type'] == 'plug') {
            $ext_info = cot_get_extensionparams($extra_whitelist[$table]['code'], $extra_whitelist[$table]['type'] == 'module');
            $name = $ext_info['name'];
        }
        $name = empty($name) ? $extra_whitelist[$table]['caption'] : $name;
        $ii++;
        $t->assign(array('ADMIN_EXTRAFIELDS_ROW_ICO' => $ext_info['icon'], 'ADMIN_EXTRAFIELDS_ROW_ITEMNAME' => $name, 'ADMIN_EXTRAFIELDS_ROW_TABLENAME' => $table . (isset($extra_whitelist[$table]) ? " - " . $extra_whitelist[$table]['caption'] : ''), 'ADMIN_EXTRAFIELDS_ROW_TABLE' => $table, 'ADMIN_EXTRAFIELDS_ROW_TYPE' => $extra_whitelist[$table]['type'], 'ADMIN_EXTRAFIELDS_ROW_TABLEURL' => cot_url('admin', 'm=extrafields&n=' . $table), 'ADMIN_EXTRAFIELDS_COUNTER_ROW' => $ii, 'ADMIN_EXTRAFIELDS_ODDEVEN' => cot_build_oddeven($ii)));
        $t->parse('MAIN.TABLELIST.ROW');
    }
    $t->assign('ADMIN_EXTRAFIELDS_ALLTABLES', cot_url('admin', 'm=extrafields&alltables=1'));
    /* === Hook  === */
    foreach (cot_getextplugins('admin.extrafields.tablelist.tags') as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.TABLELIST');
} else {
        $sql = $db->query("\n\t\t\tSELECT DISTINCT(config_cat) FROM {$db_config}\n\t\t\tWHERE config_owner = 'module'\n\t\t\tAND config_type != '" . COT_CONFIG_TYPE_HIDDEN . "'\n\t\t\tORDER BY config_cat ASC\n\t\t");
        $jj = 0;
        while ($row = $sql->fetch()) {
            $jj++;
            $ext_info = cot_get_extensionparams($row['config_cat'], true);
            $t->assign(array('ADMIN_CONFIG_ROW_URL' => cot_url('admin', 'm=config&n=edit&o=module&p=' . $row['config_cat']), 'ADMIN_CONFIG_ROW_ICO' => $ext_info['icon'], 'ADMIN_CONFIG_ROW_NAME' => $ext_info['name'], 'ADMIN_CONFIG_ROW_DESC' => $ext_info['desc'], 'ADMIN_CONFIG_ROW_NUM' => $jj, 'ADMIN_CONFIG_ROW_ODDEVEN' => cot_build_oddeven($jj)));
            $t->parse('MAIN.DEFAULT.ADMIN_CONFIG_COL.ADMIN_CONFIG_ROW');
        }
        $sql->closeCursor();
        $t->assign('ADMIN_CONFIG_COL_CAPTION', $L['Modules']);
        $t->parse('MAIN.DEFAULT.ADMIN_CONFIG_COL');
        $sql = $db->query("\n\t\t\tSELECT DISTINCT(c.config_cat), r.ct_title FROM {$db_config} AS c\n\t\t\t\tLEFT JOIN {$db_core} AS r ON c.config_cat = r.ct_code\n\t\t\tWHERE config_owner = 'plug'\n\t\t\tAND config_type != '" . COT_CONFIG_TYPE_HIDDEN . "'\n\t\t\tORDER BY config_cat ASC\n\t\t");
        $jj = 0;
        while ($row = $sql->fetch()) {
            $jj++;
            $ext_info = cot_get_extensionparams($row['config_cat'], false);
            $t->assign(array('ADMIN_CONFIG_ROW_URL' => cot_url('admin', 'm=config&n=edit&o=plug&p=' . $row['config_cat']), 'ADMIN_CONFIG_ROW_ICO' => $ext_info['icon'], 'ADMIN_CONFIG_ROW_NAME' => $ext_info['name'], 'ADMIN_CONFIG_ROW_DESC' => $ext_info['desc'], 'ADMIN_CONFIG_ROW_NUM' => $jj, 'ADMIN_CONFIG_ROW_ODDEVEN' => cot_build_oddeven($jj)));
            $t->parse('MAIN.DEFAULT.ADMIN_CONFIG_COL.ADMIN_CONFIG_ROW');
        }
        $sql->closeCursor();
        $t->assign('ADMIN_CONFIG_COL_CAPTION', $L['Plugins']);
        $t->parse('MAIN.DEFAULT.ADMIN_CONFIG_COL');
        /* === Hook  === */
        foreach (cot_getextplugins('admin.config.default.tags') as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.DEFAULT');
        break;
}
cot_display_messages($t);
Exemple #5
0
         return 0;
     }
     return $pl_a['pl_code'] < $pl_b['pl_code'] ? -1 : 1;
 }
 foreach (array('module', 'plug') as $type) {
     if ($type == 'module') {
         $target = $cot_plugins['admin'];
         $title = $L['Modules'];
     } else {
         $target = $cot_plugins['tools'];
         $title = $L['Plugins'];
     }
     if (is_array($target)) {
         usort($target, 'cot_admin_other_cmp');
         foreach ($target as $pl) {
             $ext_info = cot_get_extensionparams($pl['pl_code'], $type == 'module');
             $t->assign(array('ADMIN_OTHER_EXT_URL' => $type == 'plug' ? cot_url('admin', 'm=other&p=' . $pl['pl_code']) : cot_url('admin', 'm=' . $pl['pl_code']), 'ADMIN_OTHER_EXT_ICO' => $ext_info['icon'], 'ADMIN_OTHER_EXT_NAME' => $ext_info['name'], 'ADMIN_OTHER_EXT_DESC' => $ext_info['desc']));
             $t->parse('MAIN.SECTION.ROW');
         }
     } else {
         $t->parse('MAIN.SECTION.EMPTY');
     }
     $t->assign('ADMIN_OTHER_SECTION', $title);
     $t->parse('MAIN.SECTION');
 }
 $t->assign(array('ADMIN_OTHER_URL_CACHE' => cot_url('admin', 'm=cache'), 'ADMIN_OTHER_URL_DISKCACHE' => cot_url('admin', 'm=cache&s=disk'), 'ADMIN_OTHER_URL_EXFLDS' => cot_url('admin', 'm=extrafields'), 'ADMIN_OTHER_URL_STRUCTURE' => cot_url('admin', 'm=structure'), 'ADMIN_OTHER_URL_BBCODE' => cot_url('admin', 'm=bbcode'), 'ADMIN_OTHER_URL_LOG' => cot_url('admin', 'm=log'), 'ADMIN_OTHER_URL_INFOS' => cot_url('admin', 'm=infos')));
 /* === Hook === */
 foreach (cot_getextplugins('admin.other.tags') as $pl) {
     include $pl;
 }
 /* ===== */