ErrorController.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <?php
  2. /**
  3. * ErrorController
  4. * Feel free to change this and customize your own error message
  5. *
  6. * @author darkredz
  7. */
  8. class ErrorController extends DooController {
  9. public $data;
  10. function __construct() {
  11. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  12. $this->data['rootUrl_JS'] = Doo::conf()->APP_JS_URL;
  13. $this->data['rootUrl_IMG'] = Doo::conf()->APP_IMG_URL;
  14. $this->data['rootUrl_CSS'] = Doo::conf()->APP_CSS_URL;
  15. $this->theme = Doo::conf()->APP_THEME;
  16. }
  17. function defaultError() {
  18. $this->data['title'] = '';
  19. $this->data['content'] = '<p>ERROR 404 not found</p>';
  20. $this->render($this->theme.'error', $this->data);
  21. }
  22. // 未登录提示
  23. function loginError() {
  24. $this->data['title'] = '';
  25. $this->data['content'] = '<p style="color:#ff0000;">请登录后操作!2秒后跳转登陆</p>';
  26. header('refresh:2;url=' . Doo::conf()->APP_URL . 'login');
  27. $this->render($this->theme.'error', $this->data);
  28. }
  29. // 已登录
  30. function IsloginError() {
  31. $this->data['title'] = '';
  32. $this->data['content'] = '<p style="color:#ff0000;">已经登陆无需重复操作!2秒后跳转个人信息页</p>';
  33. header('refresh:2;url=' . Doo::conf()->APP_URL . 'profile');
  34. $this->render($this->theme.'error', $this->data);
  35. }
  36. // 激活邮箱缺少参数
  37. function ActEmailError() {
  38. $this->data['title'] = '';
  39. $this->data['content'] = '<p style="color:#ff0000;">错误!2秒后跳转登陆页</p>';
  40. header('refresh:2;url=' . Doo::conf()->APP_URL . 'login');
  41. $this->render($this->theme.'error', $this->data);
  42. }
  43. // 账户已经激活
  44. function activeUser() {
  45. $this->data['title'] = '';
  46. $this->data['content'] = '<p style="color:#ff0000;">已经激活,无需重复操作!2秒后跳转登陆页</p>';
  47. header('refresh:2;url=' . Doo::conf()->APP_URL . 'profile');
  48. $this->render($this->theme.'error', $this->data);
  49. }
  50. // 激活邮件
  51. function isact() {
  52. $this->data['title'] = '';
  53. $this->data['content'] = '<p style="color:#ff0000;">激活邮件已经发送,请查收!2秒后跳转登陆页</p>';
  54. header('refresh:2;url=' . Doo::conf()->APP_URL . 'profile');
  55. $this->render($this->theme.'error', $this->data);
  56. }
  57. // 邮箱与当前相同
  58. function userdemail() {
  59. $this->data['title'] = '';
  60. $this->data['content'] = '<p style="color:#ff0000;">此邮箱已存在,请更换其他邮箱!2秒后跳转登陆页</p>';
  61. header('refresh:2;url=' . Doo::conf()->APP_URL . 'nactchm');
  62. $this->render($this->theme.'error', $this->data);
  63. }
  64. // 邮箱与当前相同
  65. function erroremail() {
  66. $this->data['title'] = '';
  67. $this->data['content'] = '<p style="color:#ff0000;">邮箱格式不正确!2秒后跳转登陆页</p>';
  68. header('refresh:2;url=' . Doo::conf()->APP_URL . 'nactchm');
  69. $this->render($this->theme.'error', $this->data);
  70. }
  71. // 登陆跳转充值页面
  72. function loginandforwardtodeposit() {
  73. $this->data['title'] = '';
  74. $this->data['content'] = '<p style="color:#ff0000;">即将跳转充值页面...</p>';
  75. header('refresh:2;url=' . Doo::conf()->APP_URL . 'deposit');
  76. $this->render($this->theme.'error', $this->data);
  77. }
  78. // 登陆跳转充值页面
  79. function logout() {
  80. $this->data['title'] = '';
  81. $this->data['content'] = '<p style="color:#ff0000;">登出成功.</p>';
  82. header('refresh:2;url=' . Doo::conf()->APP_URL . 'login');
  83. $this->render($this->theme.'error', $this->data);
  84. }
  85. /**
  86. * Prepare sidebar data, random tags and archive list
  87. */
  88. private function prepareSidebar() {
  89. //if tags cache exist, skip retrieving from DB, expires every 5 minutes
  90. $cacheTagOK = Doo::cache('front')->testPart('sidebarTag', 300);
  91. if (!$cacheTagOK) {
  92. echo '<h2>Cache expired. Get Tags from DB!</h2>';
  93. //get random 10 tags
  94. Doo::loadModel('Tag');
  95. $tags = new Tag();
  96. $this->data['randomTags'] = $tags->limit(10, null, null, array('custom' => 'ORDER BY RAND()'));
  97. } else {
  98. $this->data['randomTags'] = array();
  99. }
  100. //if archive cache exist, skip retrieving from DB, archive expires when Post added, updated, deleted
  101. $cacheArchiveOK = Doo::cache('front')->testPart('sidebarArchive', 31536000);
  102. if (!$cacheArchiveOK) {
  103. echo '<h2>Cache expired. Get Archives from DB!</h2>';
  104. //you can pass data to constructor to set the Model properties
  105. Doo::loadModel('Post');
  106. $p = new Post(array('status' => 1));
  107. $this->data['archives'] = $p->getArchiveSummary();
  108. } else {
  109. $this->data['archives'] = array();
  110. }
  111. }
  112. // 登陆跳转充值页面
  113. function username() {
  114. $this->data['title'] = '';
  115. $this->data['content'] = '<p style="color:#ff0000;">用户名只能包含中文、字母大小写与数字</p>';
  116. header('refresh:2;url=' . Doo::conf()->APP_URL . 'reg');
  117. $this->render($this->theme.'error', $this->data);
  118. }
  119. // 激活用户失败
  120. function actUserError() {
  121. $this->data['title'] = '';
  122. $this->data['content'] = '<p style="color:#ff0000;">激活用户失败</p>';
  123. header('refresh:2;url=' . Doo::conf()->APP_URL);
  124. $this->render($this->theme.'error', $this->data);
  125. }
  126. // 用户已经激活
  127. function actived() {
  128. $this->data['title'] = '';
  129. $this->data['content'] = '<p style="color:#ff0000;">用户已经激活</p>';
  130. header('refresh:2;url=' . Doo::conf()->APP_URL . 'login');
  131. $this->render($this->theme.'error', $this->data);
  132. }
  133. // 重新登录
  134. function relogin() {
  135. $this->data['title'] = '';
  136. $this->data['content'] = '<p style="color:#ff0000;">修改成功,请重新登陆</p>';
  137. header('refresh:2;url=' . Doo::conf()->APP_URL . 'login');
  138. $this->render($this->theme.'error', $this->data);
  139. }
  140. // 重新登录
  141. function emailerror() {
  142. $this->data['title'] = '';
  143. $this->data['content'] = '<p style="color:#ff0000;">发送成功,请按邮件提示进行操作!</p>';
  144. header('refresh:2;url=' . Doo::conf()->APP_URL . 'profile');
  145. $this->render($this->theme.'error', $this->data);
  146. }
  147. // 手机注册验证码过期或出错
  148. function mobilereg() {
  149. $this->data['title'] = '';
  150. $this->data['content'] = '<p style="color:#ff0000;">验证码过期或不一致,请重新获取</p>';
  151. header('refresh:2;url=' . Doo::conf()->APP_URL . 'login');
  152. $this->render($this->theme.'error', $this->data);
  153. }
  154. // 手机注册验证码过期或出错
  155. function hadmobile() {
  156. $this->data['title'] = '';
  157. $this->data['content'] = '<p style="color:#ff0000;">该手机号码已注册</p>';
  158. header('refresh:2;url=' . Doo::conf()->APP_URL . 'login');
  159. $this->render($this->theme.'error', $this->data);
  160. }
  161. // 密码出错
  162. function mimaerror() {
  163. $this->data['title'] = '';
  164. $this->data['content'] = '<p style="color:#ff0000;">请确认密码是否正确</p>';
  165. header('refresh:2;url=' . Doo::conf()->APP_URL . 'login');
  166. $this->render($this->theme.'error', $this->data);
  167. }
  168. // 手机找回密码成功
  169. function repwdmobile() {
  170. $this->data['title'] = '';
  171. $this->data['content'] = '<p style="color:#ff0000;">找回密码成功,请重新登陆</p>';
  172. header('refresh:2;url=' . Doo::conf()->APP_URL . 'login');
  173. $this->render($this->theme.'error', $this->data);
  174. }
  175. // 添加手机
  176. function addmobile() {
  177. $this->data['title'] = '';
  178. $this->data['content'] = '<p style="color:#ff0000;">添加手机成功!2秒后跳转个人页</p>';
  179. header('refresh:2;url=' . Doo::conf()->APP_URL . 'profile');
  180. $this->render($this->theme.'error', $this->data);
  181. }
  182. }
  183. ?>