Exemplo n.º 1
0
 public static function checkCache()
 {
     if (CShell::caching() && ($page = self::isPageReady(PageTool::getVersion(PageTool::getPage(), CShell::pages()), CShell::target(), CShell::duration()))) {
         echo $page;
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
/**
 * Dissect the URL and route the request.
 */
function callHook()
{
    $controller = CShell::id();
    $action = 'home';
    $queryString = array();
    try {
        //Remove all get parameters
        $URI = preg_replace('/\\?(.*)/', '', $_SERVER['REQUEST_URI']);
        $urlArray = explode("/", str_replace('-', '_', $URI));
        //The first segment will always be empty
        if (count($urlArray) > 0) {
            array_shift($urlArray);
        }
        if (count($urlArray) > 0 && $urlArray[0] != '') {
            //Ignore the sub-folder if it exists.
            if (PageTool::getSubFolder() != '') {
                array_shift($urlArray);
            }
            /**
             * If an exception is triggered or the dc is set to false set the controller.
             */
            if (count($urlArray) > 0 && (in_array($urlArray[0], CShell::exceptions()) || in_array($urlArray[0], CShell::system()) || !CShell::default_controller())) {
                $controller = $urlArray[0];
                array_shift($urlArray);
            }
            //Set the action.
            if (count($urlArray) > 0) {
                //If GoLink skip assignment of action.
                if ($controller != CShell::GO) {
                    $action = $urlArray[0];
                    array_shift($urlArray);
                }
                //Set the arguments
                if (count($urlArray) > 0) {
                    $queryString = $urlArray;
                }
            }
        }
        $controllerName = $controller;
        $controller = ucwords($controller);
        $controller .= 'Controller';
        if (file_exists(ROOT . DS . 'app' . DS . 'controllers' . DS . $controller . '.php')) {
            require_once ROOT . DS . 'app' . DS . 'controllers' . DS . $controller . '.php';
        } elseif (file_exists(ROOT . DS . 'app' . DS . 'controllers' . DS . 'system' . DS . $controller . '.php')) {
            require_once ROOT . DS . 'app' . DS . 'controllers' . DS . 'system' . DS . $controller . '.php';
        }
        if (class_exists($controller) && method_exists($controller, $action)) {
            $dispatch = new $controller($controllerName, $action);
        } else {
            header('HTTP/1.0 404 Not Found');
            exit;
        }
        call_user_func_array(array($dispatch, $action), $queryString);
    } catch (Exception $e) {
        SystemTool::sendException($e->getFile(), $e->getMessage(), $e->getTraceAsString());
    }
}
Exemplo n.º 3
0
 public function listAction()
 {
     $page = Framework::getNullRequrest('page', 1);
     $pagesize = Framework::getNullRequrest('pagesize', 10);
     $goods_model = new GoodsModel();
     $list = $goods_model->getList($page, $pagesize);
     $this->view->assign('list', $list);
     $page_html = PageTool::show($page, $pagesize, $goods_model->autoTotalCount());
     $this->view->assign('page_html', $page_html);
     $this->view->display('list.tpl');
 }
Exemplo n.º 4
0
 function render($echo = true)
 {
     $this->set('ENV', ENV);
     $page = PageTool::renderPage($this->page, $this->variables);
     if ($this->cache && $echo) {
         $pageName = PageTool::getVersion(PageTool::getPage(), CShell::pages());
         $dump = ["page" => $page, "timestamp" => time()];
         apc_store($pageName, $dump);
     }
     if ($echo) {
         echo $page;
     } else {
         return $page;
     }
 }
Exemplo n.º 5
0
    }
    $fileDataOne = $row;
    $fileData[] = $fileDataOne;
}
$jilu = "共有 {$num} 条记录  当前第 {$pageval} 页,共 {$pagenum} 页";
if ($pageval == "1") {
    $pre = "##";
} else {
    $pre = $url . "?id=explore&page=" . ($pageval - 1);
}
if ($pageval == $pagenum) {
    $ne = "##";
} else {
    $ne = $url . "?id=explore&page=" . ($pageval + 1);
}
$p = new PageTool($num, $pageval, $pagesize);
$smarty->template_dir = "./../content/themes/" . $theme;
$head = '<script type="text/javascript" src="./../includes/js/jquery-1.9.1.min.js"></script>';
$jscode = $tjcode;
$smarty->assign("tit", $tit);
$smarty->assign("zzurl", $url1);
$smarty->assign("isVisitor", $isVisitor);
$smarty->assign("userinfo", $userInfo);
$smarty->assign("head", $head);
$smarty->assign("fy", $p->show());
$smarty->assign("jilu", $jilu);
$smarty->assign("pre", $pre);
$smarty->assign("ne", $ne);
$smarty->assign("filedata", $fileData);
$smarty->assign("jscode", 'Powered by <a target="_blank" href="http://yun.aoaoao.me">树洞外链</a> ' . $jscode);
$smarty->display("fileAll.html");
Exemplo n.º 6
0
$res2 = $sqltool->dbQuery($sql2);
$page2 = new PageTool($res2[0][0]);
$page2->url = "task_list.php";
$page2->sql = "select t_req.*,(select count(req_num) from t_feedback where t_feedback.req_num=t_req.req_num) fd from t_req where req_finish_engineer='{$user_name}' and req_state=4 order by req_finish_time desc";
$page2->pageNow = 1;
$page2->url_arg = "flag=2";
if ($_GET['flag'] == 2 and $_GET['pageNow']) {
    $page2->pageNow = $_GET['pageNow'];
}
$smarty->assign("done", $page2->getPageResource());
$smarty->assign("nav2", $page2->getNavigate());
$smarty->assign("totalCount2", $res2[0][0]);
//变更列表
$sql3 = " from t_req,t_req_change where t_req.req_num=t_req_change.req_num and req_engineer='{$user_name}' order by change_time desc";
$res3 = $sqltool->dbQuery("select count(*)" . $sql3);
$page3 = new PageTool($res3[0][0]);
$page3->sql = "select t_req.req_num,req_title,req_author,req_time,change_time,flag " . $sql3;
$page3->url = "task_list.php";
$page3->url_arg = "flag=3";
$page3->pageNow = 1;
if ($_GET['flag'] == 3 and $_GET['pageNow']) {
    $page3->pageNow = $_GET['pageNow'];
}
$smarty->assign("changelist", $page3->getPageResource());
$smarty->assign("nav3", $page3->getNavigate());
$smarty->assign("totalCount3", $res3[0][0]);
$flag = 1;
if ($_GET['flag']) {
    $flag = $_GET['flag'];
}
$smarty->assign("res", $res);
Exemplo n.º 7
0
  <ul style="float:right;"class="pagination">
    <li>
      <a href="<?php 
