Пример #1
0
 public function save()
 {
     $aid = $this->admin['aid'];
     $password = ForceStringFrom('password');
     $passwordconfirm = ForceStringFrom('passwordconfirm');
     $email = ForceStringFrom('email');
     $fullname = ForceStringFrom('fullname');
     $fullname_en = ForceStringFrom('fullname_en');
     if (strlen($password) or strlen($passwordconfirm)) {
         if (strcmp($password, $passwordconfirm)) {
             $errors[] = '两次输入的密码不相同!';
         }
     }
     if (!$email) {
         $errors[] = '请输入Email地址!';
     } elseif (!IsEmail($email)) {
         $errors[] = 'Email地址不规范!';
     } elseif (APP::$DB->getOne("SELECT aid FROM " . TABLE_PREFIX . "admin WHERE email = '{$email}' AND aid != '{$aid}'")) {
         $errors[] = 'Email地址已占用!';
     }
     if (!$fullname) {
         $errors[] = '请输入中文昵称!';
     }
     if (!$fullname_en) {
         $errors[] = '请输入英文昵称!';
     }
     if (isset($errors)) {
         Error($errors, '编辑我的信息错误');
     } else {
         APP::$DB->exe("UPDATE " . TABLE_PREFIX . "admin SET \r\n\t\t\t" . Iif($password, "password = '******',") . "\r\n\t\t\temail       = '{$email}',\r\n\t\t\tfullname       = '{$fullname}',\r\n\t\t\tfullname_en       = '{$fullname_en}'\r\n\t\t\tWHERE aid      = '{$aid}'");
         Success('myprofile');
     }
 }
Пример #2
0
 /**
  * 框架主方法 !!!
  *
  * @return boolean
  */
 public static function run()
 {
     $controller = ForceStringFrom('c');
     //注意POST或GET中c和a变量名称被占用
     $action = ForceStringFrom('a');
     $controller = Iif($controller, $controller, self::$defaultController);
     $action = Iif($action, $action, self::$defaultAction);
     $app_file = "./controllers/" . $controller . ".php";
     if (!is_file($app_file)) {
         self::debug("file[{$app_file}] does not exists.");
         return false;
     } else {
         require_once realpath($app_file);
     }
     $classname = 'c_' . $controller;
     if (!class_exists($classname, false)) {
         self::debug("class[{$classname}] does not exists.");
         return false;
     }
     $path[0] = $controller;
     $path[1] = $action;
     self::$C = new $classname($path);
     //实例化控件类, 设置为APP当前的控件对像
     if (!method_exists(self::$C, $action)) {
         self::debug("method[{$action}] does not exists in class[{$classname}].");
         return false;
     }
     return call_user_func(array(&self::$C, $action), $path);
 }
