if (!in_array($l, $clForums)) { $clForums[] = $l; } if (!isset($clForumsUsers[$l])) { $clForumsUsers[$l] = array(); } } } $filterCrit = " NOT IN "; $filterIds = "({$CONF['forum_gridsquare']},{$CONF['forum_gallery']})"; if (!empty($showIds)) { $filterCrit = " IN "; $filterIds = "(" . implode(',', $showIds) . ")"; } if (isset($clForumsUsers)) { $closedForums = getAccess($clForums, $clForumsUsers, $user_id); } else { $closedForums = 'n'; } if ($closedForums != 'n') { $xtr = getClForums($closedForums, 'where', '', 'forum_id', 'and', '!='); } else { $xtr = ''; } $lPosts = array(); if ($user_sort == 1) { $orderBy = 'topic_id DESC'; } else { $orderBy = 'topic_last_post_id DESC'; } if ($cols = db_simpleSelect(0, $Tt, 'topic_last_post_id', 'forum_id', $filterCrit, $filterIds, $orderBy, $viewlastdiscussions)) {
function action_getPlaylist() { doPrint("got json playlist request"); //doPrint($_REQUEST); global $config; $data = getData(); if (isset($_REQUEST["move"]) and is_array($_REQUEST["move"])) { doPrint("reorderd playlist"); $newPlaylist = array(); foreach ($_REQUEST['move'] as $key) { $track = $data['playlist'][$key]; unset($data['playlist'][$key]); $newPlaylist[$key] = $track; } #add not moved ones to the end foreach ($data['playlist'] as $key => $track) { $newPlaylist[$key] = $track; } $data["playlist"] = $newPlaylist; storeData($data); } if (isset($_REQUEST["add"]) and is_array($_REQUEST["add"])) { if (!isset($_REQUEST["aktPath"])) { $_REQUEST["aktPath"] = ""; } $aktPath = strip_tags($_REQUEST["aktPath"]); $aktPath = stripslashes($_REQUEST["aktPath"]); foreach ($_REQUEST["add"] as $file) { $file = stripslashes($file); $file = trim($file); $allowed = getAccess($aktPath . "/" . $file); if (!$allowed) { doPrint("ip is not allowed to add " . $aktPath . "/" . $file); } elseif (file_exists($config["searchPath"] . $aktPath . "/" . $file)) { doPrint("added file " . $aktPath . "/" . $file); $data["playlist"] = playlistAdd($data["playlist"], $config["searchPath"] . $aktPath . "/" . $file); } elseif (strpos($file, "http://") === 0) { doPrint("added stream " . $file); $data["playlist"] = playlistAdd($data["playlist"], $file); } else { doPrint("action_getPlaylist(): dont know what to do with: " . $config["searchPath"] . $aktPath . "/" . $file); } } $data = recalcTotalPlaytime($data); storeData($data); } if (isset($_REQUEST["remove"]) and is_array($_REQUEST["remove"])) { foreach ($_REQUEST["remove"] as $token) { if (isset($data["playlist"][$token])) { doPrint("removed file " . $data["playlist"][$token]['title']); unset($data["playlist"][$token]); } } $data = recalcTotalPlaytime($data); storeData($data); } if (isset($_REQUEST["clear"])) { doPrint("pressed clear"); $data["playlist"] = array(); $data["totalTime"] = "0"; $data["cachedPic"] = ""; $data["playingPic"] = ""; $data["curTrack"] = ""; storeData($data); } if (isset($_REQUEST["shuffle"])) { doPrint("pressed shuffle"); shuffle($data["playlist"]); $newData = array(); foreach ($data["playlist"] as $blah) { $newData[$blah["token"]] = $blah; } $data["playlist"] = $newData; storeData($data); } if (isset($_REQUEST["sort"])) { doPrint("pressed sort"); $tmp = sortMultiArray($data["playlist"], "filename"); $newData = array(); foreach ($tmp as $blah) { $newData[$blah["token"]] = $blah; } $data["playlist"] = $newData; storeData($data); } if (isset($_REQUEST["loadPlaylist"]) and is_file($config["plDir"] . $_REQUEST["loadPlaylist"])) { doPrint("loading playlist: " . $_REQUEST["loadPlaylist"]); if (!preg_match("/\\w+ - .*\\.playlist/", $_REQUEST["loadPlaylist"])) { doPrint("invalid playlist: " . $_REQUEST["loadPlaylist"]); exit; } $files = file($config["plDir"] . $_REQUEST["loadPlaylist"]); $playlist = array(); foreach ($files as $file) { $file = trim($file); if (substr($file, 0, 8) == "STREAM::") { $playlist = playlistAdd($playlist, substr($file, 8)); } else { $playlist = playlistAdd($playlist, $config["searchPath"] . $file); } } $data["playlist"] = $playlist; storeData($data); } $playlist = array(); foreach ($data['playlist'] as $key => $entry) { if (empty($key) or !isset($entry["filename"])) { continue; } $playlist[] = array("tracknum" => $entry['tracknum'], "artist" => utf8_encode($entry['artist']), "album" => utf8_encode($entry['album']), "title" => utf8_encode($entry['title']), "length" => $entry['length'], "token" => $entry['token'], "file" => utf8_encode($entry['filename'])); } if (count($playlist) > 0) { $data = json_encode($playlist); echo '({"total":"' . count($playlist) . '","results":' . $data . '})'; } else { echo '({"total":"0", "results":""})'; } }
/** * Обработчик действия: Комментирование альбома. */ function AddComment() { if (!getAccess("comment")) { return false; } if (empty($_REQUEST['captcha']) || md5(strtolower($_REQUEST['captcha'])) != A_Session::get('captcha')) { $this->errors['captcha'] = true; return false; } A_Session::unregister('captcha'); $data = array(); $data['date'] = time(); $data['idsec'] = SECTION_ID; $data['iduser'] = A::$AUTH->id; $data['iditem'] = $this->idalb; $data['name'] = strip_tags($_REQUEST['name']); $data['bbcode'] = $_REQUEST['message']; $data['message'] = parse_bbcode($data['bbcode']); $data['active'] = A::$OPTIONS['cactive'] ? 'N' : 'Y'; if (empty($data['name']) || empty($data['message'])) { return false; } if ($id = A::$DB->Insert(DOMAIN . "_comments", $data)) { $count = A::$DB->getCount(DOMAIN . "_comments", "idsec=" . SECTION_ID . " AND iditem={$this->idalb}"); A::$DB->execute("UPDATE " . SECTION . "_albums SET comments={$count} WHERE id={$this->idalb}"); $link = gallery_createItemLink($this->idalb, SECTION); if (!empty(A::$OPTIONS['cemail'])) { if (!empty(A::$OPTIONS['commenttpl'])) { $item = A::$DB->getRowById($this->idalb, SECTION . "_albums"); $item['link'] = "http://" . HOSTNAME . $link; $mail = new A_Mail(A::$OPTIONS['commenttpl'], "html"); $mail->Assign("item", $item); $mail->Assign("comment", $data); $mail->send(A::$OPTIONS['cemail']); } } if (A::$OPTIONS['cactive']) { A::goUrl($link . '?newcomment=1'); } else { A::goUrl($link); } } else { return false; } }
function getDataTableSACA() { $keyAccess = getAccess(); $conexion = odbc_connect("Driver={SQL Server Native Client 10.0};Server={$keyAccess['2']};Database={$keyAccess['3']};", $keyAccess[0], $keyAccess[1]); $result = odbc_exec($conexion, "USE WauReports"); $result = odbc_exec($conexion, "EXEC GetChargesSA"); $r = odbc_fetch_object($result); $result2 = odbc_exec($conexion, "GetpercentageSA"); $r2 = odbc_fetch_object($result2); $body = "<tr><td align=\"center\"> SANIC </td><td align=\"right\">" . number_format($r->SANIC) . "</td><td align=\"right\">" . number_format($r2->SANIC) . "</td><td align=\"right\"> " . number_format($r->SANIC * 100 / $r2->SANIC); $body = $body . "%</td></tr>"; $body = $body . "<tr><td align=\"center\"> SAPAN </td><td align=\"right\">" . number_format($r->SAPAN) . "</td><td align=\"right\">" . number_format($r2->SAPAN) . "</td><td align=\"right\"> "; $body = $body . "%</td></tr>"; return $body; }
if (!class_exists('Oauth')) { die("oauth extension is mising\n"); } if ($_SERVER['argc']==1) { getStatus(); } else switch($_SERVER['argv'][1]) { case 'register': if ($_SERVER['argc']==4) { register($_SERVER['argv'][2], $_SERVER['argv'][3]); } else { Help(); } break; case 'access': getAccess(); break; case 'help': Help(); break; default: if ($_SERVER['argc']==2) { setStatus($_SERVER['argv'][1]); } else { Help(); } }
//error_log("checkRetJson:".var_export($checkRetJson,1)." \n\n",3,"/tmp/wm_debug.log"); $checkRet = json_decode($checkRetJson, true); //error_log("checkRet:".var_export($checkRet,1)." \n\n",3,"/tmp/wm_debug.log"); //刷新token if ($checkRet['errcode'] != 0) { $userBase = json_decode($this->https_request("https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={$weixin_appId}&grant_type=refresh_token&refresh_token={$userBase['refresh_token']}"), true); } //拉取用户信息(需scope为 snsapi_userinfo) $url = "https://api.weixin.qq.com/sns/userinfo?access_token={$userBase['access_token']}&openid={$userBase['openid']}&lang=zh_CN"; $userJson = https_request($url); //error_log("userJson:".var_export($userJson,1)." \n\n",3,"/tmp/wm_debug.log"); $user = json_decode($userJson, true); //设置js参数 $timeSt = time(); $randomstr = createNonceStr(); $jsapiTicket = getJSApiTicket(getAccess($weixin_appId, $weixin_appSecret, 1)); //error_log("jsapiTicket:".var_export($jsapiTicket,1)." \n\n",3,"/tmp/wm_debug.log"); $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://"; $signUrl = "{$protocol}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; //error_log($signUrl."---\n",3,"/tmp/sing.txt"); $signature1 = sha1("jsapi_ticket={$jsapiTicket}&noncestr={$randomstr}×tamp={$timeSt}&url={$signUrl}"); //error_log("user:"******" \n\n",3,"/tmp/wm_debug.log"); //$this->display('weixinApi.showShareGame.html'); //} elseif($state == 3) { $name = $user['nickname']; $headImg = $user['headimgurl']; $openId = $user['openid']; //生成三张牌 if (rand(1, 100) <= 3) { $card = rand(0, 33); $pokers = '[' . $card . ',34,35]';