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.2 a 1.3

verzia 1.2, 2002/11/27 22:28:40 verzia 1.3, 2003/03/16 04:25:50
Riadok 1 
Riadok 1 
 <?php  <?php
   
 /* This should be completelly rewritten.  /* This should be completelly rewritten.
    -- Nepto [21/11/2002] */     -- Nepto [21/11/2002]
   
      Done.
      -- Nepto [16/3/2003] */
   
   /* $Platon: $ */
   
 require_once dirname(__FILE__).'/../phpMyEdit.class.php';  require_once dirname(__FILE__).'/../phpMyEdit.class.php';
   
Riadok 15  class phpMyEdit_messages extends phpMyEd
Riadok 20  class phpMyEdit_messages extends phpMyEd
                 parent::phpMyEdit($opts);                  parent::phpMyEdit($opts);
                 $this->tb2         = $opts['tb2'];                  $this->tb2         = $opts['tb2'];
                 $this->format_date = $opts['format_date'];                  $this->format_date = $opts['format_date'];
   
                 if ($this->add_operation() || ($this->get_cgi_var('rec') &&                  /* Preserved article ID in CGI environment. */
                                         ($this->change_operation()                  /* TODO: change to $this->article_id or something like this */
                                          || $this->view_operation()                  global $ezin_admin_article;
                                          || $this->delete_operation()))) {                  $ezin_admin_article = $this->get_cgi_var('article_id');
                         // do nothing  
                         // $mode = 2;  
                 } elseif ($this->savechange == $this->labels['Save']  
                                 || $this->moreadd == $this->labels['More']  
                                 || $this->saveadd == $this->labels['Save']  
                                 || $this->savedelete == $this->labels['Delete']) {  
   
                         /* Variable $fm is temporary storage for article_id value.  
                            Remember this carefully. */  
                         $fm = $this->get_cgi_var('fm');  
   
                         if ($this->moreadd == $this->labels['More']  
                                         || $this->saveadd == $this->labels['Save']) {  
                                 $opts['cgi']['overwrite']['article_id'] = $fm;  
                                 $opts['cgi']['append']['parent']        = 0;  
                                 $opts['fdd']['article_id']['options']   = 'ACFVD';  
                                 // constructor re-call  
                                 parent::phpMyEdit($opts);  
                                 $this->saveadd = $this->labels['Save'];  
                                 $this->moreadd = '';  
                                 ezin_update_message_count($fm, 1, 1);  
                         }  
   
                         if ($this->savedelete == $this->labels['Delete']) {  
                                 ezin_update_message_count($fm, -1, 1);  
                         }  
                 }  
   
                 $execute && $this->execute();                  $execute && $this->execute();
         } /* }}} */          } /* }}} */
Riadok 57  class phpMyEdit_messages extends phpMyEd
Riadok 35  class phpMyEdit_messages extends phpMyEd
                 $PHP_SELF = $HTTP_POST_VARS['PHP_SELF'];                  $PHP_SELF = $HTTP_POST_VARS['PHP_SELF'];
                 $ezin_admin_article_change_up = $this->get_cgi_var('ezin_admin_article_change_up');                  $ezin_admin_article_change_up = $this->get_cgi_var('ezin_admin_article_change_up');
                 $ezin_admin_article_change_down = $this->get_cgi_var('ezin_admin_article_change_down');                  $ezin_admin_article_change_down = $this->get_cgi_var('ezin_admin_article_change_down');
   
                 if (isset($ezin_admin_article_change_up)) {                  if (isset($ezin_admin_article_change_up)) {
                         $ezin_admin_article = $this->get_cgi_var('ezin_admin_article_up');                          $ezin_admin_article = $this->get_cgi_var('ezin_admin_article_up');
                 } elseif (isset($ezin_admin_article_change_down)) {                  } elseif (isset($ezin_admin_article_change_down)) {
                         $ezin_admin_article = $this->get_cgi_var('ezin_admin_article_down');                          $ezin_admin_article = $this->get_cgi_var('ezin_admin_article_down');
                 }                  }
                 !isset($ezin_admin_article) && $ezin_admin_article = $this->get_cgi_var('fm');                  !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";                  echo '<form method=post action="'.$PHP_SELF.'">' . "\n";
   
