Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの
Revision | 2be5b06af81696e17b24d75aadaeb8f5f789b73f (tree) |
---|---|
Time | 2006-11-27 15:49:14 |
Author | shizuki <shizuki@1ca2...> |
Commiter | shizuki |
php バージョンチェック部分修正 (4.0.3 -> 4.3.0)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@497 1ca29b6e-896d-4ea0-84a5-967f57386b96
@@ -18,6 +18,8 @@ | ||
18 | 18 | * @version 0.41 |
19 | 19 | * @link http://nakahara21.com |
20 | 20 | * |
21 | + * 0.51 typo fix | |
22 | + * 0.5 TAG sort modified | |
21 | 23 | * 0.43 fix URL generate |
22 | 24 | * 0.42 add URL selected tag check |
23 | 25 | * 0.41 security fix and add some trick |
@@ -159,7 +161,7 @@ class NP_TagEX extends NucleusPlugin | ||
159 | 161 | $value = array_map("stripslashes", $value); |
160 | 162 | } |
161 | 163 | if (!array_map("is_numeric",$value)) { |
162 | - if (version_compare(phpversion(),"4.0.3") == "-1") { | |
164 | + if (version_compare(phpversion(),"4.3.0") == "-1") { | |
163 | 165 | $value = array_map("mysql_escape_string", $value); |
164 | 166 | } else { |
165 | 167 | $value = array_map("mysql_real_escape_string", $value); |
@@ -172,7 +174,7 @@ class NP_TagEX extends NucleusPlugin | ||
172 | 174 | $value = stripslashes($value); |
173 | 175 | } |
174 | 176 | if (!is_numeric($value)) { |
175 | - if (version_compare(phpversion(), "4.0.3") == "-1") { | |
177 | + if (version_compare(phpversion(), "4.3.0") == "-1") { | |
176 | 178 | $value = "'" . mysql_escape_string($value) . "'"; |
177 | 179 | } else { |
178 | 180 | $value = "'" . mysql_real_escape_string($value) . "'"; |
@@ -193,7 +195,7 @@ class NP_TagEX extends NucleusPlugin | ||
193 | 195 | $q_query = 'SELECT tddesc as result ' |
194 | 196 | . 'FROM %s ' |
195 | 197 | . 'WHERE tdname = %s'; |
196 | - $q_query = sprintf($q_query, $templateDescTable, $currentTemplateName); | |
198 | + $q_query = sprintf($q_query, $templateDescTable, $currentTemplateName); | |
197 | 199 | $currentTemplateDesc = quickQuery($q_query); |
198 | 200 | if (eregi('<highlightTagsAll>', $currentTemplateDesc)) { |
199 | 201 | $tags = $this->scanExistTags(0, 99999999); |
@@ -406,9 +408,9 @@ class NP_TagEX extends NucleusPlugin | ||
406 | 408 | function event_PreUpdateItem($data) |
407 | 409 | { |
408 | 410 | // Add tags when it add for Item |
409 | - $itags = trim(requestVar('itags')); | |
410 | - $inum = intval($data['itemid']); | |
411 | - $query = 'SELECT itags as result FROM %s WHERE inum = %d'; | |
411 | + $itags = trim(requestVar('itags')); | |
412 | + $inum = intval($data['itemid']); | |
413 | + $query = 'SELECT itags as result FROM %s WHERE inum = %d'; | |
412 | 414 | $oldTags = quickQuery(sprintf($query, _TAGEX_TABLE, $inum)); |
413 | 415 | if ($itags == $oldTags) { |
414 | 416 | return; |
@@ -416,7 +418,7 @@ class NP_TagEX extends NucleusPlugin | ||
416 | 418 | $query = 'DELETE FROM %s WHERE inum = %d'; |
417 | 419 | sql_query(sprintf($query, _TAGEX_TABLE, $inum)); |
418 | 420 | if (isset($itags)) { |
419 | - $query = 'INSERT INTO %s (inum, itags) VALUES (%d, %s)'; | |
421 | + $query = 'INSERT INTO %s (inum, itags) VALUES (%d, %s)'; | |
420 | 422 | $query = sprintf($query, _TAGEX_TABLE, $inum, $this->quote_smart($itags)); |
421 | 423 | sql_query($query); |
422 | 424 | } |
@@ -457,7 +459,7 @@ class NP_TagEX extends NucleusPlugin | ||
457 | 459 | function getTags($str) |
458 | 460 | { |
459 | 461 | // extract Item's TAG for array |
460 | - $tempArray = preg_split("/[\r\n,]+/", $str); | |
462 | + $tempArray = preg_split("/[\r\n,]+/", $str); | |
461 | 463 | $returnArray = array_map('trim', $tempArray); |
462 | 464 | return array_unique($returnArray); |
463 | 465 | } |
@@ -473,8 +475,8 @@ class NP_TagEX extends NucleusPlugin | ||
473 | 475 | function deleteTags($tag, $inum) |
474 | 476 | { |
475 | 477 | // Delete TAGs and TAG's Item |
476 | - $inum = intval($inum); | |
477 | - $tag = $this->quote_smart($tag); | |
478 | + $inum = intval($inum); | |
479 | + $tag = $this->quote_smart($tag); | |
478 | 480 | $f_query = "SELECT inums FROM " . _TAGEX_KLIST_TABLE |
479 | 481 | . " WHERE tag = " . $tag |
480 | 482 | . ' AND inums REGEXP "(^|,)' . $inum . '(,|$)"' |
@@ -490,16 +492,16 @@ class NP_TagEX extends NucleusPlugin | ||
490 | 492 | return; |
491 | 493 | } |
492 | 494 | $inums_array = explode(',', $temp_inums); |
493 | - $trans = array_flip($inums_array); | |
495 | + $trans = array_flip($inums_array); | |
494 | 496 | unset($trans[$inum]); |
495 | 497 | $inums_array = array_flip($trans); |
496 | 498 | $inums_count = count($inums_array); |
497 | - $inums = @join(",", $inums_array); | |
499 | + $inums = @implode(",", $inums_array); | |
498 | 500 | if (!empty($inums)) { |
499 | 501 | $update_query = 'UPDATE %s ' |
500 | - . 'SET inums = %s, ' | |
502 | + . 'SET inums = %s, ' | |
501 | 503 | . 'inums_count = %d ' |
502 | - . 'WHERE tag = %s'; | |
504 | + . 'WHERE tag = %s'; | |
503 | 505 | $iCount = intval($inums_count); |
504 | 506 | $quoteInums = $this->quote_smart($inums); |
505 | 507 | sql_query(sprintf($update_query, _TAGEX_KLIST_TABLE, $quoteInums, $iCount, $tag)); |
@@ -512,8 +514,8 @@ class NP_TagEX extends NucleusPlugin | ||
512 | 514 | if (empty($tag)) { |
513 | 515 | return; |
514 | 516 | } |
515 | - $inum = intval($inum); | |
516 | - $tag = $this->quote_smart($tag); | |
517 | + $inum = intval($inum); | |
518 | + $tag = $this->quote_smart($tag); | |
517 | 519 | $f_query = 'SELECT inums' |
518 | 520 | . ' FROM ' . _TAGEX_KLIST_TABLE |
519 | 521 | . ' WHERE tag = ' . $tag |
@@ -527,14 +529,16 @@ class NP_TagEX extends NucleusPlugin | ||
527 | 529 | $inums_count = count($inums_array) + 1; |
528 | 530 | } |
529 | 531 | } else { |
530 | - $q_query = 'INSERT INTO %s (tag, inums, inums_count) VALUES (%s, %d, 1)'; | |
532 | + $q_query = 'INSERT INTO %s ' | |
533 | + . '(tag, inums, inums_count) ' | |
534 | + . 'VALUES (%s, %d, 1)'; | |
531 | 535 | sql_query(sprintf($q_query, _TAGEX_KLIST_TABLE, $tag, intval($inum))); |
532 | 536 | } |
533 | 537 | |
534 | 538 | if (isset($inums)) { |
535 | - $q_query = 'UPDATE %s SET inums = %s, inums_count = %d WHERE tag = %s'; | |
536 | - $iCount = intval($inums_count); | |
537 | - $quoteInums = $this->quote_smart($inums); | |
539 | + $q_query = 'UPDATE %s SET inums = %s, inums_count = %d WHERE tag = %s'; | |
540 | + $iCount = intval($inums_count); | |
541 | + $quoteInums = $this->quote_smart($inums); | |
538 | 542 | sql_query(sprintf($q_query, _TAGEX_KLIST_TABLE, $quoteInums, $iCount, $tag)); |
539 | 543 | } |
540 | 544 | } |
@@ -616,8 +620,12 @@ class NP_TagEX extends NucleusPlugin | ||
616 | 620 | $where .= ' and i.itime <= ' . mysqldate($b->getCorrectTime()); |
617 | 621 | } |
618 | 622 | |
619 | - $iquery = 'SELECT i.inumber FROM %s as i' . $mtable . ' WHERE i.idraft = 0' . $where; | |
620 | - $res = sql_query(sprintf($iquery, sql_table('item'))); | |
623 | + $iquery = 'SELECT i.inumber ' | |
624 | + . 'FROM %s as i' | |
625 | + . $mtable | |
626 | + . ' WHERE i.idraft = 0' | |
627 | + . $where; | |
628 | + $res = sql_query(sprintf($iquery, sql_table('item'))); | |
621 | 629 | while ($row = mysql_fetch_row($res)) { |
622 | 630 | $existInums[] = $row[0]; |
623 | 631 | } |
@@ -675,7 +683,7 @@ class NP_TagEX extends NucleusPlugin | ||
675 | 683 | case 4: |
676 | 684 | /// <http://blog.uribou.net/> |
677 | 685 | srand ((float) microtime() * 10000000); |
678 | - $tmp_key = array_rand($tagCount, count($tagCount)); | |
686 | + $tmp_key = array_rand($tagCount, count($tagCount)); | |
679 | 687 | unset($tagCount); |
680 | 688 | $tagCount = array(); |
681 | 689 | foreach ($tmp_key as $k => $v) { |
@@ -715,10 +723,11 @@ class NP_TagEX extends NucleusPlugin | ||
715 | 723 | $blogid = intval(getBlogIDFromName($blogid)); |
716 | 724 | } |
717 | 725 | // </mod by shizuki> |
718 | -// $existInumsIn = ($existInums = $this->scanExistItem($narrowMode, $blogid)) ? ' WHERE inum in (' . @join(',', $existInums) . ')' : ''; | |
726 | +// $existInumsIn = ($existInums = $this->scanExistItem($narrowMode, $blogid)) ? | |
727 | +// ' WHERE inum in (' . @implode(',', $existInums) . ')' : ''; | |
719 | 728 | $existInumsIn = ''; |
720 | 729 | if ($existInums = $this->scanExistItem($narrowMode, $blogid)) { |
721 | - $existInumsIn = ' WHERE inum in (' . @join(',', $existInums) . ')'; | |
730 | + $existInumsIn = ' WHERE inum in (' . @implode(',', $existInums) . ')'; | |
722 | 731 | } |
723 | 732 | $q = 'SELECT * FROM ' . _TAGEX_TABLE . $existInumsIn; |
724 | 733 | $res = sql_query($q); |
@@ -803,7 +812,8 @@ class NP_TagEX extends NucleusPlugin | ||
803 | 812 | $urlq = serverVar('QUERY_STRING'); |
804 | 813 | $urlq = str_replace('?', '', $urlq); |
805 | 814 | $urlq = explode('&', $urlq); |
806 | - for ($i=0;$i<count($urlq);$i++) { | |
815 | + $qCnt = count($urlq); | |
816 | + for ($i=0; $i<$qCnt; $i++) { | |
807 | 817 | $tempq = explode('=', $urlq[$i]); |
808 | 818 | if ($tempq[0] == $q) { |
809 | 819 | $str = preg_replace('|[^a-z0-9-~+_.#;,:@%]|i', '', $tempq[1]); |
@@ -823,7 +833,8 @@ class NP_TagEX extends NucleusPlugin | ||
823 | 833 | } |
824 | 834 | $res = array('and'=>array(), 'or'=>array()); |
825 | 835 | $tempAnd = explode('+', $q); |
826 | - for ($i=0; $i<count($tempAnd); $i++) { | |
836 | + $andCnt = count($tempAnd); | |
837 | + for ($i=0; $i<$andCnt; $i++) { | |
827 | 838 | $temp = explode(':', $tempAnd[$i]); |
828 | 839 | $res['and'][] = array_shift($temp); |
829 | 840 | if ($temp != array()) { |
@@ -837,7 +848,7 @@ class NP_TagEX extends NucleusPlugin | ||
837 | 848 | { |
838 | 849 | // type[0]: type ( + amount (int)) |
839 | 850 | // type[1]: $narrowMode (0/1/2) |
840 | - // type[2]: sort | |
851 | + // type[2]: sortMode (1/2/3/4) | |
841 | 852 | // type[3]: Minimum font-sizem(em) 0.5/1/1.5/2... |
842 | 853 | // type[4]: Maximum font-sizem(em) |
843 | 854 | // default |
@@ -846,19 +857,25 @@ class NP_TagEX extends NucleusPlugin | ||
846 | 857 | } |
847 | 858 | $type = explode('/',$type); |
848 | 859 | if (eregi('list', $type[0])) { |
849 | - $amount = eregi_replace("list", "", $type[0]); | |
860 | + $amount = eregi_replace("list", "", $type[0]); | |
850 | 861 | $type[0] = 'list'; |
851 | 862 | // < meta keywords="TAG" mod by shizuki> |
852 | 863 | } elseif (eregi('meta', $type[0])) { |
853 | - $amount = eregi_replace("meta", "", $type[0]); | |
864 | + $amount = eregi_replace("meta", "", $type[0]); | |
854 | 865 | $type[0] = 'meta'; |
855 | 866 | // </mod by shizuki>*/ |
856 | 867 | } |
857 | 868 | // default amount |
858 | - $amount = ($amount) ? $amount: 99999999; | |
869 | + $amount = ($amount) ? $amount: 99999999; | |
870 | + $amount = intval($amount); | |
859 | 871 | |
860 | 872 | $defaultType = array('list', '1', '0', '1', '4'); |
861 | - $type = $type + $defaultType; | |
873 | + $type = $type + $defaultType; | |
874 | + $type[0] = htmlspecialchars($type[0], ENT_QUOTES, _CHARSET); | |
875 | + $type[1] = intval($type[1]); | |
876 | + $type[2] = intval($type[2]); | |
877 | + $type[3] = (float)$type[3]; | |
878 | + $type[4] = (float)$type[4]; | |
862 | 879 | // <for FancyURL mod by shizuki> |
863 | 880 | // if (requestVar('tag')) { |
864 | 881 | $requestT = $this->getNoDecodeQuery('tag'); |
@@ -881,7 +898,7 @@ class NP_TagEX extends NucleusPlugin | ||
881 | 898 | . '" title="' . $val . '">' |
882 | 899 | . $val . '</a>'; |
883 | 900 | } |
884 | - $reqANDp = @join('" + "', $reqAndLink); | |
901 | + $reqANDp = @implode('" + "', $reqAndLink); | |
885 | 902 | if ($reqOR) { |
886 | 903 | foreach ($reqOR as $val) { |
887 | 904 | $reqOrLink[] = '<a href="' |
@@ -912,9 +929,10 @@ class NP_TagEX extends NucleusPlugin | ||
912 | 929 | $res = sql_query(sprintf($q, _TAGEX_TABLE, $itemid)); |
913 | 930 | while ($o = mysql_fetch_object($res)) { |
914 | 931 | $temp_tags_array = preg_split("/[\n,]+/", trim($o->itags)); |
915 | - for ($i=0; $i < count($temp_tags_array); $i++) { | |
932 | + $temp_tags_count = count($temp_tags_array); | |
933 | + for ($i=0; $i < $temp_tags_count; $i++) { | |
916 | 934 | $tag = trim($temp_tags_array[$i]); |
917 | - $taglist[$i] = htmlspecialchars($tag); | |
935 | + $taglist[$i] = htmlspecialchars($tag, ENT_QUOTES, _CHARSET); | |
918 | 936 | } |
919 | 937 | } |
920 | 938 | if ($taglist) |
@@ -924,7 +942,7 @@ class NP_TagEX extends NucleusPlugin | ||
924 | 942 | $eachTag = array(); |
925 | 943 | $t = 0; |
926 | 944 | foreach ($tags as $tag => $inums) { |
927 | - $eachTag[$t] = htmlspecialchars($tag); | |
945 | + $eachTag[$t] = htmlspecialchars($tag, ENT_QUOTES, _CHARSET); | |
928 | 946 | $t++; |
929 | 947 | } |
930 | 948 | if ($type[3] != 'ad') { |
@@ -961,26 +979,34 @@ tagIndexSeparator | ||
961 | 979 | |
962 | 980 | |
963 | 981 | /* |
964 | - $template['tagIndex'] = '<h3><a href="<%taglinkurl%>"><%tag%>(<%tagamount%>)</a></h3>'; | |
965 | - $template['tagItemHeader'] = '<ul>'; | |
966 | - $template['tagItem'] = '<li><%itemid%></li>'; | |
967 | - $template['tagItemSeparator'] = ''; | |
968 | - $template['tagItemFooter'] = '</ul>'; | |
982 | + $template['tagIndex'] = '<h3><a href="<%taglinkurl%>"><%tag%>' | |
983 | + . '(<%tagamount%>)</a></h3>'; | |
984 | + $template['tagItemHeader'] = '<ul>'; | |
985 | + $template['tagItem'] = '<li><%itemid%></li>'; | |
986 | + $template['tagItemSeparator'] = ''; | |
987 | + $template['tagItemFooter'] = '</ul>'; | |
969 | 988 | *//* |
970 | - $template['and'] = '<span style="font-family:tahoma;font-size:smaller;"> <a href="<%andurl%>" title="narrow">&</a>.'; | |
971 | - $template['or'] = '<a href="<%orurl%>" title="expand">or</a> </span>'; | |
972 | - $template['tagIndex'] = '<%and%><%or%><span style="font-size:<%fontlevel%>em" title="<%tagamount%> post(s)! <%tagitems%>"><a href="<%taglinkurl%>"><%tag%></a></span>'; | |
973 | - $template['tagItemHeader'] = ''; | |
974 | - $template['tagItem'] = "<%itemid%>:<%itemtitle%>"; | |
975 | - $template['tagItemSeparator'] = ' , '; | |
976 | - $template['tagItemFooter'] = ''; | |
989 | + $template['and'] = '<span style="font-family:tahoma;font-size:smaller;">' | |
990 | + . ' <a href="<%andurl%>" title="narrow">&</a>.'; | |
991 | + $template['or'] = '<a href="<%orurl%>" title="expand">or</a> </span>'; | |
992 | + $template['tagIndex'] = '<%and%><%or%>' | |
993 | + . '<span style="font-size:<%fontlevel%>em" ' | |
994 | + . 'title="<%tagamount%> post(s)! <%tagitems%>">' | |
995 | + . '<a href="<%taglinkurl%>"><%tag%></a></span>'; | |
996 | + $template['tagItemHeader'] = ''; | |
997 | + $template['tagItem'] = "<%itemid%>:<%itemtitle%>"; | |
998 | + $template['tagItemSeparator'] = ' , '; | |
999 | + $template['tagItemFooter'] = ''; | |
977 | 1000 | $template['tagIndexSeparator'] = ' | '; |
978 | 1001 | *//* |
979 | - $template['tagIndex'] = '<span style="font-size:<%fontlevel%>em" title="<%tagamount%> post(s)!"><a href="<%taglinkurl%>"><%tag%>(<%tagamount%>)</a></span>'; | |
980 | - $template['tagItemHeader'] = ''; | |
981 | - $template['tagItem'] = "\n<%itemid%>:<%itemtitle%>"; | |
982 | - $template['tagItemSeparator'] = ' / '; | |
983 | - $template['tagItemFooter'] = ''; | |
1002 | + $template['tagIndex'] = '<span style="font-size:<%fontlevel%>em"' | |
1003 | + . ' title="<%tagamount%> post(s)!">' | |
1004 | + . '<a href="<%taglinkurl%>"><%tag%>' | |
1005 | + . '(<%tagamount%>)</a></span>'; | |
1006 | + $template['tagItemHeader'] = ''; | |
1007 | + $template['tagItem'] = "\n<%itemid%>:<%itemtitle%>"; | |
1008 | + $template['tagItemSeparator'] = ' / '; | |
1009 | + $template['tagItemFooter'] = ''; | |
984 | 1010 | $template['tagIndexSeparator'] = ' | '; |
985 | 1011 | */ |
986 | 1012 | // print_r($tags); |
@@ -997,11 +1023,11 @@ tagIndexSeparator | ||
997 | 1023 | // if($tags = $this->scanExistTags($type[1], $amount, $type[2])){// original mode |
998 | 1024 | if ($tags = $this->scanExistTags($type[1])) {// <nodisplay selected TAGs mod by shizuki /> |
999 | 1025 | if ($type[3] != $type[4]) { |
1000 | - $minFontSize = min($type[3], $type[4]) - 0.5; | |
1001 | - $maxFontSize = max($type[3], $type[4]); | |
1002 | - $levelsum = ($maxFontSize - $minFontSize) / 0.5; | |
1026 | + $minFontSize = min($type[3], $type[4]) - 0.5; | |
1027 | + $maxFontSize = max($type[3], $type[4]); | |
1028 | + $levelsum = ($maxFontSize - $minFontSize) / 0.5; | |
1003 | 1029 | list($maxCount, $minCount) = $this->scanCount($tags); |
1004 | - $eachCount = ceil(($maxCount - $minCount) / $levelsum); | |
1030 | + $eachCount = ceil(($maxCount - $minCount) / $levelsum); | |
1005 | 1031 | } |
1006 | 1032 | // <nodisplay selected TAGs mod by shizuki> |
1007 | 1033 | $select = array(); |
@@ -1044,7 +1070,7 @@ tagIndexSeparator | ||
1044 | 1070 | } |
1045 | 1071 | // </mod by shizuki>*/ |
1046 | 1072 | $eachTag = array(); |
1047 | - $t = 0; | |
1073 | + $t = 0; | |
1048 | 1074 | foreach ($tags as $tag => $inums) { |
1049 | 1075 | $tagitems = array(); |
1050 | 1076 | $tagAmount = count($inums); |
@@ -1057,13 +1083,16 @@ tagIndexSeparator | ||
1057 | 1083 | |
1058 | 1084 | // Item's name had TAGs |
1059 | 1085 | for ($i=0;$i<$tagAmount;$i++) { |
1060 | - $qQuery = 'SELECT ititle as result FROM %s WHERE inumber = %d'; | |
1061 | - $qQuery = sprintf($qQuery, sql_table('item'), intval($inums[$i])); | |
1062 | - $itemtitle = quickQuery($qQuery); | |
1063 | - $shortTitle = shorten(strip_tags($itemtitle), 10, '..'); | |
1086 | + $qQuery = 'SELECT ititle as result ' | |
1087 | + . 'FROM %s WHERE inumber = %d'; | |
1088 | + $qQuery = sprintf($qQuery, sql_table('item'), intval($inums[$i])); | |
1089 | + $itemtitle = quickQuery($qQuery); | |
1090 | + $itemtitle = htmlspecialchars($itemtitle, ENT_QUOTES, _CHARSET); | |
1091 | + $shortTitle = shorten(strip_tags($itemtitle), 10, '...'); | |
1092 | + $shortTitle = htmlspecialchars($shortTitle, ENT_QUOTES, _CHARSET); | |
1064 | 1093 | $printData['tagItem'] = array( |
1065 | - 'itemid' => intval($inums[$i]), | |
1066 | - 'itemtitle' => $shortTitle, | |
1094 | + 'itemid' => intval($inums[$i]), | |
1095 | + 'itemtitle' => $shortTitle, | |
1067 | 1096 | ); |
1068 | 1097 | $tagitems[] = TEMPLATE::fill($template['tagItem'], $printData['tagItem']); |
1069 | 1098 | } |
@@ -1090,12 +1119,12 @@ tagIndexSeparator | ||
1090 | 1119 | $printData['tagIndex'] = array( |
1091 | 1120 | 'and' => $and, |
1092 | 1121 | 'or' => $or, |
1093 | - 'tag' => htmlspecialchars($tag), | |
1122 | + 'tag' => htmlspecialchars($tag, ENT_QUOTES, _CHARSET), | |
1094 | 1123 | 'tagamount' => $tagAmount, |
1095 | 1124 | 'fontlevel' => $fontlevel, |
1096 | 1125 | 'taglinkurl' => $this->creatTagLink($tag, $type[1]), |
1097 | 1126 | 'tagitems' => $tagitem |
1098 | - ); | |
1127 | + ); | |
1099 | 1128 | $eachTag[$t] = TEMPLATE::fill($template['tagIndex'], $printData['tagIndex']); |
1100 | 1129 | |
1101 | 1130 | // format outputdata and data output |
@@ -1145,10 +1174,10 @@ tagIndexSeparator | ||
1145 | 1174 | while ($o = mysql_fetch_object($res)) { |
1146 | 1175 | $temp_tags_array = preg_split("/[\n,]+/", trim($o->itags)); |
1147 | 1176 | for ($i=0; $i < count($temp_tags_array); $i++) { |
1148 | - $tag = trim($temp_tags_array[$i]); | |
1177 | + $tag = trim($temp_tags_array[$i]); | |
1149 | 1178 | $taglink = $this->creatTagLink($tag, 0); |
1150 | 1179 | // <highlight selected TAGs mod by shizuki> |
1151 | - $key = array_search($tag, $words); | |
1180 | + $key = array_search($tag, $words); | |
1152 | 1181 | if ($key >= 10) { |
1153 | 1182 | $key = $key - 10; |
1154 | 1183 | } |
@@ -1156,13 +1185,13 @@ tagIndexSeparator | ||
1156 | 1185 | $taglist[$i] = '<a href="' |
1157 | 1186 | . $this->creatTagLink($tag, 0) |
1158 | 1187 | . '" class="highlight_0" rel="tag">' |
1159 | - . htmlspecialchars($tag) . '</a>'; | |
1188 | + . htmlspecialchars($tag, ENT_QUOTES, _CHARSET) . '</a>'; | |
1160 | 1189 | } else { |
1161 | 1190 | // </mod by shizuki>*/ |
1162 | 1191 | $taglist[$i] = '<a href="' |
1163 | 1192 | . $this->creatTagLink($tag, 0) |
1164 | 1193 | . '" rel="tag">' |
1165 | - . htmlspecialchars($tag) . '</a>'; | |
1194 | + . htmlspecialchars($tag, ENT_QUOTES, _CHARSET) . '</a>'; | |
1166 | 1195 | } // <highlight selected TAGs mod by shizuki /> |
1167 | 1196 | } |
1168 | 1197 | } |
@@ -1198,11 +1227,21 @@ tagIndexSeparator | ||
1198 | 1227 | function getChildren($subcat_id) |
1199 | 1228 | { |
1200 | 1229 | $subcat_id = intval($subcat_id); // <mod by shizuki /> |
1201 | - $que = 'SELECT scatid, parentid, sname FROM %s WHERE parentid = %d'; | |
1230 | + $que = 'SELECT' | |
1231 | + . ' scatid,' | |
1232 | + . ' parentid,' | |
1233 | + . ' sname ' | |
1234 | + . 'FROM' | |
1235 | + . ' %s ' | |
1236 | + . 'WHERE' | |
1237 | + . ' parentid = %d'; | |
1202 | 1238 | $mcatTable = sql_table('plug_multiple_categories_sub'); |
1203 | - $res = sql_query(sprintf($que, $mcatTable, $subcat_id)); | |
1239 | + $que = sprintf($que, $mcatTable, $subcat_id); | |
1240 | + $res = sql_query($que); | |
1204 | 1241 | while ($so = mysql_fetch_object($res)) { |
1205 | - $r .= $this->getChildren($so->scatid) . '/' . $so->scatid; | |
1242 | + $r .= $this->getChildren($so->scatid) | |
1243 | + . '/' | |
1244 | + . $so->scatid; | |
1206 | 1245 | } |
1207 | 1246 | return $r; |
1208 | 1247 | } |
@@ -1219,6 +1258,7 @@ tagIndexSeparator | ||
1219 | 1258 | if (!$blogid) { |
1220 | 1259 | $blogid = $CONF['DefaultBlog']; |
1221 | 1260 | } |
1261 | + $b =& $manager->getBlog($blogid); | |
1222 | 1262 | if ($narrowMode == 2) { |
1223 | 1263 | // if ($blogid) { |
1224 | 1264 | // $linkparams['blogid'] = intval($blogid); |
@@ -1228,7 +1268,7 @@ tagIndexSeparator | ||
1228 | 1268 | } |
1229 | 1269 | if ($manager->pluginInstalled('NP_MultipleCategories')) { |
1230 | 1270 | $mcategories =& $manager->getPlugin('NP_MultipleCategories'); |
1231 | - if (method_exists($mcategories, "getRequestName")) { | |
1271 | + if (method_exists($mcategories, 'getRequestName')) { | |
1232 | 1272 | $subrequest = $mcategories->getRequestName(); |
1233 | 1273 | } else { |
1234 | 1274 | $subrequest = 'subcatid'; |
@@ -1266,27 +1306,40 @@ tagIndexSeparator | ||
1266 | 1306 | $sep = ''; |
1267 | 1307 | } |
1268 | 1308 | // <mod by shizuki> |
1269 | - $link = $CONF['BlogURL']; | |
1270 | - if (substr($CONF['BlogURL'], -1) != '/') { | |
1271 | - if (substr($CONF['BlogURL'], -4) != '.php') { | |
1309 | +/// <Original URL Generate code> | |
1310 | +// if ($CONF['URLMode'] == 'pathinfo') | |
1311 | +// $link = $CONF['IndexURL'] . '/tag/' . $ready . $sep . $this->_rawencode($tag); | |
1312 | +// else | |
1313 | +// $link = $CONF['IndexURL'] . '?tag=' . $ready . $sep . $this->_rawencode($tag); | |
1314 | + $link = $b->getURL(); | |
1315 | + if (substr($link, -1) != '/') { | |
1316 | + if (substr($link, -4) != '.php') { | |
1272 | 1317 | $link .= '/'; |
1273 | 1318 | } |
1274 | 1319 | } |
1275 | 1320 | if ($CONF['URLMode'] == 'pathinfo') { |
1276 | - $link .= 'tag/' . $ready . $sep . $this->_rawencode($tag); | |
1321 | + $link .= 'tag/' . $ready . $sep . $this->_rawencode($tag); | |
1277 | 1322 | } else { |
1278 | 1323 | $link .= '?tag=' . $ready . $sep . $this->_rawencode($tag); |
1279 | 1324 | } |
1280 | -// if ($CONF['URLMode'] == 'pathinfo') | |
1281 | -// $link = $CONF['IndexURL'] . '/tag/' . $ready . $sep . $this->_rawencode($tag); | |
1282 | -// else | |
1283 | -// $link = $CONF['IndexURL'] . '?tag=' . $ready . $sep . $this->_rawencode($tag); | |
1325 | +// </ Original URL Generate code> */ | |
1326 | + | |
1327 | +/*// <test code> | |
1328 | + $CONF['BlogURL'] = $b->getURL(); | |
1329 | + $linkparams['tag'] = $ready . $sep . $this->_rawencode($tag); | |
1330 | + $uri = createBlogidLink($blogid, $linkparams); | |
1331 | + if (strstr ($uri, '//')) { | |
1332 | + $uri = preg_replace("/([^:])\/\//", "$1/", $uri); | |
1333 | + } | |
1334 | + return $uri; | |
1335 | +// </test code>*/ | |
1336 | + | |
1284 | 1337 | // </mod by shizuki>*/ |
1285 | 1338 | |
1286 | 1339 | // <mod by shizuki> |
1287 | 1340 | if ($manager->pluginInstalled('NP_CustomURL')) { |
1288 | 1341 | $linkparams['tag'] = $ready . $sep . $this->_rawencode($tag); |
1289 | - $uri = createBlogidLink($blogid, $linkparams); | |
1342 | + $uri = createBlogidLink($blogid, $linkparams); | |
1290 | 1343 | if (strstr ($uri, '//')) { |
1291 | 1344 | $uri = preg_replace("/([^:])\/\//", "$1/", $uri); |
1292 | 1345 | } |
@@ -1317,5 +1370,4 @@ tagIndexSeparator | ||
1317 | 1370 | } |
1318 | 1371 | } |
1319 | 1372 | |
1320 | -} | |
1321 | -?> | |
\ No newline at end of file | ||
1373 | +} | |
\ No newline at end of file |