Esempio n. 1
0
/**
* Start function for retrieving bot reply
*
* Checks to see if bot exists, if so calls reply() to get the repons to the user's input.
*
* @uses lookupbotid()
* @uses reply()
*
* @param string $userinput          The user's input
* @param integer $uniqueid          The user's session ID
* @param string $botname            The bot's name, if no name selected the default value is "TestBot".
*
* @return string                    The bot's reply. 
*/
function replybotname($userinput, $uniqueid, $botname = "TestBot")
{
    $botid = lookupbotid($botname);
    if ($botid == -1) {
        print "I don't know that bot: {$botname}<BR>\n";
    } else {
        return reply($userinput, $uniqueid, $botid);
    }
}
Esempio n. 2
0
function broadcast($server, $type, $message, $except_fd, $channel = 'public')
{
    global $app;
    foreach ($app->users->online() as $user) {
        $to_fd = $user['fd'];
        if (is_array($except_fd) && in_array($to_fd, $except_fd) || $except_fd === $to_fd) {
            continue;
        }
        if (is_null($channel) || $user['channel'] !== $channel) {
            continue;
        }
        reply($server, $to_fd, $type, $message);
    }
}
Esempio n. 3
0
/**
* Start function for retrieving bot reply
*
* Checks to see if bot exists, if so calls reply() to get the repons to the user's input.
*
* @uses lookupbotid()
* @uses reply()
*
* @param string $userinput          The user's input
* @param integer $uniqueid          The user's session ID
* @param string $botname            The bot's name, if no name selected the default value is "octavius".
*
* @return string                    The bot's reply. 
*/
function replybotname($userinput, $uniqueid, $botname = "octavius")
{
    $botid = lookupbotid($botname);
    if ($botid == -1) {
        //print "I don't know that bot: $botname<BR>\n";
    } else {
        return reply($userinput, $uniqueid, $botid);
    }
}
Esempio n. 4
0
        cpg_error($rated, _ARTICLERATING, URL::index('News&file=article&sid=' . $sid));
    } else {
        cpg_error(_DIDNTRATE, _ARTICLERATING);
    }
}
$sid = isset($_POST['sid']) ? intval($_POST['sid']) : (isset($_GET['sid']) ? intval($_GET['sid']) : 0);
if ((isset($_POST['postreply']) || isset($_POST['preview']) || isset($_GET['reply']) || isset($_GET['comment'])) && (!$MAIN_CFG['global']['articlecomm'] || $db->sql_count($prefix . '_stories', "sid={$sid} AND acomm=0"))) {
    URL::redirect(URL::index('&amp;file=article&amp;sid=' . $sid));
}
require_once "modules/{$module_name}/comments.php";
if (isset($_POST['postreply'])) {
    replyPost($sid);
    // store the reply
} else {
    if (isset($_GET['reply'])) {
        reply($sid);
        // reply to comment
    } elseif (isset($_POST['preview'])) {
        replyPreview($sid);
        // Preview the reply before storage
    } else {
        if (isset($_GET['comment'])) {
            // Show comment X
            if (!isset($_GET['pid'])) {
                singlecomment(intval($_GET['comment']), $sid);
            } else {
                DisplayComments($sid, '', intval($_GET['pid']), intval($_GET['comment']));
            }
        } else {
            $storynum = is_user() && $userinfo['storynum'] && $MAIN_CFG['member']['user_news'] ? $userinfo['storynum'] : $MAIN_CFG['global']['storyhome'];
            if (isset($_GET['page']) && intval($_GET['page']) > 1) {
Esempio n. 5
0
    function addTicket($sujet, $corps, $cat, $notify)
    {
        global $lvlUser, $nuked, $user;
        if (is_nan($cat) or is_null(getCatName($cat))) {
            ?>
 <div style="text-align:center;"><h2><?php 
            echo _UNKNCAT;
            ?>
</h2></div><?php 
            redirect("index.php?file=Support", 3);
        } else {
            if (empty($sujet) or empty($corps)) {
                ?>
 <div style="text-align:center;"><h2><?php 
                echo _UNKSUJETCORPS;
                ?>
</h2></div><?php 
                redirect("index.php?file=Support", 3);
            } else {
                $time = time();
                $sql = mysql_query("INSERT INTO " . mysql_real_escape_string($nuked["prefix"]) . "_support_threads (titre, date, closed, auteur, auteur_id, cat_id, notify) VALUES ('" . mysql_real_escape_string(secu_html(html_entity_decode($sujet, ENT_QUOTES))) . "', '" . $time . "', '0', '" . mysql_real_escape_string(secu_html(html_entity_decode($user[2], ENT_QUOTES))) . "', '" . mysql_real_escape_string($user[0]) . "', '" . mysql_real_escape_string($cat) . "', '" . $notify . "') ");
                if (!$sql) {
                    ?>
 <div style="text-align:center;"><h2><?php 
                    echo _ERREUR . "   " . mysql_error($sql);
                    ?>
</h2></div><?php 
                } else {
                    $sql = mysql_query("SELECT id FROM " . mysql_real_escape_string($nuked["prefix"]) . "_support_threads WHERE date = '" . $time . "' AND closed = '0' AND auteur_id = '" . $user[0] . "' LIMIT 0,1 ");
                    $sql = mysql_fetch_assoc($sql);
                    if ($sql) {
                        reply($sql["id"], $corps, 1);
                    } else {
                        die(_ERREUR);
                    }
                    ?>
<div style="text-align:center;">
    <h2><?php 
                    echo _SUPPORT;
                    ?>
</h2>
    <h3><?php 
                    echo $thread["titre"];
                    ?>
</h3>
    <br /><br />
    <?php 
                    echo _TICKETSUCCESS;
                    ?>
    <br /><br /><a href="javascript:history.back()"><b>[ <?php 
                    echo _BACK;
                    ?>
 ]</b></a><br />
</div>

        <?php 
                    redirect("javascript:history.back()", 2);
                }
            }
        }
    }
Esempio n. 6
0
<?php

define('PIGCMS_PATH', dirname(dirname(__FILE__)) . '/');
require_once PIGCMS_PATH . 'source/init.php';
$t_configs = D('Config')->field('`name`,`value`')->select();
foreach ($t_configs as $key => $value) {
    $t_config[$value['name']] = $value['value'];
}
$_G['config'] = $t_config;
$action = isset($_GET['a']) ? addslashes($_GET['a']) : 'index';
import("source.class.Wechat");
$wechat = new Wechat($t_config);
if ($action == 'index') {
    $data = $wechat->request();
    list($content, $type) = reply($data);
    $wechat->response($content, $type);
} elseif ($action == 'get_ticket') {
    //获取 component_verify_ticket 每十分钟微信服务本服务器请求一次
    $data = $wechat->request();
    if (isset($data['InfoType'])) {
        if ($data['InfoType'] == 'component_verify_ticket') {
            if (isset($data['ComponentVerifyTicket']) && $data['ComponentVerifyTicket']) {
                if ($config = D('Config')->where("`name`='wx_componentverifyticket'")->find()) {
                    D('Config')->where("`name`='wx_componentverifyticket'")->data(array('value' => $data['ComponentVerifyTicket']))->save();
                } else {
                    D('Config')->data(array('name' => 'wx_componentverifyticket', 'value' => $data['ComponentVerifyTicket'], 'type' => 'type=text', 'gid' => 0, 'tab_id' => 0))->add();
                }
                F('config', null);
                exit('success');
            }
        } elseif ($data['InfoType'] == 'unauthorized') {
Esempio n. 7
0
/**
* Start function for retrieving bot reply
*
* Checks to see if bot exists, if so calls reply() to get the repons to the user's input.
*
* @uses lookupbotid()
* @uses reply()
*
* @param string $userinput          The user's input
* @param integer $uniqueid          The user's session ID
* @param string $botname            The bot's name, if no name selected the default value is "TestBot".
*
* @return string                    The bot's reply.
*/
function replybotname($userinput, $uniqueid, $botname)
{
    /*
      $userinput = eregi_replace("^\/to L_PRIV_PM", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/msg L_PRIV_PM", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/wisp L_PRIV_WISP", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/whisp L_PRIV_WISP", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/to  Re: ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/msg  Re: ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/wisp  Re: ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/whisp  Re: ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/to  ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/msg  ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/wisp  ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/whisp  ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = eregi_replace("^\/Re: ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
      $userinput = ereg_replace("^\> ", "", $userinput);      // removes not necessary chars from the input of private messages helps the bot to make sense?
    */
    $userinput = preg_replace("/^\\/to L_PRIV_PM/i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/msg L_PRIV_PM/i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/wisp L_PRIV_WISP/i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/whisp L_PRIV_WISP/i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/to Re: /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/msg Re: /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/wisp Re: /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/whisp Re: /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/to /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/msg /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/wisp /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/whisp /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\/Re: /i", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/^\\> /", "", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $userinput = preg_replace("/&#39;/", "'", $userinput);
    // removes not necessary chars from the input of private messages helps the bot to make sense?
    $botid = lookupbotid($botname);
    if ($botid == -1) {
        #		print "There is no such a bot: $botname<br />\n";
        return reply("There is no such a bot <b>{$botname}</b> loaded in the database.<br />\nPlease make sure the bot is fully loaded into the database.<br />\nNotify the chat administrator about this message!", $uniqueid, $botid);
    } else {
        return reply($userinput, $uniqueid, $botid);
    }
}
Esempio n. 8
0
//}
//$phones = array();
//while($row = mysql_fetch_row($result)) {
//    $phones[] = $row[0];
//}
//mysql_free_result($result);
//
//$new_status = WAITING_CODE;
//if (count($phones) >= ANTIFRAUD_MAX_PHONES_PER_WM_PER_HOUR)
//    if (!in_array($user_phone, $phones)) {
//        $new_status = REJECTED_FRAUD;
//    }
//
//if ($ran <= 3 and $new_status == WAITING_CODE) {
//    $new_status = MANUAL_TRANSFER;
//}
/************************************************************************************
 Сохранение информации об СМСке
************************************************************************************/
$partner = $session->partner;
if ($parner) {
    $sms->partner_earning = $partner->earning_percent / 100.0 * $sms->service_earning;
}
$sms->status = SMS_STATUS_OK;
$sms->put();
stat_sms_received($session->id, $session->test_id, $session->partner_id, $session->day, $session->paid, $sms->service_earning, $sms->partner_earning);
/************************************************************************************
 Готово
************************************************************************************/
reply(sprintf(SMS_REPLY_OK, $session->sms_resp));
Esempio n. 9
0
    case "write":
        $showWrite = true;
        break;
    case "delete":
        $showList = true;
        delete($smarty);
        display($smarty);
        break;
    case "send":
        send($smarty);
        $showList = true;
        display($smarty);
        break;
    case "reply":
        $showWrite = true;
        reply($smarty);
        break;
    default:
        $showList = true;
        display($smarty);
        break;
}
$smarty->assign('showList', $showList);
$smarty->assign('showRead', $showRead);
$smarty->assign('showCompose', $showWrite);
$smarty->assign('msg', 'There is no message in your inbox.');
//================ Function
function display(&$smarty)
{
    $usn = $_SESSION['usn'];
    $message_fact = new message_factory();
Esempio n. 10
0
            $seller_name = $seller["username"];
        }
        for ($i = 1; $i <= 5; $i++) {
            $speaker_var = "speaker" . $i;
            $output .= "<h3>";
            if ($messages["{$speaker_var}"] == 'b') {
                //instead of printing who is the buyer and seller, print out the name of the buyer and seller based on who is what
                $output .= $buyer_name;
            } elseif ($messages["{$speaker_var}"] == 's') {
                $output .= $seller_name;
            }
            $output .= "</h3>";
            $message_var = "message" . $i;
            $output .= $messages["{$message_var}"];
        }
    }
    echo $header_output;
    echo $output;
    echo "<br /><br />";
    echo make_field_and_button($messages_id, $action);
    //the textfield and the correct button (add message or reply) will be made depending on the action
    add_message($messages_id, $action);
    //if the user clicks on the button, one of these functions will run
    reply($messages_id, $action);
}
?>
</div>
</body>
</html>
<?php 
ob_end_flush();
Esempio n. 11
0
/**
 * 端口
 * @param $address
 * @param $port
 * @param $pairs
 */
function listen_on($address, $port, $pairs, $use_ip = false)
{
    /**
     * 创建一个SOCKET
     * AF_INET=是ipv4 如果用ipv6,则参数为 AF_INET6
     * SOCK_STREAM为socket的tcp类型,如果是UDP则使用SOCK_DGRAM
     */
    $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("socket_create() 失败的原因是:" . socket_strerror(socket_last_error()) . "/n");
    // 阻塞模式
    socket_set_block($sock) or die("socket_set_block() 失败的原因是:" . socket_strerror(socket_last_error()) . "/n");
    // 绑定到socket端口
    $result = socket_bind($sock, $address, $port) or die("socket_bind() 失败的原因是:" . socket_strerror(socket_last_error()) . "/n");
    //开始监听
    $result = socket_listen($sock, 4) or die("socket_listen() 失败的原因是:" . socket_strerror(socket_last_error()) . "/n");
    echo "Binding the socket on {$address}:{$port} ... ";
    echo "OK\nListening on the socket {$address}:{$port} ... \n";
    do {
        // never stop the daemon
        // 它接收连接请求并调用一个子连接Socket来处理客户端和服务器间的信息
        $msgsock = socket_accept($sock) or die("socket_accept() failed: reason: " . socket_strerror(socket_last_error()) . "/n");
        // 读取客户端数据
        while (save_relet_file($msgsock, $pairs, $use_ip) !== -1) {
            echo "ok\n";
        }
        // 数据传送 向客户端写入返回结果
        $info = array('code' => 0, 'msg' => 'OK');
        reply($msgsock, $info);
        // 一旦输出被返回到客户端,父/子socket都应通过socket_close($msgsock)函数来终止
        socket_close($msgsock);
    } while (true);
    socket_close($sock);
}
Esempio n. 12
0
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Program E; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
/**
 * Flash User Interface
 * 
 * Contains the basics of Flash communication
 * @author Paul Rydell
 * @copyright 2002
 * @version 0.0.8
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @package Interpreter
 * @subpackage Responder
 */
/**
* Include the guts of the program.
*/
include "respond.php";
$numselects = 0;
// Start the session or get the existing session.
session_start();
$myuniqueid = session_id();
// Here is where we get the reply. Make sure you fill in testbot with your bot's name
$botresponse = reply($HTTP_POST_VARS['input'], $myuniqueid, "TestBot");
// Print the results.
print "&bot_name=Test Agent\n";
print "&alice_out=" . $botresponse->response . "\n";
print "&textLoaded=1";
Esempio n. 13
0
    }
    if (isset($cookie[5])) {
        $options .= "&order={$cookie['5']}";
    } else {
        $options .= "&order=0";
    }
    if (isset($cookie[6])) {
        $options .= "&thold={$cookie['6']}";
    } else {
        $options .= "&thold=0";
    }
    Header("Location: modules.php?name={$module_name}&file=article&sid={$sid}{$options}");
}
switch ($op) {
    case "Reply":
        reply($pid, $sid, $mode, $order, $thold);
        break;
    case "" . _PREVIEW . "":
        replyPreview($pid, $sid, $subject, $comment, $xanonpost, $mode, $order, $thold, $posttype);
        break;
    case "" . _OK . "":
        CreateTopic($xanonpost, $subject, $comment, $pid, $sid, $host_name, $mode, $order, $thold, $posttype);
        break;
    case "moderate":
        if (isset($admin)) {
            include "auth.php";
        } else {
            include "mainfile.php";
        }
        if ($admintest == 1 || $moderate == 2) {
            while (list($tdw, $emp) = each($HTTP_POST_VARS)) {
Esempio n. 14
0
 * @version 0.0.8
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @package Interpreter
 * @subpackage Responder
 */
/**
* Include the guts of the program.
*/
include "respond.php";
// Read tests.txt into an array, each line a different element.
$tests = array("testatomic", "testdisplayset", "testhide", "testget", "testsetx", "testalter", "testsettopic", "test6a", "test6b", "testsimplecondition", "testsimpleconditiona", "testsimpleconditionmatch", "testconditionlist", "testconditionlistmatch", "testconditionlistdefault", "testconditionlistname", "teststar test passed", "teststar Test passed one and Test passed two and Test passed three and Test passed four", "testunderscore Test passed one and Test passed two and Test passed three and Test passed four", "testrandom", "testwordformat", "testnestedwordformat", "testsimplemultisentencethat", "testarray4multisentencethat", "testarray3multisentencethat", "testarray2multisentencethat", "testarray1multisentencethat", "testthatarray", "testbotproperties", "testconditionsetvalue", "testnestedcondition", "testnestedcondition1", "testnestedcondition2", "testsetcondition", "testversion", "testsrai", "testsr sraisucceeded", "testnestedsrai", "testthinksrai", "teststarset test passed", "testidsizedate", "testgossip", "testname", "testinput", "testinput1", "testinput2", "testinput3", "testgender he", "testthatstar", "testthatstar1", "testmultithatstar", "testmultithatstar1", "testtopicstar", "testmultitopicstar", "test35", "testoldtopic", "test36", "testextremesrai", "testperson i was", "testperson2 with you");
ss_timing_start("alll");
// For each element in the array to a curl request to talk.php.
for ($x = 0; $x < sizeof($tests); $x++) {
    // Start the session or get the existing session.
    session_start();
    $myuniqueid = session_id();
    // Timer will let us know how long it took to get our response.
    ss_timing_start("single");
    // Here is where we get the reply.
    $botresponse = reply($tests[$x], $myuniqueid, 1);
    // Stop the timer.
    ss_timing_stop("single");
    // Print the results.
    print "<B>RESPONSE: " . $botresponse->response . "<BR></b>";
    print "<BR><BR>execution time: " . ss_timing_current("single");
    print "<BR>";
}
ss_timing_stop("alll");
print "<BR><BR>all execution time: " . ss_timing_current("alll");
print "<BR>";
Esempio n. 15
0
    $site = "";
}
switch ($site) {
    case "eingabe":
        eingabe();
        break;
    case "zeige":
        zeige();
        break;
    case "zeigethread":
        zeigethread();
        break;
    case "register":
        registrieren();
        break;
    case "login":
        login();
        break;
    case "logout":
        raushier();
        break;
    case "reply":
        reply();
        break;
    default:
        ausgabe();
}
?>
</body>
</html>
        while ($cursor->hasNext()) {
            $db_data = $cursor->getNext();
            if ($db_data) {
                $record = array();
                $rec_num++;
                $record['product'] = $db_data['product'];
                $record['price'] = $db_data['price'];
                $record['ice_cream_type'] = $db_data['ice_cream_type'];
                if (isset($db_data['cone_type']) && $db_data['cone_type'] != '') {
                    $record['cone_type'] = $db_data['cone_type'];
                }
                if (isset($db_data['soda_type']) && $db_data['soda_type'] != '') {
                    $record['soda_type'] = $db_data['soda_type'];
                }
                if (isset($db_data['milk_type']) && $db_data['milk_type'] != '') {
                    $record['milk_type'] = $db_data['milk_type'];
                }
                $record['vendor'] = $db_data['vendor'];
                $record['rec_num'] = $rec_num;
                //--gather records for output
                array_push($master_output, $record);
            }
        }
        reply(1, "Complete. Viewing " . $rec_num . " records.", $master_output);
    } catch (Exception $e) {
        reply(0.5, "Could not read the collection. Error: ", $e->getMessage());
    }
}
//--shouldnt get here
reply(2, "Nothing Doing... exiting...", null);
Esempio n. 17
0
     searchByKeyword($con, $keyword, $token, $type, $bid);
 } else {
     if ($ask == "edituser") {
         edituser($con, $token, $ip);
     } else {
         if ($ask == "online") {
             viewonline($con);
         } else {
             if ($ask == "update") {
                 updatetokentime($con, $token, $ip);
             } else {
                 if ($ask == "post") {
                     post($con, $token, $bid, $ip, $attachs);
                 } else {
                     if ($ask == "reply") {
                         reply($con, $token, $bid, $tid, $ip, $attachs);
                     } else {
                         if ($ask == "edit") {
                             edit($con, $token, $bid, $tid, $pid, $ip, $attachs);
                         } else {
                             if ($ask == "lock" || $ask == "extr" || $ask == "top") {
                                 threads_action($con, $token, $bid, $tid, $ask);
                             } else {
                                 if ($ask == "delete") {
                                     delete($con, $token, $bid, $tid, $pid, $ip);
                                 } else {
                                     if ($ask == "move") {
                                         move($con, $token, $bid, $tid, $to);
                                     } else {
                                         if ($ask == "lzl") {
                                             lzl($con, @$_REQUEST['method'], $fid, $token, $ip);
Esempio n. 18
0
        $db->sql_query('UPDATE ' . $prefix . "_poll_desc SET voters=voters+1 WHERE poll_id='{$poll_id}'");
    }
    $forwarder = isset($_POST['forwarder']) ? $_POST['forwarder'] : 0;
    if (strlen($forwarder < 5)) {
        $forwarder = URL::index('&op=results&pollid=' . $poll_id);
    }
    URL::redirect($forwarder);
} elseif (isset($_POST['postreply'])) {
    // store the reply
    replyPost($poll_id);
}
require_once 'header.php';
OpenTable();
if (isset($_GET['reply'])) {
    // reply to comment
    reply($poll_id);
} elseif (isset($_POST['preview'])) {
    // Preview the reply before storage
    replyPreview($poll_id);
} else {
    if (isset($_GET['comment'])) {
        // Show comment X
        if (!isset($_GET['pid'])) {
            singlecomment(intval($_GET['comment']), $poll_id);
        } else {
            DisplayComments($poll_id, '', intval($_GET['pid']), intval($_GET['comment']));
        }
    } elseif ($op == 'results' && $poll_id > 0) {
        echo '<div style="text-align:center;" class="title">' . _CURRENTPOLLRESULTS . '</div>';
        CloseTable();
        echo '<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td width="70%" valign="top">';
function writebody()
{
    global $db, $domain, $suserid, $sitename, $cachelife, $template, $gamesfolder, $thumbsfolder, $limitboxgames, $seo_on, $blogentriesshown, $enabledcode_on, $comments_on, $directorypath, $autoapprovecomments, $gamesonpage, $abovegames, $belowgames, $showwebsitelimit, $supportemail, $showblog, $blogentriesshown, $blogcharactersshown, $blogcommentpermissions, $blogcommentsshown, $blogfollowtags, $blogcharactersrss, $usrdata, $userid;
    if (!isset($suserid)) {
        echo '<div class="error">Please login.</div>';
        exit;
    }
    function inbox()
    {
        global $db, $domain, $userid;
        $w = $db->query("SELECT * FROM fas_messages WHERE to_userid='{$userid}' ORDER BY datesent DESC");
        echo '<h2>Messages</h2>
<table width="100%" border="0" align="center">
<tr>
<th class="header">#</th>
<th class="header">Details</th>
<th class="header">Status</th>
<th class="header">Options</th>
</tr>
';
        while ($iw = $db->fetch_row($w)) {
            if ($iw['status'] == 0) {
                $status = '<font color="green">Unread</font>';
            } else {
                $status = '<font color="red">Read</font>';
            }
            $gr = $db->fetch_row($db->query("SELECT userid, username FROM fas_users WHERE userid='{$iw['from_userid']}'"));
            echo ' <tr>
<td class="content"><div align="center">' . $iw['ID'] . '</div></td>
<td class="content"><small>
Subject: ' . $iw['subject'] . '<br />
Date: ' . date('d/m/Y', $iw['datesent']) . '<br />
From: ' . $gr['username'] . '<br />
</small></td>
<td class="content"><div align="center">' . $status . '</div></td>
<td class="content" align="center">
<div align="center">
[<a href="' . $domain . '/index.php?action=messages&case=delete&ID=' . $iw['ID'] . '">Delete</a> -
<a href="' . $domain . '/index.php?action=messages&case=read&ID=' . $iw['ID'] . '">Read</a>]</div></td>
</tr>';
        }
        echo '</table>

<br />
<div align="center">
<a href="' . $domain . '/index.php?action=messages&case=deleteall">Delete All</a>
</div>';
    }
    function read()
    {
        global $db, $domain, $template, $userid;
        $ID = abs((int) $_GET['ID']);
        $ir = $db->query("SELECT * FROM dd_messages WHERE to_userid='{$userid}' AND ID='{$ID}'");
        $or = $db->fetch_row($ir);
        if (!$db->num_rows($ir)) {
            echo 'Either you do not own that message or it does not exist.';
            include 'templates/' . $template . '/footer.php';
            exit;
        }
        $db->query("UPDATE fas_messages SET status='1' WHERE ID='{$ID}'");
        $ud = $db->fetch_row($db->query("SELECT username, userid FROM fas_users WHERE userid='{$or['from_userid']}'"));
        $message = str_replace('\\n', '<br />', $or['content']);
        $replysubject = 'Re: ' . $or['subject'];
        echo '<table width="95%" border="0" align="center">
<tr>
<td class="header" width="30%">Message From:</td>
<td class="content">' . $ud['username'] . '</td>
</tr>
<tr>
<td class="header">Subject Details</td>
<td class="content">' . $or['subject'] . '<br /><small>' . date('d/m/Y', $or['datesent']) . '</small></td>
</tr>
<tr>
<td class="header" colspan="2"><div align="center">Message</div></td>
</tr>
<tr>
<td class="content" colspan="2" valign="top">' . $message . '</td>
</tr>
</table> 
<table width="95%" border="0" align="center">
<tr>
<td class="header"  colspan="2">Quick Reply</td></tr>
<tr>
<td class="content" colspan="2">


<form action="' . $domain . '/index.php?action=messages&case=reply&;ID=' . $or['from_userid'] . '" method="post">
<textarea cols="50" rows="6" name="message"></textarea><br>
<input name="to" value="' . $or['from_userid'] . '" type="hidden">

<input size="37" name="subject" value="' . $replysubject . '" type="hidden">
<input name="submit" value="Send" type="submit"> 
</form> 
</td>
</tr>

<td class="header" colspan="2">Your Conversation with ' . $ud['username'] . '.</td>
</table>
<table width="95%" border="0" align="center">
<tr>
<th class="header">From/Date</th>
<th class="header">Message</th>
</tr>';
        $senderid = $or['from_userid'];
        $tt = $db->query("SELECT * FROM fas_messages WHERE to_userid='{$userid}' AND from_userid='{$senderid}' ORDER BY datesent DESC") or die(mysql_error());
        while ($row = mysql_fetch_array($tt)) {
            $op = $db->fetch_row($db->query("select username from fas_users where userid='{$row['from_userid']}'"));
            echo ' <tr align="center">

<td class="content">' . $op['username'] . '
<br /><small>On: ' . date('d/m/Y', $row['datesent']) . '</small></td>
<td class="content">' . $row['content'] . '</td>
</tr>';
        }
        echo '</table>';
    }
    function reply()
    {
        global $userid, $domain, $db;
        $to = abs((int) $_POST['to']);
        $message = clean($_POST['message']);
        $subject = clean($_POST['subject']);
        if (!$to || !$message) {
            echo "All fields must be filled in!";
            include 'templates/' . $template . '/footer.php';
            exit;
        }
        $date = time();
        $db->query("INSERT INTO dd_messages SET\nfrom_userid='{$userid}',\nto_userid='{$to}',\nsubject='{$subject}',\ncontent = '{$message}',\nstatus = '0',\ndatesent='{$date}'");
        echo 'Message sent.';
    }
    function compose()
    {
        global $userid, $domain, $db, $template;
        if (isset($_POST['submit'])) {
            $to = abs((int) $_POST['to']);
            $message = clean($_POST['message']);
            $subject = clean($_POST['subject']);
            if (!$to || !$message) {
                echo "All fields must be filled in!";
                include 'templates/' . $template . '/footer.php';
                exit;
            }
            $date = time();
            $db->query("INSERT INTO fas_messages SET\nfrom_userid='{$userid}',\nto_userid='{$to}',\nsubject='{$subject}',\ncontent = '{$message}',\nstatus = '0',\ndatesent='{$date}'");
            echo 'Message sent.';
            include 'templates/' . $template . '/footer.php';
            exit;
        }
        if ($to == '') {
            $to = '';
        } else {
            $to = $ID;
        }
        echo '
<form action="' . $domain . '/index.php?action=messages&case=compose" method="POST">
<table width="95%" border="0" align="center">
<tr>
<td class="header" width="30%">To (Userid#):</td>
<td class="content" width="30%"><input type="text" name="to" value="' . $to . '" size="35"></td>
</tr>
<tr>
<td class="header" width="30%">Subject:</td>
<td class="content" width="30%"><input type="text" name="subject" value="[No Subject]" size="35"></td>
</tr>
<tr>
<td colspan="2" class="header" align="center">Message</td>
</tr> 
<tr>
<td colspan="2" class="content">
<textarea cols="65" rows="6" name="message"></textarea>
</td>

</tr> 
<tr>
<td colspan="2" align="center" class="content"><input type="submit" name="submit" value="Send"></td>
</tr> 

</table>
</form> ';
    }
    function delete()
    {
        $ID = abs((int) $_GET['ID']);
        global $db, $userid;
        $db->query("DELETE FROM fas_messages WHERE ID='{$ID}' AND to_userid='{$userid}'");
        echo 'Deleted.';
    }
    function deleteall()
    {
        global $db, $userid;
        $db->query("DELETE FROM fas_messages WHERE to_userid='{$userid}'");
    }
    $userid = $suserid;
    echo ' <table align="center">
<tr>
<td class="content"><a href="' . $domain . '/index.php?action=messages&case=compose">Compose</a></td>
<td class="content"><a href="' . $domain . '/index.php?action=messages&case=deleteall">Delete All</a></td>
<td class="content"><a href="' . $domain . '/index.php?action=messages">Messages Home</a></td>
</tr>
</table>';
    switch ($_GET['case']) {
        default:
            inbox();
            break;
        case 'compose':
            compose();
            break;
        case 'reply':
            reply();
            break;
        case 'read':
            read();
            break;
        case 'delete':
            delete();
            break;
        case 'deleteall':
            deleteall();
            break;
    }
}
Esempio n. 20
0
            $i = 0;
            $page .= "</tr>\n";
        }
    }
    if ($i != 0) {
        $page .= "</tr>\n";
    }
    //Cierra los dos tables
    $page .= "</table>\n</td>\n</tr>\n<tr>\n<td class=\"c\" align=\"center\">";
    $page .= "<a href=\"javascript:window.close();\">Cerrar Ventana</a>\n";
    $page .= "</td>\n</tr>\n</table>\n</td>\n</tr>\n</table>";
    display($page, 'Emoticons', false);
    die;
}
/*
  Foro!!!
*/
if (isset($f) && isset($new) && is_numeric($f) && $new == "thread") {
    newthread($f);
} elseif (isset($t) && isset($new) && is_numeric($t) && $new == "reply") {
    reply($t);
} elseif (isset($f) && is_numeric($f)) {
    showtopic($f);
} elseif (isset($t) && is_numeric($t)) {
    showthread($t);
} elseif (isset($mode) && $mode == 'smilies') {
    smilies();
} else {
    showcategories();
}
// Created by Perberos. All rights reversed (C) 2006
Esempio n. 21
0
    extract($context);
    $user = $app->users->logout($fd);
    if ($user) {
        // 广播离开聊天室通知
        broadcast($server, 'leave', ['fd' => $fd, 'username' => $user['username']], $fd);
    }
});
$app->on('list', [App\Middlewares\Auth::class, function ($context) use($app) {
    extract($context);
    reply($server, $fd, 'list', $app->users->all());
}]);
$app->on('chat', [App\Middlewares\Auth::class, function ($context) use($app) {
    extract($context);
    if (property_exists($message, 'to_fd')) {
        // 私人聊天
        whisper($server, $message->content, $fd, $message->to_fd);
    } else {
        if (property_exists($message, 'to_channel')) {
            // 频道聊天
            mass($server, $message->content, $fd, $message->to_channel);
        } else {
            // 公共聊天
            mass($server, $message->content, $fd);
        }
    }
    reply($server, $fd, 'chat', ['success' => true, 'id' => $message->id]);
}]);
$app->on('messages', [App\Middlewares\Auth::class, function ($context) use($app) {
    extract($context);
    reply($server, $fd, 'messages', $app->messages->orWhere(['fd' => $fd, 'from_fd' => $fd]));
}]);
Esempio n. 22
0
    if (isset($userinfo['uorder'])) {
        $order = $userinfo['uorder'];
    } else {
        $order = 0;
    }
}
if (!isset($thold) or empty($thold)) {
    if (isset($userinfo['thold'])) {
        $thold = $userinfo['thold'];
    } else {
        $thold = 0;
    }
}
switch ($op) {
    case "Reply":
        reply($pid, $pollID, $mode, $order, $thold);
        break;
    case "" . _PREVIEW . "":
        replyPreview($pid, $pollID, $subject, $comment, $xanonpost, $mode, $order, $thold);
        break;
    case "" . _OK . "":
        CreateTopic($xanonpost, $subject, $comment, $pid, $pollID, $host_name, $mode, $order, $thold);
        break;
    case "moderate":
        if (!is_admin($admin)) {
            global $module_name;
        }
        if ($admintest == 1 || $moderate == 2) {
            while (list($tdw, $emp) = each($_POST)) {
                $tdw = intval($tdw);
                if (stripos_clone($tdw, "dkn")) {
Esempio n. 23
0
 public function hello(Message $message)
 {
     if ($message->text() === 'hello') {
         reply('world');
     }
 }
Esempio n. 24
0
     }
     redirect("index.php?file=Support&amp;page=admin", 3);
 }
 switch ($_REQUEST['op']) {
     case "view":
         viewThread($_REQUEST['id']);
         break;
     case "index":
         if (isset($_REQUEST["tickets"]) and $_REQUEST["tickets"] == "close") {
             main(1);
         } else {
             main();
         }
         break;
     case "reply":
         reply($_REQUEST["id"], $_REQUEST["corps"]);
         break;
     case "close":
         close($_REQUEST["id"]);
         break;
     case "open":
         open($_REQUEST["id"]);
         break;
     case "main_pref":
         main_pref();
         break;
     case "pref_insert_cat":
         insert_cat($_REQUEST['categorie_insert'], $_REQUEST['ordre_insert']);
         break;
     case "pref_rename_cat":
         rename_cat($_REQUEST['categorie_old'], $_REQUEST['categorie_rename'], $_REQUEST['ordre_rename']);