function main() { $sql = "select count(*) from " . TABLE_PREFIX . "feed_log "; $total_record = DB::result_first($sql); $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num']))); $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'), '20 50 100 200 500'); $sql = "select * from " . TABLE_PREFIX . "feed_log order by id desc\t{$page_arr['limit']} "; $query = $this->DatabaseHandler->Query($sql); $feedlist = array(); while (false != ($rs = $query->GetRow())) { $rs['dateline'] = my_date_format($rs['dateline']); $feedlist[$rs['id']] = $rs; } $action = "admin.php?mod=feed&code=del"; include template('admin/feed_main'); }
function Viewimg() { $imgid = jget('pid'); $infos = jlogic('image')->get_uploadimg_byid($imgid); $imginfo = $infos[$imgid]; if (!$imginfo) { $this->Messager("不存在该图片", null); } if ($imginfo['albumid'] > 0 && !jlogic('image')->checkalbumbyid($imginfo['albumid'])) { $this->Messager("您没有权限浏览该图片", null); } $imginfo['photo'] = $imginfo['site_url'] . '/' . str_replace('./', '', $imginfo['photo']); $albumname = $imginfo['albumid'] > 0 ? jlogic('image')->get_albumname_byid($imginfo['albumid']) : '默认相册'; $imgname = $imginfo['description'] ? cut_str($imginfo['description'], 18) : $imginfo['name']; $imgwidth = $imginfo['width'] > 800 ? 800 : $imginfo['width']; $imgheight = $imginfo['width'] > 800 ? ceil($imginfo['height'] / $imginfo['width'] * 800) : $imginfo['height']; $imgsize = $imginfo['filesize'] > 0 ? $imginfo['filesize'] < 1024 * 100 ? round($imginfo['filesize'] / 1024, 1) . 'K' : round($imginfo['filesize'] / (1024 * 1024), 1) . 'M' : '未知'; $imgtime = my_date_format($imginfo['dateline']); if ($imginfo['uid'] == MEMBER_ID) { $myclass = 'curr'; $allclass = ''; $navtitle = '<a href="' . jurl('index.php?mod=album') . '">我的相册</a> >> ' . '<a href="' . jurl('index.php?mod=album&aid=' . $imginfo['albumid']) . '">' . $albumname . '</a> >> ' . $imgname; } else { $myclass = ''; $allclass = 'curr'; $navtitle = '<a href="' . jurl('index.php?mod=album&code=list') . '">全部相册</a> >> ' . '<a href="' . jurl('index.php?mod=album&code=list&uid=' . $imginfo['uid']) . '">' . $imginfo['username'] . '的相册</a> >> ' . '<a href="' . jurl('index.php?mod=album&code=list&aid=' . $imginfo['albumid']) . '">' . $albumname . '</a> >> ' . $imgname; } $imgfrom = $imginfo['tid'] > 0 ? '<a href="' . jurl('index.php?mod=topic&code=' . $imginfo['tid']) . '">微博</a>' : ($imginfo['tid'] < 0 ? '私信' : '相册'); $this->item = 'topic_image'; $this->item_id = $imgid; $albumid = $imginfo['albumid']; $h_key = 'album'; $gets = array('mod' => 'album', 'code' => 'viewimg', 'pid' => $imgid); $page_url = 'index.php?' . url_implode($gets); $tids = jlogic('image')->get_topic_by_imageid($imgid); $options = array('tid' => $tids, 'perpage' => 5, 'page_url' => $page_url); $topic_info = jlogic('topic_list')->get_data($options); $topic_list = array(); if (!empty($topic_info)) { $topic_list = $topic_info['list']; $page_arr['html'] = $topic_info['page']['html']; } $this->Title = '查看相册图片 - ' . $imginfo['name']; $albums = jlogic('image')->getalbum(); include template("album_img"); }
function goodsinfo() { $id = jget('id'); $info = jlogic('mall')->get_info($id); if ($info) { $config = jconf::get('mall'); $member = jsg_member_info(MEMBER_ID); if ($info['expire'] < TIMESTAMP) { $info['exp'] = '商品已过期'; } elseif ($info['price'] > $member[$config['credits']]) { $info['exp'] = '您的' . $config['credits_name'] . '不够'; } elseif ($info['credit'] > $member['credits']) { $info['exp'] = '您的总积分不够'; } else { $info['exp'] = ''; } $info['expire'] = my_date_format($info['expire']); $info['desc'] = nl2br($info['desc']); $this->Title = '商品详情 —— ' . $info['name']; $this->MetaKeywords = '积分兑换,商品详情'; $this->MetaDescription = $info['name']; $top_credit_members = jlogic('mall')->get_top_member_credits(); $feeds = jlogic('feed')->get_feed(5, "`action`='兑换了'"); $css['mall'] = ' class="current"'; $this->item = 'mall'; $this->item_id = $id; $h_key = 'mall'; $gets = array('mod' => 'mall', 'code' => 'goodsinfo', 'id' => $id); $page_url = 'index.php?' . url_implode($gets); $tids = jlogic('mall')->get_topic_by_goodsid($id); $options = array('tid' => $tids, 'perpage' => 5, 'page_url' => $page_url); $topic_info = jlogic('topic_list')->get_data($options); $topic_list = array(); if (!empty($topic_info)) { $topic_list = $topic_info['list']; $page_arr['html'] = $topic_info['page']['html']; } $albums = jlogic('image')->getalbum(); include template('mall_info'); } else { header('Location: ' . jurl('index.php?mod=mall')); } }
function Main() { $act_list = jlogic('other')->act_list(); $act = $this->Code; $member = $this->Member; if (!$member) { $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=login'); } if ($member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } $member_nickname = $member['nickname']; if ('qqrobot' == $act) { if (empty($member['qq'])) { $qq_code = $member['uid'] . "j" . md5($member['password'] . $member['username']); } } elseif ('qmd' == $act) { $uid = MEMBER_ID; $image_path = $this->Config['site_url']; if ($this->Config['is_qmd']) { if ($member['qmd_url']) { $image_file = $image_path . '/' . $member['qmd_url']; } else { $image_file = $image_path . '/images/qmd_error.gif'; } } } elseif ('extcredits' == $act) { if (!$this->Config['extcredits_enable']) { $this->Messager("积分功能未启用", null); } $credits_config = $this->Config['credits']; $_default_credits = array(); $_enable = false; if (is_array($credits_config) && count($credits_config)) { foreach ($credits_config['ext'] as $_k => $_v) { if ($_v['enable']) { $_enable = true; if ($_v['default']) { $_default_credits[$_k] = $_v['default']; } } } } if (!$_enable) { $this->Messager("积分未设置", null); } $op = $this->Get['op']; $op_lists = array('base' => '我的积分', 'rule' => '积分规则'); $op = isset($op_lists[$op]) ? $op : 'base'; if ('base' == $op) { $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "members where `uid`='" . MEMBER_ID . "'"); $member = $query->GetRow(); $_search = $_replace = array(); for ($i = 1; $i <= 8; $i++) { $k = 'extcredits' . $i; $_search[$k] = '$member[' . $k . ']'; $_replace[$k] = ' 0 '; if (isset($credits_config['ext'][$k]) && $credits_config['ext'][$k]['enable']) { $_replace[$k] = $credits_config['ext'][$k]['name']; } } $_search['topic_count'] = '$member[topic_count]'; $_replace['topic_count'] = '发微博数量'; $credits_config_formula = str_replace($_search, $_replace, $credits_config['formula']); } elseif ('log' == $op) { $query = $this->DatabaseHandler->Query("select R.rulename,RL.* from " . TABLE_PREFIX . "credits_rule_log RL left join " . TABLE_PREFIX . "credits_rule R on R.rid=RL.rid where RL.`uid`='" . MEMBER_ID . "'"); $log_list = array(); while ($row = $query->GetRow()) { $log_list[] = $row; } if ($_default_credits) { $log_list['default_credits'] = $_default_credits; $log_list['default_credits']['rulename'] = '注册时的初始积分'; $log_list['default_credits']['total'] = $log_list['default_credits']['cyclenum'] = 1; } $_counts = array(); foreach ($log_list as $k => $row) { $row['dateline'] = $row['dateline'] ? my_date_format($row['dateline'], 'm-d H:i') : ' - '; foreach ($credits_config['ext'] as $_k => $_v) { $row[$_k] = $row[$_k] * $row['total']; $_counts[$_k] += $row[$_k]; } $log_list[$k] = $row; } } elseif ('rule' == $op) { if (!($credits_rule = jconf::get('credits_rule'))) { $sql = "select * from " . TABLE_PREFIX . "credits_rule order by rid"; $query = $this->DatabaseHandler->Query($sql); $credits_rule = array(); while (false != ($row = $query->GetRow())) { $v = false; foreach ($credits_config['ext'] as $_k => $_v) { if ($row[$_k]) { $v = true; break; } } if ($v) { foreach ($row as $k => $v) { if (!$v) { unset($row[$k]); } } $credits_rule[$row['action']] = $row; } } } $_cycletypes = array(0 => '一次性', 1 => '每天', 2 => '整点', 3 => '间隔分钟', 4 => '不限周期'); if ($_default_credits) { $credits_rule['default_credits'] = $_default_credits; $credits_rule['default_credits']['rulename'] = '注册时的初始积分'; $credits_rule['default_credits']['cycletype'] = 0; $credits_rule['default_credits']['rewardnum'] = 1; } foreach ($credits_rule as $k => $v) { $v['cycletype'] = $_cycletypes[(int) $v['cycletype']]; if (!$v['rewardnum']) { $v['rewardnum'] = '不限次数'; } $credits_rule[$k] = $v; } } else { $this->Messager("未定义的操作"); } } elseif ('imjiqiren' == $act) { define('IN_IMJIQIREN_MOD', true); include ROOT_PATH . 'modules/imjiqiren.mod.php'; } elseif ('sms' == $act) { define('IN_SMS_MOD', true); include ROOT_PATH . 'modules/sms.mod.php'; } elseif ('email' == $act) { } else { $PostShareName = $this->Post['share_name']; $shareName = $PostShareName ? $PostShareName : $this->Config['site_name']; } $this->Title = $act_list[$act]; include template('tools_main'); }
function tag() { $sort = intval(trim($this->Get['sort'])); $tag_id = intval(trim($this->Get['tag_id'])); if (empty($tag_id)) { $this->Messager("当前标签不存在或者已经被删除了"); } $tag_info = $this->QunLogic->get_tag_info($tag_id); if (empty($tag_info)) { $this->Messager("当前标签不存在或者已经被删除了"); } $perpage = 10; $gets = array('mod' => 'qun', 'code' => 'tag', 'tag_id' => $tag_id, 'sort' => $this->Get['sort']); $page_url = 'index.php?' . url_implode($gets); $where_sql = " tag_id='{$tag_id}' AND gview_perm=0 "; $order_sql = ' '; if ($sort == 2) { $order_sql = ' q.thread_num DESC '; } else { if ($sort == 3) { $order_sql = ' q.dateline DESC '; } else { $sort = 1; $order_sql = ' q.member_num DESC '; } } $active_sort[$sort] = 'class="on"'; $count = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t FROM " . DB::table('qun') . " AS q\r\n\t\t\t\t\t\t\t\t LEFT JOIN " . DB::table('qun_tag_fields') . " AS qtf\r\n\t\t\t\t\t\t\t\t USING(qid)\r\n\t\t\t\t\t\t\t\t WHERE {$where_sql} "); $qun_list = array(); if ($count) { $_config = array('return' => 'array'); $page_arr = page($count, $perpage, $page_url, $_config); $query = DB::query("SELECT q.*\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('qun') . " AS q\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('qun_tag_fields') . " AS qtf\r\n\t\t\t\t\t\t\t\tUSING(qid)\r\n\t\t\t\t\t\t\t\tWHERE {$where_sql} "); while ($value = DB::fetch($query)) { $value['icon'] = $this->QunLogic->qun_avatar($value['qid'], 's'); $value['dateline'] = my_date_format($value['dateline'], 'Y-m-d H:i'); $qun_list[] = $value; } $this->_get_ql_tag($qun_list); } $member =& $this->my; $joined_nums = $this->QunLogic->joined_nums(MEMBER_ID); $title = "所有使用“{$tag_info['tag_name']}”标签的" . $this->Config[changeword][weiqun] . "列表"; $this->Title = $title; include_once template('qun/tag_list'); }
function Main() { $this->CheckAdminPrivs('sessions'); $where_list=array(); $where=""; $query_link="admin.php?mod=sessions"; $p=max((int)$this->Get['page'],1); $query_link.="&page=".$p; $pn=(int)$this->Get['pn']?(int)$this->Get['pn']:20; if($pn<1)$pn=20; $query_link.='&pn='.$pn; $username=trim($this->Get['username']); if ($username!="") { $where_list[]="username like '%$username%'"; $query_link.="&username="******"*" || empty($_ip))continue; $ips.=$and."ip{$i}='$_ip'"; $and=" and "; } $where_list[]=$ips; } if($this->Get['order_by'])$query_link.="&order_by=".$this->Get['order_by']; if($this->Get['order_type'])$query_link.="&order_type=".$this->Get['order_type']; if($where_list)$where=" where ".implode(" AND ",$where_list); $order_by_list = array ( 'order_by_default' => 'lastactivity', 'lastactivity' => array ( 'name' => '最后访问时间', 'order_by' => 'lastactivity', ), 'ip' => array ( 'name' => 'IP地址', 'order_by' =>"concat_ws('.',ip1,ip2,ip3,ip4)", ), 'uid' => array ( 'name' => '用户名', 'order_by' => 'uid', ), ); $order_array = order($order_by_list,$query_link,array('display_un_href'=>true)); $order = $order_array['order']; $order_html = $order_array['html']; $limit=""; $offset=($p-1)*$pn; $sql="SELECT count(1) total from ".TABLE_PREFIX."system_sessions".$where; $query = $this->DatabaseHandler->Query($sql); $row=$query->GetRow(); $total=$row['total']; $sql="SELECT * from ".TABLE_PREFIX."system_sessions".$where." ".$order." limit $offset,$pn"; $query = $this->DatabaseHandler->Query($sql); $session_list=array(); while ($row=$query->GetRow()) { $row['dateline']=my_date_format($row['lastactivity']); $row['ip']=sprintf("%s.%s.%s.%s",$row['ip1'],$row['ip2'],$row['ip3'],$row['ip4']); $session_list[]=$row; } $robot=array(); $robot_record=(int)ConfigHandler::get('robot','turnon'); if($robot_record==1) { $sql="SELECT * from ".TABLE_PREFIX."system_robot_ip"; $query=$this->DatabaseHandler->Query($sql,"SKIP_ERROR"); if($query) { while ($row=$query->GetRow()) { $robot[$row['ip']]=$row['name']; } } } $pages=page($total,$pn,$query_link,array(),"2 10 20 50 100 200 500"); include handler('template')->file('@admin/sessions'); }
function mk_time_select($type = 'hour', $def_val = false, $name = '') { $html = ''; $time = 0; if (defined(TIMESTAMP)) { $time = TIMESTAMP; } else { $time = time(); } if ($type == 'hour') { $range = 24; if ($def_val === false) { $def_val = my_date_format($time, 'H'); } } else { if ($type == 'min') { $range = 60; if ($def_val === false) { $def_val = my_date_format($time, 'i'); } } else { return ''; } } $name = $name ? $name : $type; $html = "<select name=\"{$name}\" id=\"{$name}\" defaultvalue=\"{$def_val}\">"; for ($i = 0; $i < $range; ++$i) { $selected = ''; $value = $i; if (strlen($value) < 2) { $value = '0' . $value; } if ($value == $def_val) { $selected = 'selected="selected"'; } $html .= " <option value=\"{$value}\" {$selected} >{$value}</option>"; } $html .= '</select>'; return $html; }
function viewIP() { $this->CheckAdminPrivs('robot'); $robot=trim($this->Get['robot']); $sql="select * from ".TABLE_PREFIX."system_robot_ip where `name`='$robot' order by `ip`"; $query = $this->DatabaseHandler->Query($sql); $ip_list=array(); $count=0; while ($row=$query->GetRow()) { $count++; $row['first_visit']=my_date_format($row['first_visit']); $row['last_visit']=my_date_format($row['last_visit']); $times+=$row['times']; $ip_list[]=$row; } if(empty($ip_list))$this->Messager("无IP记录"); include handler('template')->file('@admin/robot_view_ip'); }
function get($p) { $wheres = array(); if (isset($p['id'])) { $p['id'] = max(0, (int) $p['id']); if ($p['id'] > 0) { $wheres[] = " `id`='{$p['id']}' "; } } if (isset($p['ids'])) { $p['ids'] = $this->get_ids($p['ids'], 0); if ($p['ids']) { $wheres[] = " `id` in ({$p['ids']}) "; } } if (isset($p['item'])) { $wheres[] = " `item`='{$p['item']}' "; } if (isset($p['itemid'])) { $p['itemid'] = max(0, (int) $p['itemid']); if ($p['itemid'] > 0) { $wheres[] = " `itemid`='{$p['itemid']}' "; } } if (isset($p['itemids'])) { $p['itemids'] = $this->get_ids($p['itemids'], 0); if ($p['itemids']) { $wheres[] = " `itemid` in ({$p['itemids']}) "; } } if (isset($p['tid'])) { $p['tid'] = max(0, (int) $p['tid']); $wheres[] = " `tid`='{$p['tid']}' "; } if (isset($p['tids'])) { $p['tids'] = $this->get_ids($p['tids'], 0); if ($p['tids']) { $wheres[] = " `tid` in ({$p['tids']}) "; } } if (isset($p['dateline_min'])) { $p['dateline_min'] = max(0, (int) $p['dateline_min']); $wheres[] = " `dateline`>='{$p['dateline_min']}' "; } if (isset($p['dateline_max'])) { $p['dateline_max'] = max(0, (int) $p['dateline_max']); $wheres[] = " `dateline`<='{$p['dateline_max']}' "; } if (isset($p['uid'])) { $p['uid'] = max(0, (int) $p['uid']); $wheres[] = " `uid`='{$p['uid']}' "; } if (isset($p['uids'])) { $p['uids'] = $this->get_ids($p['uids'], 0); if ($p['uids']) { $wheres[] = " `uid` in ({$p['uids']}) "; } } $sql_where = $wheres ? " where " . implode(" and ", $wheres) : ""; $count = max(0, (int) $p['count']); if ($count < 1) { $count = DB::result_first("select count(*) as `count` from " . DB::table($this->table) . " {$sql_where} "); } $list = array(); $page = array(); if ($count > 0) { $sql_limit = ''; if ($p['per_page_num']) { $page = page($count, $p['per_page_num'], $p['page_url'], array('return' => 'Array')); $sql_limit = " {$page['limit']} "; } elseif ($p['limit']) { if (false !== strpos(strtolower($p['limit']), 'limit ')) { $sql_limit = " {$p['limit']} "; } else { $sql_limit = " limit {$p['limit']} "; } } $sql_order = ''; if ($p['order']) { if (false !== strpos(strtolower($p['order']), 'order by ')) { $sql_order = " {$p['order']} "; } else { $sql_order = " order by {$p['order']} "; } } $sql_fields = $p['fields'] ? $p['fields'] : "*"; $query = DB::query("select {$sql_fields} from " . DB::table($this->table) . " {$sql_where} {$sql_order} {$sql_limit} "); $candown = jclass('member')->HasPermission('uploadattach', 'down'); $canviewtype = array('doc', 'ppt', 'pdf', 'xls', 'txt', 'docx', 'xlsx', 'pptx'); while (false != ($r = DB::fetch($query))) { $r['type'] = 'images/filetype/' . $r['filetype'] . '.gif'; $r['time'] = my_date_format($r['dateline']); $r['size'] = $r['filesize'] > 1024 * 1024 ? round($r['filesize'] / (1024 * 1024), 2) . 'MB' : round($r['filesize'] / 1024, 1) . 'KB'; $r['url'] = ($r['site_url'] ? $r['site_url'] : $GLOBALS['_J']['site_url']) . '/' . str_replace('./', '', $r['file']); $r['onlineview'] = $candown && in_array($r['filetype'], $canviewtype) && $r['score'] == 0 ? $r['url'] : ''; $list[] = $r; } if ($list) { return array('count' => $count, 'list' => $list, 'page' => $page); } } return array(); }
function recd() { Load::logic('topic_recommend'); $TopicRecommendLogic = new TopicRecommendLogic(); $tid = intval($this->Get['tid']); $tag_id = intval($this->Get['tag_id']); $topic = DB::fetch_first("SELECT * FROM " . DB::table("topic") . " WHERE tid='{$tid}'"); if (empty($topic)) { json_error("当前微博不存在或者已经被删除了"); } if ($topic['item'] == 'channel' && $topic['item_id'] > 0) { if (!function_exists('item_topic_from')) { jfunc('item'); } $topic = item_topic_from($topic); } if (!($this->MemberHandler->HasPermission('topic', 'do_recd') || $topic['ismanager'])) { json_error("您的角色没有推荐微博的权限!"); } $topic_recd = $TopicRecommendLogic->get_info($tid); if (!empty($topic_recd)) { $topic_recd['expiration'] = empty($topic_recd['expiration']) ? '' : my_date_format($topic_recd['expiration'], 'Y-m-d H:i'); $recd_html = jform()->Radio('recd[]', array(array("name" => "重点推荐", "value" => "4", "title" => "在我的首页和指定的位置推荐"), array("name" => "普通推荐", "value" => "2", "title" => "仅在指定的页面位置推荐"), array("name" => "取消推荐", "value" => "0", "title" => "恢复为常态微博")), $topic_recd['recd'], 'title'); } else { $recd_html = jform()->Radio('recd[]', array(array("name" => "重点推荐", "value" => "4", "title" => "在我的首页和指定的位置推荐"), array("name" => "普通推荐", "value" => "2", "title" => "仅在指定的页面位置推荐")), 2, 'title'); } $channels = array(); if ($this->Config['channel_enable']) { $channels = $TopicRecommendLogic->recd_channels(); } if ($topic['item'] == 'qun' && $topic['item_id'] > 0) { Load::logic('qun'); $QunLogic = new QunLogic(); $tmp_perm = $QunLogic->chk_perm($topic['item_id'], MEMBER_ID); if (!('admin' == MEMBER_ROLE_TYPE || in_array($tmp_perm, array(1, 2)))) { json_error("你没有权限推荐群内微博"); } } include template("topic_recd"); }
function DoList() { $keyword = trim($this->Get['keyword']); $where_list = array(); if ($keyword) { $where_list[] = "`name` like '%{$keyword}%'"; } $where = ""; $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' '; $per_page_num = (int) $this->Get['pn'] ? (int) $this->Get['pn'] : 50; $offset = (max((int) $this->Get['page'], 1) - 1) * $per_page_num; $sql = "SELECT count(1) total from " . TABLE_PREFIX . "tag {$where}"; $query = $this->DatabaseHandler->Query($sql); $row = $query->GetRow(); $total = $row['total']; $order_by_list = array('order_by_default' => 'default', 'default' => array('name' => '添加时间', 'order_by' => 'id'), 'thread_count' => array('name' => '使用次数', 'order_by' => 'total_count'), 'member_count' => array('name' => '标签名称', 'order_by' => 'name')); $order_condition = order($order_by_list, "admin.php?mod=tag&keyword=" . urlencode($keyword), array('display_un_href' => true)); $sql = "SELECT *\r\n\t\tFROM " . TABLE_PREFIX . "tag\r\n\t\t{$where}\r\n\t\t{$order_condition['order']}\r\n\t\tlimit {$offset},{$per_page_num}"; $query = $this->DatabaseHandler->Query($sql); $tag_list = array(); while ($row = $query->GetRow()) { $row['dateline'] = my_date_format($row['dateline']); $row['tag_html'] = $this->_tag_html($row['id'], $row['status']); $tag_list[] = $row; } $pages = page($total, $per_page_num, '', array(), "20 50 100 200 300"); $tag_item_list = jconf::get('tag', 'item_list'); $tag_num = jconf::get('tag_num'); foreach ($tag_item_list as $key => $val) { $val["selected_" . (int) $tag_num[$val['value']]] = " selected "; $tag_item_list[$key] = $val; } include template('admin/tag'); }
function my_date_format2($time,$format='m月d日 H时i分') { $now = time(); $t = $now - $time; if ($t < 60) { $time = __("刚刚"); } elseif ($t < 3600) { $time = floor($t / 60) . __("分钟前"); } elseif ($t < 86400) { $time = floor($t / 3600) . "小时" . (($i=round($t % 3600 / 60)) > 0 ? "{$i}分钟" : "") . "前"; } else { $time = my_date_format($time,$format); } return $time; }
function getrcduser() { $tid = jget('tid', 'int', 'P'); if ($tid > 0) { $rcduser = DB::fetch_first("SELECT dateline,r_nickname FROM " . DB::table('topic_recommend') . " WHERE tid='{$tid}'"); $html = '<script type="text/javascript">$(document).ready(function(){$(".rcdusername").bind("mouseover", function(){$(this).show();});$(".rcdusername").bind("mouseout", function(){$(this).hide();});});</script>'; $html .= '<div class="rcdusername"><div style="text-align:center;background:#fdffd2;border:1px solid #ffecb0;padding:1px 10px;width:380px;overflow:hidden; margin:3px 0 0 80px"><p>推荐人:' . $rcduser['r_nickname'] . ',推荐时间:' . my_date_format($rcduser['dateline'], "Y-m-d H:i") . ',<a href="' . jurl('index.php?mod=topic&code=recd') . '">查看更多推荐</a></p></div></div>'; echo $html; } }
function Main() { $report_config = jconf::get('report'); $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num']))); $where_list = array(); $query_link = 'admin.php?mod=report'; $keyword = trim($this->Get['keyword']); if ($keyword) { $_GET['highlight'] = $keyword; $where_list['keyword'] = build_like_query('content', $keyword); $query_link .= "&keyword=" . urlencode($keyword); } $username = trim($this->Get['username']); if ($username) { $where_list['username'] = "******"; $query_link .= "&username="******" selected "; if ($reason) { $where_list['reason'] = "`reason`='{$reason}'"; $query_link .= "&reason={$reason}"; } $result = isset($this->Get['result']) ? $this->Get['result'] : ''; $result_arr[$result] = " selected "; if ($result != '') { $where_list['result'] = "`process_result`='{$result}'"; $query_link .= "&result={$result}"; } $timefrom = $this->Get['timefrom']; if ($timefrom) { $str_time_from = strtotime($timefrom); $where_list['timefrom'] = "`dateline`>'{$str_time_from}'"; $query_link .= "&timefrom=" . $timefrom; } $timeto = $this->Get['timeto']; if ($timeto) { $str_time_to = strtotime($timeto); $where_list['timeto'] = "`dateline`<'{$str_time_to}'"; $query_link .= "&timeto=" . $timeto; } $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' '; $sql = " select count(*) as `total_record` from `" . TABLE_PREFIX . "report` {$where} "; $total_record = DB::result_first($sql); $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'), '20 50 100 200 500'); $sql = " select * from `" . TABLE_PREFIX . "report` {$where} order by `id` desc {$page_arr['limit']} "; $query = $this->DatabaseHandler->Query($sql); $report_list = array(); $TopicLogic = jlogic('topic'); $deleted_tid = array(); while (false != ($row = $query->GetRow())) { $row['topic_list'] = $TopicLogic->Get($row['tid']); if (!$row['topic_list']) { $deleted_tid[$row['id']] = $row['id']; continue; } if ($row['topic_list']['type'] == 'forward' && $row['topic_list']['roottid'] > 0) { $row['topic_list']['root_topic'] = $TopicLogic->Get($row['topic_list']['roottid']); } $row['type_show'] = $report_config['type_list'][$row['type']]; $row['reason_show'] = $report_config['reason_list'][$row['reason']]; $row['process_result_show'] = $report_config['process_result_list'][$row['process_result']]; if ($row['process_time']) { $row['process_time'] = my_date_format($row['process_time']); $row['process_result_show'] = "[{$row['process_time']}]" . $row['process_result_show']; } $report_list[] = $row; } if ($deleted_tid) { DB::query("delete from `" . TABLE_PREFIX . "report` where id in (" . jimplode($deleted_tid) . ")"); } include template('admin/report'); }
function get_publish_form_param($dateline = '') { if (empty($dateline)) { $expiration = my_date_format(TIMESTAMP + 7 * 24 * 3600, 'Y-m-d'); $hour_select = mk_time_select(); $min_select = mk_time_select('min'); } else { $expiration = my_date_format($dateline, 'Y-m-d '); $hour_select = mk_time_select('hour', my_date_format($dateline, 'H')); $min_select = mk_time_select('min', my_date_format($dateline, 'i')); } return array('expiration' => $expiration, 'hour_select' => $hour_select, 'min_select' => $min_select); }
function LogList() { $task_id = (int) $this->Get['task_id'] ? (int) $this->Get['task_id'] : (int) $this->Post['task_id']; $limit = (int) $this->Get['limit'] ? (int) $this->Get['limit'] : (int) $this->Post['limit']; if ($limit == 0) { $limit = 5; } $where_list = array(); $where = ""; if ($task_id) { $where_list['task_id'] = "task_id='{$task_id}'"; } if ($where_list != false) { $where = ' where ' . implode(" AND ", $where_list); } $error_type = array(0 => "成功", E_USER_ERROR => "<span style='color:red'>错误</span>", E_USER_WARNING => "<span style='color:#EF6000'>警告</span>", E_USER_NOTICE => "<span style='color:#FF9710'>注意</span>"); $sql = "SELECT id,name from " . TABLE_PREFIX . 'task'; $query = $this->DatabaseHandler->Query($sql); $task_list = array(); $task_list[] = array('name' => "所有任务", 'id' => 0); while ($row = $query->GetRow()) { $task_list[$row['id']] = $row; } $task_select = $this->jishigou_form->Select('task_id', $task_list, $task_id); $sql = "SELECT * from " . TABLE_PREFIX . 'task_log' . $where . " order by id desc limit {$limit}"; $query = $this->DatabaseHandler->Query($sql); $log_list = array(); while ($row = $query->GetRow()) { $row['error_string'] = $error_type[$row['error']]; $row['task_name'] = $task_list[$row['task_id']]['name']; $row['dateline'] = my_date_format($row['dateline']); $log_list[] = $row; } include template('admin/task_log_list'); }
function viewIP() { $robot = trim($this->Get['robot']); if (empty($robot)) { $this->Messager('请先指定一个要查询的名称'); } $page_url = 'admin.php?mod=robot&code=viewip&robot=' . urlencode($robot); $per_page_num = jget('pn', 'int'); if ($per_page_num < 1) { $per_page_num = jget('per_page_num', 'int'); } if ($per_page_num < 1 || $per_page_num > 200) { $per_page_num = 50; } $page_url .= '&pn=' . $per_page_num; $npage = $page_url; $order = jget('order', 'txt'); if (!in_array($order, array('times', 'ip'))) { $order = 'last_visit'; } $page_url .= '&order=' . $order; $rets = jtable('robot_ip')->get(array('perpage' => $per_page_num, 'page_url' => $page_url, 'page_options' => array('per_page_nums' => '20 50 100 200'), 'name' => $robot, 'sql_order' => ' `' . $order . '` DESC ')); $count = $rets['count']; $page = $rets['page']; if ($count > 0) { $ip_list = array(); foreach ($rets['list'] as $k => $row) { $row['first_visit'] = my_date_format($row['first_visit']); $row['last_visit'] = my_date_format($row['last_visit']); $times += $row['times']; $ip_list[$k] = $row; } } else { $this->Messager("无IP记录"); } include template('admin/robot_view_ip'); }
function edit() { $vid = empty($this->Get['vid']) ? 0 : intval($this->Get['vid']); $vote = $this->VoteLogic->id2voteinfo($vid); if (empty($vote)) { $this->Messager("当前投票不存在"); } $opt_info = $this->VoteLogic->get_option_by_vid($vid); $options = $opt_info['option']; $max_range_num = count($options) > 40 ? 50 : count($options) + 9; $range = range(0, $max_range_num); $checked = array(); $checked['is_view'][$vote['is_view']] = 'checked="checked"'; $checked['recd'] = $vote['recd'] ? 'checked="checked"' : ''; $selected[$vote['maxchoice']] = 'selected="selected"'; $date = my_date_format($vote['expiration'], 'Y-m-d'); $hour_select = mk_time_select('hour', my_date_format($vote['expiration'], 'H')); $min_select = mk_time_select('min', my_date_format($vote['expiration'], 'i')); include template('admin/vote_edit'); }
function Export() { $id = jget('id', 'int'); $plugin_info = jlogic('plugin')->getpluginbyid($id); if ($plugin_info) { $export_ary = array(); $export_ary['Title'] = 'JishiGou! Plugin'; $export_ary['Version'] = SYS_VERSION; $export_ary['Time'] = my_date_format(time()); $export_ary['Data']['plugin']['available'] = 0; $export_ary['Data']['plugin']['name'] = $plugin_info['name']; $export_ary['Data']['plugin']['identifier'] = $plugin_info['identifier']; $export_ary['Data']['plugin']['description'] = $plugin_info['description']; $export_ary['Data']['plugin']['directory'] = $plugin_info['directory']; $export_ary['Data']['plugin']['copyright'] = $plugin_info['copyright']; $export_ary['Data']['plugin']['version'] = $plugin_info['version']; $export_ary['Data']['plugin']['__modules'] = unserialize($plugin_info['modules']); $plugin_var = jlogic('plugin')->getpluginvarbyid($id); foreach ($plugin_var as $temp => $val) { $export_ary['Data']['var'][$temp]['displayorder'] = $val['displayorder']; $export_ary['Data']['var'][$temp]['title'] = $val['title']; $export_ary['Data']['var'][$temp]['description'] = $val['description']; $export_ary['Data']['var'][$temp]['variable'] = $val['variable']; $export_ary['Data']['var'][$temp]['type'] = $val['type']; $export_ary['Data']['var'][$temp]['value'] = $val['value']; $export_ary['Data']['var'][$temp]['extra'] = $val['extra']; } $plugindir = PLUGIN_DIR . '/' . $plugin_info['directory']; if (file_exists($plugindir . '/install.php')) { $export_ary['installfile'] = 'install.php'; } if (file_exists($plugindir . '/upgrade.php')) { $export_ary['upgradefile'] = 'upgrade.php'; } if (file_exists($plugindir . '/uninstall.php')) { $export_ary['uninstallfile'] = 'uninstall.php'; } $xml = xml_serialize($export_ary, true); $filename = strtolower(str_replace(array('!', ' '), array('', '_'), 'JishiGou! Plugin')) . '_' . $plugin_info['identifier'] . '.xml'; ob_end_clean(); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); header('Content-Encoding: none'); header('Content-Length: ' . strlen($xml)); header('Content-Disposition: attachment; filename=' . $filename); header('Content-Type: text/xml'); echo $xml; exit; } else { $this->Messager("未找到该插件", 'admin.php?mod=plugin'); } }
function editEvent() { $id = (int) $this->Get['id']; load::logic('event'); $EventLogic = new EventLogic(); $postman = $EventLogic->get_postman($id); if ($postman != MEMBER_ID) { $this->Messager("你无权修改该活动"); } $free = 'checked'; $all = 'checked'; $info = array(); $info = jconf::get('profileeventinfo'); $val = array(); if ($id) { $act = "edit"; $val = $EventLogic->get_event_info($id); $item_id = $val['item_id']; $title = $val['title']; $moneys = $val['money']; $content = $val['content']; $address = $val['address']; if ($val['image']) { $image = $val['image']; } $edit_fromt = date("Y-m-d", $val['fromt']); $edit_fromt_h = date("H", $val['fromt']); $edit_fromt_i = date("i", $val['fromt']); $edit_tot = date("Y-m-d", $val['tot']); $edit_tot_h = date("H", $val['tot']); $edit_tot_i = date("i", $val['tot']); if ($val['money']) { $money = 'checked'; $free = ''; } else { $money = ''; $free = 'checked'; } $qualification = unserialize($val['qualification']); if (count($qualification)) { $qua = "checked"; $all = ""; if ($qualification['fans_num']) { $fans = "checked"; $fans_num = $qualification['fans_num']; } if ($qualification['same_city']) { $same_city = "checked"; } if ($qualification['inqun']) { $inqun = " checked "; } } $need_app_info = unserialize($val['need_app_info']); if (count($need_app_info)) { foreach ($need_app_info as $value) { $info[$value]['checked'] = "checked"; } } } $rs = $EventLogic->get_event_type(TRUE); $event_type = jform()->Select("type", $rs, $val['type_id']); $province = $EventLogic->get_province(); $province_id = $val['province_id']; $hid_province = $province_id; $province_list = jform()->Select("province", $province, $province_id, "onchange=\"changeProvince();\""); $city_id = $val['city_id']; $hid_city = $city_id; $area_id = $val['area_id']; $hid_area = $area_id; $fromt = $edit_fromt ? $edit_fromt : my_date_format(TIMESTAMP, 'Y-m-d'); $edit_fromt_h = $edit_fromt_h ? $edit_fromt_h : false; $edit_fromt_i = $edit_fromt_i ? $edit_fromt_i : false; $hour_select_from = mk_time_select('hour', $edit_fromt_h, 'hour_select_from'); $min_select_from = mk_time_select('min', $edit_fromt_i, 'min_select_from'); $tot = $edit_tot ? $edit_tot : my_date_format(TIMESTAMP + 7 * 24 * 3600, 'Y-m-d'); $edit_tot_h = $edit_tot_h ? $edit_tot_h : false; $edit_tot_i = $edit_tot_i ? $edit_tot_i : false; $hour_select_to = mk_time_select('hour', $edit_tot_h, 'hour_select_to'); $min_select_to = mk_time_select('min', $edit_tot_i, 'min_select_to'); $member = $this->Member; $this->Title = "修改活动"; include template('event/event_create'); }
function eventPost() { $is_allowed = ''; if (MEMBER_ID < 1) { $is_allowed = "请先登录或者注册一个帐号"; } if (MEMBER_ROLE_TYPE != 'admin' && !$is_allowed) { load::logic('event'); $EventLogic = new EventLogic(); $is_allowed = $EventLogic->allowedCreate(MEMBER_ID, $this->Member); } if ($is_allowed) { exit($is_allowed); } $item = $this->Get['item']; $item_id = $this->Get['item_id']; $top = 'top'; $free = 'checked'; $all = 'checked'; $info = array(); $info = jconf::get('profileeventinfo'); $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "event_sort order by id"); while ($rsdb = $query->GetRow()) { $rs[$rsdb[id]]['value'] = $rsdb['id']; $rs[$rsdb[id]]['name'] = $rsdb['type']; } $event_type = jform()->Select("type", $rs); if ($this->Member['province']) { $province_id = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '" . $this->Member['province'] . "' and `upid` = '0'"); } else { $province_id = DB::result_first("select id from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list"); } $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list"); while ($rsdb = $query->GetRow()) { $province[$rsdb['id']]['value'] = $rsdb['id']; $province[$rsdb['id']]['name'] = $rsdb['name']; } $hid_province = $province_id; $province_list = jform()->Select("province", $province, $province_id, "onchange=\"changeProvince();\""); if ($this->Member['city']) { $city_id = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '" . $this->Member['city'] . "' and upid = '{$province_id}'"); $where_city = " and upid = '{$city_id}' "; } $hid_city = $city_id; if ($this->Member['area']) { $area_id = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '" . $this->Member['area'] . "' {$where_city}"); } $hid_area = $area_id; $fromt = my_date_format(TIMESTAMP, 'Y-m-d'); $hour_select_from = mk_time_select('hour', false, 'hour_select_from'); $min_select_from = mk_time_select('min', false, 'min_select_from'); $tot = my_date_format(TIMESTAMP + 7 * 24 * 3600, 'Y-m-d'); $hour_select_to = mk_time_select('hour', false, 'hour_select_to'); $min_select_to = mk_time_select('min', false, 'min_select_to'); include template('event/event_options'); }
function InviteByEmail() { $inviteEmail = trim($this->Post['inviteEmail'] ? $this->Post['inviteEmail'] : $this->Get['inviteEmail']); if (!$inviteEmail) { $this->Messager("请填入Email地址", -1); } $email_list = explode(';', $inviteEmail); $send_success = $send_failed = 0; foreach ($email_list as $email) { $email = trim($email); if (preg_match("~^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\\.)+([a-z]{2,4})|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))\$~i", $email)) { $_sql = "select * from `" . TABLE_PREFIX . "invite` where `femail`='{$email}' and `uid`='" . MEMBER_ID . "'"; $_query = $this->DatabaseHandler->Query($_sql); $_row = $_query->GetRow(); if ($_row) { if ($_row['fuid'] > 0 || $_row['dateline'] + 600 > time()) { continue; } $_row['dateline'] = time(); $_sql = "update `" . TABLE_PREFIX . "invite` set `dateline`='{$_row['dateline']}' where `id`='{$_row['id']}'"; $this->DatabaseHandler->Query($_sql); } else { $_row['uid'] = MEMBER_ID; $_row['code'] = substr(md5(MEMBER_ID . random(16) . time()), 0, 16); $_row['dateline'] = time(); $_row['femail'] = $email; $_sql = "insert into `" . TABLE_PREFIX . "invite` (`uid`,`code`,`dateline`,`femail`) values ('{$_row['uid']}','{$_row['code']}','{$_row['dateline']}','{$_row['femail']}')"; $this->DatabaseHandler->Query($_sql); $_row['id'] = $this->DatabaseHandler->Insert_ID(); } if ($_row['id'] < 1 || !$_row['code'] || !$_row['femail']) { continue; } $invite_id = $_row['id']; $invite_hash = md5($_row['id'] . $_row['code'] . $_row['dateline'] . $_row['femail']); $invite_email = $_row['femail']; $invite_url = "{$this->Config['site_url']}/index.php?mod=member&code=" . urlencode("{$invite_id}#{$invite_hash}") . "&email=" . urlencode($invite_email); $mail_from_username = $this->Member['nickname']; $mail_from_email = '*****@*****.**'; $mail_from_email = $this->Config['site_admin_email']; $mail_to = $email; $mail_subject = "{$this->Config[site_name]}的邀请:来自好友{$this->Member['nickname']}"; $mail_content = "{$this->Member['nickname']} 邀请你加入 {$this->Config[site_name]}!\r\n\r\n请点击以下链接加入,随时随地关注、分享身边的新鲜事儿:\r\n\t\t\t\t{$invite_url}\r\n(注意:此邀请链接仅能使用一次)\r\n\r\n如果以上链接无法访问,请复制链接并粘贴到浏览器地址栏访问。\r\n\r\n\r\n如果您已经拥有{$this->Config[site_name]}帐号,请访问我的个人页面:\r\n\t\t\t\t{$this->Config['site_url']}/index.php?mod={$this->Member['username']}\r\n\r\n-------------------------------------------------------------------------\r\n这是一封系统自动发送的邮件,请不要直接回复。\r\n" . my_date_format(time(), 'Y-m-d'); $send_result = send_mail($mail_to, $mail_subject, $mail_content, $mail_from_username, $mail_from_email, array(), 3, false); if ($send_result) { $send_success++; } else { $send_failed++; } } } $send_result = $send_success ? $send_success . "份邀请发送成功;" : ""; $send_result .= $send_failed ? $send_failed . "份邀请发送失败。" : ""; $this->Messager("{$send_result}", '', 5); }
function Main() { $member = jsg_member_info(MEMBER_ID); $_act_list = array('imjiqiren' => 1, 'qqrobot' => 1, 'sms' => 1, 'sina' => 1, 'qqwb' => 1); if (isset($_act_list[$this->Code])) { $this->Messager(null, "index.php?mod=tools&code={$this->Code}"); } if ('email' == $this->Code) { $this->Messager(null, 'index.php?mod=settings&code=base#modify_email_area'); } $act_list = array('base' => '我的资料', 'face' => '我的头像', 'secret' => '修改密码', 'user_tag' => array('name' => '我的标签', 'link_mod' => 'user_tag'), 'vip_intro' => array('name' => '申请V认证', 'link_mod' => 'other', 'link_code' => 'vip_intro')); if ($member['validate'] && $member['validate_extra']) { $act_list['validate_extra'] = '专题设置'; } if ($this->Config['sendmailday'] && $this->Config['sendmailday'] > 0) { $act_list['sendmail'] = '邮件提醒'; } if ($this->Config['vest_enable']) { $act_list['vest'] = '我的马甲'; } $this->Code = $act = $this->Code ? $this->Code : 'base'; $member_nickname = $member['nickname']; if ('face' == $act) { if (true === UCENTER_FACE && true === UCENTER) { include_once ROOT_PATH . './api/uc_client/client.php'; $uc_avatarflash = uc_avatar(MEMBER_UCUID, 'avatar', 'returnhtml'); $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "members where `uid`='{$member['uid']}'"); $_member_info = $query->GetRow(); if ($member['uid'] > 0 && MEMBER_UCUID > 0 && !$_member_info['face']) { $uc_check_result = uc_check_avatar(MEMBER_UCUID); if ($uc_check_result) { $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "members set `face`='./images/noavatar.gif' where `uid`='{$member['uid']}'"); } } } elseif (true === UCENTER_FACE && true === PWUCENTER) { $pwuc_avatarflash = true; $pwurl_setuserface = UC_API . '/profile.php?action=modify&info_type=face'; } else { $temp_face = ''; if ($this->Get['temp_face'] && is_image($this->Get['temp_face'])) { $temp_face = $this->Get['temp_face']; $member['face_original'] = $temp_face; } } } elseif ('base' == $act) { $op = jget('op'); $groupProfile = jconf::get('groupprofile'); $sql = "select * from `" . TABLE_PREFIX . "memberfields` where `uid`='{$member['uid']}'"; $query = $this->DatabaseHandler->Query($sql); $memberfields = $query->GetRow(); if (!$memberfields) { $memberfields = array(); $memberfields['uid'] = $member['uid']; $sql = "insert into `" . TABLE_PREFIX . "memberfields` (`uid`) values ('{$member['uid']}')"; $this->DatabaseHandler->Query($sql); } $privacy = array(); if ($memberfields['profile_set']) { $privacy = unserialize($memberfields['profile_set']); } #附加信息 $member_profile = DB::fetch_first("select * from `" . TABLE_PREFIX . "members_profile` where `uid` = '{$member['uid']}'"); if ($member_profile) { if ($member_profile['birthcity']) { $birthcity = explode('-', $member_profile['birthcity']); $b_province = $birthcity[0]; $b_city = $birthcity[1]; $b_area = $birthcity[2]; $b_street = $birthcity[3]; } $member = array_merge($member_profile, $member); } $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list"); while ($rsdb = $query->GetRow()) { $province[$rsdb['id']]['value'] = $rsdb['id']; $province[$rsdb['id']]['name'] = $rsdb['name']; if ($member['province'] == $rsdb['name']) { $province_id = $rsdb['id']; } } $b_province_list = jform()->Select("b_province", $province, $b_province, "onchange=\"changeProvince('b');\""); if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $this->Config['company_enable']) { if ($member['companyid']) { $canmod = false; } else { $canmod = true; } $companyselect = $this->CpLogic->get_cp_html($member['companyid'], 'company', 0, $canmod); if ($this->Config['department_enable']) { if ($member['departmentid']) { $danmod = false; } else { $danmod = true; } $departmentselect = $this->CpLogic->get_cp_html($member['departmentid'], 'department', $member['companyid'], $danmod); } if ($member['jobid']) { $janmod = false; } else { $janmod = true; } $jobselect = jlogic('job')->get_job_select($member['jobid'], $janmod); $morcompanys = $this->CpLogic->get_cp_users(); } $gender_radio = jform()->Radio('gender', array(1 => array('name' => '男', 'value' => 1), 2 => array('name' => '女', 'value' => 2)), $member['gender']); $_options = array('0' => array('name' => '请选择', 'value' => '0'), '身份证' => array('name' => '身份证', 'value' => '身份证'), '学生证' => array('name' => '学生证', 'value' => '学生证'), '军官证' => array('name' => '军官证', 'value' => '军官证'), '护照' => array('name' => '护照', 'value' => '护照'), '营业执照' => array('name' => '营业执照', 'value' => '营业执照'), '官方公函' => array('name' => '官方公函', 'value' => '官方公函'), '驾驶证' => array('name' => '驾驶证', 'value' => '驾驶证'), '其他' => array('name' => '其他', 'value' => '其他')); $validate_card_type_select = jform()->Select('validate_card_type', $_options, $memberfields['validate_card_type']); $province_list = jform()->Select("province", $province, $province_id, "onchange=\"changeProvince();\""); if ($province_id) { if ($member['city']) { $hid_city = DB::result_first("select `id` from " . TABLE_PREFIX . "common_district where name = '{$member['city']}' and upid = '{$province_id}'"); } if ($hid_city) { if ($member['area']) { $hid_area = DB::result_first("select `id` from " . TABLE_PREFIX . "common_district where name = '{$member['area']}' and upid = '{$hid_city}'"); } if ($hid_area) { if ($member['street']) { $hid_street = DB::result_first("select `id` from " . TABLE_PREFIX . "common_district where name = '{$member['street']}' and upid = '{$hid_area}'"); } } } } } elseif ('user_medal' == $act) { if ($this->Config[sina_enable] && sina_weibo_init($this->Config)) { $sina = sina_weibo_has_bind(MEMBER_ID); } if ($this->Config[imjiqiren_enable] && imjiqiren_init($this->Config)) { $imjiqiren = imjiqiren_has_bind(MEMBER_ID); } if ($this->Config[sms_enable] && sms_init($this->Config)) { $sms = sms_has_bind(MEMBER_ID); } if ($this->Config[qqwb_enable] && qqwb_init($this->Config)) { $qqwb = qqwb_bind_icon(MEMBER_ID); } $sql = "select MD.medal_img , MD.medal_name , UM.* from `" . TABLE_PREFIX . "user_medal` UM left join `" . TABLE_PREFIX . "medal` MD on UM.medalid=MD.id where UM.uid='" . MEMBER_ID . " ' "; $query = $this->DatabaseHandler->Query($sql); $medal_list = array(); $medal_ids = array(); while (false != ($row = $query->GetRow())) { $medal_list[] = $row; $medal_ids[$row['medalid']] = $row['medalid']; } $medal_ids_str = implode(",", $medal_ids); $_member = DB::fetch_first("select * from " . TABLE_PREFIX . "members where `uid`='" . MEMBER_ID . "'"); if ($medal_ids_str != $_member['medal_id']) { $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "members set medal_id='{$medal_ids_str}' where `uid`='" . MEMBER_ID . "'"); } } elseif ('exp' == $act) { $experience = jconf::get('experience'); $exp_list = $experience['list']; $mylevel = $member['level']; $my_credits = $member['credits']; foreach ($exp_list as $v) { if ($my_credits >= $v['start_credits']) { $my_level = $v['level']; } } if ($mylevel != $my_level) { $sql = "update `" . TABLE_PREFIX . "members` set `level`='{$my_level}' where `uid`='" . MEMBER_ID . "'"; $this->DatabaseHandler->Query($sql); $sql = "select `level` from `" . TABLE_PREFIX . "members` where `uid`='" . MEMBER_ID . "' "; $query = $this->DatabaseHandler->Query($sql); $members = $query->GetRow(); $member['level'] = $members['level']; } $my_level_begin_credits = $exp_list[$my_level]['start_credits']; $next_level = $my_level + 1; $next_level_begin_credits = $exp_list[$next_level]['start_credits']; $my_exp = $my_credits - $my_level_begin_credits; $nex_exp = $next_level_begin_credits - $my_level_begin_credits; $level_width_arr = array('1' => '27', '2' => '31', '3' => '45', '4' => '51', '5' => '62', '6' => '68', '7' => '77', '8' => '82', '9' => '93', '10' => '107'); $level_width = $my_exp * $level_width_arr[$my_level] / $nex_exp; $exp_width_arr = array('1' => '15', '2' => '41', '3' => '72', '4' => '116', '5' => '166', '6' => '229', '7' => '296', '8' => '372', '9' => '451', '10' => '545'); $exp_width = 100 * (($level_width + $exp_width_arr[$my_level]) / 569); $nex_exp_credit = $next_level_begin_credits - $my_credits; } elseif ('validate_extra' == $act) { $sql = "select `validate_extra` from `" . TABLE_PREFIX . "memberfields` where `uid` = '" . MEMBER_ID . "' "; $query = $this->DatabaseHandler->Query($sql); $memberfields = $query->GetRow(); $meb_fields = @unserialize($memberfields['validate_extra']); if ($meb_fields['vote']) { $sql = "select * from `" . TABLE_PREFIX . "vote` where `uid` = '" . MEMBER_ID . "' order by `vid` desc limit 0,10 "; $query = $this->DatabaseHandler->Query($sql); $vote_list = array(); while (false != ($row = $query->GetRow())) { $vote_list[] = $row; } } Load::logic('validate_extra'); $this->ValidateExtraLogic = new ValidateExtraLogic(); $uid = MEMBER_ID; $extra = $this->ValidateExtraLogic->get_info($uid); $id = $extra['id']; $data = $extra['data']; } elseif ('qqrobot' == $act) { if (empty($member['qq'])) { $qq_code = $member['uid'] . "j" . md5($member['password'] . $member['username']); } } elseif ('extcredits' == $act) { if (!$this->Config['extcredits_enable']) { $this->Messager("积分功能未启用", null); } $this->Title = '积分管理'; $this->MetaKeywords = '积分兑换,积分管理,积分规则,积分详情'; $this->MetaDescription = '积分兑换,积分管理,积分规则,积分详情'; $top_credit_members = jlogic('mall')->get_top_member_credits(); $feeds = jlogic('feed')->get_feed(5, "`action`='兑换了'"); $config = jconf::get('mall'); $css['rule'] = ' class="current"'; $credits_config = $this->Config['credits']; $_default_credits = array(); $_enable = false; if (is_array($credits_config) && count($credits_config)) { foreach ($credits_config['ext'] as $_k => $_v) { if ($_v['enable']) { $_enable = true; if ($_v['default']) { $_default_credits[$_k] = $_v['default']; } } } } if (!$_enable) { $this->Messager("积分未设置", null); } $op = $this->Get['op']; $op_lists = array('base' => '我的积分', 'detail' => '积分详情', 'rule' => '积分规则'); $op = isset($op_lists[$op]) ? $op : 'base'; if ('base' == $op) { $_search = $_replace = array(); for ($i = 1; $i <= 8; $i++) { $k = 'extcredits' . $i; $_search[$k] = '$member[' . $k . ']'; $_replace[$k] = ' 0 '; if (isset($credits_config['ext'][$k]) && $credits_config['ext'][$k]['enable']) { $_replace[$k] = $credits_config['ext'][$k]['name']; } } $_search['topic_count'] = '$member[topic_count]'; $_replace['topic_count'] = '发微博数量'; $credits_config_formula = str_replace($_search, $_replace, $credits_config['formula']); } elseif ('log' == $op) { $query = $this->DatabaseHandler->Query("select R.rulename,R.action,R.related,RL.* from " . TABLE_PREFIX . "credits_rule_log RL left join " . TABLE_PREFIX . "credits_rule R on R.rid=RL.rid where RL.`uid`='" . MEMBER_ID . "'"); $log_list = array(); while ($row = $query->GetRow()) { $log_list[$row['action']] = $row; } if ($_default_credits) { $log_list['default_credits'] = $_default_credits; $log_list['default_credits']['rulename'] = '注册时的初始积分'; $log_list['default_credits']['total'] = $log_list['default_credits']['cyclenum'] = 1; } $_counts = array(); foreach ($log_list as $k => $row) { $row['dateline'] = $row['dateline'] ? my_date_format($row['dateline'], 'm-d H:i') : ' - '; foreach ($credits_config['ext'] as $_k => $_v) { if (!in_array($k, array('attach_down', 'down_my_attach', 'convert', 'unconvert'))) { $row[$_k] = $row[$_k] * $row['total']; } $_counts[$_k] += $row[$_k]; } if (strpos($row['action'], '_C') !== false || strpos($row['action'], '_D') !== false) { $row['related'] = jlogic('channel')->id2subject($row['related']); } $log_list[$k] = $row; } } elseif ('detail' == $op) { $uid = MEMBER_ID; $rule = jconf::get('credits_rule'); foreach ($rule as $key => $value) { $rule_id[$value['rid']] = $value['rulename']; } $credits_field = array(); foreach ($GLOBALS['_J']['config']['credits']['ext'] as $key => $value) { $credits_field[] = $key; } $list = jtable('credits_log')->get(array('sql_where' => "uid = {$uid}", 'sql_order' => 'id desc', 'page_num' => 20)); foreach ($list['list'] as $key => $value) { $log_list[$key]['rid'] = $value['rid']; $log_list[$key]['rulename'] = $rule_id[$value['rid']]; $log_list[$key]['dateline'] = $value['dateline'] ? my_date_format($value['dateline'], 'm-d H:i') : ' - '; foreach ($credits_field as $k => $v) { $log_list[$key][$v] = $value[$v]; } if (strpos($value['remark'], '[a]') && strpos($value['remark'], '发布') === 0) { $t = explode('[a]', $value['remark']); $t1 = $t[1]; $t = parse_url($t[1]); $t = $t['query']; parse_str($t, $out); $log_list[$key]['remark'] = "发布微博【微博ID:<a href='{$t1}' target='_blank'>{$out[code]}</a>】"; $log_list[$key]['detail_remark'] = "发布微博【微博ID:{$out['code']}】"; } else { $log_list[$key]['remark'] = strlen($value['remark']) > 30 ? mb_substr($value['remark'], 0, 30, $GLOBALS['_J']['charset']) . '...' : $value['remark']; $log_list[$key]['detail_remark'] = $value['remark']; } } } elseif ('rule' == $op) { if (!($credits_rule = jconf::get('credits_rule'))) { $sql = "select * from " . TABLE_PREFIX . "credits_rule order by rid"; $query = $this->DatabaseHandler->Query($sql); $credits_rule = array(); while (false != ($row = $query->GetRow())) { $v = false; foreach ($credits_config['ext'] as $_k => $_v) { if ($row[$_k]) { $v = true; break; } } if ($v) { foreach ($row as $k => $v) { if (!$v) { unset($row[$k]); } } $credits_rule[$row['action']] = $row; } } } $_cycletypes = array(0 => '一次性', 1 => '每天', 2 => '整点', 3 => '间隔分钟', 4 => '不限周期'); if ($_default_credits) { $credits_rule['default_credits'] = $_default_credits; $credits_rule['default_credits']['rulename'] = '注册时的初始积分'; $credits_rule['default_credits']['cycletype'] = 0; $credits_rule['default_credits']['rewardnum'] = 1; } $mall_enable = (int) jconf::get('mall', 'enable'); foreach ($credits_rule as $k => $v) { if ('unconvert' == $k || 'convert' == $k && empty($mall_enable)) { unset($credits_rule[$k]); } else { $v['cycletype'] = $_cycletypes[(int) $v['cycletype']]; if (!$v['rewardnum']) { $v['rewardnum'] = '不限次数'; } $credits_rule[$k] = $v; } } } else { $this->Messager("未定义的操作"); } } elseif ('imjiqiren' == $act) { define('IN_IMJIQIREN_MOD', true); include ROOT_PATH . 'modules/imjiqiren.mod.php'; } elseif ('sms' == $act) { define('IN_SMS_MOD', true); include ROOT_PATH . 'modules/sms.mod.php'; } elseif ('qqwb' == $act) { if (!qqwb_init($this->Config)) { $this->Messager('腾讯微博功能未启用,请联系管理员', null); } $qqwb = jconf::get('qqwb'); $qqwb_bind_info = qqwb_bind_info(MEMBER_ID); if ($qqwb_bind_info) { if ($qqwb['is_synctopic_toweibo']) { $synctoqq_radio = jform()->YesNoRadio('synctoqq', (int) $qqwb_bind_info['synctoqq']); } } } elseif ('sina' == $act) { $profile_bind_message = ''; $xwb_start_file = ROOT_PATH . 'include/ext/xwb/sina.php'; if (!is_file($xwb_start_file)) { $profile_bind_message = '插件文件丢失,无法启动!'; } else { require $xwb_start_file; $profile_bind_message = '<a href="javascript:XWBcontrol.bind()">如果看不到新浪微博绑定设置窗口,请点击这里启动。</a>'; $GLOBALS['xwb_tips_type'] = 'bind'; $profile_bind_message .= jsg_sina_footer(); } } elseif ('email' == $act) { } else { if ('sendmail' == $act) { if (!$this->Config['sendmailday']) { $this->Messager('本站点尚未开启邮件提醒功能。', -1); } $member['user_notice_time'] = $member['user_notice_time'] ? $member['user_notice_time'] : 3; $sendtime[$member['user_notice_time']] = ' selected '; } else { if ('vest' == $act) { if (!$this->Config['vest_enable']) { $this->Messager('本站点尚未开启马甲功能。', -1); } if ($this->Config['vest_role'] && false == jsg_find($this->Config['vest_role'], $member['role_id'])) { $this->Messager('你所在的用户组没有添加马甲的权限', -1); } $vest = jlogic('member_vest')->get_member_vest(MEMBER_ID); } elseif ('plugin' == $act) { global $_J; $pluginid = jget('id'); if (!empty($pluginid)) { list($identifier, $module) = explode(':', $pluginid); $module = $module !== NULL ? $module : $identifier; } $plugin = jlogic('plugin')->pluginmodule($pluginid); if ($plugin[0]) { include $plugin[2]; $plugintemplate = $identifier . ':' . $module; $act_list['plugin'] = $plugin[1]; } else { $this->Messager($plugin[1]); } } } } if (empty($this->Title)) { $this->Title = $act_list[$act]; } if ('plugin' == $act) { include template('setting/plugin'); } elseif ('extcredits' == $act) { include template('mall_rule'); } else { include template('setting/setting_main'); } }
function Main() { $where_list = array(); $where = ""; $query_link = "admin.php?mod=sessions"; $p = max((int) $this->Get['page'], 1); $query_link .= "&page=" . $p; $pn = $this->Get['pn'] ? (int) $this->Get['pn'] : 20; if ($pn < 1 || $pn > 500) { $pn = 20; } $query_link .= '&pn=' . $pn; $uid = 0; $nickname = get_param('nickname'); if ($nickname) { $info = jsg_member_info($nickname, '', '`uid`'); $uid = $info['uid']; } $uid = $uid ? $uid : (int) get_param('uid'); if ($uid > 0) { $where_list[] = "uid = '{$uid}'"; $query_link .= "&uid={$uid}"; } $is_member_radio = $this->jishigou_form->YesNoRadio('is_member', $this->Get['is_member']); if (isset($this->Get['is_member'])) { $is_member = (int) $this->Get['is_member']; $where_list[] = $is_member > 0 ? "uid>0" : "uid=0"; } $ip = trim($this->Get['ip']); if (!empty($ip)) { $ip_l = explode('.', $ip); $ips = ''; $i = 0; $and = ''; foreach ($ip_l as $_ip) { $i++; if ($_ip == "*" || empty($_ip)) { continue; } $ips .= $and . "ip{$i}='{$_ip}'"; $and = " and "; } $where_list[] = $ips; } if ($this->Get['order_by']) { $query_link .= "&order_by=" . $this->Get['order_by']; } if ($this->Get['order_type']) { $query_link .= "&order_type=" . $this->Get['order_type']; } $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' '; $order_by_list = array('order_by_default' => 'slastactivity', 'slastactivity' => array('name' => '最后访问时间', 'order_by' => 'slastactivity'), 'ip' => array('name' => 'IP地址', 'order_by' => "concat_ws('.',ip1,ip2,ip3,ip4)"), 'uid' => array('name' => '用户ID', 'order_by' => 'uid')); $order_array = order($order_by_list, $query_link, array('display_un_href' => true)); $order = $order_array['order']; $order_html = $order_array['html']; $limit = ""; $offset = ($p - 1) * $pn; $sql = "SELECT count(1) total from " . TABLE_PREFIX . "sessions" . $where; $query = $this->DatabaseHandler->Query($sql); $row = $query->GetRow(); $total = $row['total']; $sql = "SELECT * from " . TABLE_PREFIX . "sessions" . $where . " " . $order . " limit {$offset},{$pn}"; $query = $this->DatabaseHandler->Query($sql); $session_list = array(); $uids = array(); $ips = array(); while (false != ($row = $query->GetRow())) { $row['dateline'] = my_date_format($row['slastactivity']); $row['ip'] = sprintf("%s.%s.%s.%s", $row['ip1'], $row['ip2'], $row['ip3'], $row['ip4']); if ($row['uid'] > 0) { $uids[$row['uid']] = $row['uid']; } $ips[$row['ip']] = $row['ip']; $session_list[] = $row; } $robot = array(); if ($ips && $this->Config['robot_enable']) { $sql = "SELECT `ip`, `name` from " . TABLE_PREFIX . "robot_ip where `ip` in ('" . implode("','", $ips) . "')"; $query = $this->DatabaseHandler->Query($sql, "SKIP_ERROR"); if ($query) { while (false != ($row = $query->GetRow())) { $robot[$row['ip']] = $row['name']; } } } $users = array(); if ($uids) { $query = DB::query("select `uid`, `username`, `nickname` from " . DB::table('members') . " where `uid` in ('" . implode("','", $uids) . "')"); while (false != ($row = DB::fetch($query))) { $users[$row['uid']] = $row; } } $pages = page($total, $pn, $query_link, array(), "10 20 50 100 200"); $action = "admin.php?mod=session&code=delete"; include template('admin/sessions'); }
function edit() { $tid = intval($this->Get['tid']); $topic_recd = $this->TopicRecommendLogic->get_info($tid); $channels = array(); if ($this->Config['channel_enable']) { $channels = $this->TopicRecommendLogic->recd_channels(); } if (!empty($topic_recd)) { $topic_recd['expiration'] = empty($topic_recd['expiration']) ? '' : my_date_format($topic_recd['expiration'], 'Y-m-d H:i'); $recd_html = $this->jishigou_form->Radio('recd[]', array(array("name" => "重点推荐", "value" => "4"), array("name" => "普通推荐", "value" => "2"), array("name" => "取消推荐", "value" => "0")), $topic_recd['recd']); } else { $recd_html = $this->jishigou_form->Radio('recd[]', array(array("name" => "重点推荐", "value" => "4"), array("name" => "普通推荐", "value" => "2")), 2); } include template('admin/recdtopic_edit'); }
function Export() { $this->CheckAdminPrivs('dbexport'); $filename=my_date_format(time(),'YmdHi').'_'.random(8); $shelldisabled = function_exists('shell_exec') ? '' : 'disabled'; $table_list = $this->_fetch_table_list(TABLE_PREFIX); $table_list_group=array_chunk($table_list,4); include handler('template')->file('@admin/db_export'); }
function getAttach($param) { $qid = $param['qid']; $attach_list = array(); $recd = array(); $sql = " SELECT ta.*,m.nickname FROM " . DB::table('topic_attach') . " ta\r\n\t\t\t\t LEFT JOIN " . DB::table('members') . " m ON m.uid = ta.uid\r\n\t\t\t\t WHERE ta.itemid='{$qid}' AND ta.item='qun'\r\n\t\t\t\t ORDER BY ta.id DESC "; $query = DB::query($sql); $count = 0; $candown = jclass('member')->HasPermission('uploadattach', 'down'); $canviewtype = array('doc', 'ppt', 'pdf', 'xls', 'txt', 'docx', 'xlsx', 'pptx'); while ($rsdb = DB::fetch($query)) { $count++; $rsdb['filetype'] = 'images/filetype/' . $rsdb['filetype'] . '.gif'; $rsdb['dateline'] = my_date_format($rsdb['dateline']); $rsdb['size'] = $rsdb['filesize'] > 1024 * 1024 ? round($rsdb['filesize'] / (1024 * 1024), 2) . 'MB' : round($rsdb['filesize'] / 1024, 1) . 'KB'; $rsdb['url'] = ($rsdb['site_url'] ? $rsdb['site_url'] : $GLOBALS['_J']['site_url']) . '/' . str_replace('./', '', $rsdb['file']); $rsdb['onlineview'] = $candown && in_array($rsdb['filetype'], $canviewtype) && $rsdb['score'] == 0 ? $rsdb['url'] : ''; $attach_list[] = $rsdb; } $return['attach_list'] = $attach_list; $return['count'] = $count; return $return; }
function wap_my_date_format($time, $format = 'm月d日 H时i分') { $now = time(); $t = $now - $time; if ($t >= 3600) { $time = my_date_format($time, $format); } elseif ($t < 3600 && $t >= 60) { $time = floor($t / 60) . "分钟前"; } else { $time = "刚刚"; } return $time; }
function ajherrorlog($type='',$log='',$halt=1) { $logfile = ROOT_PATH . 'errorlog/'.$type . '-' . date('Y-m').'.php'; if (!is_file($logfile)) { $log ="<? exit; ?>\r\n" . $log; } $log = "[".my_date_format(time(),"Y-m-d H:i:s")."]" . $log . "\r\n"; global $IoHandler; if(is_null($IoHandler)) { $load = new Load(); $load->lib('io'); $IoHandler = new IoHandler(); $log = " \r\n ------------------------------------------------------ \r\n " . $log; } if (!is_dir(dirname($logfile))) { $IoHandler->MakeDir(dirname($logfile)); } $IoHandler->WriteFile($logfile,$log,'a'); if($halt) { exit(); } }
function manage() { $tab = 'word'; $op = empty($this->Get['op']) ? '' : $this->Get['op']; if (empty($op)) { exit; } $vid = empty($this->Get['vid']) ? 0 : intval($this->Get['vid']); $vote = $this->VoteLogic->id2voteinfo($vid, 'm'); if ($vote['tab']) { $tab = 'pic'; } if (empty($vote) || $vote['verify'] == 0) { json_error('当前投票不存在或正在审核中'); } if (jdisallow($vote['uid'])) { json_error("你没有权限"); } if ($op == 'modify_date') { $exp_info = $this->VoteLogic->get_publish_form_param($vote['expiration']); extract($exp_info); } else { if ($op == 'edit_opt') { $info = $this->VoteLogic->get_option_by_vid($vid); $options = $info['option']; $option_num = count($info['option']); if (MEMBER_ROLE_TYPE != 'admin') { $is_voted = $this->VoteLogic->get_count_vote_user($vid); } } else { if ($op == 'edit') { $max_option = 50; $this->Get['arf'] = "edit"; $opt_info = $this->VoteLogic->get_option_by_vid($vid); $opts = $opt_info['option']; $vote['message'] = $this->VoteLogic->get_vote_field_message($vid); $options_num = count($opts); $maxchoice = array(); if ($options_num > 1) { $maxchoice = range(1, $options_num); } $perpage = ceil($options_num / 5) * 5; $options = range(1, $perpage); for ($i = $options_num; $i < $perpage; $i++) { $opts[$i]['picurl'] = 'images/none.png'; } $is_voted = $this->VoteLogic->get_count_vote_user($vid); $checked = array(); $checked['is_view'][$vote['is_view']] = 'checked="checked"'; $checked['recd'] = $vote['recd'] ? 'checked="checked"' : ''; $selected[$vote['maxchoice']] = 'selected="selected"'; $expiration = my_date_format($vote['expiration'], 'Y-m-d'); $hour_select = mk_time_select('hour', my_date_format($vote['expiration'], 'H')); $min_select = mk_time_select('min', my_date_format($vote['expiration'], 'i')); include template('vote/vote_edit'); exit; } } } include template('vote/vote_manage'); }