当前位置: 首页>>代码示例>>PHP>>正文


PHP sendNotification函数代码示例

本文整理汇总了PHP中sendNotification函数的典型用法代码示例。如果您正苦于以下问题:PHP sendNotification函数的具体用法?PHP sendNotification怎么用?PHP sendNotification使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sendNotification函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     $post = $this->input->post();
     if ($post) {
         $this->form_validation->set_rules('push_message', 'Message', 'trim|required');
         if ($this->form_validation->run()) {
             $deviceids = $this->common_model->selectData(DEVICE, '*', array("status" => 'Active'));
             $pushMessage = $post['push_message'];
             $msg = array('message' => $pushMessage, 'title' => 'Gujjubazar', 'subtitle' => 'No. 1 Classified site', 'type' => 'message', 'msgcnt' => 3, 'vibrate' => 1, 'sound' => 1);
             $macids[] = array();
             if (!empty($deviceids)) {
                 foreach ($deviceids as $key => $value) {
                     $macids[] = $value->macid;
                 }
             }
             if (count($macids) != 0) {
                 sendNotification($macids, $msg);
             }
             redirect('admin/dashboard');
         } else {
             $flash_arr = array('flash_type' => 'error', 'flash_msg' => 'Blank Push notification not allowed.');
         }
     }
     $data['view'] = "index";
     $data['flash_arr'] = $flash_arr;
     $this->load->view('admin/content', $data);
 }
开发者ID:niravpatel2008,项目名称:ubiquitous-octo-tatertot,代码行数:27,代码来源:pushmessage.php

示例2: pushNotificationsIOS

function pushNotificationsIOS($messageIOS)
{
    $sqlTD = @mysql_query("select distinct token from notificaciones where estatus = 1");
    $numberRows = mysql_num_rows($sqlTD);
    if ($numberRows > 0) {
        while ($row = mysql_fetch_array($sqlTD)) {
            sendNotification($row[token], "HOLA ArMoving");
            echo $row[token];
        }
    }
}
开发者ID:armoving,项目名称:nayaritenlinea,代码行数:11,代码来源:index.php

示例3: on_transition_post_status

 public static function on_transition_post_status($new_status, $old_status, $post)
 {
     if (empty($post) || $new_status !== "publish") {
         return;
     }
     $title_option = get_option('webpush_title');
     update_option('webpush_payload', array('title' => $title_option === 'blog_title' ? get_bloginfo('name') : $title_option, 'body' => get_the_title($post->ID), 'url' => get_permalink($post->ID)));
     $subscriptions = WebPush_DB::get_subscriptions();
     foreach ($subscriptions as $subscription) {
         if (!sendNotification($subscription->endpoint)) {
             // If there's an error while sending the push notification,
             // the subscription is no longer valid, hence we remove it.
             WebPush_DB::remove_subscription($subscription->endpoint);
         }
     }
 }
开发者ID:mykmelez,项目名称:wp-web-push,代码行数:16,代码来源:wp-web-push-main.php

示例4: prepareGCMAndSend

function prepareGCMAndSend($title, $message, $type)
{
    $jsonMessage = array();
    $jsonMessage["title"] = $title;
    $jsonMessage["message"] = $message;
    $jsonMessage["type"] = $type;
    $registrationIDs = array();
    $sql = "SELECT * FROM gcm_users;";
    $ref = mysql_query($sql);
    if (mysql_num_rows($ref) > 0) {
        while ($row = mysql_fetch_assoc($ref)) {
            $registrationIDs[] = $row["gcm_regid"];
        }
    }
    return sendNotification($jsonMessage, $registrationIDs);
}
开发者ID:quannguyenngoc,项目名称:gcm-notification-manager-php,代码行数:16,代码来源:add_and_send.php