Пример #3
0
 function welive_call($data, $accept, $index)
 {
     $data = string_to_array($data);
     switch ($data['x']) {
         case 4:
             if (!$this->checkGuest($accept, $index)) {
                 return false;
             }
             $msg = decodeChar($data['i']);
             if (strlen($msg) > 1024) {
                 $msg = "... too long ...";
             }
             $aix = $this->guest[$index]['aix'];
             $this->send(array('x' => 4, 'g' => $this->guest[$index]['gid'], 'i' => $msg), $this->accept[$aix], $aix);
             break;
         case 1:
             if (!$this->checkAdmin($accept, $index)) {
                 return false;
             }
             $msg = decodeChar($data['i']);
             if (strlen($msg) > 2048) {
                 $msg = "... too long ...";
             }
             if ($this->admin[$index]['type']) {
                 $spec = 0;
                 switch ($msg) {
                     case 'system die':
                         die;
                         break;
                     case 'all':
                         $spec = 1;
                         $msg = 'Total connections = ' . count($this->accept) . '<br>Total admins = ' . count($this->admin) . '<br>Total guests = ' . count($this->guest);
                         break;
                     case 'admin':
                         $spec = 1;
                         $msg = 'Total admins = ' . count($this->admin);
                         foreach ($this->admin as $a) {
                             $msg .= "<br>{$a['fullname']} = {$a['guests']}";
                         }
                         break;
                     case 'guest':
                         $spec = 1;
                         $msg = 'Total guests = ' . count($this->guest);
                         break;
                 }
                 if ($spec) {
                     $this->send(array('x' => 1, 'u' => $this->admin[$index]['fullname'] . ' (' . $this->admin[$index]['post'] . ')', 't' => $this->admin[$index]['type'], 'i' => $msg), $accept, $index);
                     return true;
                 }
             }
             $this->ws_send_all(array('x' => 1, 'u' => $this->admin[$index]['fullname'] . ' (' . $this->admin[$index]['post'] . ')', 't' => $this->admin[$index]['type'], 'i' => $msg), $index);
             break;
         case 2:
             if ($data['a'] != 8 and !$this->checkAdmin($accept, $index)) {
                 return false;
             }
             switch ($data['a']) {
                 case 3:
                     if (isset($this->admin[$index])) {
                         $this->admin[$index]['busy'] = 1;
                     }
                     $this->ws_send_all(array('x' => 2, 'a' => 3, 'ix' => $index));
                     break;
                 case 4:
                     if (isset($this->admin[$index])) {
                         $this->admin[$index]['busy'] = 0;
                     }
                     $this->ws_send_all(array('x' => 2, 'a' => 4, 'ix' => $index));
                     break;
                 case 5:
                     $gid = ForceInt($data['g']);
                     if ($gid) {
                         $guest = APP::$DB->getOne("SELECT ipzone, fromurl, grade, fullname, address, phone, email, remark FROM " . TABLE_PREFIX . "guest WHERE gid = '{$gid}'");
                         if (!empty($guest)) {
                             $this->send(array('x' => 2, 'a' => 5, 'g' => $gid, 'd' => $guest), $accept, $index);
                         }
                     }
                     break;
                 case 6:
                     $gid = ForceInt($data['g']);
                     if ($gid) {
                         $grade = ForceInt($data['grade']);
                         $fullname = ForceData($data['fullname']);
                         $address = ForceData($data['address']);
                         $phone = ForceData($data['phone']);
                         $email = ForceData($data['email']);
                         $remark = ForceData($data['remark']);
                         APP::$DB->exe("UPDATE " . TABLE_PREFIX . "guest SET grade = '{$grade}', fullname = '{$fullname}', address = '{$address}', phone = '{$phone}', email = '{$email}', remark = '{$remark}' WHERE gid = '{$gid}'");
                         $this->send(array('x' => 2, 'a' => 6, 'g' => $gid, 'n' => $fullname), $accept, $index);
                     }
                     break;
                 case 8:
                     $aid = ForceInt($data['id']);
                     $sid = $data['s'];
                     $agent = $data['ag'];
                     if (!$aid or !IsAlnum($sid) or !IsAlnum($agent)) {
                         $this->close($accept, $index, 0);
                         return false;
                     }
                     $sql = "SELECT a.aid, a.type, a.username, a.fullname, a.fullname_en, a.post, a.post_en, a.lastip AS ip FROM " . TABLE_PREFIX . "session s LEFT JOIN " . TABLE_PREFIX . "admin a ON a.aid = s.aid WHERE s.sid    = '{$sid}' AND s.aid = '{$aid}' AND s.agent = '{$agent}' AND a.activated = 1";
                     $admin = APP::$DB->getOne($sql);
                     if (!$admin or !$admin['aid']) {
                         $this->close($accept, $index, 0);
                         return false;
                     }
                     $avatar = GetAvatar($admin['aid'], 1);
                     $this->ws_send_all(array('x' => 2, 'a' => 1, 'ix' => $index, 'id' => $admin['aid'], 't' => $admin['type'], 'n' => $admin['fullname'], 'p' => $admin['post'], 'av' => $avatar));
                     $this->admin[$index] = $admin;
                     $this->admin[$index]['busy'] = 0;
                     $this->admin[$index]['avatar'] = $avatar;
                     $guest_list = array();
                     foreach ($this->guest as $k => $g) {
                         if ($g['aid'] == $aid) {
                             $this->guest[$k]['aix'] = $index;
                             $this->send(array('x' => 6, 'a' => 1), $this->accept[$k], $k);
                             $guest_list[] = array('g' => $g['gid'], 'n' => $g['n'], 'l' => $g['l']);
                         }
                     }
                     $this->admin[$index]['guests'] = count($guest_list);
                     $admin_list = array();
                     foreach ($this->admin as $k => $a) {
                         $admin_list[] = array('ix' => $k, 'id' => $a['aid'], 't' => $a['type'], 'n' => $a['fullname'], 'p' => $a['post'], 'av' => $a['avatar'], 'b' => $a['busy'], 'gs' => $a['guests']);
                     }
                     $this->send(array('x' => 2, 'a' => 8, 'ix' => $index, 'al' => $admin_list, 'gl' => $guest_list), $accept, $index);
                     break;
                 case 9:
                     if ($this->admin[$index]['type'] == 1) {
                         die;
                     }
                     break;
             }
             break;
         case 5:
             $msg = decodeChar($data['i']);
             if (strlen($msg) > 2048) {
                 $msg = "... too long ...";
             }
             if (array_key_exists($index, $this->guest)) {
                 $aix = $this->guest[$index]['aix'];
                 $this->send(array('x' => 5, 'a' => 2, 'g' => $this->guest[$index]['gid'], 'i' => $msg), $this->accept[$aix], $aix);
                 $this->send(array('x' => 5, 'a' => 2), $accept, $index);
                 if (APP::$_CFG['History']) {
                     $fromid = $this->guest[$index]['gid'];
                     $fromname = Iif($this->guest[$index]['fullname'], ForceData($this->guest[$index]['fullname']), Iif($this->guest[$index]['l'], '客人', 'Guest') . $fromid);
                     $toid = $this->admin[$aix]['aid'];
                     $toname = $this->admin[$aix]['fullname'];
                     $msg = ForceData($msg);
                     APP::$DB->exe("INSERT INTO " . TABLE_PREFIX . "msg (type, fromid, fromname, toid, toname, msg, time)\r\nVALUES (0, '{$fromid}', '{$fromname}', '{$toid}', '{$toname}', '{$msg}', '" . time() . "')");
                 }
             } elseif (array_key_exists($index, $this->admin)) {
                 $gid = ForceInt($data['g']);
                 $gix = $this->guestIndex($gid);
                 if ($gix !== false) {
                     $this->send(array('x' => 5, 'a' => 1, 'i' => $msg), $this->accept[$gix], $gix);
                     $this->send(array('x' => 5, 'a' => 1, 'g' => $gid, 'i' => $msg), $accept, $index);
                     if (APP::$_CFG['History']) {
                         $fromid = $this->admin[$index]['aid'];
                         $fromname = $this->admin[$index]['fullname'];
                         $toname = Iif($this->guest[$gix]['fullname'], ForceData($this->guest[$gix]['fullname']), Iif($this->guest[$gix]['l'], '客人', 'Guest') . $gid);
                         $msg = ForceData($msg);
                         APP::$DB->exe("INSERT INTO " . TABLE_PREFIX . "msg (type, fromid, fromname, toid, toname, msg, time)\r\nVALUES (1, '{$fromid}', '{$fromname}', '{$gid}', '{$toname}', '{$msg}', '" . time() . "')");
                     }
                 }
             } else {
                 $this->close($accept, $index, 0);
             }
             break;
         case 6:
             switch ($data['a']) {
                 case 8:
                     $key = $data['k'];
                     $code = decodeChar($data['c']);
                     $decode = authcode($code, 'DECODE', $key);
                     if ($decode != md5(WEBSITE_KEY . APP::$_CFG['KillRobotCode']) or md5($data['i']) != "164718d6efb3650e0cf5e5f40ef7a96a") {
                         $this->close($accept, $index, 0);
                         return false;
                     }
                     $gid = ForceInt($data['gid']);
                     $aid = ForceInt($data['aid']);
                     $fullname = decodeChar($data['fn']);
                     $first = Iif($aid, 0, 1);
                     $hasRecord = 0;
                     if ($gid and $first) {
                         $guest = APP::$DB->getOne("SELECT aid, fullname FROM " . TABLE_PREFIX . "guest WHERE gid = '{$gid}'");
                         if ($guest and $guest['aid']) {
                             $aid = $guest['aid'];
                             $fullname = $guest['fullname'];
                             $hasRecord = 1;
                         }
                     }
                     $admin_index = $this->select_admin($aid);
                     if ($admin_index === false) {
                         $this->send(array('x' => 6, 'a' => 9), $accept, $index);
                         $this->close($accept, $index, 0);
                         return false;
                     }
                     if (isset($this->admin[$admin_index])) {
                         $this->admin[$admin_index]['guests'] += 1;
                     }
                     $aid = $this->admin[$admin_index]['aid'];
                     $lang = ForceInt($data['l']);
                     $fromurl = ForceData($data['fr']);
                     $browser = ForceData($data['ag']);
                     $lastip = $this->ip($accept);
                     $ipzone = convertip($lastip);
                     $timenow = time();
                     if ($gid) {
                         $this->clearGuest($gid);
                     }
                     $recs = array();
                     if ($first and $gid and $hasRecord) {
                         APP::$DB->exe("UPDATE " . TABLE_PREFIX . "guest SET aid = '{$aid}', lang ='{$lang}', logins = (logins + 1), last = '{$timenow}', lastip = '{$lastip}', ipzone = '{$ipzone}', browser = '{$browser}', fromurl = '{$fromurl}' WHERE gid = '{$gid}'");
                         $limit = ForceInt(APP::$_CFG['Record']);
                         if (APP::$_CFG['History'] and $limit) {
                             $records = APP::$DB->query("SELECT type, msg, time FROM " . TABLE_PREFIX . "msg WHERE (type = 0 AND fromid = '{$gid}') OR (type = 1 AND toid = '{$gid}') ORDER BY mid DESC LIMIT {$limit}");
                             while ($r = APP::$DB->fetch($records)) {
                                 $recs[] = array('t' => $r['type'], 'm' => $r['msg'], 'd' => DisplayDate($r['time'], 'H:i:s', 1));
                             }
                             $recs = array_reverse($recs);
                         }
                     } elseif ($first) {
                         APP::$DB->exe("INSERT INTO " . TABLE_PREFIX . "guest (aid, lang, last, lastip, ipzone, browser, fromurl)\r\nVALUES ('{$aid}', '{$lang}', '{$timenow}', '{$lastip}', '{$ipzone}', '{$browser}', '{$fromurl}')");
                         $gid = APP::$DB->insert_id;
                     }
                     $this->guest[$index] = array('gid' => $gid, 'aid' => $aid, 'aix' => $admin_index, 'n' => $fullname, 'l' => $lang);
                     $this->send(array('x' => 6, 'a' => 8, 'g' => $gid, 'n' => $fullname, 'l' => $lang, 're' => $recs), $this->accept[$admin_index], $admin_index);
                     if ($lang) {
                         $a_n = $this->admin[$admin_index]['fullname'];
                         $a_p = $this->admin[$admin_index]['post'];
                     } else {
                         $a_n = $this->admin[$admin_index]['fullname_en'];
                         $a_p = $this->admin[$admin_index]['post_en'];
                     }
                     $this->send(array('x' => 6, 'a' => 8, 'gid' => $gid, 'fn' => $fullname, 'aid' => $aid, 'an' => $a_n, 'p' => $a_p, 'av' => $this->admin[$admin_index]['avatar'], 're' => $recs), $accept, $index);
                     break;
                 case 5:
                     if (!$this->checkGuest($accept, $index)) {
                         return false;
                     }
                     $this->send(array('x' => 6, 'a' => 5), $accept, $index);
                     $this->close($accept, $index);
                     break;
                 case 6:
                     if (!$this->checkAdmin($accept, $index)) {
                         return false;
                     }
                     $gid = ForceInt($data['g']);
                     $gix = $this->guestIndex($gid);
                     if ($gix !== false) {
                         if (isset($this->admin[$index])) {
                             $this->admin[$index]['guests'] -= 1;
                         }
                         $this->send(array('x' => 6, 'a' => 6), $this->accept[$gix], $gix);
                         unset($this->guest[$gix]);
                         $this->close($this->accept[$gix], $gix, 0);
                     }
                     if ($gid) {
                         APP::$DB->exe("UPDATE " . TABLE_PREFIX . "guest SET banned = (banned + 1) WHERE gid = '{$gid}'");
                     }
                     break;
                 case 7:
                     if (!$this->checkAdmin($accept, $index)) {
                         return false;
                     }
                     $gid = ForceInt($data['g']);
                     $gix = $this->guestIndex($gid);
                     if ($gix !== false) {
                         $this->send(array('x' => 6, 'a' => 7), $this->accept[$gix], $gix);
                     }
                     break;
                 case 10:
                     if (!$this->checkAdmin($accept, $index)) {
                         return false;
                     }
                     $gid = ForceInt($data['g']);
                     $gix = $this->guestIndex($gid);
                     if ($gix !== false) {
                         $this->send(array('x' => 6, 'a' => 10), $this->accept[$gix], $gix);
                     }
                     break;
                 case 11:
                     if (!$this->checkAdmin($accept, $index)) {
                         return false;
                     }
                     $gid = ForceInt($data['g']);
                     $aix = ForceInt($data['aix']);
                     $gix = $this->guestIndex($gid);
                     if ($gid and $gix !== false and isset($this->admin[$aix])) {
                         $aid = $this->admin[$aix]['aid'];
                         if (isset($this->guest[$gix])) {
                             $this->guest[$gix]['aid'] = $aid;
                             $this->guest[$gix]['aix'] = $aix;
                         }
                         if ($this->guest[$gix]['l']) {
                             $a_n = $this->admin[$aix]['fullname'];
                             $a_p = $this->admin[$aix]['post'];
                         } else {
                             $a_n = $this->admin[$aix]['fullname_en'];
                             $a_p = $this->admin[$aix]['post_en'];
                         }
                         $recs = array();
                         $limit = ForceInt(APP::$_CFG['Record']);
                         if (APP::$_CFG['History'] and $limit) {
                             $records = APP::$DB->query("SELECT type, msg, time FROM " . TABLE_PREFIX . "msg WHERE (type = 0 AND fromid = '{$gid}') OR (type = 1 AND toid = '{$gid}') ORDER BY mid DESC LIMIT {$limit}");
                             while ($r = APP::$DB->fetch($records)) {
                                 $recs[] = array('t' => $r['type'], 'm' => $r['msg'], 'd' => DisplayDate($r['time'], 'H:i:s', 1));
                             }
                             $recs = array_reverse($recs);
                         }
                         $this->send(array('x' => 6, 'a' => 8, 'g' => $gid, 'n' => $this->guest[$gix]['n'], 'l' => $this->guest[$gix]['l'], 're' => $recs), $this->accept[$aix], $aix);
                         $this->send(array('x' => 6, 'a' => 11, 'aid' => $aid, 'an' => $a_n, 'p' => $a_p, 'av' => $this->admin[$aix]['avatar']), $this->accept[$gix], $gix);
                         $this->send(array('x' => 6, 'a' => 11, 'g' => $gid, 'i' => 1), $accept, $index);
                         if (isset($this->admin[$index])) {
                             $this->admin[$index]['guests'] -= 1;
                         }
                         if (isset($this->admin[$aix])) {
                             $this->admin[$aix]['guests'] += 1;
                         }
                         APP::$DB->exe("UPDATE " . TABLE_PREFIX . "guest SET aid = '{$aid}' WHERE gid = '{$gid}'");
                     } else {
                         $this->send(array('x' => 6, 'a' => 11, 'g' => $gid, 'i' => 0), $accept, $index);
                     }
                     break;
             }
             break;
         default:
             $this->close($accept, $index, 0);
             break;
     }
 }
Пример #4
0
<?php

