_main_left.aspx.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /*******************************************************************************
  2. * iNethinkCMS - 网站内容管理系统
  3. * Copyright (C) 2012-2013 inethink.com
  4. *
  5. * @author jackyang <69991000@qq.com>
  6. * @website http://cms.inethink.com
  7. * @version 1.3.6.0 (2013-08-14)
  8. *
  9. * This is licensed under the GNU LGPL, version 3.0 or later.
  10. * For details, see: http://www.gnu.org/licenses/gpl-3.0.html
  11. *******************************************************************************/
  12. using System;
  13. using System.Collections.Generic;
  14. using System.Web;
  15. using System.Web.UI;
  16. using System.Web.UI.WebControls;
  17. using iNethinkCMS.Command;
  18. using iNethinkCMS.Web.UI;
  19. using System.Collections.Specialized;
  20. using System.Text.RegularExpressions;
  21. namespace iNethinkCMS.Web.admin
  22. {
  23. public partial class _main_left :Admin_BasePage
  24. {
  25. public string vMenuName = "";
  26. public string vMenuCon = "";
  27. protected void Page_Load(object sender, EventArgs e)
  28. {
  29. CheckUserPower("login");
  30. string vMenu = Request["menu"];
  31. if (vMenu == null || vMenu.Length < 1)
  32. {
  33. vMenu = "news";
  34. }
  35. //System.Environment.NewLine
  36. switch (vMenu)
  37. {
  38. case "news":
  39. if (this.SysLoginUserType == 1)
  40. {
  41. vMenuName = "内容管理";
  42. vMenuCon = "<a href='news/news_content.aspx?act=guide' target='main'>添加内容</a>";
  43. vMenuCon += "<a href='news/news_content.aspx' target='main'>内容管理</a>";
  44. if (this.SysLoginUserPower.IndexOf("f,") >=0)
  45. {
  46. vMenuCon += "<p></p>";
  47. vMenuCon += "<a href='../plugs/guestbook/guestbook_manage.aspx' target='main'>留言管理</a>";
  48. }
  49. if (this.SysLoginUserPower.IndexOf("g,") >= 0)
  50. {
  51. this.vMenuCon += "<p></p>";
  52. this.vMenuCon += "<a href='../plugs/comment/comment_manage.aspx' target='main'>评论管理</a>";
  53. }
  54. if (this.SysLoginUserPower.IndexOf("h,") >= 0)
  55. {
  56. this.vMenuCon += "<p></p>";
  57. this.vMenuCon += "<a href='../plugs/digg/digg_manage.aspx' target='main'>投票管理</a>";
  58. }
  59. }
  60. else {
  61. this.vMenuName = "用户中心";
  62. if (this.SysRegisteredUsersIsManage)
  63. {
  64. vMenuCon = "<a href='news/news_content.aspx?act=guide' target='main'>添加内容</a>";
  65. vMenuCon += "<a href='news/news_content.aspx' target='main'>内容管理</a>";
  66. if (this.SysLoginUserPower.IndexOf("f,") >= 0)
  67. {
  68. vMenuCon += "<p></p>";
  69. vMenuCon += "<a href='../plugs/guestbook/guestbook_manage.aspx' target='main'>留言管理</a>";
  70. }
  71. if (this.SysLoginUserPower.IndexOf("g,") >= 0)
  72. {
  73. this.vMenuCon += "<a href='../plugs/comment/comment_manage.aspx' target='main'>评论管理</a>";
  74. }
  75. if (this.SysLoginUserPower.IndexOf("h,") >= 0)
  76. {
  77. this.vMenuCon += "<a href='../plugs/digg/digg_manage.aspx' target='main'>投票管理</a>";
  78. }
  79. vMenuCon += "<p></p>";
  80. }
  81. this.vMenuCon += "<a href='/Register.aspx?id="+this.SysLoginUserID.ToString()+"' target='main'>帐号管理</a>";
  82. if (this.siteConfig.UserManagedCenters.Trim().Length > 3)
  83. {
  84. try
  85. {
  86. string[] userMenuValues = this.siteConfig.UserManagedCenters.Trim().Split('|');
  87. foreach (string usrMenuValue in userMenuValues)
  88. {
  89. if (usrMenuValue.Trim().Length > 2)
  90. {
  91. string[] mValues = usrMenuValue.Trim().Split(':');
  92. if (mValues.Length == 4)
  93. {
  94. if (mValues[3].Trim() == "1")
  95. {
  96. this.vMenuCon += "<p></p>";
  97. }
  98. NameValueCollection nvcList = new NameValueCollection();
  99. string baseUrl = "";
  100. ParseUrl(mValues[1].Trim(), out baseUrl, out nvcList);
  101. if (this.SysRegisteredUsersChannelPower.IndexOf(nvcList["pcid"] + ",") < 0)
  102. {
  103. this.vMenuCon += "<a href='/channel.aspx?id=" + nvcList["pcid"] + "' target='_blank'>" + mValues[0].Trim() + "</a>";
  104. }
  105. else {
  106. this.vMenuCon += "<a href='" + mValues[1].Trim() + "' target='" + mValues[2].Trim() + "'>" + mValues[0].Trim() + "</a>";
  107. }
  108. }
  109. }
  110. }
  111. }
  112. catch (Exception ex){
  113. Response.Write(ex.Message);
  114. }
  115. }
  116. }
  117. break;
  118. case "column":
  119. vMenuName = "栏目&专题";
  120. vMenuCon = "<a href='news/news_column.aspx?act=guide' target='main'>添加栏目</a>";
  121. vMenuCon += "<a href='news/news_column.aspx' target='main'>栏目管理</a>";
  122. vMenuCon += "<p></p>";
  123. vMenuCon += "<a href='news/news_special.aspx' target='main'>专题管理</a>";
  124. break;
  125. case "module":
  126. vMenuName = "扩展模块";
  127. vMenuCon += "<a href='extend/extend_blogroll.aspx' target='main'>友情连接</a>";
  128. vMenuCon += "<a href='extend/extend_dict.aspx' target='main'>数据字典</a>";
  129. vMenuCon += "<p></p>";
  130. vMenuCon += "<a href='extend/extend_plugs.aspx' target='main'>插件管理</a>";
  131. vMenuCon += "<p></p>";
  132. vMenuCon += "<a href='extend/KHZL.aspx' target='main'>客户资料</a>";
  133. break;
  134. case "label":
  135. vMenuName = "标签&页面";
  136. vMenuCon = "<a href='custom/custom_tags.aspx' target='main'>自定义标签</a>";
  137. vMenuCon += "<p></p>";
  138. vMenuCon += "<a href='custom/custom_pages.aspx' target='main'>自定义页面</a>";
  139. break;
  140. case "sys":
  141. vMenuName = "系统设置";
  142. vMenuCon = "<a href='sys/sys_user.aspx' target='main'>系统用户管理</a>";
  143. vMenuCon += "<p></p>";
  144. vMenuCon += "<a href='sys/sys_upclear.aspx' target='main'>上传文件管理</a>";
  145. vMenuCon += "<p></p>";
  146. vMenuCon += "<a href='sys/sys_cache.aspx' target='main'>缓存管理</a>";
  147. vMenuCon += "<p></p>";
  148. vMenuCon += "<a href='sys/sys_template.aspx' target='main'>模板管理</a>";
  149. vMenuCon += "<a href='sys/sys_seo.aspx' target='main'>SEO优化</a>";
  150. vMenuCon += "<a href='sys/sys_settings.aspx' target='main'>系统设置</a>";
  151. break;
  152. }
  153. }
  154. /// <summary>
  155. /// 分析 url 字符串中的参数信息
  156. /// </summary>
  157. /// <param name="url">输入的 URL</param>
  158. /// <param name="baseUrl">输出 URL 的基础部分</param>
  159. /// <param name="nvc">输出分析后得到的 (参数名,参数值) 的集合</param>
  160. public static void ParseUrl(string url, out string baseUrl, out NameValueCollection nvc)
  161. {
  162. if (url == null)
  163. throw new ArgumentNullException("url");
  164. nvc = new NameValueCollection();
  165. baseUrl = "";
  166. if (url == "")
  167. return;
  168. int questionMarkIndex = url.IndexOf('?');
  169. if (questionMarkIndex == -1)
  170. {
  171. baseUrl = url;
  172. return;
  173. }
  174. baseUrl = url.Substring(0, questionMarkIndex);
  175. if (questionMarkIndex == url.Length - 1)
  176. return;
  177. string ps = url.Substring(questionMarkIndex + 1);
  178. // 开始分析参数对
  179. Regex re = new Regex(@"(^|&)?(\w+)=([^&]+)(&|$)?", RegexOptions.Compiled);
  180. MatchCollection mc = re.Matches(ps);
  181. foreach (Match m in mc)
  182. {
  183. nvc.Add(m.Result("$2").ToLower(), m.Result("$3"));
  184. }
  185. }
  186. }
  187. }