本文整理汇总了PHP中cmsCore::m方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::m方法的具体用法?PHP cmsCore::m怎么用?PHP cmsCore::m使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::m方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: search_board
function search_board($query, $look) {
$sql = "SELECT f.*, f.title as title, a.title as cat, a.id as cat_id
FROM cms_board_items f
INNER JOIN cms_board_cats a ON a.id = f.category_id AND a.published = 1
WHERE MATCH(f.title, f.content) AGAINST ('". $query ."' IN BOOLEAN MODE) AND f.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' => '/board/read'. $item['id'] .'.html',
'place' => $item['cat'],
'placelink' => '/board/'. $item['cat_id'],
'description' => cmsCore::m('search')->getProposalWithSearchWord($item['content']),
'title' => $item['obtype'] .' '. $item['title'],
'imageurl' => (file_exists(PATH .'/images/board/medium/'. $item['file']) ? '/images/board/medium/'. $item['file'] : ''),
'pubdate' => $item['pubdate']
);
cmsCore::m('search')->addResult($result_array);
}
}
return;
}
示例9: rss_content
function rss_content($item_id, $cfg) {
if (!cmsCore::getInstance()->isComponentEnable('content')) { return false; }
global $_LANG;
$channel = array();
$items = array();
if ($item_id) {
$cat = cmsCore::c('db')->getNsCategory('cms_category', (int)$item_id);
if (!$cat) { return false; }
$cat = cmsCore::callEvent('GET_CONTENT_CAT', $cat);
if (!$cat['published']) { return false; }
if (!cmsCore::checkUserAccess('category', $cat['id']) ) {
return false;
}
cmsCore::m('content')->whereThisAndNestedCats($cat['NSLeft'], $cat['NSRight']);
$channel['title'] = $cat['title'] ;
$channel['description'] = $cat['description'];
$channel['link'] = HOST . cmsCore::m('content')->getCategoryURL(0, $cat['seolink']);
} else {
$channel['title'] = $_LANG['NEW_MATERIALS'];
$channel['description'] = $_LANG['LAST_ARTICLES_NEWS'];
$channel['link'] = HOST .'/content';
}
cmsCore::c('db')->where('con.showlatest = 1');
cmsCore::c('db')->orderBy('con.pubdate', 'DESC');
cmsCore::c('db')->limit($cfg['maxitems']);
$content = cmsCore::m('content')->getArticlesList();
if ($content) {
foreach($content as $con){
$con['link'] = HOST . $con['url'];
$con['comments'] = $con['link'].'#c';
$con['category'] = $con['cat_title'];
if ($con['image']) {
$con['size'] = round(filesize(PATH . $con['image']));
$con['image'] = HOST . $con['image'];
}
$items[] = $con;
}
}
return array(
'channel' => $channel,
'items' => $items
);
}
示例10: search_clubs
function search_clubs($query, $look) {
global $_LANG;
cmsCore::m('clubs');
/////// поиск по клубным блогам //////////
$sql = "SELECT con.*, cat.title cat_title, cat.id cat_id, cat.owner owner, cat.user_id, 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 = 'club'
LEFT JOIN cms_upload_images img ON img.target_id = con.id AND img.target = 'blog_post' AND img.component = 'clubs'
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('clubs')->getPostURL($item['user_id'], $item['seolink']),
'place' => ' «'. $item['cat_title'] .'»',
'placelink' => cmsCore::m('clubs')->getBlogURL($item['user_id']),
'description' => cmsCore::m('search')->getProposalWithSearchWord($item['content_html']),
'title' => $item['title'],
'imageurl' => $item['fileurl'],
'pubdate' => $item['pubdate']
);
cmsCore::m('search')->addResult($result_array);
}
}
/////// поиск по клубным фоткам //////////
$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)) {
while($item = cmsCore::c('db')->fetch_assoc($result)) {
$result_array = array(
'link' => '/clubs/photo'. $item['id'] .'.html',
'place' => $_LANG['CLUBS_PHOTOALBUM'] .' «'. $item['cat'] .'»',
'placelink' => '/clubs/photoalbum'. $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;
}
示例11: applet_arhive
function applet_arhive()
{
$inCore = cmsCore::getInstance();
global $_LANG;
cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES_ARCHIVE']);
$cfg = $inCore->loadComponentConfig('content');
$cfg_arhive = $inCore->loadComponentConfig('arhive');
cpAddPathway($_LANG['AD_ARTICLE_SITE'], 'index.php?view=tree');
cpAddPathway($_LANG['AD_ARTICLES_ARCHIVE'], 'index.php?view=arhive');
$do = cmsCore::request('do', 'str', 'list');
$id = cmsCore::request('id', 'int', -1);
if ($do == 'saveconfig') {
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
$cfg['source'] = cmsCore::request('source', 'str', '');
$inCore->saveComponentConfig('arhive', $cfg);
cmsCore::addSessionMessage($_LANG['AD_CONFIG_SAVE_SUCCESS'], 'success');
cmsCore::redirect('?view=arhive&do=config');
}
if ($do == 'config') {
$toolmenu = array(array('icon' => 'folders.gif', 'title' => $_LANG['AD_LIST_OF_ARTICLES'], 'link' => '?view=arhive'));
cpToolMenu($toolmenu);
cpAddPathway($_LANG['AD_SETTINGS'], 'index.php?view=arhive&do=config');
cmsCore::c('page')->initTemplate('applets', 'arhive')->assign('cfg_arhive', $cfg_arhive)->display();
}
if ($do == 'list') {
$toolmenu = array(array('icon' => 'config.gif', 'title' => $_LANG['AD_SETTINGS'], 'link' => '?view=arhive&do=config'), array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=arhive&do=delete&multiple=1');"));
cpToolMenu($toolmenu);
//TABLE COLUMNS
$fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['AD_CREATE'], 'field' => 'pubdate', 'width' => '80', 'filter' => 15, 'fdate' => '%d/%m/%Y'), array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=content&do=edit&id=%id%', 'filter' => 15), array('title' => $_LANG['AD_PARTITION'], 'field' => 'category_id', 'width' => '150', 'filter' => 1, 'prc' => 'cpCatById', 'filterlist' => cpGetList('cms_category')));
//ACTIONS
$actions = array(array('title' => $_LANG['AD_TO_ARTICLES_CATALOG'], 'icon' => 'arhive_off.gif', 'link' => '?view=arhive&do=arhive_off&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'link' => '?view=content&do=delete&id=%id%', 'confirm' => $_LANG['AD_DELETE_MATERIALS']));
//Print table
cpListTable('cms_content', $fields, $actions, 'is_arhive=1');
}
if ($do == 'arhive_off') {
if (cmsCore::inRequest('id')) {
cmsCore::c('db')->setFlag('cms_content', $id, 'is_arhive', '0');
cmsCore::redirect('?view=arhive');
}
}
if ($do == 'delete') {
if (!cmsCore::inRequest('item')) {
if ($id >= 0) {
cmsCore::m('content')->deleteArticle($id, $cfg['af_delete']);
}
} else {
cmsCore::m('content')->deleteArticles(cmsCore::request('item', 'array_int'), $cfg['af_delete']);
}
cmsCore::redirect('?view=arhive');
}
}
示例12: mod_forum
function mod_forum($mod, $cfg) {
$cfg = array_merge(array(
'shownum' => 4,
'cat_id' => 0,
'forum_id' => 0,
'subs' => 0,
'show_hidden' => 0,
'show_pinned' => 0,
'showtext' => 1,
'showforum' => 0,
'order' => 'pubdate'
), $cfg);
cmsCore::c('db')->addJoin('INNER JOIN cms_forums f ON f.id = t.forum_id');
cmsCore::c('db')->addSelect('f.title as forum_title');
if ($cfg['cat_id']) {
cmsCore::m('forum')->whereForumCatIs($cfg['cat_id']);
}
if ($cfg['forum_id']) {
if ($cfg['subs']) {
$forum = cmsCore::m('forum')->getForum($cfg['forum_id']);
if (!$forum) { return false; }
cmsCore::m('forum')->whereThisAndNestedForum($forum['NSLeft'], $forum['NSRight']);
} else {
cmsCore::m('forum')->whereForumIs($cfg['forum_id']);
}
}
if (!$cfg['show_hidden']) {
cmsCore::m('forum')->wherePublicThreads();
}
if ($cfg['show_pinned']) {
cmsCore::m('forum')->wherePinnedThreads();
}
cmsCore::c('db')->orderBy('t.'.$cfg['order'], 'DESC');
cmsCore::c('db')->limit($cfg['shownum']);
$threads = cmsCore::m('forum')->getThreads();
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('threads', $threads)->
assign('cfg', $cfg)->
display();
return true;
}
示例13: applet_tree
function applet_tree()
{
$inCore = cmsCore::getInstance();
cmsCore::loadLib('tags');
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/content', $adminAccess)) {
cpAccessDenied();
}
cmsCore::c('page')->setTitle($_LANG['AD_ARTICLES']);
cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
cmsCore::c('page')->addHeadJS('admin/js/content.js');
echo '<script>';
echo cmsPage::getLangJS('AD_NO_SELECTED_ARTICLES');
echo cmsPage::getLangJS('AD_DELETE_SELECTED_ARTICLES');
echo cmsPage::getLangJS('AD_PIECES');
echo cmsPage::getLangJS('AD_CATEGORY_DELETE');
echo cmsPage::getLangJS('AD_AND_SUB_CATS');
echo cmsPage::getLangJS('AD_DELETE_SUB_ARTICLES');
echo '</script>';
$do = cmsCore::request('do', 'str', 'tree');
if ($do == 'tree') {
$toolmenu = array(array('icon' => 'config.gif', 'title' => $_LANG['AD_SETUP_CATEGORY'], 'link' => '?view=components&do=config&link=content'), array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=components&do=config&link=content'));
cpToolMenu($toolmenu);
$only_hidden = cmsCore::request('only_hidden', 'int', 0);
$category_id = cmsCore::request('cat_id', 'int', 0);
$base_uri = 'index.php?view=tree';
$title_part = cmsCore::request('title', 'str', '');
$def_order = $category_id ? 'con.ordering' : 'pubdate';
$orderby = cmsCore::request('orderby', 'str', $def_order);
$orderto = cmsCore::request('orderto', 'str', 'asc');
$page = cmsCore::request('page', 'int', 1);
$perpage = 20;
if ($category_id) {
cmsCore::m('content')->whereCatIs($category_id);
}
if ($title_part) {
cmsCore::c('db')->where('LOWER(con.title) LIKE \'%' . mb_strtolower($title_part) . '%\'');
}
if ($only_hidden) {
cmsCore::c('db')->where('con.published = 0');
}
cmsCore::c('db')->orderBy($orderby, $orderto);
cmsCore::c('db')->limitPage($page, $perpage);
$total = cmsCore::m('content')->getArticlesCount(false);
cmsCore::c('page')->initTemplate('applets', 'tree')->assign('hide_cats', cmsCore::request('hide_cats', 'int', 0))->assign('only_hidden', $only_hidden)->assign('base_uri', $base_uri)->assign('category_id', $category_id)->assign('cats', cmsCore::m('content')->getCatsTree())->assign('orderto', $orderto)->assign('orderby', $orderby)->assign('title_part', $title_part)->assign('category_opt', $inCore->getListItemsNS('cms_category', $category_id))->assign('page', $page)->assign('total', $total)->assign('perpage', $perpage)->assign('pages', ceil($total / $perpage))->assign('items', cmsCore::m('content')->getArticlesList(false))->display();
}
}
示例14: banners
function banners(){
$inCore = cmsCore::getInstance();
$banner_id = cmsCore::request('id', 'int', 0);
//======================================================================================================================//
if ($inCore->do == 'view'){
$banner = cmsCore::m('banners')->getBanner($banner_id);
if(!$banner || !$banner['published']) { cmsCore::error404(); }
cmsCore::m('banners')->clickBanner($banner_id);
cmsCore::redirect($banner['link']);
}
}
示例15: mod_blogs
function mod_blogs($mod, $cfg) {
$cfg = array_merge(
array(
'sort' => 'pubdate',
'owner' => 'user',
'shownum' => 5,
'minrate' => 0,
'blog_id' => 0,
'showrss' => 1
),
$cfg
);
cmsCore::c('blog')->owner = $cfg['owner'];
if ($cfg['owner'] == 'club') {
cmsCore::c('db')->addSelect('b.user_id as bloglink');
}
// получаем аватары владельцев
cmsCore::c('db')->addSelect('up.imageurl, img.fileurl');
cmsCore::c('db')->addJoin('LEFT JOIN cms_user_profiles up ON up.user_id = u.id');
cmsCore::c('db')->addJoin("LEFT JOIN cms_upload_images img ON img.target_id = p.id AND img.target = 'blog_post' AND img.component = 'blogs'");
cmsCore::c('blog')->whereOnlyPublic();
if ($cfg['minrate']) {
cmsCore::c('blog')->ratingGreaterThan($cfg['minrate']);
}
if ($cfg['blog_id']) {
cmsCore::c('blog')->whereBlogIs($cfg['blog_id']);
}
cmsCore::c('db')->orderBy('p.'.$cfg['sort'], 'DESC')->groupBy('p.id');
cmsCore::c('db')->limit($cfg['shownum']);
$posts = cmsCore::c('blog')->getPosts(false, cmsCore::m( $cfg['owner'] == 'club' ? 'clubs' : 'blogs' ));
if (!$posts) { return false; }
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('posts', $posts)->
assign('cfg', $cfg)->
display();
return true;
}