本文整理汇总了PHP中cmsCore::request方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::request方法的具体用法?PHP cmsCore::request怎么用?PHP cmsCore::request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::request方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: f_pages
function f_pages(&$text)
{
if (mb_strpos($text, 'pagebreak') === false) {
return true;
}
$seolink = urldecode(cmsCore::request('seolink', 'str', ''));
$seolink = preg_replace('/[^a-zа-я-яёіїєґА-ЯЁІЇЄҐ0-9_\\/\\-]/ui', '', $seolink);
if (!$seolink) {
return true;
}
$regex = '/{(pagebreak)\\s*(.*?)}/iu';
$pages = preg_split($regex, $text);
$n = count($pages);
if ($n <= 1) {
return true;
} else {
$page = cmsCore::request('page', 'int', 1);
$text = $pages[$page - 1];
if (!$text) {
cmsCore::error404();
}
cmsCore::loadModel('content');
$text .= cmsPage::getPagebar($n, $page, 1, cms_model_content::getArticleURL(null, $seolink, '%page%'));
return true;
}
}
示例3: mod_category
function mod_category($mod, $cfg)
{
$inDB = cmsDatabase::getInstance();
cmsCore::loadModel('content');
$model = new cms_model_content();
if (!isset($cfg['category_id'])) {
$cfg['category_id'] = 0;
}
if (!isset($cfg['show_subcats'])) {
$cfg['show_subcats'] = 1;
}
if (!isset($cfg['expand_all'])) {
$cfg['expand_all'] = 1;
}
$rootcat = $inDB->getNsCategory('cms_category', $cfg['category_id']);
if (!$rootcat) {
return false;
}
$subcats_list = $model->getSubCats($rootcat['id'], $cfg['show_subcats'], $rootcat['NSLeft'], $rootcat['NSRight']);
if (!$subcats_list) {
return false;
}
$current_seolink = urldecode(cmsCore::request('seolink', 'str', ''));
cmsPage::initTemplate('modules', $cfg['tpl'])->assign('cfg', $cfg)->assign('current_seolink', $current_seolink)->assign('subcats_list', $subcats_list)->display($cfg['tpl']);
return true;
}
示例4: mod_category
function mod_category($mod, $cfg) {
$cfg = array_merge(
array(
'category_id' => 0,
'show_subcats' => 1,
'expand_all' => 1
),
$cfg
);
$rootcat = cmsCore::c('db')->getNsCategory('cms_category', $cfg['category_id']);
if (!$rootcat) { return false; }
$subcats_list = cmsCore::m('content')->getSubCats($rootcat['id'], $cfg['show_subcats'], $rootcat['NSLeft'], $rootcat['NSRight']);
if (!$subcats_list) { return false; }
$current_seolink = urldecode(cmsCore::request('seolink', 'str', ''));
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('cfg', $cfg)->
assign('current_seolink', $current_seolink)->
assign('subcats_list', $subcats_list)->
display();
return true;
}
示例5: subscribes
function subscribes(){
$inCore = cmsCore::getInstance();
$inUser = cmsUser::getInstance();
$do = $inCore->do;
//========================================================================================================================//
//========================================================================================================================//
if ($do=='view'){
$subscribe = cmsCore::request('subscribe', 'int', 0);
$target = cmsCore::request('target', 'str', '');
$target_id = cmsCore::request('target_id', 'int', 0);
if (!$target_id || !$target){
cmsCore::error404();
}
if ($inUser->id){
cmsUser::subscribe($inUser->id, $target, $target_id, $subscribe);
}
if(cmsCore::isAjax()){
cmsCore::jsonOutput(array('subscribe'=>$subscribe));
} else {
cmsCore::redirectBack();
}
}
}
示例6: polls
function polls()
{
$model = new cms_model_polls();
global $_LANG;
$do = cmsCore::getInstance()->do;
//========================================================================================================================//
//========================================================================================================================//
if ($do == 'view') {
$answer = cmsCore::request('answer', 'str', '');
$poll_id = cmsCore::request('poll_id', 'int');
if (!$answer || !$poll_id) {
if (cmsCore::isAjax()) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['SELECT_THE_OPTION']));
} else {
cmsCore::error404();
}
}
$poll = $model->getPoll($poll_id);
if (!$poll) {
cmsCore::jsonOutput(array('error' => true, 'text' => ''));
}
if ($model->isUserVoted($poll_id)) {
cmsCore::jsonOutput(array('error' => true, 'text' => ''));
}
if (!cmsUser::checkCsrfToken()) {
cmsCore::halt();
}
$model->votePoll($poll, $answer);
cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['VOTE_ACCEPTED']));
}
}
示例7: 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);
}
}
示例8: 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());
}
}
示例9: __construct
public function __construct(){
$this->config = cmsCore::getInstance()->loadComponentConfig('arhive');
cmsCore::loadLanguage('components/arhive');
$this->year = cmsCore::request('y', 'int', 'all');
$this->month = sprintf("%02d", cmsCore::request('m', 'int', 'all'));
$this->day = sprintf("%02d", cmsCore::request('d', 'int', 'all'));
$this->setSqlParams();
}
示例10: applet_cache
function applet_cache()
{
$target = cmsCore::request('target', 'str', '');
$target_id = cmsCore::request('id', 'int', 0);
if (!$target || !$target_id) {
cmsCore::error404();
}
cmsCore::deleteCache($target, $target_id);
cmsCore::redirectBack();
}
示例11: 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();
}
}
}
示例12: applet_cache
function applet_cache() {
$component = cmsCore::request('component', 'str', '');
$target = cmsCore::request('target', 'str', '');
$target_id = cmsCore::request('target_id', 'str', '');
if (empty($component) || empty($target_id)) { cmsCore::error404(); }
cmsCore::c('cache')->remove($component, $target_id, $target);
cmsCore::redirectBack();
}
示例13: checkCaptcha
/**
* Проверяет код каптчи
* @return bool
*/
public function checkCaptcha()
{
$captcha_code = cmsCore::request('captcha_code', 'str', '');
$captcha_id = cmsCore::request('captcha_id', 'str', '');
if (!$captcha_id || empty($_SESSION['captcha'][$captcha_id]) || !$captcha_code) {
return false;
}
$real_code = $_SESSION['captcha'][$captcha_id];
unset($_SESSION['captcha'][$captcha_id]);
return $real_code === $captcha_code;
}
示例14: 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');
}
}
示例15: files
function files()
{
$inDB = cmsDatabase::getInstance();
global $_LANG;
$do = cmsCore::getInstance()->do;
$model = new cms_model_files();
//============================================================================//
// Скачивание
if ($do == 'view') {
$fileurl = cmsCore::request('fileurl', 'html', '');
if (mb_strpos($fileurl, '-') === 0) {
$fileurl = htmlspecialchars_decode(base64_decode(ltrim($fileurl, '-')));
}
$fileurl = cmsCore::strClear($fileurl);
if (!$fileurl || mb_strstr($fileurl, '..') || strpos($fileurl, '.') === 0) {
cmsCore::error404();
}
if (strpos($fileurl, 'http') === 0) {
$model->increaseDownloadCount($fileurl);
cmsCore::redirect($fileurl);
} elseif (file_exists(PATH . $fileurl)) {
$model->increaseDownloadCount($fileurl);
header('Content-Disposition: attachment; filename=' . basename($fileurl) . "\n");
header('Content-Type: application/x-force-download; name="' . $fileurl . '"' . "\n");
header('Location:' . $fileurl);
cmsCore::halt();
} else {
cmsCore::halt($_LANG['FILE_NOT_FOUND']);
}
}
//============================================================================//
if ($do == 'redirect') {
$url = str_replace(array('--q--', ' '), array('?', '+'), cmsCore::request('url', 'str', ''));
if (mb_strpos($url, '-') === 0) {
$url = htmlspecialchars_decode(base64_decode(ltrim($url, '-')));
}
$url = cmsCore::strClear($url);
if (!$url || mb_strstr($url, '..') || strpos($url, '.') === 0) {
cmsCore::error404();
}
// кириллические домены
$url_host = parse_url($url, PHP_URL_HOST);
if (preg_match('/^[а-яё]+/iu', $url_host)) {
cmsCore::loadClass('idna_convert');
$IDN = new idna_convert();
$host = $IDN->encode($url_host);
$url = str_ireplace($url_host, $host, $url);
}
cmsCore::redirect($url);
}
//============================================================================//
}