function getCustomers(array $where = array(), $andOr = 'AND') { $query = 'SELECT `id`,`firstname`,`lastname` FROM `customers`'; if ($where) { $query .= ' WHERE '; foreach ($where as $column => $value) { $query .= ' ' . $column . ' = ' . getQuote() . $value . getQuote() . ' ' . $andOr; } $query = substr($query, 0, -strlen($andOr)); } return queryResults($query); }
function quote2_func($atts) { //Start Function: list($price, $date) = getQuote('http://finance.yahoo.com/q?s=GAVAX', 'gavax'); list($price2, $date2) = getQuote('http://finance.yahoo.com/q?s=GAVIX', 'gavix'); return '<p style="text-align: center;"><span style="color: #ededed;"><strong>GAVAX (A-share) ' . $price . '</strong><br /><strong>GAVIX (I-share) ' . $price2 . '</strong><br /><em>' . $date . '</em><br />'; }
<tr> <th>Company</th> <th>Shares</th> <th>Current Price</th> <th>Current Value</th> <th>Trade</th> </tr> </thead> <tbody> <?php foreach ($portfolio as $item) { ?> <tr class="success"> <?php $curr_price = getQuote($item['symbol']); ?> <td><?php echo $item['symbol']; ?> </td> <td><?php echo $item['shares']; ?> </td> <td>$<?php echo $curr_price; ?> </td> <td>$<?php echo $item['shares'] * $curr_price;
function blobNoLoginHtmlEcho($pPage, $right) { $homepage = BLOB_WEB_PAGE_TO_ROOT . 'index.php'; $pmenuBlocks = array(); $pmenuBlocks[] = array('id' => 'login', 'name' => 'Login', 'url' => 'login.php'); $pmenuBlocks[] = array('id' => 'join', 'name' => 'Join', 'url' => 'join.php'); $pmenuBlocks[] = array('id' => 'about', 'name' => 'About', 'url' => 'about.php'); $primaryMenuHtml = ''; $pmenuBlockHtml = ''; foreach ($pmenuBlocks as $pmenuItem) { $selectedClass = $pmenuItem['id'] == $pPage['page_id'] ? 'selected' : ''; $fixedUrl = BLOB_WEB_PAGE_TO_ROOT . $pmenuItem['url']; $pmenuBlockHtml .= "<li onclick=\"window.location='{$fixedUrl}'\" class=\"{$selectedClass}\"><a href=\"{$fixedUrl}\">{$pmenuItem['name']}</a></li>"; } $primaryMenuHtml .= "<ul>{$pmenuBlockHtml}</ul>"; $quote = getQuote(); $messagesHtml = messagesPopAllToHtml(); if ($messagesHtml) { $messagesHtml = "<div class=\"body_padded\">{$messagesHtml}</div>"; } // Send Headers + main HTML code Header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 Header('Content-Type: text/html;charset=utf-8'); // TODO- proper XHTML headers... Header("Expires: Tue, 23 Jun 2009 12:00:00 GMT"); // Date in the past echo "\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n <head>\r\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\r\n <title>{$pPage['title']}</title>\r\n <link rel=\"stylesheet\" type=\"text/css\" href=\"" . BLOB_WEB_PAGE_TO_ROOT . "blob/css/login.css\" />\r\n <link rel=\"stylesheet\" type=\"text/css\" href=\"" . BLOB_WEB_PAGE_TO_ROOT . "blob/css/main.css\" />\r\n <link rel=\"icon\" type=\"\\image/ico\" href=\"" . BLOB_WEB_PAGE_TO_ROOT . "favicon.ico\" />\r\n {$pPage['script']}\r\n </head>\r\n <body {$pPage['onload']} class=\"home\">\r\n <div id=\"header\">\r\n <a href=\"{$homepage}\"><img class=\"header_img\" src=\"" . BLOB_WEB_PAGE_TO_ROOT . "blob/images/logo.png\" alt=\"blob\" height=40 width=60/></a>\r\n <div id=\"quote\">\r\n {$quote}\r\n </div>\r\n\r\n <div id=\"primary_menu\">\r\n {$primaryMenuHtml}\r\n </div>\r\n </div>\r\n <div id=\"wrapper\">\r\n <div id=\"container\" class=\"rounded-corners\">\r\n <div id=\"main_menu\">\r\n <div id=\"main_menu_padded\">\r\n\t\t {$right}\r\n </div>\r\n </div>\r\n <div id=\"main_body\" class=\"rounded-corners-left\">\r\n {$pPage['body']}\r\n <center>\r\n {$messagesHtml}\r\n </center>\r\n </div>\r\n <div class=\"clear\">\r\n </div>\r\n </div>\r\n <div id=\"footer\" class=\"rounded-corners\">\r\n <p>Greenify " . blobVersionGet() . " is a Free and OpenSource Microblogging client</p>\r\n </div>\r\n </div>\r\n </body>\r\n</html>"; }
$menu->addSubElement($mod, $lang->get('thread_move'), 'thread_move', array('boardid' => $boardid, 'threadid' => $threadid)); $menu->addSubElement($mod, $lang->get('thread_remove'), 'thread_remove', array('boardid' => $boardid, 'threadid' => $threadid)); $menu->addSubElement($mod, $lang->get('thread_edit'), 'thread_edit', array('boardid' => $boardid, 'threadid' => $threadid)); } // Increase hit counter if ($mode == '' and @$_GET['page'] == '') { incHits($threadid); } // add a post if (isset($_POST['add']) && $login->currentUser() !== false && $thread['closed'] == 0) { $postid = postAdd($threadid, $_POST['post'], @$_POST['attachments']); redirect(makeURL('board', array('boardid' => $boardid, 'threadid' => $threadid, 'page' => lastPage($threadid, $config->get('board', 'posts-per-page'))), 'post' . $postid)); } @($quoteid = (int) $_GET['quoteid']); if ($quoteid > 0) { $q = getQuote($quoteid); $u = $user->getUserByID($q['userid']); $a = str_replace("%u", $u['nickname'], $lang->get('quote_by')); $quote = '[quote][i][url="' . makeURL('profile', array('userid' => $q['userid'])) . '"]' . $a . "[/url][/i]\n" . $q['post'] . "[/quote]"; $smarty->assign('quote', $quote); } else { $smarty->assign('quote', ''); } // Pages $ppp = $config->get('board', 'posts-per-page'); @$pages->setValues($_GET['page'], $ppp, numPostsInThread($threadid)); $smarty->assign('pages', $pages->get('board', array('boardid' => $boardid, 'threadid' => $threadid))); $smarty->assign('path', $template_dir . "/thread.tpl"); $smarty->assign('board', $board); $smarty->assign('thread', $thread); @($pl = postList($threadid, $_GET['page']));
//die(); $date = strtotime($activity->date); if ($date < $yesterday) { continue; } $card = $trello->boards->get($board->id . "/cards/" . $activity->data->card->id); $card->board = $board; $data['yesterday'][$card->id] = $card; } echo "Done!\n"; } //print_r($data); $replace["today"] = $app->processCardlist($data["today"]); $replace["yesterday"] = $app->processCardlist($data["yesterday"]); $replace["todate"] = date('l'); $replace["thought"] = getQuote(); //print_r($replace); foreach ($replace as $n => $v) { $output = str_replace("{{data." . $n . "}}", $v, $output); } //print_r($me); /*print_r( $trello->boards->get($board->id."/lists", array( "cards"=>"all" )) ); print_r( $trello->boards->get($board->id."/actions", array( "cards"=>"all" ))
function sendTweets($search_term) { //username/pass db credentials include '/home/51949/users/.home/domains/z2.zootzy.com/html/ztbot/config/config.inc.php'; //Date/Time of execution $today = date("F j, Y, g:i a"); //base url for posting with curl $url = 'http://twitter.com/statuses/update.xml'; //Call this function in scrape.php, will return array $posts = getTwitterSearchFeedByJSON($search_term); $user_count = 0; echo "<h1>Twitter bot: <strong>{$bot_username}</strong></h1>"; echo "<h2>Tweet date/time: <strong>{$today}</strong></h2>"; for ($i = 0; $i < 10; $i++) { //grab user, post from array, then increment user counter $r_user = $posts[$user_count][0]; $r_text = $posts[$user_count][1]; $user_count++; //concatenate message to send $quo = getQuote(); $msg = "@{$r_user} {$quo}"; if ($bot_username != $r_user) { $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, $url); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status={$msg}"); curl_setopt($curl_handle, CURLOPT_USERPWD, "{$bot_username}:{$bot_password}"); $buffer = curl_exec($curl_handle); curl_close($curl_handle); if (empty($buffer)) { echo "Failure: tweet unsuccessfully posted<br />"; } else { echo "Your tweet has been submitted: <strong>{$msg}</strong> in response to: <strong>{$r_text}</strong><br />"; } } else { echo "Oooops, almost just tweeted myself, nope I caught it!<br />"; } } echo "<br />Searching and tweeting for: <strong>{$search_term}</strong><br />"; echo hourly_hits_left(); }