当前位置: 首页>>代码示例>>PHP>>正文


PHP cpAccessDenied函数代码示例

本文整理汇总了PHP中cpAccessDenied函数的典型用法代码示例。如果您正苦于以下问题:PHP cpAccessDenied函数的具体用法?PHP cpAccessDenied怎么用?PHP cpAccessDenied使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cpAccessDenied函数的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(); }
    
    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());
    }
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:35,代码来源:filters.php

示例2: 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);
    }
}
开发者ID:r2git,项目名称:icms1,代码行数:33,代码来源:filters.php

示例3: applet_robots

function applet_robots()
{
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/robots', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::c('page')->setTitle($_LANG['ROBOTS_TITLE']);
    cpAddPathway($_LANG['ROBOTS_TITLE']);
    $do = cmsCore::request('do', array('edit', 'save'), 'edit');
    if (!file_exists(PATH . '/robots.txt')) {
        $fp = fopen(PATH . '/robots.txt', 'w');
        fwrite($fp, str_replace(array('%domen%', '%host%'), array(str_replace(array('https://', 'http://'), '', cmsCore::c('config')->host), cmsCore::c('config')->host), file_get_contents(PATH . '/includes/default_robots.txt')));
        fclose($fp);
        chmod(PATH . '/robots.txt', 0777);
    }
    if ($do == 'save') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $data = cmsCore::request('robots', 'str');
        $fp = fopen(PATH . '/robots.txt', 'w');
        fwrite($fp, stripcslashes($data) . "\n");
        fclose($fp);
    }
    $robots = file_get_contents(PATH . '/robots.txt');
    cmsCore::c('page')->initTemplate('applets', 'robots')->assign('robots', $robots)->display();
}
开发者ID:CMS-RuDi,项目名称:CMS-RuDi,代码行数:28,代码来源:robots.php

示例4: applet_templates

function applet_templates()
{
    global $adminAccess;
    global $_LANG;
    if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
        cpAccessDenied();
    }
    $do = cmsCore::request('do', array('config', 'save_config'), 'main');
    cmsCore::c('page')->setTitle($_LANG['AD_TEMPLATES_SETTING']);
    cpAddPathway($_LANG['AD_TEMPLATES_SETTING'], 'index.php?view=templates');
    if ($do == 'main') {
        cmsCore::c('page')->initTemplate('applets', 'templates')->assign('templates', cmsCore::getDirsList('/templates'))->display();
    }
    if ($do == 'config') {
        $template = cmsCore::request('template', 'str', '');
        cpAddPathway($_LANG['AD_TEMPLATE'] . ': ' . $template, 'index.php?view=templates&do=config&template=' . $template);
        if (!file_exists(PATH . '/templates/' . $template) || !file_exists(PATH . '/templates/' . $template . '/config.php')) {
            cmsCore::error404();
        }
        include PATH . '/templates/' . $template . '/config.php';
        if (function_exists('get_template_cfg_fields')) {
            $tpl_cfgs = get_template_cfg_fields();
            if (!empty($tpl_cfgs)) {
                $tpl_cfgs_val = cmsCore::getTplCfg($template);
                cmsCore::c('page')->initTemplate('applets', 'templates')->assign('template', $template)->assign('form_gen_form', cmsCore::c('form_gen')->generateForm($tpl_cfgs, $tpl_cfgs_val))->display();
            } else {
                cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_NO_CONFIG'], 'error');
                cmsCore::redirectBack();
            }
        } else {
            cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_CFG_ERROR'], 'error');
            cmsCore::redirectBack();
        }
    }
    if ($do == 'save_config') {
        $template = cmsCore::request('template', 'str', '');
        if (!file_exists(PATH . '/templates/' . $template) || !file_exists(PATH . '/templates/' . $template . '/config.php') || !cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        include PATH . '/templates/' . $template . '/config.php';
        if (function_exists('get_template_cfg_fields')) {
            $tpl_cfgs = get_template_cfg_fields();
            if (!empty($tpl_cfgs)) {
                $tpl_cfgs = cmsCore::c('form_gen')->requestForm($tpl_cfgs);
                cmsCore::saveTplCfg($tpl_cfgs, $template);
                cmsCore::addSessionMessage($_LANG['AD_TEMPLATE_CFG_SAVED'], 'success');
                cmsCore::redirect('/admin/index.php?view=templates');
            } else {
                cmsCore::error404();
            }
        } else {
            cmsCore::error404();
        }
    }
}
开发者ID:CMS-RuDi,项目名称:CMS-RuDi,代码行数:55,代码来源:templates.php

