diff --git a/Connections/SQL-sample.php b/Connections/SQL-sample.php index 1bac2bb..56cd9c2 100644 --- a/Connections/SQL-sample.php +++ b/Connections/SQL-sample.php @@ -1,4 +1,36 @@ +Copyright (C) 2012-2016 Secret Center開發團隊 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, version 3. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. +*/ + if(!@$includepath){ set_include_path('include/'); } @@ -13,4 +45,3 @@ global $SQL; $SQL = new Database($hostname_SQL,$username_SQL,$password_SQL,$database_SQL); $SQL->query("SET NAMES 'utf8'"); -?> \ No newline at end of file diff --git a/Connections/SQL.php b/Connections/SQL.php index ea6b520..b266a75 100644 --- a/Connections/SQL.php +++ b/Connections/SQL.php @@ -1,11 +1,43 @@ +Copyright (C) 2012-2016 Secret Center開發團隊 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, version 3. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. +*/ + if(!@$includepath){ set_include_path('include/'); } error_reporting(E_ALL); require_once('database.php'); -$database_SQL = "sc8.0";//資料庫名稱 +$database_SQL = "center";//資料庫名稱 $username_SQL = "root";//連線帳號 $password_SQL = "usbw";//連線密碼 $hostname_SQL = "127.0.0.1";//MySQL伺服器 @@ -13,4 +45,3 @@ global $SQL; $SQL = new Database($hostname_SQL,$username_SQL,$password_SQL,$database_SQL); $SQL->query("SET NAMES 'utf8'"); -?> \ No newline at end of file diff --git a/account.php b/account.php index f39b6fc..34bcbc7 100644 --- a/account.php +++ b/account.php @@ -1,4 +1,36 @@ +Copyright (C) 2012-2016 Secret Center開發團隊 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, version 3. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. +*/ + require_once('Connections/SQL.php'); require_once('config.php'); require_once('include/view.php'); @@ -8,112 +40,108 @@ exit; } -$view = new View('view/new_theme.html','include/nav.php',$center['site_name'],'我的帳號'); -$view->addScript("https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"); -$view->addScript("include/js/channel.js"); -$view->addScript("include/js/notice.js"); -$view->addScript("include/js/jquery.validate.js"); - -$member = sc_get_member_data($_SESSION['Center_Username']); - +$_member = sc_get_result("SELECT * FROM `member` WHERE `id` = '%d'",array($_SESSION['Center_Id'])); if(isset($_POST['email'])&& filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)){ if($_POST['web_site']!='' && !filter_var($_POST['web_site'], FILTER_VALIDATE_URL)){ - $_web_site=$member['row']['web_site']; + $_web_site=$_member['row']['web_site']; }else{ $_web_site=$_POST['web_site']; } if($_POST['password'] == ''){ - $pass = $member['row']['password']; - } - else { - $pass = sc_password($_POST['password'], $member['row']['name']); + $_password = $_member['row']['password']; + }else { + $_password = sc_password($_POST['password'], $_member['row']['username']); } - $SQL->query("UPDATE member SET password = '%s', email = '%s', web_site = '%s' WHERE name = '%s'",array( - $pass, - $_POST['email'], - $_web_site, - $_SESSION['Center_Username'] - )); + $SQL->query("UPDATE `member` SET `password` = '%s', `email` = '%s', `web_site` = '%s' WHERE `id` = '%d'",array($_password,$_POST['email'],$_web_site,$_SESSION['Center_Id'])); header("Location: account.php?ok"); } + + +$view = new View('include/theme/default.html','include/nav.php',NULL,$center['site_name'],'我的帳號'); +$view->addScript("include/js/notice.js"); ?> - -
修改成功!
-

我的帳號

-
-
- -

修改頭像

+ +
+ -
-
-
- -
+
+ +
+ +
+

+
-
- -
- +
+ +
+
-
- -
- +
+ +
+
-
- -
- +
+ +
+
-
- -
- +
+ +
+
-
- -
+
+ +
+

+
-
- -
+
+ +
+

+
-
- -
+
+ +
+

