Inheritance: extends Action
示例#1
0
 public function init()
 {
     $this->assign('css', array('category/common.css', 'footer.css'));
     parent::init();
     if (isset(self::$REQUEST['type']) && self::$REQUEST['type'] >= 1) {
         self::$CATEGORY = CategoryNamespace::getCategoryById(self::$REQUEST['type']);
         $this->assign('category', self::$CATEGORY);
     }
 }
示例#2
0
 public function defaultAction()
 {
     self::$TYPE = (int) HttpNamespace::getGET('type', 1);
     if (empty(self::$CATEGORY) || empty(self::$PUID)) {
         $this->_error();
     }
     self::$ARTICLE = DetailNamespace::getArticle(self::$CATEGORY, self::$PUID);
     if (empty(self::$ARTICLE)) {
         $this->_error();
     }
     self::$ARTICLE['title'] = self::$ARTICLE['title'] . ' > ' . self::$ARTICLE['author'] . ' - 大头狗日记';
     self::$URL = 'http://datougou.cn' . UrlNamespace::detailUrl(self::$MAJORY['id'], self::$PUID);
     $this->_bulidUrl();
     DetailNamespace::increaseShareTimes(self::$CATEGORY, self::$PUID);
     HttpNamespace::redirect($this->_getUrl());
 }
示例#3
0
 public function defaultAction()
 {
     if (empty(self::$PUID)) {
         $this->_error();
     }
     self::$ARTICLE = DetailNamespace::getArticle(self::$PUID);
     if (empty(self::$ARTICLE)) {
         $this->_error();
     }
     //是否是日记类型
     if (self::$CATEGORY['table'] == 'article_diarybook') {
         $result['diary'] = true;
     }
     //
     $code = self::getErrorCode();
     $result['error'] = isset(ErrorConfig::$COMMENT[$code]) ? ErrorConfig::$COMMENT[$code] : null;
     //内容
     $result['title'] = self::$ARTICLE['title'];
     $result['article'] = self::$ARTICLE;
     //评论
     $result['comment'] = DetailNamespace::getComment(self::$CATEGORY, self::$PUID);
     //增加阅读次数
     DetailNamespace::increaseReadTimes(self::$PUID);
     //顶部ad
     $result['ad_top'] = $this->_getAdTop();
     //上面 下面 右侧的image
     $result['image'] = $this->_getImageTop();
     //面包屑
     $result['bread'] = $this->_setBread();
     //上一篇 下一篇
     $result['near'] = $this->_getNearArticle();
     //相关文章
     $result['related'] = $this->_getRelatedArticle();
     //全网热点
     $result['all_hot'] = IndexPageConfig::$TOP_ARTICLE;
     //频道热点
     $result['hot'] = CommonNamespace::getHotArticle(self::$CATEGORY['id'], self::$MAJORY['id'], 5);
     //频道最新
     $result['new'] = CommonNamespace::getNewArticle(self::$CATEGORY['id'], self::$MAJORY['id'], 5);
     $this->assign($result);
     $this->display();
 }
