示例#1
0
文件: index.php 项目: kulebri/trouble
 public function index($args)
 {
     $view = new view();
     $db = $this->database();
     $this->load_locale("lang");
     $g = new model_game($db);
     //		$g->assign_targets();
     $g->kill_agent("Edward");
     $view->set("games", MODEL_KILL::killboard_list());
     $view->set("page_title", L_PAGE_TITLE);
     $view->set("site_name", L_SITE_NAME);
     $view->show("home");
 }
示例#2
0
 public function index($args)
 {
     $db = $this->database();
     $s = new model_section($db);
     $p = new model_page($db);
     $md = new markdown_parser();
     $rt = explode("/", $args["_url"]);
     $s->load_from_name(strlen($rt[0]) > 0 ? $rt[0] : "home");
     array_shift($rt);
     $rt = implode("/", $rt);
     $cur_url = strlen($rt) > 0 ? $args["_url"] : $s->default_page();
     $p->load_from_url($cur_url);
     $navs = MODEL_SECTION::get_sections($db);
     $subnavs = $s->get_pages();
     $tpl = new view($this->registry);
     $tpl->set("cur_url", $cur_url);
     $tpl->set("title", $p->title);
     $tpl->set("navs", $navs);
     $tpl->set("subnavs", $subnavs);
     $tpl->set("page", $s->name);
     $tpl->set("content", $p->is_markdown ? array("markdown" => $md->transform($p->content)) : array("html" => $p->content));
     $tpl->set("s_intro", $md->transform($s->introduction));
     $tpl->set("s_img", $s->image);
     $tpl->show("default");
 }
示例#3
0
 /**
  * 生成文章页面
  */
 function article()
 {
     //读取总数
     if (!$_SESSION['article']['total']) {
         $_SESSION['article']['total'] = (int) sf::getModel("articles")->getTotal("`is_html` = 0");
         $_SESSION['article']['num'] = 0;
     }
     //生成静态页面
     if ($_SESSION['article']['total'] == 0 || $_SESSION['article']['num'] >= $_SESSION['article']['total']) {
         $_SESSION['article']['num'] = 0;
         $_SESSION['article']['total'] = 0;
         exit('{total:1,num:1}');
     }
     $result = sf::getModel("articles")->selectAll("is_html = 0", '', 1);
     while ($article = $result->getObject()) {
         view::set("article", $article);
         view::apply("inc_body", "template/article_show");
         $htmlStr = view::parse("template/page");
         $path = WEBROOT . "/html/" . $article->getTypeStr();
         if (!is_dir($path)) {
             sf::getLib("Files")->mDir($path);
             exit('{total:' . $_SESSION['article']['total'] . ',num:0}');
         }
         sf::getLib("Files")->write($path . "/article-show-" . $article->getId() . ".html", $htmlStr);
         $article->setIsHtml(1);
         $article->save();
         $_SESSION['article']['num']++;
     }
     exit('{total:' . $_SESSION['article']['total'] . ',num:' . $_SESSION['article']['num'] . '}');
 }
示例#4
0
 /**
  * 查看模板
  */
 function show()
 {
     $template = sf::getModel("templates", input::getInput("get.id"));
     view::set("template", $template);
     view::apply("inc_body", "admin/template/show");
     view::display("admin/page");
 }
示例#5
0
 /**
  * 发送简历
  */
 function send()
 {
     if (input::getInput("post")) {
         $back = sf::getModel("backs");
         $back->setSubject(input::getInput("post.subject"));
         $back->setUserName(input::getInput("post.user_name"));
         $back->setUserSex(input::getInput("post.user_sex"));
         $back->setUserAge(input::getInput("post.user_age"));
         $back->setUserDegree(input::getInput("post.user_degree"));
         $back->setIdcard(input::getInput("post.idcard"));
         $back->setUserPhone(input::getInput("post.user_phone"));
         $back->setUserIm(input::getInput("post.user_im"));
         $back->setUserEmail(input::getInput("post.user_email"));
         $back->setUserAddress(input::getInput("post.user_address"));
         $back->setPostCode(input::getInput("post.post_code"));
         $back->setWorkAt(input::getInput("post.work_at"));
         $back->setStudyList(input::getInput("post.study_list"));
         $back->setWorkList(input::getInput("post.work_list"));
         $back->setUpdatedAt(date("Y-m-d H:i:s"));
         $back->save();
         $this->page_debug(lang::get("Has been saved!"), site_url("job/index"));
     }
     view::set("job", sf::getModel("jobs", input::getInput("get.id")));
     view::apply("inc_body", "template/job_send");
     view::display("template/page");
 }
