示例#1
0
文件: ship.php 项目: smrealms/smrv2.0
function channel_msg_ship($fp, $rdata)
{
    global $channel;
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!ship\\s(.*)\\s$/i', $rdata, $msg)) {
        echo_r($msg);
        $db = new SmrMySqlDatabase();
        $db->query('SELECT * FROM ship_type WHERE ship_name LIKE ' . $db->escape_string('%' . $msg[4] . '%'));
        if ($db->nextRecord()) {
            $ship_name = $db->getField('ship_name');
            $hardpoint = $db->getField('hardpoint');
            $speed = $db->getField('speed');
            $cost = $db->getField('cost');
            $name_length = strlen($ship_name);
            $hp_length = strlen('Hardpoints');
            $speed_length = strlen('Speed');
            $cost_length = max(strlen('Costs'), strlen($cost));
            fputs($fp, 'NOTICE ' . $msg[1] . ' :' . str_pad('Name', $name_length) . ' | ' . str_pad('Hardpoints', $hp_length) . ' | ' . str_pad('Speed', $speed_length) . ' | ' . str_pad('Costs', $cost_length) . EOL);
            fputs($fp, 'NOTICE ' . $msg[1] . ' :' . str_pad($ship_name, $name_length) . ' | ' . str_pad($hardpoint, $hp_length) . ' | ' . str_pad($speed, $speed_length) . ' | ' . str_pad($cost, $cost_length) . EOL);
        } else {
            fputs($fp, 'NOTICE ' . $msg[1] . ' :There is no ship called ' . $msg[4] . '!' . EOL);
        }
        return true;
    }
    return false;
}
示例#2
0
function channel_msg_sd_list($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!sd list\\s$/i', $rdata, $msg)) {
        global $sds;
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        echo_r('[SD_LIST] by ' . $nick . ' in ' . $channel);
        $refresh_per_hour = 250 * Globals::getGameSpeed($player->getGameID());
        $refresh_per_sec = $refresh_per_hour / 3600;
        fputs($fp, 'PRIVMSG ' . $channel . ' :The following supply/demand list has been recorded:' . EOL);
        fputs($fp, 'PRIVMSG ' . $channel . ' :Sector   Amount' . EOL);
        foreach ($sds as $sd) {
            if ($sd[3] == $channel) {
                $seconds_since_refresh = time() - $sd[2];
                if ($seconds_since_refresh < 0) {
                    $seconds_since_refresh = 0;
                }
                $amt_to_add = floor($seconds_since_refresh * $refresh_per_sec);
                if ($sd[1] + $amt_to_add > 4000) {
                    fputs($fp, 'PRIVMSG ' . $channel . ' : ' . sprintf('%4s', $sd[0]) . '     ' . sprintf('%4s', 'full') . EOL);
                } else {
                    fputs($fp, 'PRIVMSG ' . $channel . ' : ' . sprintf('%4s', $sd[0]) . '     ' . sprintf('%4s', $sd[1] + $amt_to_add) . EOL);
                }
            }
        }
        return true;
    }
}
示例#3
0
 public function postEdit($p, $z)
 {
     $data = json_decode($_POST['filterData'])->subs[0];
     echo_r($data);
     echo_r(sqlify($data));
     die;
 }
