diff -r 1d6e762433fe -r 0acb8d9a3194 modules/snippets.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/snippets.php Mon Aug 25 12:34:26 2008 -0400 @@ -0,0 +1,67 @@ +msg(eb_censor_words("{$message['nick']}, I couldn't find that snippet (\"$snippet\") in the database."), true); + } + else + { + $snippets = array(); + while ( $row = mysql_fetch_assoc($q) ) + { + $channels = explode('|', $row['snippet_channels']); + if ( in_array($chan->get_channel_name(), $channels) ) + { + $snippets[] = $row['snippet_code']; + } + } + $snippets = implode(', ', $snippets); + $chan->msg(eb_censor_words("{$message['nick']}, the following snippets are available: $snippets"), true); + } + @mysql_free_result($q); + } + else + { + if ( eval(eb_fetch_hook('snippet_dynamic')) ) + { + return true; + } + + // Look for the snippet... + $q = eb_mysql_query('SELECT snippet_text, snippet_channels FROM snippets WHERE snippet_code = \'' . mysql_real_escape_string($snippet) . '\';'); + if ( mysql_num_rows($q) < 1 ) + { + $chan->msg(eb_censor_words("{$message['nick']}, I couldn't find that snippet (\"$snippet\") in the database."), true); + } + else + { + $row = mysql_fetch_assoc($q); + $channels = explode('|', $row['snippet_channels']); + if ( in_array($chan->get_channel_name(), $channels) ) + { + $chan->msg(eb_censor_words("{$target_nick}{$row['snippet_text']}"), true); + } + else + { + $chan->msg(eb_censor_words("{$message['nick']}, I couldn't find that snippet (\"$snippet\") in the database."), true); + } + } + @mysql_free_result($q); + } + } +}