本文整理汇总了PHP中cmsCore::badTagClear方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::badTagClear方法的具体用法?PHP cmsCore::badTagClear怎么用?PHP cmsCore::badTagClear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::badTagClear方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: users
//.........这里部分代码省略.........
cmsCore::addSessionMessage($_LANG['LONG_CITY_NAME'], 'error');
$errors = true;
}
$users['email'] = cmsCore::request('email', 'email');
if (!$users['email']) {
cmsCore::addSessionMessage($_LANG['REALY_ADRESS_EMAIL'], 'error');
$errors = true;
}
if ($usr['email'] != $users['email']) {
$is_set_email = $inDB->get_field('cms_users', "email='{$users['email']}'", 'id');
if ($is_set_email) {
cmsCore::addSessionMessage($_LANG['ADRESS_EMAIL_IS_BUSY'], 'error');
$errors = true;
} else {
// формируем токен
$token = md5($usr['email'] . uniqid() . microtime());
$inDB->insert('cms_users_activate', array('user_id' => $inUser->id, 'pubdate' => date("Y-m-d H:i:s"), 'code' => $token));
$codelink = HOST . '/users/change_email/' . $token . '/' . $users['email'];
// по старому адресу высылаем письмо с подтверждением
$letter = cmsCore::getLanguageTextFile('change_email');
$letter = str_replace(array('{nickname}', '{codelink}'), array($inUser->nickname, $codelink), $letter);
cmsCore::mailText($usr['email'], '', $letter);
cmsCore::addSessionMessage(sprintf($_LANG['YOU_CHANGE_EMAIL'], $usr['email']), 'info');
// email не меняем
$users['email'] = $usr['email'];
}
}
$profiles['showphone'] = cmsCore::request('showphone', 'int', 0);
$profiles['showmail'] = cmsCore::request('showmail', 'int');
$profiles['email_newmsg'] = cmsCore::request('email_newmsg', 'int');
$profiles['showbirth'] = cmsCore::request('showbirth', 'int');
$profiles['description'] = cmsCore::request('description', 'str', '');
$users['birthdate'] = (int) $_REQUEST['birthdate']['year'] . '-' . (int) $_REQUEST['birthdate']['month'] . '-' . (int) $_REQUEST['birthdate']['day'];
$profiles['signature'] = $inDB->escape_string(cmsCore::badTagClear(cmsCore::request('signature', 'html', '')));
$profiles['signature_html'] = $inDB->escape_string(cmsCore::parseSmiles(cmsCore::request('signature', 'html', ''), true));
$profiles['allow_who'] = cmsCore::request('allow_who', 'str');
if (!preg_match('/^([a-zA-Z]+)$/ui', $profiles['allow_who'])) {
$errors = true;
}
$users['icq'] = cmsCore::request('icq', 'str', '');
$profiles['showicq'] = cmsCore::request('showicq', 'int');
$profiles['cm_subscribe'] = cmsCore::request('cm_subscribe', 'str');
if (!preg_match('/^([a-zA-Z]+)$/ui', $profiles['cm_subscribe'])) {
$errors = true;
}
$users['phone'] = cmsCore::request('phone', 'int', 0);
// получаем данные форм
$profiles['formsdata'] = '';
if (isset($model->config['privforms'])) {
if (is_array($model->config['privforms'])) {
foreach ($model->config['privforms'] as $form_id) {
$form_input = cmsForm::getFieldsInputValues($form_id);
$profiles['formsdata'] .= $inDB->escape_string(cmsCore::arrayToYaml($form_input['values']));
// Проверяем значения формы
foreach ($form_input['errors'] as $field_error) {
if ($field_error) {
cmsCore::addSessionMessage($field_error, 'error');
$errors = true;
}
}
}
}
}
if ($errors) {
cmsCore::redirectBack();
}
示例2: content
//.........这里部分代码省略.........
// Если редактируем статью
if ($do == 'editarticle') {
$pagetitle = $_LANG['EDIT_ARTICLE'];
$inPage->setTitle($pagetitle);
$inPage->addPathway($_LANG['USERS'], '/' . str_replace('/', '', cmsUser::PROFILE_LINK_PREFIX));
if ($item['user_id'] != $inUser->id) {
$user = $inDB->get_fields('cms_users', "id='{$item['user_id']}'", 'login, nickname');
$inPage->addPathway($user['nickname'], cmsUser::getProfileURL($user['login']));
} else {
$inPage->addPathway($inUser->nickname, cmsUser::getProfileURL($inUser->login));
}
$inPage->addPathway($_LANG['MY_ARTICLES'], '/content/my.html');
$inPage->addPathway($pagetitle);
$item['tags'] = cmsTagLine('content', $item['id'], false);
$item['image'] = file_exists(PATH . '/images/photos/small/article' . $item['id'] . '.jpg') ? 'article' . $item['id'] . '.jpg' : '';
if (!$is_auto_add) {
cmsCore::addSessionMessage($_LANG['ATTENTION'] . ': ' . $_LANG['EDIT_ARTICLE_PREMODER'], 'info');
}
}
$inPage->initAutocomplete();
$autocomplete_js = $inPage->getAutocompleteJS('tagsearch', 'tags');
$item = cmsCore::callEvent('PRE_EDIT_ARTICLE', @$item ? $item : array());
cmsPage::initTemplate('components', 'com_content_edit')->assign('mod', $item)->assign('do', $do)->assign('cfg', $model->config)->assign('pubcats', $pubcats)->assign('pagetitle', $pagetitle)->assign('is_admin', $inUser->is_admin)->assign('is_billing', IS_BILLING)->assign('dynamic_cost', $dynamic_cost)->assign('autocomplete_js', $autocomplete_js)->display('com_content_edit.tpl');
}
// Пришел запрос на сохранение статьи
if (cmsCore::inRequest('add_mod')) {
$errors = false;
$article['category_id'] = cmsCore::request('category_id', 'int', 1);
$article['user_id'] = $item['user_id'] ? $item['user_id'] : $inUser->id;
$article['title'] = cmsCore::request('title', 'str', '');
$article['tags'] = cmsCore::request('tags', 'str', '');
$article['description'] = cmsCore::request('description', 'html', '');
$article['content'] = cmsCore::request('content', 'html', '');
$article['description'] = cmsCore::badTagClear($article['description']);
$article['content'] = cmsCore::badTagClear($article['content']);
$article['published'] = $is_auto_add ? 1 : 0;
if ($do == 'editarticle') {
$article['published'] = $item['published'] == 0 ? $item['published'] : $article['published'];
}
$article['pubdate'] = $do == 'editarticle' ? $item['pubdate'] : date('Y-m-d H:i');
$article['enddate'] = $do == 'editarticle' ? $item['enddate'] : $article['pubdate'];
$article['is_end'] = $do == 'editarticle' ? $item['is_end'] : 0;
$article['showtitle'] = $do == 'editarticle' ? $item['showtitle'] : 1;
$article['meta_desc'] = $do == 'addarticle' ? mb_strtolower($article['title']) : $inDB->escape_string($item['meta_desc']);
$article['meta_keys'] = $do == 'addarticle' ? $inCore->getKeywords($article['content']) : $inDB->escape_string($item['meta_keys']);
$article['showdate'] = $do == 'editarticle' ? $item['showdate'] : 1;
$article['showlatest'] = $do == 'editarticle' ? $item['showlatest'] : 1;
$article['showpath'] = $do == 'editarticle' ? $item['showpath'] : 1;
$article['comments'] = $do == 'editarticle' ? $item['comments'] : 1;
$article['canrate'] = $do == 'editarticle' ? $item['canrate'] : 1;
$article['pagetitle'] = '';
if ($do == 'editarticle') {
$article['tpl'] = $item['tpl'];
}
if (mb_strlen($article['title']) < 2) {
cmsCore::addSessionMessage($_LANG['REQ_TITLE'], 'error');
$errors = true;
}
if (mb_strlen($article['content']) < 10) {
cmsCore::addSessionMessage($_LANG['REQ_CONTENT'], 'error');
$errors = true;
}
if ($errors) {
// При добавлении статьи при ошибках сохраняем введенные поля
if ($do == 'addarticle') {
cmsUser::sessionPut('article', $article);
示例3: clubs
//.........这里部分代码省略.........
'target_url' => '',
'target_id' => 0,
'description' => ''
));
}
cmsCore::addSessionMessage($_LANG['CLUB_IS_CREATED'], 'success');
cmsCore::jsonOutput(array('error' => false,
'club_id' => $club_id));
}
}
///////////////////////// НАСТРОЙКИ КЛУБА //////////////////////////////////////
if ($do == 'config'){
if (!$inUser->id){ return false; }
$club = $model->getClub($id);
if (!$club){ return false; }
// Инициализируем участников клуба
$model->initClubMembers($club['id']);
// настраивать клуб могут только администраторы
$is_admin = $inUser->is_admin || ($inUser->id == $club['admin_id']);
if (!$is_admin){ return false; }
if (cmsCore::inRequest('save')){
if (!cmsUser::checkCsrfToken()) { return false; }
$description = cmsCore::badTagClear(cmsCore::request('description', 'html', ''));
$new_club['description'] = $inDB->escape_string($description);
$new_club['title'] = cmsCore::request('title', 'str', $club['title']);
$new_club['clubtype'] = cmsCore::request('clubtype', 'str', 'public');
$new_club['maxsize'] = cmsCore::request('maxsize', 'int', 0);
$new_club['blog_min_karma'] = cmsCore::request('blog_min_karma', 'int', 0);
$new_club['photo_min_karma'] = cmsCore::request('photo_min_karma', 'int', 0);
$new_club['album_min_karma'] = cmsCore::request('album_min_karma', 'int', 0);
$new_club['blog_premod'] = cmsCore::request('blog_premod', 'int', 0);
$new_club['photo_premod'] = cmsCore::request('photo_premod', 'int', 0);
$new_club['join_karma_limit'] = cmsCore::request('join_karma_limit', 'int', 0);
$new_club['join_min_karma'] = cmsCore::request('join_min_karma', 'int', 0);
if ($model->config['seo_user_access'] || $inUser->is_admin) {
$new_club['pagetitle'] = cmsCore::request('pagetitle', 'str', '');
$new_club['meta_keys'] = cmsCore::request('meta_keys', 'str', '');
$new_club['meta_desc'] = cmsCore::request('meta_desc', 'str', '');
}
// загружаем изображение клуба
$new_imageurl = $model->uploadClubImage($club['imageurl']);
$new_club['imageurl'] = @$new_imageurl['filename'] ? $new_imageurl['filename'] : $club['imageurl'];
// Сохраняем
$model->updateClub($club['id'], $new_club);
// Обновляем ленту активности
cmsActions::updateLog('add_club', array('object' => $new_club['title']), $club['id']);
cmsActions::updateLog('add_club_user', array('object' => $new_club['title']), $club['id']);
if ($inUser->is_admin && IS_BILLING){
$is_vip = cmsCore::request('is_vip', 'int', 0);
$join_cost = cmsCore::request('join_cost', 'int', 0);
$model->setVip($club['id'], $is_vip, $join_cost);
示例4: 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);
//.........这里部分代码省略.........
示例5: applet_modules
function applet_modules()
{
$inCore = cmsCore::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/modules', $adminAccess)) {
cpAccessDenied();
}
$GLOBALS['cp_page_title'] = $_LANG['AD_MODULES'];
cpAddPathway($_LANG['AD_MODULES'], 'index.php?view=modules');
$GLOBALS['cp_page_head'][] = '<script language="JavaScript" type="text/javascript" src="js/modules.js"></script>';
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
$co = cmsCore::request('co', 'int', -1);
//============================================================================//
//============================================================================//
if ($do == 'config') {
$module_name = cpModuleById($id);
$module_title = cpModuleTitleById($id);
if (!$module_name) {
cmsCore::redirect('index.php?view=modules&do=edit&id=' . $id);
}
$xml_file = PATH . '/admin/modules/' . $module_name . '/backend.xml';
$php_file = 'modules/' . $module_name . '/backend.php';
if (!file_exists($xml_file)) {
if (file_exists($php_file)) {
include $php_file;
return;
}
cmsCore::halt();
}
$cfg = $inCore->loadModuleConfig($id);
cmsCore::loadClass('formgen');
$formGen = new cmsFormGen($xml_file, $cfg);
cpAddPathway($module_title, '?view=modules&do=edit&id=' . $id);
cpAddPathway($_LANG['AD_SETTINGS']);
echo '<h3>' . $module_title . '</h3>';
$toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:submitModuleConfig();');
$toolmenu[] = array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'index.php?view=modules');
$toolmenu[] = array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_MODULE_VIEW'], 'link' => '?view=modules&do=edit&id=' . $id);
cpToolMenu($toolmenu);
echo '<form action="index.php?view=modules&do=save_auto_config&id=' . $id . '" method="post" name="optform" target="_self" id="optform">';
echo $formGen->getHTML();
echo '</form>';
return;
}
//============================================================================//
//============================================================================//
if ($do == 'save_auto_config') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$module_name = cpModuleById($id);
$is_ajax = cmsCore::inRequest('ajax');
if ($is_ajax) {
$title = cmsCore::request('title', 'str', '');
$published = cmsCore::request('published', 'int', 0);
$inDB->query("UPDATE cms_modules SET title='{$title}', published='{$published}' WHERE id={$id}");
if (cmsCore::inRequest('content')) {
$content = $inDB->escape_string(cmsCore::request('content', 'html'));
$inDB->query("UPDATE cms_modules SET content='{$content}' WHERE id={$id}");
}
// Добавим возможность изменять css_префикс с фронта
if (cmsCore::inRequest('css_prefix')) {
// На шаблонах не не отдающих параметра затирать класс не будем
$css_prefix = cmsCore::request('css_prefix', 'str', '');
$inDB->query("UPDATE cms_modules SET css_prefix='{$css_prefix}' WHERE id='{$id}'");
}
}
if (cmsCore::inRequest('title_only')) {
cmsCore::redirectBack();
}
$xml_file = PATH . '/admin/modules/' . $module_name . '/backend.xml';
if (!file_exists($xml_file)) {
cmsCore::halt();
}
$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':
//.........这里部分代码省略.........
示例6: applet_modules
//.........这里部分代码省略.........
if ($do == 'save_auto_config') {
if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }
$module_name = cpModuleById($id);
$is_ajax = cmsCore::inRequest('ajax');
if ($is_ajax) {
$title = cmsCore::request('title', 'str', '');
$published = cmsCore::request('published', 'int', 0);
cmsCore::c('db')->query("UPDATE cms_modules SET title='". $title ."', published='". $published ."' WHERE id=". $id);
if (cmsCore::inRequest('content')) {
$content = cmsCore::c('db')->escape_string(cmsCore::request('content', 'html'));
cmsCore::c('db')->query("UPDATE cms_modules SET content='". $content ."' WHERE id=". $id);
}
}
if (cmsCore::inRequest('title_only')) { cmsCore::redirectBack(); }
$xml_file = PATH .'/admin/modules/'. $module_name .'/backend.xml';
if (file_exists($xml_file)) {
$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;
}
}
$cfg['tpl'] = cmsCore::request('tpl', 'str', $module_name);
$inCore->saveModuleConfig($id, $cfg);
if (!$is_ajax) {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
}
cmsCore::redirectBack();
}
if ($do == 'list') {
$toolmenu = array(
array( 'icon' => 'new.gif', 'title' => $_LANG['AD_MODULE_ADD'], 'link' => '?view=modules&do=add' ),
array( 'icon' => 'install.gif', 'title' => $_LANG['AD_MODULES_SETUP'], 'link' => '?view=install&do=module' ),
array( 'icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=modules&do=edit&multiple=1');" ),
array( 'icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=modules&do=delete&multiple=1');" ),
array( 'icon' => 'show.gif', 'title' => $_LANG['AD_ALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=modules&do=show&multiple=1');" ),
array( 'icon' => 'hide.gif', 'title' => $_LANG['AD_DISALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=modules&do=hide&multiple=1');" ),
array( 'icon' => 'autoorder.gif', 'title' => $_LANG['AD_MODULE_ORDER'], 'link' => '?view=modules&do=autoorder' ),
array( 'icon' => 'reorder.gif', 'title' => $_LANG['AD_SAVE_ORDER'], 'link' => "javascript:checkSel('?view=modules&do=saveorder');" ),
array( 'icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=modules' )
示例7: applet_modules
function applet_modules()
{
$inCore = cmsCore::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/modules', $adminAccess)) {
cpAccessDenied();
}
cmsCore::c('page')->setTitle($_LANG['AD_MODULES']);
cpAddPathway($_LANG['AD_MODULES'], 'index.php?view=modules');
cmsCore::c('page')->addHeadJS('admin/js/modules.js');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
$co = cmsCore::request('co', 'int', -1);
if ($do == 'config') {
$module_name = cpModuleById($id);
$module_title = cpModuleTitleById($id);
if (!$module_name) {
cmsCore::redirect('index.php?view=modules&do=edit&id=' . $id);
}
$xml_file = PATH . '/admin/modules/' . $module_name . '/backend.xml';
$php_file = 'modules/' . $module_name . '/backend.php';
if (file_exists($php_file)) {
include $php_file;
return;
}
$cfg = $inCore->loadModuleConfig($id);
cpAddPathway($module_title, '?view=modules&do=edit&id=' . $id);
cpAddPathway($_LANG['AD_SETTINGS']);
$toolmenu = array(array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:submitModuleConfig();'), array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'index.php?view=modules'), array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_MODULE_VIEW'], 'link' => '?view=modules&do=edit&id=' . $id));
cpToolMenu($toolmenu);
$tpl = cmsCore::c('page')->initTemplate('applets', 'modules_config')->assign('module_title', $module_title)->assign('id', $id);
if (file_exists($xml_file)) {
cmsCore::loadClass('formgen');
$formGen = new cmsFormGen($xml_file, $cfg);
$tpl->assign('formGenHtml', $formGen->getHTML());
} else {
$tpl->assign('cfg', $cfg);
}
$tpl->display();
}
if ($do == 'save_auto_config') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$module_name = cpModuleById($id);
$is_ajax = cmsCore::inRequest('ajax');
if ($is_ajax) {
$title = cmsCore::request('title', 'str', '');
$published = cmsCore::request('published', 'int', 0);
cmsCore::c('db')->query("UPDATE cms_modules SET title='" . $title . "', published='" . $published . "' WHERE id=" . $id);
if (cmsCore::inRequest('content')) {
$content = cmsCore::c('db')->escape_string(cmsCore::request('content', 'html'));
cmsCore::c('db')->query("UPDATE cms_modules SET content='" . $content . "' WHERE id=" . $id);
}
}
if (cmsCore::inRequest('title_only')) {
cmsCore::redirectBack();
}
$xml_file = PATH . '/admin/modules/' . $module_name . '/backend.xml';
if (file_exists($xml_file)) {
$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;
}
}
$cfg['tpl'] = cmsCore::request('tpl', 'str', $module_name);
$inCore->saveModuleConfig($id, $cfg);
if (!$is_ajax) {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
}
cmsCore::redirectBack();
}
//.........这里部分代码省略.........
示例8: catalog
//.........这里部分代码省略.........
$cat = $inDB->get_fields('cms_uc_cats', "id='$cat_id'", '*');
if(!$cat){ cmsCore::error404(); }
if ($opt == 'add'){
if(!$inUser->is_admin &&
!$model->checkCategoryAccess($cat['id'], $cat['is_public'], $inUser->group_id)){
cmsCore::error404();
}
} else {
$item = $inDB->get_fields('cms_uc_items', "id='{$item_id}'", '*');
if(!$item){ cmsCore::error404(); }
if(!$inUser->is_admin &&
!($cat['can_edit'] && ($inUser->id == $item['user_id']) &&
$model->checkCategoryAccess($cat['id'], $cat['is_public'], $inUser->group_id))){
cmsCore::error404();
}
}
$item['title'] = cmsCore::request('title', 'str');
if (!$item['title']) { cmsCore::addSessionMessage($_LANG['NEED_TITLE'], 'error'); cmsCore::redirectBack(); }
$item['category_id'] = $cat_id;
$item['published'] = ($cfg['premod'] && !$inUser->is_admin ? 0 : 1);
$item['on_moderate'] = ($cfg['premod'] && !$inUser->is_admin ? 1 : 0);
$item['fdata'] = cmsCore::request('fdata', 'array', array());;
foreach($item['fdata'] as $key=>$value) {
$item['fdata'][$key] = cmsCore::badTagClear($value);
}
$item['fieldsdata'] = $inDB->escape_string(cmsCore::arrayToYaml($item['fdata']));
$item['is_comments'] = $inUser->is_admin ? cmsCore::request('is_comments', 'int', 0) : $cfg['is_comments'];
$item['tags'] = cmsCore::request('tags', 'str', '');
$item['canmany'] = 1;
$item['imageurl'] = ($opt == 'add' ? '' : $item['imageurl']);
$item['price'] = 0;
$item['canmany'] = 1;
if($inUser->is_admin){
$meta_desc = cmsCore::request('meta_desc', 'str', '');
$meta_keys = cmsCore::request('meta_keys', 'str', '');
$item['meta_desc'] = $meta_desc ? $meta_desc : $item['title'];
$item['meta_keys'] = $meta_keys ? $meta_keys : $item['tags'];
} else {
$item['meta_desc'] = @$item['meta_desc'] ? $item['meta_desc'] : $item['title'];
$item['meta_keys'] = @$item['meta_keys'] ? $item['meta_keys'] : $item['tags'];
}
if (cmsCore::inRequest('price')) {
$price = cmsCore::request('price', 'str', '');
$price = str_replace(',', '.', $price);
$item['price'] = round($price, 2);
$item['canmany']= cmsCore::request('canmany', 'int', 0);
}
if (cmsCore::request('delete_img', 'int', 0)){
@unlink(PATH."/images/catalog/".$item['imageurl']);
@unlink(PATH."/images/catalog/small/".$item['imageurl']);
@unlink(PATH."/images/catalog/medium/".$item['imageurl']);
示例9: define
<?php
define('PATH', $_SERVER['DOCUMENT_ROOT']);
include(PATH .'/core/ajax/ajax_core.php');
if (!$inUser->id) { cmsCore::error404(); }
$item = $inCore->m('content')->getArticle(cmsCore::request('item_id', 'int', 0));
$config = $inCore->loadPluginConfig('p_ckeditor');
if ($config['inline'] != 1) { cmsCore::error404(); }
if (!empty($item) && ($inUser->is_admin || ($item['user_id'] == $inUser->id) || ($item['modgrp_id'] == $inUser->group_id && cmsUser::isUserCan('content/autoadd'))))
{
$content = cmsCore::badTagClear(cmsCore::request('content', 'html', ''));
if (mb_strlen(strip_tags($content)) < 10) {
cmsCore::halt($_LANG['REQ_CONTENT']);
} else {
$inDB->query("UPDATE cms_content SET content='". $inDB->escape_string($content) ."' WHERE id=". $item['id']);
}
cmsCore::halt($_LANG['ARTICLE_SAVE']);
} else {
cmsCore::halt($_LANG['404']);
}
示例10: 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('icon' => 'install.gif', 'title' => $_LANG['AD_INSTALL_PLUGINS'], 'link' => '?view=install&do=plugin');
cpToolMenu($toolmenu);
$fields[] = array('title' => 'id', 'field' => 'id', 'width' => '20');
$fields[] = array('title' => $_LANG['TITLE'], 'field' => 'title', 'link' => '?view=plugins&do=config&id=%id%', 'width' => '250');
$fields[] = array('title' => $_LANG['DESCRIPTION'], 'field' => 'description', 'width' => '');
$fields[] = array('title' => $_LANG['AD_AUTHOR'], 'field' => 'author', 'width' => '160');
$fields[] = array('title' => $_LANG['AD_VERSION'], 'field' => 'version', 'width' => '50');
$fields[] = array('title' => $_LANG['AD_FOLDER'], 'field' => 'plugin', 'width' => '100');
$fields[] = array('title' => $_LANG['AD_ENABLE'], 'field' => 'published', 'width' => '60');
$actions[] = array('title' => $_LANG['AD_CONFIG'], 'icon' => 'config.gif', 'link' => '?view=plugins&do=config&id=%id%');
$actions[] = 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);
$config = cmsCore::request('config', 'array_str');
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');
}
//.........这里部分代码省略.........