Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Utorok, 13. október 2026

Rozdiely pre phpMyEdit/extensions/phpMyEdit-messages.class.php medzi verziami 1.5 a 1.6

verzia 1.5, 2003/03/31 18:25:39 verzia 1.6, 2003/05/31 21:22:07
Riadok 6 
Riadok 6 
    Done.     Done.
    -- Nepto [16/3/2003] */     -- Nepto [16/3/2003] */
   
 /* $Platon: phpMyEdit/extensions/phpMyEdit-messages.class.php,v 1.4 2003/03/17 19:29:44 nepto Exp $ */  /* $Platon: phpMyEdit/extensions/phpMyEdit-messages.class.php,v 1.5 2003/03/31 18:25:39 nepto Exp $ */
   
 require_once dirname(__FILE__).'/../phpMyEdit.class.php';  require_once dirname(__FILE__).'/../phpMyEdit.class.php';
   
Riadok 42  class phpMyEdit_messages extends phpMyEd
Riadok 42  class phpMyEdit_messages extends phpMyEd
                 }                  }
                 !isset($ezin_admin_article) && $ezin_admin_article = $this->get_cgi_var('article_id');                  !isset($ezin_admin_article) && $ezin_admin_article = $this->get_cgi_var('article_id');
                 $ezin_admin_article = intval($ezin_admin_article);                  $ezin_admin_article = intval($ezin_admin_article);
                 echo '<form method=post action="'.$PHP_SELF.'">' . "\n";                  $query = sprintf('SELECT article_id, count(id) AS messages FROM %s'
                                   .' GROUP BY article_id HAVING article_id = %d',
                                   $this->tb, intval($ezin_admin_article));
                   if (($result = $this->myquery($query)) == false) {
                           return false;
                   }
                   $row = @mysql_fetch_array($result, MYSQL_ASSOC);
                   $ezin_admin_article  = intval($row['article_id']);
                   $ezin_admin_msgcount = intval($row['messages']);
                   @mysql_free_result($result);
   
                 ob_start();                  echo '<form class="',$this->getCSSclass('form');
                 $valid_article = $this->message_nav_buttons($ezin_admin_article);                  echo '" action="',$page_name,'" method="POST">',"\n";
                 $HTML_nav_buttons = ob_get_contents();  
                 ob_end_clean();  
   
                 if ($this->nav_up()) {                  if ($this->nav_up() || $ezin_admin_article <= 0) {
                         echo str_replace('<<<<<pos>>>>>', 'up', $HTML_nav_buttons);                          $this->message_nav_buttons($ezin_admin_article, $ezin_admin_msgcount, 'up');
                         echo '<hr>';                          echo '<hr class="',$this->getCSSclass('hr', 'up'),'">',"\n";
                         if (! $valid_article) {  
                                 $HTML_nav_buttons = '';  
                         }  
                 }                  }
   
                 if ($valid_article) {                  if ($ezin_admin_article > 0) {
                         echo '<table width="100%" border=1 cellpadding=1 cellspacing=0';                          echo '<table class="',$this->getCSSclass('main'),'" summary="',$this->tb,'">',"\n";
                         echo ' summary="ezin_messages">';                          echo '<tr class="',$this->getCSSclass('header'),'">',"\n";
                         echo '<tr>';  
                         foreach (array('ID', 'Subject', ' ', 'Author', 'Date & Time', 'IP addresses') as $str) {                          foreach (array('ID', 'Subject', ' ', 'Author', 'Date & Time', 'IP addresses') as $str) {
                                 echo '<th>',Platon::htmlspecialchars2($str),'</th>';                                  echo '<th class="',$this->getCSSclass('header'),'">';
                                   echo Platon::htmlspecialchars2($str),'</th>',"\n";
                         }                          }
                         echo '</tr><tr><td colspan=6><b>Valid messages</b></td></tr>';                          echo '</tr>',"\n";
                           echo '<tr class="',$this->getCSSclass('header'),'">',"\n";
                           echo '<th class="',$this->getCSSclass('header'),'" colspan="6">';
                           echo 'Valid messages</td></tr>',"\n";
                         $message_ids = $this->message_process($ezin_admin_article, 0, 0);                          $message_ids = $this->message_process($ezin_admin_article, 0, 0);
                         $count_message_ids = count($message_ids);                          $count_message_ids = count($message_ids);
                         if ($count_message_ids == 0) {                          if ($count_message_ids == 0) {
                                 echo "<tr><td colspan=6>"                                  echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n";
                                         ."<i>There are no valid messages for this article.</i>"                                  echo '<td class="',$this->getCSSclass('cell', null, true),'" colspan="6">',"\n";
                                         ."</td></tr>";                                  echo '<i>There are no valid messages for this article.</i>';
                                   echo '</td></tr>',"\n";
                         }                          }
                         $query = sprintf('SELECT id, parent, article_id, author,'                          $query = sprintf('SELECT id, parent, article_id, author,'
                                         .' email, homepage, subject, datetime, ip'                                          .' email, homepage, subject, datetime, ip'
Riadok 87  class phpMyEdit_messages extends phpMyEd
Riadok 95  class phpMyEdit_messages extends phpMyEd
                         }                          }
                         @mysql_free_result($result);                          @mysql_free_result($result);
                         $all_ids = array_diff($all_ids, $message_ids);                          $all_ids = array_diff($all_ids, $message_ids);
                         echo '<tr><td colspan=6><b>Invalid messages</b></td></tr>';                          echo '<tr class="',$this->getCSSclass('header'),'">',"\n";
                           echo '<th class="',$this->getCSSclass('header'),'" colspan="6">';
                           echo 'Invalid messages</td></tr>',"\n";
                         if (count($all_ids) > 0) {                          if (count($all_ids) > 0) {
                                 /* To force buttons */                                  /* To force buttons */
                                 $count_message_ids = -1;                                  $count_message_ids = -1;
Riadok 98  class phpMyEdit_messages extends phpMyEd
Riadok 108  class phpMyEdit_messages extends phpMyEd
                                         $all_ids = array_diff($all_ids, $sub_ids);                                          $all_ids = array_diff($all_ids, $sub_ids);
                                 }                                  }
                         } else {                          } else {
                                 echo '<tr><td colspan=6>'                                  echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n";
                                         .'<i>There are no invalid messages for this article.</i>'                                  echo '<td class="',$this->getCSSclass('cell', null, true),'" colspan="6">',"\n";
                                         .'</td></tr>';                                  echo '<i>There are no invalid messages for this article.</i>';
                                   echo '</td></tr>',"\n";
                         }                          }
                         echo '</table>';                          echo '</table>';
                 }                  }
                 if ($this->nav_down() && strlen($HTML_nav_buttons) > 0) {                  if ($this->nav_down() && $ezin_admin_article > 0) {
                         if ($this->nav_up() || $valid_article) {                          echo '<hr class="',$this->getCSSclass('hr', 'down'),'">',"\n";
                                 echo '<hr>';                          $this->message_nav_buttons($ezin_admin_article, $ezin_admin_msgcount, 'down');
                         }  
                         echo str_replace('<<<<<pos>>>>>', 'down', $HTML_nav_buttons);  
                 }                  }
                 echo '<input type=hidden name=article_id value="'.$ezin_admin_article.'">' . "\n";                  echo '<input type="hidden" name="article_id" value="',$ezin_admin_article,'">',"\n";
                 echo '</form>' . "\n";                  echo '</form>',"\n";
         } /* }}} */          } /* }}} */
   
         function message_process($article_id, $id, $level = 0, $parent = true) /* {{{ */          function message_process($article_id, $id, $level = 0, $parent = true) /* {{{ */
