modules/snippets.php
changeset 14 506a7e0fb106
parent 8 0acb8d9a3194
equal deleted inserted replaced
13:f073c94a1477 14:506a7e0fb106
    15       // list available snippets
    15       // list available snippets
    16       $m_et = false;
    16       $m_et = false;
    17       $q = eb_mysql_query('SELECT snippet_code, snippet_channels FROM snippets;');
    17       $q = eb_mysql_query('SELECT snippet_code, snippet_channels FROM snippets;');
    18       if ( mysql_num_rows($q) < 1 )
    18       if ( mysql_num_rows($q) < 1 )
    19       {
    19       {
    20         $chan->msg(eb_censor_words("{$message['nick']}, I couldn't find that snippet (\"$snippet\") in the database."), true);
    20         // $chan->msg(eb_censor_words("{$message['nick']}, I couldn't find that snippet (\"$snippet\") in the database."), true);
    21       }
    21       }
    22       else
    22       else
    23       {
    23       {
    24         $snippets = array();
    24         $snippets = array();
    25         while ( $row = mysql_fetch_assoc($q) )
    25         while ( $row = mysql_fetch_assoc($q) )
    44       
    44       
    45       // Look for the snippet...
    45       // Look for the snippet...
    46       $q = eb_mysql_query('SELECT snippet_text, snippet_channels FROM snippets WHERE snippet_code = \'' . mysql_real_escape_string($snippet) . '\';');
    46       $q = eb_mysql_query('SELECT snippet_text, snippet_channels FROM snippets WHERE snippet_code = \'' . mysql_real_escape_string($snippet) . '\';');
    47       if ( mysql_num_rows($q) < 1 )
    47       if ( mysql_num_rows($q) < 1 )
    48       {
    48       {
    49         $chan->msg(eb_censor_words("{$message['nick']}, I couldn't find that snippet (\"$snippet\") in the database."), true);
    49         // $chan->msg(eb_censor_words("{$message['nick']}, I couldn't find that snippet (\"$snippet\") in the database."), true);
    50       }
    50       }
    51       else
    51       else
    52       {
    52       {
    53         $row = mysql_fetch_assoc($q);
    53         $row = mysql_fetch_assoc($q);
    54         $channels = explode('|', $row['snippet_channels']);
    54         $channels = explode('|', $row['snippet_channels']);
    56         {
    56         {
    57           $chan->msg(eb_censor_words("{$target_nick}{$row['snippet_text']}"), true);
    57           $chan->msg(eb_censor_words("{$target_nick}{$row['snippet_text']}"), true);
    58         }
    58         }
    59         else
    59         else
    60         {
    60         {
    61           $chan->msg(eb_censor_words("{$message['nick']}, I couldn't find that snippet (\"$snippet\") in the database."), true);
    61           // $chan->msg(eb_censor_words("{$message['nick']}, I couldn't find that snippet (\"$snippet\") in the database."), true);
    62         }
    62         }
    63       }
    63       }
    64       @mysql_free_result($q);
    64       @mysql_free_result($q);
    65     }
    65     }
    66   }
    66   }