function addset($name, $type, $x, $other = '', $text = '') { if ($type == 'checkbox') { if (option::uget($x) == 1) { $other .= ' checked="checked"'; } $value = '1'; } else { $value = option::uget($x); } echo '<tr><td>' . $name . '</td><td><input type="' . $type . '" name="' . $x . '" value="' . $value . '" ' . $other . '>' . $text . '</td>'; }
function mok_zdwk_set() { echo '<tr><td>附加签到</td><td><input type="checkbox" name="mok_zdwk_wk" '; if (option::uget('mok_zdwk_wk')) { echo 'checked'; } echo '> 签到百度文库<br/><input type="checkbox" name="mok_zdwk_zd" '; if (option::uget('mok_zdwk_zd')) { echo 'checked'; } echo '> 签到百度知道</td></tr>'; }
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 '邮件发送成功!'; }
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); } } }
function pch18_relist_setting() { ?> <tr><td>自动刷新贴吧列表</td> <td> <input type="radio" name="pch18_relist_enable" value="1" <?php if (option::uget('pch18_relist_enable') == 1) { echo 'checked'; } ?> > 是 <input type="radio" name="pch18_relist_enable" value="0" <?php if (option::uget('pch18_relist_enable') != 1) { echo 'checked'; } ?> > 否 </td> <?php }
function dl_yjtz_setting() { global $m; ?> <tr><td>签到邮件通知</td> <td> <input type="radio" name="dl_yjtz_enable" value="1" <?php if (option::uget('dl_yjtz_enable') == 1) { echo 'checked'; } ?> > 开启签到邮件通知<br/> <input type="radio" name="dl_yjtz_enable" value="0" <?php if (option::uget('dl_yjtz_enable') != 1) { echo 'checked'; } ?> > 关闭签到邮件通知 </td> <?php }
function haotian_signtz_setting() { global $m; ?> <tr><td>开启签到邮件通知</td> <td> <input type="radio" name="haotian_mail_enable" value="1" <?php if (option::uget('haotian_mail_enable') == 1) { echo 'checked'; } ?> > 是 <input type="radio" name="haotian_mail_enable" value="0" <?php if (option::uget('haotian_mail_enable') != 1) { echo 'checked'; } ?> > 否 </td> <?php }
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); } } Redirect(SYSTEM_URL . 'index.php?mod=admin:setplug&plug=pch18_relist&isok=已刷新完所有状态为开启的用户贴吧列表'); die; case 'wkq': //刷新未开启用户全部贴吧 $query = $m->query("SELECT DISTINCT id,uid FROM `" . DB_PREFIX . "baiduid` "); while ($fetch = $m->fetch_array($query)) { $id = $fetch['id']; $uid = $fetch['uid']; $setqd = option::uget('pch18_relist_enable', $uid); if ($setqd != 1) { //user表里面开启签到功能 $r = misc::scanTiebaByPid($id); //更新列表函数 $m->query("REPLACE INTO `" . DB_NAME . "`.`" . DB_PREFIX . "pch18_relist` SET `lastdate` = '" . date("Y-m-d") . "', id = " . $id); } } Redirect(SYSTEM_URL . 'index.php?mod=admin:setplug&plug=pch18_relist&isok=已刷新完所有状态为未开启用户贴吧列表'); die; case 'kong': //刷新空账户 $baid_ft = $m->query("SELECT id,uid FROM `" . DB_PREFIX . "baiduid`"); while ($baid = $m->fetch_array($baid_ft)) { $uxs = $m->once_fetch_array("SELECT * FROM `" . DB_PREFIX . "users` where id=" . $baid['uid']); if ($uxs['t'] == '') {
/** * 获取当前用户的Gravatar头像或贴吧头像 * http://en.gravatar.com/site/implement/images/ * @return bool|string */ function getGravatar($s = 140, $d = 'mm', $g = 'g', $site = 'moefont') { if (option::uget('face_img') == 1) { if (option::uget('face_url') != '') { return option::uget('face_url'); } else { return 'http://tb.himg.baidu.com/sys/portrait/item/'; } } else { return gravatar(EMAIL, $s, $d, $g, $site); } }
/** * 获取Gravatar头像(或贴吧头像) * http://en.gravatar.com/site/implement/images/ * @return bool|string */ function getGravatar($s = 140, $d = 'mm', $g = 'g', $site = 'secure') { if (option::uget('face_img') == 1) { if (option::uget('face_url') != '') { return option::uget('face_url'); } else { return 'http://tb.himg.baidu.com/sys/portrait/item/'; } } else { $hash = md5(EMAIL); $avatar = "https://{$site}.gravatar.com/avatar/{$hash}?s={$s}&r={$g}"; return $avatar; } }
if ($tb_max[0] < option::get('tb_max')) { $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'])) {