示例#6
0
 function main()
 {
     $data['user'] = sf::getModel("managers", input::getInput("session.userid"));
     view::set($data);
     view::apply("inc_body", "admin/main");
     view::display("admin/page");
 }
示例#7
0
文件: index.php 项目: Huggie/hci1
 public function index($args)
 {
     $db = $this->database();
     $articles = array();
     $sth = $db->prepare("\n\t\t\tSELECT\t\tid, title, body, date_added, author, publisher, date\n\t\t\tFROM\t\tarticles\n\t\t\tORDER BY\tdate_added DESC\n\t\t\tLIMIT\t\t5\n\t\t");
     $sth->execute();
     while ($article = $sth->fetch()) {
         $seo_url = new seo_url($article);
         $s = new markdown_smartypantstypographer();
         $articles[] = array("id" => $article["id"], "title" => $article["title"], "excerpt" => $s->transform(utf8_encode(substr($article["body"], 0, 200))) . "…", "seo_url" => $seo_url->url, "date_added" => date("dS M", strtotime($article["date_added"])), "author" => $article["author"], "publisher" => $article["publisher"], "date" => $article["date"]);
     }
     $tpl = new view($this->registry);
     $tpl->set("articles", $articles);
     $tpl->set("page_title", "Look At That F***ing Title");
     $tpl->set("subview", "home_body");
     $tpl->show("home");
 }
示例#8
0
 function index()
 {
     $page = sf::getModel("pages")->showPage($this->type, input::getInput("get.id"));
     config::set('title', $page->getSubject());
     view::set("page", $page);
     view::apply("inc_body", "template/about_us");
     view::display("template/page");
 }
示例#9
0
 public function view($args)
 {
     $template = new view($this->registry);
     $db = $this->database();
     $sth = $db->prepare("\n\t\t\tSELECT \tid, title, body, author, date, publisher\n\t\t\tFROM \tarticles\n\t\t\tWHERE\tid = :id\n\t\t\tLIMIT \t1\n\t\t");
     $sth->execute(array(":id" => $args["id"]));
     $article = $sth->fetch();
     $template->set("page_title", "Look At That F***ing Title");
     $template->set("title", utf8_encode($article["title"]));
     $p = new markdown_parser();
     $s = new markdown_smartypantstypographer();
     include SITE_PATH . DIRSEP . "definitions" . DIRSEP . "article.php";
     $body_text = $p->transform($s->transform($article["body"]));
     $article_info = sprintf(HTML_ARTICLE_INFO, $article["author"], $article["date"], $article["publisher"]);
     $template->set("info", $article_info);
     $template->set("body", utf8_encode(sprintf(HTML_ARTICLE_BODY, $body_text)));
     $template->show("home");
 }
示例#10
0
 /**
  * 查看新闻
  */
 function show()
 {
     $article = sf::getModel("articles", input::getInput("get.id"));
     //设置页面title
     config::set('title', $article->getSubject());
     view::set("article", $article);
     view::apply("inc_body", "template/article_show");
     view::display("template/page");
 }
示例#11
0
 /**
  * 查看产品
  */
 function show()
 {
     $product = sf::getModel("products", input::getInput("get.id"));
     //设置页面title
     config::set('title', $product->getSubject());
     view::set("product", $product);
     view::apply("inc_body", "template/product_show");
     view::display("template/page");
 }
