]> 4ch.mooo.com Git - test.git/blobdiff - yotsubanome.php
modified: yotsubanome.php
[test.git] / yotsubanome.php
index 297eab5edbf25072fcf6eebb2e57dbace770ebc1..021abc31b4285f2ba1fc018d5eda4e8dece5f1f2 100755 (executable)
@@ -303,7 +303,7 @@ function updatelog($resno=0,$page_num=-1,$single_page=false){
 
 /* 輸出討論串架構 */
 function arrangeThread($PTE, $tree, $tree_cut, $posts, $hiddenReply, $resno=0, $arr_kill, $arr_old, $kill_sensor, $old_sensor, $showquotelink=true, $adminMode=false, $hiddenImage, $hiddenImagP, $hiddenImagRP, $posts_img){
-       global $PIO, $FileIO, $PMS, $language;
+       global $config, $PIO, $FileIO, $PMS, $language;
 
        $thdat = ''; // 討論串輸出碼
        $posts_count = count($posts); // 迴圈次數
@@ -342,7 +342,11 @@ function arrangeThread($PTE, $tree, $tree_cut, $posts, $hiddenReply, $resno=0, $
                // Tripcode indicator // t++ //++++----
                // This may be a blob of code but it apparently works >< please help me here
                $tripkeycount = substr_count($name, TRIP_KEY);
-               if(ALLOW_NONAME==2){ // 強制砍名
+               if($config['ALLOW_NONAME']==3){
+                       if($name || $tripkeycount) $name = $config['DEFAULT_NONAME'];
+                       if($email) $now = "<a href=\"mailto:$email\" class=\"linkmail\">$now</a>";
+               }else
+               if($config['ALLOW_NONAME']==2){ // 強制砍名
                        if($tripkeycount==1) $name = preg_match('/(\\'.TRIP_KEY.'.{10})/', $name, $matches) ? '<span class="postertrip">'.$matches[1].'</span>' : '';
                        if($tripkeycount==2) $name = preg_match('/(\\'.TRIP_KEY.TRIP_KEY.'.{16})/', $name, $matches) ? '<span class="postertrip">'.$matches[1].'</span>' : '';
                        if($tripkeycount==3) $name = preg_match('/(\\'.TRIP_KEY.'.{32})/', $name, $matches) ? '<span class="postertrip">'.$matches[1].'</span>' : '';
@@ -357,8 +361,8 @@ function arrangeThread($PTE, $tree, $tree_cut, $posts, $hiddenReply, $resno=0, $
                if(AUTO_LINK) $com = auto_link($com);
                $com = quoteLight($com);
                $com = quoteLight2($com);
-               if(!$resno && MAX_LINES) list($com, $abbreviated) = abbreviate($com, MAX_LINES);
-               if(isset($abbreviated) && $abbreviated && MAX_LINES) $com .= '<br /><span class="abbrev">'._T('long_comment').'<a href="'.PHP_SELF.'?res='.$tree[0].'#r'.$no.'">'._T('long_here').'</a>'._T('long_see').'</span>';
+               if(!$resno && $config['LINE_NUMBER']) list($com, $abbreviated) = abbreviate($com, $config['LINE_NUMBER']);
+               if(isset($abbreviated) && $abbreviated && $config['LINE_NUMBER']) $com .= '<br /><span class="abbrev">'._T('long_comment').'<a href="'.PHP_SELF.'?res='.$tree[0].'#r'.$no.'">'._T('long_here').'</a>'._T('long_see').'</span>';
 
                if(USE_QUOTESYSTEM && $i){ // 啟用引用瀏覽系統
                        if(preg_match_all('/((?:&gt;|>)+)(?:No\.)?(\d+)/i', $com, $matches, PREG_SET_ORDER)){ // 找尋>>No.xxx
@@ -625,7 +629,7 @@ function regist(){
        if($name){
                // 名稱修整
                $name = str_replace(TRIP_KEY, TRIP_KEY_FAKE, $name); // 防止トリップ偽造
-               $name = str_replace(CAP_SUFFIX, CAP_SUFFIX_FAKE, $name); // 防止管理員キャップ偽造
+               $name = str_replace($config['CAP.SUFFIX'], $config['CAP.SUFFIX.FAKE'], $name); // 防止管理員キャップ偽造
                $name = str_replace("\r\n", '', $name);
                $nameOri = $name; // 名稱
                // トリップ
@@ -672,10 +676,10 @@ function regist(){
                        //----"</b></font><font class=\"postertrip\">".
                        $name .= $metrip;
                }
-               if(CAP_ENABLE && preg_match('/(.*?)[##](.*)/u', $email, $aregs)){ // 管理員キャップ(Cap)機能
+               if($config['CAP.ENABLE'] && preg_match('/(.*?)[##](.*)/u', $email, $aregs)){ // 管理員キャップ(Cap)機能
                        $acap_name = $nameOri; $acap_pwd = strtr($aregs[2], array('&amp;'=>'&'));
-                       if($acap_name==CAP_NAME && $acap_pwd==CAP_PASS){
-                               $name = '<span class="admin_cap">'.$name.CAP_SUFFIX.'</span>';
+                       if($acap_name==$config['CAP.NAME'] && $acap_pwd==$config['CAP.PASSWORD']){
+                               $name = '<span class="admin_cap">'.$name.$config['CAP.SUFFIX'].'</span>';
                                $is_admin = true;
                                $email = $aregs[1]; // 去除 #xx 密碼
                        }
@@ -697,15 +701,15 @@ function regist(){
        $com = str_replace("\n", '', $com); // 若還有\n換行字元則取消換行
        // 預設的內容
        if(!$name || ereg("^[ | |]*$", $name)){
-               if(ALLOW_NONAME) $name = DEFAULT_NONAME;
+               if($config['ALLOW_NONAME']) $name = $config['DEFAULT_NONAME'];
                else error(_T('regist_withoutname'), $dest);
        }
        if(!$sub || ereg("^[ | |]*$", $sub)){
-               if(ALLOW_NOSUB) $sub = DEFAULT_NOTITLE;
+               if($config['ALLOW_NOSUB']) $sub = $config['DEFAULT_NOTITLE'];
                else error(_T('regist_withoutsubject'), $dest);
        }
        if(!$com || ereg("^[ | |\t]*$", $com)){
-               if(ALLOW_NOSUB) $com = DEFAULT_NOCOMMENT;
+               if($config['ALLOW_NOCOM']) $com = $config['DEFAULT_NOCOMMENT'];
                else error(_T('regist_withoutcomment'), $dest);
        }
        // 修整標籤樣式
@@ -716,15 +720,13 @@ function regist(){
        if($up_incomplete) $com .= '<br /><br /><span class="warn_txt">'._T('notice_incompletefile').'</span>'; // 上傳附加圖檔不完全的提示
 
        // 密碼和時間的樣式 
-       if($pwd=='') if(ALLOW_NOPASS) error(_T('regist_withoutpassword'), $dest); else $pwd = ($pwdc=='') ? substr(rand(),0,8) : $pwdc;
+       if($pwd=='') if($config['ALLOW_NOPASS']) error(_T('regist_withoutpassword'), $dest); else $pwd = ($pwdc=='') ? substr(rand(),0,8) : $pwdc;
        $pass = $pwd ? substr(md5($pwd), 2, 8) : '*'; // 生成真正儲存判斷用的密碼
        $youbi = array(_T('sun'),_T('mon'),_T('tue'),_T('wed'),_T('thu'),_T('fri'),_T('sat'));
 //---- $yd = $youbi[gmdate('w', $time+TIME_ZONE*60*60)];
        $yd = $youbi[date('w', $tome)];
 //---- $now = gmdate('y/m/d', $time+TIME_ZONE*60*60).'('.(string)$yd.')'.gmdate('H:i', $time+TIME_ZONE*60*60);
-       if(!EN_SEC)
-               $now = date(DATE_FORMAT, $tome).'('.(string)$yd.')'.date('H:i', $tome);
-               else $now = date(DATE_FORMAT, $tome).'('.(string)$yd.')'.date('H:i:s', $tome);
+       $now = date($config['DATE_FORMAT'], $tome).'('.(string)$yd.')'.date($config['TIME_FORMAT'], $tome);
 
 //---- if(DISP_ID){ // 顯示ID
 //----         if($email && DISP_ID==1) $now .= ' ID:????';
@@ -732,7 +734,7 @@ function regist(){
 //---- }
        if(DISP_ID){ // 顯示ID
                if($email&&DISP_ID==1) $now .= " ID:????";
-               else $now .= " ID:".substr(crypt(md5(getREMOTE_ADDR().IDSEED.date(DATE_FORMAT, $tome)),'id'), -8);
+               else $now .= " ID:".substr(crypt(md5(getREMOTE_ADDR().IDSEED.date($config['DATE_FORMAT'], $tome)),'id'), -8);
        }
 
        // 連續投稿 / 相同附加圖檔檢查
@@ -1199,9 +1201,9 @@ function manage_css(){
        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).'
@@ -1239,26 +1241,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';
 
@@ -1305,7 +1307,7 @@ function total_size($isupdate=false){
                $all = $sp[0];
                unset($sp);
        }
-        //---- return (int)($all / 1024);
+//----        return (int)($all / 1024);
        if(!$config['KB']) return (int)($all);
        else return (int)($all / 1024);
 }
@@ -1397,7 +1399,7 @@ function searchCategory(){
        $dat .= "<div>$links</div>\n";
        for($i = 0; $i < $loglist_cut_count; $i++){
                $posts = $PIO->fetchPosts($loglist_cut[$i]); // 取得文章內容
-               $dat .= arrangeThread($PTE, ($posts[0]['resto'] ? $posts[0]['resto'] : $posts[0]['no']), null, $posts, 0, $loglist_cut[$i], array(), array(), false, false, false); // 逐個輸出 (引用連結不顯示)
+               $dat .= arrangeThread($PTE, ($posts[0]['resto'] ? $posts[0]['resto'] : $posts[0]['no']), null, $posts, 0, $loglist_cut[$i], array(), array(), false, false, false, 0, 0, 0, 0, 0); // 逐個輸出 (引用連結不顯示)
        }
 
        $dat .= '<table border="1"><tr>';
@@ -1508,14 +1510,14 @@ function showstatus(){
 <tr><td>'._T('info_basic_bumphours').'</td><td colspan="3"> '.MAX_AGE_TIME.' '._T('info_basic_hours').' '._T('info_basic_0disable').'</td></tr>
 <tr><td>'._T('info_basic_urllinking').'</td><td colspan="3"> '.AUTO_LINK.' '._T('info_0no1yes').'</td></tr>
 <tr><td>'._T('info_basic_com_limit').'</td><td colspan="3"> '.COMM_MAX._T('info_basic_com_after').'</td></tr>
-<tr><td>'._T('info_basic_anonpost').'</td><td colspan="3"> '.ALLOW_NONAME.' '._T('info_basic_anonpost_opt').'</td></tr>
+<tr><td>'._T('info_basic_anonpost').'</td><td colspan="3"> '.$config['ALLOW_NONAME'].' '._T('info_basic_anonpost_opt').'</td></tr>
 <tr><td>'._T('info_basic_del_incomplete').'</td><td colspan="3"> '.KILL_INCOMPLETE_UPLOAD.' '._T('info_0no1yes').'</td></tr>
 <tr><td>'._T('info_basic_use_sample',THUMB_Q).'</td><td colspan="3"> '.USE_THUMB.' '._T('info_0notuse1use').'</td></tr>
 <tr><td>'._T('info_basic_useblock').'</td><td colspan="3"> '.BAN_CHECK.' '._T('info_0disable1enable').'</td></tr>
 <tr><td>'._T('info_basic_showid').'</td><td colspan="3"> '.DISP_ID.' '._T('info_basic_showid_after').'</td></tr>
 <tr><td>'._T('info_basic_cr_limit').'</td><td colspan="3"> '.BR_CHECK._T('info_basic_cr_after').'</td></tr>
 <!--<tr><td>'._T('info_basic_timezone').'</td><td colspan="3"> GMT </td></tr>-->
-<tr><td>'._T('info_basic_max_lines_limit').'</td><td colspan="3"> '.MAX_LINES._T('info_basic_max_lines_after').'</td></tr>
+<tr><td>'._T('info_basic_line_number_limit').'</td><td colspan="3"> '.$config['LINE_NUMBER']._T('info_basic_line_number_after').'</td></tr>
 <tr><td>'._T('info_basic_theme').'</td><td colspan="3"> '.$PTE->BlockValue('THEMENAME').' '.$PTE->BlockValue('THEMEVER').'<br/>by '.$PTE->BlockValue('THEMEAUTHOR').'</td></tr>
 <tr><td align="center" colspan="4">'._T('info_dsusage_top').'</td></tr>
 <tr align="center"><td>'._T('info_basic_threadcount').'</td><td colspan="'.(isset($piosensorInfo)?'2':'3').'"> '.$counttree.' '._T('info_basic_threads').'</td>'.(isset($piosensorInfo)?'<td rowspan="2">'.$piosensorInfo.'</td>':'').'</tr>