示例#4
0
function check_events($fp)
{
    global $events;
    foreach ($events as $key => $event) {
        if ($event[0] < time()) {
            echo_r('[TIMER] finished. Sending a note to ' . $event[2]);
            fputs($fp, 'NOTICE ' . $event[2] . ' :' . $event[1] . EOL);
            unset($events[$key]);
        }
    }
}
示例#5
0
function smarty_function_echo_r($params, &$smarty)
{
    if (is_null($params['var'])) {
        echo 'NULL';
        return;
    }
    if (!isset($params['var'])) {
        trigger_error("assign: missing 'var' parameter");
        return;
    }
    echo_r($params['var']);
}
示例#6
0
function query_command($fp, $rdata)
{
    // :MrSpock!mrspock@coldfront-120CBD34.dip.t-dialin.net PRIVMSG Caretaker :Test
    if (preg_match('/^:(MrSpock!mrspock|Page!Page)@.*\\sPRIVMSG\\s' . IRC_BOT_NICK . '\\s:(.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $text = $msg[2];
        echo_r('[QUERY] by ' . $nick . ': ' . $text);
        // relay msg as our own
        fputs($fp, $text . EOL);
        return true;
    }
    return false;
}
示例#7
0
/**
 * A powerfull debugging function based on die() and var_dump or print_r PHP-defined functions
 * @param mixed $var
 * @return void
 */
function ____($var, $dump = TRUE, $exit = TRUE)
{
    echo '<pre style="font-size: 1.3em; color: #FF0000; line-height: 18px;">';
    if (!$dump) {
        echo_r($var);
    } else {
        var_dump($var);
    }
    echo '</pre>';
    if ($exit) {
        exit;
    }
}
示例#8
0
 function handleTextNode($node, $container, $styleStack)
 {
     $textRun = $container->getNewTextRun();
     echo_r($node->getTextContent());
     $textRun->setTextInfo($node->getTextContent());
     // echo $textRun;
     $textRun->setStyle($styleStack->getTopStyle());
     // echo 'handleTextNode<br>';
     // $this->container->drawRenderTree();
     // echo_r($container);
     // echo_r($node->getTextContent());
     // echo_r($extra);
     // die();
 }
示例#9
0
function channel_action_slap($fp, $rdata)
{
    // :MrSpock!mrspock@coldfront-25B201B9.dip.t-dialin.net PRIVMSG #rod : ACTION slaps Caretaker around a bit with a large trout
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:.ACTION slaps ' . IRC_BOT_NICK . '/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        echo_r('[SLAP] by ' . $nick . ' in ' . $channel);
        $slap_responses = array('blocks ' . $nick . '\'s attack and beats six shades of shit out of their pets', 'drops dead on the ground', 'ducks and takes aim with an M16', 'throws rocks at ' . $nick, 'beats ' . $nick . ' like a red-headed step child', 'gets up off the ground and roundhouse kicks ' . $nick . ' in the face', 'does an evasive backflip and throws ninja stars at ' . $nick, 'slaps ' . $nick . ' around a bit with a large trout', 'deflects the slap and deals ' . rand(1, 999999) . ' damage to ' . $nick, 'steals the trout and throws it back in the river');
        fputs($fp, 'PRIVMSG ' . $channel . ' :' . chr(1) . 'ACTION ' . $slap_responses[rand(0, count($slap_responses) - 1)] . chr(1) . EOL);
        return true;
    }
}
示例#10
0
文件: ctcp.php 项目: smrealms/smrv2.0
function ctcp_ping($fp, $rdata)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:' . chr(1) . 'PING\\s(.*)' . chr(1) . '\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $botnick = $msg[4];
        $their_time = $msg[5];
        echo_r('[CTCP_PING] by ' . $nick . ' at ' . $their_time);
        fputs($fp, 'NOTICE ' . $nick . ' :' . chr(1) . 'PING ' . time() . chr(1) . EOL);
        return true;
    }
    return false;
}
示例#11
0
function invite($fp, $rdata)
{
    // :MrSpock!mrspock@coldfront-425DB813.dip.t-dialin.net INVITE Caretaker :#fe
    if (preg_match('/^:(.*)!(.*)@(.*) INVITE ' . IRC_BOT_NICK . ' :(.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        echo_r('[INVITE] by ' . $nick . ' for ' . $channel);
        // join channel where they want us
        fputs($fp, 'JOIN ' . $channel . EOL);
        sleep(1);
        fputs($fp, 'WHO ' . $channel . EOL);
    }
}
示例#12
0
文件: Entry.php 项目: laiello/zoop
 public function assignHeaders()
 {
     $headers = $this->getHeaders();
     echo_r($headers);
     if (isset($headers['publish-date'])) {
         $this->published_date = $headers['publish-date'];
     }
     if (isset($headers['title'])) {
         $this->title = $headers['title'];
     }
     if (isset($headers['link'])) {
         $this->link = $headers['link'];
     }
     if (isset($headers['link-text'])) {
         $this->link_text = $headers['link-text'];
     }
     echo_r($this);
 }
示例#13
0
文件: rank.php 项目: smrealms/smrv2.0
function channel_msg_rank($fp, $rdata)
{
    global $channel, $nick;
    // did he gave us no parameter?
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!rank\\s$/i', $rdata, $msg) || preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $nick . '\\s:rank\\s$/i', $rdata, $msg)) {
        echo_r($msg);
        fputs($fp, 'NOTICE ' . $msg[1] . ' :SYNTAX !rank <nick>' . EOL);
        return true;
    }
    // in channel we only accept !rank
    // in private msg we accept both
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!rank\\s(.*)\\s$/i', $rdata, $msg) || preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $nick . '\\s:?rank\\s(.*)\\s$/i', $rdata, $msg)) {
        echo_r($msg);
        $db = new SmrMySqlDatabase();
        $db2 = new SmrMySqlDatabase();
        $db->query('SELECT * FROM player WHERE player_name = ' . $db->escape_string($msg[4], true));
        if ($db->getNumRows()) {
            while ($db->nextRecord()) {
                $player_name = stripslashes($db->getField('player_name'));
                $experience = $db->getField('experience');
                $game_id = $db->getField('game_id');
                $db2->query('SELECT COUNT(*) as our_rank FROM player ' . 'WHERE game_id = ' . $game_id . ' AND ' . '(experience > ' . $experience . ' OR ' . '(experience = ' . $experience . ' AND ' . 'player_name <= ' . $db->escape_string($player_name, true) . ' ))');
                if ($db2->nextRecord()) {
                    $our_rank = $db2->getField('our_rank');
                }
                // how many players are there?
                $db2->query('SELECT COUNT(*) as total_player FROM player WHERE game_id = ' . $game_id);
                if ($db2->nextRecord()) {
                    $total_player = $db2->getField('total_player');
                }
                $db2->query('SELECT game_name FROM game WHERE game_id = ' . $game_id);
                if ($db2->nextRecord()) {
                    $game_name = $db2->getField('game_name');
                }
                fputs($fp, 'NOTICE ' . $msg[1] . ' :' . $msg[1] . ' you are ranked ' . $our_rank . ' out of ' . $total_player . ' in ' . $game_name . '!' . EOL);
            }
        } else {
            fputs($fp, 'NOTICE ' . $msg[1] . ' :No Trader found that matches your query!' . EOL);
        }
        return true;
    }
    return false;
}
示例#14
0
function channel_msg_level($fp, $rdata)
{
    global $channel, $nick;
    // in channel we only accept !rank
    // in private msg we accept both
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!level\\s(.*)\\s$/i', $rdata, $msg) || preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $nick . '\\s:?level\\s(.*)\\s$/i', $rdata, $msg)) {
        echo_r($msg);
        $db = new SmrMySqlDatabase();
        $db->query('SELECT * FROM level WHERE level_id = ' . $msg[4]);
        if ($db->nextRecord()) {
            $level_name = $db->getField('level_name');
            $experience = $db->getField('requirement');
            fputs($fp, 'NOTICE ' . $msg[1] . ' :For a ' . $level_name . ' you need to have ' . $experience . ' experience points!' . EOL);
        } else {
            fputs($fp, 'NOTICE ' . $msg[1] . ' :This Level doesn\'t exist!!' . EOL);
        }
        return true;
    }
    return false;
}
示例#15
0
function notice_nickserv_unknown_user($fp, $rdata)
{
    // :NickServ!services@coldfront.net NOTICE Caretaker :Nickname Slevin isn't registered.
    if (preg_match('/^:NickServ!services@coldfront.net NOTICE ' . IRC_BOT_NICK . ' :Nickname .(.*). isn\'t registered\\.\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        echo_r('[NOTICE_NICKSERV_UNKNOWN_NICK] ' . $nick);
        global $actions;
        foreach ($actions as $key => $action) {
            // is that a callback for our nick?
            if ($action[0] == 'NICKSERV_INFO' && $nick == $action[2]) {
                echo_r('Callback found: ' . $action[3]);
                unset($actions[$key]);
                if ($action[5] === true) {
                    fputs($fp, 'PRIVMSG ' . $action[1] . ' :' . $nick . ', you are not using a registered nick. Please identify with NICKSERV and try the last command again.' . EOL);
                }
            }
        }
        return true;
    }
    return false;
}
示例#16
0
文件: user.php 项目: smrealms/smrv2.0
/**
 * Someone changed his nick
 */
function user_nick($fp, $rdata)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sNICK\\s:(.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $new_nick = $msg[4];
        echo_r('[NICK] ' . $nick . ' -> ' . $new_nick);
        // database object
        $db = new SmrMySqlDatabase();
        $db2 = new SmrMySqlDatabase();
        $channel_list = array();
        // 'sign off' all active old_nicks (multiple channels)
        $db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($nick) . ' AND signed_off = 0');
        while ($db->nextRecord()) {
            $seen_id = $db->getInt('seen_id');
            // remember channels where this nick was active
            array_push($channel_list, $db->getField('channel'));
            $db2->query('UPDATE irc_seen SET signed_off = ' . time() . ' WHERE seen_id = ' . $seen_id);
        }
        // now sign in the new_nick in every channel
        foreach ($channel_list as $channel) {
            // 'sign in' the new nick
            $db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($new_nick) . ' AND channel = ' . $db->escapeString($channel));
            if ($db->nextRecord()) {
                // exiting nick?
                $seen_id = $db->getField('seen_id');
                $db->query('UPDATE irc_seen SET ' . 'signed_on = ' . time() . ', ' . 'signed_off = 0, ' . 'user = '******', ' . 'host = ' . $db->escapeString($host) . ', ' . 'registered = NULL ' . 'WHERE seen_id = ' . $seen_id);
            } else {
                // new nick?
                $db->query('INSERT INTO irc_seen (nick, user, host, channel, signed_on) VALUES(' . $db->escapeString($new_nick) . ', ' . $db->escapeString($user) . ', ' . $db->escapeString($host) . ', ' . $db->escapeString($channel) . ', ' . time() . ')');
            }
        }
        unset($channel_list);
        return true;
    }
    return false;
}
示例#17
0
function channel_part($fp, $rdata)
{
    // :Azool!Azool@coldfront-F706F7E1.co.hfc.comcastbusiness.net PART #smr-irc :
    // :SomeGuy!mrspock@coldfront-DD847655.dip.t-dialin.net PART #smr-irc
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPART\\s(.*?)\\s/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        echo_r('[PART] ' . $nick . '!' . $user . '@' . $host . ' ' . $channel);
        // database object
        $db = new SmrMySqlDatabase();
        $db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($nick) . ' AND channel = ' . $db->escapeString($channel));
        // exiting nick?
        if ($db->nextRecord()) {
            $seen_id = $db->getField('seen_id');
            $db->query('UPDATE irc_seen SET signed_off = ' . time() . ' WHERE seen_id = ' . $seen_id);
        } else {
            // we don't know this one, but who cares? he just left anyway...
        }
        return true;
    }
    return false;
}
示例#18
0
 /**
  * Automatic class loading handler.  This automatically loads a class using the path
  * information that was registered using the Zoop::registerClass or ::registerDomain
  * method 
  *
  * @param string $className Name of the class to load
  */
 static function autoload($className)
 {
     if (headers_sent()) {
         echo_r($className);
         die('here');
     }
     $classPath = Zoop::getClassPath($className);
     if ($classPath) {
         require_once $classPath;
     }
     if (substr($className, 0, 5) == 'Zend_') {
         $parts = explode('_', $className);
         $modName = $parts[1];
         require_once zoop_dir . "/Zend/{$modName}.php";
     }
 }