示例#12
0
 function index()
 {
     $addWhere = $addSql = '';
     $addSql = "order by updated_at DESC";
     $addWhere .= " is_public = 1 ";
     input::getInput("post.search") && ($addWhere .= " AND `content` LIKE '%" . trim(input::getInput("post.search")) . "%' ");
     //取得带翻页的数据集
     $from_vars = array('field', 'search', 'type');
     view::set("pager", sf::getModel("books")->getPager($addWhere, $addSql, 5, '', '', $from_vars));
     view::apply("inc_body", "template/book");
     view::display("template/page");
 }
示例#13
0
 function edit_back()
 {
     $back = sf::getModel("backs", input::getInput("post.id") ? input::getInput("post.id") : input::getInput("get.id"));
     if (input::getInput("post.note")) {
         $back->setNote(input::getInput("post.note"));
         $back->save();
         $this->page_debug(lang::get("Has been saved!"), site_url("admin/job/back"));
     }
     view::set("back", $back);
     view::apply("inc_body", "admin/job/edit_back");
     view::display("admin/page");
 }
示例#14
0
 /**
  * 数据编辑
  */
 function edit()
 {
     $orders = sf::getModel("Order_froms", input::getInput("post.id") ? input::getInput("post.id") : input::getInput("get.id"));
     if (input::getInput("post.note")) {
         $orders->setNote(input::getInput("post.note"));
         $orders->setIsPublic(input::getInput("post.is_public"));
         $orders->save();
         $this->page_debug(lang::get("Has been saved!"), site_url("admin/orders/index"));
     }
     view::set("orders", $orders);
     view::apply("inc_body", "admin/order/edit");
     view::display("admin/page");
 }
示例#15
0
 /**
  * 数据编辑
  */
 function edit()
 {
     $filemanager = sf::getModel("filemanager", input::getInput("post.id") ? input::getInput("post.id") : input::getInput("get.id"));
     if (input::getInput("post.file_note")) {
         input::getInput("post.file_note") && $filemanager->setFileNote(input::getInput("post.file_note"));
         input::getInput("post.file_name") && $filemanager->setFileName(input::getInput("post.file_name"));
         $filemanager->save();
         $this->page_debug(lang::get("Has been saved!"), getFromUrl());
     }
     view::set("filemanager", $filemanager);
     view::apply("inc_body", "filemanager/edit");
     view::display("page");
 }
示例#16
0
 function group_edit()
 {
     $user_group = sf::getModel("user_groups", input::getInput("get.id") ? input::getInput("get.id") : input::getInput("post.id"));
     if (input::getInput("post.user_group_name")) {
         $user_group->setUserGroupName(input::getInput("post.user_group_name"));
         if ($user_group->save()) {
             $this->page_debug(lang::get("Has been saved!"), getFromUrl(site_url("home/left"), site_url("admin/user/group_list")));
         }
     }
     $data['group'] = $user_group;
     view::set($data);
     view::apply("inc_body", "admin/user/group_edit");
     view::display("admin/page");
 }
示例#17
0
 function index()
 {
     $tool = sf::getModel("tool");
     $result = $tables = array();
     if ($_POST['tables']) {
         for ($i = 0, $n = count($_POST['tables']); $i < $n; $i++) {
             $this->createmodel($_POST['tables'][$i]);
             $result[] = $_POST['tables'][$i];
         }
     }
     view::set("title", "Tools::Select tables!");
     view::set("tables", $tool->showTables());
     view::set("result", $result);
     view::display("tools");
 }
示例#18
0
 /**
  * 数据编辑
  */
 function edit()
 {
     $Authorizations = sf::getModel("Authorizations", input::getInput("post.id") ? input::getInput("post.id") : input::getInput("get.id"));
     if (input::getInput("post.controller_name")) {
         $Authorizations->setController(input::getInput("post.controller"));
         $Authorizations->setControllerName(input::getInput("post.controller_name"));
         $Authorizations->setMethod(input::getInput("post.method"));
         $Authorizations->setUserGroupIds(input::getInput("post.actions"));
         $Authorizations->save();
         $this->page_debug(lang::get("Has been saved!"), getFromUrl(site_url("home/left"), site_url("Authorization/index")));
     }
     $data["authorization"] = $Authorizations;
     $data['pager'] = sf::getModel("user_groups")->selectAll("", "ORDER BY id ASC", 0);
     view::set($data);
     view::apply("inc_body", "admin/authorization/edit");
     view::display("admin/page");
 }
