Beispiel #1
0
 private function _getResult($res, $aid, $page)
 {
     require_once DISCUZ_ROOT . './source/function/function_home.php';
     require_once DISCUZ_ROOT . './source/function/function_portal.php';
     loadcache('portalcategory');
     global $_G;
     // 在DISCUZ_ROOT/source/module/portal/portal_view.php基础上二次开发
     if (empty($aid)) {
         return $this->makeErrorInfo($res, lang('message', 'view_no_article_id'));
     }
     $article = C::t('portal_article_title')->fetch($aid);
     require_once libfile('function/portalcp');
     $categoryperm = getallowcategory($_G['uid']);
     if (empty($article) || $article['status'] > 0 && $article['uid'] != $_G['uid'] && !$_G['group']['allowmanagearticle'] && empty($categoryperm[$article['catid']]['allowmanage']) && $_G['adminid'] != 1 && $_GET['modarticlekey'] != modauthkey($article['aid'])) {
         return $this->makeErrorInfo($res, lang('message', 'view_article_no_exist'));
     }
     // if(!empty($_G['setting']['antitheft']['allow']) && empty($_G['setting']['antitheft']['disable']['article']) && empty($_G['cache']['portalcategory'][$article['catid']]['noantitheft'])) {
     //     helper_antitheft::check($aid, 'aid');
     // }
     $res['body']['newsInfo'] = $this->_getNewsInfo($article, $page);
     return $res;
 }
Beispiel #2
0
/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: portal_view.php 33660 2013-07-29 07:51:05Z nemohou $
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
$aid = empty($_GET['aid']) ? 0 : intval($_GET['aid']);
if (empty($aid)) {
    showmessage('view_no_article_id');
}
$article = C::t('portal_article_title')->fetch($aid);
require_once libfile('function/portalcp');
$categoryperm = getallowcategory($_G['uid']);
if (empty($article) || $article['status'] > 0 && $article['uid'] != $_G['uid'] && !$_G['group']['allowmanagearticle'] && empty($categoryperm[$article['catid']]['allowmanage']) && $_G['adminid'] != 1 && $_GET['modarticlekey'] != modauthkey($article['aid'])) {
    showmessage('view_article_no_exist');
}
if (!empty($_G['setting']['antitheft']['allow']) && empty($_G['setting']['antitheft']['disable']['article']) && empty($_G['cache']['portalcategory'][$article['catid']]['noantitheft'])) {
    helper_antitheft::check($aid, 'aid');
}
if (!empty($_G['setting']['makehtml']['flag']) && $article['htmlmade'] && !isset($_G['makehtml']) && empty($_GET['diy']) && empty($article['url'])) {
    dheader('location:' . fetch_article_url($article));
}
$article_count = C::t('portal_article_count')->fetch($aid);
if ($article_count) {
    $article = array_merge($article_count, $article);
}
if ($article_count) {
    C::t('portal_article_count')->increase($aid, array('viewnum' => 1));
Beispiel #3
0
         $_time = !empty($article) ? $article['dateline'] : TIMESTAMP;
         if (file_exists(helper_makehtml::fetch_dir($portalcategory[$catid]['fullfoldername'], $_time) . $htmlname . '.' . $_G['setting']['makehtml']['extendname'])) {
             showmessage('html_existed');
         } else {
             showmessage('html_have_no_exists');
         }
     } else {
         showmessage('make_html_closed');
     }
 } else {
     if (empty($_G['cache']['portalcategory'])) {
         showmessage('portal_has_not_category');
     }
     if (!checkperm('allowmanagearticle') && !checkperm('allowpostarticle')) {
         $allowcategorycache = array();
         if ($allowcategory = getallowcategory($_G['uid'])) {
             foreach ($allowcategory as $catid => $category) {
                 $allowcategorycache[$catid] = $_G['cache']['portalcategory'][$catid];
             }
         }
         foreach ($allowcategorycache as &$_value) {
             if ($_value['upid'] && !isset($allowcategorycache[$_value['upid']])) {
                 $_value['level'] = 0;
             }
         }
         $_G['cache']['portalcategory'] = $allowcategorycache;
     }
     if (empty($_G['cache']['portalcategory'])) {
         showmessage('portal_article_add_nopermission');
     }
     $category = $_G['cache']['portalcategory'];
Beispiel #4
0
function check_articleperm($catid, $aid = 0, $article = array(), $isverify = false, $return = false)
{
    global $_G;
    if (empty($catid)) {
        if (!$return) {
            showmessage('article_category_empty');
        } else {
            return 'article_category_empty';
        }
    }
    if ($_G['group']['allowmanagearticle'] || empty($aid) && $_G['group']['allowpostarticle'] || $_GET['modarticlekey'] == modauthkey($aid)) {
        return true;
    }
    $permission = getallowcategory($_G['uid']);
    if (isset($permission[$catid])) {
        if ($permission[$catid]['allowmanage'] || empty($aid) && $permission[$catid]['allowpublish']) {
            return true;
        }
    }
    if (!$isverify && $aid && !empty($article['uid']) && $article['uid'] == $_G['uid'] && ($article['status'] == 1 && $_G['group']['allowpostarticlemod'] || empty($_G['group']['allowpostarticlemod']))) {
        return true;
    }
    if (!$return) {
        showmessage('article_edit_nopermission');
    } else {
        return 'article_edit_nopermission';
    }
}
Beispiel #5
0
/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: portal_view.php 29055 2012-03-23 09:25:15Z zhangguosheng $
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
$aid = empty($_GET['aid']) ? 0 : intval($_GET['aid']);
if (empty($aid)) {
    showmessage('view_no_article_id');
}
$article = C::t('portal_article_title')->fetch($aid);
require_once libfile('function/portalcp');
$permission = getallowcategory($_G['uid']);
if (empty($article) || $article['status'] > 0 && $article['uid'] != $_G['uid'] && !$_G['group']['allowmanagearticle'] && empty($permission[$article['catid']]['allowmanage']) && $_G['adminid'] != 1 && $_GET['modarticlekey'] != modauthkey($article['aid'])) {
    showmessage('view_article_no_exist');
}
$article_count = C::t('portal_article_count')->fetch($aid);
if ($article_count) {
    $article = array_merge($article_count, $article);
}
if ($article_count) {
    C::t('portal_article_count')->increase($aid, array('viewnum' => 1));
    unset($article_count);
} else {
    C::t('portal_article_count')->insert(array('aid' => $aid, 'catid' => $article['catid'], 'viewnum' => 1));
}
if ($article['url']) {
    dheader("location:{$article['url']}");
function check_articleperm($catid, $aid = 0)
{
    global $_G;
    if (empty($catid) && empty($aid)) {
        showmessage('article_category_empty');
    }
    if ($_G['group']['allowmanagearticle'] || empty($aid) && $_G['group']['allowpostarticle']) {
        return true;
    }
    $permission = getallowcategory($_G['uid']);
    if (isset($permission[$catid])) {
        if ($permission[$catid]['allowmanage'] || empty($aid) && $permission[$catid]['allowpublish']) {
            return true;
        }
    }
    showmessage('article_edit_nopermission');
}