示例5: mysql_fetch_array

     $getKey = mysql_fetch_array($selectKey);
     $key = $getKey["android_key"];
     $messageText = "A self-made workout has been added/edited in fitness4.me";
     if ($key != "") {
         sentandroid($key, $messageText, $level = "");
     }
     //get iphone device key
     $selectIphoneKey = mysql_query("select devicetoken from apple_devices where user_id='" . $userid . "'");
     $getIphoneKey = mysql_fetch_array($selectIphoneKey);
     $iphonekey = $getIphoneKey["devicetoken"];
     //get user plan
     $selectPlan = mysql_query("select plan from fitness_user_general where user_id='" . $userid . "'");
     $getPlan = mysql_fetch_array($selectPlan);
     $plan = $getPlan["plan"];
     if ($iphonekey != "") {
         sendNotification($messageText, $iphonekey, $sender = "", $level = "", $plan);
     }
     if ($workoutid == "null") {
         $query = "insert into fitness_selfmade_workouts(`userid`,`workout_name`,`workout_equipment`,`workout_focus`,`collection`,`duration`,`date_created`) values('" . $userid . "','" . $workoutName . "','" . $equipments . "','" . $muscles . "','" . $products . "','" . $time . "','" . $date . "')";
         mysql_query($query);
         $sql = 'SELECT id FROM fitness_selfmade_workouts order by id DESC limit 0,1';
         $query_execute = mysql_query($sql);
         $result = mysql_fetch_array($query_execute);
         $lastID = $result['id'];
     } else {
         $query = "update fitness_selfmade_workouts set workout_name='" . $workoutName . "',workout_equipment='" . $equipments . "',workout_focus='" . $muscles . "',collection='" . $products . "',duration='" . $time . "' where id='" . $workoutid . "' and userid='" . $userid . "'";
         mysql_query($query);
         $lastID = $workoutid;
     }
     echo $lastID;
 } else {
开发者ID:keyanmca,项目名称:yoga,代码行数:31,代码来源:update.php

示例6: messagedetail

 public function messagedetail()
 {
     $uid = $this->user_session['uid'];
     $allMessages = array();
     $get = $this->input->get();
     $post = $this->input->post();
     if ($post) {
         if (trim($post['message']) != '' && trim($get['user']) != '') {
             $data = array('clad_id' => trim($get['ad']), 'ad_msg_from' => $uid, 'ad_msg_to' => trim($get['user']), 'ad_message' => trim($post['message']), 'ad_msg_read_flag' => 0);
             $ret = $this->common_model->insertData(MESSAGE, $data);
             /*** User notification ***/
             $macids = array();
             $macid = $this->common_model->getMacids(trim($get['user']));
             foreach ($macid as $val) {
                 $macids[] = $val->macid;
             }
             ## get ad title
             $adDetail = $this->common_model->selectData(CLASSIFIEDAD, 'clad_title', array("clad_id" => $get['ad']));
             $pushMsg = "You have new message on Ad " . $adDetail[0]->clad_title . " - " . trim($post['message']);
             $msg = array('message' => $pushMsg, 'title' => 'Gujjubazar', 'subtitle' => 'No. 1 Classified site', 'type' => 'message', 'msgcnt' => 3, 'vibrate' => 1, 'sound' => 1);
             if (count($macids) != 0) {
                 sendNotification($macids, $msg);
             }
             $this->manageCache($get['ad']);
         }
     }
     if ($get['user'] != 0) {
         $messages = $this->common_model->getallmessage($get['ad'], $uid, $get['user']);
     } else {
         $messages = $this->common_model->selectData(ADREPLY, '*', array("clad_id" => $get['ad']), 'ad_reply_created_date', 'asc');
     }
     $where = 'ad_msg_to = ' . $uid . " AND clad_id =" . $get['ad'] . " AND ad_msg_from =" . $get['user'];
     $update = $this->common_model->updateData(MESSAGE, array('ad_msg_read_flag' => 1), $where);
     $where = "clad_id =" . $get['ad'];
     $update = $this->common_model->updateData(ADREPLY, array('ad_reply_status' => 1), $where);
     ## update notification cache
     $this->filecachemodel->processUpdateCache($uid, $get['ad']);
     ## Get ad detail by id
     $res = $this->common_model->selectData(CLASSIFIEDAD, 'clad_id,clad_title', array("clad_id" => $get['ad']));
     $data['ad_detail'] = $res;
     $data['allmessage'] = $messages;
     $data['uid'] = $uid;
     $data['fuid'] = $get['user'];
     $data['view'] = 'messagedetail';
     $this->load->view('content', $data);
 }
开发者ID:niravpatel2008,项目名称:ubiquitous-octo-tatertot,代码行数:46,代码来源:myaccount.php

示例7: array

}
// don't have and decline to answer
$test = array('execic' => 'a0HV0000002aEse', 'senioric' => 'a0HV0000002aEsg', 'promorate' => 'a0HV0000002aEss');
// check to see if they have changed between entries
$testFlag = false;
foreach ($test as $key => $val) {
    $f1 = $entry->getResponseByQuestion($val);
    $f2 = $prior->getResponseByQuestion($val);
    if ($f1 != $f2) {
        writeLog("{$key} status has changed");
        $testFlag = true;
    }
}
// if so, send a notification
if ($testFlag) {
    $url = Sforce::getInstance()->serverURL . $entry->Account__c;
    $subject = 'Top Company Promotion Rate and/or Position Verification';
    $msg = "The Top Company application for {$user->company} has inconsistent position information and should be reviewed. ";
    $msg .= "You may access the entry at {$url}.";
    sendNotification($msg, $subject);
}
try {
    $result = $entry->save();
} catch (Exception $e) {
    $message = "Please type your comment directly or copy and paste only plain text into the comment box.";
}
if ($result != "Saved") {
    echo "Please type your comment directly or copy and paste only plain text into the comment box.";
} else {
    echo "Saved";
}
开发者ID:redsummit,项目名称:anitaborg,代码行数:31,代码来源:certify.php