示例#19
0
 /**
  * @brief Constructor.
  * 
  * If you include your own constructor, you MUST call on parent::construct()
  * with the expected data or things will go boom.
  * 
  * @param string $token The token of the form (from getFormToken())
  * @param string $url The target URL to post to, or same if blank.
  * @param array $options The options as an array
  */
 public function __construct($token = null, $url = null, array $options = null)
 {
     if (!$token) {
         if (request::has('wf_formtoken')) {
             $token = request::get('wf_formtoken')->toString();
         } else {
             $token = uniqid('form', false);
         }
     }
     // These are the defaults we will use
     $defaults = array('method' => 'post', 'target' => null, 'token' => $token, 'url' => $url);
     view::set('token', $token);
     if (request::has('wf_step')) {
         $options['step'] = request::get('wf_step')->toString();
     }
     // Apply the defaults to the options and save
     $this->options = arr::defaults($options, $defaults);
 }
示例#20
0
 function password()
 {
     $user = sf::getModel("users", input::getInput("session.userid"));
     if (input::getInput("post.password")) {
         if ($user->check(input::getInput("post.oldpassword"))) {
             $user->setUserPassword(input::getInput("post.password"));
             $user->setUpdatedAt(date("Y-m-d H:i:s"));
             $user->save();
             $this->page_debug(lang::get("Has been changed!"), site_url("login/index"));
         } else {
             $msg = lang::get("Password is error!");
         }
     }
     view::set("msg", $msg);
     view::set("user", $user);
     view::apply("inc_body", "template/user_password");
     view::display("template/page");
 }
示例#21
0
 /**
  * 数据编辑
  */
 function edit()
 {
     $page = sf::getModel("pages", input::getInput("post.id") ? input::getInput("post.id") : input::getInput("get.id"));
     if (input::getInput("post.subject")) {
         $page->setSubject(input::getInput("post.subject"));
         $page->setContent(input::getInput("post.content"));
         $page->setTypeStr($this->type);
         $page->setIsMenu(input::getInput("post.is_menu") ? 1 : 0);
         $page->setOrders((int) input::getInput("post.orders"));
         $page->setIsDefault(input::getInput("post.is_default") ? 1 : 0);
         $page->setIsPublic(input::getInput("post.is_public") ? 1 : 0);
         $page->setUpdatedAt(date("Y-m-d H:i:s"));
         $page->save();
         $this->page_debug(lang::get("Has been saved!"), site_url("admin/page/index/type/" . $this->type));
     }
     view::set("page", $page);
     view::apply("inc_body", "admin/page/edit");
     view::display("admin/page");
 }
示例#22
0
 function edit()
 {
     $book = sf::getModel("books", input::getInput("post.id") ? input::getInput("post.id") : input::getInput("get.id"));
     if (input::getInput("post.content")) {
         $book->setContent(input::getInput("post.content"));
         $book->setUserName(input::getInput("post.user_name"));
         $book->setUserPhone(input::getInput("post.user_phone"));
         $book->setUserQq(input::getInput("post.user_qq"));
         $book->setUserEmail(input::getInput("post.user_email"));
         $book->setWriteBack(input::getInput("post.write_back"));
         $book->setIsPublic(input::getInput("post.is_public") ? 1 : 0);
         $book->setUpdatedAt(date("Y-m-d H:i:s"));
         $book->save();
         $this->page_debug(lang::get("Has been saved!"), getFromUrl());
     }
     view::set("book", $book);
     view::apply("inc_body", "admin/book/edit");
     view::display("admin/page");
 }
