[Pyukiwiki-cvs 0009711] CVS update: PyukiWiki-Devel-UTF8/lib

Back to archive index

PyukiWiki CVS Commit pyuki****@lists*****
2012年 3月 19日 (月) 01:54:06 JST


Index: PyukiWiki-Devel-UTF8/lib/lang.inc.pl
diff -u PyukiWiki-Devel-UTF8/lib/lang.inc.pl:1.338 PyukiWiki-Devel-UTF8/lib/lang.inc.pl:1.339
--- PyukiWiki-Devel-UTF8/lib/lang.inc.pl:1.338	Mon Mar 19 00:06:52 2012
+++ PyukiWiki-Devel-UTF8/lib/lang.inc.pl	Mon Mar 19 01:54:06 2012
@@ -1,6 +1,6 @@
 ######################################################################
 # lang.inc.pl - This is PyukiWiki, yet another Wiki clone.
-# $Id: lang.inc.pl,v 1.338 2012/03/18 15:06:52 papu Exp $
+# $Id: lang.inc.pl,v 1.339 2012/03/18 16:54:06 papu Exp $
 #
 # "PyukiWiki" ver 0.2.0-p3-dev1 $$
 # Author: Nanami http://nanakochi.daiba.cx/
@@ -266,6 +266,9 @@
 			$::navi{"lang_" . $_ . "_width"}=16;
 		}
 	}
+	# 0.2.0-p4 add security fix # comment
+	return('init'=>0) if($::lang!~/^\w{1,64}$/) {
+
 	&init_lang;
 	&init_dtd;
 	%::resource = &read_resource("$::res_dir/resource.$::lang.txt",%::resource);
Index: PyukiWiki-Devel-UTF8/lib/wiki.cgi
diff -u PyukiWiki-Devel-UTF8/lib/wiki.cgi:1.384 PyukiWiki-Devel-UTF8/lib/wiki.cgi:1.385
--- PyukiWiki-Devel-UTF8/lib/wiki.cgi:1.384	Mon Mar 19 00:06:52 2012
+++ PyukiWiki-Devel-UTF8/lib/wiki.cgi	Mon Mar 19 01:54:06 2012
@@ -1,6 +1,6 @@
 ######################################################################
 # wiki.cgi - This is PyukiWiki, yet another Wiki clone.
-# $Id: wiki.cgi,v 1.384 2012/03/18 15:06:52 papu Exp $
+# $Id: wiki.cgi,v 1.385 2012/03/18 16:54:06 papu Exp $
 #
 # "PyukiWiki" ver 0.2.0-p3-dev1 $$
 # Copyright (C) 2004-2012 Nekyo
@@ -121,6 +121,7 @@
 $::linedata;			# save lines for plugin					# comment
 $::eom_string;			# end of message for plugin				# comment
 $::exec_inlinefunc;		# exec inline func						# comment
+%::jscss_included;		# Load JavaScript and CSS				# comment
 
 @::notes = ();
 
@@ -822,7 +823,8 @@
 
 sub exec_plugin {
 	my $exec = 1;
-	if ($::form{cmd}) {
+	# add 0.2.0-p4 fix add security fix
+	if ($::form{cmd}=~/^\w{1,64}$/) {
 		if (&exist_plugin($::form{cmd}) == 1) {
 			my $action = "\&plugin_" . $::form{cmd} . "_action";
 			my %ret = eval $action;
@@ -917,7 +919,11 @@
 		push(@::loaded_explugin,$explugin);
 		my %ret = eval $action;
 		$::debug.=$@;
-		$::_exec_plugined{$explugin} = 2 if($ret{init}); #execed	# comment
+		# 0.2.0-p4 change
+		if($ret{init}) {
+			$::_exec_plugined{$explugin} = 2;
+			$::IN_HEAD.=&jscss_include($::skin_dir, $explugin);
+		}
 		# 重複関数の検査								# comment
 		foreach(split(/,/,$ret{func})) {
 			if($_exec_plugined_func{$_} ne '' ) {
@@ -4943,7 +4949,9 @@
 				require $path;
 				$::debug.=$@;
 				$_plugined{$1} = 1;	# Pyuki
-				#v0.1.6										# comment
+				# 0.2.0-p4										# comment
+				$::IN_HEAD.=&jscss_include($::skin_dir, $plugin);
+				# v0.1.6										# comment
 				$path="$::res_dir/$plugin.$::lang.txt";
 				%::resource = &read_resource($path,%::resource) if(-r $path);
 				return 1;
@@ -5048,6 +5056,59 @@
 
 =lang ja
 
+=head2 jscss_include
+
+=over 4
+
+=item 入力値
+
+&jscss_include(dir, plugin name);
+
+=item 出力
+
+HTMLã‚¿ã‚°
+
+=item オーバーライド
+
+可
+
+=item 概要
+
+プラグイン向けのJavaScript、CSSの読み込み文字列を生成する。
+
+Nekyo氏のPyukiWikiと互換性はありません。
+
+=back
+
+=cut
+
+sub jscss_include {
+	my($dir, $name)=@_;
+
+	if(!$::jscss_included{$name}) {
+		$::jscss_included{$name}=1;
+		return if($name!/^\w{1,64}/);
+		my $head;
+		foreach("$::skin_dir/$name.js", "$::skin_dir/$::skin_name.$name.js"
+			, 	"$::skin_dir/$name.css","$::skin_dir/$::skin_name.$name.js") {
+			if(-r $_) {
+				if(/\.js$/) {
+					$head.=<<EOM;
+<script type="text/javascript" src="$_" charset="$::charset"></script>
+EOM
+				} elsif(/\.css$/) {
+					$head.=<<EOM;
+<link rel="stylesheet" href="$_" type="text/css" media="print" charset="$::charset" />
+EOM
+				}
+			}
+		}
+	}
+	return $head;
+}
+
+=lang ja
+
 =head2 embedded_to_html
 
 =over 4



Pyukiwiki-cvs メーリングリストの案内
Back to archive index