Improved 1.1.6/1.1.7 compatibility
authorDan
Sat, 19 Dec 2009 01:37:40 +0000
changeset 20 1cbefc789a46
parent 19 93c01ea4366b
child 22 7f0d9fa561f4
Improved 1.1.6/1.1.7 compatibility
plugins/Newsboy.php
--- a/plugins/Newsboy.php	Tue May 05 22:35:52 2009 +0000
+++ b/plugins/Newsboy.php	Sat Dec 19 01:37:40 2009 +0000
@@ -715,7 +715,8 @@
             $time = mktime($hour, $minute, $second, $month, $day, $year);
           }
           
-          if ( isset($paths->pages[ $paths->nslist['NewsBoy'] . $time ]) && $paths->pages[ $paths->nslist['NewsBoy'] . $time ] != $paths->pages[ $paths->nslist['NewsBoy'] . $_POST['page_id'] ] )
+          $time_changed = $time !== intval($_POST['page_id']);
+          if ( isPage($paths->nslist['NewsBoy'] . $time) && $time_changed ) // $paths->pages[ $paths->nslist['NewsBoy'] . $time ] != $paths->pages[ $paths->nslist['NewsBoy'] . $_POST['page_id'] ] )
             $errors[] = 'You cannot have two news articles with the same publish time.';
           
           if ( count($errors) < 1 )
@@ -760,12 +761,13 @@
           echo '<div class="warning-box">Errors encountered while saving data:<ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>';
         
         // Obtain page information
-        if ( !isset($paths->pages[ $paths->nslist['NewsBoy'] . $_GET['id'] ]) )
+        if ( !isPage($paths->nslist['NewsBoy'] . $_GET['id']) )
         {
           echo 'Invalid ID';
           return false;
         }
-        $page_info =& $paths->pages[ $paths->nslist['NewsBoy'] . $_GET['id'] ];
+        $page = namespace_factory($_GET['id'], 'NewsBoy');
+        $page_info = $page->get_cdata();
         $time = intval($page_info['urlname_nons']);
         
         // Get author