示例#19
0
             $json_error = 'Unknown error';
             break;
     }
 }
 if ($json_error !== false) {
     $detected_json_error = array_diff($array_ajax_object_render, json_decode($json_ajax_render));
     $detected_json_error_ok = array();
     for ($i = 0; $i < sizeof($detected_json_error); $i++) {
         $converted_html = trim(preg_replace("/[^A-Za-z0-9<>&'\" ()\\[\\]\\/=:;_-}{]/", "", $detected_json_error[$i]));
         if ($converted_html != "") {
             $detected_json_error_ok[] = $converted_html;
         }
     }
     $json_error_msg = new Object($json_error);
     if (sizeof($detected_json_error_ok) > 0) {
         $json_error_msg->add("<br/><br/><div align='left'>DEBUG: ", echo_r($detected_json_error_ok), "</div>");
     }
     $page_object->disableCache();
     header('HTTP/1.1 500 Internal Server Error');
     echo $json_error_msg->render();
     exit;
 }
 // Convert special caracters
 $json_ajax_render = str_replace("\n\n", "\n", str_replace("\r", "", str_replace("{#wsp_tab}", "\\t", str_replace("\t", "", $json_ajax_render))));
 // convert caracters '<' and '>' if there is a UploadFile event
 if ($__WSP_OBJECT_UPLOADFILE_CHANGED__) {
     $json_ajax_render = str_replace("<", "{#wsp_lt}", str_replace(">", "{#wsp_gt}", $json_ajax_render));
 }
 // Write Ajax result (JSON encoding)
 echo $json_ajax_render;
 // End If page is not caching