+
-
-
- +
+
+
-
-
- -
+ +
render(); diff --git a/admin/chat.php b/admin/chat.php index 0ae1d60..ae6e2f3 100644 --- a/admin/chat.php +++ b/admin/chat.php @@ -1,4 +1,36 @@ +Copyright (C) 2012-2016 Secret Center開發團隊 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, version 3. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. +*/ + set_include_path('../include/'); $includepath = true; @@ -7,37 +39,32 @@ require_once('view.php'); if(!isset($_SESSION['Center_Username']) or $_SESSION['Center_UserGroup'] != 9){ - header("Location: ../index.php"); - exit; + header("Location: ../index.php"); + exit; } -if(isset($_GET['del']) && $_GET['del'] == 'public'){ - $delete_data = "TRUNCATE TABLE chat"; - $SQL->query($delete_data); +if(isset($_GET['del'])){ + $SQL->query("TRUNCATE TABLE `chat`"); } -$view = new View('../view/new_theme.html','../include/admin_nav.php',$center['site_name'],'聊天管理',true); -$view->addScript("https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"); -$view->addScript("../include/js/channel.js"); +$view = new View('theme/admin_default.html','admin/nav.php','',$center['site_name'],'聊天室',true); +$view->addScript("../include/js/chat.js"); ?> -
-

聊天室管理

- 清除所有公共聊天紀錄 -
-
+ +

+ 清除所有聊天紀錄 +

+
render(); + $view->render(); ?> \ No newline at end of file diff --git a/admin/editconfig.php b/admin/editconfig.php index 4f9bc7a..fa7848a 100644 --- a/admin/editconfig.php +++ b/admin/editconfig.php @@ -1,4 +1,36 @@ +Copyright (C) 2012-2016 Secret Center開發團隊 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, version 3. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. +*/ + set_include_path('../include/'); $includepath = true; @@ -8,7 +40,7 @@ if(!isset($_SESSION['Center_Username']) or $_SESSION['Center_UserGroup'] != 9){ header("Location: ../index.php"); - exit; + exit; } if(isset($_POST['site_name'])){ @@ -17,10 +49,10 @@ }else{ $register=0; } - if(isset($_POST['img_tiny'])){ - $img_tiny=1; + if(isset($_POST['compress'])){ + $compress=1; }else{ - $img_tiny=0; + $compress=0; } if(isset($_POST['forum_captcha'])){ $forum_captcha=1; @@ -33,12 +65,10 @@ addslashes($_POST['site_name']), $register, $_POST['mail'], - implode('","',explode(',',$_POST['limitedext'])), - abs($_POST['max_files']), - abs($_POST['max_size']), abs($_POST['public']), abs($_POST['avatar_max_size']), - $img_tiny, + $compress, + abs($_POST['quality']), $forum_captcha, abs($_POST['forum_limit']), sc_xss_filter($_POST['member_message']) @@ -48,139 +78,122 @@ require('../config.php'); } -$view = new View('../view/new_theme.html','../include/admin_nav.php',$center['site_name'],'系統設定',true); -$view->addScript("https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"); -$view->addScript("../include/js/channel.js"); -$view->addScript("../include/js/jquery.validate.js"); +$view = new View('theme/admin_default.html','admin/nav.php','',$center['site_name'],'系統設定',true); ?> - -
- -
編輯成功!
- -

系統設定

-
+ +
主要 -
- -
- +
+ +
+
-
- -
- > +
+ +
+
-
- -
- +
+ +
+
-
- -
- +
+ +
+
聊天室 -
- -
-
- - +
+ +
+
+ +
- 文件夾 -
- -
- "> -
-
-
- -
-
- - + 頭貼 +
+ +
+
+ + KB
-
- -
-
- - KB -
+
+ +
+
-
-
- 頭像 -
- -
-
- - KB -
+
+ +
+

+ % + +

-
-
- -
- > +
+ 範圍1~100,越高品質越好
論壇 -
- -
- > +
+ +
+
-
- -
-
- - +
+ +
+
+ +
- 每頁所顯示的帖子/回覆數量 +
+
+ 每頁所顯示的帖子/回覆數量
-
- +
+
+ +
-
render(); ?> \ No newline at end of file diff --git a/admin/editcss.php b/admin/editcss.php index d1c5039..d9c3381 100644 --- a/admin/editcss.php +++ b/admin/editcss.php @@ -1,4 +1,36 @@ +Copyright (C) 2012-2016 Secret Center開發團隊 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, version 3. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. +*/ + set_include_path('../include/'); $includepath = true; @@ -11,93 +43,96 @@ exit; } -if(isset($_POST['body_font_size'])){ +if(isset($_POST['body_font-size'])){ + $_put_array=array( + addslashes($_POST['body_font-size']), + addslashes($_POST['body_background-color']), + addslashes($_POST['body_line-height']), + addslashes($_POST['main_width']), + addslashes($_POST['chat_color']), + addslashes($_POST['chat_background-color']) + ); + $_css='../style.css'; $_css_sample='../style-sample.css'; - $put_css = vsprintf(str_replace('%;','@',file_get_contents($_css_sample)),array( - addslashes($_POST['body_font_size']), - addslashes($_POST['body_background_color']), - addslashes($_POST['body_line_height']), - addslashes($_POST['container_width']) - )); + + $config='../include/admin/cssconfig.php'; + $config_sample='../include/admin/cssconfig-sample.php'; + + $put_css = vsprintf(str_replace('%;','@',file_get_contents($_css_sample)),$_put_array); + $put_config = vsprintf(file_get_contents($config_sample),$_put_array); + file_put_contents($_css,str_replace('@','%;',$put_css)); + file_put_contents($config,$put_config); + $_GET['ok']=true; } - -$view = new View('../view/new_theme.html','../include/admin_nav.php',$center['site_name'],'網站樣式',true); -$view->addScript("https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"); -$view->addScript("../include/js/channel.js"); -$view->addScript("../include/js/jquery.validate.js"); +require_once('../include/admin/cssconfig.php'); +$view = new View('theme/admin_default.html','admin/nav.php','',$center['site_name'],'網站樣式',true); ?> - -
修改成功!
-

網站樣式

+

提醒您,若修改後網站樣式沒有變更,請清除瀏覽器快取後再重新整理頁面

-
+
主要 -
- -
-
- - px +
+ +
+
+ + px
-
- -
- - +
+ +
+
-
- -
-
- - px +
+ +
+
+ + px
-
-
- -
-
- - % +
+ +
+
+ + %
-
- +
+ 聊天室 +
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
-
render(); ?> \ No newline at end of file diff --git a/admin/forum.php b/admin/forum.php index 609072c..ca2b2c6 100644 --- a/admin/forum.php +++ b/admin/forum.php @@ -1,4 +1,36 @@ +Copyright (C) 2012-2016 Secret Center開發團隊 + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, version 3. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. +*/ + set_include_path('../include/'); $includepath = true; @@ -12,27 +44,30 @@ } if(isset($_POST['del']) && $_POST['del'] != ''){ - $del_sql[] = sprintf("DELETE FROM forum WHERE id IN (%s)",implode(",",$_POST['del'])); - $del_sql[] = sprintf("DELETE FROM forum_reply WHERE post IN (%s)",implode(",",$_POST['del'])); - foreach($del_sql as $val){ + $_del[] = sprintf("DELETE FROM `forum` WHERE `id` IN (%s)",implode(",",$_POST['del'])); + $_del[] = sprintf("DELETE FROM `forum_reply` WHERE `post_id` IN (%s)",implode(",",$_POST['del'])); + foreach($_del as $val){ $SQL->query($val); } header("Location: forum.php?del&fid=".$_GET['fid']); }elseif(isset($_GET['delblock']) && abs($_GET['delblock']) != ''){ - $_post_query=$SQL->query("SELECT `id` FROM `forum` WHERE block = '%d'",array(abs($_GET['delblock']))); - if($_post_query->num_rows>0){ - $_post =$_post_query->fetch_assoc(); - $del_sql[] = sprintf("DELETE FROM forum_reply WHERE post IN (%s)",implode(",",$_post)); + $_post=sc_get_result("SELECT `id` FROM `forum` WHERE `block` = '%d'",array(abs($_GET['delblock']))); + if($_post['num_rows']>0){ + do{ + $_list[]=$_post['row']['id']; + }while($_post['row']=$_post['query']->fetch_assoc()); + + $_del[] = sprintf("DELETE FROM `forum_reply` WHERE `post_id` IN (%s)",implode(",",$_list)); } - $del_sql[] = sprintf("DELETE FROM forum_block WHERE id =%d",abs($_GET['delblock'])); - $del_sql[] = sprintf("DELETE FROM forum WHERE block = %d",abs($_GET['delblock'])); - foreach($del_sql as $val){ + $_del[] = sprintf("DELETE FROM `forum_block` WHERE `id` =%d",abs($_GET['delblock'])); + $_del[] = sprintf("DELETE FROM `forum` WHERE `block` = %d",abs($_GET['delblock'])); + foreach($_del as $val){ $SQL->query($val); } header("Location: forum.php?del"); }elseif(isset($_GET['newblock'])&&sc_namefilter($_POST['blockname'])!=''){ - sc_add_forum_block(sc_namefilter($_POST['blockname']),1); + sc_add_forum_block(sc_namefilter($_POST['blockname'])); }elseif(isset($_GET['edit']) &&abs($_GET['edit'])!='' && isset($_POST['blockname'])&&isset($_POST['position'])){ $SQL->query("UPDATE `forum_block` SET `blockname` = '%s',`position` = '%d' WHERE `id` = '%d'",array(sc_namefilter($_POST['blockname']),abs(intval($_POST['position'])),abs($_GET['edit']))); @@ -40,200 +75,198 @@ } - if(isset($_GET['fid'])){ - if($SQL->query("SELECT * FROM `forum_block` WHERE `id`='%d'",array(abs(intval($_GET['fid']))))->num_rows<1){ + $_block = sc_get_result("SELECT * FROM `forum_block` WHERE `id`='%d'",array(abs(intval($_GET['fid'])))); + + if($_block['num_rows']<1){ header("Location: forum.php"); } + $limit_row=$center['forum']['limit']; + if(isset($_GET['page'])){ $limit_start = abs(intval(($_GET['page']-1)*$limit_row)); - $post_sql = sprintf("SELECT * FROM `forum` WHERE `block`='%d' ORDER BY `ptime` DESC LIMIT %d,%d",abs(intval($_GET['fid'])),$limit_start,$limit_row); + $_forum = sc_get_result("SELECT * FROM `forum` WHERE `block`='%d' ORDER BY `mktime` DESC LIMIT %d,%d",array($_block['row']['id'],$limit_start,$limit_row)); } else { $limit_start=0; - $post_sql = sprintf("SELECT * FROM `forum` WHERE `block`='%d' ORDER BY `ptime` DESC LIMIT %d,%d",abs(intval($_GET['fid'])),$limit_start,$limit_row); + $_forum = sc_get_result("SELECT * FROM `forum` WHERE `block`='%d' ORDER BY `mktime` DESC LIMIT %d,%d",array($_block['row']['id'],$limit_start,$limit_row)); } - $_block = $SQL->query("SELECT * FROM `forum_block` WHERE `id`='%d'",array(abs(intval($_GET['fid']))))->fetch_assoc(); }else{ - $post_sql = sprintf("SELECT * FROM `forum_block` ORDER BY `position` ASC"); + $_forum = sc_get_result("SELECT * FROM `forum_block` ORDER BY `position` ASC"); } -$post = $SQL->query($post_sql); -$post_row = $post->fetch_assoc(); -$post_num_rows = $post->num_rows; - -$view = new View('../view/new_theme.html','../include/admin_nav.php',$center['site_name'],'論壇管理',true); -$view->addScript("https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"); -$view->addScript("../include/js/channel.js"); +$view = new View('theme/admin_default.html','admin/nav.php','',$center['site_name'],'論壇管理',true); ?> -
- +
刪除成功!
-

- -
沒有帖子!
- -
- - - - - - - - - - - - query("SELECT * FROM `forum_reply` WHERE `post`='%d' ORDER BY `ptime` DESC",array($post_row['id'])); - $_post_reply_row=$_post_reply_query->fetch_assoc(); - $_post_reply_num_rows = $_post_reply_query->num_rows; - ?> - - - - - - - - fetch_assoc()); ?> - -
- - 帖子作者/發表時間回覆最後回覆
- - - - 1){ ?> -    - - - - -
-
- - - 0){ - - echo '
'.$_post_reply_row['posted'].'
'.date('Y-m-d H:i',strtotime($_post_reply_row['ptime'])).'
'; - }else{ - echo '無'; - } - ?> - -
-query("SELECT * FROM forum WHERE block = '%d'",array($_block['id']))->num_rows; - -$pageTotal=ceil($nav_num_rows / $limit_row); - -if($pageTotal > 1){ - echo '