示例8: sendNotification

<?php

function sendNotification($apiKey, $registrationIdsArray, $messageData)
{
    $headers = array("Content-Type:" . "application/json", "Authorization:" . "key=" . $apiKey);
    $data = array('data' => $messageData, 'registration_ids' => $registrationIdsArray);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_URL, "https://android.googleapis.com/gcm/send");
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
    $response = curl_exec($ch);
    curl_close($ch);
    return $response;
}
// MENSAGEM
$message = 'Mensagem';
$title = "Testando";
$exemploParam = "Exemplo como passar parametro.";
//CODIGO GERADO PELO GOOGLE PARA O DEVICE - O IDEAL É GUARDAR ESSE CÓDIGO NO BANCO E GERAR UM LOOP AQUI PARA O ENVIO.
// PARA PROJETOS GRANDES ACONSELHO UTILIZAR UM CRON PARA AGENDAMENTO DOS ENVIOS
$registrationId = "REGISTRO DO DEVICE GERADO PELO APLICATIVO";
//API KEY GERADA PELO GOOGLE
$apiKey = "API KEY AQUI";
$response = sendNotification($apiKey, array($registrationId), array('message' => $message, 'exemploParam' => $exemploParam, 'title' => $title));
开发者ID:GustavoCostaW,项目名称:PushNotificationBackendSamples,代码行数:27,代码来源:android.php

示例9: brackets


