本文整理汇总了PHP中cmsCore::c方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::c方法的具体用法?PHP cmsCore::c怎么用?PHP cmsCore::c使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::c方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applet_robots
function applet_robots()
{
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/robots', $adminAccess)) {
cpAccessDenied();
}
cmsCore::c('page')->setTitle($_LANG['ROBOTS_TITLE']);
cpAddPathway($_LANG['ROBOTS_TITLE']);
$do = cmsCore::request('do', array('edit', 'save'), 'edit');
if (!file_exists(PATH . '/robots.txt')) {
$fp = fopen(PATH . '/robots.txt', 'w');
fwrite($fp, str_replace(array('%domen%', '%host%'), array(str_replace(array('https://', 'http://'), '', cmsCore::c('config')->host), cmsCore::c('config')->host), file_get_contents(PATH . '/includes/default_robots.txt')));
fclose($fp);
chmod(PATH . '/robots.txt', 0777);
}
if ($do == 'save') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$data = cmsCore::request('robots', 'str');
$fp = fopen(PATH . '/robots.txt', 'w');
fwrite($fp, stripcslashes($data) . "\n");
fclose($fp);
}
$robots = file_get_contents(PATH . '/robots.txt');
cmsCore::c('page')->initTemplate('applets', 'robots')->assign('robots', $robots)->display();
}
示例2: search_content
function search_content($query, $look) {
global $_LANG;
$sql = "SELECT con.*, cat.title cat_title, cat.id cat_id, cat.seolink as cat_seolink, cat.parent_id as cat_parent_id
FROM cms_content con
INNER JOIN cms_category cat ON cat.id = con.category_id AND cat.published = 1
WHERE MATCH(con.title, con.content) AGAINST ('". $query ."' IN BOOLEAN MODE) AND con.is_end = 0 AND con.published = 1 LIMIT 100";
$result = cmsCore::c('db')->query($sql);
if (cmsCore::c('db')->num_rows($result)) {
cmsCore::loadLanguage('components/content');
while ($item = cmsCore::c('db')->fetch_assoc($result)) {
$result_array = array(
'link' => '/'. $item['seolink'] .'.html',
'place' => $_LANG['CATALOG_ARTICLES'],
'placelink' => '/'. ($item['cat_parent_id']>0 ? $item['cat_seolink'] : $item['seolink'] .'.html'),
'description' => cmsCore::m('search')->getProposalWithSearchWord($item['content']),
'title' => $item['title'],
'imageurl' => (file_exists(PATH .'/images/content/medium/'. ceil($item['id']/100) .'/article'. $item['id' ] .'.jpg') ? '/images/content/medium/'. ceil($item['id']/100) .'/article'. $item['id' ] .'.jpg' : ''),
'pubdate' => $item['pubdate']
);
cmsCore::m('search')->addResult($result_array);
}
}
return;
}
示例3: search_photos
function search_photos($query, $look) {
$sql = "SELECT f.*, a.title as cat, a.id as cat_id
FROM cms_photo_files f
INNER JOIN cms_photo_albums a ON a.id = f.album_id AND a.published = 1 AND a.NSDiffer = ''
WHERE MATCH(f.title, f.description) AGAINST ('". $query ."' IN BOOLEAN MODE) AND f.published = 1";
$result = cmsCore::c('db')->query($sql);
if (cmsCore::c('db')->num_rows($result)) {
global $_LANG;
cmsCore::loadLanguage('components/photos');
while ($item = cmsCore::c('db')->fetch_assoc($result)) {
$result_array = array(
'link' => '/photos/photo'. $item['id'] .'.html',
'place' => $_LANG['PHOTOALBUM'] .' «'. $item['cat'] .'»',
'placelink' => '/photos/'. $item['cat_id'],
'description' => cmsCore::m('search')->getProposalWithSearchWord($item['description']),
'title' => $item['title'],
'imageurl' => (file_exists(PATH .'/images/photos/medium/'. $item['file']) ? '/images/photos/medium/'. $item['file'] : ''),
'pubdate' => $item['pubdate']
);
cmsCore::m('search')->addResult($result_array);
}
}
return;
}
示例4: mod_actions
function mod_actions($mod, $cfg) {
global $_LANG;
if (!isset($cfg['action_types'])) {
echo $_LANG['MODULE_NOT_CONFIGURED'];
return true;
}
$cfg = array_merge(
array(
'show_target' => 1,
'limit' => 15,
'show_link' => 1
),
$cfg
);
if (!$cfg['show_target']) {
cmsCore::c('actions')->showTargets(false);
}
cmsCore::c('actions')->onlySelectedTypes($cfg['action_types']);
cmsCore::c('db')->limitIs($cfg['limit']);
$actions = cmsCore::c('actions')->getActionsLog();
if (!$actions) { return false; }
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('actions', $actions)->
assign('cfg', $cfg)->
assign('user_id', cmsCore::c('user')->id)->
display();
return true;
}
示例5: mod_category
function mod_category($mod, $cfg) {
$cfg = array_merge(
array(
'category_id' => 0,
'show_subcats' => 1,
'expand_all' => 1
),
$cfg
);
$rootcat = cmsCore::c('db')->getNsCategory('cms_category', $cfg['category_id']);
if (!$rootcat) { return false; }
$subcats_list = cmsCore::m('content')->getSubCats($rootcat['id'], $cfg['show_subcats'], $rootcat['NSLeft'], $rootcat['NSRight']);
if (!$subcats_list) { return false; }
$current_seolink = urldecode(cmsCore::request('seolink', 'str', ''));
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('cfg', $cfg)->
assign('current_seolink', $current_seolink)->
assign('subcats_list', $subcats_list)->
display();
return true;
}
示例6: search_catalog
function search_catalog($query, $look) {
$sql = "SELECT i.*, c.title as cat, c.id as cat_id
FROM cms_uc_items i
INNER JOIN cms_uc_cats c ON c.id = i.category_id AND c.published = 1
WHERE MATCH(i.title, i.fieldsdata) AGAINST ('". $query ."' IN BOOLEAN MODE) AND i.published = 1 LIMIT 100";
$result = cmsCore::c('db')->query($sql);
if (cmsCore::c('db')->num_rows($result)) {
while($item = cmsCore::c('db')->fetch_assoc($result)) {
$result_array = array(
'link' => '/catalog/item'. $item['id'] .'.html',
'place' => $item['cat'],
'placelink' => '/catalog/'. $item['cat_id'],
'title' => $item['title'],
'imageurl' => (file_exists(PATH .'/images/catalog/medium/'. $item['imageurl']) ? '/images/catalog/medium/'. $item['imageurl'] : ''),
'pubdate' => $item['pubdate']
);
cmsCore::m('search')->addResult($result_array);
}
}
return;
}
示例7: parseHide
private function parseHide($text, $hidden = false) {
global $_LANG;
$pattern = '/\[hide(?:=?)([0-9]*)\](.*?)\[\/hide\]/sui';
preg_match($pattern, $text, $matches);
if (!$matches) { return $text; }
if ($hidden) {
$replacement = '<noindex>'. $_LANG['P_HIDE_TEXT_MOD'] .'</noindex>';
} else if (!cmsCore::c('user')->id) {
$replacement = '<noindex><div class="bb_tag_hide">'. $_LANG['P_HIDE_TEXT'] .'</div></noindex>';
} else {
if (!$matches[1]) {
$replacement = '<div class="bb_tag_hide">${2}</div>';
} else if (cmsCore::c('user')->rating > $matches[1] || cmsCore::c('user')->is_admin) {
$replacement = '<div class="bb_tag_hide">${2}</div>';
} else {
$replacement = '<div class="bb_tag_hide">'.sprintf($_LANG['P_HIDE_TEXT_RATING'], cmsCore::spellCount($matches[1], $_LANG['P_ITEM1'], $_LANG['P_ITEM2'], $_LANG['P_ITEM10'])).'</div>';
}
}
return preg_replace($pattern, $replacement, $text);
}
示例8: mod_clubs
function mod_clubs($mod, $cfg) {
$cfg = array_merge(array(
'count' => 5,
'type' => 'id',
'vip_on_top' => 1
), $cfg);
if ($cfg['vip_on_top']) {
cmsCore::c('db')->orderBy('is_vip', 'DESC, c.'. $cfg['type'] .' DESC');
} else {
cmsCore::c('db')->orderBy('c.'. $cfg['type'], 'DESC');
}
cmsCore::c('db')->limit($cfg['count']);
$clubs = cmsCore::m('clubs')->getClubs();
if (!$clubs) { return false; }
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('clubs', $clubs)->
display();
return true;
}
示例9: mod_user_image
function mod_user_image($mod, $cfg) {
$sql = "SELECT u.id uid, u.nickname author, u.login as login, p.imageurl, p.title, p.id, pr.gender gender
FROM cms_user_photos p
LEFT JOIN cms_users u ON u.id = p.user_id
LEFT JOIN cms_user_profiles pr ON pr.user_id = u.id
LEFT JOIN cms_user_albums a ON a.id = p.album_id
WHERE p.allow_who = 'all' AND u.is_deleted = 0 AND u.is_locked = 0
AND p.album_id > 0 AND a.allow_who = 'all'
ORDER BY RAND()
LIMIT 1";
$result = cmsCore::c('db')->query($sql) ;
if (!cmsCore::c('db')->num_rows($result)) { return false; }
while ($usr = cmsCore::c('db')->fetch_assoc($result)) {
$usr['genderlink'] = cmsUser::getGenderLink($usr['uid'], $usr['author'], $usr['gender'], $usr['login']);
$users[] = $usr;
}
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('users', $users)->
assign('cfg', $cfg)->
display();
return true;
}
示例10: applet_noaccess
function applet_noaccess()
{
global $_LANG;
cmsCore::c('page')->setTitle($_LANG['ACCESS_DENIED']);
cpAddPathway($_LANG['ACCESS_DENIED'], 'index.php?view=noaccess');
cmsCore::c('page')->initTemplate('applets', 'noaccess')->display();
}
示例11: search_faq
function search_faq($query, $look) {
global $_LANG;
$sql = "SELECT con.*, cat.title cat_title, cat.id cat_id
FROM cms_faq_quests con
INNER JOIN cms_faq_cats cat ON cat.id = con.category_id AND cat.published = 1
WHERE MATCH(con.quest, con.answer) AGAINST ('". $query ."' IN BOOLEAN MODE) AND con.published = 1 LIMIT 100";
$result = cmsCore::c('db')->query($sql);
if (cmsCore::c('db')->num_rows($result)) {
cmsCore::loadLanguage('components/faq');
while($item = cmsCore::c('db')->fetch_assoc($result)) {
$result_array = array(
'link' => '/faq/quest'. $item['id'] .'.html',
'place' => $_LANG['FAQ'] .' → '. $item['cat_title'],
'placelink' => '/faq/'. $item['cat_id'],
'description' => cmsCore::m('search')->getProposalWithSearchWord($item['answer']),
'title' => mb_substr($item['quest'], 0, 70) .'...',
'pubdate' => $item['pubdate']
);
cmsCore::m('search')->addResult($result_array);
}
}
return;
}
示例12: moveField
function moveField($id, $form_id, $dir) {
$sign = $dir > 0 ? '+' : '-';
$current = cmsCore::c('db')->get_field('cms_form_fields', "id='". $id ."'", 'ordering');
if ($current === false) { return false; }
if ($dir > 0) {
$sql = "UPDATE cms_form_fields
SET ordering = ordering-1
WHERE form_id='". $form_id ."' AND ordering = (". $current ."+1)
LIMIT 1";
cmsCore::c('db')->query($sql);
}
if ($dir < 0) {
if ($current == 1) { return false; }
$sql = "UPDATE cms_form_fields
SET ordering = ordering+1
WHERE form_id='". $form_id ."' AND ordering = (". $current ."-1)
LIMIT 1";
cmsCore::c('db')->query($sql);
}
$sql = "UPDATE cms_form_fields
SET ordering = ordering ". $sign ." 1
WHERE id='". $id ."'";
cmsCore::c('db')->query($sql);
return true;
}
示例13: applet_filters
function applet_filters() {
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/plugins', $adminAccess)) { cpAccessDenied(); }
if (!cmsUser::isAdminCan('admin/filters', $adminAccess)) { cpAccessDenied(); }
cmsCore::c('page')->setTitle($_LANG['AD_FILTERS']);
cpAddPathway($_LANG['AD_FILTERS'], 'index.php?view=filters');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'hide') {
cmsCore::c('db')->setFlag('cms_filters', $id, 'published', '0');
cmsCore::halt('1');
}
if ($do == 'show') {
cmsCore::c('db')->setFlag('cms_filters', $id, 'published', '1');
cmsCore::halt('1');
}
if ($do == 'list') {
$fields = array(
array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
array( 'title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '250' ),
array( 'title' => $_LANG['DESCRIPTION'], 'field' => 'description', 'width' => '' ),
array( 'title' => $_LANG['AD_ENABLE'], 'field' => 'published', 'width' => '100' )
);
cpListTable('cms_filters', $fields, array());
}
}
示例14: eventGetArticle
private function eventGetArticle($item) {
global $_LANG;
$item_id = $item['id'];
$tag_arr = explode(', ', cmsTagLine('content', $item_id, false));
$id_target = array();
// Получаем id назначения таких же тегов, не более пяти на каждый
foreach ($tag_arr as $tag) {
$sql = "SELECT item_id FROM cms_tags WHERE tag = '$tag' AND item_id<>'$item_id' AND target='content' LIMIT 5";
$rs = cmsCore::c('db')->query($sql) ;
if (cmsCore::c('db')->num_rows($rs)) {
while ($tagitem = cmsCore::c('db')->fetch_assoc($rs)) {
$id_target[]= $tagitem['item_id'];
}
}
}
if (count($id_target)) {
$id_target = array_unique($id_target);
$id_target = array_slice($id_target, 0, $this->config['P_LIMIT']);
if ($this->config['P_UNSORT']) { shuffle($id_target); }
$morecontent = '';
foreach ($id_target as $n) {
$con = cmsTagItemLink('content', $n);
if ($con) {
$morecontent .= '<p>'. $con ."</p>";
}
}
if ($morecontent) { $item['content'] .= '<h4>'. $_LANG['P_SIMILAR_ARTICLES'] .':</h4>'. $morecontent; }
}
return $item;
}
示例15: search_blogs
function search_blogs($query, $look) {
global $_LANG;
$sql = "SELECT con.*, cat.title cat_title, cat.id cat_id, cat.owner owner, cat.user_id user_id, cat.seolink as bloglink, img.fileurl
FROM cms_blog_posts con
INNER JOIN cms_blogs cat ON cat.id = con.blog_id AND cat.allow_who = 'all' AND cat.owner = 'user'
LEFT JOIN cms_upload_images img ON img.target_id = con.id AND img.target = 'blog_post' AND img.component = 'blogs'
WHERE MATCH(con.title, con.content) AGAINST ('". $query ."' IN BOOLEAN MODE) AND con.published = 1 LIMIT 100";
$result = cmsCore::c('db')->query($sql);
if (cmsCore::c('db')->num_rows($result)) {
while($item = cmsCore::c('db')->fetch_assoc($result)) {
$result_array = array(
'link' => cmsCore::m('blogs')->getPostURL($item['bloglink'], $item['seolink']),
'place' => $_LANG['BLOG'].' «'.$item['cat_title'].'»',
'placelink' => cmsCore::m('blogs')->getBlogURL($item['bloglink']),
'description' => cmsCore::m('search')->getProposalWithSearchWord($item['content_html']),
'title' => $item['title'],
'imageurl' => $item['fileurl'],
'pubdate' => $item['pubdate']
);
cmsCore::m('search')->addResult($result_array);
}
}
return;
}