setting.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <?php
  2. require_once "../path.php";
  3. require_once 'checklogin.inc';
  4. require_once "../public/load_lang.php";
  5. require_once '../public/config.php';
  6. require_once "../public/_pdo.php";
  7. //if(isset($_GET["language"])){$currLanguage=$_GET["language"];}
  8. //else{$currLanguage="en";}
  9. if (isset($_GET["device"])) {$currDevice = $_GET["device"];} else { $currDevice = "computer";}
  10. $menu_active["account"] = "";
  11. $menu_active["general"] = "";
  12. $menu_active["local"] = "";
  13. $menu_active["studio"] = "";
  14. $menu_active["liberay"] = "";
  15. $menu_active["dictionary"] = "";
  16. $menu_active["userdict"] = "";
  17. $menu_active["term"] = "";
  18. $menu_active["message"] = "";
  19. $menu_active["album"] = "";
  20. if (isset($_GET["item"])) {
  21. $currSettingItem = $_GET["item"];
  22. $menu_active[$currSettingItem] = " class='act'";
  23. } else {
  24. $currSettingItem = "home";
  25. }
  26. $album_power["15"] = "超级管理员";
  27. $album_power["1"] = "管理员";
  28. $album_power["2"] = "编辑";
  29. ?>
  30. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  31. <html>
  32. <head>
  33. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  34. <link type="text/css" rel="stylesheet" href="css/main.css"/>
  35. <link type="text/css" rel="stylesheet" href="css/setting.css"/>
  36. <title>PCD Studio</title>
  37. <script src="../public/js/jquery.min.js"></script>
  38. <script type="text/javascript">
  39. $(document).ready(function(){
  40. $(".flip").click(function(){
  41. $(this).next().slideToggle("slow");
  42. });
  43. });
  44. </script>
  45. </head>
  46. <body class="mainbody" id="mbody">
  47. <div class="main">
  48. <!-- content begin-->
  49. <div id="leftmenuinner">
  50. <div class="toolgroup1">
  51. </div>
  52. <div >
  53. <h1>Setting</h1>
  54. </div>
  55. <div class='toc' id='leftmenuinnerinner'>
  56. <ul class="setting_item">
  57. <li <?php echo $menu_active["account"]; ?>><a href="setting.php?item=account"><?php echo $_local->gui->account; ?></a></li>
  58. <li <?php echo $menu_active["general"]; ?>><a href="setting.php?item=general"><?php echo $_local->gui->general; ?></a></li>
  59. <li <?php echo $menu_active["local"]; ?>><a href="setting.php?item=local">Local</a></li>
  60. <li <?php echo $menu_active["studio"]; ?>><a href="setting.php?item=studio"><?php echo $_local->gui->studio; ?></a></li>
  61. <li <?php echo $menu_active["liberay"]; ?>><a href="setting.php?item=liberay"></a><?php echo $_local->gui->library; ?></li>
  62. <li <?php echo $menu_active["dictionary"]; ?>><a href="setting.php?item=dictionary"><?php echo $_local->gui->dictionary; ?></a></li>
  63. <li <?php echo $menu_active["userdict"]; ?>><a href="setting.php?item=userdict"><?php echo $_local->gui->userdict; ?></a></li>
  64. <li <?php echo $menu_active["term"]; ?>><a href="setting.php?item=term"><?php echo $_local->gui->dict_terms; ?></a></li>
  65. <li <?php echo $menu_active["message"]; ?>><a href="setting.php?item=message"><?php echo $_local->gui->message; ?></a></li>
  66. <li <?php echo $menu_active["album"]; ?>><a href="setting.php?item=album">Album</a></li>
  67. <li><a href="../admin/setting.php?item=account">Web Admin</a></li>
  68. </ul>
  69. </div>
  70. </div>
  71. <div id="setting_main_view" class="mainview">
  72. <div class="tool_bar">
  73. <div >
  74. <?php
  75. switch ($currSettingItem) {
  76. case "account":
  77. break;
  78. case "album":
  79. if (isset($_GET["id"])) {
  80. echo "<a href='setting.php?item=album'>返回</a>";
  81. }
  82. break;
  83. }
  84. ?>
  85. </div>
  86. <!--
  87. <div>
  88. <span>Language</span>
  89. <select id="id_language" name="menu" >
  90. <option value="en" >English</option>
  91. <option value="si" >සින‍්හල</option>
  92. <option value="zh-cn" >简体中文</option>
  93. <option value="zh-tw" >正體中文</option>
  94. </select>
  95. </div>-->
  96. </div>
  97. <?php
  98. switch ($currSettingItem) {
  99. case "dictionary":
  100. PDO_Connect("../" . FILE_DB_REF);
  101. $query = "select * from info where 1";
  102. $all = PDO_FetchAll($query);
  103. echo "<h2>参考字典 Refrence Dictionary</h2>";
  104. echo "<table>";
  105. echo "<th>选择</th><th>名称</th><th>语言</th><th>简介</th><th>下载</th><th></th>";
  106. foreach ($all as $dict) {
  107. echo "<tr>";
  108. echo "<td><input type='checkbox' checked /></td><td>{$dict["shortname"]}</td><td>{$dict["language"]}</td><td>{$dict["name"]}</td><td><button>下载</button></td><td><a>管理</a></td>";
  109. echo "</tr>";
  110. }
  111. echo "</table>";
  112. echo "<h2>系统字典System Dictionary</h2>";
  113. break;
  114. case "local":
  115. //语言文件
  116. if (isset($_GET["lang"])) {
  117. $_local = json_decode(file_get_contents("../public/lang/{$_GET["lang"]}.json"));
  118. } else {
  119. $_local = json_decode(file_get_contents("../public/lang/default.json"));
  120. }
  121. echo $_local->gui->pcd_studio;
  122. echo "<button>保存</button>";
  123. foreach ($_local as $x => $value) {
  124. echo "<div>";
  125. $counter = count($value);
  126. echo "<div class='flip'>{$x}({$counter})</div>";
  127. echo "<div class='panel' style='display:none;'>";
  128. if (is_object($value)) {
  129. $counter = 1;
  130. echo "<table>";
  131. foreach ($value as $row => $row_value) {
  132. echo "<tr>";
  133. echo "<td>$counter</td>";
  134. echo "<td>{$row}</td>";
  135. echo "<td><input type='input' value='{$row_value}' /></td>";
  136. echo "</tr>";
  137. $counter++;
  138. }
  139. echo "</table>";
  140. echo "<button>增加</button>";
  141. } else if (is_array($value)) {
  142. $counter = 1;
  143. echo "<table>";
  144. foreach ($value as $row) {
  145. if (is_object($row)) {
  146. echo "<tr>";
  147. echo "<td>$counter</td>";
  148. echo "<td style=\"text-align:right;\">{$row->id}</td>";
  149. echo "<td><input type='input' value='{$row->value}' /></td>";
  150. echo "</tr>";
  151. } else {
  152. echo "unkow<br>";
  153. }
  154. $counter++;
  155. }
  156. echo "</table>";
  157. echo "<button>增加</button>";
  158. } else {
  159. echo "unkow type";
  160. }
  161. echo "</div>";
  162. echo "</div>";
  163. }
  164. break;
  165. case "userdict": //用户字典管理
  166. break;
  167. case "term":
  168. break;
  169. case "account":
  170. echo "<h2>{$_local->gui->account}</h2>";
  171. echo "{$_local->gui->username}:$username<br />";
  172. echo "{$_local->gui->nick_name}:$nickname<br />";
  173. echo "{$_local->gui->e_mail}:$email<br />";
  174. echo "<a href='../ucenter/pwd_set.php'>{$_local->gui->change_password}</a><br>";
  175. echo "<a href='login.php?op=logout'>{$_local->gui->logout}</a>";
  176. break;
  177. case "album":
  178. $db_file = _FILE_DB_RESRES_INDEX_;
  179. PDO_Connect("$db_file");
  180. if (isset($_GET["id"])) {
  181. if (isset($_GET["power"])) {
  182. /*权限管理*/
  183. $query = "select * from 'album' where id='{$_GET["id"]}'";
  184. $album_info = PDO_FetchAll($query);
  185. if (count($album_info) > 0) {
  186. $query = "select * from 'album_power' where album_id='{$album_info[0]["id"]}'";
  187. $Fetch = PDO_FetchAll($query);
  188. echo "<h2>专辑权限管理</h2>";
  189. echo "<div>{$album_info[0]["title"]}-{$album_info[0]["author"]}</div>";
  190. echo "<form>";
  191. ?>
  192. <table>
  193. <tr>
  194. <th>序号</th><th>用户</th><th>密码</th><th>权限</th><th></th><th></th>
  195. </tr>
  196. <?php
  197. $sn = 1;
  198. foreach ($Fetch as $oneline) {
  199. echo "<tr>
  200. <td>{$sn}</td>
  201. <td>{$oneline["user_id"]}</td>
  202. <td><input type='input' value='{$oneline["password"]}' /></td>
  203. <td>
  204. <select>";
  205. foreach ($album_power as $x => $value) {
  206. if ($oneline["power"] == $x) {
  207. $select = "selected";
  208. } else {
  209. $select = "";
  210. }
  211. echo "<option value='{$x}' {$select}>{$value}</option>\r\n";
  212. }
  213. echo "</select>
  214. </td>
  215. <td><button>修改</button></td>
  216. <td><button>删除</button></td>
  217. </tr>";
  218. $sn++;
  219. }
  220. echo "<input type='submit' />";
  221. echo "</form>";
  222. }
  223. } else {
  224. $query = "select * from 'album' where id='{$_GET["id"]}'";
  225. $Fetch = PDO_FetchAll($query);
  226. if (count($Fetch) > 0) {
  227. echo "<h2>{$Fetch[0]["title"]}</h2>";
  228. echo "<form>";
  229. foreach ($Fetch[0] as $x => $value) {
  230. echo "<div><span>{$x}</span><span><input type='input' value='{$value}' /></span></div>";
  231. }
  232. echo "<input type='submit' />";
  233. echo "</form>";
  234. }
  235. }
  236. } else {
  237. echo "<h2>My Album</h2>";
  238. $query = "select * from 'album' where owner='{$UID}'";
  239. $Fetch = PDO_FetchAll($query);
  240. ?>
  241. <table>
  242. <tr>
  243. <th>Book</th><th>Title</th><th>Author</th><th>语言</th><th>媒体</th><th></th><th></th>
  244. </tr>
  245. <?php
  246. foreach ($Fetch as $album) {
  247. echo "<tr><td>{$album["book"]}</td>
  248. <td>{$album["title"]}</td>
  249. <td>{$album["author"]}</td>
  250. <td>{$album["language"]}</td>
  251. <td>{$album["type"]}</td>
  252. <td><a href=\"album.php?op=show_info&album_id={$album["id"]}\" target='_blank'>详情</a></td>
  253. <td><a href=\"album.php?op=export&album_id={$album["id"]}\" target='_blank'>导出</a></td>
  254. </tr>";
  255. }
  256. echo "</table>";
  257. }
  258. break;
  259. }
  260. ?>
  261. </div>
  262. </div>
  263. </body>
  264. </html>