本文整理汇总了PHP中cmsUser::getGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsUser::getGroups方法的具体用法?PHP cmsUser::getGroups怎么用?PHP cmsUser::getGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsUser
的用法示例。
在下文中一共展示了cmsUser::getGroups方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: users
//.........这里部分代码省略.........
cmsUser::goToLogin();
}
$usr = cmsUser::getShortUserData($id);
if (!$usr) {
cmsCore::error404();
}
$inPage->setTitle($_LANG['MY_MESS']);
$inPage->addPathway($usr['nickname'], cmsUser::getProfileURL($usr['login']));
$inPage->addPathway($_LANG['MY_MESS'], '/users/' . $id . '/messages.html');
include 'components/users/messages.php';
}
//============================================================================//
//=========================== Отправка сообщения ============================//
//============================================================================//
if ($do == 'sendmessage') {
if (!$model->config['sw_msg']) {
cmsCore::halt();
}
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
cmsCore::halt();
}
if (!$inUser->id || $inUser->id == $id && !cmsCore::inRequest('massmail') && !cmsCore::request('send_to_group', 'int', 0)) {
cmsCore::halt();
}
if (!cmsCore::inRequest('gosend')) {
$replyid = cmsCore::request('replyid', 'int', 0);
if ($replyid) {
$msg = $model->getReplyMessage($replyid, $inUser->id);
if (!$msg) {
cmsCore::halt();
}
}
$inPage->setRequestIsAjax();
cmsPage::initTemplate('components', 'com_users_messages_add')->assign('msg', isset($msg) ? $msg : array())->assign('is_reply_user', $replyid)->assign('id', $id)->assign('bbcodetoolbar', cmsPage::getBBCodeToolbar('message'))->assign('smilestoolbar', cmsPage::getSmilesPanel('message'))->assign('groups', $inUser->is_admin ? cmsUser::getGroups(true) : array())->assign('friends', cmsUser::getFriends($inUser->id))->assign('id_admin', $inUser->is_admin)->display('com_users_messages_add.tpl');
cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
}
if (cmsCore::inRequest('gosend')) {
// Кому отправляем
$usr = cmsUser::getShortUserData($id);
if (!$usr) {
cmsCore::halt();
}
$message = cmsCore::parseSmiles(cmsCore::request('message', 'html', ''), true);
if (mb_strlen($message) < 2) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ERR_SEND_MESS']));
}
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$output = cmsCore::callEvent('USER_SEND_MESSEDGE', array('text' => $message, 'to_id' => $id));
$message = $output['text'];
$id = $output['to_id'];
$send_to_group = cmsCore::request('send_to_group', 'int', 0);
$group_id = cmsCore::request('group_id', 'int', 0);
//
// Обычная отправка (1 получатель)
//
if (!cmsCore::inRequest('massmail') && !$send_to_group) {
//отправляем сообщение
$msg_id = cmsUser::sendMessage($inUser->id, $id, $message);
// отправляем уведомление на email если нужно
$model->sendNotificationByEmail($id, $inUser->id, $msg_id);
cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['SEND_MESS_OK']));
}
//
// далее идут массовые рассылки, доступные только админам
示例2: foreach
</div>
<div class="form-group">
<label><?php echo $_LANG['AD_CATEGORY']; ?>:</label>
<?php $rootid = cmsCore::c('db')->get_field('cms_forums', 'parent_id=0', 'id'); ?>
<select id="category_id" class="form-control" name="category_id">
<?php
echo $inCore->getListItems('cms_forum_cats', cmsCore::getArrVal($mod, 'category_id', cmsCore::request('addto', 'int', 0)), 'ordering');
?>
</select>
</div>
<div class="form-group">
<label><?php echo $_LANG['AD_SHOW_GROUP']; ?>:</label>
<?php
$groups = cmsUser::getGroups();
$style = 'disabled="disabled"';
$public = 'checked="checked"';
if ($mod['access_list']) {
$public = '';
$style = '';
$access_list = $inCore->yamlToArray($mod['access_list']);
}
echo '<select id="showin" class="form-control" name="access_list[]" size="6" multiple="multiple" '. $style .'>';
if ($groups) {
foreach ($groups as $group) {
if (!$group['is_admin']) {
示例3: applet_menu
//.........这里部分代码省略.........
echo $_LANG['NO'];
?>
</label>
</td>
</tr>
<tr>
<td valign="top"><strong><?php
echo $_LANG['AD_PREFIX_CSS'];
?>
</strong></td>
<td valign="top">
<input name="css_prefix" type="text" id="css_prefix" value="<?php
echo @$mod['css_prefix'];
?>
" style="width:99%" />
</td>
</tr>
<tr>
<td valign="top">
<strong><?php
echo $_LANG['AD_TAB_ACCESS'];
?>
:</strong><br />
<span class="hinttext"><?php
echo $_LANG['AD_GROUP_ACCESS'];
?>
</span>
</td>
<td valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="checklist" style="margin-top:5px">
<tr>
<td width="20">
<?php
$groups = cmsUser::getGroups();
$style = 'disabled="disabled"';
$public = 'checked="checked"';
if ($do == 'edit') {
if ($mod['access_list']) {
$public = '';
$style = '';
$access_list = $inCore->yamlToArray($mod['access_list']);
}
}
?>
<input name="is_public" type="checkbox" id="is_public" onclick="checkAccesList()" value="1" <?php
echo $public;
?>
/>
</td>
<td><label for="is_public"><strong><?php
echo $_LANG['AD_SHARE'];
?>
</strong></label></td>
</tr>
</table>
<div style="padding:5px">
<span class="hinttext">
<?php
echo $_LANG['AD_VIEW_IF_CHECK'];
?>
</span>
</div>
<div style="margin-top:10px;padding:5px;padding-right:0px;" id="grp">
<div>
<strong><?php
示例4:
if (@(!$cfg['act'])) {
echo 'checked="checked"';
}
?>
/> Нет
</td>
</tr>
<tr>
<td><strong>Письмо с инструкцией по активации:</strong> </td>
<td><a href="/includes/letters/activation.txt">/includes/letters/activation.txt</a></td>
</tr>
<tr>
<td><strong>Группа пользователей по-умолчанию:</strong></td>
<td>
<?php
$groups = cmsUser::getGroups(true);
?>
<select name="default_gid" id="default_gid" style="width:300px">
<?php
foreach ($groups as $group) {
?>
<option value="<?php
echo $group['id'];
?>
" <?php
if ($cfg['default_gid'] == $group['id']) {
?>
selected="selected"<?php
}
?>
><?php
示例5: applet_modules
//.........这里部分代码省略.........
<div class="form-group">
<label><?php echo $_LANG['AD_MODULE_CACHE_PERIOD']; ?></label>
<table class="table">
<tr>
<td valign="top" width="100">
<input id="int_1" class="form-control" style="width:99%" name="cachetime" type="text" value="<?php echo cmsCore::getArrVal($mod, 'cachetime', 0); ?>"/>
</td>
<td valign="top" style="padding-left:5px">
<select id="int_2" class="form-control" style="width:100%" name="cacheint">
<option value="MINUTE" <?php if(mb_strstr(cmsCore::getArrVal($mod, 'cacheint', 'MINUTES'), 'MINUTE')) { echo 'selected="selected"'; } ?>><?php echo cmsCore::spellCount(cmsCore::getArrVal($mod, 'cachetime', 0), $_LANG['MINUTE1'], $_LANG['MINUTE2'], $_LANG['MINUTE10'], false); ?></option>
<option value="HOUR" <?php if(mb_strstr(cmsCore::getArrVal($mod, 'cacheint', 'MINUTES'), 'HOUR')) { echo 'selected="selected"'; } ?>><?php echo cmsCore::spellCount(cmsCore::getArrVal($mod, 'cachetime', 0), $_LANG['HOUR1'], $_LANG['HOUR2'], $_LANG['HOUR10'], false); ?></option>
<option value="DAY" <?php if(mb_strstr(cmsCore::getArrVal($mod, 'cacheint', 'MINUTES'), 'DAY')) { echo 'selected="selected"'; } ?>><?php echo cmsCore::spellCount(cmsCore::getArrVal($mod, 'cachetime', 0), $_LANG['DAY1'], $_LANG['DAY2'], $_LANG['DAY10'], false); ?></option>
<option value="MONTH" <?php if(mb_strstr(cmsCore::getArrVal($mod, 'cacheint', 'MINUTES'), 'MONTH')) { echo 'selected="selected"'; } ?>><?php echo cmsCore::spellCount(cmsCore::getArrVal($mod, 'cachetime', 0), $_LANG['MONTH1'], $_LANG['MONTH2'], $_LANG['MONTH10'], false); ?></option>
</select>
</td>
</tr>
</table>
<div style="margin-top:15px">
<?php
if ($do == 'edit') {
$cache = cmsCore::c('cache')->get('modules', $mod['id'], $mod['content'], array(cmsCore::getArrVal($mod, 'cachetime', 1), cmsCore::getArrVal($mod, 'cacheint', 'MINUTES')));
if (!empty($cache)){
$kb = round(mb_strlen($cache)/1024, 2);
unset($cache);
echo '<a href="index.php?view=cache&component=modules&target='. $mod['content'] .'&target_id='. $mod['id'] .'">'. $_LANG['AD_MODULE_CACHE_DELETE'] .'</a> ('. $kb . $_LANG['SIZE_KB'] .')';
} else {
echo '<span style="color:gray">'. $_LANG['AD_NO_CACHE'] .'</span>';
}
}
?>
</div>
</div>
</div>
<?php } ?>
<div id="upr_access">
<div class="form-group">
<?php
$groups = cmsUser::getGroups();
$style = 'disabled="disabled"';
$public = 'checked="checked"';
if ($do == 'edit') {
if ($mod['access_list']) {
$public = '';
$style = '';
$access_list = $inCore->yamlToArray($mod['access_list']);
}
}
?>
<label>
<input name="is_public" type="checkbox" id="is_public" onclick="checkAccesList()" value="1" <?php echo $public; ?> />
<?php echo $_LANG['AD_SHARE']; ?>
</label>
<div class="help-block"><?php echo $_LANG['AD_IF_CHECKED']; ?></div>
</div>
<div class="form-group">
<label><?php echo $_LANG['AD_GROUPS_VIEW']; ?></label>
<?php
echo '<select style="width: 99%" name="allow_group[]" id="allow_group" size="6" multiple="multiple" '.$style.'>';
if ($groups) {
foreach($groups as $group) {
echo '<option value="'.$group['id'].'"';
if ($do == 'edit' && $mod['access_list']) {
if (in_array($group['id'], $access_list)) {
echo 'selected="selected"';
}
}
echo '>';
echo $group['title'].'</option>';
}
}
echo '</select>';
?>
<div class="help-block"><?php echo $_LANG['AD_SELECT_MULTIPLE_CTRL']; ?></div>
</div>
</div>
</div>
</td></tr>
</table>
<p>
<input type="submit" id="add_mod" class="btn btn-primary" name="add_mod" value="<?php echo $_LANG['SAVE']; ?>" />
<input type="button" id="back" class="btn btn-default" name="back" value="<?php echo $_LANG['CANCEL']; ?>" onclick="window.history.back();" />
<input type="hidden" id="do" name="do" <?php if ($do == 'add') { echo 'value="submit"'; } else { echo 'value="update"'; } ?> />
<?php
if ($do == 'edit') {
echo '<input name="id" type="hidden" value="'. $mod['id'] .'" />';
}
?>
</p>
</form>
<?php
}
}
示例6: applet_modules
//.........这里部分代码省略.........
</td>
</tr>
</table>
</div>
<div style="margin-top:15px">
<?php
if ($do == 'edit') {
if ($inCore->isCached('module', $mod['id'], $mod['cachetime'], $mod['cacheint'])) {
$t = 'module' . $mod['id'];
$cfile = PATH . '/cache/' . md5($t) . '.html';
if (file_exists($cfile)) {
$kb = round(filesize($cfile) / 1024, 2);
echo '<a href="index.php?view=cache&do=delcache&target=module&id=' . $mod['id'] . '">' . $_LANG['AD_MODULE_CACHE_DELETE'] . '</a> (' . $kb . $_LANG['SIZE_KB'] . ')';
}
} else {
echo '<span style="color:gray">' . $_LANG['AD_NO_CACHE'] . '</span>';
}
}
?>
</div>
<?php
}
?>
{tab=<?php
echo $_LANG['AD_TAB_ACCESS'];
?>
}
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="checklist" style="margin-top:5px">
<tr>
<td width="20">
<?php
$groups = cmsUser::getGroups();
$style = 'disabled="disabled"';
$public = 'checked="checked"';
if ($do == 'edit') {
if ($mod['access_list']) {
$public = '';
$style = '';
$access_list = $inCore->yamlToArray($mod['access_list']);
}
}
?>
<input name="is_public" type="checkbox" id="is_public" onclick="checkAccesList()" value="1" <?php
echo $public;
?>
/>
</td>
<td><label for="is_public"><strong><?php
echo $_LANG['AD_SHARE'];
?>
</strong></label></td>
</tr>
</table>
<div style="padding:5px">
<span class="hinttext">
<?php
echo $_LANG['AD_IF_CHECKED'];
?>
</span>
</div>
<div style="margin-top:10px;padding:5px;padding-right:0px;">
<div>
<strong><?php
示例7: applet_menu
//.........这里部分代码省略.........
foreach($pos as $key=>$position) {
if (cmsCore::getArrVal($mod, 'position') == $position){
echo '<option value="'. $position .'" selected>'. $position .'</option>';
} else {
echo '<option value="'. $position .'">'. $position .'</option>';
}
}
}
?>
</select>
<input name="is_external" type="hidden" id="is_external" value="0" />
<div class="help-block"><?php echo $_LANG['AD_POSITION_MUST_BE']; ?></div>
</div>
<div class="form-group">
<label><?php echo $_LANG['AD_MENU_PUBLIC']; ?></label>
<label>
<input name="published" type="radio" value="1" checked="checked" <?php if (cmsCore::getArrVal($mod, 'published')) { echo 'checked="checked"'; } ?> /> <?php echo $_LANG['YES']; ?>
</label>
<label>
<input name="published" type="radio" value="0" <?php if (!cmsCore::getArrVal($mod, 'published')) { echo 'checked="checked"'; } ?> /> <?php echo $_LANG['NO']; ?>
</label>
</div>
<div class="form-group">
<label><?php echo $_LANG['AD_PREFIX_CSS']; ?></label>
<input type="text" id="css_prefix" class="form-control" name="css_prefix" value="<?php echo cmsCore::getArrVal($mod, 'css_prefix'); ?>" style="width:99%" />
</div>
<div class="form-group">
<label><?php echo $_LANG['AD_TAB_ACCESS']; ?>:</label>
<div class="help-block"><?php echo $_LANG['AD_GROUP_ACCESS'] ; ?></div>
<?php
$groups = cmsUser::getGroups();
$style = 'disabled="disabled"';
$public = 'checked="checked"';
if ($do == 'edit') {
if ($mod['access_list']) {
$public = '';
$style = '';
$access_list = $inCore->yamlToArray($mod['access_list']);
}
}
?>
<label><input name="is_public" type="checkbox" id="is_public" onclick="checkAccesList()" value="1" <?php echo $public?> /> <?php echo $_LANG['AD_SHARE']; ?></label>
<div class="help-block"><?php echo $_LANG['AD_VIEW_IF_CHECK']; ?></div>
</div>
<div class="form-group">
<label><?php echo $_LANG['AD_GROUPS_VIEW']; ?></label>
<?php
echo '<select class="form-control" style="width: 99%" name="allow_group[]" id="allow_group" size="6" multiple="multiple" '. $style .'>';
if ($groups) {
foreach ($groups as $group) {
echo '<option value="'. $group['id'] .'"';
if ($do == 'edit') {
if (in_array($group['id'], $access_list)) {
echo 'selected="selected"';
}
}
echo '>';
echo $group['title'].'</option>';
}
}
示例8: mb_strtolower
$cfg['first_auth_redirect'] = cmsCore::request('first_auth_redirect', 'str', '');
$cfg['auth_redirect'] = cmsCore::request('auth_redirect', 'str', '');
$cfg['name_mode'] = cmsCore::request('name_mode', 'str', '');
$cfg['badnickname'] = mb_strtolower(cmsCore::request('badnickname', 'html', ''));
$cfg['ask_icq'] = cmsCore::request('ask_icq', 'int', 0);
$cfg['ask_birthdate'] = cmsCore::request('ask_birthdate', 'int', 0);
$cfg['ask_city'] = cmsCore::request('ask_city', 'int', 0);
$cfg['send_greetmsg'] = cmsCore::request('send_greetmsg', 'int');
$cfg['greetmsg'] = cmsCore::request('greetmsg', 'html', '');
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
$inCore->saveComponentConfig('registration', $cfg);
if (cmsCore::request('inv_now', 'int', 0)) {
$inv_count = $cfg['inv_count'];
$inv_karma = $cfg['inv_karma'];
if ($inv_count) {
$invites_given = cmsCore::m('users')->giveInvites($inv_count, $inv_karma);
if ($invites_given) {
cmsCore::addSessionMessage($_LANG['AD_ISSUED_INVITES'] . ': ' . $invites_given, 'success');
} else {
cmsCore::addSessionMessage($_LANG['AD_INVITES_NOT_ISSUED'], 'success');
}
}
}
if (cmsCore::request('inv_delete', 'int', 0)) {
cmsCore::m('users')->deleteInvites();
cmsCore::addSessionMessage($_LANG['AD_INVITES_DELETE'], 'success');
}
cmsCore::redirectBack();
}
cmsCore::c('page')->initTemplate('components', 'registration_config')->assign('groups', cmsUser::getGroups(true))->assign('cfg', $cfg)->display();
示例9: applet_modules
//.........这里部分代码省略.........
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)\r\n 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') {
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']);
$mod['titles'] = cmsCore::yamlToArray($mod['titles']);
$show_all = false;
$default_position = cmsCore::c('db')->get_field('cms_modules_bind', "module_id='" . $mod['id'] . "' AND menu_id=0 AND tpl='" . cmsCore::c('config')->template . "'", 'position');
if (!empty($default_position)) {
$show_all = true;
$mod['position'] = $default_position;
}
echo '<h3>' . $_LANG['AD_EDIT_MODULE'] . $ostatok . '</h3>';
cpAddPathway($mod['name']);
}
$toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();');
$toolmenu[] = array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'javascript:history.go(-1);');
if (cmsCore::getArrVal($mod, 'is_external')) {
$php_file = 'modules/' . $mod['content'] . '/backend.php';
$xml_file = 'modules/' . $mod['content'] . '/backend.xml';
if (file_exists($php_file) || file_exists($xml_file)) {
$toolmenu[] = array('icon' => 'config.gif', 'title' => $_LANG['CONFIG_MODULE'], 'link' => '?view=modules&do=config&id=' . $mod['id']);
}
}
cpToolMenu($toolmenu);
$bind = array();
$bind_pos = array();
$cache = 0;
if ($do == 'edit') {
$bind_sql = "SELECT * FROM cms_modules_bind WHERE module_id = " . $mod['id'] . " AND tpl = '" . cmsCore::c('config')->template . "'";
$bind_res = cmsCore::c('db')->query($bind_sql);
while ($r = cmsCore::c('db')->fetch_assoc($bind_res)) {
$bind[] = $r['menu_id'];
$bind_pos[$r['menu_id']] = $r['position'];
}
$cache = cmsCore::c('cache')->get('modules', $mod['id'], $mod['content'], array(cmsCore::getArrVal($mod, 'cachetime', 1), cmsCore::getArrVal($mod, 'cacheint', 'MINUTES')));
}
$menu_sql = "SELECT * FROM cms_menu ORDER BY NSLeft, ordering";
$menu_res = cmsCore::c('db')->query($menu_sql);
$menu_items = array();
if (cmsCore::c('db')->num_rows($menu_res)) {
while ($item = cmsCore::c('db')->fetch_assoc($menu_res)) {
if ($do == 'edit') {
if (in_array($item['id'], $bind)) {
$item['selected'] = true;
$item['position'] = $bind_pos[$item['id']];
}
}
$item['titles'] = cmsCore::yamlToArray($item['titles']);
// переопределяем название пункта меню в зависимости от языка
if (!empty($item['titles'][cmsCore::c('config')->lang])) {
$item['title'] = $item['titles'][cmsCore::c('config')->lang];
}
$item['title'] = str_replace($_LANG['AD_ROOT_PAGES'], $_LANG['AD_MAIN'], $item['title']);
$menu_items[] = $item;
}
}
cmsCore::c('page')->initTemplate('applets', 'modules_add')->assign('do', $do)->assign('langs', cmsCore::getDirsList('/languages'))->assign('pos', cpModulePositions(cmsCore::c('config')->template))->assign('positions_img_exist', file_exists(PATH . '/templates/' . cmsCore::c('config')->template . '/positions.jpg'))->assign('tpls', cmsAdmin::getModuleTemplates())->assign('modules_opt', $inCore->getListItems('cms_modules'))->assign('show_all', $show_all)->assign('groups', cmsUser::getGroups())->assign('kb_cache', !empty($cache) ? round(mb_strlen($cache) / 1024, 2) : false)->assign('menu_items', $menu_items)->assign('access_list', !empty($mod['access_list']) ? $inCore->yamlToArray($mod['access_list']) : array())->assign('mod', $mod)->display();
}
}
示例10: 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();
}
}
示例11: array
$_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'] . count($_SESSION['editlist']) . ')';
}
} else {
$item_id = cmsCore::request('item_id', 'int', 0);
}
$mod = $model->getForum($item_id);
if (!$mod) {
cmsCore::error404();
}
cpAddPathway($mod['title']);
}
if (!empty($mod['moder_list'])) {
$moder_list = $inCore->yamlToArray($mod['moder_list']);
if ($moder_list) {
$moder_list = cmsUser::getAuthorsList($moder_list, $moder_list);
}
}
cmsCore::c('page')->initTemplate('components', 'forum_add_forum')->assign('is_billing', IS_BILLING)->assign('opt', $opt)->assign('ostatok', $ostatok)->assign('rootid', cmsCore::c('db')->get_field('cms_forums', 'parent_id=0', 'id'))->assign('forums_opt', $inCore->getListItemsNS('cms_forums', cmsCore::getArrVal($mod, 'parent_id', 0)))->assign('forum_cats_opt', $inCore->getListItems('cms_forum_cats', cmsCore::getArrVal($mod, 'category_id', cmsCore::request('addto', 'int', 0)), 'ordering'))->assign('groups', cmsUser::getGroups())->assign('access_list', !empty($mod['access_list']) ? $inCore->yamlToArray($mod['access_list']) : false)->assign('moder_list', $moder_list)->assign('mod', $mod)->display();
}