plugins/Newsboy.php
changeset 22 7f0d9fa561f4
parent 21 af40ef1982dd
parent 20 1cbefc789a46
child 23 6a501b41907f
equal deleted inserted replaced
21:af40ef1982dd 22:7f0d9fa561f4
   716           if ( count($errors) < 1 )
   716           if ( count($errors) < 1 )
   717           {
   717           {
   718             $time = mktime($hour, $minute, $second, $month, $day, $year);
   718             $time = mktime($hour, $minute, $second, $month, $day, $year);
   719           }
   719           }
   720           
   720           
   721           if ( isset($paths->pages[ $paths->nslist['NewsBoy'] . $time ]) && $paths->pages[ $paths->nslist['NewsBoy'] . $time ] != $paths->pages[ $paths->nslist['NewsBoy'] . $_POST['page_id'] ] )
   721           $time_changed = $time !== intval($_POST['page_id']);
       
   722           if ( isPage($paths->nslist['NewsBoy'] . $time) && $time_changed ) // $paths->pages[ $paths->nslist['NewsBoy'] . $time ] != $paths->pages[ $paths->nslist['NewsBoy'] . $_POST['page_id'] ] )
   722             $errors[] = 'You cannot have two news articles with the same publish time.';
   723             $errors[] = 'You cannot have two news articles with the same publish time.';
   723           
   724           
   724           if ( count($errors) < 1 )
   725           if ( count($errors) < 1 )
   725           {
   726           {
   726             $publ = ( isset($_POST['published']) ) ? '1' : '0';
   727             $publ = ( isset($_POST['published']) ) ? '1' : '0';
   761         
   762         
   762         if ( count($errors) > 0 )
   763         if ( count($errors) > 0 )
   763           echo '<div class="warning-box">Errors encountered while saving data:<ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>';
   764           echo '<div class="warning-box">Errors encountered while saving data:<ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>';
   764         
   765         
   765         // Obtain page information
   766         // Obtain page information
   766         if ( !isset($paths->pages[ $paths->nslist['NewsBoy'] . $_GET['id'] ]) )
   767         if ( !isPage($paths->nslist['NewsBoy'] . $_GET['id']) )
   767         {
   768         {
   768           echo 'Invalid ID';
   769           echo 'Invalid ID';
   769           return false;
   770           return false;
   770         }
   771         }
   771         $page_info =& $paths->pages[ $paths->nslist['NewsBoy'] . $_GET['id'] ];
   772         $page = namespace_factory($_GET['id'], 'NewsBoy');
       
   773         $page_info = $page->get_cdata();
   772         $time = intval($page_info['urlname_nons']);
   774         $time = intval($page_info['urlname_nons']);
   773         
   775         
   774         // Get author
   776         // Get author
   775         $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;');
   777         $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;');
   776         
   778