if ($pageval == "1") {
    echo "#";
} else {
    echo $url . "?page=" . ($pageval - 1);
}
?>
" aria-label="Previous">
        <span aria-hidden="true">&laquo;</span>
      </a>
    </li>
    
    <?php 
$p = new PageTool($num, $pageval, $pagesize);
echo $p->show();
?>
    
 
    <li>
      <a href="<?php 
if ($pageval == $pagenum) {
    echo "#";
} else {
    echo $url . "?page=" . ($pageval + 1);
}
?>
" aria-label="Next">
        <span aria-hidden="true">&raquo;</span>
      </a>
Exemplo n.º 8
0
require_once "../../smarty_include.php";
require_once "../../tools/SQLTool.class.php";
require_once "../../tools/PageTool.class.php";
$sqltool = new SQLTool();
$sql = "select * from t_kno where 1=1 ";
//输入搜索
$searchcontent = "";
if (isset($_GET['searchcontent']) and $_GET['searchcontent'] != "") {
    $searchcontent = $_GET['searchcontent'];
    $sql .= " and (kno_title like '%{$searchcontent}%' or kno_num like '%{$searchcontent}%' or kno_sort like '%{$searchcontent}%' or kno_keyword like '%{$searchcontent}%' or kno_content like '%{$searchcontent}%')";
}
//分类搜索
if (isset($_GET['kno_sort'])) {
    $sort = $_GET['kno_sort'];
    $sql .= " and kno_sort like '%{$sort}%' ";
}
$sql .= " and kno_state=3 order by kno_read desc";
$res = $sqltool->dbQuery($sql);
$pagetool = new PageTool(count($res));
$pagetool->url = "know_list.php";
$pagetool->sql = $sql;
$pagetool->url_arg = "searchcontent={$searchcontent}&kno_sort={$sort}";
$pageNow = 1;
if ($_GET['pageNow']) {
    $pageNow = $_GET['pageNow'];
}
$pagetool->pageNow = $pageNow;
$smarty->assign("res", $pagetool->getPageResource());
$smarty->assign("nav", $pagetool->getNavigate());
$smarty->assign("searchcontent", $searchcontent);
$smarty->display("share/know_list.html");
Exemplo n.º 9
0
 /**
  * @return null|str
  */
 public static function checkEID()
 {
     $e = null;
     if (isset($_GET["eid"])) {
         //Sanitize for base 64
         $e = base64_decode(SystemTool::sanitize($_GET["eid"], 1));
         //Sanitize for email
         $e = SystemTool::sanitize($e, 2);
         //Is it a valid email?
         if (SystemTool::validate($e)) {
             setcookie(SystemTool::getCookieName(), base64_encode($e), PageTool::getCookieLength(), CShell::cookiePath(), CShell::cookieDomain());
         } else {
             $e = null;
         }
     }
     return $e;
 }
