plugins/Newsboy.php
changeset 20 1cbefc789a46
parent 19 93c01ea4366b
child 22 7f0d9fa561f4
equal deleted inserted replaced
19:93c01ea4366b 20:1cbefc789a46
   713           if ( count($errors) < 1 )
   713           if ( count($errors) < 1 )
   714           {
   714           {
   715             $time = mktime($hour, $minute, $second, $month, $day, $year);
   715             $time = mktime($hour, $minute, $second, $month, $day, $year);
   716           }
   716           }
   717           
   717           
   718           if ( isset($paths->pages[ $paths->nslist['NewsBoy'] . $time ]) && $paths->pages[ $paths->nslist['NewsBoy'] . $time ] != $paths->pages[ $paths->nslist['NewsBoy'] . $_POST['page_id'] ] )
   718           $time_changed = $time !== intval($_POST['page_id']);
       
   719           if ( isPage($paths->nslist['NewsBoy'] . $time) && $time_changed ) // $paths->pages[ $paths->nslist['NewsBoy'] . $time ] != $paths->pages[ $paths->nslist['NewsBoy'] . $_POST['page_id'] ] )
   719             $errors[] = 'You cannot have two news articles with the same publish time.';
   720             $errors[] = 'You cannot have two news articles with the same publish time.';
   720           
   721           
   721           if ( count($errors) < 1 )
   722           if ( count($errors) < 1 )
   722           {
   723           {
   723             $publ = ( isset($_POST['published']) ) ? '1' : '0';
   724             $publ = ( isset($_POST['published']) ) ? '1' : '0';
   758         
   759         
   759         if ( count($errors) > 0 )
   760         if ( count($errors) > 0 )
   760           echo '<div class="warning-box">Errors encountered while saving data:<ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>';
   761           echo '<div class="warning-box">Errors encountered while saving data:<ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>';
   761         
   762         
   762         // Obtain page information
   763         // Obtain page information
   763         if ( !isset($paths->pages[ $paths->nslist['NewsBoy'] . $_GET['id'] ]) )
   764         if ( !isPage($paths->nslist['NewsBoy'] . $_GET['id']) )
   764         {
   765         {
   765           echo 'Invalid ID';
   766           echo 'Invalid ID';
   766           return false;
   767           return false;
   767         }
   768         }
   768         $page_info =& $paths->pages[ $paths->nslist['NewsBoy'] . $_GET['id'] ];
   769         $page = namespace_factory($_GET['id'], 'NewsBoy');
       
   770         $page_info = $page->get_cdata();
   769         $time = intval($page_info['urlname_nons']);
   771         $time = intval($page_info['urlname_nons']);
   770         
   772         
   771         // Get author
   773         // Get author
   772         $q = $db->sql_query('SELECT author FROM '.table_prefix.'logs WHERE page_id=\'' . $db->escape($page_info['urlname_nons']) . '\' AND namespace=\'NewsBoy\' AND action=\'create\' ORDER BY time_id DESC LIMIT 1;');
   774         $q = $db->sql_query('SELECT author FROM '.table_prefix.'logs WHERE page_id=\'' . $db->escape($page_info['urlname_nons']) . '\' AND namespace=\'NewsBoy\' AND action=\'create\' ORDER BY time_id DESC LIMIT 1;');
   773         
   775