Riadok 81  class phpMyEdit_messages extends phpMyEd
Riadok 58  class phpMyEdit_messages extends phpMyEd
                 }                  }
   
                 if ($valid_article) {                  if ($valid_article) {
   
                         echo '<table width="100%" border=1 cellpadding=1 cellspacing=0';                          echo '<table width="100%" border=1 cellpadding=1 cellspacing=0';
                         echo ' summary="ezin_messages">';                          echo ' summary="ezin_messages">';
                         echo '<tr>';                          echo '<tr>';
Riadok 89  class phpMyEdit_messages extends phpMyEd
Riadok 65  class phpMyEdit_messages extends phpMyEd
                                 echo '<th>',Platon::htmlspecialchars2($str),'</th>';                                  echo '<th>',Platon::htmlspecialchars2($str),'</th>';
                         }                          }
                         echo '</tr><tr><td colspan=6><b>Valid messages</b></td></tr>';                          echo '</tr><tr><td colspan=6><b>Valid messages</b></td></tr>';
   
                         $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><td colspan=6>"
                                         ."<i>There are no valid messages for this article.</i>"                                          ."<i>There are no valid messages for this article.</i>"
                                         ."</td></tr>";                                          ."</td></tr>";
   
                         $query = 'SELECT id, parent, article_id, author,'  
                                 .' email, homepage, subject, datetime, ip'  
                                 .' FROM ' . $this->tb  
                                 .' WHERE article_id = "'.$ezin_admin_article.'"'  
                                 .' ORDER BY datetime ASC';  
   
                         //print "$query<hr>";  
   
                         $result = @mysql_query($query);  
                         if ($result == false) {  
                                 echo '<strong>[3] mysql_query() error</strong>';  
                                 return;  
                         }                          }
                           $query = sprintf('SELECT id, parent, article_id, author,'
                                           .' email, homepage, subject, datetime, ip'
                                           .' FROM %s WHERE article_id = %d ORDER BY datetime ASC',
                                           $this->tb, intval($ezin_admin_article));
                           if (($result = $this->myquery($query)) == false) {
                                   return false;
                           }
                         $all_ids = array();                          $all_ids = array();
                         $parents = array();                          $parents = array();
                           for ($i = 0; ($row = @mysql_fetch_array($result, MYSQL_ASSOC)); $i++) {
                         for ($i = 0; ($row = mysql_fetch_array($result, MYSQL_ASSOC)); $i++) {  
                                 $all_ids[]           = $row['id'];                                  $all_ids[]           = $row['id'];
                                 $parents[$row['id']] = $row['parent'];                                  $parents[$row['id']] = $row['parent'];
                         }                          }
                         @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><td colspan=6><b>Invalid messages</b></td></tr>';
   
                         if (count($all_ids) > 0) {                          if (count($all_ids) > 0) {
                                 /* To force buttons */                                  /* To force buttons */
                                 $count_message_ids = -1;                                  $count_message_ids = -1;
   
                                 while (count($all_ids) > 0) {                                  while (count($all_ids) > 0) {
                                         //echo "<p>all_ids: "; var_dump($all_ids);echo '<br>';                                          //echo "<p>all_ids: "; var_dump($all_ids);echo '<br>';
                                         $sub_ids = $this->message_process($ezin_admin_article,                                          $sub_ids = $this->message_process($ezin_admin_article,
Riadok 140  class phpMyEdit_messages extends phpMyEd
Riadok 102  class phpMyEdit_messages extends phpMyEd
                                         .'<i>There are no invalid messages for this article.</i>'                                          .'<i>There are no invalid messages for this article.</i>'
                                         .'</td></tr>';                                          .'</td></tr>';
                         }                          }
   
                         echo '</table>';                          echo '</table>';
                 }                  }
   
                 if ($this->nav_down() && strlen($HTML_nav_buttons) > 0) {                  if ($this->nav_down() && strlen($HTML_nav_buttons) > 0) {
                         if ($this->nav_up() || $valid_article) {                          if ($this->nav_up() || $valid_article) {
                                 echo '<hr>';                                  echo '<hr>';
                         }                          }
                         echo str_replace('<<<<<pos>>>>>', 'down', $HTML_nav_buttons);                          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=fm 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) /* {{{ */
         {          {
   
                 $id    = intval($id);                  $id    = intval($id);
                 $level = intval($level);                  $level = intval($level);
                 $query = 'SELECT id, parent, article_id, author,'                  $query = sprintf('SELECT id, parent, article_id, author,'
                         .' email, homepage, subject, datetime, ip'                                  .' email, homepage, subject, datetime, ip'
                         .' FROM ' . $this->tb                                  .' FROM %s WHERE %s = %d AND article_id = %d'
                         .' WHERE '.($parent == true ? 'parent = '.$id : 'id = '.$id)                                  .' ORDER BY datetime ASC', $this->tb,
                         .' AND article_id = "'.$article_id.'"'                                  $parent == true ? 'parent' : 'id', intval($id), intval($article_id));
                         .' ORDER BY datetime ASC';                  if (($result = $this->myquery($query)) == false) {
                           return false;
                 //print "$query<hr>";  
   
                 $result = @mysql_query($query);  
                 if ($result == false) {  
                         echo '<strong>[4] mysql_query() error</strong>';  
                         return;  
                 }                  }
   
                 $ar     = array();                  $ar     = array();
                 $ar_out = array();                  $ar_out = array();
                 for ($i = 0; ($row = mysql_fetch_array($result, MYSQL_ASSOC)); $i++) {                  for ($i = 0; ($row = @mysql_fetch_array($result, MYSQL_ASSOC)); $i++) {
                         $ar[$i]   = $row;                          $ar[$i]   = $row;
                         $ar_out[] = $row['id'];                          $ar_out[] = $row['id'];
                 }                  }
   
                 $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>';
Riadok 209  class phpMyEdit_messages extends phpMyEd
Riadok 160  class phpMyEdit_messages extends phpMyEd
                                         echo $ip;                                          echo $ip;
                                 }                                  }
                         }                          }
   
                         echo '</small></td></tr>' . "\n";                          echo '</small></td></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));
                         }                          }
                         strlen($checked) && $checked = '';                          strlen($checked) && $checked = '';
                 }                  }
   
                 return $ar_out;                  return $ar_out;
         } /* }}} */          } /* }}} */
   