示例#4
0
 function index()
 {
     $info = array('操作系统' => PHP_OS, '运行环境' => $_SERVER["SERVER_SOFTWARE"], 'PHP运行方式' => php_sapi_name(), '版本' => C('SYSTEM_NAME') . C('SYSTEM_VAR') . ' [ <a href="http://soputrade.googlecode.com" target="_blank">查看最新版本</a> ]', '上传附件限制' => ini_get('upload_max_filesize'), '执行时间限制' => ini_get('max_execution_time') . '秒', '服务器时间' => date("Y年n月j日 H:i:s"), '北京时间' => gmdate("Y年n月j日 H:i:s", time() + 8 * 3600), '服务器域名/IP' => $_SERVER['SERVER_NAME'] . ' [ ' . gethostbyname($_SERVER['SERVER_NAME']) . ' ]', '剩余空间' => round(@disk_free_space(".") / (1024 * 1024), 2) . 'M', 'register_globals' => get_cfg_var("register_globals") == "1" ? "ON" : "OFF", 'magic_quotes_gpc' => 1 === get_magic_quotes_gpc() ? 'YES' : 'NO', 'magic_quotes_runtime' => 1 === get_magic_quotes_runtime() ? 'YES' : 'NO');
     $this->info = $info;
     $day = mktime(0, 0, 0, date('m'), 0, date('Y'));
     //今天
     $week = mktime(0, 0, 0, date("m"), date("d") - date("w") + 1, date("Y"));
     //本周
     $month = mktime(0, 0, 0, date("m"), 1, date("Y"));
     //本月
     //产品类别
     $this->product_count = self::$Model = D('Products')->count();
     self::$Model = D('Cate');
     $this->cate_count = self::$Model->count();
     //新增留言
     self::$Model = D('Products_ask');
     $this->ask_count = self::$Model->where("`dateline`>'{$day}'")->count();
     $this->week_ask_count = self::$Model->where("`dateline`>'{$week}'")->count();
     $this->month_ask_count = self::$Model->where("`dateline`>'{$month}'")->count();
     //新增购物车
     self::$Model = D('Cart');
     $this->cart_count = self::$Model->where("`dateline`>'{$day}'")->count();
     //新增会员
     self::$Model = D('Members');
     $this->member_count = self::$Model->where("`createdate`>'" . $day . "'")->count();
     $this->week_member_count = self::$Model->where("`createdate`>'" . $week . "'")->count();
     $this->month_member_count = self::$Model->where("`createdate`>'" . $month . "'")->count();
     $this->member_last_login_count = self::$Model->where("`lastlogindate`>'" . $day . "'")->count();
     //新增订单
     self::$Model = D('Orders');
     $this->week_order_count = self::$Model->where("`dateline`>'{$week}'")->count();
     $this->month_order_count = self::$Model->where("`dateline`>'{$month}'")->count();
     $this->order_count = self::$Model->where("`dateline`>'{$day}'")->count();
     $this->orders_status1 = self::$Model->where("`dateline`>'{$day}' and orders_status=1")->count();
     $this->orders_status2 = self::$Model->where("`dateline`>'{$day}' and orders_status=2")->count();
     $this->display();
 }
 function ConfirmOrders()
 {
     $id = $_GET['id'];
     $data['orders_status'] = 4;
     self::$Model = D("Orders");
     self::$Model->where("id=" . $id)->save($data);
     $this->success(L("DO_OK"));
 }
示例#6
0
 public function index()
 {
     //transfer start
     $data = M('Member_card_create');
     $cardByToken = M('Member_card_set')->where(array('token' => $this->token))->order('id ASC')->find();
     $data->where('token=\'' . $this->token . '\' AND cardid=0')->save(array('cardid' => $cardByToken['id']));
     M('Member_card_exchange')->where('token=\'' . $this->token . '\' AND cardid=0')->save(array('cardid' => $cardByToken['id']));
     M('Member_card_coupon')->where('token=\'' . $this->token . '\' AND cardid=0')->save(array('cardid' => $cardByToken['id']));
     M('Member_card_vip')->where('token=\'' . $this->token . '\' AND cardid=0')->save(array('cardid' => $cardByToken['id']));
     M('Member_card_integral')->where('token=\'' . $this->token . '\' AND cardid=0')->save(array('cardid' => $cardByToken['id']));
     //transfer end
     $member_create_db = M('Member_card_create');
     //
     $cards = $member_create_db->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id))->select();
     $cardsByID = array();
     if ($cards) {
         foreach ($cards as $c) {
             $cardsByID[$c['cardid']] = $c;
         }
     }
     $cardsCount = count($cards);
     $this->assign('cards', $cards);
     $this->assign('memberCard', $cards[0]);
     if ($cardsCount && isset($_GET['mycard'])) {
         echo '<script>location.href="/index.php?g=Wap&m=Card&a=card&wecha_id=' . $this->wecha_id . '&token=' . $this->token . '&cardid=' . $cards[0]['cardid'] . '";</script>';
     }
     $this->assign('cardsCount', $cardsCount);
     //
     $userinfo_db = M('Userinfo');
     $userInfos = $userinfo_db->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id))->select();
     $userScore = 0;
     if ($userInfos) {
         $userScore = intval($userInfos[0]['total_score']);
     }
     $this->assign('userScore', $userScore);
     //
     $member_card_set_db = M('Member_card_set');
     $allCards = $member_card_set_db->where(array('token' => $this->token))->order('miniscore ASC')->select();
     if ($allCards) {
         $i = 0;
         foreach ($allCards as $c) {
             $allCards[$i]['applied'] = $cardsByID[$c['id']] ? 1 : 0;
             if (isset($_GET['mycard']) && !$allCards[$i]['applied']) {
                 unset($allCards[$i]);
             }
             $i++;
         }
     }
     $allCardsCount = count($allCards);
     $this->assign('allCards', $allCards);
     $this->assign('allCardsCount', $allCardsCount);
     //
     $thisCompany = M('Company')->where(array('token' => $this->token, 'isbranch' => 0, 'display' => 1))->find();
     $this->assign('thisCompany', $thisCompany);
     //
     $infoType = 'memberCardHome';
     if (isset($_GET['mycard'])) {
         $infoType = 'myCard';
     }
     $focus = M('Member_card_focus')->where(array('token' => $this->_get('token')))->select();
     if ($focus == NULL) {
         $focus = array(array("info" => "广告位描述", "img" => "/tpl/static/attachment/focus/tour/4.jpg", "url" => ""), array("info" => "广告位描述", "img" => "/tpl/static/attachment/focus/tour/3.jpg", "url" => ""));
     }
     $IndexModel = new IndexAction();
     $focus = $IndexModel->convertLinks($focus);
     $this->assign('flash', $focus);
     $this->assign('infoType', $infoType);
     //
     $this->display();
 }
