本文整理汇总了PHP中cmsCore::getDirsList方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::getDirsList方法的具体用法?PHP cmsCore::getDirsList怎么用?PHP cmsCore::getDirsList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::getDirsList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printLangPanel
function printLangPanel($target, $target_id, $field)
{
if (!$target_id) {
return;
}
$langs = cmsCore::getDirsList('/languages');
if (count($langs) > 1) {
foreach ($langs as $lang) {
?>
<a class="ajaxlink editfieldlang" href="#" onclick="return editFieldLang('<?php
echo $lang;
?>
','<?php
echo $target;
?>
','<?php
echo $target_id;
?>
','<?php
echo $field;
?>
', this);"><strong><?php
echo mb_strtoupper($lang);
?>
</strong></a>
<?php
}
}
}
示例2: mod_template
function mod_template($mod, $cfg){
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('current_template', (isset($_SESSION['template']) ? $_SESSION['template'] : ''))->
assign('templates', cmsCore::getDirsList('/templates'))->
display();
return true;
}
示例3: 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();
}
}
}
示例4: 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();
}
示例5: applet_config
//.........这里部分代码省略.........
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['AD_SCHEME_TYPE']; ?></label>
<div class="col-sm-7">
<select id="scheme" class="form-control" name="scheme">
<option value=""><?php echo $_LANG['AD_SCHEME_ANY']; ?></option>
<option value="http" <?php if ($config['scheme'] == 'http') { echo 'selected="selected"'; } ?>><?php echo $_LANG['AD_SCHEME_http']; ?></option>
<option value="https" <?php if ($config['scheme'] == 'https') { echo 'selected="selected"'; } ?>><?php echo $_LANG['AD_SCHEME_https']; ?></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['AD_TIME_ARREA']; ?></label>
<div class="col-sm-7">
<select id="timezone" class="form-control" name="timezone">
<?php echo cmsCore::getTimeZonesOptions($config['timezone']); ?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['AD_SITENAME']; ?></label>
<div class="col-sm-7">
<input type="text" class="form-control" name="sitename" value="<?php echo htmlspecialchars($config['sitename']);?>" />
<div class="help-block"><?php echo $_LANG['AD_USE_HEADER']; ?></div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['TEMPLATE']; ?></label>
<div class="col-sm-7">
<select id="template" class="form-control" name="template" onchange="document.CFGform.submit();">
<?php
$templates = cmsCore::getDirsList('/templates');
foreach ($templates as $template) {
if ($template == 'admin') { continue; }
echo '<option value="'. $template .'" '. ($config['template'] == $template ? 'selected="selected"' : '') .'>'. $template .'</option>';
}
$tpl_info = cmsCore::c('page')->getCurrentTplInfo();
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['AD_SEARCH_RESULT']; ?></label>
<div class="col-sm-7 btn-group" data-toggle="buttons">
<label class="btn btn-default <?php if ($config['slight']) { echo 'active'; } ?>">
<input type="radio" name="slight" <?php if ($config['slight']) { echo 'checked="checked"'; } ?> value="1" /> <?php echo $_LANG['SHOW']; ?>
</label>
<label class="btn btn-default <?php if (!$config['slight']) { echo 'active'; } ?>">
<input type="radio" name="slight" <?php if (!$config['slight']) { echo 'checked="checked"'; } ?> value="0" /> <?php echo $_LANG['HIDE']; ?>
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['AD_TAGE_ADD']; ?></label>
<div class="col-sm-7 btn-group" data-toggle="buttons">
<label class="btn btn-default <?php if ($config['title_and_sitename']) { echo 'active'; } ?>">
<input type="radio" name="title_and_sitename" <?php if ($config['title_and_sitename']) { echo 'checked="checked"'; } ?> value="1" /> <?php echo $_LANG['YES']; ?>
</label>
<label class="btn btn-default <?php if (!$config['title_and_sitename']) { echo 'active'; } ?>">
<input type="radio" name="title_and_sitename" <?php if (!$config['title_and_sitename']) { echo 'checked="checked"'; } ?> value="0" /> <?php echo $_LANG['NO']; ?>
</label>
示例6: applet_config
//.........这里部分代码省略.........
</strong>
</td>
<td valign="top">
<label><input name="title_and_page" type="radio" value="1" <?php
if ($config['title_and_page']) {
echo 'checked="checked"';
}
?>
/><?php
echo $_LANG['YES'];
?>
</label>
<label><input name="title_and_page" type="radio" value="0" <?php
if (!$config['title_and_page']) {
echo 'checked="checked"';
}
?>
/><?php
echo $_LANG['NO'];
?>
</label>
</td>
</tr>
<tr>
<td>
<strong><?php
echo $_LANG['TEMPLATE_INTERFACE_LANG'];
?>
:</strong>
</td>
<td width="350" valign="top">
<select name="lang" id="lang" style="width:364px">
<?php
$langs = cmsCore::getDirsList('/languages');
foreach ($langs as $lng) {
echo '<option value="' . $lng . '" ' . ($config['lang'] == $lng ? 'selected="selected"' : '') . '>' . $lng . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>
<strong><?php
echo $_LANG['AD_SITE_LANGUAGE_CHANGE'];
?>
</strong><br/>
<span class="hinttext"><?php
echo $_LANG['AD_VIEW_FORM_LANGUAGE_CHANGE'];
?>
</span>
</td>
<td valign="top">
<label><input name="is_change_lang" type="radio" value="1" <?php
if ($config['is_change_lang']) {
echo 'checked="checked"';
}
?>
/><?php
echo $_LANG['YES'];
?>
</label>
<label><input name="is_change_lang" type="radio" value="0" <?php
if (!$config['is_change_lang']) {
echo 'checked="checked"';
}
示例7: applet_menu
//.........这里部分代码省略.........
if (@$mod['target'] == '_top') {
echo 'selected="selected"';
}
?>
><?php
echo $_LANG['AD_TOP'];
?>
</option>
</select>
</div>
<div style="margin-top:15px">
<strong><?php
echo $_LANG['TEMPLATE'];
?>
</strong><br/>
<span class="hinttext"><?php
echo $_LANG['AD_DESIGN_CHANGE'];
?>
</span>
</div>
<div>
<select name="template" id="template" style="width:100%">
<option value="0" <?php
if (@$mod['template'] == 0 || !$mod['template']) {
echo 'selected="selected"';
}
?>
><?php
echo $_LANG['AD_BY_DEFAULT'];
?>
</option>
<?php
$templates = cmsCore::getDirsList('/templates');
foreach ($templates as $template) {
echo '<option value="' . $template . '" ' . (@$mod['template'] == $template ? 'selected="selected"' : '') . '>' . $template . '</option>';
}
?>
</select>
</div>
<div style="margin-top:15px">
<strong><?php
echo $_LANG['AD_ICON_PICTURE'];
?>
</strong><br/>
<span class="hinttext"><?php
echo $_LANG['AD_ICON_FILENAME'];
?>
</span>
</div>
<div>
<input name="iconurl" type="text" id="iconurl" size="30" value="<?php
echo @$mod['iconurl'];
?>
" style="width:100%"/>
<div>
<a id="iconlink" style="display:block;" href="javascript:showIcons()"><?php
echo $_LANG['AD_CHECK_ICON'];
?>
</a>
<div id="icondiv" style="display:none; padding:6px;border:solid 1px gray;background:#FFF">
<div><?php
iconList();
?>
</div>
示例8: header
<?php
/******************************************************************************/
/********************************CMS.VADYUS.COM********************************/
/******************************************************************************/
header('Content-Type: text/html; charset=utf-8');
Error_Reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
session_start();
define('PATH', dirname(__FILE__));
define("VALID_CMS", 1);
include PATH . '/core/cms.php';
cmsCore::getInstance();
if (!cmsConfig::getConfig('is_change_lang')) {
cmsCore::halt();
}
$set_lang = cmsCore::request('lang', 'str', 'ru');
$langs = cmsCore::getDirsList('/languages');
if (!in_array($set_lang, $langs)) {
cmsCore::halt();
}
$_SESSION['lang'] = $set_lang;
cmsCore::redirectBack();
示例9: getModulesDirs
/**
* Возвращает список папок с модулями
* @return array
*/
public static function getModulesDirs()
{
return cmsCore::getDirsList('/modules');
}
示例10: applet_modules
//.........这里部分代码省略.........
$inDB->query($sql);
if ($is_original) {
$sql = "DELETE FROM cms_modules WHERE id = {$mod_id}";
$inDB->query($sql);
}
}
$lastid = $inDB->get_last_id('cms_modules');
if (cmsCore::request('show_all', 'int', 0)) {
$sql = "INSERT INTO cms_modules_bind (module_id, menu_id, position)\r\n\t\t\t\t\tVALUES ({$lastid}, 0, '{$position}')";
$inDB->query($sql);
$hidden_menu_ids = cmsCore::request('hidden_menu_ids', 'array_int', array());
if ($hidden_menu_ids) {
$hidden_menu_ids = cmsCore::arrayToYaml($hidden_menu_ids);
$inDB->query("UPDATE cms_modules SET hidden_menu_ids='{$hidden_menu_ids}' WHERE id = '{$lastid}' LIMIT 1");
}
} else {
$showin = cmsCore::request('showin', 'array_int', array());
$showpos = cmsCore::request('showpos', 'array_str', array());
if ($showin) {
foreach ($showin as $key => $value) {
$sql = "INSERT INTO cms_modules_bind (module_id, menu_id, position)\r\n\t\t\t\t\t\t\tVALUES ({$lastid}, {$value}, '{$showpos[$value]}')";
$inDB->query($sql);
}
}
}
cmsCore::addSessionMessage($_LANG['AD_MODULE_ADD_SITE'], 'success');
cmsCore::redirect('index.php?view=modules');
}
//============================================================================//
//============================================================================//
if ($do == 'add' || $do == 'edit') {
require '../includes/jwtabs.php';
$GLOBALS['cp_page_head'][] = jwHeader();
$langs = cmsCore::getDirsList('/languages');
if ($do == 'add') {
cpAddPathway($_LANG['AD_MODULE_ADD']);
echo '<h3>' . $_LANG['AD_MODULE_ADD'] . '</h3>';
$show_all = false;
} 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_modules', "id = '{$item_id}'", '*');
if (!$mod) {
cmsCore::error404();
}
$mod['hidden_menu_ids'] = cmsCore::yamlToArray($mod['hidden_menu_ids']);
$mod['titles'] = cmsCore::yamlToArray($mod['titles']);
$sql = "SELECT id FROM cms_modules_bind WHERE module_id = {$id} AND menu_id = 0 LIMIT 1";
$result = $inDB->query($sql);
示例11: mod_template
function mod_template()
{
cmsPage::initTemplate('modules', 'mod_template')->assign('current_template', isset($_SESSION['template']) ? $_SESSION['template'] : '')->assign('templates', cmsCore::getDirsList('/templates'))->display('mod_template.tpl');
return true;
}
示例12: dir_list
/**
* Генерирует html код поля <select> из списка названий директорий в указанной папке
* @param array $field Массив параметров, вдобавок к стандартным (name, title...)
* обязательно должен быть указан параметр path содержащую ссылку на папку
* относительно корня сайта
* @return boolean|array
*/
private function dir_list($field) {
if (empty($field['name']) || empty($field['path'])) {
return false;
}
$field['path'] = rtrim($field['path'], '/');
if (!file_exists(PATH . $field['path']) || !is_dir(PATH . $field['path'])) {
return false;
}
$this->fields['select']['count']++;
$selected = $this->getValue($field);
if (!is_array($selected)) { $selected = array($selected); }
$attr_field = $field;
unset($attr_field['path']);
$html = '<select id="'. $this->fields['select']['class'] .'_'. $this->fields['select']['count'] .'" class="form-control '. $this->fields['select']['class'] .' '. cmsCore::getArrVal($field, 'class', '') .'"'. $this->getStyle(cmsCore::getArrVal($field, 'style', false)) .''. $this->getOtherAttributes($field) .' name="'. $this->name_prefix . $field['name'] .'">' ."\n";
$dirs = cmsCore::getDirsList($field['path'] .'/');
if (!empty($dirs)) {
foreach ($dirs as $dir) {
$html .= ' <option value="'. htmlspecialchars($dir) .'"'. (in_array($dir, $selected) ? ' selected="selected"' : '') .'>'. $dir .'</option>'. "\n";
}
}
$html .= '</select>';
return array(
'type' => $field['type'],
'title' => $this->getTD($field, 'title', 'dir_list', $field['name']),
'description' => $this->getTD($field, 'description', 'dir_list', $field['name']),
'html' => $html
);
}
示例13: applet_modules
//.........这里部分代码省略.........
cmsCore::c('db')->query($sql) ;
}
}
$lastid = cmsCore::c('db')->get_last_id('cms_modules');
if (cmsCore::request('show_all', 'int', 0)) {
$sql = "INSERT INTO cms_modules_bind (module_id, menu_id, position, tpl)
VALUES (". $lastid .", 0, '". $position ."', '". cmsCore::c('config')->template ."')";
cmsCore::c('db')->query($sql) ;
$hidden_menu_ids = cmsCore::request('hidden_menu_ids', 'array_int', array());
if ($hidden_menu_ids) {
$hidden_menu_ids = cmsCore::arrayToYaml($hidden_menu_ids);
cmsCore::c('db')->query("UPDATE cms_modules SET hidden_menu_ids='". $hidden_menu_ids ."' WHERE id = '". $lastid ."' LIMIT 1");
}
} else {
$showin = cmsCore::request('showin', 'array', array());
$showpos = cmsCore::request('showpos', 'array', array());
if (count($showin) > 0) {
foreach ($showin as $key=>$value) {
$sql = "INSERT INTO cms_modules_bind (module_id, menu_id, position, tpl)
VALUES (". $lastid .", ". $value .", '". $showpos[$value] ."', '". cmsCore::c('config')->template ."')";
cmsCore::c('db')->query($sql) ;
}
}
}
cmsCore::addSessionMessage($_LANG['AD_MODULE_ADD_SITE'] , 'success');
cmsCore::redirect('index.php?view=modules');
}
if ($do == 'add' || $do == 'edit') {
$langs = cmsCore::getDirsList('/languages');
if ($do == 'add') {
cpAddPathway($_LANG['AD_MODULE_ADD']);
echo '<h3>'. $_LANG['AD_MODULE_ADD'] .'</h3>';
$show_all = false;
} else {
if (cmsCore::inRequest('multiple')) {
if (cmsCore::inRequest('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 (count($_SESSION['editlist'])==0) {
unset($_SESSION['editlist']);
} else {
$ostatok = '('. $_LANG['AD_NEXT_IN'] . count($_SESSION['editlist']) .')';
}
} else {
$item_id = cmsCore::request('id', 'int', 0);
}
$mod = cmsCore::c('db')->get_fields('cms_modules', "id = '". $item_id ."'", '*');
if (!$mod) { cmsCore::error404(); }
$mod['hidden_menu_ids'] = cmsCore::yamlToArray($mod['hidden_menu_ids']);
示例14: applet_menu
//.........这里部分代码省略.........
$title = cmsCore::request('title', 'str', '');
$titles = cmsCore::arrayToYaml(cmsCore::request('titles', 'array_str', array()));
$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);
$template = cmsCore::request('template', 'str', '');
$iconurl = cmsCore::request('iconurl', 'str', '');
$parent_id = cmsCore::request('parent_id', 'int', 0);
$css_class = cmsCore::request('css_class', 'str', '');
$is_public = cmsCore::request('is_public', 'int', '');
$is_lax = cmsCore::request('is_lax', 'int', 0);
if (!$is_public) {
$access_list = cmsCore::arrayToYaml(cmsCore::request('allow_group', 'array_int'));
}
$ns = $inCore->nestedSetsInit('cms_menu');
$myid = $ns->AddNode($parent_id);
$sql = "UPDATE cms_menu\r\n SET menu='" . $menu . "',\r\n title='" . $title . "',\r\n titles='" . $titles . "',\r\n css_class='" . $css_class . "',\r\n link='" . $link . "',\r\n linktype='" . $linktype . "',\r\n linkid='" . $linkid . "',\r\n target='" . $target . "',\r\n published='" . $published . "',\r\n template='" . $template . "',\r\n access_list='" . $access_list . "',\r\n is_lax='" . $is_lax . "',\r\n iconurl='" . $iconurl . "'\r\n WHERE id = '" . $myid . "'";
cmsCore::c('db')->query($sql);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirect('?view=menu');
}
if ($do == 'submitmenu') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$sql = "SELECT ordering as max_o FROM cms_modules ORDER BY ordering DESC LIMIT 1";
$result = cmsCore::c('db')->query($sql);
$row = cmsCore::c('db')->fetch_assoc($result);
$maxorder = $row['max_o'] + 1;
$menu = cmsCore::request('menu', 'str', '');
$title = cmsCore::request('title', 'str', '');
$position = cmsCore::request('position', 'str', '');
$published = cmsCore::request('published', 'int', 0);
$css_prefix = cmsCore::request('css_prefix', 'str', '');
$is_public = cmsCore::request('is_public', 'int', '');
if (!$is_public) {
$access_list = $inCore->arrayToYaml(cmsCore::request('allow_group', 'array_int'));
}
$cfg['menu'] = $menu;
$cfg_str = cmsCore::arrayToYaml($cfg);
$sql = "INSERT INTO cms_modules (position, name, title, is_external, content, ordering, showtitle, published, user, config, css_prefix, access_list)\r\n VALUES ('" . $position . "', '" . $_LANG['AD_MENU'] . "', '" . $title . "', 1, 'mod_menu', " . $maxorder . ", 1, " . $published . ", 0, '" . $cfg_str . "', '" . $css_prefix . "', '" . $access_list . "')";
cmsCore::c('db')->query($sql);
$newid = cmsCore::c('db')->get_last_id('cms_modules');
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirect('?view=modules&do=edit&id=' . $newid);
}
if ($do == 'addmenu' || $do == 'add' || $do == 'edit') {
cmsCore::c('page')->addHeadJS('admin/js/menu.js');
echo '<script>';
echo cmsPage::getLangJS('AD_SPECIFY_LINK_MENU');
echo '</script>';
}
if ($do == 'addmenu') {
cmsCore::c('page')->setTitle($_LANG['AD_MENU_ADD']);
cpAddPathway($_LANG['AD_MENU_ADD']);
cmsCore::c('page')->initTemlate('applets', 'menu_addmenu')->assign('menu_list', cpGetList('menu'))->assign('pos', cpModulePositions(cmsCore::c('config')->template))->assign('groups', cmsUser::getGroups())->assign('access_list', !empty($mod['access_list']) ? $inCore->yamlToArray($mod['access_list']) : array())->assign('mod', $mod)->display();
}
if ($do == 'add' || $do == 'edit') {
if ($do == 'add') {
cpAddPathway($_LANG['AD_MENU_POINT_ADD']);
$mod['menu'] = array('mainmenu');
} 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 = cmsCore::c('db')->get_fields('cms_menu', "id = '{$item_id}'", '*');
if (!$mod) {
cmsCore::error404();
}
$mod['menu'] = cmsCore::yamlToArray($mod['menu']);
$mod['titles'] = cmsCore::yamlToArray($mod['titles']);
cpAddPathway($_LANG['AD_MENU_POINT_EDIT'] . $ostatok . ' "' . $mod['title'] . '"');
}
$linktype = cmsCore::getArrVal($mod, 'linktype', 'link');
$tpl = cmsCore::c('page')->initTemplate('applets', 'menu_add')->assign('linktype', $linktype)->assign('langs', cmsCore::getDirsList('/languages'))->assign('templates', cmsCore::getDirsList('/templates'))->assign('menu_list', cpGetList('menu'))->assign('rootid', cmsCore::c('db')->get_field('cms_menu', 'parent_id=0', 'id'))->assign('menu_opt', $inCore->getListItemsNS('cms_menu', cmsCore::getArrVal($mod, 'parent_id', 0)))->assign('content_opt', $inCore->getListItems('cms_content', $linktype == 'content' ? $mod['linkid'] : 0))->assign('category_opt', $inCore->getListItemsNS('cms_category', $link_type == 'category' ? $mod['linkid'] : 0))->assign('components_opt', $inCore->getListItems('cms_components', $link_type == 'component' ? $mod['linkid'] : 0, 'title', 'asc', 'internal=0', 'link'))->assign('blogs_opt', $inCore->getListItems('cms_blogs', $link_type == 'blog' ? $mod['linkid'] : 0, 'title', 'asc', "owner='user'"))->assign('uc_cats_opt', $inCore->getListItems('cms_uc_cats', $link_type == 'uccat' ? $mod['linkid'] : 0))->assign('photo_albums_opt', $inCore->getListItems('cms_photo_albums', $link_type == 'photoalbum' ? $mod['linkid'] : 0, 'id', 'ASC', 'NSDiffer = ""'))->assign('video_installed', $inCore->isComponentInstalled('video'))->assign('iconList', iconList())->assign('mod', $mod);
if ($inCore->isComponentInstalled('video')) {
$tpl->assign('video_cats_opt', $inCore->getListItemsNS('cms_video_category', $linktype == 'video_cat' ? $mod['linkid'] : 0));
}
$tpl->display();
}
}
示例15: 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') {
$templates = cmsCore::getDirsList('/templates');
echo '<div class="panel panel-default"><div class="panel-heading">'. $_LANG['AD_TEMPLATES_LIST'] .'</div><div class="panel-body">';
echo '<table class="table table-striped"><thead><tr>';
echo '<th>'. $_LANG['AD_TEMPLATE'] .'</th>';
echo '<th width="200">'. $_LANG['AD_TEMPLATE_AUTHOR'] .'</th>';
echo '<th width="200">'. $_LANG['AD_TEMPLATE_RENDERER'] .'</th>';
echo '<th width="200">'. $_LANG['AD_TEMPLATE_EXT'] .'</th><th width="100"></th><th width="100"></th>';
echo '</tr></thead><tbody>';
foreach ($templates as $template) {
if ($template == 'admin') { continue; }
$tpl_info = cmsCore::c('page')->getTplInfo($template);
echo '<tr>';
echo '<td><strong>'. $template .'</strong></td>';
echo '<td>'. $tpl_info['author'] .'</td>';
echo '<td>'. $tpl_info['renderer'] .'</td>';
echo '<td>'. $tpl_info['ext'] .'</td><td>';
if (file_exists(PATH .'/templates/'. $template .'/positions.jpg')) {
echo '<a href="#'. $template .'" role="button" class="btn btn-sm btn-default" data-toggle="modal">'. $_LANG['AD_TPL_POS'] .'</a>
<div class="modal fade" id="'. $template .'" tabindex="-1" role="dialog" aria-labelledby="'. $template .'Label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="'. $template .'Label">'. $_LANG['AD_TPL_POS'] .'</h4>
</div>
<div class="modal-body">
<img src="/templates/'. $template .'/positions.jpg" alt="'. $_LANG['AD_TPL_POS'] .'" style="width:100%;height:auto;" />
</div>
</div>
</div>
</div>';
}
echo '</td><td>';
if (file_exists(PATH .'/templates/'. $template .'/config.php')) {
echo '<a href="/admin/index.php?view=templates&do=config&template='. $template .'" class="btn btn-sm btn-primary">'. $_LANG['AD_CONFIG'] .'</a>';
}
echo '</td></tr>';
}
echo '</tbody></table></div></div>';
}
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);
echo '<form action="/admin/index.php?view=templates&template='. $template .'&do=save_config" method="post" style="width:650px;margin-bottom:30px">';
echo cmsCore::c('form_gen')->generateForm($tpl_cfgs, $tpl_cfgs_val);
echo '<div>';
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.back();" />';
echo '</div>';
echo '</form>';
} 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');
//.........这里部分代码省略.........