示例5: applet_clearcache

function applet_clearcache()
{
    global $adminAccess;
    global $_LANG;
    if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::clearCache();
    cmsCore::addSessionMessage($_LANG['AD_CLEAR_CACHE_SUCCESS'], 'success');
    cmsCore::redirectBack();
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:11,代码来源:clearcache.php

示例6: applet_phpinfo

function applet_phpinfo()
{
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::c('page')->setTitle($_LANG['AD_PHP_INFO']);
    cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
    cpAddPathway($_LANG['AD_PHP_INFO'], 'index.php?view=phpinfo');
    ob_start();
    phpinfo();
    cmsCore::c('page')->initTemplate()->assign('phpinfo', ob_get_clean())->display();
}
开发者ID:CMS-RuDi,项目名称:CMS-RuDi,代码行数:14,代码来源:phpinfo.php

示例7: applet_robots

function applet_robots() {
    global $_LANG;
    global $adminAccess;
    
    if (!cmsUser::isAdminCan('admin/robots', $adminAccess)) { cpAccessDenied(); }
    
    cmsCore::c('page')->setTitle($_LANG['ROBOTS_TITLE']);

    cpAddPathway($_LANG['ROBOTS_TITLE']);

    $do = cmsCore::request('do', array('edit', 'save'), 'edit');

    if (!file_exists(PATH .'/robots.txt')) {
        $fp = fopen(PATH .'/robots.txt', 'w');
        fwrite($fp, str_replace(array('%domen%', '%host%'), array(str_replace(array('https://', 'http://'), '', cmsCore::c('config')->host), cmsCore::c('config')->host), file_get_contents(PATH .'/includes/default_robots.txt')));
        fclose ($fp);
        chmod(PATH .'/robots.txt', 0777);
    }

    if ($do == 'save') {
        if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }

        $data = cmsCore::request('robots', 'str');
        
        $fp = fopen(PATH .'/robots.txt', 'w');
        fwrite($fp, stripcslashes($data) ."\n");
        fclose ($fp);
    }

    $robots = file_get_contents(PATH .'/robots.txt');
?>
<form action="" method="post">
    <div style="width:650px;">
        <input type="hidden" name="csrf_token" value="<?php echo cmsUser::getCsrfToken(); ?>" />
        
        <div class="form-group">
            <label><?php echo $_LANG['ROBOTS_TXT_DATA']; ?></label>
            <textarea name="robots" class="form-control" style="height: 400px;"><?php echo $robots; ?></textarea>
            <div class="help-block"><?php echo $_LANG['ROBOTS_TXT_INFO']; ?></div>
        </div>
        
        <input type="hidden" name="do" value="save" />
        
        <input type="submit" class="btn btn-primary" name="save" value="<?php echo $_LANG['SAVE']; ?>" />
        <input type="button" class="btn btn-default" name="back" value="<?php echo $_LANG['CANCEL']; ?>" onclick="window.history.back();" />
    </div>
</form>
<?php
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:49,代码来源:robots.php

示例8: applet_tree

function applet_tree()
{
    $inCore = cmsCore::getInstance();
    cmsCore::loadLib('tags');
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/content', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES']);
    cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
    cmsCore::c('page')->addHeadJS('admin/js/content.js');
    echo '<script>';
    echo cmsPage::getLangJS('AD_NO_SELECTED_ARTICLES');
    echo cmsPage::getLangJS('AD_DELETE_SELECTED_ARTICLES');
    echo cmsPage::getLangJS('AD_PIECES');
    echo cmsPage::getLangJS('AD_CATEGORY_DELETE');
    echo cmsPage::getLangJS('AD_AND_SUB_CATS');
    echo cmsPage::getLangJS('AD_DELETE_SUB_ARTICLES');
    echo '</script>';
    $do = cmsCore::request('do', 'str', 'tree');
    if ($do == 'tree') {
        $toolmenu = array(array('icon' => 'config.gif', 'title' => $_LANG['AD_SETUP_CATEGORY'], 'link' => '?view=components&do=config&link=content'), array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=components&do=config&link=content'));
        cpToolMenu($toolmenu);
        $only_hidden = cmsCore::request('only_hidden', 'int', 0);
        $category_id = cmsCore::request('cat_id', 'int', 0);
        $base_uri = 'index.php?view=tree';
        $title_part = cmsCore::request('title', 'str', '');
        $def_order = $category_id ? 'con.ordering' : 'pubdate';
        $orderby = cmsCore::request('orderby', 'str', $def_order);
        $orderto = cmsCore::request('orderto', 'str', 'asc');
        $page = cmsCore::request('page', 'int', 1);
        $perpage = 20;
        if ($category_id) {
            cmsCore::m('content')->whereCatIs($category_id);
        }
        if ($title_part) {
            cmsCore::c('db')->where('LOWER(con.title) LIKE \'%' . mb_strtolower($title_part) . '%\'');
        }
        if ($only_hidden) {
            cmsCore::c('db')->where('con.published = 0');
        }
        cmsCore::c('db')->orderBy($orderby, $orderto);
        cmsCore::c('db')->limitPage($page, $perpage);
        $total = cmsCore::m('content')->getArticlesCount(false);
        cmsCore::c('page')->initTemplate('applets', 'tree')->assign('hide_cats', cmsCore::request('hide_cats', 'int', 0))->assign('only_hidden', $only_hidden)->assign('base_uri', $base_uri)->assign('category_id', $category_id)->assign('cats', cmsCore::m('content')->getCatsTree())->assign('orderto', $orderto)->assign('orderby', $orderby)->assign('title_part', $title_part)->assign('category_opt', $inCore->getListItemsNS('cms_category', $category_id))->assign('page', $page)->assign('total', $total)->assign('perpage', $perpage)->assign('pages', ceil($total / $perpage))->assign('items', cmsCore::m('content')->getArticlesList(false))->display();
    }
}
开发者ID:CMS-RuDi,项目名称:CMS-RuDi,代码行数:48,代码来源:tree.php