示例#7
0
<?php

require dirname(__FILE__) . '/init.inc.php';
global $_tpl;
$_index = new IndexAction($_tpl);
$_index->_action();
$_tpl->display('index.tpl');
示例#8
0
 function execute(&$controller, &$request, &$user)
 {
     $modules = array();
     $configs = array();
     $loggers = array();
     $defines = array();
     foreach (get_defined_constants() as $key => $value) {
         $defines[$value] = $key;
     }
     // Configuration
     $configs['BASE_DIR'] = BASE_DIR;
     $configs['LOG_DIR'] = LOG_DIR;
     $configs['MOJAVI_FILE'] = MOJAVI_FILE;
     $configs['WEB_MODULE_DIR'] = WEB_MODULE_DIR;
     $configs['SCRIPT_PATH'] = SCRIPT_PATH;
     $configs['MODULE_ACCESSOR'] = MODULE_ACCESSOR;
     $configs['ACTION_ACCESSOR'] = ACTION_ACCESSOR;
     $configs['AUTH_MODULE'] = AUTH_MODULE;
     $configs['AUTH_ACTION'] = AUTH_ACTION;
     $configs['DEFAULT_MODULE'] = DEFAULT_MODULE;
     $configs['DEFAULT_ACTION'] = DEFAULT_ACTION;
     $configs['ERROR_404_MODULE'] = ERROR_404_MODULE;
     $configs['ERROR_404_ACTION'] = ERROR_404_ACTION;
     $configs['SECURE_MODULE'] = SECURE_MODULE;
     $configs['SECURE_ACTION'] = SECURE_ACTION;
     $configs['UNAVAILABLE_MODULE'] = UNAVAILABLE_MODULE;
     $configs['UNAVAILABLE_ACTION'] = UNAVAILABLE_ACTION;
     $configs['AVAILABLE'] = AVAILABLE;
     $configs['DISPLAY_ERRORS'] = DISPLAY_ERRORS;
     $configs['PATH_INFO_ARRAY'] = PATH_INFO_ARRAY;
     $configs['PATH_INFO_KEY'] = PATH_INFO_KEY;
     $configs['URL_FORMAT'] = URL_FORMAT;
     $configs['USE_SESSIONS'] = USE_SESSIONS;
     $configs['DISPLAY_ERRORS'] = DISPLAY_ERRORS;
     $configs['include_path'] = join("<br />\n", split(PATH_SEPARATOR, ini_get('include_path')));
     $request->setAttribute("configs", $configs);
     // Modules
     foreach (IndexAction::getFilesByDir(MODULE_DIR) as $moduleName) {
         $actions = is_readable(MODULE_DIR . "/" . $moduleName . "/actions") ? IndexAction::getFilesByDir(MODULE_DIR . "/" . $moduleName . "/actions") : array();
         $views = is_readable(MODULE_DIR . "/" . $moduleName . "/views") ? IndexAction::getFilesByDir(MODULE_DIR . "/" . $moduleName . "/views") : array();
         $templates = is_readable(MODULE_DIR . "/" . $moduleName . "/templates") ? IndexAction::getFilesByDir(MODULE_DIR . "/" . $moduleName . "/templates") : array();
         $modules[$moduleName] = array("actions" => $actions, "views" => $views, "templates" => $templates);
     }
     $request->setAttribute("modules", $modules);
     // Global Filter List
     $gf = new GlobalFilterList();
     $request->setAttribute("globalFilterList", array_keys($gf->filters));
     // Authorization Handler
     $request->setAttribute("authorizationHandler", get_class($controller->getAuthorizationHandler()));
     // User
     $request->setAttribute("user", get_class($controller->getUser()));
     // User Container
     $request->setAttribute("userContainer", get_class($user->getContainer()));
     // Session Handler
     $sessionHandler = $controller->sessionHandler ? get_class($controller->sessionHandler) : "none";
     $request->setAttribute("sessionHandler", $sessionHandler);
     // Logger
     $logManager =& LogManager::getInstance();
     $lgs = $logManager->getLoggers();
     foreach ($lgs as $logger_name => $logger) {
         $lg = array("name" => $logger_name . ' (' . get_class($logger) . ')', "priority" => $defines[$logger->getPriority()], "exit" => $defines[$logger->getExitPriority()]);
         foreach ($logger->appenders as $appender_name => $appender) {
             $lg["appenders"][] = $appender_name . ' (' . get_class($appender) . ')';
         }
         $loggers[] = $lg;
     }
     $request->setAttribute("loggers", $loggers);
     return VIEW_INDEX;
 }
