本文整理汇总了PHP中misc类的典型用法代码示例。如果您正苦于以下问题:PHP misc类的具体用法?PHP misc怎么用?PHP misc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了misc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: report
function report($id, $name, $down, $up, $rank, $first, $last)
{
if ($down > 0) {
$ratio = substr($up / $down, 0, 5);
} else {
$ratio = "∞";
}
if ($down > $up) {
$diff = "<b><font color='red'>↓ " . misc::makesize($down - $up) . "</font></b>";
} elseif ($up > $down) {
$diff = "<b><font color='blue'>↑ " . misc::makesize($up - $down) . "</font></b>";
} else {
$diff = "<b><font color='cyan'>0</font></b>";
}
print "\n<tr>\n<td class='lista' align='center'><b><font color='blue'>" . $id . "</font></b></td>";
print "\n<td class='lista' align='center'><b><font color='lavender'><a href='userdetails.php?id=" . $id . "'>" . $name . "</a></font></b></td>";
print "\n<td class='lista' align='center'><b><font color='red'>↓ " . misc::makesize($down) . "</b></font></td>";
print "\n<td class='lista' align='center'><b><font color='green'>↑ " . misc::makesize($up) . "</b></font></td>";
print "\n<td class='lista' align='center'><b>" . $ratio . "</b></td>";
print "\n<td class='lista' align='center'><b>" . $rank . "</b></td>";
print "\n<td class='lista' align='center'><b>" . $diff . "</b></td>";
print "\n<td class='lista' align='center'><b>" . date("d/m/Y H:i:s", $first) . "</b></td>";
print "\n<td class='lista' align='center'><b>" . date("d/m/Y H:i:s", $last) . "</b></td>";
print "\n<td class='lista' align='center'><b><a href='account.php?act=mod&uid=" . $id . "&returnto=admincp.php?user=" . user::$current["uid"] . "&code=" . user::$current["random"] . "&do=searchdiff'><img src='./style/base/edit.png' border='0' alt='Edit'/></b></td>";
print "\n<td class='lista' align='center'><b><a href='account.php?act=del&uid=" . $id . "&returnto=admincp.php?user=" . user::$current["uid"] . "&code=" . user::$current["random"] . "&do=searchdiff'><img src='./style/base/delete.png' border='0' alt='Delete'/></b></td>";
print "\n<td class='lista' align='center'><input type='checkbox' name='uyedegis[]' value='" . $id . "' /></td>\n</tr>";
}
示例2: verifyTiezi_send
function verifyTiezi_send($uid, $tid, $pid, $water = 'StusGame Tieba Cloud Sign Plugin "verifyTiezi"', $device = 4)
{
if (empty($uid) || empty($tid) || empty($pid)) {
return array('status' => '1', 'msg' => '');
}
$ck = misc::GetCookie($pid);
$xs = verifyTiezi_gettie($tid, $ck);
$x = array('BDUSS' => $ck, '_client_id' => 'wappc_136' . rand_int(10) . '_' . rand_int(3), '_client_type' => $device, '_client_version' => '5.0.0', '_phone_imei' => md5(rand_int(16)), 'anonymous' => '0', 'content' => $water, 'fid' => $xs['fid'], 'kw' => $xs['word'], 'net_type' => '3', 'tbs' => $xs['tbs'], 'tid' => $tid, 'title' => '');
$y = '';
foreach ($x as $key => $value) {
$y .= $key . '=' . $value;
}
$x['sign'] = strtoupper(md5($y . 'tiebaclient!!!'));
$c = new wcurl('http://c.tieba.baidu.com/c/c/post/add', array('Content-Type: application/x-www-form-urlencoded'));
/* //Note:普通的
$x = verifyTiezi_gettie($tid,$ck);
$c = new wcurl('http://tieba.baidu.com'.$x['__formurl']);
unset($x['__formurl']);
$x['co'] = $water;
*/
$c->addcookie('BDUSS=' . $ck);
$return = json_decode($c->post($x), true);
$c->close();
if (!empty($return['error_code']) && $return['error_code'] != '1') {
return array('status' => $return['error_code'], 'msg' => $return['error_msg']);
} else {
return array('status' => '1', 'msg' => '');
}
}
示例3: FlashCounterViewDataSet
function FlashCounterViewDataSet($DATA)
{
global $blog, $service;
requireComponent('Textcube.Function.misc');
$cfg = misc::fetchConfigVal($DATA);
if (!isset($blog['blogLanguage'])) {
$blog['blogLanguage'] = $service['language'];
}
// Locale language file support.
switch ($blog['blogLanguage']) {
case "zh-TW":
$retval = 'Flash 計數器尺寸 "205x85" 僅適用於黑色底色設定。';
break;
case "zh-CN":
$retval = 'Flash 计数器尺寸 "205x85" 仅适用于黑色底色设定。';
break;
default:
$retval = "플래쉬카운터 '205x85' 크기는 검정색만 설정가능합니다.";
}
if ($cfg['flashsize'] == '205') {
if ($cfg['flashcolor'] == 'white') {
return $retval;
}
}
return true;
}
示例4: add
public function add()
{
global $db;
$recipient = new user();
if ($recipient->get('name', $this->data['recipient']) == 'done') {
$sender = new user();
if ($sender->get('name', $this->data['sender']) == 'done') {
if (!$sender->isBlocked($recipient->data['id'])) {
$this->data['id'] = misc::newId('messages');
$sent = strftime('%Y-%m-%d %H:%M:%S', time());
$db->query('insert into messages (id, sender, recipient, subject, body, sent, viewed) values ("' . $this->data['id'] . '", "' . $sender->data['id'] . '", "' . $recipient->data['id'] . '", "' . $this->data['subject'] . '", "' . $this->data['body'] . '", "' . $sent . '", "' . $this->data['viewed'] . '")');
if ($db->affected_rows() > -1) {
$status = 'done';
} else {
$status = 'error';
}
} else {
$status = 'blocked';
}
} else {
$status = 'noSender';
}
} else {
$status = 'noRecipient';
}
return $status;
}
示例5: EntriesWithTags_DataSet
function EntriesWithTags_DataSet($data)
{
requireComponent('Textcube.Function.misc');
$cfg = misc::fetchConfigVal($data);
if (!$cfg['entries'] || empty($cfg['entries']) || intval($cfg['entries'] <= 0)) {
$cfg['entries'] = 5;
}
return true;
}
示例6: cron_system_sign_retry
/**
* 云签到内部计划任务
* [重新尝试签到出错的贴吧]
*/
function cron_system_sign_retry()
{
global $i;
$today = date('Y-m-d');
$sign_again = unserialize(option::get('cron_sign_again'));
if ($sign_again['lastdo'] != $today) {
option::set('cron_sign_again', serialize(array('num' => 0, 'lastdo' => $today)));
}
foreach ($i['table'] as $value) {
misc::DoSign_retry($value);
}
}
示例7: cron_signtz_mail
function cron_signtz_mail()
{
global $m;
$today = date("Y-m-d");
$lastday = option::get('haotian_mail');
if ((time() - 1396281600) % 86400 < 21600) {
return '未到发送邮件时间';
}
if ($today != $lastday) {
option::set('haotian_mail', $today);
} else {
return '今日任务已经执行完毕';
}
$query = $m->query("SELECT * FROM `" . DB_NAME . "`.`" . DB_PREFIX . "users`");
while ($fetch = $m->fetch_array($query)) {
$mail = $fetch['email'];
$name = $fetch['name'];
$id = $fetch['id'];
if (option::uget('haotian_mail_enable', $id) == 1) {
$title = "[" . date("Y-m-d") . "] " . SYSTEM_NAME . " - {$name} - 签到报告";
$query2 = $m->query("SELECT * FROM `" . DB_NAME . "`.`" . DB_PREFIX . "tieba` WHERE `uid`={$id}");
$c = 0;
$content = '<p class="sign_title">' . SYSTEM_NAME . ' - 签到报告</p><p>' . date("Y-m-d") . '<br>站点地址:<a href="' . SYSTEM_URL . '">' . SYSTEM_URL . '</a>' . '<br>若有大量贴吧签到失败,建议您重新设置 Cookie 相关信息</p><table class="result_table"><thead><tr><td style="width: 40px">#</td><td>贴吧</td><td style="width: 75px">状态</td><td style="width: 75px">经验</td></tr></thead><tbody>';
while ($ff = $m->fetch_array($query2)) {
$c++;
$tie8 = $ff['tieba'];
$status = $ff['status'];
$content .= "<tr><td>{$c}</td><td><a href=" . '"http://tieba.baidu.com/f?kw=' . urlencode($tie8) . '" target="_blank">' . $tie8 . '</a>' . "</td>";
if ($status == 0) {
$content .= "<td>已签到</td><td>+8</td>";
} else {
$content .= "<td>签到失败</td><td>-</td>";
}
$content .= "</tr>";
}
$content .= "</tbody></table>";
$content = '<style type="text/css">div.wrapper * { font: 12px "Microsoft YaHei", arial, helvetica, sans-serif; word-break: break-all; }div.wrapper a { color: #15c; text-decoration: none; }div.wrapper a:active { color: #d14836; }div.wrapper a:hover { text-decoration: underline; }div.wrapper p { line-height: 20px; margin: 0 0 .5em; text-align: center; }div.wrapper .sign_title { font-size: 20px; line-height: 24px; }div.wrapper .result_table { width: 85%; margin: 0 auto; border-spacing: 0; border-collapse: collapse; }div.wrapper .result_table td { padding: 10px 5px; text-align: center; border: 1px solid #dedede; }div.wrapper .result_table tr { background: #d5d5d5; }div.wrapper .result_table tbody tr { background: #efefef; }div.wrapper .result_table tbody tr:nth-child(odd) { background: #fafafa; }</style><div class="wrapper">' . $content . '</div><br><p style="font-size: 12px; color: #9f9f9f; text-align: right; border-top: 1px solid #dedede; padding: 20px 10px 0; margin-top: 25px;">此封邮件来自 百度贴吧云签到<br>Haotian Mail API v0.1, 2014 © <a href="http://ihaotian.me/">Haotian\'s Laboratory</a>.</p>';
if ($c == 0) {
continue;
}
$x = misc::mail($mail, $title, $content);
if ($x != true) {
return '发送失败,错误日志:' . $x;
}
}
}
return '邮件发送成功!';
}
示例8: cron_pch18_relist
function cron_pch18_relist()
{
global $m;
$query = $m->query("SELECT DISTINCT id,uid FROM `" . DB_PREFIX . "baiduid` ");
while ($fetch = $m->fetch_array($query)) {
$id = $fetch['id'];
$uid = $fetch['uid'];
$isqd_query = $m->query("SELECT * FROM `" . DB_PREFIX . "pch18_relist` where id=" . $id . " and lastdate='" . date("Y-m-d") . "'");
$isqd_fetch = $m->fetch_array($isqd_query);
$setqd = option::uget('pch18_relist_enable', $uid);
if (!empty($setqd)) {
//user表里面开启签到功能
$r = misc::scanTiebaByPid($id);
//更新列表函数
$m->query("REPLACE INTO `" . DB_NAME . "`.`" . DB_PREFIX . "pch18_relist` SET `lastdate` = '" . date("Y-m-d") . "', id = " . $id);
}
}
}
示例9: sendMail
/**
* 变量名称
* @param $verifyKey 发送邮件中的key,用于验证用户身份是否与$verifyCode匹配
* @param $query SQL查询语句
* @param $url 验证链接地址
* @param $verifyCode 验证码
* @param $pluginName 插件名
*/
function sendMail($userMail, $uid)
{
global $m;
global $today;
$pluginName = 'white_vmail';
// 获取8位数的随机验证码并加密
$verifyCode = rand_int(8);
$verifyKey = sha1(md5($verifyCode));
$url = SYSTEM_URL . '?plugin=' . $pluginName . '&key=' . $verifyKey;
$title = '邮箱验证 -- ' . SYSTEM_NAME;
$text = '亲爱的用户:<br><br>您好!<br><br>这是来自学园百度贴吧云签到平台的验证邮件,用来验证您的用户邮箱。<br><br>请登录学园百度贴吧云签到平台后点击该链接,以便验证你的邮箱。<br><br>提示:必须登录后点击!必须登录后点击!必须登录后点击! 否则无法验证!谢谢合作!<br><br>系统将会自动清除注册一定时间后没验证邮箱的用户!<hr/>验证链接:' . $url . '<br>(如果您无法点击此链接,请将它复制到浏览器地址栏后访问)<br><br><br>' . SYSTEM_NAME . '<br><br>(本邮件为系统自动发送,请勿回复)';
$mailResult = misc::mail($userMail, $title, $text);
if ($mailResult != TRUE) {
msg("向" . $userMail . "发送邮件失败。");
}
$m->query("UPDATE " . DB_PREFIX . "users SET white_vmail_send = 1, white_vmail_code = " . $verifyCode . " WHERE id = " . $uid);
Redirect(SYSTEM_URL . "index.php?mod=admin:setplug&plug=white_vmail");
}
示例10: add
public function add($nodeId)
{
global $db, $game;
$alliance = new alliance();
if ($alliance->get('name', $this->data['name']) == 'noAlliance') {
$node = new node();
if ($node->get('id', $nodeId) == 'done') {
$node->checkResources(time());
$addCost = $game['factions'][$node->data['faction']]['costs']['alliance'];
$addCostData = $node->checkCost($addCost, 'alliance');
if ($addCostData['ok']) {
$ok = 1;
foreach ($addCost as $cost) {
$node->resources[$cost['resource']]['value'] -= $cost['value'] * $game['users']['cost']['alliance'];
$db->query('update resources set value="' . $node->resources[$cost['resource']]['value'] . '" where node="' . $node->data['id'] . '" and id="' . $cost['resource'] . '"');
if ($db->affected_rows() == -1) {
$ok = 0;
}
}
$this->data['id'] = misc::newId('alliances');
$db->query('insert into alliances (id, user, name) values ("' . $this->data['id'] . '", "' . $node->data['user'] . '", "' . $this->data['name'] . '")');
if ($db->affected_rows() == -1) {
$ok = 0;
}
$db->query('update users set alliance="' . $this->data['id'] . '" where id="' . $this->data['user'] . '"');
if ($db->affected_rows() == -1) {
$ok = 0;
}
if ($ok) {
$status = 'done';
} else {
$status = 'error';
}
} else {
$status = 'notEnoughResources';
}
} else {
$status = 'noNode';
}
} else {
$status = 'nameTaken';
}
return $status;
}
示例11: display
function display()
{
global $conn, $config, $lang;
require_once $config['basepath'] . '/include/misc.inc.php';
$misc = new misc();
// Make Sure we passed the PageID
$display = '';
if (!isset($_GET['PageID'])) {
$display .= "ERROR. PageID not sent";
}
$page_id = $misc->make_db_safe($_GET['PageID']);
$display .= '<div class="page_display">';
$sql = "SELECT pagesmain_full,pagesmain_id FROM " . $config['table_prefix'] . "pagesmain WHERE pagesmain_id=" . $page_id;
$recordSet = $conn->Execute($sql);
if ($recordSet === false) {
$misc->log_error($sql);
}
$full = html_entity_decode($misc->make_db_unsafe($recordSet->fields['pagesmain_full']), ENT_NOQUOTES, $config['charset']);
//$full = $misc->make_db_unsafe($recordSet->fields['pagesmain_full']);
$id = $recordSet->fields['pagesmain_id'];
if ($config["wysiwyg_execute_php"] == 1) {
ob_start();
$full = str_replace("<!--<?php", "<?php", $full);
$full = str_replace("?>-->", "?>", $full);
eval('?>' . "{$full}" . '<?php ');
$display .= ob_get_contents();
ob_end_clean();
} else {
$display .= $full;
}
// Allow Admin To Edit #
if (isset($_SESSION['editpages']) && $_SESSION['admin_privs'] == 'yes' && $config["wysiwyg_show_edit"] == 1) {
$display .= "<p> </p>";
$display .= "<a href=\"{$config['baseurl']}/admin/index.php?action=edit_page&id={$id}\">{$lang['edit_html_from_site']}</a>";
}
$display .= '</div>';
// parse page for template varibales
require_once $config['basepath'] . '/include/class/template/core.inc.php';
$template = new page_user();
$template->page = $display;
$template->replace_tags(array('templated_search_form', 'featured_listings_horizontal', 'featured_listings_vertical', 'company_name', 'link_printer_friendly'));
$display = $template->return_page();
return $display;
}
示例12: cron_wmzz_zan
function cron_wmzz_zan()
{
require_once SYSTEM_ROOT . '/plugins/Cloud_Click/zan.php';
$set = unserialize(option::get('plugin_Cloud_Click'));
$today = date('Y-m-d');
global $m;
//准备:扫描wmzz_zan表中lastdo不是今天的,然后更新wmzz_zan_data表的remain
$sy = $m->query("SELECT * FROM `" . DB_PREFIX . "wmzz_zan` WHERE `lastdo` != '{$today}';");
while ($sx = $m->fetch_array($sy)) {
$m->query('UPDATE `' . DB_NAME . '`.`' . DB_PREFIX . 'wmzz_zan_data` SET `remain` = \'' . $sx['num'] . '\' WHERE `uid` = ' . $sx['uid']);
$m->query('UPDATE `' . DB_NAME . '`.`' . DB_PREFIX . 'wmzz_zan` SET `lastdo` = \'' . $today . '\' WHERE `uid` = ' . $sx['uid']);
}
//开始:计划任务
$count = $m->once_fetch_array("SELECT COUNT(*) AS `c` FROM `" . DB_PREFIX . "wmzz_zan_data` WHERE `remain` > '0' LIMIT {$set['rem']};");
if ($count['c'] == $set['rem']) {
$y = rand_row(DB_PREFIX . 'wmzz_zan_data', 'id', $set['rem'], "`remain` > '0'");
} else {
$y = rand_row(DB_PREFIX . 'wmzz_zan_data', 'id', $count['c'], "`remain` > '0'");
}
//如果只有一条记录的兼容方案
if (isset($y['tieba'])) {
$y = array(0 => $y);
}
//点赞
foreach ($y as $x) {
if (!empty($x['pid'])) {
$remain = $x['remain'] - $set['num'];
$res = wmzz_zan_donow(misc::GetCookie($x['pid']), $x['tieba'], $set['num']);
$m->query('UPDATE `' . DB_NAME . '`.`' . DB_PREFIX . 'wmzz_zan_data` SET `remain` = \'' . $remain . '\' WHERE `tieba` = \'' . $x['tieba'] . '\' AND `uid` = ' . $x['uid']);
sleep($set['sleep']);
}
}
/*
while ($v = $m->fetch_array($x)) {
$u = $m->once_fetch_array("SELECT * FROM `".DB_NAME."`.`".DB_PREFIX."users` WHERE `id` = '{$v['uid']}' LIMIT 1");
$variable = unserialize($v['tieba']);
foreach ($variable as $value) {
wmzz_zan_get_list($u['ck_bduss'],$value['tieba'],$s['sleep'],$v['max'],$s['sp']);
}
$m->query("UPDATE `".DB_NAME."`.`".DB_PREFIX."wmzz_zan` SET `lastdo` = '".$today."' WHERE `id` = ".$v['id']);
}
*/
}
示例13: add
public function add()
{
global $db, $game;
$user = new user();
if ($user->get('name', $this->data['name']) == 'noUser') {
if ($user->get('email', $this->data['email']) == 'noUser') {
if (!blacklist::check('ip', $this->data['ip'])) {
if (!blacklist::check('email', $this->data['email'])) {
$ok = 1;
$this->data['id'] = misc::newId('users');
$db->query('insert into users (id, name, password, email, level, joined, lastVisit, ip, template, locale) values ("' . $this->data['id'] . '", "' . $this->data['name'] . '", "' . $this->data['password'] . '", "' . $this->data['email'] . '", "' . $this->data['level'] . '", "' . $this->data['joined'] . '", "' . $this->data['lastVisit'] . '", "' . $this->data['ip'] . '", "' . $this->data['template'] . '", "' . $this->data['locale'] . '")');
if ($db->affected_rows() == -1) {
$ok = 0;
}
$preferences = array();
foreach ($game['users']['preferences'] as $key => $preference) {
$preferences[] = '("' . $this->data['id'] . '", "' . $key . '", "' . $preference . '")';
}
$preferences = implode(', ', $preferences);
$db->query('insert into preferences (user, name, value) values ' . $preferences);
if ($db->affected_rows() == -1) {
$ok = 0;
}
if ($ok) {
$status = 'done';
} else {
$status = 'error';
}
} else {
$status = 'emailBanned';
}
} else {
$status = 'ipBanned';
}
} else {
$status = 'emailInUse';
}
} else {
$status = 'nameTaken';
}
return $status;
}
示例14: cron_wmzz_ban
function cron_wmzz_ban()
{
global $m;
$s = unserialize(option::get('plugin_wmzz_ban'));
$now = strtotime(date('Y-m-d'));
$y = $m->query("SELECT * FROM `" . DB_PREFIX . "wmzz_ban` WHERE `nextdo` <= '{$now}' LIMIT {$s['limit']}");
while ($x = $m->fetch_array($y)) {
$r = wmzz_ban_getTime($x['date']);
if ($r != '-1') {
$bduss = misc::getCookie($x['pid']);
$c = new wcurl('http://tieba.baidu.com/pmc/blockid');
$c->addcookie('BDUSS=' . $bduss);
$c->post(array('user_name[]' => $x['user'], 'day' => $r, 'fid' => misc::getFid($x['tieba']), 'tbs' => misc::getTbs($x['uid'], $bduss), 'ie' => 'utf-8', 'reason' => $s['msg']));
$next = $now + $r * 86400;
$m->query("UPDATE `" . DB_PREFIX . "wmzz_ban` SET `nextdo` = '{$next}' WHERE `id` = '{$x['id']}'");
} else {
$m->query("DELETE FROM `" . DB_PREFIX . "wmzz_ban` WHERE `id` = '{$x['id']}'");
}
}
}
示例15: editAction
public function editAction()
{
$id = intval($this->getRequest()->getQuery('id'));
if ($this->getRequest()->isPost()) {
$value = ['username' => core::safe_str($this->getRequest()->getPost('username')), 'name' => core::safe_str($this->getRequest()->getPost('name')), 'nickname' => core::safe_str($this->getRequest()->getPost('nickname')), 'gender' => intval($this->getRequest()->getPost('gender')), 'phone' => core::safe_str($this->getRequest()->getPost('phone')), 'email' => core::is_email($this->getRequest()->getPost('email')) ? $this->getRequest()->getPost('email') : NULL, 'status' => intval($this->getRequest()->getPost('status')), 'birthday' => misc::is_date($this->getRequest()->getPost('birthday'), '-') ? strtotime($this->getRequest()->getPost('birthday')) : NULL];
if ($this->member->update($value, ['id' => intval($this->getRequest()->getPost('id'))])) {
Alert::success('更新成功!');
} else {
Alert::success('没有任何变化!');
}
$this->redirect($this->getRequest()->getPost('referer'));
} else {
if ($data = $this->member->getMemberByAttribute(['id' => $id])) {
$data['referer'] = $_SERVER["HTTP_REFERER"];
$this->getView()->assign('data', $data);
} else {
Alert::success('没有此用户!');
$this->redirect('/admin/managemember/index');
}
}
}