示例9: applet_phpinfo

function applet_phpinfo() {
    global $_LANG;
	global $adminAccess;
	if (!cmsUser::isAdminCan('admin/config', $adminAccess)) { cpAccessDenied(); }

	cmsCore::c('page')->setTitle($_LANG['AD_PHP_INFO']);

	cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
	cpAddPathway($_LANG['AD_PHP_INFO'], 'index.php?view=phpinfo');
?>
<div>
	<h3><?php echo $_LANG['AD_PHP_INFO']; ?></h3>
    <iframe src="/admin/includes/phpinfo.php" style="border:none;width:100%;height:600px" />
</div>
<?php
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:16,代码来源:phpinfo.php

示例10: applet_config

function applet_config()
{
    // получаем оригинальный конфиг
    $config = cmsConfig::getDefaultConfig();
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::c('page')->setTitle($_LANG['AD_SITE_SETTING']);
    cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
    $do = cmsCore::request('do', 'str', 'list');
    if ($do == 'save') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $newCFG = cmsCore::getArrayFromRequest(array('scheme' => array('scheme', array('http', 'https'), ''), 'sitename' => array('sitename', 'str', ''), 'title_and_sitename' => array('title_and_sitename', 'int', 0), 'title_and_page' => array('title_and_page', 'int', 0), 'hometitle' => array('hometitle', 'str', ''), 'homecom' => array('homecom', 'str', ''), 'com_without_name_in_url' => array('com_without_name_in_url', 'str', ''), 'siteoff' => array('siteoff', 'int', 0), 'only_authorized' => array('only_authorized', 'int', 0), 'debug' => array('debug', 'int', 0), 'offtext' => array('offtext', 'str', ''), 'keywords' => array('keywords', 'str', ''), 'metadesc' => array('metadesc', 'str', ''), 'seourl' => array('seourl', 'int', 0), 'lang' => array('lang', 'str', 'ru'), 'is_change_lang' => array('is_change_lang', 'int', 0), 'sitemail' => array('sitemail', 'str', ''), 'sitemail_name' => array('sitemail_name', 'str', ''), 'wmark' => array('wmark', 'str', ''), 'template' => array('template', 'str', ''), 'admin_template' => array('admin_template', 'str', ''), 'cache' => array('cache', 'int', 0), 'cache_type' => array('cache_type', array('file', 'memcached'), ''), 'memcached_host' => array('memcached_host', 'str', ''), 'memcached_port' => array('memcached_port', 'int', 0), 'combine_css_enable' => array('combine_css_enable', 'int', 0), 'combine_css' => array('combine_css', 'html', ''), 'combine_js_enable' => array('combine_js_enable', 'int', 0), 'combine_js' => array('combine_js', 'html', ''), 'splash' => array('splash', 'int', 0), 'slight' => array('slight', 'int', 0), 'show_pw' => array('show_pw', 'int', 0), 'last_item_pw' => array('last_item_pw', 'int', 0), 'index_pw' => array('index_pw', 'int', 0), 'fastcfg' => array('fastcfg', 'int', 0), 'mailer' => array('mailer', 'str', ''), 'smtpsecure' => array('smtpsecure', 'str', ''), 'smtpauth' => array('smtpauth', 'int', 0), 'smtpuser' => array('smtpuser', 'str', $config['smtpuser']), 'smtppass' => array('smtppass', 'str', $config['smtppass']), 'smtphost' => array('smtphost', 'str', ''), 'smtpport' => array('smtpport', 'int', '25'), 'timezone' => array('timezone', 'str', $config['timezone']), 'user_stats' => array('user_stats', 'int', 0), 'seo_url_count' => array('seo_url_count', 'int', 0), 'max_pagebar_links' => array('max_pagebar_links', 'int', 0), 'allow_ip' => array('allow_ip', 'str', ''), 'iframe_enable' => array('iframe_enable', 'int', 0), 'vk_enable' => array('vk_enable', 'int', 0), 'vk_id' => array('vk_id', 'str', ''), 'vk_private_key' => array('vk_private_key', 'str', '')));
        $newCFG['sitename'] = stripslashes($newCFG['sitename']);
        $newCFG['hometitle'] = stripslashes($newCFG['hometitle']);
        $newCFG['offtext'] = htmlspecialchars($newCFG['offtext'], ENT_QUOTES);
        $newCFG['db_host'] = $config['db_host'];
        $newCFG['db_base'] = $config['db_base'];
        $newCFG['db_user'] = $config['db_user'];
        $newCFG['db_pass'] = $config['db_pass'];
        $newCFG['db_prefix'] = $config['db_prefix'];
        if (cmsConfig::saveToFile($newCFG)) {
            cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
        } else {
            cmsCore::addSessionMessage($_LANG['AD_CONFIG_SITE_ERROR'], 'error');
        }
        cmsCore::clearCache();
        cmsCore::redirect('index.php?view=config');
    }
    cpCheckWritable('/includes/config/config.inc.json');
    $result = cmsCore::c('db')->query("SELECT (sum(data_length)+sum(index_length))/1024/1024 as size FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = '" . $config['db_base'] . "'", true);
    if (!cmsCore::c('db')->error()) {
        $s = cmsCore::c('db')->fetch_assoc($result);
    } else {
        $s['size'] = 0;
    }
    cmsCore::c('page')->initTemplate('applets', 'config')->assign('config', $config)->assign('timezone_opt', cmsCore::getTimeZonesOptions($config['timezone']))->assign('admin_templates', cmsCore::getDirsList('/templates/admin'))->assign('templates', cmsCore::getDirsList('/templates'))->assign('tpl_info', cmsCore::c('page')->getTplInfo(cmsCore::c('page')->template))->assign('components_opt', cmsCore::getListItems('cms_components', $config['com_without_name_in_url'], 'title', 'ASC', 'internal=0', 'link'))->assign('homecom_opt', cmsCore::getListItems('cms_components', $config['homecom'], 'title', 'ASC', 'internal=0', 'link'))->assign('langs', cmsCore::getDirsList('/languages'))->assign('db_size', round($s['size'], 2))->display();
}
开发者ID:CMS-RuDi,项目名称:CMS-RuDi,代码行数:42,代码来源:config.php