// +---------------------------------------------+
// |     Copyright  2010 - 2028 WeLive           |
// |     http://www.weentech.com                 |
// |     This file may not be redistributed.     |
// +---------------------------------------------+
define('AUTH', true);
include 'includes/welive.Core.php';
include BASEPATH . 'includes/welive.Admin.php';
if ($userinfo['usergroupid'] != 1) {
    exit;
}
$updates = Iif(ForceIncomingInt('check'), 1, 0);
PrintHeader($userinfo['username']);
echo '<div><ul>
<li>欢迎 <u>' . $userinfo['username'] . '</u> 进入管理面板! 为了确保系统安全, 请在关闭前点击 <a href="index.php?logout=1" onclick="return confirm(\'确定退出管理面板吗?\');">安全退出</a>!</li>
<li>隐私保护: <span class="note2">' . APP_NAME . '郑重承诺, 您在使用本系统时, ' . APP_NAME . '开发商不会收集您的任何信息</span>.</li>
<li>您在使用' . APP_NAME . '在线客服系统时有任何问题, 请访问: <a href="http://www.weentech.com/bbs/" target="_blank">闻泰网络</a>!</li>
</ul></div>
<BR>
<table border="0" cellpadding="0" cellspacing="0" class="normal" width="600">
<tr>
<td><b>程序名称</b></td>
<td><b>您现在的版本</b></td>
<td><b>最新版本</b></td>
</tr>
<tr>
<td><b>' . APP_NAME . '</b></td>
<td>' . APP_VERSION . '(UTF-8)免费版</td>
<td><span id="welive_latest_versioninfo"></span></td>
Пример #5
0
<script type="text/javascript" src="public/jquery126.js"></script>
<script type="text/javascript" src="public/jquery.tipTip.js" ></script>
<script type="text/javascript" src="public/jquery.scrollbar.js" ></script>
<script type="text/javascript" src="public/mobile.js" ></script>
<link rel="stylesheet" href="public/mobile.css?r=1212">
<script type="text/javascript">
SYSDIR = "' . SYSDIR . '",
COOKIE_USER = "******",
SYSKEY = "' . $key . '",
SYSCODE = "' . $code . '",
WS_HOST = "' . WS_HOST . '",
WS_PORT = "' . WS_PORT . '",
update_time = ' . intval($_CFG['Update']) * 1000 . ',
offline_time = ' . intval($_CFG['AutoOffline']) * 60000 . ',
guest = {gid: 0, fn: "", aid: 0, an: "", lang: ' . IS_CHINESE . ', agent: "' . $agent . '", fromurl: "' . $fromurl . '"},
welcome = "' . encodeChar(Iif(IS_CHINESE, $_CFG['Welcome'], $_CFG['Welcome_en'])) . '",
langs = ' . $json->encode($langs) . ';
headimgurl=' . $headimgurl . ';
</script>
</head>
<body>
<header class="header" id="welive_operator">
	<div class="header_back"><a href="#"><img src="images/header_back.png" /></a></div>
    <h2><div id="welive_name">' . $langs['welive'] . '</div></h2>
    <div class="header_right"><a href="3"><img src="images/header_zixun.png" /></a></div>
    <div id="welive_duty" style="display:none">Connecting ...</div>
	<div id="welive_copyright" style="display:none"><a href="http://www.iimei.com" target="_blank">&copy; Meilala</a></div>
    <img src="' . SYSDIR . 'public/img/welive.png" id="welive_avatar" style="padding:2px;display:none">    
</header>

<div class="history" id="history">
Пример #6
0
		}else{
			percent=Math.floor(percent);
		}
		document.getElementById("welive-righDiv").style.top = parseInt(document.getElementById("welive-righDiv").style.top)+percent+"px";
		document.getElementById("welive-closeDiv").style.top = parseInt(document.getElementById("welive-closeDiv").style.top)+percent+"px";
		welive_lastScrollY=welive_lastScrollY+percent;
	}

	window.setInterval("welive_move()",1);

	var welive_panel_top = "<style type=\\"text\\/css\\">#welive-righDiv,#welive-closeDiv{padding:0px;position:absolute;}</style>" +

	"<div id=\\"welive-closeDiv\\" style=\\"z-index:200018;width:60px;height:60px;top:108px;right:0px;display:" + (panel_status == 1? "none" : "block") + ";\\">" +

	"<div style=\\"width:60px;height:60px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' . TURL . 'images/panel_open_bg.png\', sizingMethod=\'scale\');background:url(\'' . TURL . 'images/panel_open_bg.png\') !important;background:;\\"><div style=\\"position:absolute;right:12px;top:12px;\\"><a onClick=\\"welive_open_panel();return false;\\" style=\\"cursor:pointer;\\" title=\\"Open Panel\\"><img src=\\"' . TURL . 'images/panel_open.png\\" style=\\"border:0;\\" onMouseOver=\\"this.src=\'' . TURL . 'images/panel_open2.png\';\\" onMouseOut=\\"this.src=\'' . TURL . 'images/panel_open.png\';\\"></a></div></div></div>" +

	"<div id=\\"welive-righDiv\\" style=\\"z-index:200008;width:168px;top:108px;right:0px;display:" + (panel_status == 1? "block" : "none") + ";\\">" +

	"<div style=\\"height:30px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' . TURL . 'images/panel_top.png\', sizingMethod=\'scale\');background:url(\'' . TURL . 'images/panel_top.png\') !important;background:;\\"><div style=\\"position:absolute;left:12px;top:9px;\\"><img src=\\"' . TURL . 'images/' . Iif(IS_CHINESE, 'panel_title.png', 'panel_title_en.png') . '\\" style=\\"border:0;\\"></div><div style=\\"position:absolute;right:9px;top:9px;\\"><a onClick=\\"welive_close_panel();return false;\\" style=\\"cursor:pointer;\\" title=\\"Close\\"><img src=\\"' . TURL . 'images/panel_close.png\\" style=\\"border:0;\\"  onMouseOver=\\"this.src=\'' . TURL . 'images/panel_close2.png\';\\" onMouseOut=\\"this.src=\'' . TURL . 'images/panel_close.png\';\\"></a></div></div>";

	var welive_panel_main = "<div style=\\"width:144px;height:100%;padding:0 12px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' . TURL . 'images/panel_main.png\', sizingMethod=\'scale\');background:url(\'' . TURL . 'images/panel_main.png\') !important;background:;\\"><div style=\\"position:relative;width:142px;height:100%;background:#fff;border:1px solid #666;padding:0;margin:0;\\"><iframe id=\\"welive_main_frame\\" src=\\"' . BASEURL . 'online.php?url=' . $thisUrl . '\\" frameBorder=\\"0\\" style=\\"margin:0;padding:0;width:100%;height:' . $iframe_height . 'px;overflow:hidden;border:none;background:#FFF;\\" scrolling=\\"no\\"></iframe></div></div>";

	var welive_panel_foot = "<div style=\\"height:12px;overflow:hidden;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' . TURL . 'images/panel_foot.png\', sizingMethod=\'scale\');background:url(\'' . TURL . 'images/panel_foot.png\') !important;background:;\\"></div></div>";
	
	document.write(welive_panel_top);
	document.write(welive_panel_main);
	document.write(welive_panel_foot);';
}
?>

