public function add() { $js = intval($_GET['js']); $userid = aac('user')->isLogin(1); //判断发布者状态 /* if(aac('user')->isPublisher()==false) { getJson('不好意思,你还没有权限发布内容!',$js); } */ if ($_POST['token'] != $_SESSION['token']) { getJson('非法操作!', $js); } $content = tsClean($_POST['content']); if ($content == '') { getJson('内容不能为空', $js); } $isaudit = 0; //过滤内容开始 aac('system')->antiWord($content); //过滤内容结束 $weiboid = $this->create('weibo', array('userid' => $userid, 'locationid' => aac('user')->getLocationId($userid), 'content' => $content, 'isaudit' => $isaudit, 'addtime' => date('Y-m-d H:i:s'), 'uptime' => date('Y-m-d H:i:s'))); //feed开始 $feed_template = '<span class="pl">说:</span><div class="quote"><span class="inq">{content}</span> <span><a class="j a_saying_reply" href="{link}" rev="unfold">回应</a></span></div>'; $feed_data = array('link' => tsurl('weibo', 'show', array('id' => $weiboid)), 'content' => cututf8(t($content), '0', '50')); aac('feed')->add($userid, $feed_template, $feed_data); //feed结束 getJson('发布成功!', $js, 2, tsurl('weibo', 'show', array('id' => $weiboid))); }
function getAnimals() { $animals = []; foreach (glob(__DIR__ . '/lib/animals/*.json') as $path) { $info = pathinfo($path); $animals[$info['filename']] = getJson($path); } return $animals; }
function bindCacheSetting() { global $_FANWE; $settings = array(); $js_settings = array(); $res = FDB::query("SELECT name,val,is_js FROM " . FDB::table('sys_conf') . " WHERE status = 1"); while ($data = FDB::fetch($res)) { $name = strtolower($data['name']); $settings[$name] = $data['val']; if ($data['is_js'] == 1) { $js_settings[$name] = $data['val']; } } $settings['site_title'] .= ' - ' . 'F' . 'A' . 'N' . 'W' . 'E'; $settings['footer_html'] .= '<' . 'p' . '>' . '<' . 'a' . ' ' . 'h' . 'r' . 'e' . 'f' . '=' . '"' . 'h' . 't' . 't' . 'p' . ':' . '/' . '/' . 'w' . 'w' . 'w' . '.' . 'f' . 'a' . 'n' . 'w' . 'e' . '.' . 'c' . 'o' . 'm' . '"' . ' ' . 't' . 'a' . 'r' . 'g' . 'e' . 't' . '=' . '"' . '_' . 'b' . 'l' . 'a' . 'n' . 'k' . '"' . '>' . 'f' . 'a' . 'n' . 'w' . 'e' . '.' . 'i' . 'n' . 'c' . '<' . '/' . 'a' . '>' . '<' . '/' . 'p' . '>'; writeFile(PUBLIC_ROOT . './js/setting.js', 'var SETTING = ' . getJson($js_settings) . ';'); $config_file = @file_get_contents(PUBLIC_ROOT . 'config.global.php'); $config_file = trim($config_file); $config_file = preg_replace("/[\$]config\\['time_zone'\\].*?=.*?'.*?'.*?;/is", "\$config['time_zone'] = '" . $settings['time_zone'] . "';", $config_file); $config_file = preg_replace("/[\$]config\\['default_lang'\\].*?=.*?'.*?'.*?;/is", "\$config['default_lang'] = '" . $settings['default_lang'] . "';", $config_file); @file_put_contents(PUBLIC_ROOT . 'config.global.php', $config_file); unset($config_file); $lang_arr = array(); $lang_files = array(FANWE_ROOT . './core/language/' . $settings['default_lang'] . '/template.lang.php', FANWE_ROOT . './tpl/' . $settings['site_tmpl'] . '/template.lang.php'); foreach ($lang_files as $lang_file) { if (@(include $lang_file)) { foreach ($lang as $lkey => $lval) { $lang_pre = strtolower(substr($lkey, 0, 3)); if ($lang_pre == 'js_') { $lang_key = substr($lkey, 3); if ($lang_key != '') { $lang_arr[$lang_key] = $lval; } } } } } writeFile(PUBLIC_ROOT . './js/lang.js', 'var LANG = ' . getJson($lang_arr) . ';'); clearDir(FANWE_ROOT . './public/data/tpl/css/'); clearDir(FANWE_ROOT . './public/data/tpl/js/'); $css_dir = FANWE_ROOT . './tpl/' . $settings['site_tmpl'] . '/css/'; $css_cache_dir = FANWE_ROOT . './public/data/tpl/css/'; $css_site_path = $_FANWE['site_root'] . 'tpl/' . $settings['site_tmpl'] . '/'; $directory = dir($css_dir); while ($entry = $directory->read()) { if ($entry != '.' && $entry != '..' && stripos($entry, '.css') !== false) { $css_path = $css_dir . $entry; $css_content = @file_get_contents($css_path); $css_content = preg_replace("/\\.\\.\\//", $css_site_path, $css_content); $css_cache_path = $css_cache_dir . '/' . $entry; writeFile($css_cache_path, $css_content); } } $directory->close(); FanweService::instance()->cache->saveCache('setting', $settings); }
function pullDataForSign(&$sign) { $sid = $sign->sid; $result = getJson("http://atlanta.onebusaway.org/api/api/where/schedule-for-stop/" . $sid . ".json?key=TEST&date=2015-12-21"); // weekday $sign->stopName = $result['data']['references']['stops'][0]['name']; $stopSchedules = array(); $groupedSchedules = array(); // get weekday schedules createSchedules($result, $stopSchedules, $groupedSchedules, 'wkday'); // get saturday schedules $result = getJson("http://atlanta.onebusaway.org/api/api/where/schedule-for-stop/" . $sid . ".json?key=TEST&date=2015-12-19"); // saturday createSchedules($result, $stopSchedules, $groupedSchedules, 'sat'); // get sunday schedules $result = getJson("http://atlanta.onebusaway.org/api/api/where/schedule-for-stop/" . $sid . ".json?key=TEST&date=2015-12-20"); // sunday createSchedules($result, $stopSchedules, $groupedSchedules, 'sun'); // Above we marked certain headsigns as "AMBIGUOUS" // b/c the same text might be used for multiple directions of travel. // Merge 'AMBIGUOUS' schedules with another schedule of the same route (MARTA 12). $deleteCandidates = array(); foreach ($groupedSchedules as $ss) { if ($ss['direction2'] == 'AMBIGUOUS') { foreach ($groupedSchedules as &$ss1) { if ($ss1['name'] == $ss['name'] && $ss1['direction2'] != 'AMBIGUOUS') { array_push($deleteCandidates, $ss); $ss1['wkday'] = array_merge($ss1['wkday'], $ss['wkday']); $ss1['sat'] = array_merge($ss1['sat'], $ss['sat']); $ss1['sun'] = array_merge($ss1['sun'], $ss['sun']); sort($ss1['wkday']); sort($ss1['sat']); sort($ss1['sun']); break; } } } } foreach ($deleteCandidates as $dc) { unset($groupedSchedules[$dc['finalDestination']]); } // // This is to center single schedules on the sheet. // if (count($stopSchedules) == 1) { // array_unshift($stopSchedules, null); // array_push($stopSchedules, null); // } // if (count($groupedSchedules) == 1) { // array_unshift($groupedSchedules, null); // array_push($groupedSchedules, null); // } $sign->stopSchedules = $stopSchedules; $sign->groupedSchedules = $groupedSchedules; }
function main() { if (isset($_GET['lang']) && $_GET['lang'] == 'en') { $lang = 'en'; } else { $lang = 'no'; } $json = getJson($lang); $form = parsePost($json); if (strlen($form['result']) > 0) { // If all fields in $_POST were valid saveForm($form['name'], $form['email'], $form['message']); } require 'cvLayout.php'; }
function seperateInfo() { $obj = getJson(); $amount = count($obj); $objectenArray = []; $infoArray = []; for ($i = 0; $i < $amount; ++$i) { $id = $obj[$i]['id']; $foto = $obj[$i]['images']['standard_resolution']['url']; array_push($infoArray, $id); array_push($infoArray, $foto); array_push($objectenArray, $infoArray); $infoArray = []; } return $objectenArray; }
function shareCount($url, $site) { function getJson($url) { $shareCountData = file_get_contents($url); $result = json_decode($shareCountData); return $result; } if ($site == 'facebook') { $result = getJson('http://graph.facebook.com/?id=' . $url); return intval($result->shares); } if ($site == 'twitter') { $result = getJson('http://cdn.api.twitter.com/1/urls/count.json?url=' . $url); return intval($result->count); } if ($site == 'linkedin') { $result = getJson('http://www.linkedin.com/countserv/count/share?url=' . $url . '&format=json'); return intval($result->count); } if ($site == 'pinterest') { $result = file_get_contents('http://api.pinterest.com/v1/urls/count.json?url=' . $url); $result = json_decode(preg_replace('/^receiveCount\\((.*)\\)$/', "\\1", $result)); return intval($result->count); } if ($site == 'googleplus') { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://clients6.google.com/rpc"); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"' . $url . '","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json')); $result = curl_exec($curl); curl_close($curl); $json = json_decode($result, true); return intval($json[0]['result']['metadata']['globalCounts']['count']); } if ($site == 'stumbleupon') { $result = getJson('http://www.stumbleupon.com/services/1.01/badge.getinfo?url=' . $url); return $result->result->views; } return "invalid request"; }
function printPageForStop($stop) { $agency = $stop[0]; $sid = $stop[1]; $stopId1 = $stop[0]; $result = getJson("http://atlanta.onebusaway.org/api/api/where/schedule-for-stop/" . $stopId1 . ".json?key=TEST&date=2015-09-08"); // weekday $stopName = $result['data']['references']['stops'][0]['name']; if (isset($_REQUEST['stopNameOverride']) && $_REQUEST['stopNameOverride'] != "") { $stopName = $_REQUEST['stopNameOverride']; } $routes = $result['data']['references']['routes']; $stopSchedules = array(); $groupedSchedules = array(); // FIRST bus stop // get weekday schedules createSchedules($result, $stopSchedules, 'wkday'); // get saturday schedules $result = getJson("http://atlanta.onebusaway.org/api/api/where/schedule-for-stop/" . $stopId1 . ".json?key=TEST&date=2015-04-04"); // saturday createSchedules($result, $stopSchedules, 'sat'); // get sunday schedules $result = getJson("http://atlanta.onebusaway.org/api/api/where/schedule-for-stop/" . $stopId1 . ".json?key=TEST&date=2015-04-05"); // sunday createSchedules($result, $stopSchedules, 'sun'); // SECOND BUS STOP if available $stopId2 = $stop[1]; if ($stopId2 != "") { // get weekday schedules $result = getJson("http://atlanta.onebusaway.org/api/api/where/schedule-for-stop/" . $stopId2 . ".json?key=TEST&date=2015-09-08"); // weekday createSchedules($result, $stopSchedules, 'wkday'); // get saturday schedules $result = getJson("http://atlanta.onebusaway.org/api/api/where/schedule-for-stop/" . $stopId2 . ".json?key=TEST&date=2015-04-04"); // saturday createSchedules($result, $stopSchedules, 'sat'); // get sunday schedules $result = getJson("http://atlanta.onebusaway.org/api/api/where/schedule-for-stop/" . $stopId2 . ".json?key=TEST&date=2015-04-05"); // sunday createSchedules($result, $stopSchedules, 'sun'); } $groupedSchedules = createMergedSchedules($stopSchedules); // Above we marked certain headsigns as "AMBIGUOUS" // b/c the same text might be used for multiple directions of travel. // Merge 'AMBIGUOUS' schedules with another schedule of the same route (MARTA 12). $deleteCandidates = array(); foreach ($groupedSchedules as $ss) { if ($ss['direction2'] == 'AMBIGUOUS') { foreach ($groupedSchedules as &$ss1) { if ($ss1['name'] == $ss['name'] && $ss1['direction2'] != 'AMBIGUOUS') { array_push($deleteCandidates, $ss); $ss1['wkday'] = array_merge($ss1['wkday'], $ss['wkday']); $ss1['sat'] = array_merge($ss1['sat'], $ss['sat']); $ss1['sun'] = array_merge($ss1['sun'], $ss['sun']); sort($ss1['wkday']); sort($ss1['sat']); sort($ss1['sun']); break; } } } } foreach ($deleteCandidates as $dc) { unset($groupedSchedules[$dc['finalDestination']]); } // print echo "<div class='page'>"; echo "<div id='fold'></div>"; printPageHeader($stopName); //echo "<div id='pageBody'>"; echo "<div id='mapFold'>"; echo "<img src='img/fakemap.png' style='width:100%; height:75%;' />"; echo "</div>"; echo "<div id='scheduleFold'>"; echo "<div class='buses'>"; //echo "<ul>"; foreach ($stopSchedules as $ss) { //echo "<li>" . $ss['direction2'] . "</li>"; //printRouteInfo($ss); } foreach ($groupedSchedules as $ss) { //echo "<li>" . $ss['direction2'] . "</li>"; printRouteInfo($ss); } //echo "</ul>"; echo "</div>"; echo <<<EOT \t<div class='disclaimer'> \t\t*Trip times are approximate, may change without notice, and may vary with road conditions, events, and holidays. Data provided by MARTA and OneBusAway. \t\t<br /><span class='alt-lang'>*Los horarios son indicativos, pueden cambiar sin aviso previo y cambiar en función de las condiciones de circulación, eventos, y días festivos.</span> \t</div> EOT; echo "</div>"; //echo "</div><!-- pageBody -->"; printPageFooter($sid); echo "</div>"; echo "<div style='clear:both; page-break-after: always;'><" . "/div>"; }
require_once "include/academic/lecturerexalresultdelete.php"; break; case "UserManagement": require_once "include/admission/usermanagement.php"; break; default: require_once "include/profile/default.php"; break; } // end content // news $template->loadTemplateFile("footer.tpl"); $template->setCurrentBlock("news"); $template->setVariable("NEWS", "Intranet News"); //$template->parseCurrentBlock(); $json = getJson($url_json); //die($json); $arr = json_decode($json); //var_dump($arr); $template->setCurrentBlock("article"); foreach ($arr as $obj) { //die$obj->guid; $template->setVariable("NEWSLINK", $obj->guid); $template->setVariable("NEWSTITLE", $obj->post_title); $template->setVariable("NEWSCONTENT", limit_text($obj->post_content, 15)); $template->setVariable("NEWSDATE", $obj->post_date); $template->setVariable("NEWSAUTHOR", $obj->user_nicename); $template->parseCurrentBlock(); } $template->parse("newsinner"); $template->show();
//Define Lastfm API calls $lastfmApi = "http://ws.audioscrobbler.com/2.0/?method=user.gettopalbums&user="******"&period=" . $request['period'] . "&api_key=" . $config['api_key'] . "&limit={$limit}&format=json"; $validUser = "******" . $request['user'] . "&api_key=" . $config['api_key'] . "&format=json"; //Check if a valid user $infoJson = json_decode(getJson($validUser)); //If an error is thrown, generate an error image and exit if (isset($infoJson->{"error"})) { header("Content-Type: image/png"); error_log($infoJson->{"message"} . " - " . $request['user']); imagepng(errorImage($infoJson->{"message"})); $sns = SnsClient::factory(array('credentials.cache' => $cache, 'region' => 'eu-west-1')); $sns->publish(array('TopicArn' => 'arn:aws:sns:eu-west-1:346795263809:LastFM-Errors', 'Message' => $infoJson->{"message"} . " - " . $request['user'], 'Subject' => "Lastfm Error: " . $infoJson->{"error"})); return; } //Get User's albums and generate a MD5 hash based on this $json = getJson($lastfmApi); $sns = SnsClient::factory(array('credentials.cache' => $cache, 'region' => 'eu-west-1')); $sns->publish(array('TopicArn' => 'arn:aws:sns:eu-west-1:346795263809:LastFM-API-CAlls', 'Message' => $json, 'Subject' => $user . "s JSON API Call")); $jsonhash = md5($json); //Cache based on user set variables and JSON hash $filename = "images/{$user}.{$period}.{$rows}.{$cols}.{$albumInfo}.{$plays}.{$jsonhash}"; //if a previous file exists - request is cached, serve from cache and exit if (file_exists($filename)) { header("Content-Type: image/jpeg"); error_log("Serving from cache - " . $filename); echo file_get_contents($filename); exit; } //otherwise carry on and getAlbums from LastFM. $albums = getAlbums(json_decode($json)); //Pass the Albums to getArt to download the art into a $covers array
if ($info["state"] == 'SUCCESS') { echo getJson('0', 'success', array('file' => getFileInfo($target . $info["name"], $ROOT))); } else { echo getJson('1', $info["state"], array('file' => getFileInfo($target . $info["name"], $ROOT))); } break; case 'download': $path = $ROOT . $target; $info = getFileInfo($target, $ROOT); downloadFile($path, $info['name']); break; case 'info': echo getJson('0', 'success', array('file' => getFileInfo($target, $ROOT))); break; default: echo getJson('1', 'unknow command'); break; } function listFile($dir, $ROOT) { if ($handle = opendir($ROOT . $dir)) { $output = array(); $dir = $dir[strlen($dir) - 1] == '/' ? $dir : $dir . '/'; while (false !== ($item = readdir($handle))) { if ($item != "." && $item != "..") { $output[] = getFileInfo($dir . $item, $ROOT); } } closedir($handle); return $output; } else {
<?php header('Content-Type: application/json'); define('WEBSITE', 'http://www.studentenwerk-oldenburg.de/de'); define('OVERVIEW_URI', '/gastronomie/speiseplaene.html'); define('DETAILVIEW_URI', '/gastronomie/speiseplaene/%s.html'); define('OVERVIEW', isset($_GET['mensa']) ? FALSE : TRUE); define('SCRIPT_URL', "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); require_once 'simple_html_dom.php'; require_once 'functions.php'; $output = ''; if (OVERVIEW) { $url = WEBSITE . OVERVIEW_URI; $output = getJson($url, '7 days'); } else { $url = WEBSITE . sprintf(DETAILVIEW_URI, $_GET['mensa']); $output = getJson($url, '120 minutes'); } echo $output;
function bindCacheSetting() { global $_FANWE; $settings = array(); $js_settings = array(); $res = FDB::query("SELECT name,val,is_js FROM " . FDB::table('sys_conf') . " WHERE status = 1"); while ($data = FDB::fetch($res)) { $name = strtolower($data['name']); $settings[$name] = $data['val']; if ($data['is_js'] == 1) { $js_settings[$name] = $data['val']; } } writeFile(PUBLIC_ROOT . './js/setting.js', 'var SETTING = ' . getJson($js_settings) . ';'); $pingJs = ''; //采集JS初始化 $pingJs = @file_get_contents(PUBLIC_ROOT . './js/demo.js'); $domain = 'var domain = "' . $_FANWE['site_url'] . '"; '; $host_name = 'var hostName = "' . str_replace("http://", "", $_FANWE['site_url']) . '"; '; $tpl_name = 'var tplName = "' . $_FANWE['setting']['site_tmpl'] . '"; '; $yz_name = 'var global="TUPU";document[global]=document[global] || {};'; $im_ping_js = ''; $im_ping_js = $host_name . $domain . $tpl_name . $yz_name . $pingJs; writeFile(PUBLIC_ROOT . './js/im.ping.js', $im_ping_js); $config_file = @file_get_contents(PUBLIC_ROOT . 'config.global.php'); $config_file = trim($config_file); $config_file = preg_replace("/[\$]config\\['time_zone'\\].*?=.*?'.*?'.*?;/is", "\$config['time_zone'] = '" . $settings['time_zone'] . "';", $config_file); $config_file = preg_replace("/[\$]config\\['default_lang'\\].*?=.*?'.*?'.*?;/is", "\$config['default_lang'] = '" . $settings['default_lang'] . "';", $config_file); @file_put_contents(PUBLIC_ROOT . 'config.global.php', $config_file); unset($config_file); $lang_arr = array(); $lang_files = array(FANWE_ROOT . './core/language/' . $settings['default_lang'] . '/template.lang.php', FANWE_ROOT . './tpl/' . $settings['site_tmpl'] . '/template.lang.php'); foreach ($lang_files as $lang_file) { if (@(include $lang_file)) { foreach ($lang as $lkey => $lval) { $lang_pre = strtolower(substr($lkey, 0, 3)); if ($lang_pre == 'js_') { $lang_key = substr($lkey, 3); if ($lang_key != '') { $lang_arr[$lang_key] = $lval; } } } } } writeFile(PUBLIC_ROOT . './js/lang.js', 'var LANG = ' . getJson($lang_arr) . ';'); clearDir(FANWE_ROOT . './public/data/tpl/css/'); clearDir(FANWE_ROOT . './public/data/tpl/js/'); $css_dir = FANWE_ROOT . './tpl/' . $settings['site_tmpl'] . '/css/'; $css_cache_dir = FANWE_ROOT . './public/data/tpl/css/'; $css_site_path = $_FANWE['site_root'] . 'tpl/' . $settings['site_tmpl'] . '/'; $directory = dir($css_dir); while ($entry = $directory->read()) { if ($entry != '.' && $entry != '..' && stripos($entry, '.css') !== false) { $css_path = $css_dir . $entry; $css_content = @file_get_contents($css_path); $css_content = preg_replace("/\\.\\.\\//", $css_site_path, $css_content); $css_cache_path = $css_cache_dir . '/' . $entry; writeFile($css_cache_path, $css_content); } } $directory->close(); FanweService::instance()->cache->saveCache('setting', $settings); }
function getCustomersByName($customerName, $format) { global $apiId, $apiKey; if ($format == "xml") { return getXml($apiId, $apiKey, "Customers", "customerName={$customerName}"); } else { return getJson($apiId, $apiKey, "Customers", "customerName={$customerName}"); } }
function getStockOnHand($format) { global $apiId, $apiKey; if ($format == "xml") { return getXml($apiId, $apiKey, "StockOnHand", ""); } else { return getJson($apiId, $apiKey, "StockOnHand", "pageSize=300"); } }
<?php if (!isset($_FILES['image']) || empty($_FILES['image'])) { exit; } $result = array(); $pic = $_FILES['image']; include_once fimport('class/image'); $image = new Image(); if (intval($_FANWE['setting']['max_upload']) > 0) { $image->max_size = intval($_FANWE['setting']['max_upload']); } $image->init($pic); if ($image->save()) { //$type = $_FANWE['request']['photo_type']; //if(empty($type) || !in_array($type,array('default', 'dapei', 'look'))) //$type = 'default'; $result['img'] = $image->file['target']; $result['status'] = 1; $info = array('path' => $image->file['local_target'], 'type' => $_FANWE['request']['photo_type']); $result['info'] = authcode(serialize($info), 'ENCODE'); $args = array('result' => $result); $result['html'] = tplFetch("services/share/pic_item", $args); } else { $result['status'] = 0; } $json = getJson($result); echo "<textarea>{$json}</textarea>";
} else { header('HTTP/1.0 404 not found'); } break; case 'getall': $posts = Post::getList(); $hc = new HtmlConstructor(); $hc->displayAllPosts($posts); break; case 'getjson': if ($params['resource'] == 'comment') { $r = new Comment(); } elseif ($params['resource'] == 'post') { $r = new Post(); } print getJson($r); break; case 'login': $hc = new HtmlConstructor(); $hc->displayLoginPage(); break; case 'edit': $hc = new HtmlConstructor(); $post = Post::get($params["id"]); $hc->editPost('edit', $post); break; case 'create': $hc = new HtmlConstructor(); $hc->editPost('create', null); //edition and creation of post use share tamplate break;
<?php header("content-type:text/html;charset:utf-8"); set_time_limit(0); date_default_timezone_set("Asia/Shanghai"); $domains = array("crusher.com", "jawcrusher.co.in", "mobilecrusher.pw", "conecrusher.co.in", "lxpdeyumng.com"); $start = date("Y-m-d") . " 03:55:00"; $end = date("Y-m-d") . " 04:30:00"; $json = getJson($domains); $domain_status = getDomainStatus($json, $domains); print_r(checkAvailable($domain_status)); //检查可以注册的域名 function checkAvailable($domains_status) { $arrayKeys = array_keys($domains_status); $i = 0; foreach ($arrayKeys as $domain) { if ($domains_status[$domain]["status"] == "available") { $ava_domains[$i] = $domain; $i++; } } return $ava_domains; } //获取域名状态json数据 function getJson($domains) { return sendData(getDomainCheckUrl(getDomainConsist($domains))); } /** * 获取需要注册域名的status
} else { $json = '{ "Error": "Database già esistente!" }'; } } //Show all arguments. if (isset($_GET['arguments'])) { $stmt = $db->query('SELECT * FROM argomenti;'); $json = getJson($stmt->fetchAll(PDO::FETCH_ASSOC)); } //Show all solutions. if (isset($_GET['solutions']) && (isset($_GET['argument']) && $_GET['argument'] != "")) { $stmt = $db->query('SELECT id, soluzione FROM soluzioni WHERE id IN (SELECT soluzione FROM domandeALG WHERE argomento = ' . $_GET['argument'] . ') OR id IN (SELECT soluzione FROM domandeSQL WHERE argomento = ' . $_GET['argument'] . ')'); $json = getJson($stmt->fetchAll(PDO::FETCH_ASSOC)); print_json($json); return; } //Submit newQuestion, INSERT argomento, soluzioni and domandeALG/SQL. function submitNewQuestion($db, $argumentId, $solutionId) { $stmt = $db->query("INSERT INTO " . $_GET['type'] . " (testo,db_connesso,soluzione,argomento)\n VALUES ('" . $_GET['text'] . "','" . $_GET['db'] . "'," . $solutionId . "," . $argumentId . ");"); $json = '{ "Success": "Domanda aggiunta!" }'; print_json($json); } function getIdArgument($db) { $stmt = $db->query("SELECT id FROM argomenti WHERE argomento = '" . $_GET['new_argument'] . "';"); return $stmt->fetchColumn(); }
<div class="panel-body"> <textarea placeholder="Write something..." class="form-control"></textarea> </div><!-- panel-body --> <div class="panel-footer"> <div class="timeline-btns pull-left"> <a href="#" class="tooltips" data-toggle="tooltip" title="" data-original-title="Add Photo"><i class="glyphicon glyphicon-picture"></i></a> <a href="#" class="tooltips" data-toggle="tooltip" title="" data-original-title="Add Video"><i class="glyphicon glyphicon-facetime-video"></i></a> <a href="#" class="tooltips" data-toggle="tooltip" title="" data-original-title="Check In"><i class="glyphicon glyphicon-map-marker"></i></a> <a href="#" class="tooltips" data-toggle="tooltip" title="" data-original-title="Tag User"><i class="glyphicon glyphicon-user"></i></a> </div><!--timeline-btns --> <button class="btn btn-primary pull-right">Submit Post</button> </div><!-- panel-footer --> </div> </div><!-- col-sm-6 --> <?php $feed = json_decode(getJson("http://hummingbird.me/api/v1/users/" . $user["name"] . "/feed"), true); $i = 0; while ($i < count($feed)) { if ($feed[$i]["story_type"] == "comment") { ?> <div class="col-sm-6" style="position: absolute; left: 0px; top: 0px;"> <div class="panel panel-default panel-timeline"> <div class="panel-heading"> <div class="media"> <a href="#" class="pull-left"> </a> <div class="media-body"> <h4 class="text-primary"><?php echo $feed[$i]["user"]["name"]; ?> <small></small></h4>
} if ($strGroup['userid'] == $userid) { getJson('组长任务艰巨,请坚持到底!'); } $new['group']->delete('group_user', array('userid' => $userid, 'groupid' => $groupid)); //计算小组会员数 $count_user = $new['group']->findCount('group_user', array('groupid' => $groupid)); //更新小组成员统计 $new['group']->update('group', array('groupid' => $groupid), array('count_user' => $count_user)); getJson('退出成功!', 1, 1); break; //帖子推荐 //帖子推荐 case "isrecommend": $js = intval($_GET['js']); $topicid = intval($_POST['topicid']); if ($TS_USER['isadmin'] == 1 && $topicid) { $strTopic = $new['group']->find('group_topic', array('topicid' => $topicid)); if ($strTopic['isrecommend'] == 1) { $new['group']->update('group_topic', array('topicid' => $topicid), array('isrecommend' => 0)); getJson('取消推荐成功!', $js); } if ($strTopic['isrecommend'] == 0) { $new['group']->update('group_topic', array('topicid' => $topicid), array('isrecommend' => 1)); getJson('推荐成功!', $js); } } else { getJson('非法操作', $js); } break; }
$userNum = $new['user']->findCount('user', array('email' => $email, 'resetpwd' => $resetpwd)); if ($email == '' || $resetpwd == '') { tsNotice("你应该去火星生活啦!"); } elseif ($userNum == 0) { tsNotice("你应该去火星生活啦!"); } else { $title = '重设密码'; include template("resetpwd"); } break; case "do": $js = intval($_GET['js']); $email = trim($_POST['email']); $pwd = trim($_POST['pwd']); $repwd = trim($_POST['repwd']); $resetpwd = trim($_POST['resetpwd']); if ($email == '' || $pwd == '' || $repwd == '' || $resetpwd == '') { getJson("所有输入项都不能为空!", $js); } if (valid_email($email) == false) { getJson('Email输入不正确', $js); } $userNum = $new['user']->findCount('user', array('email' => $email, 'resetpwd' => $resetpwd)); if ($userNum == '0') { getJson("你应该去火星生活啦!", $js); } $salt = md5(rand()); $new['user']->update('user', array('email' => $email), array('pwd' => md5($salt . $pwd), 'salt' => $salt, 'resetpwd' => '')); getJson("密码修改成功^_^", $js); break; }
foreach ($arrGroup as $key => $item) { $groupUserNum = $new['user']->findCount('group_user', array('userid' => $userid, 'groupid' => $item)); if ($groupUserNum == 0) { $new['user']->create('group_user', array('userid' => $userid, 'groupid' => $item, 'addtime' => time())); //统计更新 $count_user = $new['user']->findCount('group_user', array('groupid' => $item)); $new['user']->update('group', array('groupid' => $item), array('count_user' => $count_user)); } } } } //用户信息 $userData = $new['user']->find('user_info', array('userid' => $userid), 'userid,username,path,face,isadmin,signin,uptime'); //用户session信息 $_SESSION['tsuser'] = $userData; //发送消息 aac('message')->sendmsg(0, $userid, '亲爱的 ' . $username . ' :<br />您成功加入了 ' . $TS_SITE['site_title'] . '<br />在遵守本站的规定的同时,享受您的愉快之旅吧!'); //注销邀请码并将关注邀请用户 if ($TS_SITE['isinvite'] == '1') { //邀请码信息 $strInviteCode = $new['user']->find('user_invites', array('invitecode' => $invitecode)); $new['user']->create('user_follow', array('userid' => $userid, 'userid_follow' => $strInviteCode['userid'])); //注销 $new['user']->update('user_invites', array('invitecode' => $invitecode), array('isused' => '1')); } //对积分进行处理 aac('user')->doScore($TS_URL['app'], $TS_URL['ac'], $TS_URL['ts']); //跳转 getJson('登录成功!', $js, 2, SITE_URL); break; }
//执行登录 case "do": $js = intval($_GET['js']); if ($_POST['token'] != $_SESSION['token']) { getJson('非法操作!', $js); } $email = trim($_POST['email']); if (valid_email($email) == false) { getJson('Email输入不正确', $js); } $emailNum = $new['user']->findCount('user', array('email' => $email)); if ($email == '') { getJson('Email输入不能为空^_^', $js); } elseif ($emailNum == '0') { getJson("Email不存在,你可能还没有注册^_^", $js); } else { //加密 $resetpwd = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36); $new['user']->update('user', array('email' => $email), array('resetpwd' => $resetpwd)); //发送邮件 $subject = $TS_SITE['site_title'] . '会员密码找回'; $content = '您的登陆信息:<br />Email:' . $email . '<br />重设密码链接:<br /><a href="' . $TS_SITE['site_url'] . 'index.php?app=user&ac=resetpwd&mail=' . $email . '&set=' . $resetpwd . '">' . $TS_SITE['site_url'] . 'index.php?app=user&ac=resetpwd&mail=' . $email . '&set=' . $resetpwd . '</a>'; $result = aac('mail')->postMail($email, $subject, $content); if ($result == '0') { getJson('找回密码所需信息不完整^_^', $js); } elseif ($result == '1') { getJson('系统已经向你的邮箱发送了邮件,请尽快查收^_^', $js); } } break; }
<?php $cache_file = getTplCache('services/share/expression'); if (!@(include $cache_file)) { $expressions = getCache('expression'); if ($expressions === NULL) { $expressions = array(); $res = FDB::query('SELECT type,title,emotion,filename FROM ' . FDB::table('expression') . ' ORDER BY type'); while ($data = FDB::fetch($res)) { $data['url'] = './public/expression/' . $data['type'] . '/' . $data['filename']; $data['emotion'] = str_replace(array('[', ']'), array('', ''), $data['emotion']); $expressions[$data['type']][] = $data; } setCache('expression', $expressions); } $expressions_js = array(); foreach ($expressions as $ekty => $elist) { $args = array('current_exp' => &$elist); $expressions_js[$ekty] = tplFetch("services/share/expression_item", $args); } $expressions_json = getJson($expressions_js); $current_exp = current($expressions_js); include template('services/share/expression'); } display($cache_file);
<li><a href="#rp-settings" data-toggle="tab"><i class="fa fa-gear"></i></a></li> </ul> <!-- Tab panes --> <div class="tab-content"> <div class="tab-pane active" id="rp-alluser"> <h5 class="sidebartitle">Online Users</h5> <ul class="chatuserlist"> <?php $following = json_decode(getJson("http://hummingbird.me/users?followed_by=" . $user["name"]), true); for ($x = 0; $x <= count($following["users"]) - 1; $x++) { ?> <li class="online"> <div class="media"> <a href="#" class="pull-left media-thumb"> <?php $hbuser = json_decode(getJson("http://hummingbird.me/api/v1/users/" . $following["users"][$x]["id"]), true); ?> <img alt="" src="<?php echo $hbuser["avatar"]; ?> " class="media-object"> </a> <div class="media-body"> <strong><?php echo $following["users"][$x]["id"]; if ($following["users"][$x]["is_pro"] == "true") { ?> <small class="pull-right">Pro</small></h3><?php } ?> </strong>
<div class="panel panel-default"> <div class="panel-body"> <div class="table-responsive"> <div id="table2_wrapper" class="dataTables_wrapper" role="grid"> <table class="table dataTable" id="table2" aria-describedby="table2_info"> <thead> <tr role="row"> <th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="table2" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Title: activate to sort column descending" style="width: 200px;">Title</th> <th class="sorting" role="columnheader" tabindex="0" aria-controls="table2" rowspan="1" colspan="1" aria-label="Progress: activate to sort column ascending" style="width: 200px;">Progress</th> <th class="sorting" role="columnheader" tabindex="0" aria-controls="table2" rowspan="1" colspan="1" aria-label="Status: activate to sort column ascending" style="width: 200px;">Status</th> <th class="sorting" role="columnheader" tabindex="0" aria-controls="table2" rowspan="1" colspan="1" aria-label="Score: activate to sort column ascending" style="width: 100px;">Score</th> </tr> </thead> <tbody role="alert" aria-live="polite" aria-relevant="all"> <?php $hummingbird = json_decode(getJson("http://hummingbird.me/api/v1/users/" . $otheruser["name"] . "/library"), true); $i = 0; while ($i < count($hummingbird)) { $query = "SELECT * FROM anime WHERE id='" . $hummingbird[$i]["anime"]["id"] . "' LIMIT 1"; $result = mysqli_query($conn, $query); $row = mysqli_fetch_array($result, MYSQLI_ASSOC); ?> <tr class="gradeA odd"> <td class=" sorting_1"><img src="<?php echo $row["cover-image"]; ?> " alt="<?php echo $row["title-eng"]; ?> height="60" width="60"> <a href="/watch/watch.php?id=<?php echo $row["id"];
$userWishNum = $new['event']->findCount('event_users', array('eventid' => $eventid, 'status' => 1)); $new['event']->update('event', array('eventid' => $eventid), array('count_userdo' => $userDoNum, 'count_userwish' => $userWishNum)); echo '1'; break; //参加活动 //参加活动 case "join": $js = intval($_GET['js']); $userid = intval($TS_USER['userid']); if ($userid == 0) { getJson('请登录后再参加活动', $js); } $eventid = intval($_POST['eventid']); $username = trim($_POST['username']); $phone = trim($_POST['phone']); $email = trim($_POST['email']); $qq = trim($_POST['qq']); if ($username == '' || $phone == '') { getJson('姓名和手机号不能为空', $js); } //删除之前的报名信息 $new['event']->delete('event_users', array('eventid' => $eventid, 'userid' => $userid)); $new['event']->create('event_users', array('eventid' => $eventid, 'userid' => $userid, 'username' => $username, 'phone' => $phone, 'email' => $email, 'qq' => $qq, 'status' => 0, 'addtime' => time())); //统计一下参加的 $userDoNum = $new['event']->findCount('event_users', array('eventid' => $eventid, 'status' => 0)); //统计感兴趣的 $userWishNum = $new['event']->findCount('event_users', array('eventid' => $eventid, 'status' => 1)); $new['event']->update('event', array('eventid' => $eventid), array('count_userdo' => $userDoNum, 'count_userwish' => $userWishNum)); getJson('报名提交成功,感谢参与。', $js); break; }
public function isLogin($type = '') { $userid = intval($_SESSION['tsuser']['userid']); if ($type && $userid == 0) { getJson('你还没有登录', 1); } if ($userid > 0) { if ($this->isUser($userid)) { return $userid; } else { header("Location: " . tsUrl('user', 'login', array('ts' => 'out'))); exit; } } else { header("Location: " . tsUrl('user', 'login', array('ts' => 'out'))); exit; } }
<?php $postString = "servicekey=<servicekey>&service=<bank name>&documentType=1&user=<username>&pass=<password>&pass2=&products=GLOBAL&startdate=01-01-2016&account_id=0"; $json = getJson($postString); $array = json_decode($json, true); print_r($array); function getJson($postString = '') { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_URL, 'https://www.afterbanks.com/endpoint/'); curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); $response = curl_exec($ch); curl_close($ch); return $response; }