OSDN Git Service

ver 0.3.0.0
authorkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 10 Jun 2008 02:23:04 +0000 (02:23 +0000)
committerkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Tue, 10 Jun 2008 02:23:04 +0000 (02:23 +0000)
Supports the redirection to forum page after editting.
Note that refresh of plugin event is required.

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@629 1ca29b6e-896d-4ea0-84a5-967f57386b96

trunk/NP_SubSilver/plugins/NP_subSilver.php
trunk/NP_SubSilver/skins/subsilver/category.inc
trunk/NP_SubSilver/skins/subsilver/faq.inc
trunk/NP_SubSilver/skins/subsilver/item.inc
trunk/NP_SubSilver/skins/subsilver/onlinedata.inc
trunk/NP_SubSilver/skins/subsilver/skinbackup.xml

index 58556e9..c469599 100644 (file)
@@ -3,12 +3,12 @@ class NP_subSilver extends NucleusPlugin {
        function getName() { return 'NP_subSilver'; }
        function getMinNucleusVersion() { return 330; }
        function getAuthor()  { return 'Katsumi'; }
-       function getVersion() { return '0.2.9.7'; }
+       function getVersion() { return '0.3.0.0'; }
        function getURL() {return 'http://japan.nucleuscms.org/bb/viewtopic.php?t=3257';}
        function getDescription() { return $this->getName().' plugin'; } 
        function supportsFeature($what) { return (int)($what=='SqlTablePrefix'); }
        function getEventList() {
-               return array('QuickMenu','InitSkinParse','PostAuthentication',
+               return array('QuickMenu','InitSkinParse','PostAuthentication','AdminPrePageHead',
                        'SpamCheck','PostAddComment','ValidateForm',
                        'PreDeleteComment','PostDeleteComment','PreUpdateComment','PrepareCommentForEdit',
                        'PostAddItem','PostAddCategory');
@@ -64,9 +64,23 @@ try {
 /*]]>*/
 </script><?php
        }
-/* Following event is used to check the values of blog/category settings */
+/* Following event is used to check the values of blog/category settings as well as to redirect to another page */
        var $noblogid=false;
+       var $returntoforum='';
        function event_PostAuthentication(){
+               // Remember forum URI
+               global $member,$CONF,$itemid;
+               if ($member->isLoggedIn()) {
+                       if (@$CONF['UsingAdminArea']) {
+                               if (requestVar('subsilver_action')!='returntoforum') {
+                                       // Set the redirect URI and forget cookie URI
+                                       if (serverVar('REQUEST_METHOD')=='POST') $this->returntoforum=cookieVar($CONF['CookiePrefix'] . 'subsilver_uri');
+                                       setcookie($CONF['CookiePrefix'] . 'subsilver_uri', '', 0, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+                               } // else the cookie remains.
+                       } elseif ($itemid) {// Set the redirect URI to cookie when not in admin page.
+                               setcookie($CONF['CookiePrefix'] . 'subsilver_uri', serverVar('REQUEST_URI'), 0, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+                       }
+               }
                // Set blogid for the search page.
                global $blogid,$query,$DIR_NUCLEUS;
                if (strpos(realpath('./'),realpath($DIR_NUCLEUS))!==0 && ($query || getVar('search_author')) && !$blogid) {
@@ -74,7 +88,7 @@ try {
                        $this->noblogid=true;
                }
                // Restrict member's admin area.
-               global $member,$DIR_PLUGINS,$HTTP_POST_VARS,$action;
+               global $DIR_PLUGINS,$action;
                if ($member->isAdmin()) return;
                if (strpos(realpath('./'),realpath($DIR_PLUGINS))===0) return;
                if (strpos(realpath('./'),realpath($DIR_NUCLEUS))!==0) return;
@@ -83,6 +97,14 @@ try {
                $obj=&$this->loadClass('member');
                return $obj->event_PostAuthentication();
        }
+       function event_AdminPrePageHead(&$data){
+               if ($this->returntoforum){
+                       // Note that this occurs when cookie is set in POST mode
+                       // but requestVar('subsilver_action') isn't 'returntoforum'
+                       redirect($this->returntoforum);
+                       exit;
+               }
+       }
 /* General stuffs when the skin parse */
        function event_InitSkinParse(&$data){
                // Reset global $blogid if it's set in event_PostAuthentication.
@@ -199,7 +221,7 @@ try {
                        return $obj->posting('PostAddComment',$data);
                } else {
                        $obj=&$this->loadClass('comments');
-                       return $obj->event_PostAddComment(&$data);
+                       return $obj->event_PostAddComment($data);
                }
        }
        // PostAddItem event occurs when a new blog is created.
@@ -214,19 +236,19 @@ try {
 /* Following events are used when the comment is modified */
        function event_PreDeleteComment(&$data){
                $obj=&$this->loadClass('comments');
-               return $obj->event_PreDeleteComment(&$data);
+               return $obj->event_PreDeleteComment($data);
        }
        function event_PostDeleteComment(&$data){
                $obj=&$this->loadClass('comments');
-               return $obj->event_PostDeleteComment(&$data);
+               return $obj->event_PostDeleteComment($data);
        }
        function event_PrepareCommentForEdit(&$data){
                $obj=&$this->loadClass('comments');
-               return $obj->event_PrepareCommentForEdit(&$data);
+               return $obj->event_PrepareCommentForEdit($data);
        }
        function event_PreUpdateComment(&$data){
                $obj=&$this->loadClass('comments');
-               return $obj->event_PreUpdateComment(&$data);
+               return $obj->event_PreUpdateComment($data);
        }
 /* General class object manager */
        var $classobjects=array();
index 590f31d..978b242 100644 (file)
@@ -5,10 +5,12 @@
 </tr>
 <tr>
   <td align="left" valign="middle" width="50">
+    <%if(subSilver,member,can=postnew)%>
     <form method="post" action="#nucleus_cf" style="position:absolute;">
     <input type="hidden" name="subSilver_action" value="posting" />
     <input type="image" src="<%skinfile(images/lang_english/post.gif)%>" alt="トピックの新規投稿" title="トピックの新規投稿" />
     </form><img src="<%skinfile(images/lang_english/post.gif)%>" alt="トピックの新規投稿" title="トピックの新規投稿" />
+    <%endif%>
   </td>
   <td class="nav" align="left" valign="middle" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="<%sitevar(url)%>" class="nav"><%sitevar(name)%> フォーラム一覧</a> -&gt; <a class="nav" href="?catid=<%category(id)%>&amp;blogid=<%blogsetting(id)%>"><%category(name)%></a></span></td>
   <td class="nav" align="right" nowrap="nowrap" valign="bottom">
 <table align="center" border="0" cellpadding="2" cellspacing="2" width="100%">
 <tbody><tr>
   <td align="left" valign="middle" width="50">
+    <%if(subSilver,member,can=postnew)%>
     <form method="post" action="#nucleus_cf" style="position:absolute;">
     <input type="hidden" name="subSilver_action" value="posting" />
     <input type="image" src="<%skinfile(images/lang_english/post.gif)%>" alt="トピックの新規投稿" title="トピックの新規投稿" />
     </form><img src="<%skinfile(images/lang_english/post.gif)%>" alt="トピックの新規投稿" title="トピックの新規投稿" />
+    <%endif%>
   </td>
   <td align="left" valign="middle" width="100%"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="<%sitevar(url)%>" class="nav"><%sitevar(name)%> フォーラム一覧</a> -&gt; <a class="nav" href="?catid=<%category(id)%>&amp;blogid=<%blogsetting(id)%>"><%category(name)%></a></span></td>
   <td align="right" nowrap="nowrap" valign="middle"><br /><span class="nav"></span>
index 0f0e8a6..9580872 100644 (file)
@@ -6,6 +6,7 @@
   </tr>
 </table>
 
+<%if(admin)%>
 <%subSilver(includelanguage,faq.inc)%><br />
 <%subSilver(includelanguage,faq1.inc)%><br />
 <%subSilver(includelanguage,faq2.inc)%><br />
@@ -14,3 +15,6 @@
 <%subSilver(includelanguage,faq5.inc)%><br />
 <%subSilver(includelanguage,faq6.inc)%><br />
 <%subSilver(includelanguage,faq7.inc)%><br />
+<%else%>
+FAQは現在準備中です。
+<%endif%>
\ No newline at end of file
index 8ae6ce2..b43e957 100644 (file)
@@ -5,7 +5,7 @@
 <table border="0" cellpadding="2" cellspacing="2" width="100%">
   <tbody><tr>
        <td colspan="2" align="left" valign="bottom"><a class="maintitle" href="?itemid=<%itemid%>"><%itemtitle%></a>
-        <%if(admin)%><a href="<%adminurl%>?action=itemedit&itemid=<%itemid%>"><img src="<%skinfile(images/lang_english/icon_edit.gif)%>"/ alt="edit" title="edit" /></a><%endif%>
+        <%if(admin)%><a href="<%adminurl%>?action=itemedit&amp;itemid=<%itemid%>&amp;subsilver_action=returntoforum"><img src="<%skinfile(images/lang_english/icon_edit.gif)%>"/ alt="edit" title="edit" /></a><%endif%>
         <br /><span class="gensmall"><b></b><br />
          &nbsp; </span></td>
   </tr>
@@ -15,6 +15,7 @@
   <tbody><tr>
     <td align="left" nowrap="nowrap" valign="bottom">
       <span class="nav">
+        <%if(subSilver,member,can=postnew)%>
         <input type="image" name="subSilver_action" value="posting" src="<%skinfile(images/lang_english/post.gif)%>" alt="トピックの新規投稿" title="トピックの新規投稿" onclick="
 document.getElementById('subsilver_form_body').value='';
 document.getElementById('subsilver_form_dummy').name=this.name;
@@ -22,12 +23,15 @@ document.getElementById('subsilver_form_dummy').value=this.value;
 return true;
 " />
         &nbsp;&nbsp;
+        <%endif%>
+        <%if(subSilver,member,can=reply)%>
         <input type="image" name="subSilver_action" value="commentform" src="<%skinfile(images/lang_english/reply.gif)%>" alt="返信" title="返信" onclick="
 document.getElementById('subsilver_form_body').value='';
 document.getElementById('subsilver_form_dummy').name=this.name;
 document.getElementById('subsilver_form_dummy').value=this.value;
 return true;
 " />
+        <%endif%>
       </span>
     </td>
        <td align="left" valign="middle"><span class="nav">&nbsp;&nbsp;&nbsp;<a href="<%sitevar(url)%>" class="nav"><%sitevar(name)%> フォーラム一覧</a> -&gt; <a class="nav" href="<%self%>?catid=<%category(id)%>&amp;blogid=<%blogsetting(id)%>"><%category(name)%></a></span></td>
@@ -60,6 +64,7 @@ return true;
   <tbody><tr>
     <td align="left" nowrap="nowrap" valign="bottom">
       <span class="nav">
+        <%if(subSilver,member,can=postnew)%>
         <input type="image" name="subSilver_action" value="posting" src="<%skinfile(images/lang_english/post.gif)%>" alt="トピックの新規投稿" title="トピックの新規投稿" onclick="
 document.getElementById('subsilver_form_body').value='';
 document.getElementById('subsilver_form_dummy').name=this.name;
@@ -67,12 +72,15 @@ document.getElementById('subsilver_form_dummy').value=this.value;
 return true;
 " />
         &nbsp;&nbsp;
+        <%endif%>
+        <%if(subSilver,member,can=reply)%>
         <input type="image" name="subSilver_action" value="commentform" src="<%skinfile(images/lang_english/reply.gif)%>" alt="返信" title="返信" onclick="
 document.getElementById('subsilver_form_body').value='';
 document.getElementById('subsilver_form_dummy').name=this.name;
 document.getElementById('subsilver_form_dummy').value=this.value;
 return true;
 " />
+        <%endif%>
       </span>
     </td>
        <td align="right" nowrap="nowrap" valign="top">
index 1838e6b..ff83769 100644 (file)
@@ -2,7 +2,7 @@
 
 <table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
   <tr>
-  <td class="catHead" colspan="2" height="28"><span class="cattitle"><a href="viewonline.php?sid=10078eb7dbbadbd85d2f386ceb800a0a" class="cattitle">オンライン管理</a></span></td>
+  <td class="catHead" colspan="2" height="28"><span class="cattitle">オンライン管理</span></td>
   </tr>
   <tr>
   <td class="row1" align="center" valign="middle" rowspan="2"><img src="<%skinfile(images/whosonline.gif)%>" alt="オンライン管理" /></td>
index 30f3974..ab5ed14 100644 (file)
@@ -147,12 +147,10 @@ title="<:categoryicon:<%catid%>:新しい記事有り:新しい記事無し:ロ
       <td nowrap="nowrap" valign="top"><input type="image" name="subSilver_action" value="commentform" src="<%skinfile(images/lang_english/icon_quote.gif)%>" alt="引用" title="引用" onclick="
 document.getElementById('subsilver_form_body').value=
   '[quote=<%user(realname)%>]' + document.getElementById('commentbody_<%commentid%>').innerHTML + '[/quote]';
-document.getElementById('subsilver_form_dummy').name=this.name;
-document.getElementById('subsilver_form_dummy').value=this.value;
 return true;
 " />
     <%subSilver(if,caneditcomment)%>
-      <a href="<%subSilver(adminurl)%>?action=commentedit&commentid=<%commentid%>" ><img src="<%skinfile(images/lang_english/icon_edit.gif)%>" alt="edit" title="edit" border="0" /></a>
+      <a href="<%subSilver(adminurl)%>?action=commentedit&amp;commentid=<%commentid%>&amp;subsilver_action=returntoforum" ><img src="<%skinfile(images/lang_english/icon_edit.gif)%>" alt="edit" title="edit" border="0" /></a>
     <%subSilver(endif)%>
     </td>
     </tr>