本文整理汇总了PHP中cmsCore::yamlToArray方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::yamlToArray方法的具体用法?PHP cmsCore::yamlToArray怎么用?PHP cmsCore::yamlToArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::yamlToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPoll
public function getPoll($poll_id, $order = 'id ASC')
{
$where = $poll_id ? "id = '{$poll_id}'" : '1=1';
$poll = $this->inDB->get_fields('cms_polls', $where, '*', $order);
if (!$poll) {
return false;
}
$poll['answers'] = cmsCore::yamlToArray($poll['answers']);
$poll['total_answers'] = $this->getVoteCount($poll['answers']);
return cmsCore::callEvent('GET_POLL', $poll);
}
示例2: getPoll
/**
* Возвращает опрос
* @param str $where условия запроса
* @return int
*/
public function getPoll($where)
{
$poll = $this->inDB->get_fields('cms_forum_polls', $where, '*');
if (!$poll) {
return false;
}
global $_LANG;
$poll['answers'] = cmsCore::yamlToArray($poll['answers']);
$num = 1;
foreach ($poll['answers'] as $key => $value) {
$poll['answers_key'][$num] = $key;
$num++;
}
$poll['options'] = cmsCore::yamlToArray($poll['options']);
switch ($poll['options']['result']) {
case 0:
$poll['options']['result_text'] = $_LANG['AVAILABLE_FOR_ALL'];
break;
case 1:
$poll['options']['result_text'] = $_LANG['AVAILABLE_FOR_VOTERS'];
break;
case 2:
$poll['options']['result_text'] = $_LANG['AVAILABLE_AFTER_VOTE'];
break;
}
switch ($poll['options']['change']) {
case 0:
$poll['options']['change_text'] = $_LANG['PROHIBITED'];
break;
case 1:
$poll['options']['change_text'] = $_LANG['ALLOW'];
break;
}
$poll['days_left'] = round((strtotime($poll['enddate']) - time()) / 86400);
$poll['days_left'] = $poll['days_left'] < 0 ? 0 : $poll['days_left'];
$poll['is_closed'] = $poll['days_left'] <= 0;
$poll['is_user_vote'] = $this->isUserVoted($poll['id']);
// совместимость старых типов ответов, по id
// если пользователь проголосовал
if (!is_bool($poll['is_user_vote'])) {
if (is_numeric($poll['is_user_vote'])) {
$poll['is_user_vote'] = $poll['answers_key'][$poll['is_user_vote']];
}
}
$poll['vote_count'] = $this->getVoteCount($poll['answers']);
$poll['fenddate'] = cmsCore::dateFormat($poll['enddate']);
$poll['show_result'] = false;
return cmsCore::callEvent('GET_THREAD_POLL', $poll);
}
示例3: mod_uc
function mod_uc($module_id, $cfg)
{
$inDB = cmsDatabase::getInstance();
cmsCore::loadModel('catalog');
if (!in_array(@$cfg['sort'], array('rating', 'hits', 'pubdate'))) {
$cfg['sort'] = 'pubdate';
}
global $_LANG;
if (@$cfg['cat_id'] > 0) {
if (!@$cfg['subs']) {
//select from category
$catsql = ' AND i.category_id = ' . $cfg['cat_id'];
} else {
//select from category and subcategories
$rootcat = $inDB->get_fields('cms_uc_cats', "id='{$cfg['cat_id']}'", 'NSLeft, NSRight');
if (!$rootcat) {
return false;
}
$catsql = "AND (c.NSLeft >= {$rootcat['NSLeft']} AND c.NSRight <= {$rootcat['NSRight']})";
}
} else {
$catsql = '';
}
$sql = "SELECT i.* , IFNULL(AVG( r.points ), 0) AS rating, c.view_type as viewtype\n FROM cms_uc_items i\n LEFT JOIN cms_uc_cats c ON c.id = i.category_id\n LEFT JOIN cms_uc_ratings r ON r.item_id = i.id\n WHERE i.published = 1 {$catsql}\n GROUP BY i.id\n ORDER BY {$cfg['sort']} DESC\n LIMIT " . $cfg['num'];
$result = $inDB->query($sql);
$items = array();
if (!$inDB->num_rows($result)) {
return false;
}
cmsCore::includeFile('components/catalog/includes/shopcore.php');
if ($cfg['showtype'] == 'thumb') {
while ($item = $inDB->fetch_assoc($result)) {
if (mb_strlen($item['imageurl']) < 4) {
$item['imageurl'] = 'nopic.jpg';
} elseif (!file_exists(PATH . '/images/catalog/small/' . $item['imageurl'])) {
$item['imageurl'] = 'nopic.jpg';
}
if ($item['viewtype'] == 'shop') {
$item['price'] = number_format(shopDiscountPrice($item['id'], $item['category_id'], $item['price']), 2, '.', ' ');
}
$items[] = $item;
}
}
if ($cfg['showtype'] == 'list') {
while ($item = $inDB->fetch_assoc($result)) {
$item['fieldsdata'] = cmsCore::yamlToArray($item['fieldsdata']);
$item['title'] = mb_substr($item['title'], 0, 40);
for ($f = 0; $f < $cfg['showf']; $f++) {
$item['fdata'][] = cms_model_catalog::getUCSearchLink($item['category_id'], $item['fieldsdata'][$f]);
}
if ($cfg['sort'] == 'rating') {
$item['key'] = '<a href="/catalog/item' . $item['id'] . '.html" title="' . $_LANG['UC_MODULE_RATING'] . ': ' . round($item['rating'], 2) . '">' . cms_model_catalog::buildRating(round($item['rating'], 2)) . '</a>';
} elseif ($cfg['sort'] == 'hits') {
$item['key'] = $_LANG['UC_MODULE_VIEWS'] . ': <a href="/catalog/item' . $item['id'] . '.html" title="' . $_LANG['UC_MODULE_VIEWS'] . '">' . $item['hits'] . '</a>';
} else {
$item['key'] = cmsCore::dateFormat($item['pubdate']);
}
if ($item['viewtype'] == 'shop') {
$item['price'] = number_format(shopDiscountPrice($item['id'], $item['category_id'], $item['price']), 2, '.', ' ');
}
$items[] = $item;
}
}
cmsPage::initTemplate('modules', 'mod_uc')->assign('items', $items)->assign('cfg', $cfg)->display('mod_uc.tpl');
return true;
}
示例4: cpAddPathway
}
if ($opt == 'config') {
cpAddPathway($_LANG['AD_SETTINGS']);
cpCheckWritable('/images/catalog', 'folder');
cpCheckWritable('/images/catalog/medium', 'folder');
cpCheckWritable('/images/catalog/small', 'folder');
cmsCore::c('page')->initTemplate('components', 'catalog_config')->assign('cfg', $cfg)->display();
}
if ($opt == 'import_xls') {
cpAddPathway($_LANG['AD_EXCEL_IMPORT']);
$tpl = cmsCore::c('page')->initTemplate('components', 'catalog_import_xls')->assign('is_cat_id', cmsCore::inRequest('cat_id'));
if (cmsCore::inRequest('cat_id')) {
$cat_id = cmsCore::request('cat_id', 'int', 0);
$cat = cmsCore::c('db')->get_fields('cms_uc_cats', "id = '" . $cat_id . "'", '*');
if (!$cat) {
cmsCore::error404();
}
$tpl->assign('cat_id', $cat_id)->assign('cat', $cat)->assign('fstruct', cmsCore::yamlToArray($cat['fieldsstruct']))->assign('users_opt', cmsUser::getUsersList());
} else {
$cats = array();
$sql = "SELECT id, title, NSLeft, NSLevel, parent_id\r\n FROM cms_uc_cats\r\n WHERE parent_id > 0\r\n ORDER BY NSLeft";
$result = cmsCore::c('db')->query($sql);
if (cmsCore::c('db')->num_rows($result)) {
while ($cat = cmsCore::c('db')->fetch_assoc($result)) {
$cats[] = $cat;
}
}
$tpl->assign('cats', $cats);
}
$tpl->display();
}
示例5: applet_menu
//.........这里部分代码省略.........
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
echo $_LANG['AD_GROUPS_VIEW'];
?>
</strong><br />
<span class="hinttext">
<?php
echo $_LANG['AD_SELECT_MULTIPLE_CTRL'];
?>
示例6: applet_modules
//.........这里部分代码省略.........
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;
}
$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'];
示例7: cpAddPathway
}
if (in_array($opt, array('add', 'edit'))) {
if ($opt == 'add') {
cpAddPathway($_LANG['AD_NEW_FORM']);
echo '<h3>' . $_LANG['AD_NEW_FORM'] . '</h3>';
$mod['showtitle'] = 1;
$mod['form_action'] = '/forms/process';
$mod['tpl'] = 'form';
$mod['only_fields'] = 0;
} else {
$item_id = cmsCore::request('item_id', 'int');
$field_id = cmsCore::request('field_id', 'int');
$mod = $inDB->get_fields('cms_forms', "id = '{$item_id}'", '*');
$field = $inDB->get_fields('cms_form_fields', "id='{$field_id}'", '*');
if ($field) {
$field['config'] = cmsCore::yamlToArray($field['config']);
}
echo '<h3>' . $_LANG['AD_FORM'] . ': ' . $mod['title'] . '</h3>';
cpAddPathway($mod['title']);
ob_start();
echo '{tab=' . $_LANG['AD_FORM_PROPERTIES'] . '}';
}
?>
<form id="addform" name="addform" method="post" action="index.php?view=components&do=config&id=<?php
echo $id;
?>
">
<input type="hidden" name="csrf_token" value="<?php
echo cmsUser::getCsrfToken();
?>
示例8: cpAddPathway
<input type="submit" class="btn btn-primary" name="save" value="<?php echo $_LANG['SAVE']; ?>" />
<input type="button" class="btn btn-default" name="back" value="<?php echo $_LANG['CANCEL']; ?>" onclick="window.location.href='index.php?view=components';"/>
</div>
</form>
<?php
}
if ($opt == 'import_xls') {
cpAddPathway($_LANG['AD_EXCEL_IMPORT']);
echo '<h3>'. $_LANG['AD_EXCEL_IMPORT'] .'</h3>';
if (cmsCore::inRequest('cat_id')) {
$cat_id = cmsCore::request('cat_id', 'int', 0);
$cat = cmsCore::c('db')->get_fields('cms_uc_cats', "id = '$cat_id'", '*');
if (!$cat) { cmsCore::error404(); }
$fstruct = cmsCore::yamlToArray($cat['fieldsstruct']);
?>
<form action="index.php?view=components&do=config&id=<?php echo $id; ?>" method="POST" enctype="multipart/form-data" name="addform">
<input type="hidden" name="csrf_token" value="<?php echo cmsUser::getCsrfToken(); ?>" />
<div style="width:650px;">
<p><strong><?php echo $_LANG['AD_CAT_BOARD']; ?>:</strong> <a href="index.php?view=components&do=config&id=<?php echo $id; ?>&opt=import_xls"><?php echo $cat['title']; ?></a></p>
<p><?php echo $_LANG['AD_CHECK_EXCEL_FILE']; ?></p>
<div class="form-group">
<label><?php echo $_LANG['AD_EXCEL_FILE']; ?></label>
<input type="file" class="form-control" name="xlsfile" />
<div class="help-block"><?php echo $_LANG['AD_XLS_EXTENTION']; ?></div>
</div>
<div class="form-group">
示例9: getRecord
public function getRecord($item_id)
{
$this->deleteOldRecords();
$this->clearOldVips();
$sql = "SELECT i.*,\r\n a.id as cat_id,\r\n\t\t\t\t\t a.form_id,\r\n a.NSLeft as NSLeft,\r\n a.NSRight as NSRight,\r\n a.title as cat_title,\r\n a.title as category,\r\n a.public as public,\r\n a.thumb1 as thumb1,\r\n a.thumb2 as thumb2,\r\n a.thumbsqr as thumbsqr,\r\n u.nickname as user,\r\n u.is_deleted as user_is_deleted,\r\n u.login as user_login\r\n FROM cms_board_items i\r\n\t\t\t\tINNER JOIN cms_board_cats a ON a.id = i.category_id\r\n\t\t\t\tLEFT JOIN cms_users u ON u.id = i.user_id\r\n WHERE i.id = '{$item_id}'";
$result = $this->inDB->query($sql);
if (!$this->inDB->num_rows($result)) {
return false;
}
$record = $this->inDB->fetch_assoc($result);
$timedifference = strtotime("now") - strtotime($record['pubdate']);
$record['is_overdue'] = round($timedifference / 86400) > $record['pubdays'] && $record['pubdays'] > 0;
$record['fpubdate'] = $record['pubdate'];
$record['pubdate'] = cmsCore::dateFormat($record['pubdate']);
$record['vipdate'] = cmsCore::dateFormat($record['vipdate']);
$record['enc_city'] = urlencode($record['city']);
$record['moderator'] = $this->checkAccess($record['user_id']);
if (!$record['file'] || !file_exists(PATH . '/images/board/small/' . $record['file'])) {
$record['file'] = '';
}
if (!$record['formsdata']) {
$record['form_array'] = array();
} else {
$record['form_array'] = cmsCore::yamlToArray($record['formsdata']);
}
return cmsCore::callEvent('GET_BOARD_RECORD', $record);
}
示例10: applet_modules
//.........这里部分代码省略.........
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'));
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;
}
}
cmsCore::c('db')->query("UPDATE cms_modules SET ordering = " . $ord . " WHERE id=" . $item['id']);
$ord += 1;
$latest_pos = $item['position'];
}
}
cmsCore::redirect('index.php?view=modules');
}
if ($do == 'move_up') {
if ($id >= 0) {
dbMoveUp('cms_modules', $id, $co);
}
cmsCore::redirectBack();
}
示例11: catalog
//.........这里部分代码省略.........
$fdata = cmsCore::request('fdata', 'array', array());
$query = cmsCore::strClear(implode('%', $fdata));
$title = cmsCore::request('title', 'str', '');
$tags = cmsCore::request('tags', 'str', '');
if ($query || $title || $tags){
$findsql = "SELECT i.* , IFNULL(AVG(r.points),0) AS rating
FROM cms_uc_items i
LEFT JOIN cms_uc_ratings r ON r.item_id = i.id
WHERE i.published = 1 AND i.category_id = '$id' ";
if($query){
$findsql .= " AND i.fieldsdata LIKE '%{$query}%' ";
}
if($title){
$findsql .= " AND i.title LIKE '%$title%' ";
}
if($tags){
$findsql .= "AND (i.tags LIKE '%".$tags."%')";
}
$findsql .= " GROUP BY i.id";
$advsearch = 1;
}
$do = 'cat';
} else {
//show search form
$sql = "SELECT * FROM cms_uc_cats WHERE id = '$id'";
$result = $inDB->query($sql) ;
if ($inDB->num_rows($result)==1){
$cat = $inDB->fetch_assoc($result);
$fstruct = cmsCore::yamlToArray($cat['fieldsstruct']);
//heading
$inPage->addPathway($cat['title'], '/catalog/'.$cat['id']);
$inPage->addPathway($_LANG['SEARCH'], '/catalog/'.$cat['id'].'/search.html');
$inPage->setTitle($_LANG['SEARCH_IN_CAT']);
$inPage->addHeadJS('components/catalog/js/search.js');
$fstruct_ready = array();
foreach($fstruct as $key=>$value) {
if (mb_strstr($value, '/~h~/')) { $ftype = 'html'; $value=str_replace('/~h~/', '', $value); }
elseif (mb_strstr($value, '/~l~/')) { $ftype = 'link'; $value=str_replace('/~l~/', '', $value); } else { $ftype='text'; }
if (mb_strstr($value, '/~m~/')) {
$value = str_replace('/~m~/', '', $value);
}
$fstruct_ready[stripslashes($key)] = stripslashes($value);
}
//searchform
cmsPage::initTemplate('components', 'com_catalog_search')->
assign('id', $id)->
assign('cat', $cat)->
assign('fstruct', $fstruct_ready)->
display('com_catalog_search.tpl');
} else { cmsCore::error404(); }
}//search form
}
//////////////////////////// SEARCH BY FIRST LETTER OF TITLE ///////////////////////////////////////////////////////
if ($do == 'findfirst') {
示例12: array
$plg_config = cmsCore::c('db')->get_field('cms_plugins', "plugin='p_content_imgs'", 'config');
$plg_config = cmsCore::yamlToArray($plg_config);
if (!isset($plg_config['slider'])) {
$plg_nconfig = array(
'slider' => $plg_config['PCI_SLIDER'] .'__'. $plg_config['PCI_SLIDER_OPT']
);
$plg_nconfig = cmsCore::arrayToYaml($plg_nconfig);
cmsCore::c('db')->query("UPDATE cms_plugins SET config='". cmsCore::c('db')->escape_string($plg_nconfig) ."' WHERE plugin='p_content_imgs' LIMIT 1");
}
// ========== /p_content_imgs =========
//======================================================================
// --------------- Добавляем всем модулям настройку tpl ----------------
$results = cmsCore::c('db')->query('SELECT id, content, config FROM cms_modules WHERE is_external = 1');
while ($mod = cmsCore::c('db')->fetch_assoc($results)) {
$mod['config'] = cmsCore::yamlToArray($mod['config']);
if (empty($mod['config']['tpl'])) {
$mod['config']['tpl'] = $mod['content'];
}
$mod['config'] = cmsCore::arrayToYaml($mod['config']);
cmsCore::c('db')->update(
'cms_modules',
array(
'config' => cmsCore::c('db')->escape_string($mod['config'])
),
$mod['id']
);
}
示例13:
echo $_LANG['AD_PX'];
?>
</td>
</tr>
</table>
</div>
<?php
$groups = cmsUser::getGroups();
$style = 'disabled="disabled"';
$public = 'checked="checked"';
if (@$field) {
if ($field['show_for_group']) {
$public = '';
$style = '';
$show_for_group = cmsCore::yamlToArray($field['show_for_group']);
}
}
?>
<label><input name="is_public" type="checkbox" id="is_public" onclick="checkGroupList()" value="1" <?php
echo $public;
?>
/> Показывать всем группам</label>
<div style="margin-top:10px;padding:5px;padding-right:0px;">
<div>
<?php
echo $_LANG['AD_GROUPS_VIEW'];
?>
<br />
示例14: applet_menu
function applet_menu()
{
$inCore = cmsCore::getInstance();
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/menu', $adminAccess)) {
cpAccessDenied();
}
cmsCore::c('page')->setTitle($_LANG['AD_MENU']);
cpAddPathway($_LANG['AD_MENU'], 'index.php?view=menu');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'list') {
$toolmenu = array(array('icon' => 'new.gif', 'title' => $_LANG['AD_MENU_POINT_ADD'], 'link' => '?view=menu&do=add'), array('icon' => 'newmenu.gif', 'title' => $_LANG['AD_MENU_ADD'], 'link' => '?view=menu&do=addmenu'), array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=edit&multiple=1');"), array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=delete&multiple=1');"), array('icon' => 'show.gif', 'title' => $_LANG['AD_ALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=show&multiple=1');"), array('icon' => 'hide.gif', 'title' => $_LANG['AD_DISALLOW_SELECTED'], 'link' => "javascript:checkSel('?view=menu&do=hide&multiple=1');"), array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=help&topic=menu'));
cpToolMenu($toolmenu);
$fields = array(array('title' => 'Lt', 'field' => 'NSLeft', 'width' => '40'), array('title' => $_LANG['TITLE'], 'field' => array('title', 'titles'), 'width' => '', 'link' => '?view=menu&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['SHOW'], 'field' => 'published', 'width' => '80'), array('title' => $_LANG['AD_ORDER'], 'field' => 'ordering', 'width' => '100'), array('title' => $_LANG['AD_LINK'], 'field' => array('linktype', 'linkid', 'link'), 'width' => '240', 'prc' => 'cpMenutypeById'), array('title' => $_LANG['AD_MENU'], 'field' => 'menu', 'width' => '80', 'filter' => '10', 'filterlist' => cpGetList('menu'), 'prc' => 'list_menu'), array('title' => $_LANG['TEMPLATE'], 'field' => 'template', 'width' => '90', 'prc' => 'cpTemplateById'));
$actions = array(array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=menu&do=edit&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_MENU_POINT_CONFIRM'], 'link' => '?view=menu&do=delete&id=%id%'));
cpListTable('cms_menu', $fields, $actions, 'parent_id>0', 'NSLeft, ordering');
} else {
$toolmenu = array(array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();'), array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'index.php?view=menu'));
cpToolMenu($toolmenu);
}
if ($do == 'move_up') {
cmsCore::c('db')->moveNsCategory('cms_menu', $id, 'up');
cmsCore::redirectBack();
}
if ($do == 'move_down') {
cmsCore::c('db')->moveNsCategory('cms_menu', $id, 'down');
cmsCore::redirectBack();
}
if ($do == 'show') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) {
cmsCore::c('db')->setFlag('cms_menu', $id, 'published', '1');
}
cmsCore::halt('1');
} else {
cmsCore::c('db')->setFlags('cms_menu', $_REQUEST['item'], 'published', '1');
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirectBack();
}
}
if ($do == 'hide') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) {
cmsCore::c('db')->setFlag('cms_menu', $id, 'published', '0');
}
cmsCore::halt('1');
} else {
cmsCore::c('db')->setFlags('cms_menu', cmsCore::request('item', 'array_int', array()), 'published', '0');
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirectBack();
}
}
if ($do == 'delete') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) {
cmsCore::c('db')->deleteNS('cms_menu', (int) $id);
}
} else {
cmsCore::c('db')->deleteListNS('cms_menu', cmsCore::request('item', 'array_int', array()));
}
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
cmsCore::redirectBack();
}
if ($do == 'update') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$id = cmsCore::request('id', 'int', 0);
if (!$id) {
cmsCore::redirectBack();
}
$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);
$oldparent = cmsCore::request('oldparent', 'int', 0);
$is_lax = cmsCore::request('is_lax', 'int', 0);
$css_class = cmsCore::request('css_class', 'str', '');
$is_public = cmsCore::request('is_public', 'int', '');
if (!$is_public) {
$access_list = cmsCore::arrayToYaml(cmsCore::request('allow_group', 'array_int'));
}
$ns = $inCore->nestedSetsInit('cms_menu');
if ($oldparent != $parent_id) {
//.........这里部分代码省略.........
示例15: getUser
public function getUser($login){
if(is_numeric($login)){
$where = "u.id = '{$login}'";
} else {
$where = "u.login = '{$login}'";
}
$sql = "SELECT
u.*,
u.status as status_text,
u.rating as user_rating,
p.id as pid, p.city, p.description, p.showmail, p.showbirth, p.showicq,
p.karma, p.imageurl, p.allow_who,
p.gender as gender, p.formsdata, p.signature,
p.email_newmsg, p.cm_subscribe,
g.title as grp,
g.alias as group_alias,
b.user_id as banned,
IFNULL(ui.login, '') as inv_login,
IFNULL(ui.nickname, '') as inv_nickname
FROM cms_users u
INNER JOIN cms_user_profiles p ON p.user_id = u.id
INNER JOIN cms_user_groups g ON g.id = u.group_id
LEFT JOIN cms_banlist b ON b.user_id = u.id AND b.status = 1
LEFT JOIN cms_users ui ON ui.id = u.invited_by
WHERE u.is_locked = 0 AND {$where}
ORDER BY id DESC LIMIT 1";
$result = $this->inDB->query($sql);
if (!$this->inDB->num_rows($result)){ return false; }
$user = $this->inDB->fetch_assoc($result);
global $_LANG;
$user['avatar'] = cmsUser::getUserAvatarUrl($user['id'], 'big', $user['imageurl'], $user['is_deleted']);
$user['status_date'] = cmsCore::dateDiffNow($user['status_date']);
$user['flogdate'] = cmsUser::getOnlineStatus($user['id'], $user['logdate']);
$user['fregdate'] = cmsCore::dateFormat($user['regdate']);
$user['fbirthdate'] = cmsCore::dateFormat($user['birthdate']);
$user['cityurl'] = urlencode($user['city']);
$user['profile_link'] = HOST . cmsUser::getProfileURL($user['login']);
$user['fdescription'] = cmsPage::getMetaSearchLink('/users/hobby/', $user['description']);
$user['formsdata'] = cmsCore::yamlToArray($user['formsdata']);
if ($user['gender']) {
switch ($user['gender']){
case 'm': $user['fgender'] = $_LANG['MALES']; break;
case 'f': $user['fgender'] = $_LANG['FEMALES']; break;
default: $user['fgender'] = '';
}
}
return cmsCore::callEvent('GET_USER', $user);
}