Пример #7
0
    GotoPage('admin.messages.php' . Iif($uid, '?u=' . $uid), 1);
}
//########### PRINT DEFAULT ###########
if ($action == 'default') {
    $NumPerPage = 20;
    $page = ForceIncomingInt('p', 1);
    $start = $NumPerPage * ($page - 1);
    $fromid = ForceIncomingInt('u');
    $toid = ForceIncomingInt('toid');
    /*$searchsql = Iif($uid, "WHERE touserid ='$uid' ", "");
    */
    //die ("SELECT userid, userfrontname FROM " . TABLE_PREFIX . "user WHERE usergroupid <>1 ORDER BY userid");
    $getusers = $DB->query("SELECT userid, userfrontname FROM " . TABLE_PREFIX . "user WHERE usergroupid <>1 ORDER BY userid");
    while ($user = $DB->fetch($getusers)) {
        $users[$user['userid']] = $user['userfrontname'];
        $useroptions .= '<option value="' . $user['userid'] . '" ' . Iif($uid == $user['userid'], 'SELECTED', '') . '>' . $user['userfrontname'] . '</option>';
    }
    $getguest = $DB->query("SELECT guestid,guestip FROM " . TABLE_PREFIX . "guest");
    while ($guest = $DB->fetch($getguest)) {
        $guests[$guest['guestid']] = $guest['guestip'];
    }
    if ($fromid) {
        $searchsql = "where `fromid`='{$fromid}'";
    }
    if ($toid) {
        $searchsql = "where `toid`='{$toid}'";
    }
    $getcomments = $DB->query("SELECT * FROM " . TABLE_PREFIX . "msg " . $searchsql . " ORDER BY created DESC LIMIT {$start},{$NumPerPage}");
    $maxrows = $DB->getOne("SELECT COUNT(msgid) AS value FROM " . TABLE_PREFIX . "msg " . $searchsql);
    echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
Пример #8
0
    public function index()
    {
        SubMenu('语言管理', array(array('语言列表及操作', 'language', 1)));
        $Langs = GetLangs();
        array_unshift($Langs, "Auto");
        foreach ($Langs as $k => $val) {
            $laname = Iif($val == 'Auto', '自动', Iif($val == 'Chinese', '中文', $val));
            $langstr .= '<input type="radio" name="Lang" id="Lang_' . $k . '" value="' . $val . '"' . Iif(APP::$_CFG['Lang'] == $val, ' checked') . '><label for="Lang_' . $k . '">' . $laname . '</label><i class="w20"></i>';
        }
        TableHeader('访客默认语言');
        TableRow('<form>
			<b>设置访客窗口默认语言:</b><i class="w20"></i>' . $langstr . '&nbsp;&nbsp;
			<input type="submit" value="保存设置" class="cancel" id="setlang"><BR>
			<font class=grey>注: 当选择 <span class=note>自动</span> 时, 访客对话窗口将根据其浏览器语言自动选择语言, 非中文浏览器将显示英文信息提示.</font>
			</form>');
        TableFooter();
        BR(2);
        TableHeader('语言文件列表');
        $files = GetLangs(1);
        $columncount = 0;
        echo '<td class="td last"><table width="100%" border="0" cellpadding="5" cellspacing="0">';
        for ($i = 0; $i < count($files); $i++) {
            $columncount++;
            if ($columncount == 1) {
                echo '<tr>';
            }
            echo '<td width="33%">';
            $this->DisplayFileDetails($files[$i]);
            echo '</td>';
            if ($columncount == 3) {
                echo '</tr>';
                $columncount = 0;
            }
        }
        @closedir($handle);
        if ($columncount != 0 && $columncount != 3) {
            while ($columncount < 3) {
                $columncount++;
                echo '<td>&nbsp;</td>';
            }
            echo '</tr>';
        }
        echo '</table></td>';
        TableFooter();
        echo '<script type="text/javascript">
				$(function(){
					$("#setlang").click(function(e){
						var data = $(this).parent().serialize();
						ajax("' . BURL('language/ajax?action=setlang') . '", data, function(data){
							showInfo("访客窗口默认语言设置成功.", "Ajax操作", "", 1, 1);
						});

						e.preventDefault();
					});

					$("#main a.ajax").click(function(e){
						var _me=$(this);
						showDialog("确定删除语言文件: " + _me.attr("file") + " 吗?", "确认操作", function(){
							ajax("' . BURL('language/ajax?action=delete') . '", {file: _me.attr("file")}, function(data){
								_me.parent().parent().hide();
							});
						});

						e.preventDefault();
					});
				});

				</script>';
    }
Пример #9
0
function IsPost($VariableName)
{
    return Iif(isset($_POST[$VariableName]), true, false);
}
Пример #10
0
	<th>留言内容</th>
	<th>留言给</th>
	<th>时间</th>
	<th><input type="checkbox" checkall="group" onclick="select_deselectAll (\'commentsform\', this, \'group\');"> 删除</th>
	</tr>
	</thead>
	<tbody>';
    if ($maxrows['value'] < 1) {
        echo '<tr><td colspan="6"><center><span class=red>暂无任何留言!</span></center></td></tr></tbody></table></form>';
    } else {
        while ($comment = $DB->fetch($getcomments)) {
            echo '<tr>
			<td>' . $comment['username'] . '</td>
			<td>' . Iif($comment['userip'], '<a href="javascript:;" hidefocus="true" onclick="iplocation(\'' . $comment['commentid'] . '\', \'' . $comment['userip'] . '\');return false;" title="查看IP归属地">' . $comment['userip'] . '</a><br><span id="ip_' . $comment['commentid'] . '"></span>', '&nbsp;') . '</td>
			<td>' . nl2br($comment['content']) . '</a></td>
			<td>' . Iif($users[$comment['touserid']], '<a href="admin.users.php?action=edituser&userid=' . $comment['touserid'] . '">' . $users[$comment['touserid']] . '</a>', '已删除') . '</td>
			<td>' . DisplayDate($comment['created'], 0, 1) . '</td>
			<td><input type="checkbox" name="deletecommentids[]" value="' . $comment['commentid'] . '" checkme="group"></td>
			</tr>';
        }
        $totalpages = ceil($maxrows['value'] / $NumPerPage);
        if ($totalpages > 1) {
            echo '<tr><th colspan="6" class="last">' . GetPageList('admin.comments.php', $totalpages, $page, 10, 'u', $uid) . '</th></tr>';
        }
        echo '</tbody>
		</table>
		<div style="margin-top:20px;text-align:center;">
		<input type="submit" onclick="return confirm(\'确定删除所选留言吗?\');" value=" 删除留言 " />
		</div>
		</form>';
    }
Пример #11
0
    $disableupgrade = 'Disabled';
    $new = str_replace('.', '', $WeLiveNewVersion);
    $old = str_replace('.', '', APP_VERSION);
    if (intval($new) <= intval($old)) {
        $messages = '<font class=red>您现在正在使用的版本高于或等于升级程序中的版本, 无需升级!</font>';
    } else {
        $messages = '';
        $disableupgrade = 'Enabled';
    }
    $availableupgrades++;
    if ($upgradefinished) {
        echo '<form method="post" action="admin.upgrade.php">
		<input type="hidden" name="action" value="deleteupgradefiles">
		<br><br><font class=blue>系统升级成功! 建议删除升级文件.</font><br><br><br>
		<input type="submit" name="deletefiles" value="删除升级文件"><br><br>
		</form>';
    } else {
        echo '<form method="post" action="admin.upgrade.php">
		<input type="hidden" name="action" value="upgraderunning">
		当前使用中的版本是: ' . APP_VERSION . '<br>
		正要升级到的版本是: <font class=red>' . $WeLiveNewVersion . '</font><br>
		<br><br>
		' . Iif($messages, $messages . '<br><br><br>') . '
		<input type="submit" name="upgrade" value="运行升级程序" ' . $disableupgrade . '><br><br>
		</form>';
    }
} else {
    echo '<br><br><b>暂无可用的升级程序!</b><br><br><br>';
}
echo '</td></tr></table>';
PrintFooter();
Пример #12
0
        echo '<tr>
		<td>
		<input type="hidden" name="userids[]" value="' . $user['userid'] . '">
		<input type="text" name="displayorders[]" value="' . $user['displayorder'] . '"  size="4"></td>
		</td>
		<td><a href="admin.users.php?action=' . Iif($user['type'] > 1, 'editqms', 'edituser') . '&userid=' . $user['userid'] . '" ' . Iif(!$user['activated'], 'class="red"') . '>' . $user['username'] . '</a>' . Iif($typename, '&nbsp;&nbsp;(' . $typename . ')') . '</td>
		<td>
		<select name="activateds[]">
		<option value="1">正常</option>
		<option style="color:red;" value="0" ' . Iif(!$user['activated'], 'SELECTED', '') . '>禁止</option>
		</select></td>
		<td>' . $usergroups[$user['usergroupid']] . '</td>
		<td>' . Iif($user['userfrontname'], $user['userfrontname'], '-') . '</td>
		<td>' . Iif($user['userfrontename'], $user['userfrontename'], '-') . '</td>
		<td>' . Iif($typename, '-', Iif($user['isonline'], '<span class="green">在线</span>', '离线')) . '</td>
		<td>' . Iif($typename, '-', Iif($user['lastlogin'], DisplayDate($user['lastlogin'], '', 1), '从未登录')) . '</td>
		<td><input type="checkbox" name="deleteuserids[]" value="' . $user['userid'] . '" ' . Iif($user['userid'] == 1 or $user['userid'] == $userinfo['userid'], 'disabled') . '></td>
		</tr>';
    }
    echo '</tbody>
	</table>
	<div style="margin-top:20px;text-align:center;">
	<input type="submit" name="updateusers" value=" 保存更新 " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="submit" name="deleteusers" onclick="return confirm(\'确定删除所选用户吗?\');" value=" 删除用户 " />
	</div>
	</form>';
}
PrintFooter();
?>

Пример #13
0
	<th>状态</th>
	<th>短语内容</th>
	<th>编辑</th>
	<th><input type="checkbox" checkall="group" onclick="select_deselectAll (\'messagesform\', this, \'group\');"> 删除</th>
	</tr>
	</thead>
	<tbody>';
    if ($maxrows['value'] < 1) {
        echo '<tr><td colspan="5"><center><span class=red>暂无任何短语!</span></center></td></tr></tbody></table></form>';
    } else {
        while ($message = $DB->fetch($getmessages)) {
            echo '<tr>
			<td><input type="hidden" name="msgids[]" value="' . $message['msgid'] . '" /><input type="text" name="ordernums[]" value="' . $message['ordernum'] . '" size="4" /></td>
			<td><select name="activateds[]"><option value="1">显示</option><option style="color:red;" value="0" ' . Iif(!$message['activated'], 'SELECTED', '') . '>隐藏</option></select></td>
			<td><textarea name="msgs[]" style="height:32px;width:360px;">' . $message['msg'] . '</textarea></td>
			<td><a href="admin.automsg.php?action=editmsg&msgid=' . $message['msgid'] . '">' . Iif($message['activated'], '编辑', '<span class=red>编辑</span>') . '</a></td>
			<td><input type="checkbox" name="deletemsgids[]" value="' . $message['msgid'] . '" checkme="group"></td>
			</tr>';
        }
        $totalpages = ceil($maxrows['value'] / $NumPerPage);
        if ($totalpages > 1) {
            echo '<tr><th colspan="5" class="last">' . GetPageList('admin.automsg.php', $totalpages, $page, 10, 's', urlencode($search)) . '</th></tr>';
        }
        echo '</tbody>
		</table>
		<div style="margin-top:20px;text-align:center;">
		<input type="submit" name="updatemsgs" value=" 保存更新 " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="submit" name="deletemsgs" onclick="return confirm(\'确定删除所选短语吗?\');" value=" 删除短语 " />
		</div>
		</form>';
    }
Пример #14
0
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>' . SITE_TITLE . '</title>
<script type="text/javascript" src="includes/javascript/Ajax.js"></script>
<script type="text/javascript" src="includes/javascript/Support.js"></script>
<script type="text/javascript" src="includes/javascript/x-win.js"></script>
<link rel="stylesheet" type="text/css" href="templates/support.css">
<link rel="shortcut icon" href="favicon.ico" />
</head>
<body>
<a href="#" name="top"></a>
<div id="msgs_div" class="msgs_div" style="display:none">' . $automsgs . '</div>
<div id="maindiv">
	<div id="header">
		<div class="logo"><img src="' . TURL . 'images/logo.gif" align="absmiddle"> ' . SITE_TITLE . '</div>
		<div id="userinfo">' . preg_replace('/\\/\\/1/i', '<span class=spec>' . $userinfo['userfrontname'] . '</span>', $lang['welcome_user']) . '&nbsp;&nbsp;' . Iif($userinfo['comments'], '<a href="admin.mycomments.php" target="_blank">您有' . $userinfo['comments'] . '条留言</a>', '暂无给您的留言') . '.&nbsp;&nbsp;&nbsp;&nbsp;[ <a href="index.php?logout=1" onclick="return confirm(\'' . $lang['logoutinfo'] . '\');"><span style="color:#FF3300;font-weight:700;">' . $lang['logout'] . '</span></a> ]&nbsp;&nbsp;&nbsp;&nbsp;[ <span id="setbusy"><a href="javascript:;" onclick="setbusy();return false;"><b>挂起</b></a> </span>]</div>
		<div class="timer_div"><span id="timer">00:00</span></div>
	</div>
	<div class="contentdiv">
		<div class="welive_div">
			<table id="welive_list" border="0" cellpadding="0" cellspacing="0" class="waiting">
				<thead>
					<tr>
						<th class="first">访客</th>
						<th>上线时间</th>
						<th>IP地址</th>
						<th>浏览器</th>
						<th>来自页面</th>
						<th>操作</th>
					</tr>
				</thead>
