plugins/Newsboy.php
changeset 22 7f0d9fa561f4
parent 21 af40ef1982dd
parent 20 1cbefc789a46
child 23 6a501b41907f
--- a/plugins/Newsboy.php	Sun Jan 10 17:36:29 2010 -0500
+++ b/plugins/Newsboy.php	Sun Jan 10 17:36:47 2010 -0500
@@ -718,7 +718,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 )
@@ -763,12 +764,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