示例11: applet_tree

function applet_tree()
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inPage = cmsPage::getInstance();
    cmsCore::loadLib('tags');
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/content', $adminAccess)) {
        cpAccessDenied();
    }
    $cfg = $inCore->loadComponentConfig('content');
    cmsCore::loadModel('content');
    $model = new cms_model_content();
    $GLOBALS['cp_page_title'] = $_LANG['AD_ARTICLES'];
    cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
    $GLOBALS['cp_page_head'][] = '<script language="JavaScript" type="text/javascript" src="js/content.js"></script>';
    echo '<script>';
    echo cmsPage::getLangJS('AD_NO_SELECTED_ARTICLES');
    echo cmsPage::getLangJS('AD_DELETE_SELECTED_ARTICLES');
    echo cmsPage::getLangJS('AD_PIECES');
    echo cmsPage::getLangJS('AD_CATEGORY_DELETE');
    echo cmsPage::getLangJS('AD_AND_SUB_CATS');
    echo cmsPage::getLangJS('AD_DELETE_SUB_ARTICLES');
    echo '</script>';
    $do = cmsCore::request('do', 'str', 'tree');
    //============================================================================//
    //============================================================================//
    if ($do == 'tree') {
        $toolmenu[] = array('icon' => 'config.gif', 'title' => $_LANG['AD_SETUP_CATEGORY'], 'link' => '?view=components&do=config&link=content');
        $toolmenu[] = array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=components&do=config&link=content');
        cpToolMenu($toolmenu);
        $only_hidden = cmsCore::request('only_hidden', 'int', 0);
        $category_id = cmsCore::request('cat_id', 'int', 0);
        $base_uri = 'index.php?view=tree';
        $title_part = cmsCore::request('title', 'str', '');
        $def_order = $category_id ? 'con.ordering' : 'pubdate';
        $orderby = cmsCore::request('orderby', 'str', $def_order);
        $orderto = cmsCore::request('orderto', 'str', 'asc');
        $page = cmsCore::request('page', 'int', 1);
        $perpage = 20;
        $hide_cats = cmsCore::request('hide_cats', 'int', 0);
        $cats = $model->getCatsTree();
        if ($category_id) {
            $model->whereCatIs($category_id);
        }
        if ($title_part) {
            $inDB->where('LOWER(con.title) LIKE \'%' . mb_strtolower($title_part) . '%\'');
        }
        if ($only_hidden) {
            $inDB->where('con.published = 0');
        }
        $inDB->orderBy($orderby, $orderto);
        $inDB->limitPage($page, $perpage);
        $total = $model->getArticlesCount(false);
        $items = $model->getArticlesList(false);
        $pages = ceil($total / $perpage);
        $tpl_file = 'admin/content.php';
        $tpl_dir = file_exists(TEMPLATE_DIR . $tpl_file) ? TEMPLATE_DIR : DEFAULT_TEMPLATE_DIR;
        include $tpl_dir . $tpl_file;
    }
}
开发者ID:r2git,项目名称:icms1,代码行数:63,代码来源:tree.php