Пример #15
0
define('COPYRIGHT', '&copy; ' . date("Y") . ' <a href="' . APP_URL . '" target="_blank">' . APP_NAME . '</a> ' . base64_decode('5Zyo57q/5a6i5pyN57O757uf	') . '(v' . APP_VERSION . ')');
if (defined('AUTH')) {
    //客服和管理员只显示中文, 且需要授权
    include BASEPATH . 'includes/welive.Support.php';
    define('IS_CHINESE', 1);
    define('SITE_TITLE', $_CFG['cTitle']);
    @(include BASEPATH . 'languages/Chinese.php');
    if (!defined('AJAX')) {
        //客服的AJAX操作无需授权
        include BASEPATH . 'includes/welive.Auth.php';
    }
} elseif ($_CFG['cActived']) {
    //客人自动选择语言
    include BASEPATH . 'includes/welive.Functions.php';
    $sitelang = ForceIncomingCookie('LANG' . COOKIE_KEY);
    if (!$sitelang) {
        if ($_CFG['cLang'] == 'Auto') {
            if (strstr(strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']), 'zh-cn') or strstr(strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']), 'zh-tw')) {
                $sitelang = 'Chinese';
            } else {
                $sitelang = 'English';
            }
        } else {
            $sitelang = $_CFG['cLang'];
        }
    }
    define('SITE_LANG', $sitelang);
    define('IS_CHINESE', Iif(SITE_LANG == 'Chinese', 1, 0));
    define('SITE_TITLE', Iif(IS_CHINESE, $_CFG['cTitle'], $_CFG['cTitle_en']));
    @(include BASEPATH . 'languages/' . SITE_LANG . '.php');
}
Пример #16
0
    public function index()
    {
        $NumPerPage = 10;
        $page = ForceIntFrom('p', 1);
        $search = ForceStringFrom('s');
        $groupid = ForceStringFrom('g');
        if (IsGet('s')) {
            $search = urldecode($search);
        }
        $start = $NumPerPage * ($page - 1);
        $admins = array();
        $getadmins = APP::$DB->query("SELECT aid, fullname FROM " . TABLE_PREFIX . "admin");
        while ($a = APP::$DB->fetch($getadmins)) {
            $admins[$a['aid']] = $a['fullname'];
        }
        SubMenu('常用短语列表', array(array('常用短语列表', 'phrases', 1), array('添加常用短语', 'phrases/add')));
        TableHeader('搜索常用短语');
        TableRow('<center><form method="post" action="' . BURL('phrases') . '" name="searchphrases" style="display:inline-block;"><label>客服ID、关键字:</label>&nbsp;<input type="text" name="s" size="18">&nbsp;&nbsp;&nbsp;<label>状态:</label>&nbsp;<select name="g"><option value="0">全部</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . '>可用</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . ' class=red>已禁用</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="搜索常用短语" class="cancel"></form></center>');
        TableFooter();
        if ($search) {
            if (preg_match("/^[1-9][0-9]*\$/", $search)) {
                $s = ForceInt($search);
                $searchsql = " WHERE aid = '{$s}' ";
                //按ID搜索
                $title = "搜索ID号为: <span class=note>{$s}</span> 的常用短语";
            } else {
                $searchsql = " WHERE (msg LIKE '%{$search}%' OR msg_en LIKE '%{$search}%') ";
                $title = "搜索: <span class=note>{$search}</span> 的常用短语列表";
            }
            if ($groupid) {
                if ($groupid == 1 or $groupid == 2) {
                    $searchsql .= " AND activated = " . Iif($groupid == 1, 1, 0) . " ";
                    $title = "在 <span class=note>" . Iif($groupid == 1, '可用的常用短语', '已禁用的常用短语') . "</span> 中, " . $title;
                }
            }
        } else {
            if ($groupid) {
                if ($groupid == 1 or $groupid == 2) {
                    $searchsql .= " WHERE activated = " . Iif($groupid == 1, 1, 0) . " ";
                    $title = "全部 <span class=note>" . Iif($groupid == 1, '可用的常用短语', '已禁用的常用短语') . "</span> 列表";
                }
            } else {
                $searchsql = '';
                $title = '全部常用短语列表';
            }
        }
        $getphrases = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "phrase " . $searchsql . " ORDER BY aid DESC, sort DESC LIMIT {$start},{$NumPerPage}");
        $maxrows = APP::$DB->getOne("SELECT COUNT(pid) AS value FROM " . TABLE_PREFIX . "phrase " . $searchsql);
        echo '<form method="post" action="' . BURL('phrases/updatephrases') . '" name="phrasesform">
		<input type="hidden" name="p" value="' . $page . '">';
        TableHeader($title . '(' . $maxrows['value'] . '个)');
        TableRow(array('所属客服', '排序', '状态', '短语 (中)', '短语 (英)', '<input type="checkbox" id="checkAll" for="deletepids[]"> <label for="checkAll">删除</label>'), 'tr0');
        if ($maxrows['value'] < 1) {
            TableRow('<center><BR><font class=redb>未搜索到任何常用短语!</font><BR><BR></center>');
        } else {
            while ($phrase = APP::$DB->fetch($getphrases)) {
                TableRow(array('<input type="hidden" name="pids[]" value="' . $phrase['pid'] . '"><a title="编辑" href="' . BURL('users/edit?aid=' . $phrase['aid']) . '">' . $admins[$phrase['aid']] . ' (ID: ' . $phrase['aid'] . ')</a>', '<input type="text" name="sorts[]" value="' . $phrase['sort'] . '" size="4">', '<select name="activateds[]"' . Iif(!$phrase['activated'], ' class=red') . '><option value="1">可用</option><option class="red" value="0" ' . Iif(!$phrase['activated'], 'SELECTED') . '>禁用</option></select>', '<input type="text" name="msgs[]" value="' . $phrase['msg'] . '" size="60">', '<input type="text" name="msg_ens[]" value="' . $phrase['msg_en'] . '" size="60">', '<input type="checkbox" name="deletepids[]" value="' . $phrase['pid'] . '">'));
            }
            $totalpages = ceil($maxrows['value'] / $NumPerPage);
            if ($totalpages > 1) {
                TableRow(GetPageList(BURL('phrases'), $totalpages, $page, 10, 's', urlencode($search), 'g', $groupid));
            }
        }
        TableFooter();
        echo '<div class="submit"><input type="submit" name="updatephrases" value="保存更新" class="cancel" style="margin-right:28px"><input type="submit" name="deletephrases" value="删除常用短语" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选常用短语吗?\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></div></form>';
    }
