]> 4ch.mooo.com Git - test.git/blobdiff - yotsubanome.php
modified: lib/lib_css.php
[test.git] / yotsubanome.php
index 4bbce4b278e7067fb7d827ee7f72944df35e4212..0b94d01b875c0b3574b768fd6900551d9d2f4479 100755 (executable)
@@ -2,7 +2,7 @@
 /********************************
     四葉の芽画像掲示板
 
-yotsubanome.php*/$ver = "v0.7.8.1.0002 β lot.100404";/*
+yotsubanome.php*/$ver = "v0.7.8.1.0004 β lot.100404";/*
 
 これがコアシステムです。 四葉の芽スクリプト
 このスクリプトはレッツPHP!<http://php.s3.to/>のgazou.phpを改造したものです。
@@ -52,14 +52,12 @@ PHP 4.4.9 或更高版本並開啟 GD 和 Zlib 支援,如支援 ImageMagick 
 說明條目可資參考。
 */
 
-//error_reporting(E_ALL); // show all errors for debugging
-
 /* Enviorment Settings */
 // Do not change unless you renamed the directories
 define("PHP_DIRECTORY", '../test/'); // yotsubanome "C:\windows\system\"
 
 /* Include */
-include_once(PHP_DIRECTORY.'env.php'); // Enviorment Settings
+include_once(PHP_DIRECTORY.'lib/lib_env.php'); // Enviorment Settings
 include_once(PHP_DIRECTORY.'config.php'); // 引入設定檔
 include_once(PHP_DIRECTORY.'lib/lib_language.php'); // 引入語系
 include_once(PHP_DIRECTORY.'lib/lib_common.php'); // 引入共通函式檔案
@@ -71,9 +69,10 @@ include_once(PHP_DIRECTORY.'lib/lib_pte.php'); // 引入PTE外部函式庫
 $PTE = new PTELibrary(TEMPLATE_FILE); // PTE Library
 
 if(version_compare(PHP_VERSION, '5.0.0', '>=')){ // PHP5+
-        set_error_handler('PMCCore_errorHandler', E_ERROR | E_WARNING | E_USER_ERROR); // Handle Errors
+       set_error_handler('PMCCore_errorHandler', E_ERROR | E_WARNING | E_USER_ERROR); // Handle Errors
 }else{
-        set_error_handler('PMCCore_errorHandler');
+       //---- set_error_handler('PMCCore_errorHandler');
+       error_reporting(E_ALL); // show all errors for debugging
 }
 
 /* Lockdown [prevents posting] */