示例12: 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);
//.........这里部分代码省略.........
开发者ID:vicktorwork,项目名称:cms1,代码行数:101,代码来源:menu.php

示例13: applet_cron

function applet_cron() {
    cmsCore::loadClass('cron');
    
    global $_LANG;
    
    global $adminAccess;
    
    if (!cmsUser::isAdminCan('admin/config', $adminAccess)) { cpAccessDenied(); }

    cmsCore::c('page')->setTitle($_LANG['AD_CRON_MISSION']);
    cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
    cpAddPathway($_LANG['AD_CRON_MISSION'], 'index.php?view=cron');

    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', '0');
    
    if ($do == 'list') {
        $toolmenu = array(
            array( 'icon' => 'new.gif', 'title' => $_LANG['AD_CREATE_CRON_MISSION'], 'link' => '?view=cron&do=add' )
        );

        cpToolMenu($toolmenu);

        $items = cmsCron::getJobs(false);

        $tpl_file   = 'admin/cron.php';
        $tpl_dir    = file_exists(TEMPLATE_DIR . $tpl_file) ? TEMPLATE_DIR : DEFAULT_TEMPLATE_DIR;

        include($tpl_dir . $tpl_file);
    }

    if ($do == 'show') {
        if ($id) { cmsCron::jobEnabled($id, true);  }
        cmsCore::halt('1');
    }
    
    if ($do == 'hide') {
        if ($id) { cmsCron::jobEnabled($id, false);  }
        cmsCore::halt('1');
    }
    
    if ($do == 'delete') {
        if ($id) { cmsCron::removeJobById($id); }
        cmsCore::redirect('index.php?view=cron');
    }
    
    if ($do == 'execute') {
        if ($id) { $job_result = cmsCron::executeJobById($id); }

        if ($job_result) {
            cmsCore::addSessionMessage($_LANG['AD_MISSION_SUCCESS'], 'success');
        } else {
            cmsCore::addSessionMessage($_LANG['AD_MISSION_ERROR'], 'error');
        }

        cmsCore::redirect('index.php?view=cron');
    }
    
    if ($do == 'submit') {
        if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }

        $job_name     = cmsCore::request('job_name', 'str');
        $comment      = cmsCore::request('comment', 'str');
        $job_interval = cmsCore::request('job_interval', 'int');
        $enabled      = cmsCore::request('enabled', 'int');
        $component    = cmsCore::request('component', 'str');
        $model_method = cmsCore::request('model_method', 'str');
        $custom_file  = cmsCore::request('custom_file', 'str');
        $custom_file  = (mb_stripos($custom_file, 'image') || mb_stripos($custom_file, 'upload') || mb_stripos($custom_file, 'cache')) ? '' : $custom_file;
        $custom_file  = preg_replace('/\.+\//', '', $custom_file);
        $class_name   = cmsCore::request('class_name', 'str');
        $class_method = cmsCore::request('class_method', 'str');

        cmsCron::registerJob(
            $job_name,
            array(
                'interval' => $job_interval,
                'component' => $component,
                'model_method' => $model_method,
                'comment' => $comment,
                'custom_file' => $custom_file,
                'enabled' => $enabled,
                'class_name' => $class_name,
                'class_method' => $class_method
            )
        );

        cmsCore::redirect('index.php?view=cron');
    }
    
    if ($do == 'update') {
        if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }

        if (!$id) { cmsCore::halt(); }

        $job_name     = cmsCore::request('job_name', 'str');
        $comment      = cmsCore::request('comment', 'str');
        $job_interval = cmsCore::request('job_interval', 'int');
        $enabled      = cmsCore::request('enabled', 'int');
        $component    = cmsCore::request('component', 'str');