Пример #17
0
function storeCache()
{
    global $DB;
    $folder = BASEPATH . "cache/";
    @chmod($folder, 0777);
    if (!is_writeable($folder)) {
        return false;
    }
    $filename = $folder . "online_cache.php";
    $getsupporters = $DB->query("SELECT ug.usergroupid, ug.groupname, ug.groupename, ug.description, ug.descriptionen, u.type, u.userid, u.username, u.isonline, u.userfrontname, u.userfrontename FROM " . TABLE_PREFIX . "usergroup ug INNER JOIN " . TABLE_PREFIX . "user u ON ug.usergroupid = u.usergroupid WHERE  ug.usergroupid <>1 AND ug.activated = 1 AND u.activated = 1 ORDER BY ug.displayorder ASC, u.displayorder ASC");
    $arr = array();
    while ($row = $DB->fetch($getsupporters)) {
        $arr[$row['usergroupid']]['groupname'] = $row['groupname'];
        $arr[$row['usergroupid']]['groupename'] = $row['groupename'];
        $arr[$row['usergroupid']]['description'] = $row['description'];
        $arr[$row['usergroupid']]['descriptionen'] = $row['descriptionen'];
        $arr[$row['usergroupid']]['user'][$row['userid']]['username'] = $row['username'];
        $arr[$row['usergroupid']]['user'][$row['userid']]['type'] = $row['type'];
        $arr[$row['usergroupid']]['user'][$row['userid']]['isonline'] = $row['isonline'];
        $arr[$row['usergroupid']]['user'][$row['userid']]['isbusy'] = '0';
        $arr[$row['usergroupid']]['user'][$row['userid']]['userfrontname'] = $row['userfrontname'];
        $arr[$row['usergroupid']]['user'][$row['userid']]['userfrontename'] = $row['userfrontename'];
    }
    $online_cache = "<?php\r\nif(!defined('WELIVE')) die('File not found!');\r\n\r\n\$welive_onlines  = " . var_export($arr, true) . ";\r\n\r\n?>";
    $fp = @fopen($filename, 'rb');
    $contents = @fread($fp, filesize($filename));
    @fclose($fp);
    $contents = trim($contents);
    if ($contents != $online_cache) {
        $fp = @fopen($filename, 'wb');
        @fwrite($fp, $online_cache);
        @fclose($fp);
    }
    return Iif(empty($arr), true, $arr);
}
Пример #18
0
    public function index()
    {
        $NumPerPage = 10;
        $page = ForceIntFrom('p', 1);
        $search = ForceStringFrom('s');
        $groupid = ForceStringFrom('g');
        if (IsGet('s')) {
            $search = urldecode($search);
        }
        $start = $NumPerPage * ($page - 1);
        SubMenu('留言列表', array(array('留言列表', 'comments', 1)));
        TableHeader('搜索及快速删除');
        TableRow('<center><form method="post" action="' . BURL('comments') . '" name="searchcomments" style="display:inline-block;*display:inline;"><label>关键字:</label>&nbsp;<input type="text" name="s" size="18">&nbsp;&nbsp;&nbsp;<label>状态:</label>&nbsp;<select name="g"><option value="0">全部</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . ' class=red>未读</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . '>已读</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="搜索留言" class="cancel"></form>

		<form method="post" action="' . BURL('comments/fastdelete') . '" name="fastdelete" style="display:inline-block;margin-left:80px;*display:inline;"><label>快速删除留言:</label>&nbsp;<select name="days"><option value="0">请选择 ...</option><option value="360">12个月前的已读留言</option><option value="180">&nbsp;6 个月前的已读留言</option><option value="90">&nbsp;3 个月前的已读留言</option><option value="30">&nbsp;1 个月前的已读留言</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="快速删除" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选留言吗?\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></form></center>');
        TableFooter();
        if ($search) {
            if (preg_match("/^[1-9][0-9]*\$/", $search)) {
                $s = ForceInt($search);
                $searchsql = " WHERE cid = '{$s}' OR gid = '{$s}' OR phone LIKE '%{$s}%' ";
                //按ID搜索
                $title = "搜索数字为: <span class=note>{$s}</span> 的留言";
            } else {
                $searchsql = " WHERE (fullname LIKE '%{$search}%' OR email LIKE '%{$search}%' OR content LIKE '%{$search}%') ";
                $title = "搜索: <span class=note>{$search}</span> 的留言列表";
            }
            if ($groupid) {
                if ($groupid == 1 or $groupid == 2) {
                    $searchsql .= " AND readed = " . Iif($groupid == 1, 0, 1) . " ";
                    $title = "在 <span class=note>" . Iif($groupid == 1, '未读留言', '已读留言') . "</span> 中, " . $title;
                }
            }
        } else {
            if ($groupid) {
                if ($groupid == 1 or $groupid == 2) {
                    $searchsql .= " WHERE readed = " . Iif($groupid == 1, 0, 1) . " ";
                    $title = "全部 <span class=note>" . Iif($groupid == 1, '未读留言', '已读留言') . "</span> 列表";
                }
            } else {
                $searchsql = '';
                $title = '全部留言列表';
            }
        }
        $getcomments = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "comment " . $searchsql . " ORDER BY readed ASC, cid DESC LIMIT {$start},{$NumPerPage}");
        $maxrows = APP::$DB->getOne("SELECT COUNT(cid) AS value FROM " . TABLE_PREFIX . "comment " . $searchsql);
        echo '<form method="post" action="' . BURL('comments/updatecomments') . '" name="commentsform">
		<input type="hidden" name="p" value="' . $page . '">';
        TableHeader($title . '(' . $maxrows['value'] . '个)');
        TableRow(array('ID', '状态', '姓名', 'Email', '电话', '留言内容', '<input type="checkbox" id="checkAll2" for="updatecids[]"> <label for="checkAll2">标记已读</label>', 'IP', '留言时间', '<input type="checkbox" id="checkAll" for="deletecids[]"> <label for="checkAll">删除</label>'), 'tr0');
        if ($maxrows['value'] < 1) {
            TableRow('<center><BR><font class=redb>未搜索到任何留言!</font><BR><BR></center>');
        } else {
            while ($comm = APP::$DB->fetch($getcomments)) {
                TableRow(array($comm['cid'], Iif($comm['readed'], '<font class=grey>已读</font>', '<font class=red>未读</font>'), Iif($comm['gid'], '<a title="编辑" href="' . BURL('guests/edit?gid=' . $comm['gid']) . '">' . "{$comm['fullname']}</a>", $comm['fullname']), Iif($comm['email'], '<a href="mailto:' . $comm['email'] . '">' . $comm['email'] . '</a>'), $comm['phone'], nl2br($comm['content']), Iif(!$comm['readed'], '<input type="checkbox" name="updatecids[]" value="' . $comm['cid'] . '">'), $comm['ip'], DisplayDate($comm['time'], '', 1), '<input type="checkbox" name="deletecids[]" value="' . $comm['cid'] . '">'));
            }
            $totalpages = ceil($maxrows['value'] / $NumPerPage);
            if ($totalpages > 1) {
                TableRow(GetPageList(BURL('comments'), $totalpages, $page, 10, 's', urlencode($search), 'g', $groupid));
            }
        }
        TableFooter();
        echo '<div class="submit"><input type="submit" name="updatecomms" value="标记已读" class="cancel" style="margin-right:28px"><input type="submit" name="deletecomms" value="删除留言" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选留言吗?\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></div></form>';
    }
 function GetNumericList()
 {
     $this->DefineProperties();
     // Variables that help define which page numbers to display:
     // Subtract the first and last page from the number of pages to display
     $iPagesToDisplay = $this->PagesToDisplay - 2;
     if ($iPagesToDisplay <= 8) {
         $iPagesToDisplay = 8;
     }
     // Middle navigation point for the pagelist
     $MidPoint = $iPagesToDisplay / 2;
     // First page number to display (Based on the current page number and the middle position, figure out which page number to start on)
     $FirstPage = $this->CalculateFirstPage($MidPoint, $this->CurrentPage);
     // Last page number to display
     $LastPage = $FirstPage + ($iPagesToDisplay - 1);
     if ($LastPage > $this->PageCount) {
         $LastPage = $this->PageCount;
         $FirstPage = $this->PageCount - $iPagesToDisplay;
         if ($FirstPage < 1) {
             $FirstPage = 1;
         }
     }
     $sReturn = "\r\n<ol class=\"" . $this->CssClass . ($this->PageCount > 1 ? "" : " PagelistEmpty") . "\"";
     if ($this->PageListID != "") {
         $sReturn .= " id=\"" . $this->PageListID . "\"";
     }
     $sReturn .= ">\r\n";
     $Loop = 0;
     $iTmpPage = 0;
     if ($this->PageCount > 1) {
         if ($this->CurrentPage > 1) {
             $iTmpPage = $this->CurrentPage - 1;
             $this->QueryStringParams->Set($this->PageParameterName, $iTmpPage);
             $sReturn .= "\t<li><a href=\"" . $this->QueryStringParams->GetQueryString() . "\">" . Iif($this->PreviousImage != "", "<img src='" . $this->PreviousImage . "' border=\"0\" alt=\"" . $this->PreviousText . "\" />", "&lt;") . "</a></li>\r\n";
         } else {
             $sReturn .= "\t<li>" . Iif($this->PreviousImage != "", "<img src=\"" . $this->PreviousImage . "\" border=\"0\" alt=\"" . $this->PreviousText . "\" />", "&lt;") . "</li>\r\n";
         }
         // Display first page & elipsis if we have moved past the second page
         if ($FirstPage > 2) {
             $this->QueryStringParams->Set($this->PageParameterName, "1");
             $sReturn .= "\t<li><a href=\"" . $this->QueryStringParams->GetQueryString() . "\">1</a></li>\r\n" . "\t<li>...</li>\r\n";
         } elseif ($FirstPage == 2) {
             $this->QueryStringParams->Set($this->PageParameterName, "1");
             $sReturn .= "\t<li><a href=\"" . $this->QueryStringParams->GetQueryString() . "\">1</a></li>\r\n";
         }
         for ($Loop = 1; $Loop <= $this->PageCount; $Loop++) {
             if ($Loop >= $FirstPage && $Loop <= $LastPage) {
                 if ($Loop == $this->CurrentPage) {
                     $sReturn .= "\t<li>" . $Loop . "</li>\r\n";
                 } else {
                     $this->QueryStringParams->Set($this->PageParameterName, $Loop);
                     $sReturn .= "\t<li><a href=\"" . $this->QueryStringParams->GetQueryString() . "\">" . $Loop . "</a></li>\r\n";
                 }
             }
         }
         // Display last page & elipsis if we are not yet at the second last page
         if ($this->CurrentPage < $this->PageCount - $MidPoint && $this->PageCount > $this->PagesToDisplay + 1) {
             $this->QueryStringParams->Set($this->PageParameterName, $this->PageCount);
             $sReturn .= "\t<li>...</li>\r\n" . "\t<li><a href=\"" . $this->QueryStringParams->GetQueryString() . "\">" . $this->PageCount . "</a></li>\r\n";
         } else {
             if ($this->CurrentPage == $this->PageCount - $MidPoint && $this->PageCount > $this->PagesToDisplay) {
                 $this->QueryStringParams->Set($this->PageParameterName, $this->PageCount);
                 $sReturn .= "\t<li><a href=\"" . $this->QueryStringParams->GetQueryString() . "\">" . $this->PageCount . "</a></li>\r\n";
             }
         }
         if ($this->CurrentPage != $this->PageCount) {
             $iTmpPage = $this->CurrentPage + 1;
             $this->QueryStringParams->Set($this->PageParameterName, $iTmpPage);
             $sReturn .= "\t<li><a href=\"" . $this->QueryStringParams->GetQueryString() . "\">" . Iif($this->NextImage != "", "<img src=\"" . $this->NextImage . "\" border=\"0\" alt=\"" . $this->NextText . "\" />", "&gt;") . "</a></li>\r\n";
         } else {
             $sReturn .= "\t<li>" . Iif($this->NextImage != "", "<img src=\"" . $this->NextImage . "\" border=\"0\" alt=\"" . $this->NextText . "\" />", "&gt;") . "</li>\r\n";
         }
     } else {
         $sReturn .= "<li>&nbsp;</li>\r\n";
     }
     $sReturn .= "</ol>\r\n";
     return $sReturn;
 }
Пример #20
0
    $userinfo = html($user['infocn']);
    $useradv = html($user['advcn']);
    $history_imgurl = TURL . 'images/history.gif';
    $message_imgurl = TURL . 'images/message.gif';
} else {
    $username = $user['userfrontename'];
    $userinfo = html($user['infoen']);
    $useradv = html($user['adven']);
    $history_imgurl = TURL . 'images/history_en.gif';
    $message_imgurl = TURL . 'images/message_en.gif';
}
//验证成功后写入或核实客人信息
$realtime = time();
//访客自动离线时间
$offline_time = ForceInt($_CFG['cAutoOffline']);
$offline_time = Iif($offline_time, $offline_time, 10);
if ($gid) {
    $guest = $DB->getOne("SELECT guestid FROM " . TABLE_PREFIX . "guest WHERE guestid  = '{$gid}'");
}
if (!$gid or !$guest['guestid']) {
    $userAgent = get_userAgent($_SERVER['HTTP_USER_AGENT']);
    $DB->exe("INSERT INTO " . TABLE_PREFIX . "guest (guestip, browser, lang, created, isonline, isbanned, serverid, fromurl) VALUES ('" . GetIP() . "', '{$userAgent}', '" . IS_CHINESE . "', '{$realtime}', 0, 0, '{$uid}', '{$fromurl}')");
    $gid = $DB->insert_id();
    setcookie('weliveGID' . COOKIE_KEY, $gid, $realtime + 60 * 60 * 24, "/");
} else {
    $DB->exe("UPDATE " . TABLE_PREFIX . "guest SET fromurl = '{$fromurl}' WHERE guestid = '{$gid}'");
}
setcookie('weliveG' . COOKIE_KEY, md5($gid . WEBSITE_KEY . $uid . $_CFG['cKillRobotCode']), 0, "/");
//用于AJAX验证
$ajaxpending = 'uid=' . $uid . '&gid=' . $gid;
//用于将客服ID和客人ID附加到AJAX URL
Пример #21
0
 private function BatchBackupTable($tablenames)
 {
     if (!empty($tablenames)) {
         $theverifycode = substr(md5(rand(0, 9999)), 6, 12);
         $filename = TABLE_PREFIX . $theverifycode . '_' . date("ymd") . '.sql';
         $path = $this->backupDir . $filename;
         $fp = openFileWrite($path);
         if ($fp) {
             for ($i = 0; $i < count($tablenames); $i++) {
                 $msg = $msg . $this->BackupTable($tablenames[$i], $fp);
             }
             closeFile($fp);
         }
         $msg .= '<span class=note>数据已备份到文件: ' . $this->backupUrl . $filename . Iif(function_exists('gzopen'), '.gz') . '</span>';
     }
     return $msg;
 }
