예제 #1
0
 public function index()
 {
     $pid = I('get.pid');
     $region = get_region($pid);
     if ($region) {
         $this->success($region);
     }
 }
예제 #2
0
    $recData['fax'] = $muujad[0]['fax'];
    $recData['http'] = $muujad[0]['http'];
    $recData['markused'] = $muujad[0]['add_info'];
    $recData['index'] = $muujad[0]['postalcode'];
    $recData['country'] = $muujad[0]['country'];
    $recData['region'] = $muujad[0]['region'];
    $recData['city'] = $muujad[0]['city'];
    $recData['address'] = $muujad[0]['address'];
    $country = get_country();
    $region = get_region(0, $recData['country']);
    $city = get_city(0, $recData['region'], $recData['country']);
} else {
    $country = get_country();
    if ($_POST['form_country']) {
        $recData['country'] = $_POST['form_country'];
        $region = get_region(0, $_POST['form_country']);
        if ($_POST['form_region']) {
            $recData['region'] = $_POST['form_region'];
            $city = get_city(0, $_POST['form_region'], $_POST['form_country']);
            $recData['city'] = $_POST['form_city'];
        }
    }
}
$engSmarty->assign("region", $region);
$engSmarty->assign("country", $country);
$engSmarty->assign("city", $city);
if (is_array($muujad)) {
    $engSmarty->assign("muujad", $muujad);
}
if ($_POST['formUser_submit']) {
    if (!$recData['fname']) {
예제 #3
0
            <span class="icon-bar"></span>
          </button>
          <b>GiveRooms<small style="font-size: 16px;">.com</small></b>
        </div>
        <div id="navbar" class="navbar-collapse collapse">

          <ul class="nav navbar-nav navbar-right">
            <li class="active"><a href="<?php 
echo base_url();
?>
">Home<span class="sr-only">(current)</span></a></li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Hotel <span class="caret"></span></a>
              <ul class="dropdown-menu hover-menu-edit">
                <?php 
$regions = get_region();
foreach ($regions as $region) {
    ?>
                <li><a href="hotels-in-<?php 
    echo slug_url($region->region_name_en);
    ?>
">Hotels in <?php 
    echo $region->region_name_en;
    ?>
<span class="badge pull-right"><?php 
    echo get_total_hotel($region->region_id);
    ?>
</span></a></li>
                <?php 
}
?>
예제 #4
0
function get_id()
{
    $region = get_region();
    if ($region == "ca") {
        $aws_partner_id = "linuhardgui01-20";
    } elseif ($region == "co.uk") {
        $aws_partner_id = "linuhardguid-21";
    } elseif ($region == "de") {
        $aws_partner_id = "linuxnetmagor-21";
    } elseif ($region == "fr") {
        $aws_partner_id = "linuhardgui01-21";
    } elseif ($region == "es") {
        $aws_partner_id = "linuhardgu061-21";
    } elseif ($region == "it") {
        $aws_partner_id = "linuhardgui05-21";
    } elseif ($region == "co.jp") {
        $aws_partner_id = "linuhardgui22-22";
        //}elseif ($region == "com.br"){
        //    	$aws_partner_id ="linuhardgui22-22";
    } elseif ($region == "cn") {
        $aws_partner_id = "linuhardgui23-23";
    } elseif ($region == "in") {
        $aws_partner_id = "linuxhardwagu-21";
    } elseif ($region == "nl") {
        $aws_partner_id = "linuxnetmagor-21";
    } else {
        // com as default
        $aws_partner_id = "linuhardguid-20";
    }
    //print "Region: $region <br>ID: $aws_partner_id<br>";
    return $aws_partner_id;
}
예제 #5
0
function get_local_region()
{
    return get_region(get_local_cluster_id());
}
예제 #6
0
}
if ($recData['country']) {
    if ($recData['region']) {
        if ($recData['ID']) {
            $city = get_city($recData['ID']);
            $recData['city'] = $recData['ID'];
            if (!$_POST['formUser_submit']) {
                $recData['value_est'] = $city[0]['name_est'];
                $recData['value_eng'] = $city[0]['name_eng'];
                $recData['value_rus'] = $city[0]['name_rus'];
            }
        }
        $region = get_region($recData['region']);
    } else {
        if ($recData['ID']) {
            $region = get_region($recData['ID']);
            if (!$_POST['formUser_submit']) {
                $recData['value_est'] = $region[0]['name_est'];
                $recData['value_eng'] = $region[0]['name_eng'];
                $recData['value_rus'] = $region[0]['name_rus'];
                $recData['path'] = $region[0]['path'];
            }
        }
    }
    $country = get_country($recData['country']);
} else {
    if ($recData['ID']) {
        $country = get_country($recData['ID']);
        if (!$_POST['formUser_submit']) {
            $recData['value_est'] = $country[0]['name_est'];
            $recData['value_eng'] = $country[0]['name_eng'];
예제 #7
0
function lookupGeoLocation($ip) {
    if ($_loc=geoip_record_by_name($ip)) {
        $_loc['timezone'] = get_time_zone($_loc['country_code'], $_loc['region']);
        $_loc['region'] = get_region($_loc['country_code'], $_loc['region']);

        $country_transition = array(
            "A1" => "N/A",
            "A2" => "N/A",
            "O1" => "N/A",
            "AP" => "N/A",
            "GB" => "UK");

        if (array_key_exists($_loc['country_code'],$country_transition)) {
            $_loc['country_code'] = $country_transition[$_loc['country_code']];
        }

        return $_loc;
    } else {
        return array();
    }
}
function affilinet()
{
    //echo "Affilinet Output:<br>";
    $PostID = get_the_ID();
    $ProductID_TMP = get_post_meta($PostID, 'PID_affilinet', true);
    $ProductID = split(",", $ProductID_TMP);
    //$ProductID=106020024;
    if ($ProductID == "") {
        return;
    }
    $region = get_region();
    $path = "/var/www/wordpress/wp-content/plugins/lhg-product-post";
    if (is_array($ProductID)) {
        //echo "Is array!";
        for ($i = 0; $i < sizeof($ProductID); $i++) {
            //echo "I: $i";
            exec("/usr/bin/php {$path}/affilinet.php \"" . (int) $ProductID[$i] . "\" {$PostID} {$region} >> /tmp/affilinet.log 2>> /tmp/affilinet.log &");
        }
    } else {
        exec("/usr/bin/php {$path}/affilinet.php \"" . (int) $ProductID . "\" {$PostID} {$region} >> /tmp/affilinet.log 2>> /tmp/affilinet.log &");
    }
    return;
}
function wp_one_post_widget($args, $vars = array())
{
    extract($args);
    $widget_number = (int) str_replace('wp-one-post-widget-', '', @$widget_id);
    $options = get_option('wp_one_post_widget');
    if (!empty($options[$widget_number])) {
        $vars = $options[$widget_number];
    }
    // ------ data used by several parts ----------
    $title = translate_title(get_the_title());
    $s = explode("(", $title);
    $short_title = trim($s[0]);
    global $post;
    global $wpdb;
    global $lhg_price_db;
    global $lang;
    global $txt_summary;
    global $txt_supplier;
    global $txt_cheapest_supplier;
    global $txt_rating;
    global $txt_select;
    global $txt_ratings;
    global $txt_sim_tags;
    global $txt_combine_tags;
    global $txt_wpop_register;
    global $txt_register_long;
    global $txt_send;
    global $txt_manage_subscr;
    global $txt_not_avail;
    global $txt_rate_yourself;
    global $txt_wpop_register;
    global $txt_button_string;
    //defined by amazon-product-in-a-post.php
    //echo "ID: $post->ID";
    if (is_single($post->ID)) {
        $querystr = "\r\n    SELECT {$wpdb->posts}.* \r\n    FROM {$wpdb->posts}\r\n    WHERE {$wpdb->posts}.post_title = '" . $vars['title'] . "'\r\n    AND {$wpdb->posts}.post_status = 'publish' \r\n    AND {$wpdb->posts}.post_type = 'post'\r\n  ";
        $pageposts = $wpdb->get_results($querystr, OBJECT);
        foreach ($pageposts as $post) {
            setup_postdata($post);
            $title = $post->post_title;
            $excerpt = $post->post_excerpt;
            if (!$excerpt) {
                $excerpt = substr($post->post_content, 0, 100);
            }
            if (!$vars['thumbnail_position']) {
                $vars['thumbnail_position'] = 'left';
            }
            $thumb = get_the_post_thumbnail($post->ID, 'thumbnail', array('class' => $vars['thumbnail_position']));
            $link = get_permalink($post->ID);
        }
        echo "\n{$before_widget}";
        echo '
    <div class="topright" style="border: 1px solid #2b8fc3; padding-left: 3px; padding-right:3px; padding-top: 1px; margin-bottom: 10px; background-color: #fff; padding-bottom: 17px;">';
        echo '
        <div class="wp-one-summary">' . $txt_summary . "</div>";
        //	if(empty($vars['custom_title'])): echo $before_title . "A".$vars['title'] . $after_title; else: echo "<h2>".$vars['custom_title'] . "</h2>"; endif;
        if ($vars['use_thumbnail'] == 'yes') {
            $content_widget = $thumb . '<p>' . $excerpt . ' <a href="' . $link . '">' . $vars['readmore'] . '</a></p>';
        } else {
            $content_widget = '<p>' . $excerpt . ' <a href="' . $link . '">' . $vars['readmore'] . '</a></p>';
        }
        //$thumb = get_the_post_thumbnail($post->ID);
        //echo "$thumb";
        //Rating Overview
        $post_id = $post->ID;
        // Check IP From IP Logging Database
        #$get_rates = $wpdb->get_results("SELECT rating_rating FROM $wpdb->ratings WHERE rating_postid = $post_id");
        //echo "Nr: ".sizeof($get_rates);
        $rating1 = 0;
        $rating2 = 0;
        $rating3 = 0;
        $rating4 = 0;
        $rating5 = 0;
        $rating_total = 0;
        #foreach($get_rates as $get_rate){
        #        $rating_total++;
        #
        #        if ($get_rate->rating_rating == 1 ) $rating1++;
        #        if ($get_rate->rating_rating == 2 ) $rating2++;
        #        if ($get_rate->rating_rating == 3 ) $rating3++;
        #        if ($get_rate->rating_rating == 4 ) $rating4++;
        #        if ($get_rate->rating_rating == 5 ) $rating5++;
        #
        #}
        if ($lang != "de") {
            $ratings = $lhg_price_db->get_results("SELECT * FROM  `lhgtransverse_posts` WHERE postid_com = {$post_id}");
        }
        if ($lang == "de") {
            $ratings = $lhg_price_db->get_results("SELECT * FROM  `lhgtransverse_posts` WHERE postid_de = {$post_id}");
        }
        #var_dump($ratings);
        $rating1 = $ratings[0]->post_ratings_1_com + $ratings[0]->post_ratings_1_de;
        $rating2 = $ratings[0]->post_ratings_2_com + $ratings[0]->post_ratings_2_de;
        $rating3 = $ratings[0]->post_ratings_3_com + $ratings[0]->post_ratings_3_de;
        $rating4 = $ratings[0]->post_ratings_4_com + $ratings[0]->post_ratings_4_de;
        $rating5 = $ratings[0]->post_ratings_5_com + $ratings[0]->post_ratings_5_de;
        $rating_total = $ratings[0]->post_ratings_users_com + $ratings[0]->post_ratings_users_de;
        #$rating1 + $rating2 + $rating3 + $rating4 + $rating5;
        //echo "<table cellspacing=0 cellpadding=0 border=1>
        //        <tr>
        //        <td width=90%>";
        //echo "</td></tr></table> ";
        global $vspacer;
        $vspacer = '<div class="spacer" style="border-top: 1px solid #2b8fc3; height: 0px; margin-top: 9px; margin-bottom: 9px;"></div>';
        // ---- Overview - cheapest supplier
        // get cheapest supplier
        $cheapest_supplier_id = lhg_db_get_cheapest_supplier_id($post->ID);
        #echo "CID: $cheapest_supplier_id <br>";
        if ($cheapest_supplier_id != "") {
            lhg_show_supplier_square($cheapest_supplier_id, $post->ID);
        }
        if ($cheapest_supplier_id == "") {
            lhg_show_supplier_square_default($post->ID);
        }
        //get price & url from DB
        $region = get_region();
        #        $meta="price-amazon.".$region;
        #        $aprice = get_post_meta($post->ID,$meta,true);
        #        $meta="url-amazon.".$region;
        #        $aurl=get_post_meta($post->ID,$meta,true); //amaz_url($post->ID);
        //still undefined?
        #	if ($aurl == ""){
        #	  $aid=get_id();
        #          $aurl = 'http://www.amazon.'.$region.'/?_encoding=UTF8&camp=15121&creative=390961&linkCode=ur2&tag='.$aid;
        #        }
        /*
        if ( ($region == "de") or ($region == "fr") or ($region == "it") or ($region == "es")) {
                $aprice=str_replace(".","",$aprice);
        }else{
        	        $aprice=str_replace(",","",$aprice);
        	        //$aprice=str_replace(",",".",$aprice);
        }
        */
        //echo "AP0: $aprice";
        #        $aprice = lhg_amazon_price_to_float ( $aprice , $region );
        //echo "AP1: $aprice";
        //
        // affilinet prices
        //
        if ($lang == "de debug") {
            //echo "A";
            $meta = "affilinet_PID";
            $aff_PID = get_post_meta($post->ID, $meta, true);
            //amaz_url($post->ID);
            if ($aff_PID == "") {
                //check for wrong entered PID
                $meta = "PID_affilinet";
                $aff_PID = get_post_meta($post->ID, $meta, true);
                //amaz_url($post->ID);
                //echo "affPID: $aff_PID";
            }
            if ($aff_PID != "") {
                // check for multiple PIDs
                $PIDlist = str_getcsv($aff_PID, ";");
                $num = count($PIDlist);
                //echo "Num: $num <br>PIDlist0: $PIDlist[0]<br>";
                //echo "PIDlist1: $PIDlist[1]<br>";
                if ($num == 1) {
                    list($aff_date, $aff_shop_id, $aff_price, $aff_shipping, $aff_url) = get_price_aff($aff_PID);
                    $cheapestURL = str_replace("+++++", ";", $aff_url);
                    //echo "Cheap: $cheapestURL<br>";
                    $tprice = $aff_price + $aff_shipping;
                    //echo "TP: $tprice <br>";
                    if ($aff_shop_id == 1739) {
                        $pcount++;
                        $pricetable[$pcount] = $tprice . '###  EUR ' . str_replace(".", ",", number_format($tprice, 2)) . ' &gt;  <a href="' . $aff_url . '" rel="nofollow">Redcoon.de</a>';
                        $pricetable_data[$pcount] = $tprice . '###' . str_replace(".", ",", number_format($tprice, 2)) . '###' . $aff_url . '###Redcoon.de' . '###' . str_replace(".", ",", number_format($aff_shipping, 2));
                    }
                    if ($aff_shop_id == 1752) {
                        $pcount++;
                        $pricetable[$pcount] = $tprice . '###  EUR ' . str_replace(".", ",", number_format($tprice, 2)) . ' &gt;  <a href="' . $aff_url . '" rel="nofollow">Reichelt.de</a>';
                        $pricetable_data[$pcount] = $tprice . '###' . str_replace(".", ",", number_format($tprice, 2)) . '###' . $aff_url . '###Reichelt.de' . '###' . str_replace(".", ",", number_format($aff_shipping, 2));
                    }
                }
                if ($num > 1) {
                    //cycle through IDs
                    //$ProductIDList = str_getcsv($ProductID,";");
                    //echo "multiple ids<br>";
                    list($aff_date, $aff_shop_id, $aff_price, $aff_shipping, $aff_url) = get_price_aff($aff_PID, $num);
                    //echo "ShopID: $aff_shop_id";
                    $ShopIDList = str_getcsv($aff_shop_id, ";");
                    $PriceList = str_getcsv($aff_price, ";");
                    $ShippingList = str_getcsv($aff_shipping, ";");
                    $URLList = str_getcsv($aff_url, ";");
                    $tpriceListCheapest = 9999999999;
                    for ($i = 0; $i < $num; $i++) {
                        $tpriceList[$i] = $PriceList[$i] + $ShippingList[$i];
                        //url of cheapest partner
                        if ($tpriceList[$i] < $tpriceListCheapest) {
                            $tpriceListCheapest = $tpriceList[$i];
                            $cheapestURL = str_replace("+++++", ";", $URLList[$i]);
                            //echo "Cheap: $cheapestURL<br>";
                        }
                        if ($ShopIDList[$i] == 1739) {
                            $pcount++;
                            $pricetable[$pcount] = $tpriceList[$i] . '###  EUR ' . str_replace(".", ",", number_format($tpriceList[$i], 2)) . ' &gt;  <a href="' . $URLList[$i] . '" rel="nofollow">Redcoon.de</a>';
                            $pricetable_data[$pcount] = $tpriceList[$i] . '###' . str_replace(".", ",", number_format($tpriceList[$i], 2)) . '###' . $URLList[$i] . '###Redcoon.de' . '###' . str_replace(".", ",", number_format($ShippingList[$i], 2));
                        }
                        if ($ShopIDList[$i] == 1752) {
                            $pcount++;
                            $pricetable[$pcount] = $tpriceList[$i] . '###  EUR ' . str_replace(".", ",", number_format($tpriceList[$i], 2)) . ' &gt;  <a href="' . $URLList[$i] . '" rel="nofollow">Reichelt.de</a>';
                            $pricetable_data[$pcount] = $tpriceList[$i] . '###' . str_replace(".", ",", number_format($tpriceList[$i], 2)) . '###' . $URLList[$i] . '###Reichelt.de' . '###' . str_replace(".", ",", number_format($ShippingList[$i], 2));
                        }
                    }
                }
            }
            //echo "ID: $aff_shop_id <br>Price: $aff_price + $aff_shipping";
        }
        //$nbprice=str_replace(",",".",NB_price($post->ID));
        //$nburl=NB_url($post->ID);
        //$region=get_region();
        //$aid=get_id();
        //print $aprice;
        //print "AURL: $aurl<br>";
        //if ($aurl == "") $aurl="http://www.amazon.$region/?_encoding=UTF8&camp=15121&creative=390961&linkCode=ur2&tag=$aid";
        //default: Euro
        //print "2: ".number_format($aprice,2);
        //$pricestring = number_format( str_replace("EUR","",str_replace(",",".",$aprice)),2,',','.');
        //pure price without currency
        //$pureprice   = str_replace("EUR","",$aprice);
        //$pureprice   = str_replace("CND","",$aprice);
        //$pureprice   = str_replace("$","",$aprice);
        #        $pricestring = $aprice;
        #
        #        if ( ($region == "de") or
        #             ($region == "es") or
        #             ($region == "fr") or
        #             ($region == "it") ){
        #		//$pricetable[0] =  str_replace(",",".",$pricestring).'###  EUR <span itemprop="price">'.$pricestring.'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        #		//$pricetable[0] =  str_replace(",",".",$pricestring).'###  EUR <span itemprop="price">'.$pricestring.'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        #		$pricetable_data[0] =  $pricestring.'###'.$pricestring.'###'.$aurl.'###Amazon.'.$region;
        #        }
        //float price to string
        #        $aprice_str = lhg_float_to_currency_string( $aprice , $region );
        #        $cs = lhg_get_currency_symbol( $region );
        //echo "REG: $region";
        /*
        if ($region == "com") $pricetable[0] =    '  $ <span itemprop="price">'.str_replace(".",".",number_format(str_replace("$","",$aprice),2)).'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        if ($region == "in")  $pricetable[0] = '  '.str_replace("INR",'&#8377; <span itemprop="price">',$aprice).'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        if ($region == "ca")  $pricetable[0] = '  CDN$ <span itemprop="price">'.str_replace(".",".",number_format(str_replace("CDN\$","",$aprice),2)).'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        if ($region == "co.uk")  $pricetable[0] = '  '.$cs.' <span itemprop="price">'.$aprice_str.'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        if ($region == "co.jp")  $pricetable[0] = '  &yen; <span itemprop="price">'.$aprice_str.'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        */
        #        $pricetable[0] = '  '.$cs.' <span itemprop="price">'.$aprice_str.'</span> &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        //echo "PT: $pricetable[0]";
        //print "APrice: $aprice<br>";
        #        if ($aprice=='out of stock')
        #                $pricetable[0] = '  '.$txt_not_avail.' &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        //print "AP: >$aprice< <br>";
        #        if ( (strpos($aprice,'nicht vorr') !== false) or (strpos($aprice,'nicht liefer') !== false) or ($aprice=="") )
        #                $pricetable[0] = '  '.$txt_not_avail.' &gt; <a href="'.$aurl.'" rel="nofollow">Amazon.'.$region.'</a>';
        #        if ($lang == "de"){
        #          if ($nbprice != ""){
        #                $pcount++;
        #        	$pricetable[$pcount] = '  EUR <span itemprop="price">'.str_replace(".",",",number_format(str_replace("EUR","",$nbprice),2)).'</span> &gt;  <a href="'.$nburl.'" rel="nofollow">Notebooksbilliger.de</a>';
        #          }
        #          //sort($pricetable);
        #          array_multisort( $pricetable , SORT_NUMERIC, $pricetable_data );
        #	}
        //echo "PT0 ".$pricetable[0];
        //echo "POS: ".strpos($pricetable[0],"###");
        //get rid of sorting string, works only for "de"
        #        if ( strpos($pricetable[0],"###") >0 )
        #       foreach ($pricetable as &$value) {
        #           list( $null, $value) = explode("###",$value);
        #       }
        //echo "PT0 ".$pricetable[0];
        //echo "<br>PT1 ".$pricetable[1];
        //echo "PR: $aprice";
        // echo "\n".'<div itemscope itemtype="http://data-vocabulary.org/Product">';
        // echo "\n".'<span itemprop="category" content="Hardware" ></span>';
        // echo "\n".'<span itemprop="name" content="'.translate_title(get_the_title()).'" ></span>';
        //echo "PC: $pcount";
        #        if ($pcount > 0)
        #	        echo "\n".'<div style="text-align: center;"><b>'.$txt_cheapest_supplier.':</b></div>';
        //echo "aprice: $aprice<br>";
        //echo "PC: ",$pcount;
        #        if ($pcount == 0)
        #                if ($aprice!='out of stock')
        #                        	echo "\n".'<div style="text-align: center;"><b>'.$txt_supplier.'</b></div>';
        #        echo "\n".'<div class="rating" style="border: 0px solid #222; width: 70%; text-align: center; margin: 0 auto;">';
        #        echo $cheap_txt;
        /* single offer. to be changed for group of offers! */
        //echo "\n".'<span itemprop="offerDetails" itemscope itemtype="http://data-vocabulary.org/Offer">';
        #        $price_meta = "USD";
        #        if ($region == "de") $price_meta = "EUR";
        #        if ($region == "it") $price_meta = "EUR";
        #        if ($region == "fr") $price_meta = "EUR";
        #        if ($region == "es") $price_meta = "EUR";
        #        if ($region == "com") $price_meta = "USD";
        #        if ($region == "co.uk") $price_meta = "GBP";
        #        if ($region == "co.jp") $price_meta = "JPY";
        #        if ($region == "cn") $price_meta = "CNY";
        #        if ($region == "ca") $price_meta = "CAD";
        #        if ($region == "in") $price_meta = "INR";
        #
        #        echo "\n".'<meta itemprop="currency" content="'.$price_meta.'" />';
        //echo '<meta itemprop="price" content="'.str_replace(".",",",number_format(str_replace("EUR","",$nbprice),2)).'" />';
        //echo "Amazon.$region";
        //echo "PT: $pricetable[0]";
        #        if ( (strpos($pricetable[0],"Amazon.$region")) or ($pricetable[0] == "") ){
        #                //if ($aprice!='out of stock')
        #                echo "\n".'<div class="amazonbutton"><a href="'.$aurl.'" rel="nofollow"><img src="/wp-uploads/2012/10/Amazon_Logo1.png" border=0 width=125 height=125 alt="'.$txt_button_string.': '.$short_title.'" title="'.$txt_button_string.': '.$short_title.'"></a></div>';
        #        }elseif (strpos($pricetable[0],"Notebooksbilliger.de")){
        #        	echo "\n".'<div class="amazonbutton"><a href="'.$nburl.'" rel="nofollow"><img src="wp-uploads/2012/10/Logo_125-x-125_5_H.gif" border=0></a></div>';
        #        }elseif (strpos($pricetable[0],"Redcoon.de")){
        #        	echo "\n".'<div class="amazonbutton" style="border: 1px solid #2B8FC3; width: 140px; margin: 0 auto;"><a href="'.$cheapestURL.'" rel="nofollow"><img src="/wp-uploads/2014/03/redcoon-logo-125x125.jpg" border=0 width=140 height=140></a></div>';
        #        }elseif (strpos($pricetable[0],"Reichelt.de")){
        #        	echo "\n".'<div class="amazonbutton" style="border: 1px solid #2B8FC3; width: 140px; margin: 0 auto;"><a href="'.$cheapestURL.'" rel="nofollow"><img src="/wp-uploads/2014/03/reichelt_logo_125x125.gif" border=0 width=140 height=140></a></div>';
        #        }
        #
        #        $pricetable[0] = str_replace("+++++",";",$pricetable[0]);
        #        echo str_replace(" &gt; ", "<br>",$pricetable[0]);
        #        echo "\n"."</div>";
        #        if ($pcount == 0){
        #	        //echo "<b>Preis:</b>";
        #	}else{
        #	        //echo "<b>Amazon-Preis:</b><br>";
        #                //echo ' '.$aprice.' &gt; <a href="'.$aurl.'">Amazon.de</a>';
        #                echo $vspacer;
        #	        echo "<b>&Uuml;bersicht der Anbieter:</b>";
        #
        #	}
        //echo "<br>PT1 ".$pricetable[1];
        #	if ($pcount == 0){
        #		//echo $line;
        #	}else{
        #                echo "<br>
        #                <table>";
        #                //<tr><td><b>Preis</b></td><td><b>Anbieter</b></td><td></td></tr>
        #                //";
        #        	$i=0;
        #        	foreach($pricetable as $line){
        #                        list ($price1, $price2, $url , $shop, $shipping) = explode("###",$pricetable_data[$i]);
        #
        #                        //echo "$price2 .. $url .. $shop";
        #
        #		        if (strpos($pricetable[$i],"Redcoon.de")){
        #			      echo '<tr><td>EUR&nbsp;'.$price2.'<br><div class="portoline">inkl. Porto: '.$shipping.' EUR</div></td><td valign="middle"><a href="'.$url.'" rel="nofollow"><img src="wp-uploads/2014/03/redcoon-logo-110x033.jpg" style="border: 1px solid #2B8FC3;"></a></td><td><a href="'.$url.'" rel="nofollow">Redcoon.de</a></td></tr>';
        #
        #	    		}elseif (strpos($pricetable[$i],"Amazon.de")){
        #			      echo '<tr><td>EUR&nbsp;'.$price2.'<br><div class="portoline">exkl. Porto</div></td><td valign="middle"><a href="'.$url.'" rel="nofollow"><img src="wp-uploads/2014/03/amazon_de_logo_110_33.jpg" style="border: 1px solid #2B8FC3;"></a></td><td><a href="'.$url.'" rel="nofollow">Amazon.de</a></td></tr>';
        #			      //echo '<img src="wp-uploads/2014/03/amazon_de_logo_110_33.jpg">'.$pricetable[$i]."<br>";
        #  	    		}elseif (strpos($pricetable[$i],"Reichelt.de")){
        #                              $url = str_replace("+++++",";",$url);
        #                              echo '<tr><td>EUR&nbsp;'.$price2.'<br><div class="portoline">inkl. Porto: '.$shipping.' EUR</div></td><td valign="middle"><a href="'.$cheapestURL.'" rel="nofollow"><img src="wp-uploads/2014/03/reichelt_logo_110x33.jpeg" style="border: 1px solid #2B8FC3;"></a></td><td><a href="'.$url.'" rel="nofollow">Reichelt.de</a></td></tr>';
        #			      //echo '<img src="wp-uploads/2014/03/amazon_de_logo_110_33.jpg">'.$pricetable[$i]."<br>";
        #	    		}
        #                        else{
        #			      echo $pricetable[$i]."<br>";
        #                        }
        #
        #	              //if ($i == 0) echo '<div class="priceline" style="border: 0px solid #000; "><div class="pricetop" style="border: 1px solid #2b8fc3; background-color: #eee; margin: 3px 3px;">'.$line.'</div></div>';
        #	              //if ($i > 0)  echo '<div class="priceline" style="border: 0px solid #000; "><div class="price" style="border: 0px solid #333; background-color: #fff; margin: 3px 3px;">'.$line.'</div></div>';
        #  	              $i++;
        #    		}
        #                echo"</table>";
        #	}
        // echo get_affiliate_prices($post->ID);
        //
        // ---- New Supplier Overview
        //
        #if ($lang == "de")
        lhg_supplier_comparison($post->ID);
        //
        // ---- Rating Overview ==============================================================
        //
        global $txt_opw_num_ratings;
        //    = "Number of ratings";
        global $txt_opw_average_rating;
        // = "Average ratings";
        global $txt_opw_rating_overview;
        global $txt_out_of;
        global $txt_opw_hardware;
        global $txt_average;
        global $no_supplier_square;
        #$rating_avg = get_post_meta($post->ID,'ratings_average',true);
        $num_rates = $ratings[0]->post_ratings_users_com + $ratings[0]->post_ratings_users_de;
        if ($num_rates == 0) {
            $rating_avg = 0;
        }
        if ($num_rates != 0) {
            $rating_avg = ($ratings[0]->post_ratings_score_com + $ratings[0]->post_ratings_score_de) / $num_rates;
        }
        if ($no_supplier_square != 1) {
            echo $vspacer;
        }
        #echo '<div itemscope itemtype="http://schema.org/Product">';
        #echo '<div itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
        #echo '<div property="itemReviewed" typeof="Product">';
        #echo '  <div itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating">';
        //echo '<div class="rating" style="border: 0px solid #222; width: 90%; margin: 0 auto;">';
        echo '

        <table class="ratingtable" border="0">
           <tr>
             <td><b>' . $txt_opw_hardware . ':</b></td>
             <td><span itemprop="name">' . $short_title . '</span></td>
           </tr>


           <tr>
             <td>
             ';
        //if ($rating_total>1) echo "<b>$txt_wpone_num_ratings:</b></td><td> <b>".'<span itemprop="votes">'."$rating_total</span></b><br>";
        //if ($rating_total<2)
        echo "       <b>{$txt_opw_num_ratings}:</b>\n             </td>\n\n\n\n             <td>\n                {$rating_total} <br />\n             </td>\n           </tr>\n\n\n           <tr>\n              <td><b>{$txt_opw_average_rating}: </b></td>\n\n              <td>";
        echo '<span itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">';
        echo the_ratings_results($post->ID, 0, 0, 0, 10) . '
                            (<span itemprop="ratingValue">' . round($rating_avg, 1) . '</span> ' . $txt_out_of . '
                             <span itemprop="bestRating">5</span>)

                            <span itemprop="ratingCount" content="' . $rating_total . '" />
                            <span itemprop="worstRating" content="0" />
                        </span>

              </td>
           </tr>


           ';
        echo '
           <tr>
              <td class="td-ratingoverview">' . "<b>{$txt_opw_rating_overview}:</b></td>\n\n              <td>";
        if ($rating_total == 0) {
            $ra5 = 0;
            $ra4 = 0;
            $ra3 = 0;
            $ra2 = 0;
            $ra1 = 0;
        } else {
            $ra5 = 100 * $rating5 / $rating_total;
            $ra4 = 100 * $rating4 / $rating_total;
            $ra3 = 100 * $rating3 / $rating_total;
            $ra2 = 100 * $rating2 / $rating_total;
            $ra1 = 100 * $rating1 / $rating_total;
        }
        echo '

        <div class="rateline" style="border: 0px solid #000;">
           <div style="float: left;">5:&nbsp; </div>
           <div class="outerbox" style="background-color: #eee; width: 80px; float: left; margin: 4px 0px;">
             <div class="box" style="border: 0px solid #088; background-color: #2b8fc3; height: 8px; width: ' . $ra5 . '%;" ></div>
           </div> &nbsp;(' . $rating5 . ')
        </div><br clear="all" />';
        echo '
        <div class="rateline" style="border: 0px solid #000; margin-top: -17px; ">
           <div style="float: left;">4:&nbsp; </div>
           <div class="outerbox" style="background-color: #eee; width: 80px; float: left; margin: 4px 0px;">
             <div class="box" style="border: 0px solid #088; background-color: #2b8fc3; height: 8px; width: ' . $ra4 . '%;" ></div>
           </div> &nbsp;(' . $rating4 . ')
        </div><br clear="all" />';
        echo '
        <div class="rateline" style="border: 0px solid #000; margin-top: -17px; ">
           <div style="float: left;">3:&nbsp; </div>
           <div class="outerbox" style="background-color: #eee; width: 80px; float: left; margin: 4px 0px;">
             <div class="box" style="border: 0px solid #088; background-color: #2b8fc3; height: 8px; width: ' . $ra3 . '%;" ></div>
           </div> &nbsp;(' . $rating3 . ')
        </div><br clear="all" />';
        echo '
        <div class="rateline" style="border: 0px solid #000; margin-top: -17px; ">
           <div style="float: left;">2:&nbsp; </div>
           <div class="outerbox" style="background-color: #eee; width: 80px; float: left; margin: 4px 0px;">
              <div class="box" style="border: 0px solid #088; background-color: #2b8fc3; height: 8px; width: ' . $ra2 . '%;" ></div>
           </div> &nbsp;(' . $rating2 . ')
        </div><br clear="all" />';
        echo '
        <div class="rateline" style="border: 0px solid #000; margin-top: -17px; ">
           <div style="float: left;">1:&nbsp; </div>
           <div class="outerbox" style="background-color: #eee; width: 80px; float: left; margin: 4px 0px;">
              <div class="box" style="border: 0px solid #2b8fc3; background-color: #2b8fc3; height: 8px; width: ' . $ra1 . '%;" ></div>
           </div> &nbsp;(' . $rating1 . ')
        </div>';
        #        echo '
        #     </div>';
        echo '      <a href="#comments">' . $txt_rate_yourself . '</a>';
        //echo "</td></tr><tr><td></td><td>";
        echo "\n                </td>\n              </tr>\n\n          </table>\n\n          ";
        #echo '</div>'; // itemreviewed
        # echo "  </div>"; //Rating
        #echo '</div>'; //Review-aggregate
        //echo $vspacer;
        //
        // -------- Subscriber =============================================================
        //
        //if ($lang == "de"){
        echo $vspacer;
        print "<b>" . '<i class="icon-user icon-add-hw-user"></i><i class="icon-plus icon-add-hw-plus"></i>' . "{$txt_wpop_register}</b><br />";
        print "{$txt_register_long}";
        if (is_user_logged_in()) {
            $current_user = wp_get_current_user();
            print '<form action="/hardware-profile?srp=' . $post->ID . '&#038;sra=s" method="post" onsubmit="if(this.sre.value==\'\' || this.sre.indexOf(\'@\')==0) return false">
  	                 <fieldset style="border:0">
  	                 <input type="hidden" class="subscribe-form-field" name="sre" value="' . $current_user->user_email . '" size="18">
  	                 <button type="submit" value="' . $txt_send . '" >' . $txt_send . '&nbsp;<i class="icon-arrow-right icon-button"></i></button>
  	                 </fieldset>
  	                 </form>';
        } else {
            print '<form action="/hardware-profile?srp=' . $post->ID . '&#038;sra=s" method="post" onsubmit="if(this.sre.value==\'\' || this.sre.indexOf(\'@\')==0) return false">
  	                 <fieldset style="border:0">
  	                 <input type="text" class="subscribe-form-field" name="sre" value="email" size="18" onfocus="if(this.value==this.defaultValue)this.value=\'\'" onblur="if(this.value==\'\')this.value=this.defaultValue"/>
  	                 <button type="submit" value="' . $txt_send . '" >' . $txt_send . '&nbsp;<i class="icon-arrow-right icon-button"></i></button>
  	                 </fieldset>
  	                 </form>';
        }
        $usernum = 0;
        //get number of registered users
        global $txt_opw_registered;
        global $wpdb;
        global $txt_not_avail;
        $usernum = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->postmeta} WHERE meta_key LIKE '\\_stcr@\\_%' AND post_id = " . $post->ID);
        if ($usernum > 0) {
            print "(" . $txt_opw_registered . ": " . $usernum . ")";
        }
        //print do_shortcode('<a href="/manage-subscriptions">'.$txt_manage_subscr."</a>");
        //}
        //
        // ----------- Language Selector ============================================
        //
        #$selected    ='<div class="pricetop" style="border: 1px solid #2b8fc3; background-color: #eee; margin: 3px 3px 3px 3px; padding-top: 3px;">';
        #$selectedEnd ='</div>';
        # Debug:
        #lhg_store_comment_numbers_by_post_id( $post_id );
        echo $vspacer;
        echo "<b>{$txt_select}:</b><br />";
        //echo "PL:".get_permalink();
        //echo "<br>QPL:".qtrans_convertURL(get_permalink());
        list($null1, $null2, $null3, $posturl) = explode("/", get_permalink());
        list($null1, $null2, $null3, $null4, $posturl2) = explode("/", get_permalink());
        //echo "pu:".$posturl ."<br>";
        //echo "pu2".$posturl2."<br>";
        if ($posturl2 != "") {
            $posturl = $posturl2;
        }
        //we are in a qtranslate subfolder!
        $posturlde = $posturl;
        $posturlcom = $posturl;
        if (!is_search() and !($postID == "1821") and !is_archive()) {
            $comURL = get_post_meta($post->ID, 'COM_URL', true);
            $deURL = get_post_meta($post->ID, 'DE_URL', true);
            if ($comURL != "") {
                $posturlcom = $comURL;
            }
            if ($deURL != "") {
                $posturlde = $deURL;
            }
            if (substr($comURL, 0, 1) == "/") {
                $comURL = substr($comURL, 1);
            }
            if (substr($deURL, 0, 1) == "/") {
                $deURL = substr($deURL, 1);
            }
            //echo "LANG: $lang, PID: $postID, ";
            //translation still missing -> redirect to main page
            if ($comURL == "" and $post->ID > 2599 and $lang == "de") {
                $posturlcom = "";
            }
            if ($deURL == "" and $post->ID > 2599 and $lang == "en") {
                $posturlde = "";
            }
            # on de server get com link from priceDB
            if ($lang == "de") {
                $com = lhg_get_com_post_URL($postID);
                $comURL == $com;
            }
        }
        //remove language selection for .de
        $posturlde = str_replace("?lang=jp", "", $posturlde);
        $posturlde = str_replace("?lang=it", "", $posturlde);
        $posturlde = str_replace("?lang=es", "", $posturlde);
        $posturlde = str_replace("?lang=uk", "", $posturlde);
        $posturlde = str_replace("?lang=ca", "", $posturlde);
        $posturlde = str_replace("?lang=in", "", $posturlde);
        $posturlde = str_replace("?lang=fr", "", $posturlde);
        $posturlde = str_replace("?lang=cn", "", $posturlde);
        $posturlde = str_replace("?lang=en", "", $posturlde);
        $posturlcom = str_replace("?lang=jp", "", $posturlcom);
        $posturlcom = str_replace("?lang=it", "", $posturlcom);
        $posturlcom = str_replace("?lang=es", "", $posturlcom);
        $posturlcom = str_replace("?lang=uk", "", $posturlcom);
        $posturlcom = str_replace("?lang=ca", "", $posturlcom);
        $posturlcom = str_replace("?lang=in", "", $posturlcom);
        $posturlcom = str_replace("?lang=fr", "", $posturlcom);
        $posturlcom = str_replace("?lang=cn", "", $posturlcom);
        $posturlcom = str_replace("?lang=en", "", $posturlcom);
        if ($lang == "de") {
            $URLC = "http://www.linux-hardware-guide.com";
            $URLD = "";
        }
        if ($lang != "de") {
            $URLC = "";
            $URLD = "http://www.linux-hardware-guide.de";
        }
        //$URLC="http://192.168.3.113"; //Debug
        if (1 == 1) {
            echo '<div class="countrytable"><table border="0">
        	<tr class="countrytable_header">
                  <td class="cth_country">Country</td>
                  <td class="cth_price">Price</td>
                  <td class="cth_currency"></td>
                  <td class="cth_comment">Comments</td>
                </tr>';
            print lhg_country_row("de", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("com", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("ca", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("co.uk", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("fr", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("es", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("it", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("nl", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("in", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("co.jp", $URLC, $URLD, $posturlcom, $posturlde);
            print lhg_country_row("cn", $URLC, $URLD, $posturlcom, $posturlde);
            echo "</table></div>";
        } else {
            //if ($region == "de") print $selected;
            //echo '&nbsp;&nbsp;<a href="'.$URLD.'/'.$posturlde.'"><img src="/wp-content/plugins/qtranslate/flags/de.png" alt="Germany" /> Germany (&euro;)</a><br />';
            //if ($region == "de") print $selectedEnd;
            if ($region == "de") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/us.png" alt="USA" /> USA (&euro;)</a><br />';
            if ($region == "de") {
                print $selectedEnd;
            }
            if ($region == "ca") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/ca/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/ca.png" alt="Canada" /> Canada (CDN $)</a><br />';
            if ($region == "ca") {
                print $selectedEnd;
            }
            if ($region == "co.uk") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/uk/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/uk.png" alt="UK" /> United Kingdom (&pound;)</a><br />';
            if ($region == "co.uk") {
                print $selectedEnd;
            }
            if ($region == "fr") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/fr/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/fr.png" alt="France" /> France (&euro;)</a><br />';
            if ($region == "fr") {
                print $selectedEnd;
            }
            if ($region == "es") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/es/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/es.png" alt="Espana" /> Espana (&euro;)</a><br />';
            if ($region == "es") {
                print $selectedEnd;
            }
            if ($region == "it") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/it/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/it.png" alt="Italia" /> Italia (&euro;)</a><br />';
            if ($region == "it") {
                print $selectedEnd;
            }
            if ($region == "nl") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/nl/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/nl.png" alt="Netherlands" /> Netherlands (&euro;)</a><br />';
            if ($region == "nl") {
                print $selectedEnd;
            }
            if ($region == "in") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/in/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/in.png" alt="India" /> India (&#8377;)</a><br />';
            if ($region == "in") {
                print $selectedEnd;
            }
            if ($region == "co.jp") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/ja/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/jp.png" alt="Japan" /> Japan (&yen;)</a><br />';
            if ($region == "co.jp") {
                print $selectedEnd;
            }
            if ($region == "cn") {
                print $selected;
            }
            echo '&nbsp;&nbsp;<a href="' . $URLC . '/zh/' . $posturlcom . '"><img src="/wp-content/plugins/qtranslate/flags/cn.png" alt="China" /> China (RMB)</a><br />';
            if ($region == "cn") {
                print $selectedEnd;
            }
        }
        //
        // Tag List Start
        //
        echo $vspacer;
        echo "\n\n" . "  <b>{$txt_sim_tags}:</b>\n  <br />";
        echo "\n" . '  <div style="margin-left: 18px;">';
        echo "\n\n" . '    <form method="get" action="/tagsearch/" class="combine_tags">' . "\n";
        foreach (get_the_category() as $category) {
            $counter++;
            $CID = $category->cat_ID;
            break;
            //stop at main category!
        }
        $args = array('category' => $CID);
        $catposts = get_posts($args);
        foreach ($catposts as $post) {
            setup_postdata($post);
            $posttags = get_the_tags(get_the_ID());
            if (is_array($posttags)) {
                foreach ($posttags as $tag) {
                    if ($tag->count > 1) {
                        // combination not useful in case of one result
                        if ($tag->term_id != 981) {
                            $count++;
                            $tagstrings[$count] = $tag->term_id . '; <a href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a> (' . $tag->count . ')<br /> ';
                            if ($count > 15) {
                                break;
                            }
                        }
                    }
                }
            }
        }
        if (is_array($tagstrings)) {
            $unique_tagstrings = array_unique($tagstrings);
        }
        if (is_array($unique_tagstrings)) {
            sort($unique_tagstrings);
        }
        $countU = 0;
        if (is_array($unique_tagstrings)) {
            foreach ($unique_tagstrings as $tagstring) {
                $part = explode(";", $tagstring);
                $out .= "\n" . '      <input type="checkbox" name="tagid[' . $countU . ']" value="' . $part[0] . '" />' . $part[1];
                $countU++;
            }
        }
        echo $out;
        //
        // Tag List End
        //
        echo $content_widget;
        echo "\n" . '
      <div class="tagbutton">
        <button type="submit" value="' . $txt_combine_tags . '" >' . $txt_combine_tags . '&nbsp;
          <i class="icon-arrow-right icon-button"></i>
        </button>
      </div>

    </form>';
        echo "\n" . "\n  </div>\n  ";
        echo "\n" . "</div>";
        echo $after_widget;
        //close the blue widget
    }
}
예제 #10
0
 $findme = 'geocaching.su';
 $pos = strpos($geouid, $findme);
 if ($pos === false) {
     $errors .= $user->lang['Error_geosu'];
 } else {
     grab_url($geouid);
     foreach ($lines as $line_num => $line) {
         $line = iconv('windows-1251', 'UTF-8', $line);
         if (preg_match_all('/<a href="note.php?/isU', $line, $res)) {
             break;
         }
         $view_data .= $line;
         //$errors .= "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
         // Регион
         if (!$geo_region) {
             get_region($line);
             //$geo_region = $region;
             if ($region) {
                 $errors .= '<font size="3">' . $region . '</font><hr>';
             }
             $region = '';
         }
         //координаты
         get_wgs($line);
         $wgs = str_replace(array("&nbsp;", "&#176;", "'"), '', $wgs);
         $wgsfull = !$wgsfull ? $wgs : $wgsfull;
         $wgses = explode(" ", $wgs);
         if ($wgs) {
             $wgs_lat[0] = $wgses[1];
             $wgs_lat[1] = $wgses[2];
             //$wgs_lat[2] = 0;
function lhg_get_sorted_products($shopids_input, $productid, $region)
{
    #global $region;
    //check if input is an array or single shop integer
    if (!is_array($shopids_input)) {
        $shopids[0]->id = $shopids_input;
    } else {
        $shopids = $shopids_input;
    }
    global $lhg_price_db;
    $n_result = 0;
    foreach ($shopids as $shopid) {
        $sid = $shopid->id;
        #if ($productid == 40247) print "SID: $sid <br>";
        //ToDo: support for multiple products per shop needed (e.g. Amazon)
        //echo "SQL request";
        //echo $lhg_price_db;
        $sql = "SELECT id, shop_id, shop_last_price, shop_shipping_costs, shop_url, last_update  FROM `lhgprices` WHERE shop_id = \"" . $sid . "\" AND lhg_article_id = \"" . $productid . "\" AND shop_last_price != \"Too low to display\"";
        #echo "SQL: $sql";
        $result[$n_result] = $lhg_price_db->get_results($sql);
        #if ($productid ==26619) print_r ($result[$n_result]);
        $n_result += 1;
    }
    //$result_tmp = $result[0][0];
    //print_r ($result);
    // sort array
    #$total[0]  = 0;
    #$sortid[0] = 0;
    $foundproducts = 0;
    for ($i = 0; $i < $n_result; $i++) {
        $price = $result[$i][0]->shop_last_price;
        $ship = $result[$i][0]->shop_shipping_costs;
        #if ($productid == 40247) print "<br>price0: $price";
        $price = lhg_amazon_price_to_float($price, $region);
        $ship = lhg_amazon_price_to_float($ship, $region);
        //print "Price ".$result[$i][0]->shop_id.": $price + $ship";
        #if ($productid == 26619) print "<br>price: $price";
        #if ($productid == 26619) var_dump($rval);
        //skip empty results, even ignore if only shipping costs are available
        if ($price > 0) {
            $total[$i] = $price + $ship;
            $sortid[$i] = $i;
            $foundproducts += 1;
        }
        //print "<br>";
    }
    #if ($productid == 40247) print "<br>FP: $foundproducts";
    //add Amazon information
    // ToDo: currently information is from Wordpress DB, should be retrieved from PriceDB
    // ToDo: PriceDB needs to be filled by amazon-product-in-post plugin for that to work
    /*
            if ( ( $region == "de") and ( get_region() != "de") ) {
                    # searching for de price on com webpage
                    # get_post_meta would be empty
    	} else  {
              //echo "Search for Amazon";
              //get price & url from DB
              #print "REG: $region<br>";
              if ($region == "") $region=get_region();
              $meta="price-amazon.".$region;
              $aprice = get_post_meta($productid,$meta,true);
              $meta="url-amazon.".$region;
              $aurl =get_post_meta($productid,$meta,true); //amaz_url($post->ID);
              //$aurl stays empty for new articles
              //echo "Aprice: $aprice<br>";
              if ( ($aprice!='out of stock') and ($aprice!='nicht lieferbar') and ($aprice!='Check Amazon For Pricing')  and ($aurl != "") )   {
                    //echo "adding Amazon";
                    $i += 1;
                    #$meta="url-amazon.".$region;
            	#$aurl =get_post_meta($productid,$meta,true); //amaz_url($post->ID);
                    #$aurl 	= $result[][0]->shop_url;
                    #if ($productid == 40247) print "URL: $url <br>";
    	        $price = lhg_amazon_price_to_float ( $aprice , $region );
                    //echo "URL: $aurl<br>";
                    //echo "Reg: $region";
                    $result[$i][0]->shop_last_price = $price;
                    $result[$i][0]->shop_url = $aurl;
                    $result[$i][0]->shop_id = "-1";
                    if ($region == "de")
                    $result[$i][0]->shop_id = "4";
                    if ($region == "it")
                    $result[$i][0]->shop_id = "6";
                    if ($region == "com")
                    $result[$i][0]->shop_id = "7";
                    if ($region == "co.uk")
                    $result[$i][0]->shop_id = "8";
                    if ($region == "ca")
                    $result[$i][0]->shop_id = "9";
                    if ($region == "fr")
                    $result[$i][0]->shop_id = "10";
                    if ($region == "in")
                    $result[$i][0]->shop_id = "11";
                    if ($region == "co.jp")
                    $result[$i][0]->shop_id = "12";
                    if ($region == "cn")
                    $result[$i][0]->shop_id = "13";
                    if ($region == "es")
                    $result[$i][0]->shop_id = "14";
                    $total[$i]  = $price + $ship;
    	        $sortid[$i] = $i;
                    $foundproducts +=1 ;
    	  }
            }
    */
    //var_dump($sortid);
    if (is_array($total)) {
        array_multisort($total, $sortid);
    }
    #if ($productid == 40247) print "TTT:<br>"; #var_dump($sortid);
    #if ($productid == 40247) var_dump($result);
    //format output
    //$rval = array("url","price","shipping","shopid");
    for ($i = 0; $i < $foundproducts; $i++) {
        //echo "SID: $sortid[$i]";
        $rval[$i]["url"] = $result[$sortid[$i]][0]->shop_url;
        $rval[$i]["shop_id"] = $result[$sortid[$i]][0]->shop_id;
        $rval[$i]["last_update"] = $result[$sortid[$i]][0]->last_update;
        $rval[$i]["id"] = $result[$sortid[$i]][0]->id;
        $price = $result[$sortid[$i]][0]->shop_last_price;
        $ship = $result[$sortid[$i]][0]->shop_shipping_costs;
        $price = lhg_amazon_price_to_float($price, $region);
        $ship = lhg_amazon_price_to_float($ship, $region);
        #$price = lhg_price_clean_format($price);
        #$ship  = lhg_price_clean_format($ship);
        $rval[$i]["price"] = $price;
        $rval[$i]["shipping"] = $ship;
        //var_dump($rval);
    }
    #echo "<p>DUMP:";
    #if ($productid == 40247) echo "<p>DUMP: ";
    #if ($productid == 26619) var_dump($rval);
    // Set values locally for faster access by category-post-list
    $setprice = $rval[0]["price"];
    if ($setprice == "" or $setprice == 0) {
        $setprice = "out of stock";
    }
    if ($region == "") {
        $region = get_region();
    }
    $meta = "price-amazon." . $region;
    update_post_meta($productid, $meta, $setprice);
    //
    return $rval;
}
예제 #12
0
//        onclick=\'document.cookie="wpsmart_view_full_site=0;";window.location.href = "'.$actual_link.'";return false;\' id="view_full_site"><i class="icon-google-phone icon-large2"></i> <span class="footerlinks">Mobile optimized site</span></a>
global $code_version;
$output .= '
        <a href="' . $actual_link_mobile . '"><i class="icon-resize-small icon-large2"></i> <span class="footerlinks">' . $txt_for_mobile . '</span></a>

	&nbsp;-&nbsp;

	<a href="https://github.com/cptpike/linuxhardwareguide" target="_blank"><i class="icon-github-sign icon-large2"></i> <span class="footerlinks">Code base: ' . $code_version . '</span></a>



        </p>';
echo $output;
$url_contact = "contact";
$url_donate = "donations";
$region = get_region();
if ($region == "de") {
    $url_contact = "kontakt";
}
if ($region == "de") {
    $url_donate = 'faq#donate';
}
echo '
	</div>

	<div id="bottom-links">

           <div id="general-box">
              <b>' . $txt_footer_general . '</b>
              <br /> <a href="' . $url_lang . '/' . $url_contact . '">' . $txt_footer_contact . '</a>
              <br /> <a href="' . $url_lang . '/faq">' . $txt_footer_faq . '</a>
\t<tr><td>
\t\t<h3>Single File Download</h3>
\t\tClick on the links next to each file to download files directly in netCDF--ascii--binary--csv formats
\t\t<br>
\t\tor to view the Catalog Page or information on OPenDAP.
\t</td></tr>
\t<tr><td>
\t\t<button class="selectall" data-name="filedownload" type="button">Select All</button>
                <button class="deselectall" data-name="filedownload" type="button">DeSelect All</button>
\t</td></tr>
HereDoc;
//===================
//  PRODUCT LOOP
//===================
foreach ($_POST["productt"] as $productt) {
    $regionn = get_region($productt);
    $dailyPath = get_dailyPath($productt, $Files);
    $monthlyPath = get_monthlyPath($productt, $Files);
    $opendapdailyPath = get_opendapDailyPath($productt, $Files);
    $opendapmonthlyPath = get_opendapMonthlyPath($productt, $Files);
    $myAggPath = get_aggPath($productt, $Files);
    //===================
    //  MODEL LOOP
    //===================
    foreach ($_POST["model"] as $model) {
        $had_gem = false;
        $ccsm4 = false;
        if (in_array($model, array("HadGEM2-ES", "HadGEM2-CC"))) {
            $had_gem = true;
        }
        if (in_array($model, array("HadGEM2-ES365", "HadGEM2-CC365"))) {
 function get_thumbnails($show_top = false)
 {
     // Retrieve Related Posts HTML for output
     $output = '';
     $debug = 'Developer mode initialisation; Version: 1.2.9;';
     $time = microtime(true);
     //R.Z.: post_number is doubled to get rid of non-available products
     $posts_number_real = get_option('relpoststh_number', $this->number);
     $posts_number = 2 * get_option('relpoststh_number', $this->number);
     if ($posts_number <= 0) {
         // return nothing if this parameter was set to <= 0
         return $this->finish_process($output, $debug . 'Posts number is 0;', $time);
     }
     $id = get_the_ID();
     $relation = get_option('relpoststh_relation', $this->relation);
     $poststhname = get_option('relpoststh_poststhname', $this->poststhname);
     $text_length = get_option('relpoststh_textlength', $this->text_length);
     $excerpt_length = get_option('relpoststh_excerptlength', $this->excerpt_length);
     $thsource = get_option('relpoststh_thsource', $this->thsource);
     $categories_show_all = get_option('relpoststh_show_categoriesall', get_option('relpoststh_categoriesall', $this->categories_all));
     $onlywiththumbs = current_theme_supports('post-thumbnails') && $thsource == 'post-thumbnails' ? get_option('relpoststh_onlywiththumbs', false) : false;
     $post_type = get_post_type();
     global $wpdb;
     /* Get taxonomy terms */
     $debug .= "Relation: {$relation}; All categories: {$categories_show_all};";
     $use_filter = $categories_show_all != '1' || $relation != 'no';
     if ($use_filter) {
         $query_objects = "SELECT distinct object_id FROM {$wpdb->term_relationships} WHERE 1=1 ";
         if ($relation != 'no') {
             /* Get object terms */
             if ($relation == 'categories') {
                 $taxonomy = array('category');
             } elseif ($relation == 'tags') {
                 $taxonomy = array('post_tag');
             } elseif ($relation == 'custom') {
                 $taxonomy = get_option('relpoststh_custom_taxonomies', $this->custom_taxonomies);
             } else {
                 $taxonomy = array('category', 'post_tag');
             }
             $object_terms = wp_get_object_terms($id, $taxonomy, array('fields' => 'ids'));
             if (empty($object_terms) || !is_array($object_terms)) {
                 // no terms to get taxonomy
                 return $this->finish_process($output, $debug . 'No taxonomy terms to get posts;', $time);
             }
             $query = "SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id in ('" . implode("', '", $object_terms) . "')";
             $object_taxonomy = $wpdb->get_results($query);
             $object_taxonomy_a = array();
             if (count($object_taxonomy) > 0) {
                 foreach ($object_taxonomy as $item) {
                     $object_taxonomy_a[] = $item->term_taxonomy_id;
                 }
             }
             $query_objects .= " AND term_taxonomy_id IN ('" . implode("', '", $object_taxonomy_a) . "') ";
         }
         if ($categories_show_all != '1') {
             /* Get filter terms */
             $select_terms = get_option('relpoststh_show_categories', get_option('relpoststh_categories'));
             if (empty($select_terms) || !is_array($select_terms)) {
                 // if no categories were specified intentionally return nothing
                 return $this->finish_process($output, $debug . 'No categories were selected;', $time);
             }
             $query = "SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id in ('" . implode("', '", $select_terms) . "')";
             $taxonomy = $wpdb->get_results($query);
             $filter_taxonomy_a = array();
             if (count($taxonomy) > 0) {
                 foreach ($taxonomy as $item) {
                     $filter_taxonomy_a[] = $item->term_taxonomy_id;
                 }
             }
             if ($relation != 'no') {
                 $query_objects .= " AND object_id IN (SELECT distinct object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id IN ('" . implode("', '", $filter_taxonomy_a) . "') )";
             } else {
                 $query_objects .= " AND term_taxonomy_id IN ('" . implode("', '", $filter_taxonomy_a) . "')";
             }
         }
         $relationships = $wpdb->get_results($query_objects);
         $related_objects = array();
         if (count($relationships) > 0) {
             foreach ($relationships as $item) {
                 $related_objects[] = $item->object_id;
             }
         }
     }
     $query = "SELECT distinct ID FROM {$wpdb->posts} ";
     $where = " WHERE post_type = '" . $post_type . "' AND post_status = 'publish' AND ID<>" . $id;
     // not the current post
     $startdate = get_option('relpoststh_startdate');
     if (!empty($startdate) && preg_match('/^\\d\\d\\d\\d-\\d\\d-\\d\\d$/', $startdate)) {
         // If startdate was set
         $debug .= "Startdate: {$startdate};";
         $where .= " AND post_date >= '" . $startdate . "'";
     }
     if ($use_filter) {
         $where .= " AND ID IN ('" . implode("', '", $related_objects) . "')";
     }
     /*
     // All articles have thumbs or default image
     $join = "";
     		if ( $onlywiththumbs ) {
     			$debug .= "Only with thumbnails;";
     			$join = " INNER JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)";
     			$where .= " AND $wpdb->postmeta.meta_key = '_thumbnail_id'";			
     		}
     */
     $order = " ORDER BY rand() LIMIT " . $posts_number;
     $random_posts = $wpdb->get_results($query . $join . $where . $order);
     /* Get posts by their IDs */
     if (!is_array($random_posts) || count($random_posts) < 1) {
         return $this->finish_process($output, $debug . 'No posts matching relationships criteria;', $time);
     }
     $posts_in = array();
     foreach ($random_posts as $random_post) {
         $posts_in[] = $random_post->ID;
     }
     $query = "SELECT ID, post_content, post_excerpt, post_title FROM {$wpdb->posts} WHERE ID IN ('" . implode("', '", $posts_in) . "')";
     $posts = array_reverse($wpdb->get_results($query));
     if (!(is_array($posts) && count($posts) > 0)) {
         // no posts
         $debug .= 'No posts found;';
         return $this->finish_process($output, $debug, $time);
     } else {
         $debug .= 'Found ' . count($posts) . ' posts;';
     }
     /* Calculating sizes */
     /*
     if ( $thsource == 'custom-field' ) {
     			$debug .= 'Custom sizes;';
     			$width = get_option( 'relpoststh_customwidth', $this->custom_width );
     			$height = get_option( 'relpoststh_customheight', $this->custom_height );
     		}
     		else { // post-thumbnails source
     			if ( $poststhname == 'thumbnail' || $poststhname == 'medium' || $poststhname == 'large' ) { // get thumbnail size for basic sizes
     				$debug .= 'Basic sizes;';
     				$width = get_option( "{$poststhname}_size_w" );
     				$height = get_option( "{$poststhname}_size_h" );
     			}
     			elseif ( current_theme_supports( 'post-thumbnails' ) ) { // get sizes for theme supported thumbnails
     				global $_wp_additional_image_sizes;
     				if ( isset( $_wp_additional_image_sizes[ $poststhname ] ) ) {
     					$debug .= 'Additional sizes;';
     					$width = $_wp_additional_image_sizes[ $poststhname ][ 'width' ];
     					$height = $_wp_additional_image_sizes[ $poststhname ][ 'height' ];					
     				}
     				else
     					$debug .= 'No additional sizes;';
     			}
     		}
     		// displaying square if one size is not cropping
     		if ( $height == 9999 )
     			$height = $width;
     		if ( $width == 9999 )
     			$width = $height;
     		// theme is not supporting but settings were not changed
     		if ( empty( $width ) ) {
     			$debug .= 'Using default width;';
     			$width = get_option( "thumbnail_size_w" );
     		}
     		if ( empty( $height ) ) {
     			$debug .= 'Using default height;';
     			$height = get_option( "thumbnail_size_h" );
     		}
     		$debug .= 'Got sizes '.$width.'x'.$height.';';
     */
     // rendering related posts HTML
     global $txt_rpt_creation;
     //="creation date";
     global $txt_rpt_update;
     //="last update";
     global $txt_rpt_sub_by;
     //="last update";
     $authorID = get_the_author_meta('ID');
     if ($authorID == 1) {
         //$output2 = ', <span itemprop="reviewer">Linux-Hardware-Guide</span>';
         $output2 = ', Linux-Hardware-Guide';
     } elseif ($authorID == 12378 or $authorID == 27) {
         $pid = get_the_ID();
         $mail = get_post_meta($pid, "user_submit_name", true);
         $pos = strpos($mail, "@");
         #echo "MAIL: $pid - $mail - $pos<br>";
         if ($pos > 0) {
             $name = ", sent by " . substr($mail, 0, $pos);
         }
         $output2 = $name . ' via web frontend';
     } else {
         $avatar = get_avatar($authorID, 25);
         $author = get_the_author();
         //$output2 .= ', '.$txt_rpt_sub_by.' <a href="./hardware-profile/user'.$authorID.'"><span itemprop="reviewer">'.$author."</span> $avatar</a>";
         $output2 .= ', ' . $txt_rpt_sub_by . ' <a href="./hardware-profile/user' . $authorID . '">' . $author . " {$avatar}</a>";
     }
     //end of itemprop description
     $output .= "</div>";
     # was
     #$output .= "</span>";
     $output .= '<div class="articledates">' . $txt_rpt_creation . ': ' . get_the_date();
     //$output .= ", ".$txt_rpt_update.': <time itemprop="dtreviewed" datetime="'.get_the_modified_date('Y-m-d').'">'.get_the_modified_date()."</time>".$output2.'</div><br style="clear:left;" />';
     $output .= ", " . $txt_rpt_update . ': ' . get_the_modified_date() . " " . $output2 . '</div><br style="clear:left;" />';
     $output .= lhg_article_scans_overview();
     global $txt_rpt_title;
     if ($show_top) {
         //$output .= "Test".stripslashes( get_option( 'relpoststh_top_text', $this->top_text ) );
         $output .= $txt_rpt_title;
     }
     //"Test".stripslashes( get_option( 'relpoststh_top_text', $this->top_text ) );
     //$relpoststh_output_style = get_option( 'relpoststh_output_style', $this->output_style );
     //$relpoststh_cleanhtml = get_option( 'relpoststh_cleanhtml', 0 );
     //$text_height = get_option( 'relpoststh_textblockheight', $this->text_block_height );
     if ($relpoststh_output_style == 'list') {
         $output .= '<ul id="related_posts_thumbnails"';
         if (!$relpoststh_cleanhtml) {
             $output .= ' style="list-style-type:none; list-style-position: inside; padding: 0; margin:0"';
         }
         $output .= '>';
         $output .= '<div class="theme-skinless"><ul id="carousel_0" class="jcarousel-skin-skinless">';
     }
     //else
     //$output .= '<div id="hwcarou">';
     $output .= '</div>';
     //closure of "desription" span from amazon-plugin
     #$output .= '</span>'; //closure of "desription" span from amazon-plugin
     $output .= '<div style="clear: both"></div>' . "\n";
     $output .= '<div class="theme-skinless" style="height:300px; width:98%;  border:0px solid #eeeeee;padding:0px;margin:0px;"><div class="inner-caroussel-frame">' . "\n";
     //$output .= '<div style="border: 1pt none ; margin: 0pt; padding: 0pt;">'."\n";
     //$output .= '<div class="arrow-right"><a href="#scroll" class="carousel_0_prev">Back 1 panel</a></div>'."\n";
     $output .= '<a href="#scroll" class="carousel_0_next"><img class="slider-left" src="/wp-content/plugins/wp-carousel/themes/premium-slider/img/arrow_left.png"  alt="scroll left" /></a>' . "\n";
     $output .= '<ul id="carousel_0" class="jcarousel-skin-skinless" >' . "\n";
     $i = 0;
     $region = get_region();
     foreach ($posts as $post) {
         $txt_na = "out of stock";
         //check availability
         $meta = "price-amazon." . $region;
         $aprice = get_post_meta($post->ID, $meta, true);
         //no Amazon product available, check global DB as second try
         if ($aprice == "" or $aprice == $txt_na or $aprice == 0) {
             $aprice = lhg_db_get_cheapest_price($post->ID);
         }
         #echo "PDI: $post->ID -- ";
         #echo "AP: $aprice --";
         if ($region == "de") {
             $txt_na = "nicht lieferbar";
         }
         //if ($lang == "fr") $txt_na="indisponible";
         //echo "Language: $lang";
         //echo "AP: $aprice";
         if ($aprice != "" && $aprice != $txt_na && $aprice != 0) {
             //check rating
             $meta = "ratings_average";
             $rating = get_post_meta($post->ID, $meta, true);
             $ratinglist[$i] = $rating;
             $pidlist[$i] = $post->ID;
             //echo "rat: $rating --";
             $i++;
         }
     }
     //echo "I: $i";
     if ($i < 4) {
         $i--;
         //not enough found. append custom list
         $ratinglist[$i + 1] = 1;
         $ratinglist[$i + 2] = 1;
         $ratinglist[$i + 3] = 1;
         $ratinglist[$i + 4] = 1;
         $pidlist[$i + 1] = 1317;
         $pidlist[$i + 2] = 1459;
         $pidlist[$i + 3] = 2505;
         $pidlist[$i + 4] = 2528;
         $i += 4;
         //if ($aprice == "nicht lieferbar") $sc="";
         //if ($aprice == "") $sc="";
         //echo "<br>";
     }
     array_multisort($ratinglist, SORT_DESC, $pidlist);
     //echo "<hr>";
     //echo "I: $i<br>";
     //print list of products
     for ($j = 0; $j < $i; $j++) {
         //echo "Rat: $ratinglist[$j] ID: $pidlist[$j]<br>";
         //}
         //echo "<hr>";
         //foreach( $posts as $post ) {
         /*
         $image = '';
         			$url = '';
         			if ( $thsource == 'custom-field' ) {
         				$debug .= 'Using custom field;';
         				$url = $basic_url = get_post_meta( $post->ID, get_option( 'relpoststh_customfield', $this->custom_field ), true );
         				if (strpos($url, '/wp-content') !== false)
         					$url = substr($url, strpos($url, '/wp-content'));
         				$theme_resize_url = get_option( 'relpoststh_theme_resize_url', '' );
         				if ( !empty( $theme_resize_url ) )
         					$url = $theme_resize_url . '?src=' . $url . '&w=' . $width . '&h=' . $height . '&zc=1&q=90';
         			}
         			else {
         				$from_post_body = true;
         				if ( current_theme_supports( 'post-thumbnails' ) ) { // using built in Wordpress feature
         					$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
         					$debug .= 'Post-thumbnails enabled in theme;';
         					if ( !( empty( $post_thumbnail_id ) || $post_thumbnail_id === false ) ) { // post has thumbnail
         						$debug .= 'Post has thumbnail '.$post_thumbnail_id.';';
         						$debug .= 'Postthname: '.$poststhname.';';
         						$image = wp_get_attachment_image_src( $post_thumbnail_id, $poststhname );
         						$url = $image[0];
         						$from_post_body = false;
         					}
         					else
         						$debug .= 'Post has no thumbnail;';
         				}
         				if ( $from_post_body ) { // Theme does not support post-thumbnails, or post does not have assigned thumbnail
         					$debug .= 'Getting image from post body;';
         					$wud = wp_upload_dir();
         					preg_match_all( '|<img.*?src=[\'"](' . $wud['baseurl'] . '.*?)[\'"].*?>|i', $post->post_content, $matches ); // searching for the first uploaded image in text
         					if ( isset( $matches ) ) $image = $matches[1][0];
         					else
         						$debug .= 'No image was found;';
         					if ( strlen( trim( $image ) ) > 0 ) {
         						$image_sizes = @getimagesize( $image );
         						if ( $image_sizes === false )
         							$debug .= 'Unable to determine parsed image size';
         						if ( $image_sizes !== false && isset( $image_sizes[0] ) && $image_sizes[0] == $width ) { // if this image is the same size as we need
         							$debug .= 'Image used is the required size;';
         							$url = $image;
         						}
         						else { // if not, search for resized thumbnail according to Wordpress thumbnails naming function
         							$debug .= 'Changing image according to Wordpress standards;';
         							$url = preg_replace( '/(-[0-9]+x[0-9]+)?(\.[^\.]*)$/', '-' . $width . 'x' . $height . '$2', $image );
         						}
         					}
         					else
         						$debug .= 'Found wrong formatted image: '.$image.';';
         				}
         				$basic_url = $url;
         			}
         */
         /*
         if ( strpos( $url, '/' ) === 0 ) {
         				$debug .= 'Relative url: ' . $url . ';';
         				$url = $basic_url = get_bloginfo( 'url' ) . $url;
         			}
         
         			$debug .= 'Image URL: '.$url.';';
         			if ( empty( $basic_url ) ) { // parsed URL is empty or no file if can check
         				$debug .= 'Image is empty or no file. Using default image;';
         				$url = get_option( 'relpoststh_default_image', $this->default_image );
         			}
         */
         //$title = $this->process_text_cut( $post->post_title, $text_length );
         //$title = str_replace('quot;', '"', $title);
         //$title = str_replace('amp;', '', $title);
         //$title = str_replace("&", '', $title);
         //$title = str_replace('Lenovo', '\"', $title);
         //$post_excerpt = ( empty( $post->post_excerpt ) ) ? $post->post_content : $post->post_excerpt;
         //$excerpt = $this->process_text_cut( $post_excerpt, $excerpt_length );
         //if ( !empty( $title ) && !empty( $excerpt ) ) {
         //	$title = '<b>' . $title . '</b>';
         //	$excerpt = '<br/>' . $excerpt;
         //}
         // $debug .= 'Using title with size ' . $text_length . '. Using excerpt with size ' . $excerpt_length . ';';
         if ($relpoststh_output_style == 'list') {
             $link = get_permalink($post->ID);
             $fontface = str_replace('"', "'", stripslashes(get_option('relpoststh_fontfamily', $this->font_family)));
             $output .= '<li ';
             if (!$relpoststh_cleanhtml) {
                 //$output .= ' style="float: left; padding: 0; margin:0; padding: 5px; display: block; border-right: 1px solid ' . get_option( 'relpoststh_bordercolor', $this->border_color ) . '; background-color: ' . get_option( 'relpoststh_background', $this->background ) . '" onmouseout="this.style.backgroundColor=\'' . get_option( 'relpoststh_background', $this->background ) . '\'" onmouseover="this.style.backgroundColor=\'' . get_option( 'relpoststh_hoverbackground', $this->hoverbackground ) . '\'"';
                 $output .= ' style="float: left; padding: 0; margin:0; padding: 5px; display: block; border-right: 1px solid';
             }
             $output .= '>';
             $output .= '<a href="' . $link . '" ><img alt="' . $title . '" src="' . $url . '" width="' . $width . '" height="' . $height . '" ';
             if (!$relpoststh_cleanhtml) {
                 $output .= 'style="padding: 0px; margin: 0px; border: 0pt none;"';
             }
             $output .= '/></a>';
             if ($text_height != '0') {
                 $output .= '<a href="' . $link . '"';
                 if (!$relpoststh_cleanhtml) {
                     $output .= ' style="display: block; width: ' . $width . 'px; overflow: hidden;height: ' . $text_height . 'px; font-family: ' . $fontface . '; font-style: normal; font-variant: normal; font-weight: normal; font-size: ' . get_option('relpoststh_fontsize', $this->font_size) . 'px; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none; color: ' . get_option('relpoststh_fontcolor', $this->font_color) . ';text-decoration: none;"';
                 }
                 $output .= '><span>' . $title . $excerpt . '</span></a></li>';
             }
         }
         //else {
         //global $lang;
         //echo "LANG: $lang";
         //if ($lang == "de"){
         //        $sc="";
         //        echo "Juhu! $post->ID ";
         //look if available
         //        $meta="price-amazon.de";
         //        $aprice = get_post_meta($post->ID,$meta,true);
         //        echo "AP: $aprice--";
         //        if ($aprice == "nicht lieferbar") $sc="";
         //        if ($aprice == "") $sc="";
         //        if ( !(($aprice == "nicht lieferbar") or ($aprice == "")) ){
         $output .= "\n        \t                          <li class=\"panel\" style=\"height:230px;width:150px;background:#ffffff;margin-right: 20px; padding: 0px;\">\n                \t                  [wp_cpl_sc cat_id=238 list_num=1 css_theme=0 sticky_post=" . $pidlist[$j] . "]\n                        \t          </li>";
         //}
         //do ignore otherwise
         //}else{
         //cpu hog for other languages
         //	$sc = do_shortcode("
         //        <li class=\"panel\" style=\"height:230px;width:150px;background:#ffffff;margin-right: 20px; padding: 0px;\">
         //        [wp_cpl_sc cat_id=238 list_num=1 css_theme=0 sticky_post=".$post->ID."]
         //        </li>");
         //}
         /*
         $sc = ("
         
         <li class=\"panel\" style=\"height:230px;width:150px;background:#ffffff;margin-right: 20px; padding: 0px;\">
         [wp_cpl_sc cat_id=238 list_num=1 css_theme=0 sticky_post=".$post->ID."]
         </li>");
         */
         //$sc = do_shortcode("<li class=\"panel\" style=\"height:150px;width:130px;background:#ffffff;\"> Test </li>");
         //echo "SC: $sc";
         //if (strpos($sc,"nicht lieferbar") or strpos($sc,"out of stock")) {
         //   $output .= "";
         //}else{
         #$output .= $sc;
         //sort by rating
         //   $avgpos=strpos($sc,"average");
         //   $avg=substr($sc, $avgpos+9, 4);
         //   #echo "Val=".substr($sc, $avg+9, 4);
         //   $scr[$i]=(5-$avg)."    ".$sc;
         //echo $i."--".$scr[$i];
         //   $i++;
         //}
         //$output .= "test";
         //$url2='http://www.linuxnetmag.org/wp-content/plugins/wp-postratings/images/stars_crystal/rating_on.gif';
         //$output .= '<a onmouseout="this.style.backgroundColor=\'' . get_option( 'relpoststh_background', $this->background ) . '\'" onmouseover="this.style.backgroundColor=\'' . get_option( 'relpoststh_hoverbackground', $this->hoverbackground ) . '\'" style="background-color: ' . get_option( 'relpoststh_background', $this->background ) . '; border-right: 1px solid ' . get_option( 'relpoststh_bordercolor', $this->border_color ) . '; border-bottom: medium none; margin: 0pt; padding: 6px; display: block; float: left; text-decoration: none; text-align: left; cursor: pointer;" href="' . get_permalink( $post->ID ) . '">';
         //$output .= '<a style="border: 0px solid #000; height: 225px; background-color: ' . get_option( 'relpoststh_background', $this->background ) . '; padding: 5pt; display: block; float: left; text-decoration: none; text-align: left; cursor: pointer;" href="' . get_permalink( $post->ID ) . '"  >';
         //$output .= '<div style="border: 0pt none ; margin: 0pt 0pt 0pt; padding: 0pt; width: 150px; height: ' . ( $height + $text_height ) . 'px; " >';
         //$output .= '<div style="border: 0pt none ; margin: 0pt; padding: 0pt; background: transparent url(' . $url . ') no-repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; width: 150px; height: 130px;"></div>';
         //$output .= '<center><div style="border: 0pt none; margin: 3px 0pt 0pt; padding: 0pt; ">' . $title . $excerpt . '
         //</div>';
         //$output .= '<br><div id="rateprod" style="width=100px; border: 0pt none; display: inline; margin: 0px 0px 0px; padding: 0px; background: transparent url('. $url.') no-repeat scroll 0% 0%;" >'.the_ratings_results($post_id,0,0,0,10).'</div>';
         //$output .= '<div class="teaser2">'.the_ratings_results($post->ID,0,0,0,10).'</div>';
         //$output .= '<div style="border: 0px solid #eee; margin: 3px 0pt 0pt; padding: 0pt; ">'.$this->amaz_price($post->ID).'</div>';
         //$output .= '</center></div>';
         //$output .= '</a>';
         //}
     }
     // end foreach
     //sort by rating
     //sort($scr);
     //for ($j=0;( ($j<$i) and ($j<$posts_number_real) ); $j++){
     //remove sort value
     //  $output .= substr($scr[$j],4);
     //}
     //print "Number: $j<br>";
     /*
     if ($j < 2){
       //not enough products - prevent carossel from failing
       $rndid=2146;
       $sc = do_shortcode("
                     <li class=\"panel\" style=\"height:230px;width:150px;background:#ffffff;margin-right: 20px; padding: 0px;\">
                     [wp_cpl_sc cat_id=238 list_num=1 css_theme=0 sticky_post=".$rndid."]
                     </li>");
     
     			$output .= $sc;
     }
     */
     //if ($relpoststh_output_style == 'list'){
     //	$output .= '</ul>';
     //}else{
     $output .= '</ul>';
     $output .= '<a href="#scroll" class="carousel_0_prev"><img class="slider-right" src="/wp-content/plugins/wp-carousel/themes/premium-slider/img/arrow_right.png" alt="scroll right" /></a>' . "\n";
     $output .= '</div></div>';
     //$output .= '<div style="clear: both"></div><br clear="all">&nbsp;<br clear="all">';
     //}
     //caroussel
     //$output .='</div>';
     //
     //                $output .='<script type="text/javascript" language="javascript">
     //                $(function() {
     //		    // Using default configuration
     //	    	    $("#hwcarou").carouFredSel();
     //		});
     //                </script>
     //                ';
     // $output .= '<div id="ratedprod" style="background-image: none; clear: both; width: 80px; border: 0pt none; display: inline; margin: 0px 0px 0px; padding: 0px; background: transparent; background-color: #eee;" >'.the_ratings_results($post_id,0,0,0,10).'</div>';
     //Filter output!
     //$region = get_region();
     return $this->finish_process($output, $debug, $time);
 }
예제 #15
0
 public function submitorder()
 {
     $consignee_address_id = I('consignee_address_id');
     $order_note = I('order_note');
     //查询配送地址
     $map = array();
     $map['uid'] = UID;
     $map['consignee_address_id'] = $consignee_address_id;
     $info = M('ConsigneeAddress')->where($map)->find();
     empty($info) && $this->error('配送地址错误!');
     if (IS_POST) {
         //查询购物车是不是有商品
         //$jon=__DB_PREFIX__.'goods as a   on  '.__DB_PREFIX__.'cart.goods_id=a.goods_id';
         $map = array();
         $map['uid'] = UID;
         $map['selected'] = 1;
         $cartlist = D('CartView')->where($map)->select();
         empty($cartlist) && $this->error('购物车是空的!', U('Cart/index'));
         $ordernum = create_ordersn();
         $order_total = 0.0;
         //订单总额
         //把购物车中的产品生成订单保存到order_goods
         $datalist = array();
         foreach ($cartlist as $val) {
             $num = intval($val['num']);
             $price = doubleval($val['price']);
             $order_total += $num * $price;
             $datalist[] = array('goods_id' => $val['goods_id'], 'uid' => UID, 'num' => $num, 'price' => $price, 'total' => $num * $price, 'order_id' => 0, 'create_time' => NOW_TIME);
             //从购物车中删除
             M('Cart')->delete($val['cart_id']);
         }
         //把订单的所有产品价格生成一个支付信息保存到order
         $data = array();
         $data['uid'] = UID;
         $data['order_sn'] = $ordernum;
         $data['create_time'] = NOW_TIME;
         $data['update_time'] = NOW_TIME;
         $data['order_total'] = $order_total;
         $data['consignee_name'] = $info['consignee_name'];
         $data['consignee_mobile'] = $info['consignee_mobile'];
         $data['consignee_diqu'] = get_region($info['consignee_diqu']);
         $data['consignee_detail'] = $info['consignee_detail'];
         $data['youbian'] = $info['consignee_youbian'];
         $data['order_status'] = 1;
         //$data['consignee_email']=$info['consignee_email'];
         $data['order_note'] = $order_note;
         $result = M('Order')->add($data);
         if (0 < $result) {
             $res = 0;
             foreach ($datalist as $k => $v) {
                 $datalist[$k]['order_id'] = $result;
                 $re = M('OrderGoods')->add($datalist[$k]);
                 $re > 0 || $res++;
             }
             //$re=M('OrderGoods')->addAll($dataList);
             //var_dump($datalist);
             //var_dump($re);
             if ($res > 0) {
                 $this->error('下单失败');
             } else {
                 //F('__ORDERSUCCESS__' . $result, 'true');
                 $this->success('下单成功', U('Buy/pay', array('order_id' => $result)));
             }
         } else {
             $this->error('提交订单失败');
         }
     } else {
         $this->error('参数错误!');
     }
 }
예제 #16
0
//Year of Publicaction
$authors = get_result_meta($post->ID, '_authors_meta');
//Authors
$institution = get_result_meta($post->ID, '_institution_meta');
//Institution
$city = get_result_meta($post->ID, '_city_meta');
//City
$cityb = get_result_meta($post->ID, '_city_meta_b');
$cityc = get_result_meta($post->ID, '_city_meta_c');
$cityd = get_result_meta($post->ID, '_city_meta_d');
$citye = get_result_meta($post->ID, '_city_meta_e');
$url = get_result_meta($post->ID, '_url_meta');
//URL
$implementing_partner = get_implementing_partner($post->ID);
//Implementing partner
$region = get_region($post->ID);
//Implementing partner
$sector = get_sector($post->ID);
//Implementing partner
?>

<div id="pageheader" class="titleclass">
	<div class="header-color-overlay"></div>
	<div class="container">
		<div class="page-header">
			<div class="row">
				<div class="col-md-12">
					<h1 class="post_page_title entry-title" itemprop="name headline">Result - <?php 
echo get_the_title();
?>
</h1>
예제 #17
0
 }
 echo "<strong>" . TXT_WPSC_CUSTOMERDETAILS . "</strong>";
 echo "<table>";
 $form_sql = "SELECT * FROM `" . $wpdb->prefix . "submited_form_data` WHERE  `log_id` = '" . $_GET['purchaseid'] . "'";
 $input_data = $wpdb->get_results($form_sql, ARRAY_A);
 //exit("<pre>".print_r($input_data,true)."</pre>");
 if ($input_data != null) {
     foreach ($input_data as $form_field) {
         $form_sql = "SELECT * FROM `" . $wpdb->prefix . "collect_data_forms` WHERE `active` = '1' AND `id` = '" . $form_field['form_id'] . "' LIMIT 1";
         $form_data = $wpdb->get_results($form_sql, ARRAY_A);
         if ($form_data != null) {
             $form_data = $form_data[0];
             switch ($form_data['type']) {
                 case 'country':
                     if (is_numeric($purch_data[0]['shipping_region'])) {
                         echo "  <tr><td>" . TXT_WPSC_STATE . ":</td><td>" . get_region($purch_data[0]['shipping_region']) . "</td></tr>";
                     }
                     echo "  <tr><td>" . $form_data['name'] . ":</td><td>" . get_country($purch_data[0]['billing_country']) . "</td></tr>";
                     break;
                 case 'delivery_country':
                     echo "  <tr><td>" . $form_data['name'] . ":</td><td>" . get_country($purch_data[0]['shipping_country']) . "</td></tr>";
                     break;
                 default:
                     echo "  <tr><td>" . $form_data['name'] . ":</td><td>" . $form_field['value'] . "</td></tr>";
                     break;
             }
         }
     }
 } else {
     echo "  <tr><td>" . TXT_WPSC_NAME . ":</td><td>" . $purch_data[0]['firstname'] . " " . $purch_data[0]['lastname'] . "</td></tr>";
     echo "  <tr><td>" . TXT_WPSC_ADDRESS . ":</td><td>" . $purch_data[0]['address'] . "</td></tr>";
예제 #18
0
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return $ret;
}
//TEMPMAXC
$out = '';
$weather_req = urlencode($word);
$url = 'API';
$content = httpGet($url);
$weather = get_weather($content);
if ($weather == '') {
    $url = 'API';
    $content = httpGet($url);
    $out = get_region($content);
    if ($out != '') {
        $weather_req = urlencode($out);
        $url = 'API';
        $content = httpGet($url);
        $weather = get_weather($content);
    }
}
$weather_return = $weather;
//out put will get in $weather;