@@ -127,7 +126,9 @@ function updatelog($resno=0,$page_num=-1,$single_page=false){
                }else{ // 討論串分頁模式 (PHP動態輸出一頁份)
                        $threads_count = $PIO->threadCount(); // 討論串個數
                        //---- if($page_num < 0 || ($page_num * PAGE_DEF) >= $threads_count) error(_T('page_not_found')); // $page_num超過範圍
-                       if($threads_count = 1 && $page_num < 0 || ($page_num < 0 || ($page_num * PAGE_DEF) >= $threads_count)) error(_T('page_not_found')); // $page_num超過範圍
+                       //++++---- Page 0 bug fix
+                       if($page_num!=0) if($page_num < 0 || ($page_num * PAGE_DEF) >= $threads_count) error(_T('page_not_found')); // $page_num超過範圍
+                       //++++----
                        $page_start = $page_end = $page_num; // 設定靜態頁面編號
                        $threads = $PIO->fetchThreadList($page_num * PAGE_DEF, PAGE_DEF); // 取出分頁後的討論串首篇列表
                        $PMS->useModuleMethods('ThreadOrder', array($resno,$page_num,$single_page,&$threads)); // "ThreadOrder" Hook Point
@@ -188,6 +189,9 @@ function updatelog($resno=0,$page_num=-1,$single_page=false){
 
        $PMS->useModuleMethods('ThreadFront', array(&$pte_vals['{$THREADFRONT}'], $resno)); // "ThreadFront" Hook Point
        $PMS->useModuleMethods('ThreadRear', array(&$pte_vals['{$THREADREAR}'], $resno)); // "ThreadRear" Hook Point
+       //++++---- Page 0 bug fix
+       if($tree_count==0 && $page_end==-1) $page_end = 0;
+       //++++----
 
        // 生成靜態頁面一頁份內容
        for($page = $page_start; $page <= $page_end; $page++){
@@ -267,11 +271,10 @@ function updatelog($resno=0,$page_num=-1,$single_page=false){
                $pte_vals['{$PAGENAV}'] .= '<br style="clear: left;" />
 </div>';
                $dat .= $PTE->ParseBlock('MAIN', $pte_vals);
-               foot($dat);
+               foot($dat); // the foot is a special core function wwww --sparky4
 
                // 存檔 / 輸出
-               //---- if($single_page || ($page_num == -1 && !$resno)){ // 靜態快取頁面生成
-               if($threads_count = 1 && $page_num < 0 || ($single_page || ($page_num == -1 && !$resno))){ // 靜態快取頁面生成
+               if($single_page || ($page_num == -1 && !$resno)){ // 靜態快取頁面生成
                        if($page==0) $logfilename = PHP_SELF2;
                        else $logfilename = $page.PHP_EXT;
                        $fp = fopen($logfilename, 'w');
@@ -684,6 +687,7 @@ function regist(){
                $name = str_replace('&'.TRIP_KEY, '&amp;'.TRIP_KEY, $name); // 避免 &#xxxx; 後面被視為 Trip 留下 & 造成解析錯誤
        }
        // End of Tripcode area--------------------------------------------------------------------------
+
        // 內文修整
        if((strlen($com) > COMM_MAX) && !$is_admin) error(_T('regist_commenttoolong'), $dest);
        $com = CleanStr($com, $is_admin); // 引入$is_admin參數是因為當管理員キャップ啟動時,允許管理員依config設定是否使用HTML
@@ -1108,9 +1112,8 @@ _ADMINEOF_;
 </html>');
 }
 
-////////////////
-// manage_css //
-////////////////
+/* manage_css */
+// http://www.magmagateau.com/fuukaba/ is the source of the code below
 function manage_css(){
        global $PMS, $language;
        $order = array(); $line = '';
@@ -1182,23 +1185,23 @@ function manage_css(){
 
                // Success messages
                $action = (file_exists($style_dat)) ? _t('admin_updated') : _t('admin_created');
-               $delete = (@unlink(CSS_DIR.CSVSS)) ? ' - <span class="warning">'.str_replace('[file]', CSS_DIR.CSVSS, _t('admin_deleted')).'</span>' : false;
+               //---- $delete = (@unlink(CSS_DIR.CSVSS)) ? ' - <span class="warning">'.str_replace('[file]', CSS_DIR.CSVSS, _t('admin_deleted')).'</span>' : false;
                $fp = fopen($style_dat, 'w+');
                set_file_buffer($fp, 0);
                rewind($fp);
                fputs($fp, $line);
                fclose($fp);
                @chmod($style_dat, 0666);
-               echo '<div class="bar_managecss">'.str_replace('[file]', $style_dat, _t('admin_updated')).$delete.'</div>';
+               echo '<div class="bar_managecss">'.str_replace('[file]', $style_dat, _t('admin_updated'))./*----$delete.*/'</div>';
        }
 
        // Editing messages
        if(file_exists(DATA_DIR.CSV_SS)){
                $style_data = DATA_DIR.CSV_SS;
                $style_mode = _t('admin_editing');
-       }else{
-               $style_data = CSS_DIR.CSVSS;
-               $style_mode = _t('admin_imported');
+       //---- }else{
+               //---- $style_data = CSS_DIR.CSVSS;
+               //---- $style_mode = _t('admin_imported');
        }
        echo '<div class="banner"><table width="100%"><tr><th class="bar_managecss">
 '.str_replace('[file]', $style_data, $style_mode).'
@@ -1236,26 +1239,26 @@ function manage_css(){
        }
 
        // Read data from R3 DAT
-       else if(file_exists(CSS_DIR.CSVSS)){
-               $style_data = CSS_DIR.CSVSS;
-               $lines = explode("\n", file_get_contents($style_data));
-               $j = 0;
-               foreach($lines as $null => $line){ // Line has data, or line is not commented out
-                       if(substr($line, 0, 2) != '//' && $line != ''){
-                               $bits = explode('[*]', $line);
-                               $j++;
-                               $style_name = $bits[0];
-                               $style_path = CSS_DIR.$bits[2];
-                               if(file_exists($style_path)){
-                                       $style_short = $bits[1];
-                                       if($bits[3]) $style_rel = ' checked="checked"';
-                                       else $style_rel = false;
-                                       $class = ($j % 2) ? 'row1' : 'row2'; // BG colour
-                                       echo '<tr class="'.$class.'"><td align="left" colspan="2"><label><input name="default" type="radio"'.$style_rel.' value="'.$style_name.'" /> '.$style_path.'</label><input type="hidden" name="path['.$style_name.']" value="'.$bits[2].'" /></td><td align="left"><input name="names['.$style_name.']" value="'.$style_name.'" size="25" /></td><td align="left"><input name="short['.$style_name.']" value="'.$style_short.'" size="5" /></td><td align="left"><input name="order['.$style_name.']" size="2" value="'.$j.'" /></td></tr>';
-                               }
-                       }
-               }
-       }
+       //---- else if(file_exists(CSS_DIR.CSVSS)){
+               //---- $style_data = CSS_DIR.CSVSS;
+               //---- $lines = explode("\n", file_get_contents($style_data));
+               //---- $j = 0;
+               //---- foreach($lines as $null => $line){ // Line has data, or line is not commented out
+                       //---- if(substr($line, 0, 2) != '//' && $line != ''){
+                               //---- $bits = explode('[*]', $line);
+                               //---- $j++;
+                               //---- $style_name = $bits[0];
+                               //---- $style_path = CSS_DIR.$bits[2];
+                               //---- if(file_exists($style_path)){
+                                       //---- $style_short = $bits[1];
+                                       //---- if($bits[3]) $style_rel = ' checked="checked"';
+                                       //---- else $style_rel = false;
+                                       //---- $class = ($j % 2) ? 'row1' : 'row2'; // BG colour
+                                       //---- echo '<tr class="'.$class.'"><td align="left" colspan="2"><label><input name="default" type="radio"'.$style_rel.' value="'.$style_name.'" /> '.$style_path.'</label><input type="hidden" name="path['.$style_name.']" value="'.$bits[2].'" /></td><td align="left"><input name="names['.$style_name.']" value="'.$style_name.'" size="25" /></td><td align="left"><input name="short['.$style_name.']" value="'.$style_short.'" size="5" /></td><td align="left"><input name="order['.$style_name.']" size="2" value="'.$j.'" /></td></tr>';
+                               //---- }
+                       //---- }
+               //---- }
+       //---- }
 
        $j++; $class = ($j % 2) ? 'row1' : 'row2';