Exemplo n.º 10
0
<?php

/**
 * Created by PhpStorm.
 * User: huzhiming
 * Date: 2015/7/1
 * Time: 17:16
 */
require_once "SQLTool.class.php";
require_once "PageTool.class.php";
$sqlTool = new SQLTool();
$res = $sqlTool->dbQuery("select count(*)from emp");
$pageTool = new PageTool($res[0][0], 2);
$pageTool->url = "./pagetest.php";
echo "用户列表:<br><br><br>";
$sql = "select *from emp ";
$pageTool->sql = $sql;
$pageNow = 1;
if ($_GET['pageNow']) {
    $pageNow = $_GET['pageNow'];
}
$res = $pageTool->getPageResource($pageNow);
for ($i = 0; $i < count($res); $i++) {
    echo $res[$i][emp_id] . "--" . $res[$i][emp_name] . "--" . $res[$i][emp_pwd] . "<br>";
}
echo "<br>";
echo $pageTool->getNavigate();
Exemplo n.º 11
0
    $sql = " and req_time>'{$start_date}' and req_time< '{$end_date}'";
}
if ($user != "") {
    $sql .= " and req_author='{$user}'";
}
if ($engineer != '') {
    $sql .= " and req_finish_engineer='{$engineer}'";
}
if ($state != 0) {
    $sql .= " and req_state={$state}";
}
if ($keyword != '') {
    $sql .= " and req_keyword='{$keyword}'";
}
$res = $sqltool->dbQuery("select count(*) from t_req where 1=1 {$sql}");
$pagetool = new PageTool($res[0][0]);
$pagetool->url = "request_inquiry.php";
$pagetool->url_arg = "options={$options}&date1={$date1}&date2={$date2}&user={$user}&engineer={$engineer}&state={$state}&keyword={$keyword}";
$pageNow = 1;
$pagetool->sql = "select t_req.*,(select count(req_num) from t_feedback where t_feedback.req_num=t_req.req_num) fd from t_req where 1=1 {$sql} order by req_time desc";
if ($_GET['pageNow']) {
    $pageNow = $_GET['pageNow'];
}
$pagetool->pageNow = $pageNow;
$req = $pagetool->getPageResource();
$list = "(";
for ($i = 0; $i < count($req); $i++) {
    if ($i == count($req) - 1) {
        $list .= "'" . $req[$i]['req_num'] . "'";
    } else {
        $list .= "'" . $req[$i]['req_num'] . "',";
Exemplo n.º 12
0
define('ACC', true);
require './include/init.php';
$cat_id = isset($_GET['cat_id']) ? $_GET['cat_id'] + 0 : 0;
$page = isset($_GET['page']) ? $_GET['page'] + 0 : 1;
if ($page < 1) {
    $page = 1;
}
$goodsModel = new GoodsModel();
$total = $goodsModel->catGoodsCount($cat_id);
// 每页取2条
$perpage = 2;
if ($page > ceil($total / $perpage)) {
    $page = 1;
}
$offset = ($page - 1) * $perpage;
$pagetool = new PageTool($total, $page, $perpage);
$pagecode = $pagetool->show();
$cat = new CatModel();
$category = $cat->find($cat_id);
if (empty($category)) {
    header('location: index.php');
    exit;
}
// 取出树状导航
$cats = $cat->select();
// 获取所有的栏目
$sort = $cat->getCatTree($cats, 0, 1);
// 取出面包屑导航
$nav = $cat->getTree($cat_id);
// 取出栏目下的商品
$goods = new GoodsModel();
 public function share_email()
 {
     //For the event iFrame.
     $cookies = PageTool::getCookies(PageTool::getPage(), CShell::pages());
     $refer = $cookies[CShell::REFER]->set && $cookies[CShell::REFER]->val == '1';
     $this->set('refer', $refer);
 }
 public function clear_all()
 {
     APCTool::clearCache();
     header("Location: " . PageTool::getSiteRoot());
     exit;
 }