Riadok 135  class phpMyEdit_messages extends phpMyEd
Riadok 144  class phpMyEdit_messages extends phpMyEd
                 }                  }
                 $checked = ! $level && $parent ? ' checked' : '';                  $checked = ! $level && $parent ? ' checked' : '';
                 for ($i = 0; $i < count($ar); $i++) {                  for ($i = 0; $i < count($ar); $i++) {
                         echo '<tr>';                          echo '<tr class="',$this->getCSSclass('row', null, 'next'),'">',"\n";
                         echo '<td>'.$ar[$i]['id'].'</td>';                          $css_class_name  = $this->getCSSclass('cell', null, true);
                         echo '<td align=left>';                          $css_class_name2 = $this->getCSSclass('navigation', null, true);
                           echo '<td class="',$css_class_name,'">',$ar[$i]['id'],'</td>',"\n";
                           echo '<td class="',$css_class_name,'">';
                         for ($j = 0; $j < $level; $j++) {                          for ($j = 0; $j < $level; $j++) {
                                 echo '&nbsp;&nbsp;&nbsp;';                                  echo '&nbsp;&nbsp;&nbsp;';
                         }                          }
                         echo htmlspecialchars($ar[$i]['subject']);                          echo htmlspecialchars($ar[$i]['subject']);
                         echo '</td><td>';                          echo '</td>',"\n";
                         echo '<input'.$checked.' type=radio name=rec value="';                          echo '<td class="',$css_class_name2,'">';
                         echo $ar[$i]['id'].'" class="link">';                          echo '<input',$checked,' class="',$css_class_name2,'" type="radio" name="rec"';
                         echo '</td>';                          echo ' value="',$ar[$i]['id'],'" class="link"></td>',"\n";
                         echo '<td>'.htmlspecialchars($ar[$i]['author']).'</td>';                          echo '<td class="',$css_class_name,'">',htmlspecialchars($ar[$i]['author']),  '</td>';
                         echo '<td>'.htmlspecialchars($ar[$i]['datetime']).'</td>';                          echo '<td class="',$css_class_name,'">',htmlspecialchars($ar[$i]['datetime']),'</td>';
                         // TODO: do resolving                          // TODO: do resolving
                         echo '<td><small>';                          echo '<td class="',$css_class_name,'"><small>';
                         // this shoud be global IP-adress-deliminator                          // this shoud be global IP-adress-deliminator
                         $output = false;                          $output = false;
                         $ar_ip  = preg_split('|([ ]*[ \\/,;]+[ ]*)|', $ar[$i]['ip'], -1, PREG_SPLIT_DELIM_CAPTURE);                          $ar_ip  = preg_split('|([ ]*[ \\/,;]+[ ]*)|', $ar[$i]['ip'], -1, PREG_SPLIT_DELIM_CAPTURE);
Riadok 157  class phpMyEdit_messages extends phpMyEd
Riadok 168  class phpMyEdit_messages extends phpMyEd
                                 if (strlen($output) > 0) {                                  if (strlen($output) > 0) {
                                         $output = true;                                          $output = true;
                                 }                                  }
                                   $ip = htmlspecialchars($ip);
                                 if (preg_match('/^(\d{1,3}\.){3}\d{1,3}$/', $ip)) {                                  if (preg_match('/^(\d{1,3}\.){3}\d{1,3}$/', $ip)) {
                                         echo '<a target=_blank href="http://'.$ip.'">';                                          echo '<a class="',$css_class_name,'" target="_blank" href="http://',$ip,'">';
                                         echo '<small>'.$ip.'</small></a>';                                          echo '<small>',$ip,'</small></a>';
                                 } else {                                  } else {
                                         echo $ip;                                          echo $ip;
                                 }                                  }
Riadok 167  class phpMyEdit_messages extends phpMyEd
Riadok 179  class phpMyEdit_messages extends phpMyEd
                         if (! $output) {                          if (! $output) {
                                 echo '&nbsp;';                                  echo '&nbsp;';
                         }                          }
                         echo '</small></td></tr>' . "\n";                          echo '</small></td>',"\n";
                           echo '</tr>',"\n";
                         if ($parent) {                          if ($parent) {
                                 $ar_out = array_merge($ar_out, $this->message_process(                                  $ar_out = array_merge($ar_out, $this->message_process(
                                                         $article_id, $ar[$i]['id'], $level + 1));                                                          $article_id, $ar[$i]['id'], $level + 1));
Riadok 177  class phpMyEdit_messages extends phpMyEd
Riadok 190  class phpMyEdit_messages extends phpMyEd
                 return $ar_out;                  return $ar_out;
         } /* }}} */          } /* }}} */
   
         /*          function message_nav_buttons($article_id, $messages_count, $position) /* {{{ */
          * ezin_admin_message_nav_buttons()          {
          */                  echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n";
                   echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
         function message_nav_buttons($ezin_admin_article) /* {{{ */                  echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
         {                  $this->print_article_select($article_id, 0, $position);
                 $valid_article = 0;                  echo '</td>',"\n";
                 /* All articles query */                  echo '<td class="',$this->getCSSclass('buttons2', $position),'">',"\n";
                 $query = 'SELECT id, title, atitle, UNIX_TIMESTAMP(datetime) AS date'                  if ($article_id > 0) {
                         .' FROM '.$this->tb2                          if ($this->add_enabled()) {
                         .' ORDER BY date DESC';                                  echo '<input class="',$this->getCSSclass('prev', $position);
                 if (($result = $this->myquery($query)) == false) {                                  echo '" type="submit" name="operation" value="',$this->labels['Add'],'">&nbsp;';
                         return false;                          }
                           if ($messages_count > 0) {
                                   if ($this->view_enabled()) {
                                           echo '<input class="',$this->getCSSclass('view', $position),'"';
                                           echo ' type="submit" name="operation" value="',$this->labels['View'],'">&nbsp;';
                                   }
                                   if ($this->change_enabled()) {
                                           echo '<input class="',$this->getCSSclass('change', $position),'"';
                                           echo ' type="submit" name="operation" value="',$this->labels['Change'],'">&nbsp;';
                                   }
                                   if ($this->delete_enabled()) {
                                           echo '<input class="',$this->getCSSclass('delete', $position),'"';
                                           echo ' type="submit" name="operation" value="',$this->labels['Delete'],'">&nbsp;';
                                   }
                           }
                 }                  }
                 echo '<table border=0 cellpadding=0 cellpsacing=0 width="100%" style="border:0;padding:0;">',"\n";                  echo '</td></tr></table>',"\n";
                 echo '<tr><td align=left style="text-align:left;border:0;padding:0;" nowrap>',"\n";          } /* }}} */
                 echo '<select name="ezin_admin_article_<<<<<pos>>>>>" size="1">',"\n";  
                 echo '<option value="0">-- Choose article --</option>',"\n";          function display_record_buttons() /* {{{ */
                 for ($k = 0; ($row = @mysql_fetch_array($result, MYSQL_ASSOC)); $k++) {          {
                         $row['title'] = empty($row['title']) ? $row['atitle'] : $row['title'];                  echo '<table class="',$this->getCSSclass('navigation', $position),'">',"\n";
                         $row['title'] = Platon::pretty_substr(strip_tags($row['title']), 40);                  echo '<tr class="',$this->getCSSclass('navigation', $position),'">',"\n";
                         echo '<option';                  echo '<td class="',$this->getCSSclass('buttons', $position),'">',"\n";
                         if ($ezin_admin_article == $row['id']) {                  $this->print_article_select($article_id, 1, $position);
                                 echo ' selected';                  echo '</td>',"\n";
                                 $valid_article = 1;                  if (strlen(@$this->message) > 0) {
                           echo '<td class="',$this->getCSSclass('message', $position),'">',$this->message,'</td>',"\n";
                   }
                   echo '<td class="',$this->getCSSclass('buttons2', $position),'">',"\n";
                   if ($this->change_operation()) {
                           echo '<input class="',$this->getCSSclass('save', $position);
                           echo '" type="submit" name="savechange" value="',$this->labels['Save'],'">&nbsp;';
                           echo '<input class="',$this->getCSSclass('more', $position);
                           echo '" type="submit" name="morechange" value="',$this->labels['Apply'],'">&nbsp;';
                           echo '<input class="',$this->getCSSclass('cancel', $position);
                           echo '" type="button" name="cancel" value="',$this->labels['Cancel'];
                           echo '" onClick="form.submit();">',"\n";
                   } elseif ($this->add_operation()) {
                           echo '<input class="',$this->getCSSclass('save', $position);
                           echo '" type="submit" name="saveadd" value="',$this->labels['Save'],'">&nbsp;';
                           echo '<input class="',$this->getCSSclass('more', $position);
                           echo '" type="submit" name="moreadd" value="',$this->labels['More'],'">&nbsp;';
                           echo '<input class="',$this->getCSSclass('cancel', $position);
                           echo '" type="button" name="cancel" value="',$this->labels['Cancel'];
                           echo '" onClick="form.submit();">',"\n";
                   } elseif ($this->delete_operation()) {
                           echo '<input class="',$this->getCSSclass('save', $position);
                           echo '" type="submit" name="savedelete" value="',$this->labels['Delete'],'">&nbsp;';
                           echo '<input class="',$this->getCSSclass('cancel', $position);
                           echo '" type="button" name="cancel" value="',$this->labels['Cancel'];
                           echo '" onClick="form.submit();">',"\n";
                   } elseif ($this->view_operation()) {
                           if ($this->change_enabled()) {
                                   echo '<input class="',$this->getCSSclass('save', $position);
                                   echo '" type="submit" name="operation" value="',$this->labels['Change'],'">&nbsp;';
                         }                          }
                         echo ' value="',$row['id'],'">',$row['title'];                          echo '<input class="',$this->getCSSclass('cancel', $position);
                         echo ' (',date($this->format_date, $row['date']),')'; // )                          echo '" type="submit" name="cancel" value="',$this->labels['Cancel'],'">',"\n";
                         echo '</option>',"\n";  
                 }                  }
                 @mysql_free_result($result);                  // Message is now written here
                 echo '</select>',"\n";                  echo '</td>',"\n";
                 echo '<input type=submit name=ezin_admin_article_change_<<<<<pos>>>>> value=" &gt; ">&nbsp;',"\n";                  echo '</tr></table>',"\n";
                 echo '</td><td align=right>',"\n";          } /* }}} */
                 if ($valid_article) {  
                         $query = sprintf('SELECT count(id) AS messages FROM %s WHERE article_id = %d',          function print_article_select($selected_id, $disabled, $position) /* {{{ */
                                         $this->tb, intval($ezin_admin_article));          {
                   if ($selected_id <= 0) {
                           $rec = intval($this->get_cgi_var('rec'));
                           if ($rec > 0) {
                                   $query  = sprintf('SELECT article_id FROM %s WHERE id = %d',
                                                   $this->tb, $rec);
                                   $result = $this->myquery($query);
                                   if ($result != false) {
                                           $row = @mysql_fetch_array($result, MYSQL_NUM);
                                           $selected_id = $row[0];
                                   }
                                   @mysql_free_result($result);
                           }
                   }
                   static $articles = null;
                   if ($articles == null) {
                           $articles = array();
                           $query = 'SELECT id, title, atitle, UNIX_TIMESTAMP(datetime) AS date'
                                   .' FROM '.$this->tb2
                                   .' ORDER BY date DESC';
                         if (($result = $this->myquery($query)) == false) {                          if (($result = $this->myquery($query)) == false) {
                                 return false;                                  return false;
                         }                          }
                         if ($row = @mysql_fetch_array($result, MYSQL_ASSOC)) {                          for ($k = 0; ($row = @mysql_fetch_array($result, MYSQL_ASSOC)); $k++) {
                                 $count_message_ids = $row['messages'];                                  $articles[] = $row;
                         }                          }
                         @mysql_free_result($result);                          @mysql_free_result($result);
                         $this->add_enabled() && $this->print_message_button($this->labels['Add']);                  }
                         if ($count_message_ids != 0) {                  echo '<select',($disabled ? ' disabled' : '');
                                 $this->change_enabled() && $this->print_message_button($this->labels['Change']);                  echo ' name="ezin_admin_article_',$position,'" size="1">',"\n";
                                 $this->view_enabled()   && $this->print_message_button($this->labels['View']);                  echo '<option value="0">-- Choose article --</option>',"\n";
                                 $this->delete_enabled() && $this->print_message_button($this->labels['Delete']);                  foreach ($articles as $row) {
                           $row['title'] = empty($row['title']) ? $row['atitle'] : $row['title'];
                           $row['title'] = Platon::pretty_substr(strip_tags($row['title']), 40);
                           echo '<option'.($selected_id == $row['id'] ? ' selected' : '');
                           echo ' value="',$row['id'],'">',$row['title'];
                           if ($row['date'] > 0) {
                                   echo ' (',date($this->format_date, $row['date']),')'; // )
                         }                          }
                           echo '</option>',"\n";
                   }
                   echo '</select>',"\n";
                   if (! $disabled) {
                           echo '<input type="submit" name="ezin_admin_article_change_',$position,'" value=" &gt; ">&nbsp;',"\n";
                 }                  }
                 echo '</td></tr></table>' . "\n";                  return true;
                 return $valid_article;  
         } /* }}} */          } /* }}} */
   
         function print_message_button($label) /* {{{ */  
         {  
                 echo '<input type="submit" name="operation" value="'.$label.'" />&nbsp';  
         } /* }}} */  
 }  }
   
 /* Modeline for ViM {{{  /* Modeline for ViM {{{

Legend:
Odstranené z verzie1.5  
zmenené riadky
  Pridané vo verzii1.6

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok