Esempio n. 1
0
 function display($params)
 {
     $Log_Model = new Log_Model();
     $options_cache = Option::getAll();
     extract($options_cache);
     $page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1;
     $tag = isset($params[1]) && $params[1] == 'tag' ? addslashes(urldecode(trim($params[2]))) : '';
     $pageurl = '';
     //page meta
     $site_title = stripslashes($tag) . ' - ' . $site_title;
     $Tag_Model = new Tag_Model();
     $blogIdStr = $Tag_Model->getTagByName($tag);
     if ($blogIdStr === false) {
         show_404_page();
     }
     $sqlSegment = "and gid IN ({$blogIdStr}) order by date desc";
     $lognum = $Log_Model->getLogNum('n', $sqlSegment);
     $total_pages = ceil($lognum / $index_lognum);
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     $pageurl .= Url::tag(urlencode($tag), 'page');
     $logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum);
     $page_url = pagination($lognum, $index_lognum, $page, $pageurl);
     include View::getView('header');
     include View::getView('log_list');
 }
Esempio n. 2
0
 function display($params)
 {
     $Log_Model = new Log_Model();
     $options_cache = Option::getAll();
     extract($options_cache);
     $page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1;
     $record = isset($params[1]) && $params[1] == 'record' ? intval($params[2]) : '';
     $GLOBALS['record'] = $record;
     //for sidebar calendar
     $pageurl = '';
     //page meta
     $site_title = $record . ' - ' . $site_title;
     if (preg_match("/^([\\d]{4})([\\d]{2})\$/", $record, $match)) {
         $days = getMonthDayNum($match[2], $match[1]);
         $record_stime = emStrtotime($record . '01');
         $record_etime = $record_stime + 3600 * 24 * $days;
     } else {
         $record_stime = emStrtotime($record);
         $record_etime = $record_stime + 3600 * 24;
     }
     $sqlSegment = "and date>={$record_stime} and date<{$record_etime} order by date desc";
     $lognum = $Log_Model->getLogNum('n', $sqlSegment);
     $total_pages = ceil($lognum / $index_lognum);
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     $start_limit = ($page - 1) * $index_lognum;
     $pageurl .= Url::record($record, 'page');
     $logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum);
     $page_url = pagination($lognum, $index_lognum, $page, $pageurl);
     include View::getView('header');
     include View::getView('log_list');
 }
Esempio n. 3
0
 function display($params)
 {
     $Log_Model = new Log_Model();
     $CACHE = Cache::getInstance();
     $options_cache = Option::getAll();
     extract($options_cache);
     $page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1;
     $sortid = '';
     if (!empty($params[2])) {
         if (is_numeric($params[2])) {
             $sortid = intval($params[2]);
         } else {
             $sort_cache = $CACHE->readCache('sort');
             foreach ($sort_cache as $key => $value) {
                 $alias = addslashes(urldecode(trim($params[2])));
                 if (array_search($alias, $value, true)) {
                     $sortid = $key;
                     break;
                 }
             }
         }
     }
     $pageurl = '';
     $sort_cache = $CACHE->readCache('sort');
     if (!isset($sort_cache[$sortid])) {
         show_404_page();
     }
     $sort = $sort_cache[$sortid];
     $sortName = $sort['sortname'];
     //page meta
     $site_title = $sortName . ' - ' . $site_title;
     if (!empty($sort_cache[$sortid]['description'])) {
         $site_description = $sort_cache[$sortid]['description'];
     }
     if ($sort['pid'] != 0 || empty($sort['children'])) {
         $sqlSegment = "and sortid={$sortid}";
     } else {
         $sortids = array_merge(array($sortid), $sort['children']);
         $sqlSegment = "and sortid in (" . implode(',', $sortids) . ")";
     }
     $sqlSegment .= " order by sortop desc, date desc";
     $lognum = $Log_Model->getLogNum('n', $sqlSegment);
     $total_pages = ceil($lognum / $index_lognum);
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     $pageurl .= Url::sort($sortid, 'page');
     $logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum);
     $page_url = pagination($lognum, $index_lognum, $page, $pageurl);
     $template = !empty($sort['template']) && file_exists(TEMPLATE_PATH . $sort['template'] . '.php') ? $sort['template'] : 'log_list';
     include View::getView('header');
     include View::getView($template);
 }
