Пример #1
0
 private function Search_Tag()
 {
     global $templates;
     if (empty($_GET['input_keyword'])) {
         Tool::alertClose('关键字不能为空');
     }
     $this->model->input_keyword = $_GET['input_keyword'];
     $object = $this->model->Search_Tag();
     foreach ($object as $value) {
         if (empty($value->thumbnail)) {
             $value->thumbnail = 'images/none.jpg';
         }
         $value->title = str_replace($_GET['input_keyword'], '<span style="color:red;">' . $_GET['input_keyword'] . '</span>', $value->title);
     }
     $templates->assgin('search', $object);
 }
Пример #2
0
 private function setCount()
 {
     if (isset($_POST['send'])) {
         if (empty($_POST['vote'])) {
             Tool::alertClose('警告:请选择一个投票项目!');
         }
         if ($_COOKIE['ip'] == $_SERVER["REMOTE_ADDR"]) {
             if (time() - $_COOKIE['time'] < 86400) {
                 Tool::alertLocation('警告:您已经参与了本投票,请不要重复投票!', 'cast.php');
             }
         }
         $this->_model->id = $_POST['vote'];
         $this->_model->setCount();
         setcookie('ip', $_SERVER["REMOTE_ADDR"]);
         setcookie('time', time());
         Tool::alertLocation('恭喜,累计投票成功,感谢您的参与!', 'cast.php');
     }
 }
Пример #3
0
 private function addComment()
 {
     if (isset($_POST['send'])) {
         $_url = 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
         if ($_url == PREV_URL) {
             if (Validate::checkNull($_POST['content'])) {
                 Tool::alertBack('警告:评论内容不得为空!');
             }
             if (Validate::checkLength($_POST['content'], 255, 'max')) {
                 Tool::alertBack('警告:评论内容长度不得大于255位!');
             }
             if (Validate::checkLength($_POST['code'], 4, 'equals')) {
                 Tool::alertBack('警告:验证码必须是四位!');
             }
             if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
                 Tool::alertBack('警告:验证码不正确!');
             }
         } else {
             if (Validate::checkNull($_POST['content'])) {
                 Tool::alertClose('警告:评论内容不得为空!');
             }
             if (Validate::checkLength($_POST['content'], 255, 'max')) {
                 Tool::alertClose('警告:评论内容长度不得大于255位!');
             }
             if (Validate::checkLength($_POST['code'], 4, 'equals')) {
                 Tool::alertClose('警告:验证码必须是四位!');
             }
             if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
                 Tool::alertClose('警告:验证码不正确!');
             }
         }
         parent::__construct($this->_tpl, new CommentModel());
         $_cookie = new Cookie('user');
         if ($_cookie->getCookie()) {
             $this->_model->user = $_cookie->getCookie();
         } else {
             $this->_model->user = '******';
         }
         $this->_model->manner = $_POST['manner'];
         $this->_model->content = $_POST['content'];
         $this->_model->cid = $_GET['cid'];
         $this->_model->addComment() ? Tool::alertLocation('评论添加成功,请等待管理员审核!', 'feedback.php?cid=' . $this->_model->cid) : Tool::alertLocation('评论添加失败,请重新添加!', 'feedback.php?cid=' . $this->_model->cid);
     }
 }
Пример #4
0
 private function Add_Comment()
 {
     // 		echo 'http://'.$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"].'?'.$_SERVER["QUERY_STRING"];
     // 		echo '<br/>';
     // 		echo PREV_URL;
     global $templates;
     if (isset($_POST['send'])) {
         $url = 'http://' . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"] . '?' . $_SERVER["QUERY_STRING"];
         if ($url == PREV_URL) {
             if (!Validate::Check_Equals($_SESSION['code'], $_POST['code'])) {
                 Tool::alertBack('验证码不正确,请重新输入');
             }
             if (Validate::Check_Null($_POST['content'])) {
                 Tool::alertBack('内容不能为空');
             }
         } else {
             if (!Validate::Check_Equals($_SESSION['code'], $_POST['code'])) {
                 Tool::alertClose('验证码不正确,请重新输入');
             }
             if (Validate::Check_Null($_POST['content'])) {
                 Tool::alertClose('内容不能为空');
             }
         }
         if (isset($_COOKIE['user'])) {
             $this->model->username = $_COOKIE['user'];
         } else {
             $this->model->username = '******';
         }
         $this->model->cid = $_GET['cid'];
         $this->model->manner = $_POST['manner'];
         $this->model->content = $_POST['content'];
         $templates->assgin('cid', $this->model->cid);
         if ($this->model->Add_Comment()) {
             //添加评论成功后,开始更新content中的评论数
             $content = new ContentModel();
             $content->cid = $_GET['cid'];
             $content->Detail_Comment();
             Tool::alertLocation('评论成功', 'feedback.php?cid=' . $this->model->cid);
         } else {
             Tool::alertLocation('评论失败', 'feedback.php?cid=' . $this->model->cid);
         }
     }
 }
