本文整理汇总了PHP中cmsConfig::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsConfig::getConfig方法的具体用法?PHP cmsConfig::getConfig怎么用?PHP cmsConfig::getConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsConfig
的用法示例。
在下文中一共展示了cmsConfig::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Ищет и применяет перевод для возможных полей
* @param str $lang Язык возвращаемого перевода
* @param str $target Для какой цели ищем
* @param array $item Массив, в котором нужно заменить значения полей
* @return array
*/
public static function process($lang, $target, $item, $id_field = 'id', $field_compliance = array())
{
if (!cmsConfig::getConfig('is_change_lang')) {
return $item;
}
$thisObj = self::init($target, $lang, $id_field, $field_compliance);
if (!$thisObj->fieldsset_id || !$item || !is_array($item)) {
return $item;
}
return $thisObj->get($item);
}
示例2: mod_invite
function mod_invite($mod, $cfg) {
global $_LANG;
$errors = false;
$is_redirect = false; // в модуле нельзя использовать cmsCore::redirectBack(), используем костыли ;)
if (cmsCore::inRequest('send_invite_email')) {
$is_redirect = true;
$username = cmsCore::request('username', 'str', '');
$email = cmsCore::request('friend_email', 'email', '');
if (!$username && !cmsCore::c('user')->id) {
cmsCore::addSessionMessage($_LANG['ERR_NEED_NAME'], 'error'); $errors = true;
}
if (cmsCore::c('user')->id) {
$username = cmsCore::c('user')->nickname;
}
if (!$email) {
cmsCore::addSessionMessage($_LANG['ERR_NEED_MAIL'], 'error'); $errors = true;
}
if (!$errors) {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$letter = cmsCore::getLanguageTextFile('mail_invite');
$letter = str_replace('{sitename}', cmsConfig::getConfig('sitename'), $letter);
$letter = str_replace('{site_url}', HOST, $letter);
$letter = str_replace('{username}', $username, $letter);
cmsCore::mailText($email, sprintf($_LANG['INVITE_SUBJECT'], $username), $letter);
cmsCore::addSessionMessage($_LANG['INVITE_SENDED'], 'success');
}
}
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('user_id', cmsCore::c('user')->id)->
assign('is_redirect', $is_redirect)->
display();
return true;
}
示例3: sendActivationNotice
public function sendActivationNotice($send_pass, $user_id)
{
global $_LANG;
$user = cmsUser::getShortUserData($user_id);
if (!$user_id) {
return false;
}
$user['password'] = $send_pass;
$code = md5($user['email'] . uniqid() . '-' . microtime());
$codelink = HOST . '/activate/' . $code;
$sql = "INSERT cms_users_activate (pubdate, user_id, code)\r\n VALUES (NOW(), '{$user['id']}', '{$code}')";
$this->inDB->query($sql);
$letter = cmsCore::getLanguageTextFile('activation');
foreach ($user as $key => $value) {
$letter = str_replace('{' . $key . '}', $value, $letter);
}
$letter = str_replace('{sitename}', cmsConfig::getConfig('sitename'), $letter);
$letter = str_replace('{codelink}', $codelink, $letter);
return cmsCore::mailText($user['email'], $_LANG['ACTIVATION_ACCOUNT'] . ' - ' . cmsConfig::getConfig('sitename'), $letter);
}
示例4: execute
public function execute($event = '', $item = array())
{
parent::execute();
$inUser = cmsUser::getInstance();
cmsCore::includeFile('plugins/p_fckeditor/fckeditor/fckeditor.php');
$oFCKeditor = new FCKeditor($item['name']);
$oFCKeditor->BasePath = '/plugins/p_fckeditor/fckeditor/';
$oFCKeditor->Height = $item['height'];
$oFCKeditor->Width = $item['width'];
$oFCKeditor->ToolbarSet = $inUser->is_admin ? 'Admin' : 'Basic';
$oFCKeditor->Value = $item['text'];
$oFCKeditor->Config['DefaultLanguage'] = cmsConfig::getConfig('lang');
$oFCKeditor->Config['AutoDetectLanguage'] = false;
if (!$inUser->is_admin) {
$oFCKeditor->Config['ImageBrowser'] = false;
$oFCKeditor->Config['LinkUpload'] = false;
$oFCKeditor->Config['LinkBrowser'] = false;
}
ob_start();
$oFCKeditor->Create();
return ob_get_clean();
}
示例5: applet_modules
//.........这里部分代码省略.........
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;
}
$inCore->saveModuleConfig($id, $cfg);
if (!$is_ajax) {
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
}
cmsCore::redirectBack();
}
//============================================================================//
//============================================================================//
if ($do == 'list') {
$toolmenu[] = array('icon' => 'new.gif', 'title' => $_LANG['AD_MODULE_ADD'], 'link' => '?view=modules&do=add');
$toolmenu[] = array('icon' => 'install.gif', 'title' => $_LANG['AD_MODULES_SETUP'], 'link' => '?view=install&do=module');
$toolmenu[] = array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=modules&do=edit&multiple=1');");
$toolmenu[] = array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=modules&do=delete&multiple=1');");
$toolmenu[] = array('icon' => 'show.gif', 'title' => $_LANG['AD_ALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=modules&do=show&multiple=1');");
$toolmenu[] = array('icon' => 'hide.gif', 'title' => $_LANG['AD_DISALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=modules&do=hide&multiple=1');");
$toolmenu[] = array('icon' => 'autoorder.gif', 'title' => $_LANG['AD_MODULE_ORDER'], 'link' => '?view=modules&do=autoorder');
$toolmenu[] = array('icon' => 'reorder.gif', 'title' => $_LANG['AD_SAVE_ORDER'], 'link' => "javascript:checkSel('?view=modules&do=saveorder');");
$toolmenu[] = array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=modules');
cpToolMenu($toolmenu);
$fields[] = array('title' => 'id', 'field' => 'id', 'width' => '30');
$fields[] = array('title' => $_LANG['AD_TITLE'], 'field' => array('title', 'titles'), 'width' => '', 'link' => '?view=modules&do=edit&id=%id%', 'prc' => function ($i) {
$i['titles'] = cmsCore::yamlToArray($i['titles']);
// переопределяем название пункта меню в зависимости от языка
if (!empty($i['titles'][cmsConfig::getConfig('lang')])) {
$i['title'] = $i['titles'][cmsConfig::getConfig('lang')];
}
return $i['title'];
});
$fields[] = array('title' => $_LANG['TITLE'], 'field' => 'name', 'width' => '220', 'filter' => '15');
$fields[] = array('title' => $_LANG['AD_VERSION'], 'field' => 'version', 'width' => '55');
$fields[] = array('title' => $_LANG['AD_AUTHOR'], 'field' => 'author', 'width' => '110');
$fields[] = array('title' => $_LANG['SHOW'], 'field' => 'published', 'width' => '65');
$fields[] = array('title' => $_LANG['AD_ORDER'], 'field' => 'ordering', 'width' => '75');
$fields[] = array('title' => $_LANG['AD_POSITION'], 'field' => 'position', 'width' => '70', 'filter' => '10', 'filterlist' => cpGetList('positions'));
$actions[] = array('title' => $_LANG['AD_CONFIG'], 'icon' => 'config.gif', 'link' => '?view=modules&do=config&id=%id%', 'condition' => 'cpModuleHasConfig');
$actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=modules&do=edit&id=%id%');
$actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_MODULE_DELETE'], 'link' => '?view=modules&do=delete&id=%id%');
cpListTable('cms_modules', $fields, $actions, '', 'published DESC, position, ordering ASC');
}
//============================================================================//
//============================================================================//
if ($do == 'autoorder') {
$rs = $inDB->query("SELECT id, position FROM cms_modules ORDER BY position");
if ($inDB->num_rows($rs)) {
$ord = 1;
while ($item = $inDB->fetch_assoc($rs)) {
if (isset($latest_pos)) {
if ($latest_pos != $item['position']) {
$ord = 1;
}
}
$inDB->query("UPDATE cms_modules SET ordering = {$ord} WHERE id='{$item['id']}'");
$ord += 1;
$latest_pos = $item['position'];
}
}
示例6:
echo 'checked="checked"';
}
?>
/> <?php
echo $_LANG['NO'];
?>
</label>
</td>
</tr>
<tr>
<td><strong><?php
echo $_LANG['AD_NOTIFICATION_TEXT'];
?>
: </strong></td>
<td><?php
echo '/languages/' . cmsConfig::getConfig('lang') . '/letters/newmessage.txt';
?>
</td>
</tr>
<tr>
<td>
<strong><?php
echo $_LANG['AD_PEROD_KARMA'];
?>
:</strong><br />
<span class="hinttext"><?php
echo $_LANG['AD_PEROD_KARMA_HINT'];
?>
</span>
</td>
<td valign="top">
示例7: getArticlesList
/**
* Получаем статьи по заданным параметрам
* @return array
*/
public function getArticlesList($only_published = true)
{
$today = date("Y-m-d H:i:s");
if ($only_published) {
$this->inDB->where("con.published = 1 AND con.pubdate <= '{$today}' AND (con.is_end=0 OR (con.is_end=1 AND con.enddate >= '{$today}'))");
}
$sql = "SELECT con.*,\r\n\t\t\t\t\t cat.title as cat_title, cat.seolink as catseolink,\r\n\t\t\t\t\t cat.showdesc,\r\n u.nickname as author,\r\n u.login as user_login\r\n FROM cms_content con\r\n\t\t\t\tINNER JOIN cms_category cat ON cat.id = con.category_id\r\n\t\t\t\tLEFT JOIN cms_users u ON u.id = con.user_id\r\n WHERE con.is_arhive = 0\r\n {$this->inDB->where}\r\n\r\n {$this->inDB->group_by}\r\n\r\n {$this->inDB->order_by}\n";
if ($this->inDB->limit) {
$sql .= "LIMIT {$this->inDB->limit}";
}
$result = $this->inDB->query($sql);
$this->inDB->resetConditions();
if (!$this->inDB->num_rows($result)) {
return false;
}
while ($article = $this->inDB->fetch_assoc($result)) {
$article['fpubdate'] = cmsCore::dateFormat($article['pubdate']);
$article['ffpubdate'] = date('c', strtotime($article['pubdate']));
$article['tagline'] = cmsTagLine('content', $article['id'], true);
$article['comments'] = cmsCore::getCommentsCount('article', $article['id']);
$article['url'] = $this->getArticleURL(null, $article['seolink']);
$article['cat_url'] = $this->getCategoryURL(null, $article['catseolink']);
$article['image'] = file_exists(PATH . '/images/photos/small/article' . $article['id'] . '.jpg') ? 'article' . $article['id'] . '.jpg' : '';
$articles[] = $article;
}
$articles = cmsCore::callEvent('GET_ARTICLES', $articles);
return translations::process(cmsConfig::getConfig('lang'), 'content_content', $articles);
}
示例8: renderModule
/**
* Формирует модуль
* @param array $mod
* @return html
*/
private function renderModule($mod)
{
$inCore = cmsCore::getInstance();
// флаг показа модуля
$callback = true;
// html код модуля
$html = '';
// для php модулей загружаем файл локализации
if (!$mod['user']) {
cmsCore::loadLanguage('modules/' . $mod['content']);
}
// Собственный модуль, созданный в админке
if (!$mod['is_external']) {
$mod['body'] = cmsCore::processFilters($mod['content']);
} else {
// Отдельный модуль
if (cmsCore::includeFile('modules/' . $mod['content'] . '/module.php')) {
// Если есть кеш, берем тело модуля из него
if ($mod['cache'] && cmsCore::isCached('module', $mod['id'], $mod['cachetime'], $mod['cacheint'])) {
$mod['body'] = cmsCore::getCache('module', $mod['id']);
$callback = true;
} else {
$cfg = cmsCore::yamlToArray($mod['config']);
// переходный костыль для указания шаблона
if (!isset($cfg['tpl'])) {
$cfg['tpl'] = $mod['content'] . '.tpl';
}
$inCore->cacheModuleConfig($mod['id'], $cfg);
ob_start();
$callback = call_user_func($mod['content'], $mod['id'], $cfg);
$mod['body'] = ob_get_clean();
if ($mod['cache']) {
cmsCore::saveCache('module', $mod['id'], $mod['body']);
}
}
}
}
// выводим модуль в шаблоне если модуль вернул true
if ($callback) {
$module_tpl = file_exists(TEMPLATE_DIR . 'modules/' . $mod['template']) ? $mod['template'] : 'module.tpl';
$cfglink = cmsConfig::getConfig('fastcfg') && cmsUser::getInstance()->is_admin ? true : false;
ob_start();
self::initTemplate('modules', $module_tpl)->assign('cfglink', $cfglink)->assign('mod', $mod)->display($module_tpl);
$html = ob_get_clean();
}
return $html;
}
示例9: importFromFile
/**
* Выполняет SQL из файла
* @param str $sql_file Полный путь к файлу
* @return bool
*/
public function importFromFile($sql_file)
{
if (!file_exists($sql_file)) {
return false;
}
$lines = file($sql_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$buffer = '';
foreach ($lines as $line) {
if (($line = trim($line)) == '') {
continue;
}
if (mb_substr(ltrim($line), 0, 2) == '--') {
continue;
}
// sql в несколько строк
if (mb_substr($line, -1) != ';') {
// добавляем в буфер
$buffer .= $line;
// считываем следующую строку
continue;
} else {
if ($buffer) {
$line = $buffer . $line;
// сбрасываем буфер
$buffer = '';
}
}
$line = mb_substr($line, 0, -1);
$result = $this->query(str_replace("#_", cmsConfig::getConfig('db_prefix'), $line), false, false);
if (!$result) {
die('DATABASE ERROR: <pre>' . $line . '</pre><br>' . $this->error());
}
}
return true;
}
示例10: content
function content()
{
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
$model = new cms_model_content();
define('IS_BILLING', $inCore->isComponentInstalled('billing'));
if (IS_BILLING) {
cmsCore::loadClass('billing');
}
global $_LANG;
$id = cmsCore::request('id', 'int', 0);
$do = $inCore->do;
$seolink = cmsCore::strClear(urldecode(cmsCore::request('seolink', 'html', '')));
if (is_numeric($seolink)) {
cmsCore::error404();
}
$page = cmsCore::request('page', 'int', 1);
///////////////////////////////////// VIEW CATEGORY ////////////////////////////////////////////////////////////////////////////////
if ($do == 'view') {
$cat = $inDB->getNsCategory('cms_category', $seolink);
// если не найдена категория и мы не на главной, 404
if (!$cat && $inCore->menuId() !== 1) {
cmsCore::error404();
}
// языки
$cat = translations::process(cmsConfig::getConfig('lang'), 'content_category', $cat);
// Плагины
$cat = cmsCore::callEvent('GET_CONTENT_CAT', $cat);
// Неопубликованные показываем только админам
if (!$cat['published'] && !$inUser->is_admin) {
cmsCore::error404();
}
// Проверяем доступ к категории
if (!$inCore->checkUserAccess('category', $cat['id'])) {
cmsCore::addSessionMessage($_LANG['NO_PERM_FOR_VIEW_TEXT'] . '<br>' . $_LANG['NO_PERM_FOR_VIEW_RULES'], 'error');
cmsCore::redirect('/content');
}
// если не корень категорий
if ($cat['NSLevel'] > 0) {
$inPage->setTitle($cat['pagetitle'] ? $cat['pagetitle'] : $cat['title']);
$pagetitle = $cat['title'];
$showdate = $cat['showdate'];
$showcomm = $cat['showcomm'];
$inPage->addHead('<link rel="alternate" type="application/rss+xml" title="' . htmlspecialchars($cat['title']) . '" href="' . HOST . '/rss/content/' . $cat['id'] . '/feed.rss">');
}
// Если корневая категория
if ($cat['NSLevel'] == 0) {
if ($model->config['hide_root']) {
cmsCore::error404();
}
$inPage->setTitle($_LANG['CATALOG_ARTICLES']);
$pagetitle = $_LANG['CATALOG_ARTICLES'];
$showdate = 1;
$showcomm = 1;
}
// Получаем дерево категорий
$path_list = $inDB->getNsCategoryPath('cms_category', $cat['NSLeft'], $cat['NSRight'], 'id, title, NSLevel, seolink, url');
if ($path_list) {
$path_list = translations::process(cmsConfig::getConfig('lang'), 'content_category', $path_list);
foreach ($path_list as $pcat) {
if (!$inCore->checkUserAccess('category', $pcat['id'])) {
cmsCore::addSessionMessage($_LANG['NO_PERM_FOR_VIEW_TEXT'] . '<br>' . $_LANG['NO_PERM_FOR_VIEW_RULES'], 'error');
cmsCore::redirect('/content');
}
$inPage->addPathway($pcat['title'], $model->getCategoryURL(null, $pcat['seolink']));
}
}
// Получаем подкатегории
$subcats_list = $model->getSubCats($cat['id']);
// Привязанный фотоальбом
$cat_photos = $model->getCatPhotoAlbum($cat['photoalbum']);
// Получаем статьи
// Редактор/администратор
$is_editor = $cat['modgrp_id'] == $inUser->group_id && cmsUser::isUserCan('content/autoadd') || $inUser->is_admin;
// Условия
$model->whereCatIs($cat['id']);
// Общее количество статей
$total = $model->getArticlesCount($is_editor);
// Сортировка и разбивка на страницы
$inDB->orderBy($cat['orderby'], $cat['orderto']);
$inDB->limitPage($page, $model->config['perpage']);
// Получаем статьи
$content_list = $total ? $model->getArticlesList(!$is_editor) : array();
$inDB->resetConditions();
if (!$content_list && $page > 1) {
cmsCore::error404();
}
$pagebar = cmsPage::getPagebar($total, $page, $model->config['perpage'], $model->getCategoryURL(null, $cat['seolink'], 0, true));
$template = $cat['tpl'] ? $cat['tpl'] : 'com_content_view.tpl';
if ($cat['NSLevel'] > 0) {
// meta description
if ($cat['meta_desc']) {
$meta_desc = $cat['meta_desc'];
} elseif (mb_strlen(strip_tags($cat['description'])) >= 250) {
$meta_desc = crop($cat['description']);
} else {
$meta_desc = $cat['title'];
}
//.........这里部分代码省略.........
示例11: if
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['AD_WATERMARK']; ?></label>
<div class="col-sm-7 btn-group" data-toggle="buttons">
<label class="btn btn-default <?php if(cmsCore::getArrVal($cfg, 'watermark', false)) { echo 'active'; } ?>">
<input type="radio" name="watermark" <?php if(cmsCore::getArrVal($cfg, 'watermark', false)) { echo 'checked="checked"'; } ?> value="1"> <?php echo $_LANG['YES']; ?>
</label>
<label class="btn btn-default <?php if (!cmsCore::getArrVal($cfg, 'watermark', false)) { echo 'active'; } ?>">
<input type="radio" name="watermark" <?php if (!cmsCore::getArrVal($cfg, 'watermark', false)) { echo 'checked="checked"'; } ?> value="0" /> <?php echo $_LANG['NO']; ?>
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['AD_ABOUT_NEW_COMENT']; ?></label>
<div class="col-sm-7">
<?php echo '/languages/'. cmsConfig::getConfig('lang') .'/letters/newcomment.txt'; ?>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['AD_MAX_LEVEL']; ?></label>
<div class="col-sm-7">
<input type="number" class="form-control" name="max_level" min="0" value="<?php echo $cfg['max_level'];?>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label"><?php echo $_LANG['AD_HOW_MANY_COMENTS']; ?></label>
<div class="col-sm-7">
<input type="number" class="form-control" name="perpage" min="0" value="<?php echo $cfg['perpage'];?>" />
</div>
示例12: applet_modules
//.........这里部分代码省略.........
$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' )
);
cpToolMenu($toolmenu);
$fields = array(
array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
array(
'title' => $_LANG['AD_TITLE'],
'field' => array('title','titles'), 'width'=>'',
'link' => '?view=modules&do=edit&id=%id%',
'prc' => function ($i) {
$i['titles'] = cmsCore::yamlToArray($i['titles']);
// переопределяем название пункта меню в зависимости от языка
if (!empty($i['titles'][cmsConfig::getConfig('lang')])) {
$i['title'] = $i['titles'][cmsConfig::getConfig('lang')];
}
return $i['title'];
}
),
array( 'title' => $_LANG['TITLE'], 'field' => 'name', 'width' => '220', 'filter' => '15' ),
array( 'title' => $_LANG['AD_VERSION'], 'field' => 'version', 'width' => '70' ),
array( 'title' => $_LANG['AD_AUTHOR'], 'field' => 'author', 'width' => '110' ),
array( 'title' => $_LANG['SHOW'], 'field' => 'published', 'width' => '80' ),
array( 'title' => $_LANG['AD_ORDER'], 'field' => 'ordering', 'width' => '100' ),
array( 'title' => $_LANG['AD_POSITION'], 'field' => 'position', 'width' => '80', 'filter' => '10', 'filterlist' => cpGetList('positions') )
);
$actions = array(
array( 'title' => $_LANG['AD_CONFIG'], 'icon' => 'config.gif', 'link' => '?view=modules&do=config&id=%id%', 'condition' => 'cpModuleHasConfig' ),
array( 'title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=modules&do=edit&id=%id%' ),
array( 'title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_MODULE_DELETE'], 'link' => '?view=modules&do=delete&id=%id%' )
);
cpListTable('cms_modules', $fields, $actions, '', 'published DESC, position, ordering ASC');
}
if ($do == 'autoorder'){
$rs = cmsCore::c('db')->query("SELECT id, position FROM cms_modules ORDER BY position") ;
if (cmsCore::c('db')->num_rows($rs)) {
$ord = 1;
while ($item = cmsCore::c('db')->fetch_assoc($rs)) {
if (isset($latest_pos)) {
if ($latest_pos != $item['position']) {
$ord = 1;
示例13: display_link_template
function display_link_template($link, $model, $time = 10)
{
global $_LANG;
$inPage = cmsPage::getInstance();
$is_domain_banned = false;
// проверяем ссылку
if (function_exists('curl_init') && $model->config['check_link']) {
$link_domain = parse_url($link, PHP_URL_HOST);
if ($model->config['white_list'] && $link_domain && !in_array($link_domain, $model->config['white_list']) || !$model->config['white_list']) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.vk.com/method/utils.checkLink?url=' . $link);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 2);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, 'InstantCMS/' . CORE_VERSION . ' +' . HOST);
$data = json_decode(curl_exec($ch), true);
if (!isset($data['error']) && isset($data['response'])) {
$is_domain_banned = $data['response']['status'] == 'banned';
$link = $data['response']['link'];
}
}
}
$inPage->setTitle($_LANG['FILE_EXTERNAL_LINK']);
$inPage->setDescription($_LANG['FILE_EXTERNAL_LINK']);
cmsPage::initTemplate('components', 'com_files_redirect')->assign('url', htmlspecialchars($link))->assign('time', $time)->assign('sitename', cmsConfig::getConfig('sitename'))->assign('is_domain_banned', $is_domain_banned)->display('com_files_redirect.tpl');
}
示例14: addWall
public function addWall($item) {
// проверяем есть ли пользователь, которому добавляем на стену
$usr = cmsUser::getShortUserData($item['user_id']);
if (!$usr) { return false; }
// добавляем запись
$wall_id = $this->inDB->insert('cms_user_wall', cmsCore::callEvent('ADD_WALL', $item));
$message = strip_tags($item['content']);
$message = mb_strlen($message)>100 ? mb_substr($message, 0, 100) : $message;
if ($item['user_id'] == $item['author_id']){
cmsActions::log('add_wall_my', array(
'object' => '',
'object_url' => '',
'object_id' => $wall_id,
'target' => '',
'target_url' => '',
'target_id' => 0,
'description' => $message
));
} else {
cmsActions::log('add_wall', array(
'object' => $usr['nickname'],
'object_url' => cmsUser::getProfileURL($usr['login']),
'object_id' => $wall_id,
'target' => '',
'target_url' => '',
'target_id' => 0,
'description' => $message
));
}
$usr['email_newmsg'] = $this->inDB->get_field('cms_user_profiles', "user_id='{$item['user_id']}'", 'email_newmsg');
if ($usr['email_newmsg'] && $item['user_id'] != $item['author_id']){
global $_LANG;
$letter = cmsCore::getLanguageTextFile('newwallpost');
$letter = str_replace('{sitename}', cmsConfig::getConfig('sitename'), $letter);
$letter = str_replace('{profilelink}', HOST . cmsUser::getProfileURL($usr['login']), $letter);
$letter = str_replace('{date}', date('d/m/Y H:i:s'), $letter);
$letter = str_replace('{from}', $item['nickname'], $letter);
cmsCore::getInstance()->mailText($usr['email'], $_LANG['NEW_POST_ON_WALL'].'! - '.cmsConfig::getConfig('sitename'), $letter);
}
return $wall_id;
}
示例15: getForums
public function getForums($is_admin = false)
{
$pub_sql = $is_admin ? '' : ' AND f.published = 1';
$sql = "SELECT f.*, cat.title as cat_title, cat.seolink as cat_seolink, cat.id as cat_id\r\n FROM cms_forums f\r\n LEFT JOIN cms_forum_cats cat ON cat.id = f.category_id\r\n WHERE f.parent_id > 0 AND cat.published = 1 {$pub_sql}\r\n {$this->inDB->where}\r\n ORDER BY cat.ordering, f.NSLeft \n";
if ($this->inDB->limit) {
$sql .= "LIMIT {$this->inDB->limit}";
}
$result = $this->inDB->query($sql);
$this->inDB->resetConditions();
if (!$this->inDB->num_rows($result)) {
return array();
}
$forums = array();
while ($forum = $this->inDB->fetch_assoc($result)) {
// проверяем доступ к форуму
if (!cmsCore::checkContentAccess($forum['access_list'])) {
continue;
}
// получаем массив последнего сообщения
$forum['last_msg_array'] = cmsCore::yamlToArray($forum['last_msg']);
if ($forum['last_msg_array']) {
$forum['last_msg_array']['fpubdate'] = cmsCore::dateFormat($forum['last_msg_array']['pubdate']);
}
// Путь до иконки форума
$forum['icon_url'] = '/upload/forum/cat_icons/' . ($forum['icon'] ? $forum['icon'] : 'forum.gif');
$forums[] = $forum;
}
if ($forums) {
$forums = translations::process(cmsConfig::getConfig('lang'), 'forum_forums', $forums);
$forums = translations::process(cmsConfig::getConfig('lang'), 'forum_forum_cats', $forums, 'cat_id', array('title' => 'cat_title'));
foreach ($forums as $f) {
// Уровень первого элемента
$first_level = isset($first_level) ? $first_level : $f['NSLevel'];
// Формируем корневой уровень
if ($f['NSLevel'] == $first_level) {
$nested_forums[] = $f;
} else {
// формируем подфорумы
$k = array_keys($nested_forums);
$nested_forums[end($k)]['sub_forums'][] = $f;
}
}
}
return cmsCore::callEvent('GET_FORUMS', $nested_forums);
}