示例#20
0
  public function addSpider($json) {
   ajax_echo_r ($json);
   
   if ($json->ID>0) {
    foreach ($json as $k=>$v) {
     if ($k!="ID") {
      $sql_set .= "`".$k."`='".$v."', ";
     }
    }
    $sql_set = substr($sql_set,0,strlen($sql_set)-2);
    
    $sql = "
     UPDATE `spiderman`
     SET    ".$sql_set."
     WHERE  `ID` = '".$json->ID."'
     ; 
    ";
    $ret=$this->db->exec($sql);                                   // save the new GalleryID to the parent object's table
    $this->addEvent('SpiderUpdated','tasks','ID',$json->ID,$json->ID);
   } else {
    foreach ($json as $k=>$v) {
     if ($k!="ID") {
      $sql_insert .= "`".$k."`, ";
      $sql_values .= "'".$v."', ";
     }
    }
    $sql_insert = substr($sql_insert,0,strlen($sql_insert)-2);
    $sql_values = substr($sql_values,0,strlen($sql_values)-2);
    
    $sql="
     INSERT INTO `spiderman`
      (".$sql_insert.")
     VALUES
      (".$sql_values.") ; 
    ";
    $ret=$this->db->exec($sql);                                   // save the new GalleryID to the parent object's table
    $this->addEvent('SpiderAdded','tasks','ID',$ret->lastInsertID,$ret->lastInsertID);
   }
   
//   echo $sql;
   
   
   echo_r ($ret);
   return $ret->lastInsertID;
  }
