link.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <?php
  2. class link_c extends Control
  3. {
  4. function __construct()
  5. {
  6. parent::Control();
  7. $this->load_model("module");
  8. $this->load_model("cate");
  9. $this->load_model("list");
  10. $this->load_model("user");
  11. $this->load_model("customer");
  12. }
  13. function link_c()
  14. {
  15. $this->__construct();
  16. }
  17. //读取列表
  18. function index_f()
  19. {
  20. exit("ERROR!");
  21. }
  22. //加载配置参数
  23. function auto_load()
  24. {
  25. if(!file_exists(ROOT_DATA."system_".$_SESSION["sys_lang_id"].".php"))
  26. {
  27. error("请先配置好,网站信息!");
  28. }
  29. include_once(ROOT_DATA."system_".$_SESSION["sys_lang_id"].".php");
  30. if(!$_sys["indexphp"])
  31. {
  32. $_sys["indexphp"] = "index.php";
  33. }
  34. if(!$_sys["sitehtml"])
  35. {
  36. $_sys["sitehtml"] = $_sys["siteurl"]."html/".$_SESSION["sys_lang_id"]."/";
  37. }
  38. $this->tpl->assign("phpfile",$_sys["indexphp"]);
  39. $input_id = $this->trans_lib->safe("input_id");
  40. if(!$input_id) $input_id = "link,link_rewrite,link_html";
  41. $this->tpl->assign("input_id",$input_id);
  42. $this->tpl->assign("htmlfile",$_sys["sitehtml"]);
  43. }
  44. function module_f()
  45. {
  46. $this->auto_load();
  47. $condition = array();
  48. $condition["langid"] = $_SESSION["sys_lang_id"];
  49. $condition["ctrl_init"] = "list";
  50. $condition["array"]["if_list"] = 1;
  51. $condition["array"]["if_msg"] = 1;
  52. $pageid = $this->trans_lib->int(SYS_PAGEID);
  53. $rslist = $this->module_m->get_list($pageid,$condition);
  54. $this->tpl->assign("rslist",$rslist);
  55. $total = $this->module_m->get_count();//读取模块总数
  56. $page_url = $this->url("link,module");
  57. $pagelist = $this->page_lib->page($page_url,$total);
  58. $this->tpl->assign("pagelist",$pagelist);
  59. $this->tpl->assign("type","module");
  60. $input_id = $this->trans_lib->safe("input_id");
  61. if(!$input_id) $input_id = "link,link_rewrite,link_html";
  62. $this->tpl->assign("input_id",$input_id);
  63. $this->tpl->display("link/module.html");
  64. }
  65. function cate_f()
  66. {
  67. $this->auto_load();
  68. $this->cate_m->langid($_SESSION["sys_lang_id"]);
  69. $this->cate_m->get_all();
  70. $this->cate_m->format_list(0,0);
  71. $catelist = $this->cate_m->flist();
  72. if(!is_array($catelist)) $catelist = array();
  73. foreach($catelist AS $key=>$value)
  74. {
  75. $value["space"] = "";
  76. for($i=0;$i<$value["level"];$i++)
  77. {
  78. $value["space"] .= "  ";
  79. }
  80. $catelist[$key] = $value;
  81. }
  82. $this->tpl->assign("catelist",$catelist);
  83. $input_id = $this->trans_lib->safe("input_id");
  84. if(!$input_id) $input_id = "link,link_rewrite,link_html";
  85. $this->tpl->assign("input_id",$input_id);
  86. $this->tpl->display("link/cate.html");
  87. }
  88. function subject_f()
  89. {
  90. $this->auto_load();
  91. $input_id = $this->trans_lib->safe("input_id");
  92. if(!$input_id) $input_id = "link,link_rewrite,link_html";
  93. $this->tpl->assign("input_id",$input_id);
  94. $page_url = $this->url("link,subject","input_id=".rawurlencode($input_id));
  95. $pageid = $this->trans_lib->int(SYS_PAGEID);
  96. $condition = "l.langid='".$_SESSION["sys_lang_id"]."' ";
  97. $condition.= " AND m.ctrl_init='list' AND m.if_msg='1' ";
  98. $keywords = $this->trans_lib->safe("keywords");
  99. if($keywords)
  100. {
  101. $condition .= " AND l.title LIKE '%".$keywords."%' ";
  102. $page_url .= "keywords=".rawurlencode($keywords)."&";
  103. }
  104. $rslist = $this->list_m->get_link($pageid,$condition);
  105. $this->tpl->assign("rslist",$rslist);
  106. $total_count = $this->list_m->get_link_count($condition);//取得总数
  107. $pagelist = $this->page_lib->page($page_url,$total_count);
  108. $this->tpl->assign("pagelist",$pagelist);
  109. $this->tpl->display("link/subject.html");
  110. }
  111. function project_f()
  112. {
  113. $this->auto_load();
  114. $input_d = $this->trans_lib->safe("input_d");
  115. $this->tpl->assign("input_d",$input_d);
  116. $page_url = $this->url("link,project","input_d=".rawurlencode($input_d));
  117. $pageid = $this->trans_lib->int(SYS_PAGEID);
  118. $condition = "l.langid='".$_SESSION["sys_lang_id"]."' ";
  119. $condition.= " AND l.module_id='3' ";
  120. $keywords = $this->trans_lib->safe("keywords");
  121. if($keywords)
  122. {
  123. $condition .= " AND l.title LIKE '%".$keywords."%' ";
  124. $page_url .= "keywords=".rawurlencode($keywords)."&";
  125. }
  126. $rslist = $this->list_m->get_link($pageid,$condition);
  127. $this->tpl->assign("rslist",$rslist);
  128. $total_count = $this->list_m->get_link_count($condition);//取得总数
  129. $pagelist = $this->page_lib->page($page_url,$total_count);
  130. $this->tpl->assign("pagelist",$pagelist);
  131. $this->tpl->display("link/project.html");
  132. }
  133. function user_f()
  134. {
  135. $this->auto_load();
  136. $input_id = $this->trans_lib->safe("input_id");
  137. $input_i = $this->trans_lib->safe("input_i");
  138. if(!$input_id) $input_id = "link,link_rewrite,link_html";
  139. $this->tpl->assign("input_id",$input_id);
  140. $this->tpl->assign("input_i",$input_i);
  141. $page_url = $this->url("link,user","input_i=".rawurlencode($input_i)."&input_id=".rawurlencode($input_id));
  142. $pageid = $this->trans_lib->int(SYS_PAGEID);
  143. $offset = $pageid>0 ? ($pageid-1)*SYS_PSIZE : 0;
  144. $condition = " 1=1 ";
  145. $rslist = $this->user_m->get_list($offset,$condition);
  146. $this->tpl->assign("rslist",$rslist);
  147. $total_count = $this->user_m->get_count($condition);
  148. $pagelist = $this->page_lib->page($page_url,$total_count);
  149. $this->tpl->assign("pagelist",$pagelist);
  150. $this->tpl->display("link/user.html");
  151. }
  152. function customer_f()
  153. {
  154. $this->auto_load();
  155. $input_cid = $this->trans_lib->safe("input_cid");
  156. $input_c = $this->trans_lib->safe("input_c");
  157. $this->tpl->assign("input_cid",$input_cid);
  158. $this->tpl->assign("input_c",$input_c);
  159. $page_url = $this->url("link,customer","input_cid=".rawurlencode($input_cid)."&input_c=".rawurlencode($input_c));
  160. $pageid = $this->trans_lib->int(SYS_PAGEID);
  161. $offset = $pageid>0 ? ($pageid-1)*SYS_PSIZE : 0;
  162. $condition = " 1=1 ";
  163. $rslist = $this->customer_m->get_list($offset,$condition);
  164. $this->tpl->assign("rslist",$rslist);
  165. $total_count = $this->customer_m->get_count($condition);
  166. $pagelist = $this->page_lib->page($page_url,$total_count);
  167. $this->tpl->assign("pagelist",$pagelist);
  168. $this->tpl->display("link/customer.html");
  169. }
  170. function recommendcustomer_f()
  171. {
  172. $this->auto_load();
  173. $uid = $this->trans_lib->safe("uid");
  174. $input_cid = $this->trans_lib->safe("input_cid");
  175. $input_c = $this->trans_lib->safe("input_c");
  176. $this->tpl->assign("input_cid",$input_cid);
  177. $this->tpl->assign("input_c",$input_c);
  178. $page_url = $this->url("link,customer","input_cid=".rawurlencode($input_cid)."&input_c=".rawurlencode($input_c));
  179. $pageid = $this->trans_lib->int(SYS_PAGEID);
  180. $offset = $pageid>0 ? ($pageid-1)*SYS_PSIZE : 0;
  181. $condition = " 1=1 and uid='".$uid."' ";
  182. //print_r($condition);
  183. //die();
  184. $rslist = $this->customer_m->get_list($offset,$condition);
  185. $this->tpl->assign("rslist",$rslist);
  186. $total_count = $this->customer_m->get_count($condition);
  187. $pagelist = $this->page_lib->page($page_url,$total_count);
  188. $this->tpl->assign("pagelist",$pagelist);
  189. $this->tpl->display("link/customer.html");
  190. }
  191. function email_f()
  192. {
  193. $this->auto_load();
  194. $page_url = $this->url("link,email");
  195. $pageid = $this->trans_lib->int(SYS_PAGEID);
  196. $condition = "l.langid='".$_SESSION["sys_lang_id"]."' ";
  197. $condition.= " AND m.ctrl_init='list' AND m.if_msg='1' ";
  198. $keywords = $this->trans_lib->safe("keywords");
  199. if($keywords)
  200. {
  201. $condition .= " AND l.title LIKE '%".$keywords."%' ";
  202. $page_url .= "keywords=".rawurlencode($keywords)."&";
  203. }
  204. $rslist = $this->list_m->get_link($pageid,$condition);
  205. $this->tpl->assign("rslist",$rslist);
  206. $total_count = $this->list_m->get_link_count($condition);//取得总数
  207. $pagelist = $this->page_lib->page($page_url,$total_count);
  208. $this->tpl->assign("pagelist",$pagelist);
  209. $this->tpl->display("link/email.html");
  210. }
  211. function lang_f()
  212. {
  213. $this->load_model("lang");
  214. $langlist = $this->lang_m->get_list();
  215. if(!$langlist)
  216. {
  217. error("未设置语言包!");
  218. }
  219. foreach($langlist AS $key=>$value)
  220. {
  221. $value["phpfile"] = "{index_php}";
  222. $value["html"] = "{site_url}{index_php}?langid=".$value["langid"];
  223. $langlist[$key] = $value;
  224. }
  225. $this->tpl->assign("langlist",$langlist);
  226. $input_id = $this->trans_lib->safe("input_id");
  227. if(!$input_id) $input_id = "link,link_rewrite,link_html";
  228. $this->tpl->assign("input_id",$input_id);
  229. $this->tpl->display("link/lang.html");
  230. }
  231. }
  232. ?>