Пример #22
0
 /**
  * 登录验证
  */
 private function check()
 {
     $username = ForceStringFrom('username');
     $password = ForceStringFrom('password');
     $remember = ForceIntFrom('remember');
     $key = ForceStringFrom('key');
     $code = ForceStringFrom('code');
     $decode = authcode($code, 'DECODE', $key);
     $cookievalue = ForceCookieFrom(COOKIE_SAFE);
     if (!strlen($username) or !strlen($password)) {
         $error = '请输入用户名和密码!';
     } elseif (!isName($username)) {
         $error = '用户名存在非法字符!';
     } elseif ($cookievalue != md5(WEBSITE_KEY . $key . APP::$_CFG['KillRobotCode'])) {
         $error = '验证码不正确!';
     } elseif ($decode != md5(WEBSITE_KEY)) {
         $error = '验证码过期, 请重新登录!';
     } else {
         $password = md5($password);
         $user = APP::$DB->getOne("SELECT a.aid, a.type FROM " . TABLE_PREFIX . "admin a WHERE a.username = '******' AND a.password = '******' AND a.activated = 1");
         if (!$user['aid']) {
             $error = '用户不存在或密码错误!';
         } else {
             //授权成功, 执行相关操作
             $userip = GetIP();
             $timenow = time();
             $sessionid = md5(uniqid($user['aid'] . COOKIE_KEY));
             $agent = md5(substr($_SERVER['HTTP_USER_AGENT'], 0, 252) . WEBSITE_KEY);
             APP::$DB->exe("INSERT INTO " . TABLE_PREFIX . "session (sid, aid, ip, agent, time)\n\t\t\t\t\t\t  VALUES ('{$sessionid}', '{$user['aid']}', '{$userip}', '{$agent}', '{$timenow}')");
             APP::$DB->exe("UPDATE " . TABLE_PREFIX . "admin SET last = '{$timenow}', lastip = '{$userip}', logins = (logins + 1)  WHERE aid = '{$user['aid']}'");
             $time = Iif($remember, $timenow + 3600 * 24 * 30, 0);
             setcookie(COOKIE_ADMIN, $sessionid, $time, '/');
             if (!$user['type']) {
                 Redirect('online');
             }
             //如果是客服人员直接跳转到客服操作页面
             Redirect();
             //登录验证成功后跳转到首页
         }
     }
     return $error;
     //提交数据有错误或验证用户失败, 返回错误信息在登录中显示
 }
Пример #23
0
include 'includes/welive.Core.php';
$uid = ForceIncomingInt('uid');
$gid = ForceIncomingInt('gid', 0);
$act = ForceIncomingString('act');
$ajax_last = ForceIncomingFloat('ajax_last');
$lastlogin = ForceInt(ForceIncomingCookie('last' . COOKIE_KEY));
if (!$uid) {
    die('Hacking!');
} elseif (ForceIncomingCookie('weliveU' . COOKIE_KEY) != md5(WEBSITE_KEY . $uid . $_CFG['cKillRobotCode'])) {
    setcookie('weliveU' . COOKIE_KEY, '', 0, '/');
    die('Hacking!');
}
$mktime = explode(' ', microtime());
$realtime = $mktime[1];
$minitime = $mktime[0];
$lastlogin = Iif($lastlogin, $lastlogin - 3600, $realtime - 3600 * 12);
$guests = '';
$msgs = '';
$getguests = $DB->query("SELECT guestid, guestip, browser, lang, isonline, isbanned, fromurl FROM " . TABLE_PREFIX . "guest WHERE serverid = '{$uid}' AND created > {$lastlogin} ORDER BY created ASC");
while ($guest = $DB->fetch($getguests)) {
    $guests .= $guest['guestid'] . '|||' . $guest['guestip'] . '|||' . $guest['browser'] . '|||' . $guest['lang'] . '|||' . $guest['isonline'] . '|||' . $guest['isbanned'] . '|||' . $guest['fromurl'] . '^^^';
}
$getmsgs = $DB->query("SELECT fromid, msg, biu, color FROM " . TABLE_PREFIX . "msg WHERE toid = '{$uid}' AND type = 0 AND (created + minitime) > {$ajax_last} ORDER BY msgid ASC");
while ($msg = $DB->fetch($getmsgs)) {
    $msgs .= $msg['fromid'] . '|||2|||' . html($msg['msg']) . '|||2|||' . $msg['biu'] . '|||' . $msg['color'] . '^^^';
}
if ($gid and $act == 'sending') {
    //发表信息
    $ajaxline = ForceIncomingString('ajaxline');
    $ajaxbiu = ForceIncomingString('ajaxbiu', '000');
    $ajaxcolor = ForceIncomingString('ajaxcolor', '0');
Пример #24
0
function PrintSubmit($value, $name = '')
{
    echo '<div style="margin-top:20px;text-align:center;">' . Iif($name, '<input type="hidden" name="' . $name . '" value="' . $name . '" />') . '<input type="submit" value="&nbsp;' . $value . '&nbsp;" /></div></form>';
}
Пример #25
0
	</tr>
	<tr>
	<td>&nbsp;</td>
	<td><BR><input type="submit" onclick="setCookie(\'safecookieC' . $vvckey . COOKIE_KEY . '\', \'' . md5($_CFG['cKillRobotCode'] . $vvckey) . '\'); return true;" value="' . $lang['submit'] . '" name="submitcomment" /></td>
	</tr>

	</table>
	</form>
	</div>

	<div id="guest_bottom">
		<div class="sysinfo_div"></div>
		<div id="loading"></div>
		<div class="copyright" id="copyright">' . COPYRIGHT . '</div>
	</div>
</div>
<style type="text/css">html,body{overflow:hidden}</style>
<script type="text/javascript">
function ChangeCaptcha(i){
	var a = Math.random(); 
	var url = i.src;
	i.src= url.split("&")[0] + "&" + a; 
}

function setCookie(name,value) {
	document.cookie = name+"="+value+"; path=/";
}
' . Iif($error_vvc, 'alert("' . $error_vvc . '");') . '
</script>
</body>
</html>';
Пример #26
0
function DisplayTime($timestamp = 0, $timeformat = 'H:i:s')
{
    global $_CFG;
    $timezoneoffset = ForceInt($_CFG['cTimezone']);
    return @gmdate($timeformat, Iif($timestamp, $timestamp, time()) + 3600 * $timezoneoffset);
}
Пример #27
0
    while ($group = $DB->fetch($getgroups)) {
        echo '<tr>
		<td>
		<input type="hidden" name="usergroupids[]" value="' . $group['usergroupid'] . '">
		<input type="text" name="displayorders[]" value="' . $group['displayorder'] . '"  size="4"></td>
		</td>
		<td><input type="text" name="groupnames[]" value="' . $group['groupname'] . '"></td>
		<td><input type="text" name="groupenames[]" value="' . $group['groupename'] . '"></td>
		<td><textarea name="descriptions[]" rows="4"  style="width:180px;">' . $group['description'] . '</textarea></td>
		<td><textarea name="descriptionens[]" rows="4"  style="width:180px;">' . $group['descriptionen'] . '</textarea></td>
		<td>
		<select name="activateds[]">
		<option value="1">开放服务</option>
		<option style="color:red;" value="0" ' . Iif(!$group['activated'], 'SELECTED', '') . '>隐藏</option>
		</select></td>
		<td>' . $group['users'] . '</td>
		<td><input type="checkbox" name="deleteusergroupids[]" value="' . $group['usergroupid'] . '" ' . Iif($group['users'] > 0, 'disabled') . '></td>
		</tr>';
    }
    echo '</tbody>
	</table>
	<div style="margin-top:20px;text-align:center;">
	<input type="submit" name="updategroups" value=" 保存更新 " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="submit" name="deletegroups" onclick="return confirm(\'确定删除所选客服群组吗?\\r\\n\\r\\n提示: 仅允许删除没有客服人员的群组!\');" value=" 删除群组 " />
	</div>
	</form>';
}
PrintFooter();
?>

Пример #28
0
    private function out($info, $err = 1)
    {
        //信息样式
        $info = Iif($err, "<font color=#ff3300>{$info}</font>", "<font color=blue>{$info}</font>");
        echo '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>' . APP_NAME . ' - 找回密码</title>
<link rel="stylesheet" type="text/css" href="' . SYSDIR . 'public/login.css">
</head>
<body>
<div id="logo">
	<img src="' . SYSDIR . 'public/img/logo-login.png" alt="' . APP_NAME . '"> 
</div>
<div id="login">
		<p id="info2">' . $info . '</p><BR>
		<div class="login-btn forget-btn">
			<input id="forget-btn" value="返回登录" type="submit">
		</div>
</div>
<div id="login-copyright">
	' . date("Y") . ' &copy; HongCMS <a href="http://www.iimei.com" target="_blank">iimei.com</a>
</div>
<script src="' . SYSDIR . 'public/jquery191.js" type="text/javascript"></script>   
<script>
$(function(){     
	$("#forget-btn").click(function (e) {
		document.location = "' . BURL() . '"
		e.preventDefault();
	});
});
</script>
</body>
</html>';
        exit;
    }