示例#21
0
function channel_msg_sms_send($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!sms send ([^ ]+) (.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        $recv = $msg[5];
        $msg = trim($msg[6]);
        echo_r('[SMS_SEND] by ' . $nick . ' in ' . $channel . ' for ' . $recv);
        if (($blacklist_reason = $account->isSmsBlacklisted()) !== false) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', you are not allowed to send text messages via ' . IRC_BOT_NICK . '. Reason: ' . $blacklist_reason . EOL);
            return true;
        }
        // check if we know this user we try to send a text too
        $recv_account =& SmrAccount::getAccountByIrcNick($recv, true);
        if ($recv_account == null) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', I don\'t know a player that goes by the nick \'' . $recv . '\'.' . EOL);
            return true;
        }
        // do we have a cellphone number?
        if (strlen($recv_account->getCellPhone()) == 0) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', ' . $recv_account->getIrcNick() . ' has not provided a cell phone number.' . EOL);
            return true;
        }
        // do we have a msg
        if (empty($msg)) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', you don\'t mind me asking what do you want to send to ' . $recv_account->getIrcNick() . '?' . EOL);
            return true;
        }
        // message too long?
        if (strlen($msg) > 160) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', the message you want to send contains more than 160 characters.' . EOL);
            return true;
        }
        // +--------------------------------------------+
        // | Copyright (c) 2007-2009 by MOBILANT.DE     |
        // +--------------------------------------------+
        $url = 'http://gw.mobilant.com';
        $request = '';
        $param = array();
        $param['key'] = SMS_GATEWAY_KEY;
        $param['message'] = $msg;
        // numbers like +177 will be (for some reason) 'corrected' to a german number because it's a common area code here
        // therefor support asked me to use 00-1-77 instad of +1-77
        $param['to'] = '00' . substr($recv_account->getCellPhone(), 1);
        //		$param['from'] = 'SMR';
        $param['route'] = 'direct';
        $param['debug'] = SMS_DEBUG;
        $param['message_id'] = '1';
        $param['dlr'] = '1';
        $param['response'] = '1';
        foreach ($param as $key => $val) {
            $request .= $key . '=' . urlencode($val);
            $request .= '&';
        }
        echo_r('Calling url: ' . $url . '?' . $request);
        // request url = send text
        $response = @file($url . '?' . $request);
        $response_code = intval($response[0]);
        $message_id = intval($response[1]);
        // insert log
        $db = new SmrMySqlDatabase();
        $db->query('INSERT INTO account_sms_log (account_id, time, receiver_id, receiver_cell, response_code, message_id)
					VALUES (' . $account->getAccountID() . ', ' . time() . ', ' . $recv_account->getAccountID() . ', ' . $db->escapeString($recv_account->getCellPhone()) . ', ' . $response_code . ', ' . $message_id . ')');
        // confirm sending
        if (SMS_DEBUG) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', sending SMS messages is currently disabled.' . EOL);
        } else {
            if ($response_code == 100) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', your text message will be delivered to ' . $recv_account->getIrcNick() . ' immediately.' . EOL);
            } elseif ($response_code == 10) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Unknown receiver number!' . EOL);
            } elseif ($response_code == 20) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Unknown sender number!' . EOL);
            } elseif ($response_code == 30) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Error in message!' . EOL);
            } elseif ($response_code == 40) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Unknown route!' . EOL);
            } elseif ($response_code == 50) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Identification failed!' . EOL);
            } elseif ($response_code == 60) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Insufficient funds! Please donate!' . EOL);
            } elseif ($response_code == 70) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Text message can\'t be delivered!' . EOL);
            } elseif ($response_code == 71) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Feature not possible!' . EOL);
            } elseif ($response_code == 80) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Error while delivering to SMS-C!' . EOL);
            } else {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message' . EOL);
            }
        }
        return true;
    }
    return false;
}
示例#22
0
 function pageAfter()
 {
     $_SESSION['afterId'] += 1;
     session::saveChangesUnsafe();
     echo_r($_SESSION);
 }
 /**
  * Method toString
  * @access static
  * @return mixed
  * @since 1.1.0
  */
 public static function toString()
 {
     self::transaction_start();
     $tmp_mem = self::fetch();
     self::transaction_finish();
     return echo_r(unserialize($tmp_mem));
 }
示例#24
0
 public static function echoClasses()
 {
     echo_r(self::$classes);
 }
示例#25
0
文件: irc.php 项目: smrealms/smrv2.0
function readFromStream($fp)
{
    global $last_ping;
    $rdata = fgets($fp, 4096);
    $rdata = preg_replace('/\\s+/', ' ', $rdata);
    // log for reports (if enabled via command line (-log)
    if (IRC_LOGGING && strlen($rdata) > 0) {
        write_log_message($rdata);
    }
    // remember the last time we got something from the server
    if (strlen($rdata) > 0) {
        $last_ping = time();
    }
    // timeout detection!
    if ($last_ping < time() - 300) {
        echo_r('TIMEOUT detected!');
        fclose($fp);
        // close socket
        throw new TimeoutException();
    }
    // we simply do some poll stuff here
    check_planet_builds($fp);
    check_events($fp);
    check_sms_dlr($fp);
    check_sms_response($fp);
    if (strlen($rdata) == 0) {
        return false;
    }
    // required!!! otherwise timeout!
    if (server_ping($fp, $rdata)) {
        return;
    }
    // server msg
    if (server_msg_307($fp, $rdata)) {
        return;
    }
    if (server_msg_318($fp, $rdata)) {
        return;
    }
    if (server_msg_352($fp, $rdata)) {
        return;
    }
    if (server_msg_401($fp, $rdata)) {
        return;
    }
    //Are they using a linked nick instead
    if (notice_nickserv_registered_user($fp, $rdata)) {
        return;
    }
    if (notice_nickserv_unknown_user($fp, $rdata)) {
        return;
    }
    // some nice things
    if (ctcp_version($fp, $rdata)) {
        return;
    }
    if (ctcp_finger($fp, $rdata)) {
        return;
    }
    if (ctcp_time($fp, $rdata)) {
        return;
    }
    if (ctcp_ping($fp, $rdata)) {
        return;
    }
    if (invite($fp, $rdata)) {
        return;
    }
    // join and part
    if (channel_join($fp, $rdata)) {
        return;
    }
    if (channel_part($fp, $rdata)) {
        return;
    }
    // nick change and quit
    if (user_nick($fp, $rdata)) {
        return;
    }
    if (user_quit($fp, $rdata)) {
        return;
    }
    if (channel_action_slap($fp, $rdata)) {
        return;
    }
    // channel msg (!xyz) without registration
    if (channel_msg_help($fp, $rdata)) {
        return;
    }
    if (channel_msg_seedlist($fp, $rdata)) {
        return;
    }
    if (channel_msg_op($fp, $rdata)) {
        return;
    }
    if (channel_msg_timer($fp, $rdata)) {
        return;
    }
    if (channel_msg_8ball($fp, $rdata)) {
        return;
    }
    if (channel_msg_seen($fp, $rdata)) {
        return;
    }
    if (channel_msg_sd($fp, $rdata)) {
        return;
    }
    if (channel_msg_sms($fp, $rdata)) {
        return;
    }
    // channel msg (!xyz) with registration
    if (channel_msg_with_registration($fp, $rdata)) {
        return;
    }
    // MrSpock can use this to send commands as caretaker
    if (query_command($fp, $rdata)) {
        return;
    }
    // debug
    if (IRC_DEBUGGING) {
        echo_r('[UNKNOWN] ' . $rdata);
        return;
    }
}
示例#26
0
 function clean($val)
 {
     if (!preg_match("/^[^\r\n]+\$/", $val)) {
         echo_r("INVALID SMTP INPUT DETECTED: <b>{$val}</b>");
         exit;
     }
 }