示例#23
0
 /**
  * AJAX取得数据
  */
 function ajax()
 {
     $comment = sf::getModel("comments");
     $type = input::getInput("post.type") ? input::getInput("post.type") : input::getInput("get.type");
     if (input::getInput("post.content")) {
         if (input::getInput("session.SafetyCode") != input::getInput("post.SafetyCode")) {
             $this->page_debug(lang::get("The safety code is error!"), getFromUrl());
         }
         $comment->setTypeStr(input::getInput("post.type"));
         $comment->setContent(input::getInput("post.content"));
         $comment->setUserId(input::getInput("session.userid"));
         $comment->setUserName(input::getInput("post.user_name") ? input::getInput("post.user_name") : 'Guest');
         $comment->setUpdatedAt(date("Y-m-d H:i:s"));
         $comment->save();
     }
     view::set("type", $type);
     view::set("pager", $comment->selectAll("`type_str` = '" . $type . "' ", "ORDER BY updated_at DESC", 5));
     view::display("comment/comment");
 }
示例#24
0
 /**
  * 数据编辑
  */
 function edit()
 {
     $category = sf::getModel("categorys", input::getInput("post.id") ? input::getInput("post.id") : input::getInput("get.id"), $this->type);
     if (input::getInput("post.subject")) {
         input::getInput("post.subject") && $category->setSubject(input::getInput("post.subject"));
         $category->setParentId(input::getInput("post.parent_id") ? input::getInput("post.parent_id") : 0);
         $category->setIsHome(input::getInput("post.is_home") ? 1 : 0);
         input::getInput("post.orders") && $category->setOrders(input::getInput("post.orders"));
         input::getInput("post.cover") && $category->setCover(input::getInput("post.cover"));
         input::getInput("post.type") && $category->setType(input::getInput("post.type"));
         $category->setUpdatedAt(date("Y-m-d H:i:s"));
         $category->save();
         $this->page_debug(lang::get("Has been saved!"), getFromUrl(site_url("home/left"), site_url("admin/category/index/type/" . $this->type)));
     }
     view::set("category", $category);
     view::set("pid", input::getInput("get.pid") ? input::getInput("get.pid") : 0);
     view::set("parent_data", $category->selectAll('', '', 0));
     view::apply("inc_body", "admin/category/edit");
     view::display("admin/page");
 }
示例#25
0
 /**
  * 取得广告内容页面
  */
 function content()
 {
     $type = input::getInput("get.type") ? input::getInput("get.type") : 'text';
     view::set("ad", sf::getModel("ads", input::getInput("get.id")));
     switch ($type) {
         case 'image':
             view::display("admin/ad/image");
             break;
         case 'flash':
             view::display("admin/ad/flash");
             break;
         case 'magic':
             view::display("admin/ad/magic");
             break;
         case 'code':
             view::display("admin/ad/code");
             break;
         default:
             view::display("admin/ad/text");
             break;
     }
 }
示例#26
0
 /**
  * 数据编辑
  */
 function edit()
 {
     $article = sf::getModel("articles", input::getInput("post.id") ? input::getInput("post.id") : input::getInput("get.id"));
     if (input::getInput("post.subject")) {
         $article->setSubject(input::getInput("post.subject"));
         $article->setBrief(input::getInput("post.brief"));
         $article->setContent(input::getInput("post.content"));
         $article->setTypeStr($this->type);
         $article->setCategoryId(input::getInput("post.category_id"));
         $article->setCover(input::getInput("post.cover"));
         $article->setIsTop(input::getInput("post.is_top") ? 1 : 0);
         $article->setIsHot(input::getInput("post.is_hot") ? 1 : 0);
         $article->setIsPublic(input::getInput("post.is_public") ? 1 : 0);
         $article->setIsHtml(0);
         $article->setUpdatedAt(date("Y-m-d H:i:s"));
         $article->save();
         $this->page_debug(lang::get("Has been saved!"), site_url("admin/article/index/type/" . $this->type));
     }
     view::set("article", $article);
     view::apply("inc_body", "admin/article/edit");
     view::display("admin/page");
 }