Esempio n. 4
0
 function display($params)
 {
     $Log_Model = new Log_Model();
     $options_cache = Option::getAll();
     extract($options_cache);
     $page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1;
     $keyword = isset($params[1]) && $params[1] == 'keyword' ? trim($params[2]) : '';
     $keyword = addslashes(htmlspecialchars(urldecode($keyword)));
     $keyword = str_replace(array('%', '_'), array('\\%', '\\_'), $keyword);
     $pageurl = '';
     $sqlSegment = "and title like '%{$keyword}%' order by date desc";
     $lognum = $Log_Model->getLogNum('n', $sqlSegment);
     $total_pages = ceil($lognum / $index_lognum);
     if ($page > $total_pages) {
         $page = $total_pages;
     }
     $pageurl .= BLOG_URL . '?keyword=' . urlencode($keyword) . '&page=';
     $logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum);
     $page_url = pagination($lognum, $index_lognum, $page, $pageurl);
     include View::getView('header');
     include View::getView('log_list');
 }
Esempio n. 5
0
    } elseif (isset($_GET['sortDate'])) {
        $sqlSegment .= "date {$sortDate}";
    } else {
        $sqlSegment .= 'top DESC, sortop DESC, date DESC';
    }
    $hide_state = $pid ? 'y' : 'n';
    if ($pid == 'draft') {
        $hide_stae = 'y';
        $sorturl = '&pid=draft';
        $pwd = '草稿箱';
    } else {
        $hide_stae = 'n';
        $sorturl = '';
        $pwd = '文章管理';
    }
    $logNum = $Log_Model->getLogNum($hide_state, $sqlSegment, 'blog', 1);
    $logs = $Log_Model->getLogsForAdmin($sqlSegment, $hide_state, $page);
    $sorts = $CACHE->readCache('sort');
    $log_cache_tags = $CACHE->readCache('logtags');
    $tags = $Tag_Model->getTag();
    $subPage = '';
    foreach ($_GET as $key => $val) {
        $subPage .= $key != 'page' ? "&{$key}={$val}" : '';
    }
    $pageurl = pagination($logNum, Option::get('admin_perpage_num'), $page, "admin_log.php?{$subPage}&page=");
    include View::getView('header');
    require_once View::getView('admin_log');
    include View::getView('footer');
    View::output();
}
//操作文章
Esempio n. 6
0
<?php

/**
 * 页面管理
 * @copyright (c) Emlog All Rights Reserved
 */
require_once 'globals.php';
//加载页面管理页面
if ($action == '') {
    $emPage = new Log_Model();
    $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
    $pages = $emPage->getLogsForAdmin('', '', $page, 'page');
    $pageNum = $emPage->getLogNum('', '', 'page', 1);
    $pageurl = pagination($pageNum, Option::get('admin_perpage_num'), $page, "./page.php?page=");
    include View::getView('header');
    require_once View::getView('admin_page');
    include View::getView('footer');
    View::output();
}
//显示新建页面表单
if ($action == 'new') {
    include View::getView('header');
    require_once View::getView('add_page');
    include View::getView('footer');
    View::output();
}
//显示编辑页面表单
if ($action == 'mod') {
    $emPage = new Log_Model();
    $pageId = isset($_GET['id']) ? intval($_GET['id']) : '';
    $pageData = $emPage->getOneLogForAdmin($pageId);
Esempio n. 7
0
if (!empty($alias)) {
    $logalias_cache = $CACHE->readCache('logalias');
    $alias = $Log_Model->checkAlias($alias, $logalias_cache, $blogid);
}
$logData = array('title' => $title, 'alias' => $alias, 'content' => $content, 'excerpt' => $excerpt, 'author' => $author, 'sortid' => $sort, 'date' => $postTime, 'top ' => $top, 'sortop ' => $sortop, 'allow_remark' => $allow_remark, 'hide' => $ishide, 'checked' => $user_cache[UID]['ischeck'] == 'y' ? 'n' : 'y', 'password' => $password);
if ($blogid > 0) {
    //自动保存草稿后,添加变为更新
    $Log_Model->updateLog($logData, $blogid);
    $Tag_Model->updateTag($tagstring, $blogid);
    $dftnum = '';
} else {
    if (!($blogid = $Log_Model->isRepeatPost($title, $postTime))) {
        $blogid = $Log_Model->addlog($logData);
    }
    $Tag_Model->addTag($tagstring, $blogid);
    $dftnum = $Log_Model->getLogNum('y', '', 'blog', 1);
}
$CACHE->updateCache();
doAction('save_log', $blogid);
switch ($action) {
    case 'autosave':
        echo "autosave_gid:{$blogid}_df:{$dftnum}_";
        break;
    case 'add':
    case 'edit':
        $tbmsg = '';
        if ($ishide == 'y') {
            emDirect("./admin_log.php?pid=draft&active_savedraft=1");
        } else {
            if ($action == 'add' || isset($_POST['pubdf'])) {
                emDirect("./admin_log.php?active_post=1");