示例#27
0
文件: index.php 项目: laiello/zoop
<?php

include 'config.php';
include zoop_dir . '/Zoop.php';
Zoop::loadLib('db');
$map = SqlFetchSimpleMap('select * from test', 'name', 'value', array());
echo_r($map);
$rows = SqlFetchRows('select * from test', array());
echo_r($rows);
$rows = SqlFetchRows('select * from test where name = :name', array('name' => 'one'));
echo_r($rows);
示例#28
0
 /**
  * Method printStaticDebugMessage
  * @access static
  * @param string|object $debug_msg 
  * @since 1.0.59
  */
 public static function printStaticDebugMessage($debug_msg)
 {
     // print the debug
     $GLOBALS['__ERROR_DEBUG_PAGE__'] = true;
     if ($GLOBALS['__DEBUG_PAGE_IS_PRINTING__'] == false) {
         $GLOBALS['__DEBUG_PAGE_IS_PRINTING__'] = true;
         if (gettype($debug_msg) == "object") {
             if (get_class($debug_msg) == "NewException") {
                 $debug_msg = NewException::generateErrorMessage($debug_msg->code, $debug_msg->message, $debug_msg->file, $debug_msg->line);
             } else {
                 $debug_msg = echo_r($debug_msg);
             }
         }
         if ($GLOBALS['__AJAX_PAGE__'] == false || $GLOBALS['__AJAX_LOAD_PAGE__'] == true && $_GET['mime'] == "text/html") {
             $_POST['debug'] = $debug_msg;
             $_GET['p'] = "error-debug";
             try {
                 if (!defined('FORCE_SERVER_NAME') || FORCE_SERVER_NAME == "") {
                     if ($_SERVER['SERVER_PORT'] == 443) {
                         $from_url = "https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
                     } else {
                         $port = "";
                         if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != "") {
                             $port = ":" . $_SERVER['SERVER_PORT'];
                         }
                         $from_url = "http://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
                     }
                 } else {
                     $from_url = "http://" . FORCE_SERVER_NAME . $_SERVER['REQUEST_URI'];
                 }
                 $_GET['from_url'] = $from_url;
                 require_once dirname(__FILE__) . "/../../pages/error/error-debug.php";
                 $debug_page = new ErrorDebug(self::$trace !== false ? true : false);
                 if (method_exists($debug_page, "InitializeComponent")) {
                     $debug_page->InitializeComponent();
                 }
                 if (method_exists($debug_page, "Load")) {
                     $debug_page->Load();
                 }
                 $debug_page->loadAllVariables();
                 $__PAGE_IS_INIT__ = true;
                 $debug_page->executeCallback();
                 if (method_exists($debug_page, "Loaded")) {
                     $debug_page->Loaded();
                 }
                 $http_type = "";
                 $split_request_uri = explode("\\?", $_SERVER['REQUEST_URI']);
                 if (!defined('FORCE_SERVER_NAME') || FORCE_SERVER_NAME == "") {
                     if ($_SERVER['SERVER_PORT'] == 443) {
                         $http_type = "https://";
                         $current_url = str_replace("//", "/", $_SERVER['SERVER_NAME'] . substr($split_request_uri[0], 0, strrpos($split_request_uri[0], "/")) . "/");
                     } else {
                         $port = "";
                         if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != "") {
                             $port = ":" . $_SERVER['SERVER_PORT'];
                         }
                         $http_type = "http://";
                         $current_url = str_replace("//", "/", $_SERVER['SERVER_NAME'] . $port . substr($split_request_uri[0], 0, strrpos($split_request_uri[0], "/")) . "/");
                     }
                 } else {
                     $http_type = "http://";
                     $current_url = str_replace("//", "/", FORCE_SERVER_NAME . substr($split_request_uri[0], 0, strrpos($split_request_uri[0], "/")) . "/");
                 }
                 // define the base URL of the website
                 $my_base_url = "";
                 $array_cwd = explode('/', str_replace('\\', '/', getcwd()));
                 $wsp_folder_name = $array_cwd[sizeof($array_cwd) - 1];
                 // Detect base URL with the root folder of wsp
                 $array_current_url = explode('/', $current_url);
                 for ($i = sizeof($array_current_url) - 2; $i >= 0; $i--) {
                     if ($array_current_url[$i] == $wsp_folder_name) {
                         $my_base_url = $http_type;
                         for ($j = 0; $j <= $i; $j++) {
                             $my_base_url .= $array_current_url[$j] . "/";
                         }
                         break;
                     }
                 }
                 if ($my_base_url == "") {
                     if (!defined('FORCE_SERVER_NAME') || FORCE_SERVER_NAME == "") {
                         // If not find root folder then test if there is an alias
                         $array_script_name = explode('/', $_SERVER['SCRIPT_NAME']);
                         unset($array_script_name[sizeof($array_script_name) - 1]);
                         $alias_path = implode('/', $array_script_name);
                         if ($alias_path != "") {
                             // Alias detected
                             $my_base_url = $http_type . $array_current_url[0] . $alias_path . "/";
                         } else {
                             // No Alias detected
                             $my_base_url = $http_type . $array_current_url[0] . "/";
                         }
                     } else {
                         if (strtoupper(substr(FORCE_SERVER_NAME, 0, 7)) == "HTTP://" || strtoupper(substr(FORCE_SERVER_NAME, 0, 8)) == "HTTPS://") {
                             $my_base_url = FORCE_SERVER_NAME . "/";
                         } else {
                             $my_base_url = $http_type . FORCE_SERVER_NAME . "/";
                         }
                     }
                 }
                 $my_site_base_url = $my_base_url;
                 header("Content-Type: text/html");
                 echo "<html><head><title>Debug Error - " . utf8encode(SITE_NAME) . "</title>\n";
                 $jquery_style = "";
                 if (DEFINE_STYLE_JQUERY != "") {
                     $jquery_style = DEFINE_STYLE_JQUERY;
                 }
                 echo "<link type=\"text/css\" rel=\"StyleSheet\" href=\"" . $my_site_base_url . "combine-css/styles.php.css,angle.php.css,jquery" . JQUERY_UI_VERSION . "|" . $jquery_style . "|jquery-ui-" . JQUERY_UI_VERSION . ".custom.css";
                 if (trim(CssInclude::getInstance()->getCssConfigFile()) != "") {
                     echo "?conf_file=" . CssInclude::getInstance()->getCssConfigFile();
                 }
                 echo "\" media=\"screen\" />\n";
                 echo "<script type=\"text/javascript\" src=\"" . $my_site_base_url . "combine-js/jquery|jquery-" . JQUERY_VERSION . ".min.js,jquery|jquery-ui-" . JQUERY_UI_VERSION . ".custom.min.js,jquery.cookie.js,pngfix.js,utils.js\"></script>\n";
                 echo "<script type=\"text/javascript\" src=\"" . $my_site_base_url . "combine-js/jquery.backstretch.min.js,jquery.cookie.js\"></script>\n";
                 echo "<meta name=\"Robots\" content=\"noindex, nofollow\" />\n";
                 echo "<base href=\"" . $my_site_base_url . "\" />\n";
                 echo "</head><body>\n";
                 echo $debug_page->render();
                 if ($GLOBALS['__AJAX_LOAD_PAGE__'] == true && $GLOBALS['__AJAX_LOAD_PAGE_ID__'] != "") {
                     echo "<script type=\"text/javascript\">\n";
                     echo "lauchJavascriptPage_" . $GLOBALS['__AJAX_LOAD_PAGE_ID__'] . " = function() {\n";
                     echo "\t\$('#idLoadPageLoadingPicture" . $GLOBALS['__AJAX_LOAD_PAGE_ID__'] . "').attr('style', 'display:none;');\n";
                     echo "\t\$('#idLoadPageContent" . $GLOBALS['__AJAX_LOAD_PAGE_ID__'] . "').attr('style', 'display:block;');\n";
                     echo "};\n";
                     echo "\twaitForJsScripts(" . $GLOBALS['__AJAX_LOAD_PAGE_ID__'] . ");\n";
                     echo "\tLoadPngPicture();\n";
                     echo "</script>\n";
                 }
                 echo "</body></html>\n";
             } catch (Exception $e) {
                 echo $e->getMessage();
                 NewException::sendErrorByMail($debug_msg);
             }
         } else {
             header('HTTP/1.1 500 Internal Server Error');
             if (defined('SEND_ERROR_BY_MAIL') && SEND_ERROR_BY_MAIL == true && !isLocalDebug()) {
                 if (self::$trace !== false) {
                     // standard msg "administrator is notified"
                     echo __(ERROR_DEBUG_MAIL_SENT);
                 } else {
                     // no trace in the debug information
                     echo utf8encode($debug_msg);
                 }
             } else {
                 echo utf8encode($debug_msg);
             }
             NewException::sendErrorByMail($debug_msg);
             exit;
         }
     }
 }