示例#27
0
 /**
  * 数据编辑
  */
 function edit()
 {
     $menu = sf::getModel("menus", input::getInput("post.id") ? input::getInput("post.id") : input::getInput("get.id"), $this->type);
     if (input::getInput("post.subject")) {
         input::getInput("post.subject") && $menu->setSubject(input::getInput("post.subject"));
         $menu->setParentId(input::getInput("post.parent_id") ? input::getInput("post.parent_id") : 0);
         input::getInput("post.orders") && $menu->setOrders(input::getInput("post.orders"));
         input::getInput("post.url") && $menu->setUrl(input::getInput("post.url"));
         input::getInput("post.alt") && $menu->setAlt(input::getInput("post.alt"));
         $menu->setUserGroupIds(input::getInput("post.user_group_ids"));
         $menu->setType($this->type);
         $menu->setUpdatedAt(date("Y-m-d H:i:s"));
         $menu->save();
         $this->page_debug(lang::get("Has been saved!"), getFromUrl(site_url("home/left"), site_url("admin/menu/index/type/" . $this->type)));
     }
     view::set("menu", $menu);
     view::set('pager', sf::getModel("user_groups")->selectAll("", "ORDER BY id ASC", 0));
     view::set("pid", input::getInput("get.pid") ? input::getInput("get.pid") : 0);
     view::set("parent_data", $menu->selectAll('', '', 0));
     view::apply("inc_body", "admin/menu/edit");
     view::display("admin/page");
 }
示例#28
0
 /**
  * 评论
  */
 function comment()
 {
     $comment = sf::getModel("comments");
     $type = input::getInput("post.type") ? input::getInput("post.type") : 'common';
     if (input::getInput("post.content")) {
         if (config::get('comment_must_login', false) && !input::getInput("session.userid")) {
             exit('{state:false,msg:"' . lang::get("You do not have permission to visit!") . '"}');
         }
         $comment->setTypeStr($type);
         input::getInput("post.subject") && $comment->setSubject(input::getInput("post.subject"));
         input::getInput("post.content") && $comment->setContent(input::getInput("post.content"));
         $comment->setUserId(input::getInput("session.userid") ? input::getInput("session.userid") : 0);
         $comment->setUserName(input::getInput("session.username") ? input::getInput("session.username") : 'Guest');
         $comment->setUpdatedAt(date("Y-m-d H:i:s"));
         if ($comment->save()) {
             exit('{state:true,msg:"' . lang::get('Has been save!') . '",subject:"' . $comment->getSubject() . '",content:"' . $comment->getContent() . '",username:"******",date:"' . $comment->getUpdatedAt("Y/m/d") . '"}');
         } else {
             exit('{state:false,msg:"' . lang::get('Save error!') . '"}');
         }
     }
     view::set("pager", $comment->selectAll("type_str = '" . $type . "' ", 'ORDER BY `updated_at` DESC', config::get('comment_show_max_in_page', 5)));
     $htmlStr = view::getContent("common/comment");
     exit("{state:true,htmlStr:'" . $htmlStr . "'}");
 }
示例#29
0
 /**
  * иб╦═╝Ы└Щ
  */
 function index()
 {
     if (input::getInput("post")) {
         $order = sf::getModel("order_froms");
         $order->setSubject(input::getInput("post.subject"));
         $order->setNumber(input::getInput("post.number"));
         $order->setPrice(input::getInput("post.price"));
         $order->setUserId(input::getInput("session.userid"));
         $order->setUserName(input::getInput("post.user_name"));
         $order->setUserSex(input::getInput("post.user_sex"));
         $order->setUserMobile(input::getInput("post.user_mobile"));
         $order->setUserPhone(input::getInput("post.user_phone"));
         $order->setUserFax(input::getInput("post.user_fax"));
         $order->setUserEmail(input::getInput("post.user_email"));
         $order->setUserAddress(input::getInput("post.user_address"));
         $order->setNotebook(input::getInput("post.notebook"));
         $order->setUpdatedAt(date("Y-m-d H:i:s"));
         $order->save();
         $this->page_debug(lang::get("Has been saved!"), getFromUrl());
     }
     view::set("subject", input::getInput("get.subject"));
     view::apply("inc_body", "template/order_from");
     view::display("template/page");
 }
示例#30
0
 function render(array $meta = null) {
     response::buffer(true);
     view::set('meta',$meta);
     view::set('key',$this->getKey());
     view::set('value',$this->getKey());
     view::embed($this->view);
     $ret = response::getBuffer();
     response::buffer(false);
     return $ret;
 }