本文整理汇总了PHP中cpListTable函数的典型用法代码示例。如果您正苦于以下问题:PHP cpListTable函数的具体用法?PHP cpListTable怎么用?PHP cpListTable使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cpListTable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applet_filters
function applet_filters()
{
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/plugins', $adminAccess)) {
cpAccessDenied();
}
if (!cmsUser::isAdminCan('admin/filters', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_FILTERS'];
cpAddPathway($_LANG['AD_FILTERS'], 'index.php?view=filters');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'hide') {
dbHide('cms_filters', $id);
echo '1';
exit;
}
if ($do == 'show') {
dbShow('cms_filters', $id);
echo '1';
exit;
}
if ($do == 'list') {
$fields[] = array('title' => 'id', 'field' => 'id', 'width' => '30');
$fields[] = array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '250');
$fields[] = array('title' => $_LANG['DESCRIPTION'], 'field' => 'description', 'width' => '');
$fields[] = array('title' => $_LANG['AD_ENABLE'], 'field' => 'published', 'width' => '100');
$actions = array();
cpListTable('cms_filters', $fields, $actions);
}
}
示例2: applet_filters
function applet_filters() {
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/plugins', $adminAccess)) { cpAccessDenied(); }
if (!cmsUser::isAdminCan('admin/filters', $adminAccess)) { cpAccessDenied(); }
cmsCore::c('page')->setTitle($_LANG['AD_FILTERS']);
cpAddPathway($_LANG['AD_FILTERS'], 'index.php?view=filters');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'hide') {
cmsCore::c('db')->setFlag('cms_filters', $id, 'published', '0');
cmsCore::halt('1');
}
if ($do == 'show') {
cmsCore::c('db')->setFlag('cms_filters', $id, 'published', '1');
cmsCore::halt('1');
}
if ($do == 'list') {
$fields = array(
array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
array( 'title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '250' ),
array( 'title' => $_LANG['DESCRIPTION'], 'field' => 'description', 'width' => '' ),
array( 'title' => $_LANG['AD_ENABLE'], 'field' => 'published', 'width' => '100' )
);
cpListTable('cms_filters', $fields, array());
}
}
示例3: applet_arhive
function applet_arhive()
{
$inCore = cmsCore::getInstance();
global $_LANG;
cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES_ARCHIVE']);
$cfg = $inCore->loadComponentConfig('content');
$cfg_arhive = $inCore->loadComponentConfig('arhive');
cpAddPathway($_LANG['AD_ARTICLE_SITE'], 'index.php?view=tree');
cpAddPathway($_LANG['AD_ARTICLES_ARCHIVE'], 'index.php?view=arhive');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'saveconfig') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$cfg['source'] = cmsCore::request('source', 'str', '');
$inCore->saveComponentConfig('arhive', $cfg);
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('?view=arhive&do=config');
}
if ($do == 'config') {
$toolmenu = array(array('icon' => 'folders.gif', 'title' => $_LANG['AD_LIST_OF_ARTICLES'], 'link' => '?view=arhive'));
cpToolMenu($toolmenu);
cpAddPathway($_LANG['AD_SETTINGS'], 'index.php?view=arhive&do=config');
cmsCore::c('page')->initTemplate('applets', 'arhive')->assign('cfg_arhive', $cfg_arhive)->display();
}
if ($do == 'list') {
$toolmenu = array(array('icon' => 'config.gif', 'title' => $_LANG['AD_SETTINGS'], 'link' => '?view=arhive&do=config'), array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=arhive&do=delete&multiple=1');"));
cpToolMenu($toolmenu);
//TABLE COLUMNS
$fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['AD_CREATE'], 'field' => 'pubdate', 'width' => '80', 'filter' => 15, 'fdate' => '%d/%m/%Y'), array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=content&do=edit&id=%id%', 'filter' => 15), array('title' => $_LANG['AD_PARTITION'], 'field' => 'category_id', 'width' => '150', 'filter' => 1, 'prc' => 'cpCatById', 'filterlist' => cpGetList('cms_category')));
//ACTIONS
$actions = array(array('title' => $_LANG['AD_TO_ARTICLES_CATALOG'], 'icon' => 'arhive_off.gif', 'link' => '?view=arhive&do=arhive_off&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'link' => '?view=content&do=delete&id=%id%', 'confirm' => $_LANG['AD_DELETE_MATERIALS']));
//Print table
cpListTable('cms_content', $fields, $actions, 'is_arhive=1');
}
if ($do == 'arhive_off') {
if (cmsCore::inRequest('id')) {
cmsCore::c('db')->setFlag('cms_content', $id, 'is_arhive', '0');
cmsCore::redirect('?view=arhive');
}
}
if ($do == 'delete') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) {
cmsCore::m('content')->deleteArticle($id, $cfg['af_delete']);
}
} else {
cmsCore::m('content')->deleteArticles(cmsCore::request('item', 'array_int'), $cfg['af_delete']);
}
cmsCore::redirect('?view=arhive');
}
}
示例4: array
$fields[3]['title'] = $_LANG['AD_SHOW'];
$fields[3]['field'] = 'published';
$fields[3]['width'] = '100';
$fields[3]['do'] = 'opt';
$fields[3]['do_suffix'] = '_item';
//ACTIONS
$actions = array();
$actions[0]['title'] = $_LANG['EDIT'];
$actions[0]['icon'] = 'edit.gif';
$actions[0]['link'] = '?view=components&do=config&id=' . (int) $_REQUEST['id'] . '&opt=edit_item&item_id=%id%';
$actions[1]['title'] = $_LANG['DELETE'];
$actions[1]['icon'] = 'delete.gif';
$actions[1]['confirm'] = $_LANG['AD_REMOVE_QUESTION'];
$actions[1]['link'] = '?view=components&do=config&id=' . (int) $_REQUEST['id'] . '&opt=delete_item&item_id=%id%';
//Print table
cpListTable('cms_faq_quests', $fields, $actions, '', 'pubdate DESC');
}
if ($opt == 'add_item' || $opt == 'edit_item') {
if ($opt == 'add_item') {
echo '<h3>' . $_LANG['AD_ADD_QUESTION'] . '</h3>';
cpAddPathway($_LANG['AD_ADD_QUESTION']);
} else {
if (isset($_REQUEST['multiple'])) {
if (isset($_REQUEST['item'])) {
$_SESSION['editlist'] = $_REQUEST['item'];
} else {
echo '<p class="error">' . $_LANG['AD_NO_SELECT_OBJECTS'] . '</p>';
return;
}
}
$ostatok = '';
示例5: array
$fields = array(
array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
array( 'title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=components&do=config&id='. $id .'&opt=edit_forum&item_id=%id%', 'filter' => '15' ),
array( 'title' => $_LANG['AD_TOPICS'], 'field' => 'thread_count', 'width' => '60'),
array( 'title' => $_LANG['AD_FORUM_MESSAGES'], 'field' => 'post_count', 'width' => '90' ),
array( 'title' => $_LANG['AD_IS_PUBLISHED'], 'field' => 'published', 'width' => '60', 'do' => 'opt', 'do_suffix' => '_forum' ),
array( 'title' => $_LANG['AD_CATEGORY'], 'field' => 'category_id', 'width' => '150', 'prc' => 'cpForumCatById', 'filter' => '1', 'filterlist' => cpGetList('cms_forum_cats'))
);
$actions = array(
array( 'title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=components&do=config&id='. $id .'&opt=edit_forum&item_id=%id%' ),
array( 'title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_FORUM_DELETE'], 'link' => '?view=components&do=config&id='. $id .'&opt=delete_forum&item_id=%id%' )
);
cpListTable('cms_forums', $fields, $actions, 'parent_id>0', 'NSLeft');
}
if ($opt == 'add_cat' || $opt == 'edit_cat') {
if ($opt == 'add_cat') {
echo '<h3>'. $_LANG['AD_CREATE_CATEGORY'] .'</h3>';
cpAddPathway($_LANG['AD_CREATE_CATEGORY']);
$mod = array( 'published' => 1, 'ordering' => (int)cmsCore::c('db')->get_field('cms_forum_cats', '1=1 ORDER BY ordering DESC', 'ordering')+1 );
} else {
$mod = $model->getForumCat(cmsCore::request('item_id', 'int', 0));
if (!$mod) { cmsCore::error404(); }
cpAddPathway($_LANG['AD_EDIT_CATEGORY']);
echo '<h3>'. $_LANG['AD_EDIT_CATEGORY'] .'</h3>';
}
?>
示例6: applet_plugins
function applet_plugins()
{
global $_LANG;
$inCore = cmsCore::getInstance();
$GLOBALS['cp_page_title'] = $_LANG['AD_PLUGINS'];
cpAddPathway($_LANG['AD_PLUGINS'], 'index.php?view=plugins');
global $adminAccess;
if (!cmsUser::isAdminCan('admin/plugins', $adminAccess)) {
cpAccessDenied();
}
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
// ===================================================================================== //
if ($do == 'hide') {
dbHide('cms_plugins', $id);
echo '1';
exit;
}
// ===================================================================================== //
if ($do == 'show') {
dbShow('cms_plugins', $id);
echo '1';
exit;
}
// ===================================================================================== //
if ($do == 'list') {
$toolmenu = array();
$toolmenu[1]['icon'] = 'install.gif';
$toolmenu[1]['title'] = $_LANG['AD_INSTALL_PLUGINS'];
$toolmenu[1]['link'] = '?view=install&do=plugin';
cpToolMenu($toolmenu);
$plugin_id = cmsCore::request('installed', 'str', '');
if ($plugin_id) {
$task = cmsCore::request('task', 'str', 'install');
if ($task == 'install' || $task == 'upgrade') {
$plugin = $inCore->loadPlugin($plugin_id);
$task_str = $task == 'install' ? $_LANG['AD_IS_INSTALL'] : $_LANG['AD_IS_UPDATE'];
echo '<div style="color:green;margin-top:12px;margin-bottom:5px;">' . $_LANG['AD_PLUGIN'] . ' <strong>"' . $plugin->info['title'] . '"</strong> ' . $task_str . '. ' . $_LANG['AD_ENABLE_PLUGIN'] . '.</div>';
}
if ($task == 'remove') {
echo '<div style="color:green;margin-top:12px;margin-bottom:5px;">' . $_LANG['AD_REMOVE_PLUGIN_OK'] . '.</div>';
}
}
$fields = array();
$fields[0]['title'] = 'id';
$fields[0]['field'] = 'id';
$fields[0]['width'] = '20';
$fields[1]['title'] = $_LANG['TITLE'];
$fields[1]['field'] = 'title';
$fields[1]['width'] = '250';
$fields[2]['title'] = $_LANG['DESCRIPTION'];
$fields[2]['field'] = 'description';
$fields[2]['width'] = '';
$fields[3]['title'] = $_LANG['AD_AUTHOR'];
$fields[3]['field'] = 'author';
$fields[3]['width'] = '160';
$fields[4]['title'] = $_LANG['AD_VERSION'];
$fields[4]['field'] = 'version';
$fields[4]['width'] = '50';
$fields[5]['title'] = $_LANG['AD_FOLDER'];
$fields[5]['field'] = 'plugin';
$fields[5]['width'] = '100';
$fields[6]['title'] = $_LANG['AD_ENABLE'];
$fields[6]['field'] = 'published';
$fields[6]['width'] = '60';
$actions = array();
$actions[0]['title'] = $_LANG['AD_CONFIG'];
$actions[0]['icon'] = 'config.gif';
$actions[0]['link'] = '?view=plugins&do=config&id=%id%';
$actions[1]['title'] = $_LANG['DELETE'];
$actions[1]['icon'] = 'delete.gif';
$actions[1]['confirm'] = $_LANG['AD_REMOVE_PLUGIN_FROM'];
$actions[1]['link'] = '?view=install&do=remove_plugin&id=%id%';
cpListTable('cms_plugins', $fields, $actions);
}
// ===================================================================================== //
if ($do == 'save_config') {
if (!cmsCore::validateForm()) {
cmsCore::error404();
}
$plugin_name = cmsCore::request('plugin', 'str', 0);
$config = cmsCore::request('config', 'array_str');
if (!$config || !$plugin_name) {
cmsCore::redirectBack();
}
$inCore->savePluginConfig($plugin_name, $config);
cmsUser::clearCsrfToken();
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=plugins');
}
// ===================================================================================== //
if ($do == 'config') {
$plugin_name = $inCore->getPluginById($id);
if (!$plugin_name) {
cmsCore::error404();
}
$plugin = $inCore->loadPlugin($plugin_name);
$config = $inCore->loadPluginConfig($plugin_name);
$GLOBALS['cp_page_title'] = $plugin->info['title'];
cpAddPathway($plugin->info['title'], 'index.php?view=plugins&do=config&id=' . $id);
//.........这里部分代码省略.........
示例7: array
$fields[] = array('title' => 'id', 'field' => 'id', 'width' => '30');
$fields[] = array('title' => 'Имя файла', 'field' => 'filename', 'width' => '200', 'filter' => 15);
$fields[] = array('title' => 'Размер', 'field' => 'filesize', 'width' => '200', 'filter' => 15);
$fields[] = array('title' => 'Скачен', 'field' => 'hits', 'width' => '200');
$fields[] = array('title' => 'Дата добавления', 'field' => 'pubdate', 'width' => '100', 'filter' => 15, 'fdate' => '%d/%m/%Y');
/*
$fields[] = array('title'=>$_LANG['TITLE'], 'field'=>'title', 'width'=>'', 'filter'=>15, 'link'=>'?view=components&do=config&id='.$id.'&opt=edit&item_id=%id%');
$fields[] = array('title'=>$_LANG['AD_POSITION'], 'field'=>'position', 'width'=>'100', 'filter'=>15);
$fields[] = array('title'=>$_LANG['AD_IS_PUBLISHED'], 'field'=>'published', 'width'=>'100', 'do'=>'opt', 'do_suffix'=>'_banner');
$fields[] = array('title'=>$_LANG['AD_BANNER_HITS'], 'field'=>array('maxhits','hits'), 'width'=>'90', 'prc'=>'bannerHitsbyID');
$fields[] = array('title'=>$_LANG['AD_BANNER_CLICKS'], 'field'=>'clicks', 'width'=>'90');
$fields[] = array('title'=>$_LANG['AD_BANNER_CTR'], 'field'=>array('clicks','hits'), 'width'=>'90', 'prc'=>'bannerCTRbyID');
*/
$actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=components&do=config&id=' . $id . '&opt=edit&item_id=%id%');
$actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_BANNER_DEL_CONFIRM'], 'link' => '?view=components&do=config&id=' . $id . '&opt=delete&item_id=%id%');
cpListTable('vds_user_files', $fields, $actions, '', 'pubdate DESC');
}
if ($opt == 'add' || $opt == 'edit') {
$inPage = cmsPage::getInstance();
/*
if ($opt=='add'){
echo '<h3>Добавить файл</h3>';
cpAddPathway('Добавление файла');
} else {
if(isset($_REQUEST['multiple'])){
if (isset($_REQUEST['item'])){
$_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
} else {
cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
cmsCore::redirectBack();
}
示例8: applet_usergroups
function applet_usergroups()
{
$inDB = cmsDatabase::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/users', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_USERS_GROUP'];
cpAddPathway($_LANG['AD_USERS'], 'index.php?view=users');
cpAddPathway($_LANG['AD_USERS_GROUP'], 'index.php?view=usergroups');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
cmsCore::loadModel('users');
$model = new cms_model_users();
if ($do == 'list') {
$toolmenu[] = array('icon' => 'usergroupadd.gif', 'title' => $_LANG['AD_CREATE_GROUP'], 'link' => '?view=usergroups&do=add');
$toolmenu[] = array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=usergroups&do=edit&multiple=1');");
$toolmenu[] = array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:if(confirm('{$_LANG['AD_REMOVE_GROUP']}')) { checkSel('?view=users&do=delete&multiple=1'); }");
cpToolMenu($toolmenu);
$fields[] = array('title' => 'id', 'field' => 'id', 'width' => '30');
$fields[] = array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=usergroups&do=edit&id=%id%', 'filter' => '12');
$fields[] = array('title' => $_LANG['AD_FROM_USERS'], 'field' => 'id', 'width' => '100', 'prc' => 'getCountUsers');
$fields[] = array('title' => $_LANG['AD_IF_ADMIN'], 'field' => 'is_admin', 'width' => '110', 'prc' => 'cpYesNo');
$fields[] = array('title' => $_LANG['AD_ALIAS'], 'field' => 'alias', 'width' => '75', 'filter' => '12');
$actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=usergroups&do=edit&id=%id%');
$actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_REMOVE_GROUP'], 'link' => '?view=usergroups&do=delete&id=%id%');
cpListTable('cms_user_groups', $fields, $actions);
}
if ($do == 'delete') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
$model->deleteGroup($id);
}
} else {
$model->deleteGroups(cmsCore::request('item', 'array_int', array()));
}
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=usergroups');
}
if ($do == 'submit' || $do == 'update') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$types = array('title' => array('title', 'str', ''), 'alias' => array('alias', 'str', ''), 'is_admin' => array('is_admin', 'int', 0), 'access' => array('access', 'array_str', array(), create_function('$a_list', 'return implode(\',\', $a_list);')));
$items = cmsCore::getArrayFromRequest($types);
if ($do == 'submit') {
$inDB->insert('cms_user_groups', $items);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=usergroups');
} else {
$inDB->update('cms_user_groups', $items, $id);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
if (empty($_SESSION['editlist'])) {
cmsCore::redirect('index.php?view=usergroups');
} else {
cmsCore::redirect('index.php?view=usergroups&do=edit');
}
}
}
if ($do == 'add' || $do == 'edit') {
$toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();');
$toolmenu[] = array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'javascript:history.go(-1);');
cpToolMenu($toolmenu);
if ($do == 'add') {
cpAddPathway($_LANG['AD_CREATE_GROUP']);
} else {
if (isset($_REQUEST['multiple'])) {
if (isset($_REQUEST['item'])) {
$_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
} else {
cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
cmsCore::redirectBack();
}
}
$ostatok = '';
if (isset($_SESSION['editlist'])) {
$item_id = array_shift($_SESSION['editlist']);
if (sizeof($_SESSION['editlist']) == 0) {
unset($_SESSION['editlist']);
} else {
$ostatok = '(' . $_LANG['AD_NEXT_IN'] . sizeof($_SESSION['editlist']) . ')';
}
} else {
$item_id = cmsCore::request('id', 'int', 0);
}
$mod = $inDB->get_fields('cms_user_groups', "id = '{$item_id}'", '*');
if (!$mod) {
cmsCore::error404();
}
echo '<h3>' . $_LANG['AD_EDIT_GROUP'] . ' ' . $ostatok . '</h3>';
cpAddPathway($_LANG['AD_EDIT_GROUP'] . ' ' . $mod['title']);
}
if (isset($mod['access'])) {
$mod['access'] = str_replace(', ', ',', $mod['access']);
$mod['access'] = explode(',', $mod['access']);
}
?>
<form id="addform" name="addform" method="post" action="index.php?view=usergroups">
<input type="hidden" name="csrf_token" value="<?php
//.........这里部分代码省略.........
示例9: applet_plugins
function applet_plugins()
{
global $_LANG;
$inCore = cmsCore::getInstance();
cmsCore::c('page')->setTitle($_LANG['AD_PLUGINS']);
cpAddPathway($_LANG['AD_PLUGINS'], 'index.php?view=plugins');
global $adminAccess;
if (!cmsUser::isAdminCan('admin/plugins', $adminAccess)) {
cpAccessDenied();
}
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'hide') {
cmsCore::c('db')->setFlag('cms_plugins', $id, 'published', '0');
cmsCore::halt('1');
}
if ($do == 'show') {
cmsCore::c('db')->setFlag('cms_plugins', $id, 'published', '1');
cmsCore::halt('1');
}
if ($do == 'list') {
$toolmenu = array(array('icon' => 'install.gif', 'title' => $_LANG['AD_INSTALL_PLUGINS'], 'link' => '?view=install&do=plugin'), array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=plugins'));
cpToolMenu($toolmenu);
$fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['TITLE'], 'field' => 'title', 'link' => '?view=plugins&do=config&id=%id%', 'width' => '250'), array('title' => $_LANG['DESCRIPTION'], 'field' => 'description', 'width' => ''), array('title' => $_LANG['AD_AUTHOR'], 'field' => 'author', 'width' => '160'), array('title' => $_LANG['AD_VERSION'], 'field' => 'version', 'width' => '80'), array('title' => $_LANG['AD_FOLDER'], 'field' => 'plugin', 'width' => '100'), array('title' => $_LANG['AD_ENABLE'], 'field' => 'published', 'width' => '80'));
$actions = array(array('title' => $_LANG['AD_CONFIG'], 'icon' => 'config.gif', 'link' => '?view=plugins&do=config&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'link' => '?view=install&do=remove_plugin&id=%id%', 'confirm' => $_LANG['AD_REMOVE_PLUGIN_FROM']));
cpListTable('cms_plugins', $fields, $actions);
}
if ($do == 'save_config') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$plugin_name = cmsCore::request('plugin', 'str', 0);
$plugin = $inCore->loadPlugin($plugin_name);
$plugin_cfg_fields = $plugin->getConfigFields();
if (empty($plugin_cfg_fields)) {
$config = cmsCore::request('config', 'array_str');
} else {
$config = cmsCore::c('form_gen')->requestForm($plugin->getConfigFields());
}
if (!$config || !$plugin_name) {
cmsCore::redirectBack();
}
$inCore->savePluginConfig($plugin_name, $config);
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=plugins');
}
if ($do == 'save_auto_config') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$plugin_name = cmsCore::request('plugin', 'str', '');
$xml_file = PATH . '/plugins/' . $plugin_name . '/backend.xml';
if (!file_exists($xml_file)) {
cmsCore::error404();
}
$cfg = array();
$backend = simplexml_load_file($xml_file);
foreach ($backend->params->param as $param) {
$name = (string) $param['name'];
$type = (string) $param['type'];
$default = (string) $param['default'];
switch ($param['type']) {
case 'number':
$value = cmsCore::request($name, 'int', $default);
break;
case 'string':
$value = cmsCore::request($name, 'str', $default);
break;
case 'html':
$value = cmsCore::badTagClear(cmsCore::request($name, 'html', $default));
break;
case 'flag':
$value = cmsCore::request($name, 'int', 0);
break;
case 'list':
$value = is_array($_POST[$name]) ? cmsCore::request($name, 'array_str', $default) : cmsCore::request($name, 'str', $default);
break;
case 'list_function':
$value = cmsCore::request($name, 'str', $default);
break;
case 'list_db':
$value = is_array($_POST[$name]) ? cmsCore::request($name, 'array_str', $default) : cmsCore::request($name, 'str', $default);
break;
}
$cfg[$name] = $value;
}
if (!$cfg || !$plugin_name) {
cmsCore::redirectBack();
}
$inCore->savePluginConfig($plugin_name, $cfg);
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('index.php?view=plugins');
}
if ($do == 'config') {
$plugin_name = $inCore->getPluginById($id);
if (!$plugin_name) {
cmsCore::error404();
}
$plugin = $inCore->loadPlugin($plugin_name);
$config = $inCore->loadPluginConfig($plugin_name);
//.........这里部分代码省略.........
示例10: applet_components
//.........这里部分代码省略.........
cmsCore::loadLanguage('components/'. $com['link']);
cmsCore::loadLanguage('admin/components/'. $com['link']);
cpAddPathway($com['title'] .' v'. $com['version'], '?view=components&do=config&id='. $com['id']);
if (file_exists($file)) {
include($file);
return;
} else if (file_exists($file_cfg) || file_exists($file_json)) {
echo '<h3>'. $_LANG['AD_SETTINGS'] .': '. $com['title'] .'</h3>';
if (file_exists($file_cfg)) {
include($file_cfg);
} else {
$com_cfg = json_decode(file_get_contents($file_json));
}
if (!empty($com_cfg)) {
echo '<form action="index.php?view=components&do=save_config&id='. $com['id'] .'" method="POST">';
echo '<div style="width:650px;">'. cmsCore::c('form_gen')->generateForm($com_cfg, $inCore->loadComponentConfig($com['link'])) .'</div>';
echo '<div style="margin-top:6px;">';
echo '<input type="submit" class="btn btn-primary" name="save" value="'. $_LANG['SAVE'] .'" /> ';
echo '<input type="button" class="btn btn-default" name="back" value="'. $_LANG['CANCEL'] .'" onclick="window.history.go(-1)" />';
echo '</div>';
echo '</form>';
}
return;
}
cmsCore::redirect('index.php?view=components');
}
if ($do == 'save_config') {
if (cmsUser::checkCsrfToken()) {
$file_cfg = PATH .'/admin/components/'. $com['link'] .'/backend_cfg.php';
$file_json = PATH .'/admin/components/'. $com['link'] .'/backend_cfg.json';
if (file_exists($file_cfg) || file_exists($file_json)) {
if (file_exists($file_cfg)) {
include($file_cfg);
} else {
$com_cfg = json_decode(file_get_contents($file_json), true);
}
if (!empty($com_cfg)) {
$config = cmsCore::c('form_gen')->requestForm($com_cfg);
$inCore->saveComponentConfig($com['link'], $config);
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('?view=components&do=config&id='. $id);
}
}
}
cmsCore::error404();
}
if ($do == 'list') {
$toolmenu = array(
array( 'icon' => 'install.gif', 'title' => $_LANG['AD_INSTALL_COMPONENTS'], 'link' => '?view=install&do=component' ),
array( 'icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=components' )
);
cpToolMenu($toolmenu);
$fields = array(
array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
array( 'title' => $_LANG['TITLE'], 'field' => 'title','link' => '?view=components&do=config&id=%id%', 'width' => '' ),
array( 'title' => $_LANG['AD_VERSION'], 'field' => 'version', 'width' => '80' ),
array( 'title' => $_LANG['AD_ENABLE'], 'field' => 'published', 'width' => '80' ),
array( 'title' => $_LANG['AD_AUTHOR'], 'field' => 'author', 'width' => '200' ),
array( 'title' => $_LANG['AD_LINK'], 'field' => 'link', 'width' => '100' )
);
$actions = array(
array( 'title' => $_LANG['AD_CONFIG'], 'icon' => 'config.gif', 'link' => '?view=components&do=config&id=%id%', 'condition' => 'cpComponentHasConfig'),
array( 'title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'link' => '?view=install&do=remove_component&id=%id%', 'condition' => 'cpComponentCanRemove', 'confirm' => $_LANG['AD_DELETED_COMPONENT_FROM'])
);
$where = '';
if (cmsCore::c('user')->id > 1) {
foreach($adminAccess as $key => $value){
if (mb_strstr($value, 'admin/com_')) {
if ($where) { $where .= ' OR '; }
$value = str_replace('admin/com_', '', $value);
$where .= "link='". $value ."'";
}
}
}
if (!$where) { $where = 'id>0'; }
cpListTable('cms_components', $fields, $actions, $where);
}
}
示例11: applet_tickets
function applet_tickets() {
global $adminAccess;
if (!cmsUser::isAdminCan('admin/tickets', $adminAccess)) { cpAccessDenied(); }
global $_LANG;
cmsUser::sessionDel('ticket_cat');
$do = cmsCore::request('do', 'str', 'list');
$super_user = cmsCore::c('user')->id == 1;
$toolmenu = array(
array( 'icon' => 'new.gif', 'title' => $_LANG['AD_TICKET_CREATE'], 'link' => '?view=tickets&do=add' ),
array( 'icon' => 'liststuff.gif', 'title' => $_LANG['AD_TICKET_LIST'], 'link' => '?view=tickets&do=list' )
);
cpToolMenu($toolmenu, 'list', 'do');
cmsCore::c('page')->setTitle($_LANG['AD_TICKETS']);
cpAddPathway($_LANG['AD_TICKETS'], 'index.php?view=tickets');
if ($do == 'list') {
$fields = array(
array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
array( 'title' => $_LANG['AD_TICKET_STATUS'], 'field' => 'status', 'width' => '100', 'filter' => 1, 'prc' => 'cpTicketStatus', 'filterlist' => cpGetTicketStatusList() ),
array( 'title' => $_LANG['AD_TICKET_DATE'], 'field' => 'pubdate', 'width' => '80' ),
array( 'title' => $_LANG['AD_TICKET_TITLE'], 'field' => 'title', 'width' => '', 'filter' => 32, 'link' => 'index.php?view=tickets&do=view&id=%id%' ),
array( 'title' => $_LANG['AD_TICKET_LAST_MSG_DATE'], 'field' => 'last_msg_date', 'width' => '80' ),
array( 'title' => $_LANG['AD_TICKET_CAT'], 'field' => 'cat_id', 'width' => '150', 'filter' => 1, 'prc' => 'cpTicketCategory', 'filter' => 1, 'filterlist' => cpGetTicketCats() ),
array( 'title' => $_LANG['AD_TICKET_PRIORITY'], 'field' => 'priority', 'width' => '100', 'filter' => 1, 'prc' => 'cpTicketPriority', 'filterlist' => cpGetTicketPriorityList() )
);
if ($super_user) {
$fields[] = array( 'title' => $_LANG['AD_TICKET_USER'], 'field' => 'user_id', 'width' => '110', 'prc' => 'cpTicketAuthor' );
}
$actions = array(
array( 'title' => $_LANG['AD_TICKET_CLOSE'], 'icon' => 'off.gif', 'link' => '?view=tickets&do=close_ticket&id=%id%', 'condition' => 'cpCheckTicketClose' ),
array( 'title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'link' => '?view=tickets&do=delete&id=%id%', 'confirm' => $_LANG['AD_TICKET_DELETE'] )
);
cpListTable('cms_ticket', $fields, $actions, $super_user ? '' : 'user_id='. cmsCore::c('user')->id, 'last_msg_date DESC', 30);
}
if ($do == 'delete') {
$id = cmsCore::request('id', 'int', 0);
$item = cmsCore::c('db')->get_fields('cms_ticket', 'id='. $id, '*');
if (!empty($item)) {
$server = cmsCore::c('db')->get_field('cms_ticket_cat', 'id='. $item['cat_id'], 'server');
if (empty($server)) { $server = 'http://ds-soft.ru/tickets.api.php'; }
//Удаляем сам тиккет
cmsCore::c('db')->delete('cms_ticket', 'id='. $item['id']);
//Удаляем все сообщения тиккета
cmsCore::c('db')->delete('cms_ticket_msg', 'ticket_id='. $item['id']);
//Удаляем все прикрепленные изображения тиккета
cmsCore::deleteUploadImages($item['id'], 'ticket');
if ($item['status'] != '3') {
//Отправляем сообщение на сервер техподдержки что тикет удален
cmsCore::c('curl')->ajax()->request('post', $server .'?do=ticket_deleted', array( 'ticket_id' => $item['id'], 'ticket_secret_key' => $item['secret_key'], 'host' => cmsCore::c('config')->host ));
}
cmsCore::addSessionMessage($_LANG['AD_TICKET_DELETE_SUCCESS'], 'success');
} else {
cmsCore::addSessionMessage($_LANG['AD_TICKET_ERROR'], 'error');
}
cmsCore::redirect('index.php?view=tickets');
}
if ($do == 'close_ticket') {
$id = cmsCore::request('id', 'int', 0);
$item = cmsCore::c('db')->get_fields('cms_ticket', 'id='. $id, '*');
if (!empty($item)) {
cmsCore::c('db')->setFlag('cms_ticket', $item['id'], 'status', '3');
$server = cmsCore::c('db')->get_field('cms_ticket_cat', 'id='. $item['cat_id'], 'server');
if (empty($server)) { $server = 'http://ds-soft.ru/tickets.api.php'; }
//Отправляем сообщение на сервер техподдержки что тикет закрыт
cmsCore::c('curl')->ajax()->request('post', $server .'?do=ticket_closed', array( 'ticket_id' => $item['id'], 'ticket_secret_key' => $item['secret_key'], 'host' => cmsCore::c('config')->host ));
cmsCore::addSessionMessage($_LANG['AD_TICKET_CLOSE_SUCCESS'], 'success');
} else {
cmsCore::addSessionMessage($_LANG['AD_TICKET_ERROR'], 'error');
}
cmsCore::redirect('index.php?view=tickets');
}
if ($do == 'add') {
cpAddPathway($_LANG['AD_TICKET_CREATE'], 'index.php?view=tickets&do=add');
$cats = cpGetTicketCats();
?>
//.........这里部分代码省略.........
示例12: applet_modules
//.........这里部分代码省略.........
cpToolMenu($toolmenu);
$fields = array(
array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
array(
'title' => $_LANG['AD_TITLE'],
'field' => array('title','titles'), 'width'=>'',
'link' => '?view=modules&do=edit&id=%id%',
'prc' => function ($i) {
$i['titles'] = cmsCore::yamlToArray($i['titles']);
// переопределяем название пункта меню в зависимости от языка
if (!empty($i['titles'][cmsConfig::getConfig('lang')])) {
$i['title'] = $i['titles'][cmsConfig::getConfig('lang')];
}
return $i['title'];
}
),
array( 'title' => $_LANG['TITLE'], 'field' => 'name', 'width' => '220', 'filter' => '15' ),
array( 'title' => $_LANG['AD_VERSION'], 'field' => 'version', 'width' => '70' ),
array( 'title' => $_LANG['AD_AUTHOR'], 'field' => 'author', 'width' => '110' ),
array( 'title' => $_LANG['SHOW'], 'field' => 'published', 'width' => '80' ),
array( 'title' => $_LANG['AD_ORDER'], 'field' => 'ordering', 'width' => '100' ),
array( 'title' => $_LANG['AD_POSITION'], 'field' => 'position', 'width' => '80', 'filter' => '10', 'filterlist' => cpGetList('positions') )
);
$actions = array(
array( 'title' => $_LANG['AD_CONFIG'], 'icon' => 'config.gif', 'link' => '?view=modules&do=config&id=%id%', 'condition' => 'cpModuleHasConfig' ),
array( 'title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=modules&do=edit&id=%id%' ),
array( 'title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_MODULE_DELETE'], 'link' => '?view=modules&do=delete&id=%id%' )
);
cpListTable('cms_modules', $fields, $actions, '', 'published DESC, position, ordering ASC');
}
if ($do == 'autoorder'){
$rs = cmsCore::c('db')->query("SELECT id, position FROM cms_modules ORDER BY position") ;
if (cmsCore::c('db')->num_rows($rs)) {
$ord = 1;
while ($item = cmsCore::c('db')->fetch_assoc($rs)) {
if (isset($latest_pos)) {
if ($latest_pos != $item['position']) {
$ord = 1;
}
}
cmsCore::c('db')->query("UPDATE cms_modules SET ordering = ". $ord ." WHERE id=". $item['id']) ;
$ord += 1;
$latest_pos = $item['position'];
}
}
cmsCore::redirect('index.php?view=modules');
}
if ($do == 'move_up') {
if ($id >= 0) { dbMoveUp('cms_modules', $id, $co); }
cmsCore::redirectBack();
}
if ($do == 'move_down') {
if ($id >= 0) { dbMoveDown('cms_modules', $id, $co); }
cmsCore::redirectBack();
}
示例13: files_remove_directory
$mod = cmsCore::c('db')->get_fields('cms_forms', "id = '" . $item_id . "'", '*');
if (!$mod) {
cmsCore::error404();
}
cmsCore::callEvent('DELETE_FORM', $item_id);
cmsCore::c('db')->delete('cms_forms', "id = '" . $item_id . "'", 1);
cmsCore::c('db')->delete('cms_form_fields', "form_id = '" . $item_id . "'");
files_remove_directory(PATH . '/upload/forms/' . $item_id);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'] . '.');
cmsCore::redirect('?view=components&do=config&id=' . $id . '&opt=list');
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($opt == 'list') {
$fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=components&do=config&id=' . $id . '&opt=edit&item_id=%id%'), array('title' => $_LANG['AD_E-MAIL'], 'field' => 'email', 'width' => '150'));
$actions = array(array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=components&do=config&id=' . $id . '&opt=edit&item_id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_FORM_DELETE'], 'link' => '?view=components&do=config&id=' . $id . '&opt=delete&item_id=%id%'));
cpListTable('cms_forms', $fields, $actions, '', 'id DESC');
}
if (in_array($opt, array('add', 'edit'))) {
if ($opt == 'add') {
cpAddPathway($_LANG['AD_NEW_FORM']);
$mod = array('showtitle' => 1, 'form_action' => '/forms/process', 'tpl' => 'form', 'only_fields' => 0);
} else {
$item_id = cmsCore::request('item_id', 'int');
$field_id = cmsCore::request('field_id', 'int');
$mod = cmsCore::c('db')->get_fields('cms_forms', "id = '" . $item_id . "'", '*');
$field = cmsCore::c('db')->get_fields('cms_form_fields', "id='" . $field_id . "'", '*');
if ($field) {
$field['config'] = cmsCore::yamlToArray($field['config']);
}
echo '<h3>' . $_LANG['AD_FORM'] . ': ' . $mod['title'] . '</h3>';
cpAddPathway($mod['title']);
示例14: cpAddPathway
@chmod(PATH . '/upload/board/cat_icons/' . $f_icon, 0777);
@unlink(PATH . '/upload/board/cat_icons/' . $f_icon);
}
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirect('?view=components&do=config&id=' . $id . '&opt=list_cats');
}
if ($opt == 'list_cats') {
cpAddPathway($_LANG['AD_ALL_CAT']);
$fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=components&do=config&id=' . $id . '&opt=edit_cat&item_id=%id%'), array('title' => $_LANG['AD_IS_PUBLISHED'], 'field' => 'published', 'width' => '100', 'do' => 'opt', 'do_suffix' => '_cat'));
$actions = array(array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=components&do=config&id=' . $id . '&opt=edit_cat&item_id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_IF_CAT_DELETE'], 'link' => '?view=components&do=config&id=' . $id . '&opt=delete_cat&item_id=%id%'));
cpListTable('cms_board_cats', $fields, $actions, 'parent_id>0', 'NSLeft');
}
if ($opt == 'list_items') {
$fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['DATE'], 'field' => 'pubdate', 'width' => '80', 'filter' => '15', 'fdate' => '%d/%m/%Y'), array('title' => $_LANG['TYPE'], 'field' => 'obtype', 'width' => '80', 'filter' => '15'), array('title' => $_LANG['AD_TITLE'], 'field' => 'title', 'width' => '', 'filter' => '15', 'link' => '/board/edit%id%.html'), array('title' => $_LANG['AD_IS_PUBLISHED'], 'field' => 'published', 'width' => '60', 'do' => 'opt', 'do_suffix' => '_item'), array('title' => $_LANG['AD_VIEWS'], 'field' => 'hits', 'width' => '100'), array('title' => 'IP', 'field' => 'ip', 'width' => '80', 'prc' => 'long2ip'), array('title' => $_LANG['CAT_BOARD'], 'field' => 'category_id', 'width' => '230', 'prc' => 'cpBoardCatById', 'filter' => '1', 'filterlist' => cpGetList('cms_board_cats')));
$actions = array(array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '/board/edit%id%.html'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['DELETE_ADV'], 'link' => '?view=components&do=config&id=' . $id . '&opt=delete_item&item_id=%id%'));
cpListTable('cms_board_items', $fields, $actions, '', 'pubdate DESC');
}
if ($opt == 'add_cat' || $opt == 'edit_cat') {
cpAddPathway($_LANG['AD_ALL_CAT'], '?view=components&do=config&id=' . $id . '&opt=list_cats');
if ($opt == 'add_cat') {
cpAddPathway($_LANG['AD_NEW_CAT']);
} else {
$item_id = cmsCore::request('item_id', 'int', 0);
$mod = cmsCore::c('db')->get_fields('cms_board_cats', "id = '" . $item_id . "'", '*');
if (!$mod) {
cmsCore::error404();
}
echo '<h3>' . $_LANG['AD_CAT_EDIT'] . '</h3>';
cpAddPathway($_LANG['AD_CAT_EDIT'] . ' "' . $mod['title'] . '"');
}
//DEFAULT VALUES
示例15: applet_menu
function applet_menu()
{
$inCore = cmsCore::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/menu', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_MENU'];
cpAddPathway($_LANG['AD_MENU'], 'index.php?view=menu');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'list') {
$toolmenu[] = array('icon' => 'new.gif', 'title' => $_LANG['AD_MENU_POINT_ADD'], 'link' => '?view=menu&do=add');
$toolmenu[] = array('icon' => 'newmenu.gif', 'title' => $_LANG['AD_MENU_ADD'], 'link' => '?view=menu&do=addmenu');
$toolmenu[] = array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=edit&multiple=1');");
$toolmenu[] = array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=delete&multiple=1');");
$toolmenu[] = array('icon' => 'show.gif', 'title' => $_LANG['AD_ALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=show&multiple=1');");
$toolmenu[] = array('icon' => 'hide.gif', 'title' => $_LANG['AD_DISALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=hide&multiple=1');");
$toolmenu[] = array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=menu');
cpToolMenu($toolmenu);
$fields[] = array('title' => 'Lt', 'field' => 'NSLeft', 'width' => '30');
$fields[] = array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=menu&do=edit&id=%id%');
$fields[] = array('title' => $_LANG['SHOW'], 'field' => 'published', 'width' => '60');
$fields[] = array('title' => $_LANG['AD_ORDER'], 'field' => 'ordering', 'width' => '100');
$fields[] = array('title' => $_LANG['AD_LINK'], 'field' => array('linktype', 'linkid', 'link'), 'width' => '240', 'prc' => 'cpMenutypeById');
$fields[] = array('title' => $_LANG['AD_MENU'], 'field' => 'menu', 'width' => '70', 'filter' => '10', 'filterlist' => cpGetList('menu'), 'prc' => 'list_menu');
$fields[] = array('title' => $_LANG['TEMPLATE'], 'field' => 'template', 'width' => '70', 'prc' => 'cpTemplateById');
$actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=menu&do=edit&id=%id%');
$actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_MENU_POINT_CONFIRM'], 'link' => '?view=menu&do=delete&id=%id%');
cpListTable('cms_menu', $fields, $actions, 'parent_id>0', 'NSLeft, ordering');
} else {
$toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();');
$toolmenu[] = array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'index.php?view=menu');
cpToolMenu($toolmenu);
}
if ($do == 'move_up') {
$inDB->moveNsCategory('cms_menu', $id, 'up');
cmsCore::redirectBack();
}
if ($do == 'move_down') {
$inDB->moveNsCategory('cms_menu', $id, 'down');
cmsCore::redirectBack();
}
if ($do == 'show') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
dbShow('cms_menu', $id);
}
echo '1';
exit;
} else {
dbShowList('cms_menu', $_REQUEST['item']);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirectBack();
}
}
if ($do == 'hide') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
dbHide('cms_menu', $id);
}
echo '1';
exit;
} else {
dbHideList('cms_menu', cmsCore::request('item', 'array_int', array()));
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirectBack();
}
}
if ($do == 'delete') {
if (!isset($_REQUEST['item'])) {
if ($id >= 0) {
$inDB->deleteNS('cms_menu', (int) $id);
}
} else {
$items = cmsCore::request('item', 'array_int', array());
foreach ($items as $item_id) {
$inDB->deleteNS('cms_menu', $item_id);
}
}
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirectBack();
}
if ($do == 'update') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$id = cmsCore::request('id', 'int', 0);
if (!$id) {
cmsCore::redirectBack();
}
$title = cmsCore::request('title', 'str', '');
$menu = cmsCore::arrayToYaml(cmsCore::request('menu', 'array_str', ''));
$linktype = cmsCore::request('mode', 'str', '');
$linkid = cmsCore::request($linktype, 'str', '');
$link = $inCore->getMenuLink($linktype, $linkid);
$target = cmsCore::request('target', 'str', '');
$published = cmsCore::request('published', 'int', 0);
//.........这里部分代码省略.........