示例#29
0
function channel_msg_seedlist_del($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!seedlist del (.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        $sectors = explode(' ', $msg[5]);
        echo_r('[SEEDLIST_DEL] by ' . $nick . ' in ' . $channel);
        // check if $nick is leader
        if (!$player->isAllianceLeader(true)) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', only the leader of the alliance manages the seedlist.' . EOL);
            return true;
        }
        foreach ($sectors as $sector) {
            // see if the sector is numeric
            if (!is_numeric($sector)) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :The sectors all need to be numeric. Example: !seedlist del 1537' . EOL);
                return true;
            }
        }
        // add sectors to db
        $db = new SmrMySqlDatabase();
        $db->query('DELETE FROM alliance_has_seedlist
					WHERE alliance_id = ' . $player->getAllianceID() . '
						AND game_id = ' . $player->getGameID() . '
						AND sector_id IN (' . $db->escapeArray($sectors) . ')');
        fputs($fp, 'PRIVMSG ' . $channel . ' :The sectors have been deleted.' . EOL);
        return true;
    }
    return false;
}
示例#30
0
function channel_msg_help($fp, $rdata)
{
    // global help?
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!help\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        echo_r('[HELP] ' . $nick . '!' . $user . '@' . $host . ' ' . $channel);
        fputs($fp, 'NOTICE ' . $nick . ' :--- HELP ---' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :' . IRC_BOT_NICK . ' is the official SMR bot' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :If you want his services in your channel please invite him using \'/invite ' . IRC_BOT_NICK . ' #channel\'' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' : ' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :Available public commands commands:' . EOL);
        //		fputs($fp, 'NOTICE '.$nick.' :!rank <nickname>         Displays the rank of the specified trader'.EOL);
        //		fputs($fp, 'NOTICE '.$nick.' :!level <rank>            Displays the experience requirement for the specified level'.EOL);
        //		fputs($fp, 'NOTICE '.$nick.' :!weapon level <level> <order>  Displays all weapons that have power level equal to <level> in the order specified (See !help weapon level)'.EOL);
        //		fputs($fp, 'NOTICE '.$nick.' :!weapon name <name>           Displays the weapon closest matching <name>'.EOL);
        //		fputs($fp, 'NOTICE '.$nick.' :!weapon range <object> <lower_limit> <upper_limit> <order>'.EOL);
        //		fputs($fp, 'NOTICE '.$nick.' :                         Displays all weapons that have <object> great than <lower_limit> and <object> less than <upper_limit> in order (see !help weapon range)'.EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :  !seen <nickname>         Displays the last time <nickname> was seen' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :  !timer <mins> <msg>      Starts a countdown which will send a notice to the channel with the <msg> in <mins> minutes' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :  !8ball <question>        Display one of the famous 8ball answers to your <question>' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :Available alliance commands commands:' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :  !seedlist                Manages the seedlist' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :  !seed                    Displays a list of sectors you have not yet seeded' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :  !op                      Command to manage OPs' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :  !sd                      Command to manage supply/demands for ports' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :  !sms                     Command to send sms text messages to player' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :  !money                   Displays the funds the alliance owns' . EOL);
        fputs($fp, 'NOTICE ' . $nick . ' :  !forces [Galaxy]         Will tell you when forces will expire. Can be used without parameters.' . EOL);
        return true;
        // help on a spec command?
    } elseif (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!help\\s(.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        $topic = $msg[5];
        echo_r('[HELP' . $topic . '] ' . $nick . '!' . $user . '@' . $host . ' ' . $channel);
        if ($topic == 'seen') {
            fputs($fp, 'NOTICE ' . $nick . ' :Syntax !seen <nickname>' . EOL);
            fputs($fp, 'NOTICE ' . $nick . ' :   Displays the last time <nickname> was seen' . EOL);
        } else {
            fputs($fp, 'NOTICE ' . $nick . ' :There is no help available for this command! Try !help' . EOL);
        }
        //		if ($topic == 'login')
        //			fputs($fp, 'NOTICE '.$nick.' :No help available yet! Ask MrSpock!'.EOL);
        //		elseif ($topic == '!rank')
        //			fputs($fp, 'NOTICE '.$nick.' :No help available yet! Ask MrSpock!'.EOL);
        //		elseif ($topic == '!level')
        //			fputs($fp, 'NOTICE '.$nick.' :No help available yet! Ask MrSpock!'.EOL);
        //		elseif ($topic == 'weapon level') {
        //
        //			fputs($fp, 'NOTICE '.$nick.' :Syntax !weapon level <level> <order>'.EOL);
        //			fputs($fp, 'NOTICE '.$nick.' :Returns all weapons that are level <level> in order <order>'.EOL);
        //			fputs($fp, 'NOTICE '.$nick.' :Example !weapon level 4 shield_damage would return the level 4 power weapons ordered by the amount of shield damage they do.'.EOL);
        //			fputs($fp, 'NOTICE '.$nick.' :<order> options are cost, shield_damage, armour_damage, buyer_restriction, race_id, accuracy, and weapon_name'.EOL);
        //			fputs($fp, 'NOTICE '.$nick.' :All "order" commands must be spelt correctly'.EOL);
        //			fputs($fp, 'NOTICE '.$nick.' :See Azool for additional help on this topic'.EOL);
        //
        //		} elseif ($topic == 'weapon range') {
        //
        //			fputs($fp, 'NOTICE '.$nick.' :Syntax !weapon range <object> <cost1> <cost2> <order>'.EOL);
        //			fputs($fp, 'NOTICE '.$nick.' :Returns all weapons that have <object> greater than <lower_limit> and less than <upper_limit> in the order <order>'.EOL);
        //			fputs($fp, 'NOTICE '.$nick.' :Example !weapon range cost_range 100000 200000 shield_damage would return all weapons whose costs are between 100000 and 200000 ordered by the amount of shield damage they do.'.EOL);
        //			fputs($fp, 'NOTICE '.$nick.' :<object> and <order> options are cost, shield_damage, armour_damage, buyer_restriction, race_id, accuracy, power_level, and weapon_name'.EOL);
        //			fputs($fp, 'NOTICE '.$nick.' :All "order" and "object" commands must be spelt correctly'.EOL);
        //			fputs($fp, 'NOTICE '.$nick.' :See Azool for additional help on this topic'.EOL);
        //
        //		} else
        //			fputs($fp, 'NOTICE '.$nick.' :There is no help available for this command! Try !help'.EOL);
        return true;
    }
    return false;
}