//.........这里部分代码省略.........
                            $result = $sql->db_Query($q);
                            $q = "INSERT INTO " . TBL_SCORES . "(MatchID,Player,Team,Player_MatchTeam,Player_Rank)\r\n\t\t\t\t\t\t\tVALUES ({$match_id},{$playerBottomID},{$teamBottomID},2,2)\r\n\t\t\t\t\t\t\t";
                            $result = $sql->db_Query($q);
                            $match_array = array();
                            $match_array['winner'] = 'not played';
                            $match_array['match_id'] = $match_id;
                            $results[$round][$matchup]['matchs'][$nbr_matchs] = $match_array;
                            if ($nbr_matchs == 0) {
                                // Send notification to all the players.
                                $fromid = 0;
                                $subject = SITENAME . " " . EB_MATCHR_L52;
                                switch ($this->getMatchPlayersType()) {
                                    case 'Players':
                                        $q_Players = "SELECT DISTINCT " . TBL_USERS . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . " WHERE (" . TBL_MATCHS . ".MatchID = '{$match_id}')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_PLAYERS . ".PlayerID = " . TBL_SCORES . ".Player)" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_GAMERS . ".User = " . TBL_USERS . ".user_id)";
                                        $result_Players = $sql->db_Query($q_Players);
                                        $numPlayers = mysql_numrows($result_Players);
                                        break;
                                    case 'Teams':
                                        $q_Players = "SELECT DISTINCT " . TBL_USERS . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_TEAMS . ", " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . " WHERE (" . TBL_MATCHS . ".MatchID = '{$match_id}')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_TEAMS . ".TeamID = " . TBL_SCORES . ".Team)" . " AND (" . TBL_PLAYERS . ".Team = " . TBL_TEAMS . ".TeamID)" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_GAMERS . ".User = " . TBL_USERS . ".user_id)";
                                        $result_Players = $sql->db_Query($q_Players);
                                        $numPlayers = mysql_numrows($result_Players);
                                        break;
                                    default:
                                }
                                if ($numPlayers > 0) {
                                    for ($j = 0; $j < $numPlayers; $j++) {
                                        $pname = mysql_result($result_Players, $j, TBL_USERS . ".user_name");
                                        $pemail = mysql_result($result_Players, $j, TBL_USERS . ".user_email");
                                        $message = EB_MATCHR_L53 . $pname . EB_MATCHR_L54 . EB_MATCHR_L55 . $this->getField('Name') . EB_MATCHR_L56;
                                        $sendto = mysql_result($result_Players, $j, TBL_USERS . ".user_id");
                                        $sendtoemail = mysql_result($result_Players, $j, TBL_USERS . ".user_email");
                                        if (check_class($pref['eb_pm_notifications_class'])) {
                                            // Send PM
                                            sendNotification($sendto, $subject, $message, $fromid);
                                        }
                                        if (check_class($pref['eb_email_notifications_class'])) {
                                            // Send email
                                            require_once e_HANDLER . "mail.php";
                                            sendemail($sendtoemail, $subject, $message);
                                        }
                                    }
                                }
                            }
                            // if(nbr_matchs==0)
                        }
                        // create match
                    }
                    // schedule next match
                    /*
                    echo 'M'.$round.','.$matchup.':<br>';
                    var_dump($results[$round][$matchup]);
                    var_dump($content[$round][$matchup]);
                    echo '- matchup: top='.$matchups[$round][$matchup][0].', bottom='.$matchups[$round][$matchup][1].'<br>';
                    echo '- content: top='.$content[$round][$matchup][0].', bottom='.$content[$round][$matchup][1].'<br>';
                    echo '- winner='.$results[$round][$matchup]['winner'].', bye='.$results[$round][$matchup]['bye'].'<br>';
                    */
                }
                // for(matchup)
            } else {
                /* Last round, no match */
                for ($matchup = 1; $matchup <= $nbrMatchups; $matchup++) {
                    if (!isset($results[$round][$matchup]['winner'])) {
                        $results[$round][$matchup]['winner'] = '';
                    }
                    if (!isset($results[$round][$matchup]['bye'])) {
                        $results[$round][$matchup]['bye'] = false;
开发者ID:testt98,项目名称:ebattles,代码行数:67,代码来源:event.php

示例10: addTicket

 function addTicket($id)
 {
     error_log('addTicket\\n', 3, '/var/tmp/php.log');
     $request = Slim::getInstance()->request();
     $ticket = json_decode($request->getBody());
     //echo json_encode($ticket);
     try {
         $sql = "SELECT * FROM ticketstatus WHERE id = :id";
         $db = getConnection();
         $stmt = $db->prepare($sql);
         $stmt->bindParam("id", $ticket->ticketstatus->id);
         $stmt->execute();
         $ticketStatus = $stmt->fetch(PDO::FETCH_ASSOC);
         //echo json_encode($ticketStatus);
         $sql = "INSERT INTO ticket \n\t\t\t\t\t\t\t\t(id, subject, descrip, date, picture, user_id, floor_id, room_area,\n\t\t\t                    user_assigned_id, priority_id, ticketstatus_id, location_id, serviceType_id, date_assigned,\n\t\t\t                    date_respondby, date_due, date_complete, groups_id )\n\t\t\t\t\tVALUES \t\t(:id, :subject, :descrip, :date, :picture, :user_id, :floor_id, :room_area,\n\t\t\t                    :user_assigned_id, :priority_id, :ticketstatus_id, :location_id, :serviceType_id, :date_assigned,\n\t\t\t                    :date_respondby, :date_due, :date_complete, :groups_id )\n\t\t\t\t\tON DUPLICATE KEY UPDATE \n\t\t\t\t\t\t\t\tid=:id, subject=:subject, descrip=:descrip, date=:date, picture=:picture, \n\t\t\t\t\t            user_id=:user_id, floor_id=:floor_id, room_area=:room_area,\n\t\t\t                    user_assigned_id=:user_assigned_id, priority_id=:priority_id, ticketstatus_id=:ticketstatus_id\n\t\t\t                    location_id=:location_id, serviceType_id=:serviceType_id, date_assigned=:date_assigned,\n\t\t\t                    date_respondby=:date_respondby, date_due=:date_due, date_complete=:date_complete, \n\t\t\t                    groups_id=:groups_id";
         $stmt = $db->prepare($sql);
         $stmt->bindParam("id", $id);
         $stmt->bindParam("subject", $ticket->subject);
         $stmt->bindParam("descirp", $ticket->descirp);
         $stmt->bindParam("date", $ticket->date);
         $stmt->bindParam("picture", $ticket->picture);
         $stmt->bindParam("user_id", $ticket->user_id);
         $stmt->bindParam("floor_id", $ticket->floor_id);
         $stmt->bindParam("room_area", $ticket->room_area);
         $stmt->bindParam("user_assigned_id", $ticket->user_assigned_id);
         $stmt->bindParam("priority_id", $ticket->priority_id);
         $stmt->bindParam("ticketstatus_id", $ticket->ticketstatus->id);
         $stmt->bindParam("location_id", $ticket->location_id);
         $stmt->bindParam("serviceType_id", $ticket->serviceType_id);
         $stmt->bindParam("date_assigned", $ticket->date_assigned);
         $stmt->bindParam("date_respondby", $ticket->date_respondby);
         $stmt->bindParam("date_due", $ticket->date_due);
         $stmt->bindParam("date_complete", $ticket->date_complete);
         $stmt->bindParam("groups_id", $ticket->groups_id);
         $stmt->execute();
         $db = null;
         //echo "Finished INSERT";
         // send notifications
         // next, get the location name. We'll include it in the notification message.
         $sql = "SELECT name FROM location WHERE location_id=:id";
         $db = getConnection();
         $stmt = $db->prepare($sql);
         $stmt->bindParam("id", $ticket->location_id);
         $stmt->execute();
         $location = $stmt->fetch(PDO::FETCH_ASSOC);
         $db = null;
         //echo json_encode($location);
         // next, get a list of devices to notify
         $sql = "SELECT pushdevice.token, devicetype.name AS devicetype FROM profile \n\t\t\t\t\tINNER JOIN pushdevice ON pushdevice.profile_id=profile.id\n\t\t\t\t\tINNER JOIN devicetype ON pushdevice.devicetype_id=devicetype.id\n\t\t\t\t\tWHERE groups_id=:group AND location_id=:location";
         $db = getConnection();
         $stmt = $db->prepare($sql);
         $stmt->bindParam("group", $group['id']);
         $stmt->bindParam("location", $ticket->location_id);
         //error_log("QUERY: " . $stmt, 3, '/var/tmp/php.log');
         $stmt->execute();
         $devices = $stmt->fetchAll(PDO::FETCH_ASSOC);
         $db = null;
         //echo json_encode($devices);
         // finally, send push notification to each user.
         //$iospush = IOSPush::getInstance();
         //echo "**1**";
         foreach ($devices as $device) {
             error_log("PUSH TO :" . $e->getMessage() . "\n", 3, '/var/tmp/php.log');
             sendNotification($device['token'], "New Ticket for Location: " . $location['name'], 1);
         }
         echo json_encode($ticket);
     } catch (PDOException $e) {
         error_log("***** PDOException *****" . $e->getMessage() . "\n", 3, '/var/tmp/php.log');
         echo '{"error":{"text":' . $e->getMessage() . '}}';
     } catch (Exception $ex) {
         error_log("***** Exception *****" . $ex->getMessage() . "\n", 3, '/var/tmp/php.log');
         echo '{"error":{"text":' . $ex->getMessage() . '}}';
     }
 }
开发者ID:archelaus,项目名称:smartphp,代码行数:74,代码来源:ticket.php

示例11: array

@set_include_path(implode(PATH_SEPARATOR, array(dirname(__FILE__) . "/../", dirname(__FILE__) . "/../core", dirname(__FILE__) . "/../core/includes", dirname(__FILE__) . "/../core/library", get_include_path())));
/**
 * Include the Entrada init code.
 */
require_once "init.inc.php";
/*
 * Fetch the unconfirmed observerships whose preceptors have not been notified. 
 */
$query = "\tSELECT *\n\t\t\tFROM `student_observerships` \n\t\t\tWHERE ((FROM_UNIXTIME(`start`) <= NOW() AND FROM_UNIXTIME(`end`) <= NOW()) OR (FROM_UNIXTIME(`start`) <= NOW() AND `end` IS NULL))\n\t\t\t\tAND (`notice_sent` = '0' OR `notice_sent` IS NULL OR DATEDIFF(NOW(), FROM_UNIXTIME(`notice_sent`)) >= '7')\n\t\t\t\tAND `status` = 'approved'\n\t\t\t\tAND (`reflection_id` IS NOT NULL AND `reflection_id` <> 0)";
$results = $db->GetAll($query);
if ($results) {
    foreach ($results as $result) {
        /*
         * Create the observership object, send the notification, and update it with the new time.
         */
        sendNotification($result);
    }
}
function sendNotification($result)
{
    global $AGENT_CONTACTS, $db;
    if ($result["preceptor_proxy_id"] != 0) {
        $query = "SELECT `prefix`, `firstname`, `lastname`, `email` FROM `" . AUTH_DATABASE . "`.`user_data` WHERE `id` = " . $db->qstr($result["preceptor_proxy_id"]);
        $preceptor = $db->GetRow($query);
        $preceptor_email = $preceptor["email"];
        $preceptor_name = (!empty($preceptor["prefix"]) ? $preceptor["prefix"] . " " : "") . $preceptor["firstname"] . " " . $preceptor["lastname"];
    } else {
        $preceptor_email = $result["preceptor_email"];
        $preceptor_name = $result["preceptor_firstname"] . " " . $result["preceptor_lastname"];
    }
    if ($preceptor_email) {
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:31,代码来源:observership-confirmations.php

示例12: challengeDecline

 function challengeDecline()
 {
     global $sql;
     global $tp;
     global $time;
     global $pref;
     // Get info about the challenge
     $q = "SELECT DISTINCT " . TBL_CHALLENGES . ".*, " . TBL_USERS . ".*, " . TBL_EVENTS . ".*, " . TBL_GAMES . ".*" . " FROM " . TBL_CHALLENGES . ", " . TBL_USERS . ", " . TBL_EVENTS . ", " . TBL_GAMES . " WHERE (" . TBL_CHALLENGES . ".ChallengeID = '" . $this->fields['ChallengeID'] . "')" . " AND (" . TBL_USERS . ".user_id = " . TBL_CHALLENGES . ".ReportedBy)" . " AND (" . TBL_CHALLENGES . ".Event = " . TBL_EVENTS . ".EventID)" . " AND (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)";
     $result = $sql->db_Query($q);
     $numChallenges = mysql_numrows($result);
     if ($numChallenges > 0) {
         $cReportedBy = mysql_result($result, 0, TBL_USERS . ".user_id");
         $cReportedByNickName = mysql_result($result, 0, TBL_USERS . ".user_name");
         $cReportedByEmail = mysql_result($result, 0, TBL_USERS . ".user_email");
         $event_id = mysql_result($result, 0, TBL_EVENTS . ".EventID");
         $event = new Event($event_id);
         $subject = SITENAME . " " . EB_CHALLENGE_L29;
         $message = EB_CHALLENGE_L30 . $cReportedByNickName . EB_CHALLENGE_L31 . USERNAME . EB_CHALLENGE_L32 . $event->getField('Name') . EB_CHALLENGE_L33;
         $fromid = 0;
         $sendto = $cReportedBy;
         $sendtoemail = $cReportedByEmail;
         if (check_class($pref['eb_pm_notifications_class'])) {
             // Send PM
             sendNotification($sendto, $subject, $message, $fromid);
         }
         if (check_class($pref['eb_email_notifications_class'])) {
             // Send email
             require_once e_HANDLER . "mail.php";
             sendemail($sendtoemail, $subject, $message);
         }
     }
     $this->deleteChallenge();
 }
开发者ID:testt98,项目名称:ebattles,代码行数:33,代码来源:challenge.php

示例13: addMember

 function addMember($user, $notify)
 {
     global $sql;
     global $time;
     $div_id = $this->fields['DivisionID'];
     $game_id = $this->fields['Game'];
     $q = "SELECT " . TBL_USERS . ".*" . " FROM " . TBL_USERS . " WHERE (" . TBL_USERS . ".user_id = '{$user}')";
     $result = $sql->db_Query($q);
     $Name = mysql_result($result, 0, TBL_USERS . ".user_name");
     $UniqueGameID = "";
     $gamerID = updateGamer($user, $game_id, $Name, $UniqueGameID);
     $q = " INSERT INTO " . TBL_MEMBERS . "(Division,User,timestamp)\r\n\t\tVALUES ({$div_id},{$user},{$time})";
     $sql->db_Query($q);
     // User will automatically be signed up to all current events this division participates in
     $q_2 = "SELECT " . TBL_TEAMS . ".*, " . TBL_EVENTS . ".*" . " FROM " . TBL_TEAMS . ", " . TBL_EVENTS . " WHERE (" . TBL_TEAMS . ".Division = '{$div_id}')" . " AND (" . TBL_TEAMS . ".Event = " . TBL_EVENTS . ".EventID)" . " AND (" . TBL_EVENTS . ".Status != 'finished')";
     $result_2 = $sql->db_Query($q_2);
     $num_rows_2 = mysql_numrows($result_2);
     if ($num_rows_2 > 0) {
         for ($j = 0; $j < $num_rows_2; $j++) {
             $event_id = mysql_result($result_2, $j, TBL_EVENTS . ".EventID");
             $event = new Event($event_id);
             $team_id = mysql_result($result_2, $j, TBL_TEAMS . ".TeamID");
             $team_banned = mysql_result($result_2, $j, TBL_TEAMS . ".Banned");
             // Verify there is no other player for that user/event/team
             $q = "SELECT COUNT(*) as NbrPlayers" . " FROM " . TBL_PLAYERS . " WHERE (Event = '{$event_id}')" . " AND (Team = '{$team_id}')" . " AND (User = " . USERID . ")";
             $result = $sql->db_Query($q);
             $row = mysql_fetch_array($result);
             $nbrplayers = $row['NbrPlayers'];
             if ($nbrplayers == 0) {
                 $q = " INSERT INTO " . TBL_PLAYERS . "(Event,Gamer,Team,ELORanking,TS_mu,TS_sigma,G2_r,G2_RD,G2_sigma,Joined,Banned)\r\n\t\t\t\t\tVALUES ({$event_id}, {$gamerID}, {$team_id}, " . $event->getField('ELO_default') . ", " . $event->getField('TS_default_mu') . ", " . $event->getField('TS_default_sigma') . "," . $event->fields['G2_default_r'] . "," . $event->fields['G2_default_RD'] . "," . $event->fields['G2_default_sigma'] . ",{$time}, {$team_banned})";
                 $sql->db_Query($q);
                 $event->setFieldDB('IsChanged', 1);
             }
         }
     }
     if ($notify) {
         list($cname, $ctag, $cid) = $this->getClanInfo();
         $sendto = $user;
         $subject = SITENAME . " " . $cname;
         $message = EB_CLANM_L39 . $username . EB_CLANM_L40 . $cname . EB_CLANM_L41 . EB_CLANM_L43;
         sendNotification($sendto, $subject, $message, $fromid = 0);
         // Send email
         $message = EB_CLANM_L39 . $username . EB_CLANM_L39 . $cname . EB_CLANM_L42 . SITEURLBASE . e_PLUGIN_ABS . "ebattles/claninfo.php?clanid=" . $cid . EB_CLANM_L43;
         require_once e_HANDLER . "mail.php";
         sendemail($useremail, $subject, $message);
     }
 }
开发者ID:testt98,项目名称:ebattles,代码行数:47,代码来源:clan.php

示例14: WHERE

         case 'Teams':
             $q_Players = "SELECT DISTINCT " . TBL_USERS . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_TEAMS . ", " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . " WHERE (" . TBL_MATCHS . ".MatchID = '{$match_id}')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_TEAMS . ".TeamID = " . TBL_SCORES . ".Team)" . " AND (" . TBL_PLAYERS . ".Team = " . TBL_TEAMS . ".TeamID)" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_GAMERS . ".User = " . TBL_USERS . ".user_id)";
             $result_Players = $sql->db_Query($q_Players);
             $nbr_players = mysql_numrows($result_Players);
             break;
         default:
     }
     if ($nbr_players > 0) {
         for ($j = 0; $j < $nbr_players; $j++) {
             $pname = mysql_result($result_Players, $j, TBL_USERS . ".user_name");
             $pemail = mysql_result($result_Players, $j, TBL_USERS . ".user_email");
             $message = EB_MATCHR_L53 . $pname . EB_MATCHR_L54 . EB_MATCHR_L55 . $event->getField('Name') . EB_MATCHR_L56;
             $sendto = mysql_result($result_Players, $j, TBL_USERS . ".user_id");
             $sendtoemail = mysql_result($result_Players, $j, TBL_USERS . ".user_email");
             if (check_class($pref['eb_pm_notifications_class'])) {
                 sendNotification($sendto, $subject, $message, $fromid);
             }
             if (check_class($pref['eb_email_notifications_class'])) {
                 // Send email
                 require_once e_HANDLER . "mail.php";
                 sendemail($sendtoemail, $subject, $message);
             }
         }
     }
     //header("Location: eventinfo.php?eventid=$event_id");
 } else {
     $match->match_scores_update();
     // Automatically Update Players stats only if Match Approval is Disabled
     if ($event->getField('MatchesApproval') == eb_UC_NONE) {
         switch ($event->getMatchPlayersType()) {
             case 'Players':
开发者ID:testt98,项目名称:ebattles,代码行数:31,代码来源:matchreport.php

示例15: SubmitTeamChallenge

function SubmitTeamChallenge($event_id, $challengerpuid, $challengedtid)
{
    global $sql;
    global $text;
    global $tp;
    global $time;
    global $pref;
    $event = new Event($event_id);
    // Challenger Info
    // Attention here, we use user_id, so there has to be 1 user for 1 player
    $q = "SELECT " . TBL_PLAYERS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . " WHERE (" . TBL_PLAYERS . ".Event = '{$event_id}')" . "   AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . "   AND (" . TBL_USERS . ".user_id = " . TBL_GAMERS . ".User)" . "   AND (" . TBL_USERS . ".user_id = '{$challengerpuid}')";
    $result = $sql->db_Query($q);
    $challengerpid = mysql_result($result, 0, TBL_PLAYERS . ".PlayerID");
    $challengertid = mysql_result($result, 0, TBL_PLAYERS . ".Team");
    list($challengertclan, $challengertclantag, $challengertclanid) = getClanInfo($challengertid);
    // Challenged Info
    // Nothing needed here
    // ...
    $challenge_times = '';
    for ($date = 1; $date <= $event->getField('MaxDatesPerChallenge'); $date++) {
        $challenge_date = $_POST['date' . $date];
        $challenge_time_local = strtotime($challenge_date);
        $challenge_time_local = $challenge_time_local - TIMEOFFSET;
        // Convert to GMT time
        if ($date > 1) {
            $challenge_times .= ',';
        }
        $challenge_times .= $challenge_time_local;
    }
    // comments
    //----------------------------------
    $comments = $tp->toDB($_POST['challenge_comments']);
    $time_reported = $time;
    // Create Challenge ------------------------------------------
    $q = "INSERT INTO " . TBL_CHALLENGES . "(Event,ChallengerTeam,ChallengedTeam,ReportedBy,TimeReported,Comments,Status,MatchDates)\r\n\tVALUES (\r\n\t'{$event_id}',\r\n\t'{$challengertid}',\r\n\t'{$challengedtid}',\r\n\t'{$challengerpuid}',\r\n\t'{$time_reported}',\r\n\t'{$comments}',\r\n\t'requested',\r\n\t'{$challenge_times}'\r\n\t)";
    $result = $sql->db_Query($q);
    // Send PM
    $fromid = 0;
    $subject = SITENAME . " " . EB_CHALLENGE_L23;
    // All members of the challenged division will receive the PM
    $q = "SELECT " . TBL_TEAMS . ".*, " . TBL_MEMBERS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_TEAMS . ", " . TBL_USERS . ", " . TBL_MEMBERS . " WHERE (" . TBL_TEAMS . ".TeamID = '{$challengedtid}')" . " AND (" . TBL_MEMBERS . ".Division = " . TBL_TEAMS . ".Division)" . " AND (" . TBL_USERS . ".user_id = " . TBL_MEMBERS . ".User)";
    $result = $sql->db_Query($q);
    $num_rows = mysql_numrows($result);
    if ($num_rows > 0) {
        for ($j = 0; $j < $num_rows; $j++) {
            $challengedpname = mysql_result($result, $j, TBL_USERS . ".user_name");
            $challengedpemail = mysql_result($result, $j, TBL_USERS . ".user_email");
            $message = EB_CHALLENGE_L24 . $challengedpname . EB_CHALLENGE_L25 . $challengertclan . EB_CHALLENGE_L26 . $event->getField('Name') . EB_CHALLENGE_L27;
            if (check_class($pref['eb_pm_notifications_class'])) {
                $sendto = mysql_result($result, $j, TBL_USERS . ".user_id");
                sendNotification($sendto, $subject, $message, $fromid);
            }
            if (check_class($pref['eb_email_notifications_class'])) {
                // Send email
                require_once e_HANDLER . "mail.php";
                sendemail($challengedpemail, $subject, $message);
            }
        }
    }
}
开发者ID:testt98,项目名称:ebattles,代码行数:60,代码来源:challengerequest.php


注:本文中的sendNotification函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。