//.........这里部分代码省略.........
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:cron.php

示例14: applet_users

function applet_users() {
    $inCore = cmsCore::getInstance();
    cmsCore::loadClass('actions');
    cmsCore::loadModel('users');
    $model = new cms_model_users();

    // подключаем язык компонента регистрации
    cmsCore::loadLanguage('components/registration');

    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/users', $adminAccess)) { cpAccessDenied(); }

    cmsCore::c('page')->setTitle($_LANG['AD_USERS']);
    cpAddPathway($_LANG['AD_USERS'], 'index.php?view=users');

    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', 0);

    if ($do == 'list') {
        $toolmenu = array(
            array( 'icon' => 'useradd.gif', 'title' => $_LANG['AD_USER_ADD'], 'link' => '?view=users&do=add' ),
            array( 'icon' => 'useredit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=users&do=edit&multiple=1');" ),
            array( 'icon' => 'userdelete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:if(confirm('". $_LANG['AD_IF_USERS_SELECT_REMOVE'] ."')) { checkSel('?view=users&do=delete&multiple=1'); }" ),
            array( 'icon' => 'usergroup.gif', 'title' => $_LANG['AD_USERS_GROUP'], 'link' => '?view=usergroups' ),
            array( 'icon' => 'userbanlist.gif', 'title' => $_LANG['AD_BANLIST'], 'link' => '?view=userbanlist' ),
            array( 'icon' => 'user_go.png', 'title' => $_LANG['AD_USERS_SELECT_ACTIVATE'], 'link' => "javascript:if(confirm('". $_LANG['AD_IF_USERS_SELECT_ACTIVATE'] ."')) { checkSel('?view=users&do=activate&multiple=1'); }" ),
            array( 'icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=users' )
        );
        
        cpToolMenu($toolmenu);
        
        $fields = array(
            array( 'title' => 'id', 'field' => 'id', 'width' => '40'  ),
            array( 'title' => $_LANG['LOGIN'], 'field' => 'login', 'width' => '100', 'link' => '?view=users&do=edit&id=%id%', 'filter' => 12 ),
            array( 'title' => $_LANG['NICKNAME'], 'field' => 'nickname', 'width' => '', 'link' => '?view=users&do=edit&id=%id%', 'filter' => 12 ),
            array( 'title' => $_LANG['AD_RATING'], 'field' => array( 'rating', 'id' ), 'width' => '70', 'prc' => 'setRating' ),
            array( 'title' => $_LANG['AD_GROUP'], 'field' => 'group_id', 'width' => '110', 'prc' => 'cpGroupById', 'filter' => 1, 'filterlist' => cpGetList('cms_user_groups') ),
            array( 'title' => $_LANG['EMAIL'], 'field' => 'email', 'width' => '120' ),
            array( 'title' => $_LANG['AD_REGISTRATION_DATE'], 'field' => 'regdate', 'width' => '100' ),
            array( 'title' => $_LANG['AD_LAST_LOGIN'], 'field' => 'logdate', 'width' => '100' ),
            array( 'title' => $_LANG['AD_LAST_IP'], 'field' => 'last_ip', 'width' => '90', 'prc' => 'getIpLink' ),
            array( 'title' => $_LANG['AD_IS_LOCKED'], 'field' => 'is_locked', 'width' => '110', 'prc' => 'viewAct' ),
            array( 'title' => $_LANG['AD_IS_DELETED'], 'field' => 'is_deleted', 'width' => '80', 'prc' => 'viewDel' )
        );
        
        $actions = array(
            array( 'title' => $_LANG['AD_PROFILE'], 'icon' => 'profile.gif', 'link' => '/users/%login%' ),
            array( 'title' => $_LANG['AD_BANNED'], 'icon' => 'ban.gif', 'link' => '?view=userbanlist&do=add&to=%id%' ),
            array( 'title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_IS_USER_DELETE'], 'link' => '?view=users&do=delete&id=%id%' ),
            array( 'title' => $_LANG['AD_FOREVER_USER_DELETE'], 'icon' => 'off.gif', 'confirm' => $_LANG['AD_IF_FOREVER_USER_DELETE'], 'link' => '?view=users&do=delete_full&id=%id%' )
        );
        
        cpListTable('cms_users', $fields, $actions, '1=1', 'regdate DESC');
    }
    
    if ($do == 'rerating') {
        $user_id = cmsCore::request('user_id', 'int');
        if (!$user_id) { cmsCore::redirectBack(); }
        
        $rating = cmsUser::getRating($user_id);

        $user_sql = "UPDATE cms_users
                     SET rating = ". $rating ."
                     WHERE id = '". $user_id ."'";

        cmsCore::c('db')->query($user_sql);
        
        cmsCore::redirectBack();
    }
    
    if ($do == 'activate') {
        $user_ids = cmsCore::request('item', 'array_int');
        if (!$user_ids) { cmsCore::redirectBack(); }

        foreach ($user_ids as $user_id) {
            $code = cmsCore::c('db')->get_field('cms_users_activate', "user_id = '". $user_id ."'", 'code');

            $sql = "UPDATE cms_users SET is_locked = 0 WHERE id = '". $user_id ."'";
            cmsCore::c('db')->query($sql);

            $sql = "DELETE FROM cms_users_activate WHERE code = '". $code ."'";
            cmsCore::c('db')->query($sql);

            cmsCore::callEvent('USER_ACTIVATED', $user_id);

            // Регистрируем событие
            cmsActions::log(
                'add_user',
                array(
                    'object' => '',
                    'user_id' => $user_id,
                    'object_url' => '',
                    'object_id' => $user_id,
                    'target' => '',
                    'target_url' => '',
                    'target_id' => 0,
                    'description' => ''
                )
            );
//.........这里部分代码省略.........
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:users.php

示例15: applet_cron

function applet_cron()
{
    cmsCore::loadClass('cron');
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/config', $adminAccess)) {
        cpAccessDenied();
    }
    $GLOBALS['cp_page_title'] = $_LANG['AD_CRON_MISSION'];
    cpAddPathway($_LANG['AD_SITE_SETTING'], 'index.php?view=config');
    cpAddPathway($_LANG['AD_CRON_MISSION'], 'index.php?view=cron');
    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', '0');
    if ($do == 'list') {
        $toolmenu = array(array('icon' => 'new.gif', 'title' => $_LANG['AD_CREATE_CRON_MISSION'], 'link' => '?view=cron&do=add'));
        cpToolMenu($toolmenu);
        $items = cmsCron::getJobs(false);
        $tpl_file = 'admin/cron.php';
        $tpl_dir = file_exists(TEMPLATE_DIR . $tpl_file) ? TEMPLATE_DIR : DEFAULT_TEMPLATE_DIR;
        include $tpl_dir . $tpl_file;
    }
    if ($do == 'show') {
        if ($id) {
            cmsCron::jobEnabled($id, true);
        }
        echo '1';
        exit;
    }
    if ($do == 'hide') {
        if ($id) {
            cmsCron::jobEnabled($id, false);
        }
        echo '1';
        exit;
    }
    if ($do == 'delete') {
        if ($id) {
            cmsCron::removeJobById($id);
        }
        cmsCore::redirect('index.php?view=cron');
    }
    if ($do == 'execute') {
        if ($id) {
            $job_result = cmsCron::executeJobById($id);
        }
        if ($job_result) {
            cmsCore::addSessionMessage($_LANG['AD_MISSION_SUCCESS'], 'success');
        } else {
            cmsCore::addSessionMessage($_LANG['AD_MISSION_ERROR'], 'error');
        }
        cmsCore::redirect('index.php?view=cron');
    }
    if ($do == 'submit') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $job_name = cmsCore::request('job_name', 'str');
        $comment = cmsCore::request('comment', 'str');
        $job_interval = cmsCore::request('job_interval', 'int');
        $enabled = cmsCore::request('enabled', 'int');
        $component = cmsCore::request('component', 'str');
        $model_method = cmsCore::request('model_method', 'str');
        $custom_file = cmsCore::request('custom_file', 'str');
        $custom_file = mb_stripos($custom_file, 'image/') || mb_stripos($custom_file, 'upload/') || mb_stripos($custom_file, 'cache/') ? '' : $custom_file;
        $custom_file = preg_replace('/\\.+\\//', '', $custom_file);
        $class_name = cmsCore::request('class_name', 'str');
        $class_method = cmsCore::request('class_method', 'str');
        cmsCron::registerJob($job_name, array('interval' => $job_interval, 'component' => $component, 'model_method' => $model_method, 'comment' => $comment, 'custom_file' => $custom_file, 'enabled' => $enabled, 'class_name' => $class_name, 'class_method' => $class_method));
        cmsCore::redirect('index.php?view=cron');
    }
    if ($do == 'update') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        if (!$id) {
            cmsCore::halt();
        }
        $job_name = cmsCore::request('job_name', 'str');
        $comment = cmsCore::request('comment', 'str');
        $job_interval = cmsCore::request('job_interval', 'int');
        $enabled = cmsCore::request('enabled', 'int');
        $component = cmsCore::request('component', 'str');
        $model_method = cmsCore::request('model_method', 'str');
        $custom_file = cmsCore::request('custom_file', 'str');
        $custom_file = mb_stripos($custom_file, 'image/') || mb_stripos($custom_file, 'upload/') || mb_stripos($custom_file, 'cache/') ? '' : $custom_file;
        $custom_file = preg_replace('/\\.+\\//', '', $custom_file);
        $class_name = cmsCore::request('class_name', 'str');
        $class_method = cmsCore::request('class_method', 'str');
        cmsCron::updateJob($id, array('job_name' => $job_name, 'job_interval' => $job_interval, 'component' => $component, 'model_method' => $model_method, 'comment' => $comment, 'custom_file' => $custom_file, 'is_enabled' => $enabled, 'class_name' => $class_name, 'class_method' => $class_method));
        cmsCore::redirect('index.php?view=cron');
    }
    if ($do == 'edit' || $do == 'add') {
        $toolmenu = array(array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();'), array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'javascript:history.go(-1);'));
        cpToolMenu($toolmenu);
        if ($do == 'edit') {
            $mod = cmsCron::getJobById($id);
            echo '<h3>' . $_LANG['AD_EDIT_MISSION'] . '</h3>';
            cpAddPathway($mod['job_name'], 'index.php?view=cron&do=edit&id=' . $mod['id']);
        } else {
            echo '<h3>' . $_LANG['AD_CREATE_CRON_MISSION'] . '</h3>';
//.........这里部分代码省略.........
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:cron.php


注:本文中的cpAccessDenied函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。