本文整理汇总了PHP中XMPP_ERROR_trace函数的典型用法代码示例。如果您正苦于以下问题:PHP XMPP_ERROR_trace函数的具体用法?PHP XMPP_ERROR_trace怎么用?PHP XMPP_ERROR_trace使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了XMPP_ERROR_trace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: umc_faq_web
/**
* Create a jQuery accordion
*
* @global array $UMC_FAQ
* @param type $id
* @return string
*/
function umc_faq_web($id = 'accordion')
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
global $UMC_FAQ;
$s_get = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
if (isset($s_get['id']) && isset($UMC_FAQ[$s_get['id']])) {
$active = $s_get['id'] - 1;
} else {
$active = 0;
}
if (isset($s_get['cat'])) {
$presel_cat = $s_get['cat'];
} else {
$presel_cat = 'all';
}
$out = "<script>\r\n jQuery(document).ready(function(\$) {\r\n \$( \"#{$id}\" ).accordion({\r\n collapsible: true, heightStyle: \"content\", active: {$active}\r\n });\r\n });\r\n</script>" . "<div id=\"{$id}\">\n";
$cat_arr = array('all' => 'All');
foreach ($UMC_FAQ as $faq_id => $F) {
// we cannot do array_merge since we need to set the keys for the dropdown
foreach ($F['categories'] as $cat) {
$cat_arr[$cat] = ucwords($cat);
}
$cat_text = implode(", ", $F['categories']);
if ($presel_cat == 'all' || in_array($presel_cat, $F['categories'])) {
$out .= " <h3 id=\"FAQ{$faq_id}\">{$faq_id}: {$F['question']}</h3>\r\n <div>\r\n <p class=\"answer\">{$F['answer']}</p>\r\n <p class=\"categories\"><a href=\"?id={$faq_id}#FAQ{$faq_id}\">Direct link</a> | Categories: {$cat_text}</p>\r\n </div>";
}
}
$out .= "</div>";
$drop = "Categories: <form style=\"display:inline;\" action=\"\" method=\"get\">\n" . umc_web_dropdown($cat_arr, 'cat', $presel_cat, true) . "</form>";
$out = $drop . $out;
return $out;
}
示例2: run_umc_scheduler
function run_umc_scheduler()
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
// list of what to do & undo or temp permissions
$schedule_arr = array(1 => array('on_cmd' => array(0 => 'ch qm u Today bloody is Monday, beware of the mobs!', 1 => 'bloodmoon start darklands'), 'off_cmd' => array()), 2 => array('on_cmd' => array(0 => 'ch qm u Today is Tuesday, nothing special!', 1 => 'bloodmoon stop darklands', 2 => 'time 00:00 darklands'), 'off_cmd' => array()), 3 => array('on_cmd' => array(0 => 'ch qm u Hungry Wednesday started!', 1 => 'mv modify set autoheal false darklands', 2 => 'mv gamerule naturalRegeneration false darklands', 3 => 'region flag darklands_spawn greeting -w darklands ATTENTION: Today Darklands autoheal is OFF! You being fed does not heal you!'), 'off_cmd' => array(0 => 'ch qm u Hungry Wednesday is over!', 1 => 'mv modify set autoheal true darklands', 2 => 'mv gamerule naturalRegeneration true darklands', 3 => 'region flag darklands_spawn greeting -w darklands Welcome to the Darklands! Today everything is normal. Whatever that means.')), 4 => array('on_cmd' => array(0 => 'ch qm u Today is Thursday, nothing special!'), 'off_cmd' => array()), 5 => array('on_cmd' => array(0 => 'ch qm u Freaky Frydays started!', 1 => 'time 12:00 darklands', 2 => 'sunburn darklands on', 3 => 'region flag darklands_spawn greeting -w darklands ATTENTION: Today it\'s daylight in the Darklands, but the sun will burn you! find shadow!'), 'off_cmd' => array(0 => 'ch qm u Freaky Frydays is over!', 1 => 'time 00:00 darklands', 2 => 'sunburn darklands off', 3 => 'region flag darklands_spawn greeting -w darklands Welcome to the Darklands! Today everything is normal. Whatever that means.')), 6 => array('on_cmd' => array(0 => 'ch qm u Today is Saturday, nothing special!'), 'off_cmd' => array()), 0 => array('on_cmd' => array(0 => 'mv modify set pvp true darklands', 1 => 'region flag darklands_spawn greeting -w darklands ATTENTION: Today Darklands is PVP ON! You are safe here, but further out it\'s dangerous!', 2 => 'ch qm u ATTENTION: PVP is now ON in the darklands (except the area around spawn)!', 3 => 'region flag darklands_spawn farewell -w darklands ATTENTION: You are now entering a PVP area!!'), 'off_cmd' => array(0 => 'mv modify set pvp false darklands', 1 => 'region flag darklands_spawn greeting -w darklands Today Darklands is PVP OFF!', 2 => 'ch qm u ATTENTION: PVP is now OFF in the darklands. You are safe!', 3 => 'region flag darklands_spawn farewell -w darklands Welcome to the Darklands! Today everything is normal. Whatever that means.')));
// find current day
$date_new = umc_datetime();
$today = $date_new->format('w');
// echo "Echo today is $today: " . $date_new->format("Y-m-d H:i:s");
if ($today == 0) {
$yesterday = 6;
} else {
$yesterday = $today - 1;
}
// execute last day's off-commands
$cmds = $schedule_arr[$yesterday]['off_cmd'];
// var_dump($cmds);
umc_schedule_exec($cmds);
umc_log('scheduler', "yesterday", "executing commands for yesterday: {$yesterday}");
// execute todays on-commands
$cmds = $schedule_arr[$today]['on_cmd'];
umc_log('scheduler', "today", "executing commands for yesterday: {$today}");
umc_schedule_exec($cmds);
$default_commands = array("mv gamerule doDaylightCycle false darklands", "mv gamerule naturalRegeneration false deathlands");
foreach ($default_commands as $cmd) {
umc_exec_command($cmd);
}
umc_ban_to_database();
// make a new ID file in case item data has changed
include_once '/home/minecraft/server/bin/commands/make_id_file.php';
}
示例3: umc_info_setpass
function umc_info_setpass()
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
global $UMC_USER;
$uuid = $UMC_USER['uuid'];
$user_login = umc_wp_get_login_from_uuid($uuid);
// get userdata
// this code is copied from wp-login.php, round line 325, grep for 'get_password_reset_key'
$user_data = get_user_by('login', $user_login);
$reset_key = get_password_reset_key($user_data);
$url = network_site_url("wp-login.php?action=rp&key={$reset_key}&login=" . rawurlencode($user_login), 'login');
// shorten the URL
$shortenedurl = file_get_contents('http://uncovery.me/s/shorten.php?longurl=' . urlencode($url));
umc_header("Password Reset Link");
umc_echo("Please click on the following link to set a new password:");
umc_echo($shortenedurl);
umc_footer();
}
示例4: connect
/**
* Connects to a Websend server.
* Returns true if successful.
*/
public function connect()
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
$this->stream = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);
if ($this->stream) {
$this->writeRawByte(21);
$this->writeString("websendmagic");
$seed = $this->readRawInt();
$hashedPassword = hash($this->hashAlgorithm, $seed . $this->password);
$this->writeString($hashedPassword);
$result = $this->readRawInt();
if ($result == 1) {
return true;
} else {
return false;
}
} else {
return false;
}
}
示例5: ban
public function ban($reason)
{
XMPP_ERROR_trace(__CLASS__ . " // " . __FUNCTION__, func_get_args());
global $UMC_USERS;
$cmd = "ban {$this->username} {$reason}";
if ($this->context == 'websend') {
umc_ws_cmd($cmd, 'asConsole', false, false);
$admin = $UMC_USERS['current_user']->username;
} else {
umc_exec_command($cmd, 'asConsole', false);
$admin = 'wordpress';
}
$sql = "INSERT INTO minecraft_srvr.`banned_users`(`username`, `reason`, `admin`, `uuid`) VALUES ('{$this->username}','{$reason}', '{$admin}', '{$this->uuid}');";
umc_mysql_query($sql, true);
// remove shop inventory
umc_shop_cleanout_olduser($this->uuid);
// remove from teamspeak
umc_ts_clear_rights($this->uuid);
$text = "{$admin} banned \${$this->username} ({$this->uuid}) because of {$reason}";
umc_log('mod', 'ban', $text);
XMPP_ERROR_send_msg($text);
// iterate plugins to check for plugin relared post ban processes
}
示例6: umc_array2file_line
function umc_array2file_line($array, $layer, $val_change_func = false)
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
$in_text = umc_array2file_indent($layer);
$out = "";
foreach ($array as $key => $value) {
if ($val_change_func) {
$value = $val_change_func($key, $value);
}
$out .= "{$in_text}'{$key}' => ";
if (is_array($value)) {
$layer++;
$out .= "array(\n" . umc_array2file_line($value, $layer, $val_change_func) . "{$in_text}),\n";
$layer--;
} else {
if (is_numeric($value)) {
$out .= "{$value},\n";
} else {
$out .= "'{$value}',\n";
}
}
}
return $out;
}
示例7: umc_timer_from_json
/**
* Converts a JSON date to a DateTime Object
*
* @param string $json_date
* @return DateTimeObj or false
*/
function umc_timer_from_json($json_date)
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
// do we have a timezone string or not?
if (strlen($json_date) == 13) {
$json_date .= "-0000";
}
//1433044095000 <- No timezone
//1365004652303-0500 <- timezone
$pattern = '/(\\d{10})(\\d{3})([\\+\\-]\\d{4})/';
$format = "U.u.O";
$mask = '%2$s.%3$s.%4$s';
$matches = false;
$r = preg_match($pattern, $json_date, $matches);
if (!$r) {
XMPP_ERROR_trigger("Failed to match date in {$json_date}");
}
$buffer = vsprintf($mask, $matches);
$result = DateTime::createFromFormat($format, $buffer);
if (!$result) {
XMPP_ERROR_trigger(sprintf('Failed To Create from Format "%s" for "%s".', $format, $buffer));
}
return $result;
}
示例8: umc_bottomkarma
function umc_bottomkarma()
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
$sql = "SELECT SUM(karma) as sum_karma, receivers.username as receiver_name FROM minecraft_srvr.karma\r\n LEFT JOIN minecraft_srvr.UUID as senders ON sender_uuid=senders.UUID\r\n LEFT JOIN minecraft_srvr.UUID as receivers ON receiver_uuid=receivers.UUID\r\n WHERE senders.lot_count > 0 AND receivers.lot_count > 0\r\n GROUP BY receivers.username\r\n HAVING sum(karma) < 0\r\n ORDER BY sum(karma) ASC LIMIT 0,10";
$D = umc_mysql_fetch_all($sql);
umc_echo("Bottom ten Karma users:");
umc_echo("-∞ => Uncovery");
foreach ($D as $row) {
$sum_karma = $row['sum_karma'];
$receiver = $row['receiver_name'];
if (!umc_user_is_banned($receiver)) {
umc_echo("{$sum_karma} => {$receiver}");
}
}
}
示例9: write
function write()
{
global $UNC_GALLERY;
if ($UNC_GALLERY['debug']) {
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
}
if (!function_exists('iptcembed')) {
if ($UNC_GALLERY['debug']) {
XMPP_ERROR_trace(__FUNCTION__, "iptcembed Does not exist!!");
}
return false;
}
$mode = 0;
$content = iptcembed($this->binary(), $this->file, $mode);
$filename = $this->file;
@unlink($filename);
#delete if exists
$fp = fopen($filename, "w");
fwrite($fp, $content);
fclose($fp);
}
示例10: umc_mysql_fetch_all
function umc_mysql_fetch_all($sql)
{
global $UNC_DB;
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
$stmt = $UNC_DB['link']->prepare($sql);
if (!$stmt) {
$error = $UNC_DB['link']->errorInfo();
XMPP_ERROR_trigger($error);
return false;
} else {
$stmt->execute();
}
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $result;
}
示例11: umc_mod_blockcheck_fill_inv
function umc_mod_blockcheck_fill_inv($start)
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
global $UMC_DATA, $UMC_USER;
$end_item = 'record_wait';
$username = $UMC_USER['username'];
$inv_slots = 36;
$c = 0;
$started = false;
foreach ($UMC_DATA as $item_name => $D) {
if ($c >= $start && !$started) {
$started = true;
}
$id = 0;
if (!isset($D['subtypes'])) {
$D['subtypes'] = array(0 => array('name' => $item_name, 'avail' => $D['avail']));
}
foreach ($D['subtypes'] as $id => $d) {
// we assume that the current availability information is correct
$avail = $d['avail'];
if ($avail) {
umc_ws_cmd("give {$username} {$item_name}:{$id} 1;", 'asConsole');
$c++;
}
// we bail if we filled the inventory
// and return the current position in the array
if ($c == $inv_slots) {
return array('item_name' => $item_name, 'id' => $id, 'count' => $c);
}
}
}
}
示例12: umc_web_usercheck
/**
* returns likely accounts shared by UUIDs
*
*/
function umc_web_usercheck()
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
$tables = array('Same IP' => 'last_ip', 'Same Browser' => 'browser_id', 'Same TeamSpeak' => 'ts_uuid');
$out = '';
foreach ($tables as $table_name => $crit_field) {
$sql = "SELECT {$crit_field} FROM minecraft_srvr.UUID WHERE {$crit_field} <> '' " . "GROUP BY {$crit_field} HAVING count({$crit_field}) > 1 ORDER BY count({$crit_field}) DESC, onlinetime DESC";
$L = umc_mysql_fetch_all($sql);
$out_arr = array();
foreach ($L as $l) {
$line_sql = "SELECT username, userlevel, lot_count, onlinetime, INET_NTOA(last_ip) as ip, " . "CONCAT(browser_id, '<br>', ts_uuid) AS 'Browser & TS ID' " . "FROM minecraft_srvr.UUID WHERE {$crit_field} = '{$l[$crit_field]}'" . "ORDER BY onlinetime DESC";
$D = umc_mysql_fetch_all($line_sql);
foreach ($D as $d) {
$out_arr[] = $d;
}
}
$out .= umc_web_table($table_name, 0, $out_arr, "<h2>{$table_name}</h2>");
}
return $out;
}
示例13: umc_donation_level
function umc_donation_level($user, $debug = false)
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
$U = umc_uuid_getboth($user);
$uuid = $U['uuid'];
$username = $U['username'];
$debug_txt = '';
global $UMC_SETTING;
$date_now = new DateTime("now");
$sql = "SELECT amount, date FROM minecraft_srvr.donations WHERE uuid='{$uuid}';";
$level = umc_get_uuid_level($uuid);
if ($level == 'Owner') {
return false;
}
$D = umc_mysql_fetch_all($sql);
// if there are 0 donations, user should not be changes
if (count($D) == 0 && strstr($level, "Donator")) {
XMPP_ERROR_trigger("User {$username} ({$uuid}) never donated but has a donator level ({$level})");
} else {
if (count($D) == 0) {
$debug_txt .= "{$username} ({$uuid}) does not have any donations\n";
return;
}
}
$debug_txt .= "Checking donation upgrade of user {$username}, current UserLevel: {$level}\n";
$donation_level = 0;
// go through all donations and find out how much is still active
foreach ($D as $row) {
$date_donation = new DateTime($row['date']);
$interval = $date_donation->diff($date_now);
$years = $interval->format('%y');
$months = $interval->format('%m');
$donation_term = $years * 12 + $months;
$donation_leftover = $row['amount'] - $donation_term;
if ($donation_leftover < 0) {
$donation_leftover = 0;
// do not create negative carryforward
}
$donation_level = $donation_level + $donation_leftover;
$debug_txt .= "Amount donated {$row['amount']} {$years} years {$months} m ago = {$donation_term} months ago, {$donation_leftover} leftover, level: {$donation_level}\n";
}
$donation_level_rounded = ceil($donation_level);
// get userlevel and check if demotion / promotion is needed
$debug_txt .= "user {$username} ({$uuid}) has donation level of {$donation_level_rounded}, now is {$level}\n";
// current userlevel
$ranks_lvl = array_flip($UMC_SETTING['ranks']);
$cur_lvl = $ranks_lvl[$level];
// get current promotion level
if (strpos($level, 'DonatorPlus')) {
$current = 2;
} else {
if (strpos($level, 'Donator')) {
$current = 1;
} else {
$current = 0;
}
}
// get future promotion level
if (count($D) == 0) {
// this never happens since it's excluded above
$future = 0;
} else {
if ($donation_level_rounded >= 1) {
$future = 2;
} else {
if ($donation_level_rounded < 1) {
$future = 1;
}
}
}
$debug_txt .= "future = {$future}, current = {$current}\n";
$change = $future - $current;
if ($change == 0) {
$debug_txt .= "User has right level, nothing to do\n";
return false;
// bail if no change needed
} else {
// we have a change in level, let's get an error report
$debug = true;
}
$debug_txt .= "User will change {$change} levels\n";
// get currect rank index
$debug_txt .= "Current Rank index = {$cur_lvl}\n";
// calculate base level
$base_lvl = $cur_lvl - $current;
$debug_txt .= "User base level = {$base_lvl}\n";
$new_lvl = $base_lvl + $future;
if ($new_lvl == $cur_lvl) {
XMPP_ERROR_send_msg("Donations upgrade: Nothing to do, CHECK this should have bailed earlier!");
return false;
}
$new_rank = $UMC_SETTING['ranks'][$new_lvl];
$debug_txt .= "User {$username} upgraded from {$level} to {$new_rank}\n";
umc_exec_command("pex user {$uuid} group set {$new_rank}");
umc_log('Donations', 'User Level de/promotion', "User {$username} upgraded from {$level} to {$new_rank}");
if ($debug) {
XMPP_ERROR_send_msg($debug_txt);
}
return $donation_level_rounded;
// . "($donation_level $current - $future - $change)";
//.........这里部分代码省略.........
示例14: umc_wp_get_uuid_from_userlogin
/**
* takes the wordpress userlogin and returns the UUID as stored in the meta data
*
* @param type $user_login
* @return type
*/
function umc_wp_get_uuid_from_userlogin($user_login)
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
$user = get_user_by('login', $user_login);
$uuid = get_user_meta($user->ID, 'minecraft_uuid', true);
return $uuid;
}
示例15: umc_checkout_goods
/**
* Add items to a user inventory. If cancel=true, we check if the current user is owner of the goods
*
* @global type $UMC_USER
* @param type $id
* @param type $amount
* @param type $table
* @param boolean $cancel
* @param type $to_deposit
* @param string $uuid
* @return string
*/
function umc_checkout_goods($id, $amount, $table = 'stock', $cancel = false, $to_deposit = false, $uuid = false)
{
global $UMC_USER, $UMC_ENV;
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
if (!$uuid) {
$player = $UMC_USER['username'];
$uuid = $UMC_USER['uuid'];
} else {
$player = umc_user2uuid($uuid);
}
if (!is_numeric($id)) {
umc_error('{red}Invalid ID. Please use {yellow}/shophelp;');
}
// the fact that the source is also a condition prevents people to cancel other users' items.
if ($table == 'stock') {
if ($cancel) {
$sql = "SELECT * FROM minecraft_iconomy.stock WHERE uuid='{$uuid}' AND id='{$id}' LIMIT 1;";
} else {
$sql = "SELECT * FROM minecraft_iconomy.stock WHERE id='{$id}' LIMIT 1;";
}
} else {
if ($table == 'deposit') {
$sql = "SELECT * FROM minecraft_iconomy.deposit WHERE (sender_uuid='{$uuid}' OR recipient_uuid='{$uuid}') AND id='{$id}' LIMIT 1;";
}
}
$D = umc_mysql_fetch_all($sql);
if (count($D) == 0) {
umc_error("{red}Id {white}{$id}{red} not found! Please try again.;");
} else {
$row = $D[0];
$item = umc_goods_get_text($row['item_name'], $row['damage'], $row['meta']);
$meta_cmd = $meta = '';
if ($row['meta'] != '') {
$meta_arr = unserialize($row['meta']);
if (!is_array($meta_arr)) {
XMPP_ERROR_trigger("Could not get Meta Data array for {$table} id {$id}: " . var_export($row, true));
}
if ($row['item_name'] == "banner") {
$meta_cmd = umc_banner_get_data($meta_arr);
} else {
foreach ($meta_arr as $type => $lvl) {
$meta_cmd .= " {$type}:{$lvl}";
}
}
}
// handle unlimited items
$unlimited = false;
if ($row['amount'] == -1) {
$row['amount'] = $amount;
$unlimited = true;
}
//umc_echo('There were ' . $row['amount'] . " pieces of " . $item['item_name'] . "$meta_txt stored.");
// determine withdrawal amount
if (is_numeric($amount) && $amount <= $row['amount']) {
$sellamount = $amount;
} else {
if ($amount == 'max') {
// withdraw all
$sellamount = $row['amount'];
//umc_echo("You are withdrawing all ($sellamount) {$item['name']}$meta_txt");
} else {
if (is_numeric($amount) && $amount > $row['amount']) {
umc_echo("{yellow}[!]{gray} Available amount ({yellow}{$row['amount']}{gray}) less than amount specified ({yellow}{$amount}{gray})");
$sellamount = $row['amount'];
} else {
umc_error("{red}Amount {white}'{$amount}'{red} is not numeric;");
}
}
}
if ($table != 'stock') {
umc_echo("{green}[+]{gray} You are withdrawing {yellow} {$amount} {gray} of {$item['full']}{gray}.");
}
if ($table == 'stock') {
$cost = $sellamount * $row['price'];
if ($cancel) {
$target = $uuid;
$source = 'cancel00-sell-0000-0000-000000000000';
} else {
$target = $uuid;
$source = $row['uuid'];
}
} else {
if ($table == 'deposit') {
if ($row['recipient_uuid'] == $uuid) {
$cancel = true;
}
$cost = 0;
if ($cancel) {
//.........这里部分代码省略.........