Beispiel #1
0
 public function getJson($addWhere = '', $addSql = '', $showMax = 12)
 {
     $sort = input::getInput("mix.sort") ? input::getInput("mix.sort") : 'id';
     $order = input::getInput("mix.order") ? input::getInput("mix.order") : "asc";
     $page = input::getInput("mix.page") ? input::getInput("mix.page") : 1;
     $rows = input::getInput("mix.rows") ? input::getInput("mix.rows") : 10;
     $db = sf::getLib("db");
     if ($select) {
         $sql = $select . " ";
     } else {
         $sql = "SELECT * FROM `" . $this->table . "` ";
     }
     $addWhere && ($sql .= "WHERE " . $addWhere . " ");
     if ($addSql) {
         $sql .= $addSql . " ";
     } else {
         $sql .= " ORDER BY {$sort} {$order} ";
     }
     if (!router::get("totalnum" . $key)) {
         $query = $db->query($sql);
         $total = $db->num_rows($query);
     } else {
         $total = router::get("totalnum" . $key);
     }
     $sql .= "LIMIT " . $rows * ($page - 1) . "," . $rows;
     $query = $db->query($sql);
     while ($row = $db->fetch_array($query)) {
         $result[] = $this->fillObject($row)->toArray();
     }
     return '{"total":' . $total . ',"rows":' . json_encode($result) . '}';
 }
Beispiel #2
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");
 }
Beispiel #3
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");
 }
Beispiel #4
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");
 }
Beispiel #5
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");
 }
Beispiel #6
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");
 }
 /**
  * 删除数据
  */
 function delete()
 {
     if (input::getInput("post.select_id")) {
         $ids = implode("','", input::getInput("post.select_id"));
     } else {
         $ids = input::getInput("get.id");
     }
     sf::getModel("Authorizations")->remove("`id` IN('" . $ids . "')");
     $this->page_debug(lang::get("Has been deleted!"), getFromUrl());
 }
Beispiel #8
0
 function index()
 {
     if (input::getInput("post.site")) {
         $htmlStr = $this->getHtmlStr(input::getInput("post.site"));
         file_put_contents(APPPATH . "config/Config.config.php", "<?php\r\n" . 'config::set(' . $htmlStr . ");\r\n?>");
         $this->page_debug(lang::get('Has been save!'), getFromUrl());
     }
     view::apply("inc_body", "admin/configure/index");
     view::display("admin/page");
 }
Beispiel #9
0
 /**
  * 删除数据
  */
 function delete()
 {
     if (input::getInput("post.select_id")) {
         $ids = implode("','", input::getInput("post.select_id"));
     } else {
         $ids = input::getInput("get.id");
     }
     if (sf::getModel("Order_froms")->remove("`id` IN ('" . $ids . "')")) {
         $this->page_debug(lang::get("Has been deleted!"), getFromUrl());
     } else {
         $this->page_debug(lang::get("Nothing to do!"), getFromUrl());
     }
 }
Beispiel #10
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");
 }
Beispiel #11
0
 function edit()
 {
     if (input::getInput("session.SafetyCode") != input::getInput("post.SafetyCode")) {
         $this->page_debug(lang::get("The safety code is error!"), getFromUrl());
     }
     $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->setUpdatedAt(date("Y-m-d H:i:s"));
         $book->save();
         $this->page_debug(lang::get("Has been saved!"), getFromUrl());
     }
     $this->page_debug(lang::get("Has been saved!"), getFromUrl());
 }
Beispiel #12
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");
 }
Beispiel #13
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");
 }
Beispiel #14
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 . "'}");
 }
Beispiel #15
0
            <td bgcolor="#fafafa"><input name="price"  id="price"  />
                <span>*</span></td>
          </tr>
          <tr>
            <td bgcolor="#f8f8f8">货物数量:</td>
            <td bgcolor="#fafafa"><input name="number"  id="number"  />
                <span>*</span></td>
          </tr>
          <tr>
            <td colspan="2" bgcolor="#f8f8f8">请填写客户信息:</td>
          </tr>

          <tr>
            <td width="15%" bgcolor="#f8f8f8">您的姓名:</td>
            <td width="85%" bgcolor="#fafafa"><input name="user_name" value="<?php 
echo input::getInput("session.username");
?>
" />
                <span>*</span></td>
          </tr>
          <tr>
            <td bgcolor="#f8f8f8">如何称呼:</td>
            <td bgcolor="#fafafa"><input type="radio" checked="checked" value="先生" name="user_sex" />
              先生
              <input type="radio" value="女士" name="user_sex" />
              女士</td>
          </tr>
          <tr>
            <td bgcolor="#f8f8f8">移动电话:</td>
            <td bgcolor="#fafafa"><input name="user_mobile" id="user_mobile"   />
                <span>*</span></td>
Beispiel #16
0
 /**
  * 删除数据
  */
 function delete()
 {
     sf::getModel("pages", input::getInput("get.id"))->delete();
     $this->page_debug(lang::get("Has been deleted!"), getFromUrl());
 }
Beispiel #17
0
 function show()
 {
     !input::getInput("get.id") && $this->page_debug(lang::get("Lack of parameters!"));
     header("location:" . site_path("up_files/" . sf::getModel("filemanager", input::getInput("get.id"))->getFilePath()));
 }
Beispiel #18
0
 /**
  * 删除数据
  */
 function delete()
 {
     sf::getModel("categorys", input::getInput("get.id"), $this->type)->remove();
     $this->page_debug(lang::get("Has been deleted!"), getFromUrl());
 }