function mok_follow_check() { $head = array('User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36', 'Cookie:BDUSS=' . $_GET['bduss']); $opt = unserialize(option::get('mok_follow')); foreach ($opt['mustTieba'] as $tb => $lv) { $c = new wcurl('http://tieba.baidu.com/mo/m?kw=' . urlencode($tb), $head); $t = $c->get(); $c->close(); if (textMiddle($t, ' (等级', ')') < $lv) { msg($opt['error'][0]); } } if (count($opt['optionTieba']) > 0) { $check = false; foreach ($opt['optionTieba'] as $tb => $lv) { $c = new wcurl('http://tieba.baidu.com/mo/m?kw=' . urlencode($tb), $head); $t = $c->get(); $c->close(); if (textMiddle($t, ' (等级', ')') >= $lv) { $check = true; break; } } if ($check == false) { msg($opt['error'][0]); } } }
function cron_mok_zdwk() { //如果今天签到过了直接返回日志 if (option::get('mok_zdwk_run') == date('d')) { return option::get('mok_zdwk_log'); } global $m; $prefix = DB_PREFIX; //选出用户的options和bduss $res = $m->query("SELECT {$prefix}users_options.`name` , {$prefix}users_options.`value` , {$prefix}baiduid.`bduss` \nFROM {$prefix}baiduid\nINNER JOIN {$prefix}users_options ON {$prefix}users_options.uid = {$prefix}baiduid.uid\nWHERE {$prefix}users_options.`name` = 'mok_zdwk_wk'\nOR {$prefix}users_options.`name` = 'mok_zdwk_zd'"); $wk = $zd = 0; $bduss = array(); if ($m->num_rows($res) != 0) { while ($row = $res->fetch_array()) { //判断该选项是否开启 if ($row['value'] == 'on') { //记录bduss(数量),如果bduss数组内没有该bduss,则加入数组 if (!in_array($row['bduss'], $bduss)) { $bduss[] = $row['bduss']; } if ($row['name'] === 'mok_zdwk_wk') { $wk++; $head = array('Accept:*/*', 'Accept-Encoding:gzip, deflate, sdch', 'Accept-Language:zh-CN,zh;q=0.8', 'Connection:keep-alive', 'Host:wenku.baidu.com', 'Referer:http://wenku.baidu.com/task/browse/daily', 'User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36', 'X-Requested-With:XMLHttpRequest'); $c = new wcurl('http://wenku.baidu.com/task/submit/signin', $head); $c->addCookie('BDUSS=' . $row['bduss']); $c->exec(); $c->close(); } else { if ($row['name'] === 'mok_zdwk_zd') { $zd++; $c = new wcurl('http://zhidao.baidu.com/'); $c->addCookie('BDUSS=' . $row["bduss"]); $stoken = $c->get(); $c->close(); $stoken = textMiddle($stoken, '"stoken":"', '",'); if ($stoken != "") { $c = new wcurl('http://zhidao.baidu.com/submit/user'); $c->addCookie('BDUSS=' . $row["bduss"]); $c->post(array('cm' => '100509', 'utdata' => '90,90,102,96,107,101,99,97,96,90,98,103,103,99,127,106,99,99,14138554765830', 'stoken' => $stoken)); $c->close(); } } } } } } $log = "知道、文库签到完毕<br/>" . date("Y-m-d H:i:s") . "<br/>共计百度账号: " . count($bduss) . " 个<br/>知道签到: {$zd} 个<br/>文库签到: {$wk} 个"; option::set('mok_zdwk_run', date('d')); option::set('mok_zdwk_log', $log); return $log; }
function mok_bgimg_header() { global $i; $mok_bgimg = unserialize($i['opt']['mok_bgimg']); $mok_bgimg_img = unserialize($i['opt']['mok_bgimg_img']); $mok_bgimg_bing = unserialize($i['opt']['mok_bgimg_bing']); $img = explode("\r\n", $mok_bgimg['img']); //图片列表 if (count($img) > 0 || $mok_bgimg_img['bing'] == '1') { //至少要有一张图片或开启bing每日壁纸 //自动更换 if ($mok_bgimg['change'] != 0) { $change = false; //是否更换 if ($mok_bgimg['change'] == 1) { //每天更换 if ($mok_bgimg_img['day'] != date('d')) { $change = true; } } elseif ($mok_bgimg['change'] == 2) { //每小时更换 if ($mok_bgimg_img['hour'] != date('H')) { $change = true; } } elseif ($mok_bgimg['change'] == 3) { //每次访问更换 $change = true; } if ($change) { //记录背景更换时间 $mok_bgimg_img['day'] = date('d'); $mok_bgimg_img['hour'] = date('H'); if ($mok_bgimg['bing'] == '1') { //如果使用bing每日壁纸 $c = new wcurl('http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1'); $data = json_decode($c->get(), true); $c->close(); if (!empty($data['images'][0]['url'])) { option::set('mok_bgimg_bing', serialize(array('img' => $data['images'][0]['url']))); $mok_bgimg_img['img'] = $data['images'][0]['url']; } } else { if ($mok_bgimg['mode'] == 0) { //顺序更换 $key = array_search($mok_bgimg_img['img'], $img); //在图片列表中寻找当前背景图的序号 if ($key !== false) { if (count($img) == $key + 1) { //如果当前图片已经是最后一张 $mok_bgimg_img['img'] = $img[0]; } else { $mok_bgimg_img['img'] = $img[$key + 1]; } } else { //如果在图片列表中没有找到当前背景图,就从第一张背景图开始 $mok_bgimg_img['img'] = $img[0]; } } elseif ($mok_bgimg['mode'] == 1) { //随机更换 $mok_bgimg_img['img'] = $img[mt_rand(0, count($img) - 1)]; } } } } //第一次安装插件时此值为空,自动使用第一张图 if ($mok_bgimg_img['img'] == '') { $mok_bgimg_img['img'] = $img[0]; } //背景重复 if ($mok_bgimg['repeat'] == 3 || $mok_bgimg['repeat'] == 4) { //静态悬浮 if ($mok_bgimg['repeat'] == 3) { echo '<div id="mok_bgimg" style="width:100%;height:100%;background-size:100% 100%;background-image:url(\'' . $mok_bgimg_img['img'] . '\');position:fixed;"></div>'; } else { echo '<div id="mok_bgimg" style="width:100%;height:100%;background-size:100% auto;background-image:url(\'' . $mok_bgimg_img['img'] . '\');position:fixed;"></div>'; } } else { if ($mok_bgimg['repeat'] == 0) { //纵向重复 $tmp[] = 'background-repeat:repeat-y'; } else { $tmp[] = 'background-repeat:no-repeat'; } if ($mok_bgimg['repeat'] == 2) { //拉伸全屏 $tmp[] = 'background-size:100% 100%'; } else { $tmp[] = 'background-size:100% auto'; } $tmp[] = 'background-image:url(' . $mok_bgimg_img['img'] . ')'; $css = implode(';', $tmp) . ';'; echo '<style>body {' . $css . '}</style>'; } option::set('mok_bgimg_img', serialize($mok_bgimg_img)); //保存背景图片和更换时间 //透明选项 $css = '<style>'; if ($mok_bgimg['daohang'] == 1) { $css .= '.navbar{background:none !important}'; } if ($mok_bgimg['chengxuxinxi'] == 1) { $css .= '.panel{background:none !important}'; } if ($mok_bgimg['yonghuxinxi'] == 1) { $css .= '.list-group-item{background:none !important}'; } if ($mok_bgimg['liebiao'] == 1) { $css .= '.table-striped>tbody>tr:nth-of-type(odd){background:none !important}'; } if ($mok_bgimg['liebiaoxian'] == 1) { $css .= '.table>tbody>tr>td{border-top:none !important}'; } if ($mok_bgimg['tishikuang'] == 1) { $css .= '.alert{background:none !important}'; } if ($mok_bgimg['caidan'] == 1) { $css .= '.nav>li>a:hover, .nav>li>a:focus{background:none !important}'; } if ($mok_bgimg['shurukuang'] == 1) { $css .= '.form-control{background:none !important}'; } if ($mok_bgimg['anniu'] == 1) { $css .= '.btn{background:none !important}'; } //字体颜色 if (!empty($mok_bgimg['c_putong'])) { $css .= 'body{color:' . $mok_bgimg['c_putong'] . '}'; } if (!empty($mok_bgimg['c_zuoce'])) { $css .= '.container .nav>li>a{color:' . $mok_bgimg['c_zuoce'] . '}'; } if (!empty($mok_bgimg['c_dingbu'])) { $css .= '.navbar-default .navbar-nav>li>a,.navbar-default .navbar-brand{color:' . $mok_bgimg['c_dingbu'] . ' !important}'; } if (!empty($mok_bgimg['c_shurukuang'])) { $css .= '.form-control{color:' . $mok_bgimg['c_shurukuang'] . '}'; } $css .= '</style>'; echo $css; } }
/** * 获取一个bduss对应的百度用户名 * * @param string $bduss BDUSS * @return string|bool 百度用户名,失败返回FALSE */ function getBaiduId($bduss) { $c = new wcurl('http://wapp.baidu.com/'); $c->addCookie(array('BDUSS' => $bduss, 'BAIDUID' => strtoupper(md5(time())))); $data = $c->get(); $c->close(); return urldecode(textMiddle($data, 'i?un=', '">')); }
/** * 获取一个bduss对应的百度用户名 * * @param string $bduss BDUSS * @return string|bool 百度用户名,失败返回FALSE */ function getBaiduId($bduss) { global $m; $header[] = 'Content-Type:application/x-www-form-urlencoded; charset=UTF-8'; $header[] = 'Cookie: BDUSS=' . $bduss; $c = new wcurl('http://wapp.baidu.com/', $header); $data = $c->get(); $c->close(); return urldecode(textMiddle($data, 'i?un=', '">')); }
$m->query("INSERT INTO `" . DB_NAME . "`.`" . DB_PREFIX . TABLE . "` (`id`, `pid`, `uid`, `tieba`, `no`, `latest`) VALUES (NULL, {$pid} ,'" . UID . "', '{$v}', 0, 0);"); } else { msg('错误:您的贴吧数量超过限制,无法刷新!'); } } } } Redirect('index.php?mod=showtb&ok'); } doAction('showtb_set'); break; case 'set': // 获取头像的url if ($i['post']['face_img'] == 1 && $i['post']['face_baiduid'] != '') { $c = new wcurl('http://www.baidu.com/p/' . option::uget("face_baiduid")); $data = $c->get(); $c->close(); $i['post']['face_url'] = stripslashes(textMiddle($data, '<img class=portrait-img src=\\x22', '\\x22>')); } /* 受信任的设置项,如果插件要使用系统的API去储存设置,必须通过set_save1或set_save2挂载点挂载设置名 具体挂载方法为: global $PostArray; $PostArray[] = '设置名'; 为了兼容旧版本,可以global以后检查一下是不是空变量,为空则为旧版本 */ $PostArray = array('face_img', 'face_baiduid', 'face_url'); doAction('set_save1'); //更改邮箱 if ($_POST['mail'] != $i['user']['email'] && !empty($_POST['mail'])) { if (checkMail($_POST['mail'])) {
public static function getUserid($pid) { global $m; $ub = $m->once_fetch_array("SELECT * FROM `" . DB_PREFIX . "baiduid` WHERE `id` = '{$pid}';"); $user = new wcurl("http://tieba.baidu.com/home/get/panel?ie=utf-8&un={$ub['name']}"); $re = $user->get(); $ur = json_decode($re, true); $userid = $ur['data']['id']; return $userid; }