本文整理汇总了PHP中autoshout函数的典型用法代码示例。如果您正苦于以下问题:PHP autoshout函数的具体用法?PHP autoshout怎么用?PHP autoshout使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了autoshout函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: radioinfo
function radioinfo($radio)
{
global $langs, $INSTALLER09, $mc1, $CURUSER;
$xml = $html = $history = '';
if ($hand = @fsockopen($radio['host'], $radio['port'], $errno, $errstr, 30)) {
fputs($hand, "GET /admin.cgi?pass=" . $radio['password'] . "&mode=viewxml HTTP/1.1\nUser-Agent:Mozilla/5.0 " . "(Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6\n\n");
while (!feof($hand)) {
$xml .= fgets($hand, 1024);
}
preg_match_all('/\\<(SERVERTITLE|SERVERURL|SONGTITLE|STREAMSTATUS|BITRATE|CURRENTLISTENERS|PEAKLISTENERS)\\>(.*?)<\\/\\1\\>/iU', $xml, $tempdata, PREG_SET_ORDER);
foreach ($tempdata as $t2) {
$data[$t2[1]] = isset($langs[$t2[1]]) ? sprintf($langs[$t2[1]], $t2[2]) : $t2[2];
}
unset($tempdata);
preg_match_all('/\\<SONG>(.*?)<\\/SONG\\>/', $xml, $temph);
unset($temph[0][0], $temph[1]);
$history = array();
foreach ($temph[0] as $temph2) {
preg_match_all('/\\<(TITLE|PLAYEDAT)>(.*?)<\\/\\1\\>/i', $temph2, $temph3, PREG_PATTERN_ORDER);
$history[] = '<b> ' . $temph3[2][1] . '</b> <sub>(' . get_date(time(), 'DATE', $temph3[2][0]) . ')</sub>';
}
if ($data['STREAMSTATUS'] == 0) {
return 'Sorry ' . $CURUSER['username'] . '... : Server ' . $radio['host'] . ' is online but there is no stream';
} else {
unset($data['STREAMSTATUS']);
$md5_current_song = md5($data['SONGTITLE']);
$current_song = $mc1->get('current_radio_song');
if ($current_song === false || $current_song != $md5_current_song) {
autoshout(str_replace(array('<', '>'), array('[', ']'), $data['SONGTITLE'] . ' playing on ' . strtolower($data['SERVERTITLE']) . ' - ' . strtolower($data['SERVERURL'])));
$mc1->cache_value('current_radio_song', $md5_current_song, 0);
}
$html = '<fieldset>
<legend>' . $INSTALLER09['site_name'] . ' radio</legend><ul>';
foreach ($data as $d) {
$html .= '<li><b>' . $d . '</b></li>';
}
$html .= '<li>Playlist history: ' . (count($history) > 0 ? join(', ', $history) : 'No playlist history');
$html .= '</li></ul></fieldset>';
return $html;
}
} else {
$html .= '<fieldset><legend>' . $INSTALLER09['site_name'] . ' radio</legend>
<font size="3" color="red"><img src="' . $INSTALLER09['pic_base_url'] . 'off1.gif" alt="Off" title="Off" border="0" /><br />
<b>Sorry ' . $CURUSER['username'] . ' Radio is currently Offline</b></font></fieldset><br />';
}
return $html;
}
示例2: isset
$descrmain = isset($_POST['body']) ? $_POST['body'] : '';
if (!$descrmain) {
stderr("{$lang['error_error']}", "{$lang['error_descr']}");
}
$pic = '';
if (!empty($_POST['picture'])) {
if (!preg_match('/^https?:\\/\\/([a-zA-Z0-9\\-\\_]+\\.)+([a-zA-Z]{1,5}[^\\.])(\\/[^<>]+)+\\.(jpg|jpeg|gif|png|tif|tiff|bmp)$/i', $_POST['picture'])) {
stderr("{$lang['error_error']}", "{$lang['error_image']}");
}
$picture = $_POST['picture'];
// $picture2 = trim(urldecode($_POST['picture']));
// $headers = get_headers($picture2);
// if (strpos($headers[0], '200') === false)
// $picture = $INSTALLER09['baseurl'].'/pic/notfound.png';
$pic = "[img]" . $picture . "[/img]\n";
}
$descr = "{$pic}";
$descr .= "{$descrmain}";
$request2 = sqlesc($request);
$descr = sqlesc($descr);
sql_query("INSERT INTO requests (hits, userid, cat, request, descr, added) VALUES(1,{$CURUSER['id']}, {$cat}, {$request2}, {$descr}, " . TIME_NOW . ")") or sqlerr(__FILE__, __LINE__);
$id = mysql_insert_id();
sql_query("INSERT INTO voted_requests VALUES(0, {$id}, {$CURUSER['id']})") or sqlerr();
if ($INSTALLER09['karma'] && isset($CURUSER['seedbonus'])) {
sql_query("UPDATE users SET seedbonus = seedbonus-" . $INSTALLER09['req_cost_bonus'] . " WHERE id = {$CURUSER['id']}") or sqlerr(__FILE__, __LINE__);
}
write_log("Request (" . $request . ") was added to the Request section by {$CURUSER['username']}");
/** Shout announce **/
$message = " [b][color=blue]New request[/color][/b] [url={$INSTALLER09['baseurl']}/viewrequests.php?id={$id}&req_details] " . $request . "[/url] ";
autoshout($message);
header("Refresh: 0; url=viewrequests.php?id={$id}&req_details");
示例3: autoshout
$msg = $CURUSER['username'] . " Donated " . $donation . " karma point" . ($donation > 1 ? 's' : '') . " into the half download contribution pot and has activated half download for 3 days " . $donation . "/" . $points . '';
autoshout($msg);
header("Refresh: 0; url={$INSTALLER09['baseurl']}/mybonus.php?halfdown_success=1&norefund={$norefund}");
die;
} else {
// add to the pool
$sql = "UPDATE bonus SET pointspool = pointspool + '{$donation}' WHERE id = '13' LIMIT 1";
sql_query($sql) or sqlerr(__FILE__, __LINE__);
$bonuscomment = get_date(time(), 'DATE', 1) . " - " . $points . " Points contributed for halfdownload.\n " . $bonuscomment;
sql_query("UPDATE users SET seedbonus = " . sqlesc($seedbonus) . ", bonuscomment = " . sqlesc($bonuscomment) . " WHERE id = " . sqlesc($userid) . "") or sqlerr(__FILE__, __LINE__);
$mc1->delete_value('MyUser_' . $CURUSER['id']);
$mc1->delete_value('user' . $CURUSER['id']);
write_bonus_log($CURUSER["id"], $donation, $type = "halfdownload");
$Remaining = $points - $donation;
$msg = $CURUSER['username'] . " Donated " . $donation . " karma point" . ($donation > 1 ? 's' : '') . " into the half download contribution pot ! * Only [b]" . $Remaining . "[/b] more karma point" . ($Remaining > 1 ? 's' : '') . " to go! * [color=green][b]Half download contribution:[/b][/color] [url={$INSTALLER09['baseurl']}/mybonus.php]" . $donation . "/" . $points . '[/url]';
autoshout($msg);
header("Refresh: 0; url={$INSTALLER09['baseurl']}/mybonus.php?halfdown_success=2");
die;
}
die;
break;
case 'ratio':
//=== trade for one torrent 1:1 ratio
$torrent_number = 0 + $_POST['torrent_id'];
$res_snatched = sql_query("SELECT s.uploaded, s.downloaded, t.name FROM snatched AS s LEFT JOIN torrents AS t ON t.id = s.torrentid WHERE s.userid = '{$userid}' AND torrentid = " . sqlesc($torrent_number) . " LIMIT 1") or sqlerr(__FILE__, __LINE__);
$arr_snatched = mysql_fetch_assoc($res_snatched);
if ($arr_snatched['name'] == '') {
stderr("Error", "No torrent with that ID!<br />Back to your <a class='altlink' href='{$INSTALLER09['baseurl']}/mybonus.php'>Karma Bonus Point</a> page.");
}
if ($arr_snatched['uploaded'] >= $arr_snatched['downloaded']) {
stderr("Error", "Your ratio on that torrent is fine, you must have selected the wrong torrent ID.<br />Back to your <a class='altlink' href='{$INSTALLER09['baseurl']}/mybonus.php'>Karma Bonus Point</a> page.");
示例4: dos2slowcleanup
//.........这里部分代码省略.........
$length = 3 * 7;
// Give 3 weeks to let them sort there shit
$res = sql_query("SELECT id FROM users WHERE class >= 0 AND leechwarn = 'no' AND uploaded / downloaded < {$minratio} AND downloaded >= {$downloaded}") or sqlerr(__FILE__, __LINE__);
$msgs_buffer = $users_buffer = array();
if (mysql_num_rows($res) > 0) {
$dt = sqlesc(get_date_time());
$msg = "You have been warned and your download rights have been removed due to your low ratio. You need to get a ratio of 0.7 within the next 3 weeks or your downloads will remain disabled.";
$leechwarnuntil = sqlesc(get_date_time(gmtime() + $length * 86400));
while ($arr = mysql_fetch_assoc($res)) {
$modcomment = sqlesc(gmdate("Y-m-d H:i") . " - Automatically Leech warned and downloads disabled By System\n");
$msgs_buffer[] = '(0,' . $arr['id'] . ',NOW(), ' . sqlesc($msg) . ', \'Auto Leech Warn\')';
$users_buffer[] = '(' . $arr['id'] . ',\'yes\',' . $leechwarnuntil . ',\'no\', ' . $modcomment . ')';
}
if (sizeof($msgs_buffer) > 0) {
sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
sql_query("INSERT INTO users (id, leechwarn, leechwarnuntil, downloadpos, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE leechwarn=values(leechwarn),\nleechwarnuntil=values(leechwarnuntil),downloadpos=values(downloadpos),modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
$count = mysql_affected_rows();
write_log("autowarn", "Delayed Cleanup: System applied auto leech Warning(s) to " . $count / 2 . " Member(s)");
}
unset($users_buffer);
unset($msgs_buffer);
}
// //////////////////////////////////////////////////
// ==Modified autoleech warn system - Remove warning and enable downloads
$minratio = 0.7;
// ratio > 0.7
$res = sql_query("SELECT id FROM users WHERE downloadpos = 'no' AND leechwarn = 'yes' AND uploaded / downloaded >= {$minratio}") or sqlerr(__FILE__, __LINE__);
$msgs_buffer = $users_buffer = array();
if (mysql_num_rows($res) > 0) {
$msg = "Your warning for a low ratio has been removed and your downloads enabled. We highly recommend you to keep your ratio positive to avoid being automatically warned again.\n";
while ($arr = mysql_fetch_assoc($res)) {
$modcomment = sqlesc(gmdate("Y-m-d H:i") . " - Leech warn removed and download enabled By System\n");
$msgs_buffer[] = '(0,' . $arr['id'] . ',NOW(), ' . sqlesc($msg) . ', \'Auto leech warn removal and download\')';
$users_buffer[] = '(' . $arr['id'] . ',\'no\',\'0000-00-00 00:00:00\',\'yes\', ' . $modcomment . ')';
}
if (sizeof($msgs_buffer) > 0) {
sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
sql_query("INSERT INTO users (id, leechwarn, leechwarnuntil, downloadpos, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE leechwarn=values(leechwarn),\nleechwarnuntil=values(leechwarnuntil),downloadpos=values(downloadpos),modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
$count = mysql_affected_rows();
write_log("autodewarn", "Delayed Cleanup: System removed auto leech Warning(s) and renabled download(s) - " . $count / 2 . " Member(s)");
}
unset($users_buffer);
unset($msgs_buffer);
}
// ///////////Delete old pms////////////
$secs = 15 * 86400;
//change this to fit your needs
$dt = sqlesc(get_date_time(gmtime() - $secs));
sql_query("DELETE FROM messages WHERE added < {$dt}");
// //////////////////////////
$secs = 28 * 86400;
//change this to fit your needs
$dt = sqlesc(get_date_time(gmtime() - $secs));
sql_query("DELETE FROM iplog WHERE access < {$dt}");
// delete from shoutbox after 2 days
$secs = 2 * 86400;
$dt = sqlesc(get_date_time(gmtime() - $secs));
sql_query("DELETE FROM shoutbox WHERE " . time() . " - date > {$secs}") or sqlerr(__FILE__, __LINE__);
// Delete Orphaned announcement_processors
sql_query("DELETE announcement_process FROM announcement_process LEFT JOIN users ON announcement_process.user_id = users.id WHERE users.id IS NULL");
// Delete expired announcements and processors
sql_query("DELETE FROM announcement_main WHERE expires < " . sqlesc(get_date_time()));
sql_query("DELETE announcement_process FROM announcement_process LEFT JOIN announcement_main ON announcement_process.main_id = announcement_main.main_id WHERE announcement_main.main_id IS NULL");
// //////auto-delete old torrents////////
if ($oldtorrents) {
$dt = sqlesc(get_date_time(gmtime() - $torrent_ttl));
$days = 2;
$days_la = 7;
$dt_la = sqlesc(get_date_time(gmtime() - $days_la * 86400));
$res = sql_query("SELECT id, name FROM torrents WHERE added < {$dt} AND seeders=0 AND leechers=0 AND last_action < {$dt_la} ");
if (mysql_num_rows($res) > 0) {
$deadcount = mysql_num_rows($res);
while ($arr = mysql_fetch_assoc($res)) {
$ids[] = $arr['id'];
$names[] = $arr['name'];
}
@unlink("{$torrent_dir}/" . join(',', $ids) . ".torrent");
sql_query("DELETE FROM torrents WHERE id IN (" . join(',', $ids) . ")");
sql_query("DELETE FROM peers WHERE torrent IN (" . join(',', $ids) . ")");
sql_query("DELETE FROM snatched WHERE torrent IN (" . join(',', $ids) . ")");
sql_query("DELETE FROM comments WHERE torrent IN (" . join(',', $ids) . ")");
sql_query("DELETE FROM files WHERE torrent IN (" . join(',', $ids) . ")");
write_log("torrentdelete", $deadcount . " Torrents (" . join(',', $ids) . ") (" . join(', ', $names) . ") were deleted by system (older than {$days} days and no seeders or leechers in 7 day's)");
//==autoshout - comment out if not required
$message = $deadcount . " Torrents (" . join(',', $ids) . ") (" . join(', ', $names) . ")) were deleted by system (older than {$days} days and no seeders or leechers in 7 day's)";
autoshout($message);
}
}
// lock topics where last post was made more than x days ago
$res = mysql_query("SELECT topics.id FROM topics LEFT JOIN posts ON topics.lastpost = posts.id AND topics.sticky = 'no' WHERE " . gmtime() . " - UNIX_TIMESTAMP(posts.added) > {$max_dead_topic_time}") or sqlerr(__FILE__, __LINE__);
while ($arr = mysql_fetch_assoc($res)) {
mysql_query("UPDATE topics SET locked='yes' WHERE id={$arr['id']}") or sqlerr(__FILE__, __LINE__);
}
// / freeslots
$dt = sqlesc(get_date_time(gmtime() - $slotduration * 86400));
sql_query("UPDATE freeslots SET doubleup = 'no' WHERE addedup<{$dt}") or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE freeslots SET free = 'no' WHERE addedfree<{$dt}") or sqlerr(__FILE__, __LINE__);
sql_query("DELETE FROM freeslots WHERE doubleup = 'no' AND free = 'no'") or sqlerr(__FILE__, __LINE__);
write_log("slowautoclean", " -------------------- Delayed cleanup stage 2 Complete using {$queries} queries --------------------");
}
示例5: userlogin
//.........这里部分代码省略.........
$row['passhint'] = (int) $row['passhint'];
$row['avatarpos'] = (int) $row['avatarpos'];
$row['sendpmpos'] = (int) $row['sendpmpos'];
$row['invitedate'] = (int) $row['invitedate'];
$row['anonymous_until'] = (int) $row['anonymous_until'];
$row['pirate'] = (int) $row['pirate'];
$row['king'] = (int) $row['king'];
$row['ssluse'] = (int) $row['ssluse'];
$row['paranoia'] = (int) $row['paranoia'];
$row['parked_until'] = (int) $row['parked_until'];
$row['bjwins'] = (int) $row['bjwins'];
$row['bjlosses'] = (int) $row['bjlosses'];
$row['irctotal'] = (int) $row['irctotal'];
$row['last_access_numb'] = (int) $row['last_access_numb'];
$row['onlinetime'] = (int) $row['onlinetime'];
$ratio = $row['downloaded'] > 0 ? $row['uploaded'] / $row['downloaded'] : 0;
$row['ratio'] = number_format($ratio, 2);
$row['rep'] = get_reputation($row);
$mc1->cache_value('MyUser_' . $id, $row, $INSTALLER09['expires']['curuser']);
// set $Cache
unset($res);
}
if (get_mycookie('pass') !== md5($row["passhash"] . $_SERVER["REMOTE_ADDR"])) {
return;
}
//==Allowed staff
if ($row["class"] >= UC_STAFF) {
$allowed_ID = $INSTALLER09['allowed_staff']['id'];
if (!in_array((int) $row["id"], $allowed_ID, true)) {
$msg = "Fake Account Detected: Username: " . $row["username"] . " - UserID: " . $row["id"] . " - UserIP : " . getip();
/** Demote and disable **/
sql_query("UPDATE users SET enabled = 'no', class = 0 WHERE id =" . sqlesc($row["id"]) . "") or sqlerr(__FILE__, __LINE__);
write_log($msg);
autoshout($msg);
logoutcookie();
}
}
// If curr_ann_id > 0 but curr_ann_body IS NULL, then force a refresh
if ($row['curr_ann_id'] > 0 and $row['curr_ann_body'] == NULL) {
$row['curr_ann_id'] = 0;
$row['curr_ann_last_check'] = '0';
}
// If elapsed > 10 minutes, force a announcement refresh.
if ($row['curr_ann_last_check'] != '0' and $row['curr_ann_last_check'] < time($dt) - 600) {
$row['curr_ann_last_check'] = '0';
}
if ($row['curr_ann_id'] == 0 and $row['curr_ann_last_check'] == '0') {
// Force an immediate check...
$query = sprintf('SELECT m.*,p.process_id FROM announcement_main AS m ' . 'LEFT JOIN announcement_process AS p ON m.main_id = p.main_id ' . 'AND p.user_id = %s ' . 'WHERE p.process_id IS NULL ' . 'OR p.status = 0 ' . 'ORDER BY m.main_id ASC ' . 'LIMIT 1', sqlesc($row['id']));
$result = sql_query($query);
if (mysql_num_rows($result)) {
// Main Result set exists
$ann_row = mysql_fetch_assoc($result);
$query = $ann_row['sql_query'];
// Ensure it only selects...
if (!preg_match('/\\ASELECT.+?FROM.+?WHERE.+?\\z/', $query)) {
die;
}
// The following line modifies the query to only return the current user
// row if the existing query matches any attributes.
$query .= ' AND u.id = ' . sqlesc($row['id']) . ' LIMIT 1';
$result = sql_query($query);
if (mysql_num_rows($result)) {
// Announcement valid for member
$row['curr_ann_id'] = $ann_row['main_id'];
// Create two row elements to hold announcement subject and body.