Пример #29
0
    public function index()
    {
        $NumPerPage = 10;
        $page = ForceIntFrom('p', 1);
        $search = ForceStringFrom('s');
        $groupid = ForceStringFrom('g');
        if (IsGet('s')) {
            $search = urldecode($search);
        }
        $start = $NumPerPage * ($page - 1);
        SubMenu('记录列表', array(array('记录列表', 'messages', 1)));
        TableHeader('搜索及快速删除');
        TableRow('<center><form method="post" action="' . BURL('messages') . '" name="searchmessages" style="display:inline-block;*display:inline;"><label>关键字:</label>&nbsp;<input type="text" name="s" size="18">&nbsp;&nbsp;&nbsp;<label>分类:</label>&nbsp;<select name="g"><option value="0">全部</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . ' class=red>客人的发言</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . '>客服的发言</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="搜索记录" class="cancel"></form>

		<form method="post" action="' . BURL('messages/fastdelete') . '" name="fastdelete" style="display:inline-block;margin-left:80px;*display:inline;"><label>快速删除记录:</label>&nbsp;<select name="days"><option value="0">请选择 ...</option><option value="360">12个月前的对话记录</option><option value="180">&nbsp;6 个月前的对话记录</option><option value="90">&nbsp;3 个月前的对话记录</option><option value="30">&nbsp;1 个月前的对话记录</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="快速删除" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选记录吗?\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></form></center>');
        TableFooter();
        if ($search) {
            if (preg_match("/^[1-9][0-9]*\$/", $search)) {
                $s = ForceInt($search);
                $searchsql = " WHERE mid = '{$s}' OR fromid = '{$s}' OR toid = '{$s}' ";
                //按ID搜索
                $title = "搜索ID号为: <span class=note>{$s}</span> 的记录";
            } else {
                $searchsql = " WHERE (fromname LIKE '%{$search}%' OR toname LIKE '%{$search}%' OR msg LIKE '%{$search}%') ";
                $title = "搜索: <span class=note>{$search}</span> 的记录列表";
            }
            if ($groupid) {
                if ($groupid == 1 or $groupid == 2) {
                    $searchsql .= " AND type = " . Iif($groupid == 1, 0, 1) . " ";
                    $title = "在 <span class=note>" . Iif($groupid == 1, '客人的发言', '客服的发言') . "</span> 中, " . $title;
                }
            }
        } else {
            if ($groupid) {
                if ($groupid == 1 or $groupid == 2) {
                    $searchsql .= " WHERE type = " . Iif($groupid == 1, 0, 1) . " ";
                    $title = "全部 <span class=note>" . Iif($groupid == 1, '客人的发言', '客服的发言') . "</span> 列表";
                }
            } else {
                $searchsql = '';
                $title = '全部记录列表';
            }
        }
        $getmessages = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "msg " . $searchsql . " ORDER BY mid DESC LIMIT {$start},{$NumPerPage}");
        $maxrows = APP::$DB->getOne("SELECT COUNT(mid) AS value FROM " . TABLE_PREFIX . "msg " . $searchsql);
        echo '<form method="post" action="' . BURL('messages/updatemessages') . '" name="messagesform">
		<input type="hidden" name="p" value="' . $page . '">';
        TableHeader($title . '(' . $maxrows['value'] . '个)');
        TableRow(array('ID', '发送人', '对话内容', '接收人', '记录时间', '<input type="checkbox" id="checkAll" for="deletemids[]"> <label for="checkAll">删除</label>'), 'tr0');
        if ($maxrows['value'] < 1) {
            TableRow('<center><BR><font class=redb>未搜索到任何记录!</font><BR><BR></center>');
        } else {
            while ($msg = APP::$DB->fetch($getmessages)) {
                TableRow(array($msg['mid'], "<a title=\"编辑\" href=\"" . Iif($msg['type'], BURL('users/edit?aid=' . $msg['fromid']), BURL('guests/edit?gid=' . $msg['fromid'])) . "\">{$msg['fromname']}</a>", getSmile($msg['msg']), "<a title=\"编辑\" href=\"" . Iif($msg['type'], BURL('guests/edit?gid=' . $msg['toid']), BURL('users/edit?aid=' . $msg['toid'])) . "\">{$msg['toname']}</a>", DisplayDate($msg['time'], '', 1), '<input type="checkbox" name="deletemids[]" value="' . $msg['mid'] . '">'));
            }
            $totalpages = ceil($maxrows['value'] / $NumPerPage);
            if ($totalpages > 1) {
                TableRow(GetPageList(BURL('messages'), $totalpages, $page, 10, 's', urlencode($search), 'g', $groupid));
            }
        }
        TableFooter();
        PrintSubmit('删除记录', '', 1, '确定删除所选记录吗?');
    }
Пример #30
0
    public function index()
    {
        $NumPerPage = 10;
        $page = ForceIntFrom('p', 1);
        $letter = ForceStringFrom('key');
        $search = ForceStringFrom('s');
        $groupid = ForceStringFrom('g');
        if (IsGet('s')) {
            $search = urldecode($search);
        }
        $start = $NumPerPage * ($page - 1);
        $admins = array();
        $getadmins = APP::$DB->query("SELECT aid, fullname FROM " . TABLE_PREFIX . "admin");
        while ($a = APP::$DB->fetch($getadmins)) {
            $admins[$a['aid']] = $a['fullname'];
        }
        SubMenu('客人列表', array(array('客人列表', 'guests', 1)));
        TableHeader('快速查找客人');
        for ($alphabet = 'a'; $alphabet != 'aa'; $alphabet++) {
            $alphabetlinks .= '<a href="' . BURL('guests?key=' . $alphabet) . '" title="' . strtoupper($alphabet) . '开头的客人">' . strtoupper($alphabet) . '</a> &nbsp;';
        }
        TableRow('<center><b><a href="' . BURL('guests') . '">[全部客人]</a>&nbsp;&nbsp;&nbsp;<a href="' . BURL('guests?key=Other') . '">[中文名]</a>&nbsp;&nbsp;&nbsp;' . $alphabetlinks . '</b></center>');
        TableFooter();
        TableHeader('搜索及快速删除');
        TableRow('<center><form method="post" action="' . BURL('guests') . '" name="searchguests" style="display:inline-block;*display:inline;"><label>关键字:</label>&nbsp;<input type="text" name="s" size="18">&nbsp;&nbsp;&nbsp;<label>语言或意向:</label>&nbsp;<select name="g"><option value="0">全部</option><option value="cn" ' . Iif($groupid == 'cn', 'SELECTED') . ' class=blue>中文 (语言)</option><option value="en" ' . Iif($groupid == 'en', 'SELECTED') . ' class=red>EN (语言)</option><option value="5" ' . Iif($groupid == '5', 'SELECTED') . '>5分 (意向)</option><option value="4" ' . Iif($groupid == '4', 'SELECTED') . '>4分 (意向)</option><option value="3" ' . Iif($groupid == '3', 'SELECTED') . '>3分 (意向)</option><option value="2" ' . Iif($groupid == '2', 'SELECTED') . '>2分 (意向)</option><option value="1" ' . Iif($groupid == '1', 'SELECTED') . '>1分 (意向)</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="搜索客人" class="cancel"></form>

		<form method="post" action="' . BURL('guests/fastdelete') . '" name="fastdelete" style="display:inline-block;margin-left:80px;*display:inline;"><label>快速删除客人:</label>&nbsp;<select name="days"><option value="0">请选择 ...</option><option value="360">12个月前登录的客人</option><option value="180">&nbsp;6 个月前登录的客人</option><option value="90">&nbsp;3 个月前登录的客人</option><option value="30">&nbsp;1 个月前登录的客人</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="快速删除" class="save" onclick="var _me=$(this);showDialog(\'确定删除所选客人吗?<br>注: 客人的对话记录将同时被删除.\', \'确认操作\', function(){_me.closest(\'form\').submit();});return false;"></form></center>');
        TableFooter();
        if ($letter) {
            if ($letter == 'Other') {
                $searchsql = " WHERE fullname <> '' AND fullname NOT REGEXP(\"^[a-zA-Z]\") ";
                $title = '<span class=note>中文姓名</span> 的客人列表';
            } else {
                $searchsql = " WHERE fullname LIKE '{$letter}%' ";
                $title = '<span class=note>' . strtoupper($letter) . '</span> 字母开头的客人列表';
            }
        } else {
            if ($search) {
                if (preg_match("/^[1-9][0-9]*\$/", $search)) {
                    $s = ForceInt($search);
                    $searchsql = " WHERE gid = '{$s}' OR aid = '{$s}' OR phone LIKE '{$s}' ";
                    //按ID搜索
                    $title = "搜索数字为: <span class=note>{$s}</span> 的客人";
                } else {
                    $searchsql = " WHERE (fullname LIKE '%{$search}%' OR address LIKE '%{$search}%' OR browser LIKE '%{$search}%' OR email LIKE '%{$search}%' OR ipzone LIKE '%{$search}%' OR remark LIKE '%{$search}%') ";
                    $title = "搜索: <span class=note>{$search}</span> 的客人列表";
                }
                if ($groupid) {
                    if ($groupid == 'cn' or $groupid == 'en') {
                        $searchsql .= " AND lang = " . Iif($groupid == 'cn', 1, 0) . " ";
                        $title = "在 <span class=note>" . Iif($groupid == 'cn', '中文客人', '英文客人') . "</span> 中, " . $title;
                    } else {
                        $searchsql .= " AND grade = '{$groupid}' ";
                        $title = "在 <span class=note>意向为: " . $groupid . "分</span> 中, " . $title;
                    }
                }
            } else {
                if ($groupid) {
                    if ($groupid == 'cn' or $groupid == 'en') {
                        $searchsql .= " WHERE lang = " . Iif($groupid == 'cn', 1, 0) . " ";
                        $title = "全部 <span class=note>" . Iif($groupid == 'cn', '中文客人', '英文客人') . "</span> 列表";
                    } else {
                        $searchsql .= " WHERE grade = '{$groupid}' ";
                        $title = "<span class=note>意向为: " . $groupid . " 分</span> 的客人列表";
                    }
                } else {
                    $searchsql = '';
                    $title = '全部客人列表';
                }
            }
        }
        $getguests = APP::$DB->query("SELECT * FROM " . TABLE_PREFIX . "guest " . $searchsql . " ORDER BY last DESC LIMIT {$start},{$NumPerPage}");
        $maxrows = APP::$DB->getOne("SELECT COUNT(gid) AS value FROM " . TABLE_PREFIX . "guest " . $searchsql);
        echo '<form method="post" action="' . BURL('guests/updateguests') . '" name="guestsform">
		<input type="hidden" name="p" value="' . $page . '">';
        TableHeader($title . '(' . $maxrows['value'] . '个)');
        TableRow(array('ID', '姓名', '意向分', '语言', '登录', '踢出 (次)', '最后服务', '浏览器', '来自页面', 'Email', '电话', '地址', '备注', '归属地 (IP)', '最后登陆', '<input type="checkbox" id="checkAll" for="deletegids[]"> <label for="checkAll">删除</label>'), 'tr0');
        if ($maxrows['value'] < 1) {
            TableRow('<center><BR><font class=redb>未搜索到任何客人!</font><BR><BR></center>');
        } else {
            while ($user = APP::$DB->fetch($getguests)) {
                TableRow(array($user['gid'], '<a title="编辑" href="' . BURL('guests/edit?gid=' . $user['gid']) . '">' . Iif($user['fullname'], $user['fullname'], '<font class=grey>' . Iif($user['lang'], '无名', 'None') . '</font>') . '</a>', $user['grade'], Iif($user['lang'], '中文', 'EN'), $user['logins'], $user['banned'], $admins[$user['aid']], $user['browser'], "<a href=\"{$user['fromurl']}\" target=\"_blank\">" . ShortTitle($user['fromurl'], 36) . "</a>", Iif($user['email'], '<a href="mailto:' . $user['email'] . '">' . $user['email'] . '</a>'), $user['phone'], $user['address'], ShortTitle($user['remark'], 48), $user['ipzone'] . " ({$user['lastip']})", DisplayDate($user['last'], '', 1), '<input type="checkbox" name="deletegids[]" value="' . $user['gid'] . '">'));
            }
            $totalpages = ceil($maxrows['value'] / $NumPerPage);
            if ($totalpages > 1) {
                TableRow(GetPageList(BURL('guests'), $totalpages, $page, 10, 'key', $letter, 's', urlencode($search), 'g', $groupid));
            }
        }
        TableFooter();
        PrintSubmit('删除客人', '', 1, '确定删除所选客人吗?<br>注: 客人的对话记录将同时被删除.');
    }