示例#9
0
 public function downAll()
 {
     $expid = $_GET["expid"];
     $beginid = $_GET["beginid"];
     $condtion = "beginid={$beginid} and expid={$expid}";
     $Report = D("Expreport");
     $reportlist = $Report->where($condtion)->select();
     $filelist = array();
     foreach ($reportlist as $value) {
         $arr = explode("?", $value["reportfile"]);
         $file_name = urlencode($arr[0]);
         $file_name = str_replace("%EF%BB%BF", "", $file_name);
         $filelist[] = "uploads/" . $file_name;
     }
     require_once COMMONPATH . 'createzip.class.php';
     $zip = new createzip();
     if ($zip->create_zip($filelist, "uploads/temp.zip", true)) {
         $Index = new IndexAction();
         $Index->dl_file("uploads/temp.zip");
     } else {
         $this->error("压缩失败!");
     }
 }
示例#10
0
<?php

require 'init.inc.php';
global $templates;
$index = new IndexAction('index.tpl');
$index->Action();
$templates->display('index.tpl');
示例#11
0
 /**
  * @return array
  */
 public function actions()
 {
     return ['index' => ['class' => IndexAction::className(), 'modelClass' => $this->modelClass], 'view' => ['class' => ViewAction::className(), 'modelClass' => $this->modelClass], 'create' => ['class' => CreateAction::className(), 'modelClass' => $this->modelClass], 'update' => ['class' => UpdateAction::className(), 'modelClass' => $this->modelClass], 'delete' => ['class' => DeleteAction::className(), 'modelClass' => $this->modelClass], 'search' => ['class' => SearchAction::className(), 'modelClass' => $this->modelClass]];
 }
示例#12
0
 public function dl_file($filename)
 {
     $Index = new IndexAction();
     $mimeType = $Index->mime($filename);
     $filesize = filesize($filename);
     //header("Pragma: public");   header("Expires: 0");
     header('Content-Encoding: none');
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header("Content-Type: application/force-download");
     header("Content-Type: {$mimeType}");
     header("Content-Transfer-Encoding: binary");
     //header($attachmentHeader);
     Header("Content-Disposition: attachment; filename=" . $filename);
     header('Pragma: cache');
     header('Cache-Control: public, must-revalidate, max-age=0');
     header("Content-Length: {$filesize}");
     //**********************************
     ob_clean();
     flush();
     //*********************************
     readfile($filename);
     exit;
 }
示例#13
0
文件: index.php 项目: phil714/mel
<?php

require_once "action/IndexAction.php";
$action = new IndexAction();
$action->execute();
require_once "partial/header.php";
?>


	<div id="login-box">
		Login here
	</div>
	<a href="list.php">LISTE</a>


<?php 
require_once "partial/footer.php";