public static function getPlayer($gt, $platform) { $url = 'http://www.bungie.net/Platform/Destiny/SearchDestinyPlayer/' . $platform . '/' . $gt; $r = json_decode(getData($url)); $p = new Player($r->Response[0]->iconPath, $r->Response[0]->membershipType, $r->Response[0]->membershipId, $r->Response[0]->displayName); return $p; }
function getSummaryDayData($timestamp = '') { $date = !empty($timestamp) ? date('Y-m-d', $timestamp) : date('Y-m-d'); $arrQuery = array('created_d' => $date); $retval = getData($arrQuery); return $retval; }
public function reset() { $_SESSION['pk'] = 10; // <-- start fake pks at 10 $_SESSION['rs'] = getData(); // <-- populate $_SESSION with data. }
function email() { $headers = "From: order@mathsbooksforchildren.co.uk\r\n"; $headers .= "Content-type: text/html charset=iso-8859-1 \r\n"; $query = "select order_id, room_no, CONCAT(fname,' ', mname ,' ', lname) as cust_name ,phone_no,Adults, Child_A from reservation inner join customer on reservation.cust_id=customer.cust_id where arrival_date='" . date('Y-m-d 11:00:00') . "' and reservation.status='active'"; $guest = getData($query); if (!empty($guest)) { $message = ' <html> <head> <title>Some title</title> </head> <body> <table> <caption>Guests Arriving Today</caption> <thead> <tr><th>Room_no</th> <th>Customer Details</th> <th>Contacts</th> <th>Adults</th> <th>Children</th></tr> </thead>'; $table = ''; foreach ($guest as $value) { $table .= '<tbody><tr><td>' . $value['room_no'] . '</td><td>' . $value['cust_name'] . '</td><td>' . $value['phone_no'] . '</td><td>' . $value['Adults'] . '</td><td>' . $value['Child_A'] . '</td></tr></tbody>'; } $table .= '</table></html>'; $msg = $message . $table; // use wordwrap() if lines are longer than 70 characters $msg = wordwrap($msg, 70); // send email mail("*****@*****.**", "Guests Arriving today", $msg, $headers); } }
function lookup($date) { $temp = split("/", $date); $monthname = $temp[0] . $temp[1]; $folder = "./data/{$monthname}"; $drc = dir($folder); $datas = array(); $count = 0; if ($drc != null) { while ($fl = $drc->read()) { $lfl = $folder . "/" . $fl; $din = pathinfo($lfl); if ($fl != ".." && $fl != ".") { $temp = getData($folder . "/" . $fl); $rec = array(); foreach ($temp as $data) { list($key, $value) = split('":"', $data); $key = stlipQuot($key); $value = stlipQuot($value); $rec[$key] = $value; } $datas[] = $rec; $count++; } } $drc->close(); } if ($count > 0) { $datas = JEncode($datas); echo '({"total":"' . $count . '","results":' . $datas . '})'; } else { echo '({"total":"0","results":""})'; } }
function getLeaderboardIdFromSteam($date = 0) { global $config; $url = $config['leaderboards']['baseUrl'] . '?xml=1'; $lbName = date('Ymd') . '_scores'; // don't look at me like that try_again: $data = getData($url); $xml = new SimpleXMLElement($data); $lbid = ''; // since leaderboards are being created in advance by the devs, we need to // make sure we're getting a valid one, where 'valid' means with at least // 50 entries - we'd get an empty one at midnight otherwise. foreach ($xml as $x) { if ($date == 1) { $lbName = date('Ymd', strtotime('-1 day', strtotime(date('r')))) . '_scores'; } if ($x->name == $lbName) { if ($x->entries < 50) { echo "[{$x->name} has {$x->entries} entries, something's up]\n"; //sleep(5); //goto try_again; } return $x->lbid; } } }
function checkTweets($newsitem) { $backtweet_api_key = "93cf9404dc4d8aebe92f"; $q = $newsitem["url"]; $newsitem_id = $newsitem["id"]; echo "querying: " . $q . "<br>"; $sinceString = ""; $since_result = mysql_query("SELECT * FROM backtweets_db WHERE newswire_id=" . $newsitem_id . " ORDER BY tweet_id DESC LIMIT 1"); if ($since_result) { $since_row = mysql_fetch_assoc($since_result); $since_id = $since_row["tweet_id"]; $sinceString .= "&since_id=" . $since_id; } echo "<br>since string: " . $sinceString . " since_id: " . $since_id . "<br>"; $jsonString = getData("http://backtweets.com/search.json?q=" . $q . "&key=" . $backtweet_api_key . "&itemsperpage=100" . $sinceString); $tweetsObj = json_decode($jsonString); //echo "status: ".$tweetsObj->status; //echo $jsonString;. echo "total results: " . $tweetsObj->totalresults . "<br>"; //$indexable = 1; //if ($tweetsObj->totalresults < 1) { // if ($newsitem["indexed"] > 2) { //$indexable = 0; // } //} //mysql_query( "UPDATE newswire_tb SET indexable=".$indexable.", indexed=indexed+1 WHERE id=".$newsitem["id"] ); for ($i = 0; $i < count($tweetsObj->tweets); $i++) { // echo $tweetsObj->tweets[$i]->tweet_from_user ."<br>"; echo "<br>Tweet: since id : " . $sinceString . "<br>"; insertTweet($tweetsObj->tweets[$i], $newsitem["id"]); echo "<br><br>"; } }
function loginOverride($coreUserInfo) { global $gasDatabaseName, $CoreUserTableName; if ($coreUserInfo["ErrorCode"] == 0) { $uid = $coreUserInfo["Result"]["Uid"]; connectDB($gasDatabaseName); $sql = "select * from {$CoreUserTableName} where Uid = '{$uid}'"; $data = getData($sql); $info = array(); if (!empty($data)) { $data = $data[0]; foreach ($data as $key => $value) { $info["{$key}"] = $value; } } else { printResultByMessage("用戶未註冊", 1001); } foreach ($coreUserInfo["Result"] as $key => $value) { $info["{$key}"] = $value; } $_SESSION["Info"] = $info; echo json_encode($coreUserInfo); die; } }
function dekodieren($in) { global $ks_hilf; $conn = new PDO('sqlite:' . $ks_hilf[pfad] . '/navajo.sqlite'); $buffer = explode(' ', trim($in)); $cc = 0; foreach ($buffer as $key => $value) { $sql = 'SELECT count(*) AS NUM FROM data WHERE NAVAJO LIKE "' . $value . '" ORDER BY RANDOM() LIMIT 1'; $data = getData($conn, $sql); $temp = $data[0][NUM]; $cc++; if ($temp == 0) { $out .= '[' . $value . ']'; } else { $sql = 'SELECT * FROM data WHERE NAVAJO = "' . $value . '" ORDER BY RANDOM() LIMIT 1'; $data = getData($conn, $sql); $tmp = $data[0][ENGLISCH]; if ($tmp == "SPACE") { $tmp = " "; } $out .= $tmp; } } return trim($out); }
public static function GetPostInfo($id) { try { $safeId = ensureInt($id, 10); } catch (Exception $e) { throw new Exception('获取墙贴信息失败:' . $e->getMessage()); return null; } $cacheKey = 'postinfo_' . $safeId; $cache = getCache($cacheKey); if ($cache == null) { $sql = "select `post_id`,`post_creator`, `post_wall`, `post_title`, `post_content`, `post_time` from wa_post where post_id = {$safeId} limit 1"; $ret = getData($sql); if ($ret == null) { throw new Exception('获取墙贴信息失败。'); return null; } else { $ret = $ret[0]; setCache($cacheKey, $ret); return $ret; } } else { return $cache; } }
function loginOverride($coreUserInfo) { global $gasDatabaseName; if ($coreUserInfo["ErrorCode"] == 0) { $tableName = "Employee"; $uid = $coreUserInfo["Result"]["Uid"]; connectDB($gasDatabaseName); $sql = "select * from {$tableName} where Uid = '{$uid}'"; $data = getData($sql); // 该用户是否已经注册 if (empty($data)) { printResultByMessage("用戶未註冊", 1001); } $data = $data[0]; // 该gasman是否通过瓦斯行的审核 if ($data["Verify"] === "0") { printResultByMessage("請通知瓦斯行進行審核", 1002); } $info = array(); foreach ($data as $key => $value) { $info["{$key}"] = $value; } foreach ($coreUserInfo["Result"] as $key => $value) { $info["{$key}"] = $value; } $_SESSION["Info"] = $info; echo json_encode($coreUserInfo); die; } }
/** * * @param unknown $httpReq */ function getCmd($httpReq) { $reqdecoded = getData($httpReq); if (!isset($reqdecoded['cmd'])) { WrongRequestException::throwException(8010, '>cmd< is missing in request', 'got: ' . $httpReq); } return $reqdecoded['cmd']; }
function __construct() { session_start(); if (!isset($_SESSION['pk'])) { $_SESSION['pk'] = 5; $_SESSION['rs'] = getData(); } }
public function page() { $this->dbinfo = \H::getJSONData("credentials"); if (getData("credentials") != null && $this->connect($this->dbinfo)) { $this->set = true; } return "auto"; }
public function adicionar($conexao, $acao, $oQue, $quem, $qual) { try { $timestamp = getTimestamp(); $conexao->query()->from("logs")->save(array("acao" => $acao, "oque" => $oQue, "quem" => $quem, "qual" => $qual, "data" => getData($timestamp), "timestampData" => $timestamp)); } catch (Exception $e) { throw $e; } }
public function __construct() { if (!isset($_SESSION['pk'])) { $_SESSION['pk'] = 10; // <-- start fake pks at 10 $_SESSION['rs'] = getData(); // <-- populate $_SESSION with data. } }
function addData($table_name, $data, $time, $date, $user) { $status = isPublic(); if ($table_name == "list") { mysql_query("INSERT INTO {$table_name} (details, time_posted , date_posted , user, status) VALUES ('{$data}', '{$time}', '{$date}', '{$user}', '{$status}')") or die(mysql_error()); } else { $post_id = getData('post_id'); mysql_query("INSERT INTO {$table_name} (details, time_posted , date_posted , user, post_id) VALUES ('{$data}', '{$time}', '{$date}', '{$user}', '{$post_id}')") or die(mysql_error()); } }
function main() { $data = getData(); array_shift($data); // shift off the first "headers" row foreach ($data as $record) { $result = parseDBLine($record); magicalInsert($result); } }
function saveTorrent($url) { global $destDir; // get filename from http://showrss.karmorra.info/r/67849b94daf750c142adf43266525b3a.torrent $matches = split("/", $url); $filename = $matches[count($matches) - 1]; $torData = getData($url); // write to disk writeBack($destDir . $filename, $torData); }
function getTranslation($project, $resource, $lang) { $data = getData('/api/2/project/' . $project . '/resource/' . $resource . '/translation/' . $lang . '/'); if (!$data['content']) { throw new Exception('Invalid response'); } return json_decode($data['content'], true); // echo $data['content']; exit; /* eval('?>' . $data['content'] . '<?'); */ // return $LANG; }
public function merge($entity) { $table = getTable($entity); $data = getData($entity); $idColumn = key($data); $id = array_shift($data); $where = buildWhere($idColumn, $id); $update = $this->conn->update($table, $data); $return = $update->where($where, $id)->execute(); return $return; }
public function getSite($site = false) { $sites = getData("sites"); $sites = json_decode($sites, true); $sites = !is_array($sites) ? array() : $sites; if ($site) { $sites[$site]['name'] = $site; return isset($sites[$site]) ? $sites[$site] : array(); } else { return $sites; } }
public function friends($start = 50) { $start = ceil($start); $friends = array(); foreach ($this->networks as $network => $null) { $Network = ucfirst($network); $Network = "\\chatkin\\" . ucfirst($network); $n = new $Network(); $n->cookies = getData("network_" . $network . "_cookies"); $friends[$network] = $n->friends($start); } }
public function index() { $types = M('type'); $type = $types->order('sort ASC')->where('state != 2')->select(); //获取商品显示中的全部类别 $typeList = getLayer($type); //获取排序类别数组 $typeHosts = $types->order('sort ASC')->where('state = 3')->select(); //得到推荐分类 //自定义(三维)数组存放推荐分类,一维下标为父类ID,二维下标为id和name,三维下标为数字索引 foreach ($typeHosts as $v) { $typeHost[$v['pid']]['id'][] = $v['id']; $typeHost[$v['pid']]['name'][] = $v['name']; } $typeShow = $types->order('sort ASC')->where('state = 4 AND pid != 0')->select(); //得到首页展示小分类 $typeIndex = $types->order('sort ASC')->where('state = 4 AND pid = 0')->select(); //得到首页展示小分类 $brands = M('brands')->field('id,logo,type_id')->where('state = 1')->select(); //遍历得到二维数组$brandList,下标1:ID,值为品牌ID号;下标2:logo,值为品牌logo图 foreach ($type as $v) { foreach ($brands as $res) { $index = strpos($res['type_id'], "{$v['id']}"); if ($index !== false) { $brandList[$v['id']]['id'][] = $res['id']; $brandList[$v['id']]['logo'][] = $res['logo']; } } } $goods = M('goods'); $goodsList = $goods->where('state = 2')->order('addtime DESC')->select(); //获取全部销售中商品(按时间排序) $goodsHot = $goods->where('state = 2')->order('salecount ASC')->select(); //获取全部销售中商品(按销量排序) $focus = getData('posts', 'state = 2', 'sort ASC'); //获取展示中的轮播图 $news = getData('news', 'state = 2', 'sort ASC'); //获取公告、特惠新闻 $links = getData('links', 'state = 2', 'sort ASC'); //获取友情链接 //dump($typeHost); $this->assign('goods', $goodsList); $this->assign('goodsHot', $goodsHot); $this->assign('typeHost', $typeHost); $this->assign('typeShow', $typeShow); $this->assign('typeIndex', $typeIndex); $this->assign('brands', $brandList); $this->assign('types', $typeList); $this->assign('focus', $focus); $this->assign('news', $news); $this->assign('links', $links); $this->display(); }
function v($n, $default = null) { $data = getData(); if (isset($data[$n])) { $v = $data[$n]; if ($v == 'on') { $v = true; } } else { $v = $default; } return $v; }
public static function processInput($dataInput) { $result = array(); $result = getData($dataInput); if (ValidationController::validate($dataInput)) { $commands = Controller::getCommandsFromInput($dataInput); $cursor = 1; for ($i = 0; $i < $commands[0]; $i++) { $cursor = Controller::interpreteSubCommand($commands, $cursor, $result); } } return $result; }
function requestProcessor($request) { echo "received request" . PHP_EOL; var_dump($request); if (!isset($request['type'])) { return "ERROR: unsupported message type"; } switch ($request['type']) { case "getData": $information = getData(); return $information; } //return array("returnCode" => '0', 'message'=>"Server received request and processed"); }
function getImg($id) { $questArr = getData($id); preg_match_all('/src="([^"]+)"/', $questArr, $images); $img = ''; foreach ($images[0] as $tag) { if (strpos($tag, 'p50x50') !== false) { $img = substr($tag, 5, -1); //echo $img ."<br/>"; break; } } return $img; }
function printData($matric) { echo "<table class='table'>\n <tr>\n <th>Matric</th>\n <th>Module</th>\n <th>Grade</th>\n </tr>"; if ($result = getData($matric)) { foreach ($result as $data) { echo "<tr>"; echo "<td>" . $data['matric'] . "</td>"; echo "<td>" . $data['mcode'] . "</td>"; echo "<td>" . $data['grade'] . "</td>"; echo "</tr>"; } } echo "</table>"; }
public function addPage($site, $name, $page) { $data = getData("{$site}Pages"); $name = strtolower($name); if ($data) { $pages = json_decode($data, true); $pages = !is_array($pages) ? array() : $pages; } else { $pages = array(); } $pages[$name] = $page; saveData("{$site}Pages", json_encode($pages)); return true; }