Riadok 229  class phpMyEdit_messages extends phpMyEd
Riadok 177  class phpMyEdit_messages extends phpMyEd
         function message_nav_buttons($ezin_admin_article) /* {{{ */          function message_nav_buttons($ezin_admin_article) /* {{{ */
         {          {
                 $valid_article = 0;                  $valid_article = 0;
                   /* All articles query */
                 /*  
                  * All articles query.  
                  */  
                 $query = 'SELECT id, title, atitle, UNIX_TIMESTAMP(datetime) AS date'                  $query = 'SELECT id, title, atitle, UNIX_TIMESTAMP(datetime) AS date'
                         .' FROM '.$this->tb2                          .' FROM '.$this->tb2
                         .' ORDER BY date DESC';                          .' ORDER BY date DESC';
                   if (($result = $this->myquery($query)) == false) {
                 //echo "$query<hr>";                          return false;
   
                 $result = @mysql_query($query);  
                 if ($result == false) {  
                         echo "<strong>[1] mysql_query() error</strong>";  
                         return;  
                 }                  }
                   echo '<table border=0 cellpadding=0 cellpsacing=0 width="100%" style="border:0;padding:0;">',"\n";
                 echo '<table border=0 cellpadding=0 cellpsacing=0 width="100%" style="border:0;padding:0;">' . "\n";                  echo '<tr><td align=left style="text-align:left;border:0;padding:0;" nowrap>',"\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 '<select name="ezin_admin_article_<<<<<pos>>>>>" size="1">' . "\n";                  echo '<option value="0">-- Choose article --</option>',"\n";
                 echo '<option value="0">-- Choose article --</option>' . "\n";                  for ($k = 0; ($row = @mysql_fetch_array($result, MYSQL_ASSOC)); $k++) {
   
                 for ($k = 0; ($row = mysql_fetch_array($result, MYSQL_ASSOC)); $k++) {  
   
                         $row['title'] = empty($row['title']) ? $row['atitle'] : $row['title'];                          $row['title'] = empty($row['title']) ? $row['atitle'] : $row['title'];
                         $row['title'] = Platon::pretty_substr(strip_tags($row['title']), 40);                          $row['title'] = Platon::pretty_substr(strip_tags($row['title']), 40);
   
                         echo '<option';                          echo '<option';
                         if ($ezin_admin_article == $row['id']) {                          if ($ezin_admin_article == $row['id']) {
                                 echo ' selected';                                  echo ' selected';
                                 $valid_article = 1;                                  $valid_article = 1;
                         }                          }
                         echo ' value="'.$row['id'].'">'. $row['title'];                          echo ' value="',$row['id'],'">',$row['title'];
                         echo ' ('.date($this->format_date, $row['date']) . ')'; // )                          echo ' (',date($this->format_date, $row['date']),')'; // )
                         echo '</option>' . "\n";                          echo '</option>',"\n";
                 }                  }
                 mysql_free_result($result);                  @mysql_free_result($result);
                   echo '</select>',"\n";
                 echo '</select>' . "\n";                  echo '<input type=submit name=ezin_admin_article_change_<<<<<pos>>>>> value="&gt;">&nbsp;',"\n";
                 echo '<input type=submit name=ezin_admin_article_change_<<<<<pos>>>>> value="&gt;">&nbsp;' . "\n";                  echo '</td><td align=right>',"\n";
                 echo '</td><td align=right>' . "\n";  
   
                 if ($valid_article) {                  if ($valid_article) {
                           $query = sprintf('SELECT count(id) AS messages FROM %s WHERE article_id = %d',
                         $query = 'SELECT count(id) AS messages '                                          $this->tb, intval($ezin_admin_article));
                                 .' FROM ' . $this->tb                          if (($result = $this->myquery($query)) == false) {
                                 .' WHERE article_id = "'.$ezin_admin_article.'"';                                  return false;
   
                         //print "$query<hr>";  
   
                         $result = @mysql_query($query);  
                         if ($result == false) {  
                                 echo '<strong>[2] mysql_query() error</strong>';  
                                 return;  
                         }                          }
                           if ($row = @mysql_fetch_array($result, MYSQL_ASSOC)) {
                         if ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {  
                                 $count_message_ids = $row['messages'];                                  $count_message_ids = $row['messages'];
                         }                          }
                         mysql_free_result($result);                          @mysql_free_result($result);
   
                         $this->add_enabled() && $this->print_message_button($this->labels['Add']);                          $this->add_enabled() && $this->print_message_button($this->labels['Add']);
   
                         if ($count_message_ids != 0) {                          if ($count_message_ids != 0) {
                                 $this->change_enabled() && $this->print_message_button($this->labels['Change']);                                  $this->change_enabled() && $this->print_message_button($this->labels['Change']);
                                 $this->view_enabled()   && $this->print_message_button($this->labels['View']);                                  $this->view_enabled()   && $this->print_message_button($this->labels['View']);
                                 $this->delete_enabled() && $this->print_message_button($this->labels['Delete']);                                  $this->delete_enabled() && $this->print_message_button($this->labels['Delete']);
                         }                          }
                 }                  }
   
                 echo '</td></tr></table>' . "\n";                  echo '</td></tr></table>' . "\n";
   
                 return $valid_article;                  return $valid_article;
         } /* }}} */          } /* }}} */
   
Riadok 309  class phpMyEdit_messages extends phpMyEd
Riadok 231  class phpMyEdit_messages extends phpMyEd
         } /* }}} */          } /* }}} */
 }  }
   
   /* Modeline for ViM {{{
    * vim:set ts=4:
    * vim600:fdm=marker fdl=0 fdc=0:
    * }}} */
   
 ?>  ?>

Legend:
Odstranené z verzie1.2  
zmenené riadky
  Pridané vo verzii1.3

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