Пример #1
0
<?php

#####################################################################################################
/*
exec:~say|10|0|0|1|crutchy,chromas||||php scripts/say.php %%trailing%% %%nick%%
*/
#####################################################################################################
ini_set("display_errors", "on");
require_once "lib.php";
$trailing = $argv[1];
$parts = explode(" ", $trailing);
$dest = substr(strtolower($parts[0]), 1, strlen($parts[0]) - 2);
$ischan = False;
$isnick = False;
$delim1 = substr($parts[0], 0, 1);
$delim2 = substr($parts[0], strlen($parts[0]) - 1);
if ($delim1 == "<" and $delim2 == ">") {
    $ischan = users_chan_exists($dest);
    $isnick = users_nick_exists($dest);
}
if ($ischan == True or $isnick == True) {
    array_shift($parts);
    $trailing = implode(" ", $parts);
    pm($dest, $trailing);
    pm("crutchy", $trailing);
} else {
    privmsg($trailing);
}
#####################################################################################################
Пример #2
0
function irciv_load_data()
{
    $filename = DATA_FILE_PATH . "irciv_chan_list";
    if (file_exists($filename) == False) {
        irciv_term_echo("error: channel list file not found");
        return;
    }
    $game_chans = file_get_contents($filename);
    $game_chans = explode("\n", $game_chans);
    for ($i = 0; $i < count($game_chans); $i++) {
        $chan = trim($game_chans[$i]);
        if ($chan == "") {
            continue;
        }
        if (users_chan_exists($chan) == False) {
            irciv_privmsg("error: channel \"{$chan}\" not found");
            continue;
        }
        $filename = DATA_FILE_PATH . $chan;
        if (file_exists($filename) == False) {
            irciv_privmsg("error: file \"{$filename}\" not found");
            continue;
        }
        $game_bucket = file_get_contents($filename);
        $game_bucket = json_decode($game_bucket, True);
        if ($game_bucket === NULL) {
            irciv_privmsg("error: json_decode returned null when processing \"{$filename}\"");
            continue;
        }
        set_array_bucket($game_bucket, GAME_BUCKET_PREFIX . $chan, True);
        irciv_privmsg("game data for channel \"{$chan}\" loaded successfully");
    }
}