public static function getRange($start_date, $end_date) { $mysqli = new mysqli("localhost", "root", "password", "426project"); $query = "SELECT id FROM entries WHERE created_at >= '{$start_date}' AND created_at <= '{$end_date}' ORDER BY created_at"; console_log($query); $result = $mysqli->query($query); $entries = array(); if ($result) { for ($i = 1; $i < $start; $i++) { $result->fetch_row(); } for ($i = $start; $i <= $end; $i++) { $next_row = $result->fetch_row(); if ($next_row) { $entries[] = Entry::findByID($next_row[0]); } } } return $entries; }
public function index() { $this->load->model('field_module_model', 'field'); $data = $this->field->get_all()->result(); console_log($data); }
<?php include 'log.php'; // databaseInit.php connects to the DB, checks if the necessary base table exists, if not, creates it. // remember to $db.close() later $url = parse_url(getenv("CLEARDB_DATABASE_URL")); $server = $url["host"]; $username = $url["user"]; $password = $url["pass"]; $name = substr($url["path"], 1); $db = new mysqli($server, $username, $password, $name); // check that connection was successful if ($db->connect_errno > 0) { die('Unable to connect to database [' . $db->connect_error . ']'); } // check that decks exists if (!($result = $db->query("SHOW TABLES LIKE 'Decks'"))) { die('There was an error checking if Decks exists'); } $decksExists = $result->num_rows > 0; if (!$decksExists) { $sql = "CREATE TABLE Decks (ID int AUTO_INCREMENT, NAME varchar(64), PRIMARY KEY(ID))"; if (!($result = $db->query($sql))) { die('There was an error creating the Decks table'); } } console_log("success init");
<?php include '../../../php/functions.php'; console_log("Starting to get courses."); if (isset($_POST['option'])) { $subject = $_REQUEST['option']; $courseList = getCourses($subject); console_log("courses: " . $courseList); echo $courseList; } else { console_log("option did not get posted"); }
<?php require 'app.php'; require 'app-login.php'; require 'app-logout.php'; require 'app-user.php'; require 'app-feed.php'; console_log($accessToken); var_dump($profile); $content = ''; ?> <!doctype html> <html class="no-js"> <head> <meta charset="utf-8"> <title>Facebook Network Communication System</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="description" content=""> <meta name="viewport" content="width=device-width,initial-scale=1"> <link href="//www.google-analytics.com" rel="dns-prefetch"> <link href="//ajax.googleapis.com" rel="dns-prefetch"> <link href="assets/css/style.min.css" rel="stylesheet"> <script src="assets/components/modernizr.min.js"></script> <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body>
// validating the access token try { $request = $fb->get('/me'); } catch (Facebook\Exceptions\FacebookResponseException $e) { // When Graph returns an error if ($e->getCode() == 190) { unset($_SESSION['facebook_access_token']); $loginUrl = $helper->getLoginUrl($callback, $permissions); echo "<script>window.top.location.href='" . $loginUrl . "'</script>"; } exit; } catch (Facebook\Exceptions\FacebookSDKException $e) { // When validation fails or other local issues echo 'Facebook SDK returned an error: ' . $e->getMessage(); exit; } // header("Location: ./page.php"); } elseif ($helper->getError()) { // The user denied the request // You could log this data . . . console_log($helper->getError()); console_log($helper->getErrorCode()); console_log($helper->getErrorReason()); console_log($helper->getErrorDescription()); // You could display a message to the user // being all like, "What? You don't like me?" exit; } else { // login url $loginUrl = $helper->getLoginUrl($callback, $permissions); }
<?php /** * Here's a simple PHP file that converts CSS with REM measurements to PX */ error_reporting(E_ALL & ~E_NOTICE); function console_log() { echo "[", date('Y-m-d H:i:s'), "]\t", join(' ', func_get_args()), PHP_EOL; } $file = isset($argv[1]) ? $argv[1] : ''; if (!$file || !file_exists($file)) { die('First argument must be specified and must be a file that exists.' . PHP_EOL); } $tmp = explode('.', $file); $ext = array_pop($tmp); console_log('processing file', $file); $outfile = isset($argv[2]) ? $argv[1] : dirname($file) . DIRECTORY_SEPARATOR . basename($file, $ext) . 'px.' . $ext; console_log('Output file is : ', $outfile); $content = file_get_contents($file); console_log('file length: ', strlen($content)); $rootSize = intval(isset($argv[2]) ? $argv[2] : 0) ?: 10; console_log('Root size:', $rootSize, 'px'); $replaced = 0; $newContent = preg_replace_callback('/(\\d*(\\.?\\d+))?\\s*rem/', function ($matches) use($rootSize) { return floatval($matches[1]) * $rootSize . 'px'; }, $content, -1, $replaced); console_log('Replaced:', $replaced, 'items'); file_put_contents($outfile, $newContent); console_log('Written to output file, new size: ', filesize($outfile));
/** * @brief Use a REST service to geocode a single place name * * @param $placename (required) The name of a place to try geocoding (city level or higher) * * @note Inserts the geocoding result (success or failure) into the database * * @return A single GeoJSON feature on success or FALSE otherwise */ private function _geocode($placename) { try { if (isset($this->boundFailSelect)) { // Check if we've geocoded them before and failed $this->boundFailSelect->bindParam(":name", $placename); $this->boundFailSelect->execute(); if ($failure = $this->boundFailSelect->fetch(PDO::FETCH_LAZY)) { return FALSE; } } } catch (Exception $e) { console_log($e->getMessage()); } // Escape the place name the way the geocoder wants it $escapedplacename = preg_replace("/,[^ ]/", ", ", $placename); // geocoder wants spaces after commas $escapedplacename = urlencode($escapedplacename); // Escape for URL // Build the URL $url = "http://services.gisgraphy.com/fulltext/fulltextsearch?q={$escapedplacename}&placetype=City&placetype=Adm&placetype=Country&placetype=PoliticalEntity&from=1&to=1&format=json"; // Use file_get_contents for simplicity. $json = file_get_contents($url); // If file_get_contents failed don't log it into the database. Maybe we're throttled or there was a network snag or something. if ($json === FALSE) { return -1; } // Sample response: {responseHeader":{"status":0,"QTime":34},"response":{"numFound":2,"start":0,"maxScore":6.8620453,"docs":[{"feature_id":4997249,"name":"Ironwood","lat":46.45466995239258,"lng":-90.17101287841797,"placetype":"City","country_code":"US","country_flag_url":"/images/flags/US.png","feature_class":"P","feature_code":"PPL","name_ascii":"Ironwood","elevation":459,"gtopo30":459,"timezone":"America/Menominee","population":5387,"fully_qualified_name":"Ironwood, Gogebic County, Michigan","google_map_url":"http://maps.google.com/maps?f=q&ie=UTF-8&iwloc=addr&om=1&z=12&q=Ironwood&ll=46.48466995239258,-90.17101287841797","yahoo_map_url":"http://maps.yahoo.com/broadband?mag=6&mvt=m&lon=-90.17101287841797&lat=46.45466995239258","country_name":"United States","zipcode":["49938","49938"],"score":6.8620453}]},"spellcheck":{"suggestions":[]}} $ret = json_decode($json); // turn response into json // Check if we got anything. Give up if we didn't if ($ret->response->numFound == 0) { try { if (isset($this->boundFailInsert)) { // There's nothing we can do. Take a note, then carry on $this->boundFailInsert->bindParam(':name', $placename); $time = time(); $this->boundFailInsert->bindParam(':lasttry', $time); $this->boundFailInsert->execute(); } } catch (Exception $e) { console_log($e->getMessage()); } return FALSE; } try { $foundPlace = $ret->response->docs[0]; if (isset($this->boundInsert)) { // Insert the first result $this->boundInsert->bindParam(":name", $placename); $this->boundInsert->bindParam(":fully_qualified_name", $foundPlace->fully_qualified_name); $this->boundInsert->bindParam(":lat", $foundPlace->lat); $this->boundInsert->bindParam(":lng", $foundPlace->lng); $this->boundInsert->execute(); } } catch (Exception $e) { console_log($e->getMessage()); } // This is lazy, but we're going to immediately fetch it from the db again. return $this->makeFeature($placename, $foundPlace->fully_qualified_name, $foundPlace->lng, $foundPlace->lat); }
function doc_enrollment_submission($entry, $form) { global $woocommerce; $first_name = rgar($entry, '2'); $last_name = rgar($entry, '65'); $gender = rgar($entry, '4'); $dob = rgar($entry, '5'); $phone = rgar($entry, '6'); $phone2 = rgar($entry, '64'); $email = rgar($entry, '7'); $pc = rgar($entry, '8'); $reason_for_seeking_treatment = rgar($entry, '9'); $height = rgar($entry, '10'); $weight = rgar($entry, '11'); $blood_pressure = rgar($entry, '12'); $pulse = rgar($entry, '13'); $tobbacco = rgar($entry, '15'); $alcohol = rgar($entry, '16'); $caffeine = rgar($entry, '17'); $no_allergies = rgar($entry, '19.1'); $penicillin = rgar($entry, '19.2'); $sulfa_drug = rgar($entry, '19.3'); $nitrate = rgar($entry, '19.4'); $morphine = rgar($entry, '19.5'); $food = rgar($entry, '19.6'); $dye_allergies = rgar($entry, '19.7'); $seasonal = rgar($entry, '19.8'); $pet = rgar($entry, '19.9'); $codeine = rgar($entry, '19.11'); //console_log('allergies= ' . rgar( $entry, '19.1' )); $no_otc = rgar($entry, '21.1'); $aspirin = rgar($entry, '21.2'); $naproxen = rgar($entry, '21.3'); $acid_blockers = rgar($entry, '21.4'); $ketaprofen = rgar($entry, '21.5'); $decongestant = rgar($entry, '21.6'); $cough = rgar($entry, '21.7'); $laxatives = rgar($entry, '21.8'); $antihistamines = rgar($entry, '21.9'); $antacids = rgar($entry, '21.11'); $ibuprofen = rgar($entry, '21.12'); $acetaminophen = rgar($entry, '21.13'); $sleep_aids = rgar($entry, '21.14'); $diet_aids = rgar($entry, '21.15'); $antidiarrheal = rgar($entry, '21.16'); $pain_reliever = rgar($entry, '21.17'); //console_log($otc); $no_conditions = rgar($entry, '23.1'); $lung_issues = rgar($entry, '23.2'); $hbp = rgar($entry, '23.3'); $ulcers = rgar($entry, '23.4'); $migraines = rgar($entry, '23.5'); $depression = rgar($entry, '23.6'); $hormone_related = rgar($entry, '23.7'); $thyroid = rgar($entry, '23.8'); $eye_disease = rgar($entry, '23.9'); $epilepsy = rgar($entry, '23.11'); $blood_clotting = rgar($entry, '23.12'); $high_cholesterol = rgar($entry, '23.13'); //console_log($conditions); $medications = rgar($entry, '25'); $heart_disease = rgar($entry, '27'); //console_log($heart_disease); $heart_disease_relation = rgar($entry, '28'); $high_blood_pressure = rgar($entry, '29'); $high_blood_pressure_relation = rgar($entry, '30'); $diabetes = rgar($entry, '31'); $diabetes_relation = rgar($entry, '32'); $arthritis = rgar($entry, '33'); $arthritis_relation = rgar($entry, '34'); $skin_disorders = rgar($entry, '35'); $skin_disorders_relation = rgar($entry, '36'); $cancer = rgar($entry, '37'); $cancer_relation = rgar($entry, '38'); $pregnant = rgar($entry, '40'); $last_cycle = rgar($entry, '41'); $abnormal_cycle = rgar($entry, '42'); $breast_cancer = rgar($entry, '43'); $order_user = get_user_by('email', $email); console_log($order_user); $user_id = $order_user->ID; $items = $woocommerce->cart->get_cart(); //console_log($items); $order = wc_create_order(array('customer_id' => $user_id)); foreach ($items as $item => $values) { $product_ID = $values['product_id']; $order->add_product(get_product($values['product_id']), $values['quantity']); //(get_product with id and next is for quantity) } $title = get_the_title(); $order_id = $title; update_post_meta($order_id, '_patient-first-name', sanitize_text_field($first_name)); update_post_meta($order_id, '_patient-last-name', sanitize_text_field($last_name)); update_post_meta($order_id, '_gender', sanitize_text_field($gender)); update_post_meta($order_id, '_dob', sanitize_text_field($dob)); update_post_meta($order_id, '_primary-phone-number', sanitize_text_field($phone)); update_post_meta($order_id, '_addtional-phone-number', sanitize_text_field($phone2)); update_post_meta($order_id, '_email-address', sanitize_text_field($email)); update_post_meta($order_id, '_primary-physician', sanitize_text_field($pc)); update_post_meta($order_id, '_reason-for-seeking-treatment', sanitize_text_field($reason_for_seeking_treatment)); update_post_meta($order_id, '_height', sanitize_text_field($height)); update_post_meta($order_id, '_weight', sanitize_text_field($weight)); update_post_meta($order_id, '_bp', sanitize_text_field($blood_pressure)); update_post_meta($order_id, '_pulse', sanitize_text_field($pulse)); update_post_meta($order_id, '_tobbacco', sanitize_text_field($tobbacco)); update_post_meta($order_id, '_alcohol', sanitize_text_field($alcohol)); update_post_meta($order_id, '_caffeine', sanitize_text_field($caffeine)); update_post_meta($order_id, '_no-allergies', sanitize_text_field($no_allergies)); update_post_meta($order_id, '_no_otc', sanitize_text_field($no_otc)); update_post_meta($order_id, '_aspirin', sanitize_text_field($aspirin)); update_post_meta($order_id, '_naproxen', sanitize_text_field($naproxen)); update_post_meta($order_id, '_acid-blockers', sanitize_text_field($acid_blockers)); update_post_meta($order_id, '_ketaprofen', sanitize_text_field($ketaprofen)); update_post_meta($order_id, '_decongestant', sanitize_text_field($decongestant)); update_post_meta($order_id, '_cough-suppressant', sanitize_text_field($cough)); update_post_meta($order_id, '_laxatives', sanitize_text_field($laxatives)); update_post_meta($order_id, '_antihistamines', sanitize_text_field($antihistamines)); update_post_meta($order_id, '_antacids', sanitize_text_field($antacids)); update_post_meta($order_id, '_ibuprofen', sanitize_text_field($ibuprofen)); update_post_meta($order_id, '_acetaminophen', sanitize_text_field($acetaminophen)); update_post_meta($order_id, '_sleep-aids', sanitize_text_field($sleep_aids)); update_post_meta($order_id, '_diet-aids', sanitize_text_field($diet_aids)); update_post_meta($order_id, '_antidiarrheal', sanitize_text_field($antidiarrheal)); update_post_meta($order_id, '_pain-reliever', sanitize_text_field($pain_reliever)); update_post_meta($order_id, '_no-conditions', sanitize_text_field($no_conditions)); update_post_meta($order_id, '_lung-issues', sanitize_text_field($lung_issues)); update_post_meta($order_id, '_high-blood-pressure-condition', sanitize_text_field($hbp)); update_post_meta($order_id, '_ulcers', sanitize_text_field($ulcers)); update_post_meta($order_id, '_migraines', sanitize_text_field($migraines)); update_post_meta($order_id, '_depression', sanitize_text_field($depression)); update_post_meta($order_id, '_hormone-related', sanitize_text_field($hormone_related)); update_post_meta($order_id, '_thyroid', sanitize_text_field($thyroid)); update_post_meta($order_id, '_eye-disease', sanitize_text_field($eye_disease)); update_post_meta($order_id, '_epilepsy', sanitize_text_field($epilepsy)); update_post_meta($order_id, '_blood-clotting-issue', sanitize_text_field($blood_clotting)); update_post_meta($order_id, '_high-cholesterol', sanitize_text_field($high_cholesterol)); update_post_meta($order_id, '_penicillin', sanitize_text_field($penicillin)); update_post_meta($order_id, '_sulfa-drug', sanitize_text_field($sulfa_drug)); update_post_meta($order_id, '_nitrate', sanitize_text_field($nitrate)); update_post_meta($order_id, '_morphine', sanitize_text_field($morphine)); update_post_meta($order_id, '_food', sanitize_text_field($food)); update_post_meta($order_id, '_dye-allergies', sanitize_text_field($dye_allergies)); update_post_meta($order_id, '_seasonal', sanitize_text_field($seasonal)); update_post_meta($order_id, '_pet', sanitize_text_field($pet)); update_post_meta($order_id, '_codeine', sanitize_text_field($codeine)); update_post_meta($order_id, '_medication', sanitize_text_field($medications)); update_post_meta($order_id, '_heart-disease', sanitize_text_field($heart_disease)); update_post_meta($order_id, '_heart-disease-relationship', sanitize_text_field($heart_disease_relation)); update_post_meta($order_id, '_high-blood-pressure', sanitize_text_field($high_blood_pressure)); update_post_meta($order_id, '_high-blood-pressure-relationship', sanitize_text_field($high_blood_pressure_relation)); update_post_meta($order_id, '_diabetes', sanitize_text_field($diabetes)); update_post_meta($order_id, '_diabetes-relationship', sanitize_text_field($diabetes_relation)); update_post_meta($order_id, '_arthritis', sanitize_text_field($arthritis)); update_post_meta($order_id, '_arthritis-relationship', sanitize_text_field($arthritis_relation)); update_post_meta($order_id, '_skin-disorders', sanitize_text_field($skin_disorders)); update_post_meta($order_id, '_skin-disorders-relationship', sanitize_text_field($skin_disorders_relation)); update_post_meta($order_id, '_cancer', sanitize_text_field($cancer)); update_post_meta($order_id, '_cancer-relationship', sanitize_text_field($cancer_relation)); update_post_meta($order_id, '_are-you-currently-pregnant', sanitize_text_field($pregnant)); update_post_meta($order_id, '_last-menstrual-cycle', sanitize_text_field($last_cycle)); update_post_meta($order_id, '_abnormal-period-cycle', sanitize_text_field($abnormal_cycle)); update_post_meta($order_id, '_breast_cancer', sanitize_text_field($breast_cancer)); // Updating User Meta update_user_meta($user_id, 'first_name', sanitize_text_field($first_name)); update_user_meta($user_id, 'last_name', sanitize_text_field($last_name)); update_user_meta($user_id, '_patient-first-name', sanitize_text_field($first_name)); update_user_meta($user_id, '_patient-last-name', sanitize_text_field($last_name)); update_user_meta($user_id, '_gender', sanitize_text_field($gender)); update_user_meta($user_id, '_dob', sanitize_text_field($dob)); update_user_meta($user_id, '_primary-phone-number', sanitize_text_field($phone)); update_user_meta($user_id, '_addtional-phone-number', sanitize_text_field($phone2)); update_user_meta($user_id, '_email-address', sanitize_text_field($email)); update_user_meta($user_id, '_primary-physician', sanitize_text_field($pc)); update_user_meta($user_id, '_reason-for-seeking-treatment', sanitize_text_field($reason_for_seeking_treatment)); update_user_meta($user_id, '_height', sanitize_text_field($height)); update_user_meta($user_id, '_weight', sanitize_text_field($weight)); update_user_meta($user_id, '_bp', sanitize_text_field($blood_pressure)); update_user_meta($user_id, '_pulse', sanitize_text_field($pulse)); update_user_meta($user_id, '_tobbacco', sanitize_text_field($tobbacco)); update_user_meta($user_id, '_alcohol', sanitize_text_field($alcohol)); update_user_meta($user_id, '_caffeine', sanitize_text_field($caffeine)); update_user_meta($user_id, '_no-allergies', sanitize_text_field($no_allergies)); update_user_meta($user_id, '_no_otc', sanitize_text_field($no_otc)); update_user_meta($user_id, '_aspirin', sanitize_text_field($aspirin)); update_user_meta($user_id, '_naproxen', sanitize_text_field($naproxen)); update_user_meta($user_id, '_acid-blockers', sanitize_text_field($acid_blockers)); update_user_meta($user_id, '_ketaprofen', sanitize_text_field($ketaprofen)); update_user_meta($user_id, '_decongestant', sanitize_text_field($decongestant)); update_user_meta($user_id, '_cough-suppressant', sanitize_text_field($cough)); update_user_meta($user_id, '_laxatives', sanitize_text_field($laxatives)); update_user_meta($user_id, '_antihistamines', sanitize_text_field($antihistamines)); update_user_meta($user_id, '_antacids', sanitize_text_field($antacids)); update_user_meta($user_id, '_ibuprofen', sanitize_text_field($ibuprofen)); update_user_meta($user_id, '_acetaminophen', sanitize_text_field($acetaminophen)); update_user_meta($user_id, '_sleep-aids', sanitize_text_field($sleep_aids)); update_user_meta($user_id, '_diet-aids', sanitize_text_field($diet_aids)); update_user_meta($user_id, '_antidiarrheal', sanitize_text_field($antidiarrheal)); update_user_meta($user_id, '_pain-reliever', sanitize_text_field($pain_reliever)); update_user_meta($user_id, '_no-conditions', sanitize_text_field($no_conditions)); update_user_meta($user_id, '_lung-issues', sanitize_text_field($lung_issues)); update_user_meta($user_id, '_high-blood-pressure-condition', sanitize_text_field($hbp)); update_user_meta($user_id, '_ulcers', sanitize_text_field($ulcers)); update_user_meta($user_id, '_migraines', sanitize_text_field($migraines)); update_user_meta($user_id, '_depression', sanitize_text_field($depression)); update_user_meta($user_id, '_hormone-related', sanitize_text_field($hormone_related)); update_user_meta($user_id, '_thyroid', sanitize_text_field($thyroid)); update_user_meta($user_id, '_eye-disease', sanitize_text_field($eye_disease)); update_user_meta($user_id, '_epilepsy', sanitize_text_field($epilepsy)); update_user_meta($user_id, '_blood-clotting-issue', sanitize_text_field($blood_clotting)); update_user_meta($user_id, '_high-cholesterol', sanitize_text_field($high_cholesterol)); update_user_meta($user_id, '_penicillin', sanitize_text_field($penicillin)); update_user_meta($user_id, '_sulfa-drug', sanitize_text_field($sulfa_drug)); update_user_meta($user_id, '_nitrate', sanitize_text_field($nitrate)); update_user_meta($user_id, '_morphine', sanitize_text_field($morphine)); update_user_meta($user_id, '_food', sanitize_text_field($food)); update_user_meta($user_id, '_dye-allergies', sanitize_text_field($dye_allergies)); update_user_meta($user_id, '_seasonal', sanitize_text_field($seasonal)); update_user_meta($user_id, '_pet', sanitize_text_field($pet)); update_user_meta($user_id, '_codeine', sanitize_text_field($codeine)); update_user_meta($user_id, '_medication', sanitize_text_field($medications)); update_user_meta($user_id, '_heart-disease', sanitize_text_field($heart_disease)); update_user_meta($user_id, '_heart-disease-relationship', sanitize_text_field($heart_disease_relation)); update_user_meta($user_id, '_high-blood-pressure', sanitize_text_field($high_blood_pressure)); update_user_meta($user_id, '_high-blood-pressure-relationship', sanitize_text_field($high_blood_pressure_relation)); update_user_meta($user_id, '_diabetes', sanitize_text_field($diabetes)); update_user_meta($user_id, '_diabetes-relationship', sanitize_text_field($diabetes_relation)); update_user_meta($user_id, '_arthritis', sanitize_text_field($arthritis)); update_user_meta($user_id, '_arthritis-relationship', sanitize_text_field($arthritis_relation)); update_user_meta($user_id, '_skin-disorders', sanitize_text_field($skin_disorders)); update_user_meta($user_id, '_skin-disorders-relationship', sanitize_text_field($skin_disorders_relation)); update_user_meta($user_id, '_cancer', sanitize_text_field($cancer)); update_user_meta($user_id, '_cancer-relationship', sanitize_text_field($cancer_relation)); update_user_meta($user_id, '_are-you-currently-pregnant', sanitize_text_field($pregnant)); update_user_meta($user_id, '_last-menstrual-cycle', sanitize_text_field($last_cycle)); update_user_meta($user_id, '_abnormal-period-cycle', sanitize_text_field($abnormal_cycle)); update_user_meta($user_id, '_breast_cancer', sanitize_text_field($breast_cancer)); }
function adminValidate($pid) { console_log("admin" . $pid); # Make the query global $dbc; $query = "SELECT user_id FROM admin WHERE user_id = {$pid};"; # Execute the query $results = pg_query($dbc, $query); check_results($results); $rows = pg_num_rows($results); # If we get no rows, the login failed if ($rows == 0) { console_log("admin false"); return false; } else { console_log("admin true"); return true; } # We have at least one row, so get the first one and return it #$row = pg_fetch_array($results, NULL, PGSQL_ASSOC) ; #echo "ROW: " . $row; #$pid = (isset($row['user_id']) ? $row['user_id'] : null); #if($pid == null){ # echo "The pid is null"; #} #echo "Found PID: " . $pid; #return intval($pid) ; }
} else { // 过滤出若干张jpg图片用于展示。 foreach ($items as $item) { if ($item['mimeType'] == 'image/jpeg') { $pics[] = $item; if (count($pics) >= 10) { break; } } } } //var_dump($pics); $smarty = new Smarty(); // 简单的判断是否运行于SAE环境中,因为SAE中不允许写本地,需要额外处理. if (defined('SAE_TMP_PATH')) { console_log("SAE_TMP_PATH: " . SAE_TMP_PATH); $smarty->compile_dir = SAE_TMP_PATH; $smarty->cache_dir = SAE_TMP_PATH; } //$smarty->testInstall(); exit; $smarty->assign('ak', $ak); $smarty->assign('sk', $sk); $smarty->assign('bucket', $bucket); $smarty->assign('domain', $domain); $smarty->assign('pics', $pics); if (count($pics) > 0) { $smarty->assign('sn', $sn); // Properties $props['key'] = $sn; list($ret, $err) = $bm->stat($bucket, $sn); if ($err == null) {
/** * Get shipping methods. * * @access public */ function wc_cart_totals_shipping_html() { $packages = WC()->shipping->get_packages(); console_log('packages= ' . $packages); foreach ($packages as $i => $package) { $chosen_method = isset(WC()->session->chosen_shipping_methods[$i]) ? WC()->session->chosen_shipping_methods[$i] : ''; $product_names = array(); if (sizeof($packages) >= 0) { foreach ($package['contents'] as $item_id => $values) { $product_names[] = $values['data']->get_title() . ' ×' . $values['quantity']; } } wc_get_template('cart/cart-shipping.php', array('package' => $package, 'available_methods' => $package['rates'], 'show_package_details' => sizeof($packages) > 1, 'package_details' => implode(', ', $product_names), 'package_name' => apply_filters('woocommerce_shipping_package_name', sprintf(_n('Shipping', 'Shipping %d', $i + 1, 'woocommerce'), $i + 1), $i, $package), 'index' => $i, 'chosen_method' => $chosen_method)); } }