Пример #5
0
 private function frontadd()
 {
     if (isset($_POST['send'])) {
         if (Validate::checkNull($_POST['webname'])) {
             Tool::alertBack('警告:网站名称不得为空!');
         }
         if (Validate::checkLength($_POST['webname'], 20, 'max')) {
             Tool::alertBack('警告:网站名称不得大于二十位!');
         }
         if (Validate::checkNull($_POST['weburl'])) {
             Tool::alertBack('警告:网站地址不得为空!');
         }
         if (Validate::checkLength($_POST['webname'], 100, 'max')) {
             Tool::alertBack('警告:网站地址不得大于一百位!');
         }
         if ($_POST['type'] == 2) {
             if (Validate::checkNull($_POST['logourl'])) {
                 Tool::alertBack('警告:Logo地址不得为空!');
             }
             if (Validate::checkLength($_POST['logourl'], 100, 'max')) {
                 Tool::alertBack('警告:Logo地址不得大于一百位!');
             }
         }
         if (Validate::checkLength($_POST['user'], 20, 'max')) {
             Tool::alertBack('警告:站长名不得大于二十位!');
         }
         if (Validate::checkLength($_POST['code'], 4, 'equals')) {
             Tool::alertBack('警告:验证码必须是四位!');
         }
         if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
             Tool::alertBack('警告:验证码不正确!');
         }
         $this->_model->webname = $_POST['webname'];
         $this->_model->weburl = $_POST['weburl'];
         $this->_model->logourl = $_POST['logourl'];
         $this->_model->user = $_POST['user'];
         $this->_model->type = $_POST['type'];
         $this->_model->state = $_POST['state'];
         $this->_model->addLink() ? Tool::alertClose('恭喜,申请友情链接成功!请等待管理员审核!') : Tool::alertBack('很遗憾,申请友情链接失败,请重试!');
     }
     $this->_tpl->assign('frontadd', true);
 }
Пример #6
0
 private function addComment()
 {
     if (isset($_POST['send'])) {
         $_url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
         if ($_url == PREV_URL) {
             if (Validate::checkNull($_POST['content'])) {
                 Tool::alertBack('content empty');
             }
             if (Validate::checkLength($_POST['content'], 255, 'max')) {
                 Tool::alertBack('content longer than 255');
             }
             if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
                 Tool::alertBack('validate code must match');
             }
         } else {
             if (Validate::checkNull($_POST['content'])) {
                 Tool::alertClose('content empty');
             }
             if (Validate::checkLength($_POST['content'], 255, 'max')) {
                 Tool::alertClose('content longer than 255');
             }
             if (Validate::checkEquals(strtolower($_POST['code']), $_SESSION['code'])) {
                 Tool::alertClose('validate code must match');
             }
         }
         parent::__construct($this->_tpl, new CommentModel());
         $_cookie = new Cookie('user');
         if ($_cookie->getCookie()) {
             $this->_model->user = $_cookie->getCookie();
         } else {
             $this->_model->user = '******';
         }
         $this->_model->manner = $_POST['manner'];
         $this->_model->content = $_POST['content'];
         $this->_model->cid = $_GET['cid'];
         $this->_model->addComment() ? Tool::alertLocation('succeed', 'feedback.php?cid=' . $this->_model->cid) : Tool::alertLocation('failed', 'feedback.php?cid=' . $this->_model->cid);
     }
 }