function zen_address_format($zen, $data, $pre) { $company = $data[$pre . 'company']; $name = isset($data[$pre . 'firstname']) ? $data[$pre . 'firstname'] . ' ' . $data[$pre . 'lastname'] : false; $street_address = $data[$pre . 'street_address']; $suburb = $data[$pre . 'suburb']; $city = $data[$pre . 'city']; $postcode = $data[$pre . 'postcode']; if (not_null($data[$pre . 'state'])) { $state = $data[$pre . 'state']; } else { if (not_null($data[$pre . 'zone_id'])) { $state = zen_get_zone_code_from_id($zen, $data[$pre . 'zone_id']); } } if (isset($data[$pre . 'country_id'])) { $country = zen_get_country($zen, $data[$pre . 'country_id']); } else { $country = $data[$pre . 'country']; } $ret = ''; if (not_null($company)) { $ret .= $company . "\n"; } $ret .= $name . "\n" . $street_address . "\n"; if (not_null($suburb)) { $ret .= $suburb . "\n"; } if (not_null($city)) { $ret .= $city; } if (not_null($state)) { $ret .= ", " . zen_get_zone_code($zen, $state); } if (not_null($postcode)) { $ret .= " " . $postcode . "\n"; } else { $ret .= "\n"; } if (not_null($country)) { $ret .= $country . "\n"; } return $ret; }
$sort = $order[ $_GET['order'] ]; $tLijstenC = mu_sort ( $tLijstenC, $sort ); # Bouw de lijst opnieuw op $i = 0; foreach ( $tLijstenC as $lijstenC ) { $tpl->newblock ( "l.lijst.row" ); $tpl->assign ( array ( "nr" => ++$i, "AK" => $lijstenC['AK'], "album_id" => $lijstenC['album_id'], "album" => inkorten ( $lijstenC['album'], 45 ), "jaar" => not_null ( $lijstenC['jaar'] ) ) ); if ( $lijstenC['pos'] != $lPos ) $tpl->assign ( "pos", $lijstenC['pos'] ); if ( $tArtiest != $lijstenC['artiest_id'] ) { $tpl->assign ( array ( "artiest_id" => $lijstenC['artiest_id'], "artiest" => inkorten ( $lijstenC['artiest'], 40 ) ) ); } $tArtiest = $lijstenC['artiest_id']; $lPos = $lijstenC['pos'];
/** * send a request * data sent are in order * a) the command * b) the request headers if they are defined * c) the request body if defined * @return string the server repsonse status code **/ function sendCommand($command) { $this->responseHeaders = array(); $this->responseBody = ''; // connect if necessary if ($this->socket == false || feof($this->socket)) { if ($this->useProxy) { $host = $this->proxyHost; $port = $this->proxyPort; } else { $host = $this->url['host']; $port = $this->url['port']; } if (!not_null($port)) { $port = 80; } if (!($this->socket = fsockopen("ssl://" . $host, $port, $this->reply, $this->replyString, 10))) { return false; } if (not_null($this->requestBody)) { $this->addHeader('Content-Length', strlen($this->requestBody)); } $this->request = $command; $cmd = $command . "\r\n"; if (is_array($this->requestHeaders)) { reset($this->requestHeaders); while (list($k, $v) = each($this->requestHeaders)) { $cmd .= $k . ': ' . $v . "\r\n"; } } if (not_null($this->requestBody)) { $cmd .= "\r\n" . $this->requestBody; } // unset body (in case of successive requests) $this->requestBody = ''; fputs($this->socket, $cmd . "\r\n"); //echo $cmd . "--"; return true; } }
); if ( isset ( $_GET['order'] ) && !empty ( $order[ $_GET['order'] ] ) ) $qAlbum .= $order[ $_GET['order'] ]; else $qAlbum .= $order['album']; $rAlbum = $sql->query ( $qAlbum ); if ( $sql->num_rows ( $rAlbum ) > 0 ) { $i = 0; while ( $album = $sql->fetch_assoc ( $rAlbum ) ) { $tpl->newblock ( "artiest.row" ); $tpl->assign ( array ( "nr" => ++$i, "album_id" => $album['id'], "album" => $album['album'], "jaar" => not_null ( $album['jaar'] ), "recensies" => not_null ( $album['recensies'] ), "lijsten" => not_null ( $album['lijsten'] ) ) ); } } else $tpl->newblock ( "artiest.norow" ); } ?>
$tpl->newblock ( "album_lijst" ); $tpl->assign ( "album_id", $_GET['album'] ); $i = 0; while ( $lijst = $sql->fetch_assoc ( $rLijst ) ) { $tpl->newblock ( "album_lijst.row" ); $tpl->assign ( array ( "nr" => ++$i, "lijst_id" => $lijst['lijst_id'], "lijst" => $lijst['omschrijving'], "lijst_url" => empty ( $lijst['url'] ) ? NULL : "http://www.muzieklijstjes.nl/" . $lijst['url'] . ".htm", "jaar" => $lijst['jaar'], "aBron" => inkorten ( $lijst['bron'], 10 ), "bron" => $lijst['bron'], "ak" => not_null ( $lijst['ak'] ), "pos" => not_null ( $lijst['pos'] ), "gPos" => $lijst['type'] == "gp" ? "x" : NULL, "canon" => $lijst['canon'] == true ? "x" : NULL ) ); } } } } ?>
$i = 0; $lAK = ''; $tArtiest = ''; while ( $canon = $sql->fetch_assoc ( $rCanon ) ) { $AK = $order [ $canon['AK'] ]; $tpl->newblock ( "canon.row" ); $tpl->assign ( array ( "nr" => ++$i, "AK" => $canon['AK'], "album_id" => $canon['album_id'], "album" => inkorten ( $canon['album'], 45 ), "jaar" => not_null ( $canon['jaar'] ) ) ); if ( $lAK != $AK ) $tpl->assign ( "pos", $AK ); if ( $tArtiest != $canon['artiest_id'] ) { $tpl->assign ( array ( "artiest_id" => $canon['artiest_id'], "artiest" => $canon['artiest'] ) ); } $tArtiest = $canon['artiest_id'];
$tpl->assign ( "n", $n ); if ( $n > 0 ) { $i = 0; $lArtiest = ''; while ( $album = $sql->fetch_assoc ( $rAlbum ) ) { $tpl->newblock ( "l.gp.row" ); $tpl->assign ( array ( "album_id" => $album['album_id'], "album" => $album['album'], "recensies" => not_null ( $album['recensies'] ), "nr" => ++$i, "artiest_id" => $lArtiest != $album['artiest_id'] ? $album['artiest_id'] : NULL, "artiest" => $lArtiest != $album['artiest'] ? $album['artiest'] : NULL, "jaar" => not_null ( $album['jaar'] ) ) ); $lArtiest = $album['artiest']; } } } } } ?>
function post_value($key = '') { if ($key != '') { if (isset($_POST[$key]) && not_null($_POST[$key])) { if (!is_array($_POST[$key])) { return trim($_POST[$key]); } else { return $_POST[$key]; } } else { return ''; } } else { return ''; } }
function product_path($products_id) { $cPath = ''; $category_query = "select p2c.categories_id\n from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c\n where p.products_id = '" . (int) $products_id . "'\n and p.products_status = '1'\n and p.products_id = p2c.products_id limit 1"; $category = mysql_query($category_query); if (mysql_num_rows($category) > 0) { $category = mysql_fetch_array($category, MYSQL_ASSOC); $categories = array(); get_parent_categories($categories, $category['categories_id']); $categories = array_reverse($categories); $cPath = implode('_', $categories); if (not_null($cPath)) { $cPath .= '_'; } $cPath .= $category['categories_id']; } return $cPath; }
$n = $sql->num_rows ( $rTitel ); if ( $n > 0 ) { $i = 0; $lArtiest = ''; while ( $titel = $sql->fetch_assoc ( $rTitel ) ) { $tpl->newblock ( "recensent_recensie" ); $tpl->assign ( array ( "nr" => ++$i, "nummer" => $titel['nummer'], "jaar" => $titel['jaar'], "tijdschrift_id" => $titel['tijdschrift_id'], "lijsten" => not_null ( $titel['lijsten'] ), "aTijdschrift" => substr ( $titel['tijdschrift'], 0, 1 ), "tijdschrift" => $titel['tijdschrift'], "artiest_id" => $titel['artiest_id'], "artiest" => $lArtiest != $titel['artiest'] ? inkorten ( $titel['artiest'], 40 ) : NULL, "album_id" => $titel['album_id'], "album" => inkorten ( $titel['album'], 40 ) ) ); $lArtiest = $titel['artiest']; } } } }
function putgeo($ref_table, $ref_id, $id = NULL, $table = "maxmind") { $Herb =& get_instance(); // uncomment for Shared Memory support // geoip_load_shared_mem("/usr/local/share/GeoIP/GeoIPCity.dat"); // $gi = geoip_open("/usr/local/share/GeoIP/GeoIPCity.dat",GEOIP_SHARED_MEMORY); $gi = geoip_open("maxmind/GeoLiteCity.dat", GEOIP_STANDARD); $record = geoip_record_by_addr($gi, $_SERVER['REMOTE_ADDR']); if ($record == NULL) { return NULL; } if (is_null($id)) { $id = multiinsert($table, "ref_id", $ref_id, "ref_table", $ref_table, "geoip", $_SERVER['REMOTE_ADDR'], "geocountry", $record->country_code, "geocountry3", $record->country_code3, "geoname", $record->country_name, "georegion", $record->region, "geocity", $record->city, "geozip", $record->postal_code, "geolat", $record->latitude, "geolong", $record->longitude, "geodma", $record->dma_code, "geoarea", $record->area_code, "geotype", GEOIP_STANDARD, "geolang", $record->country_code); } else { if (not_null($table) && not_null($id)) { set($table, $id, "geoip", $_SERVER['REMOTE_ADDR']); set($table, $id, "geocountry", $record->country_code); set($table, $id, "geocountry3", $record->country_code3); set($table, $id, "geoname", $record->country_name); set($table, $id, "georegion", $record->region); //set($table,$id,"georegionname", $GEOIP_REGION_NAME[$record->country_code][$record->region] ); set($table, $id, "geocity", $record->city); set($table, $id, "geozip", $record->postal_code); set($table, $id, "geolat", $record->latitude); set($table, $id, "geolong", $record->longitude); set($table, $id, "geodma", $record->dma_code); set($table, $id, "geoarea", $record->area_code); set($table, $id, "geotype", GEOIP_STANDARD); set($table, $id, "geolang", $record->country_code); set($table, $id, "ref_table", $ref_table); set($table, $id, "ref_id", $ref_id); } } $country_name = $record->country_name; if (isset($GEOIP_REGION_NAME)) { $region_name = $GEOIP_REGION_NAME[$record->country_code][$record->region]; } $region_code = $record->region; // $lang = $record->country_code; geoip_close($gi); return find($table, "id", $id); }
$rArtiest = $sql->query ( $qArtiest ); $n = $sql->num_rows ( $rArtiest ); if ( $n > 0 ) { $tpl->assign ( "i_artiest", $n ); $i = 0; while ( $artiest = $sql->fetch_assoc( $rArtiest ) ) { $tpl->newblock ( "artiest.row" ); $tpl->assign ( array ( "nr" => ++$i, "artiest_id" => $artiest['id'], "artiest" => ucfirst ( $artiest['artiest'] ), "albums" => not_null ( $artiest['albums'] ), "recensies" => not_null ( $artiest['recensies'] ), "lijsten" => not_null ( $artiest['lijsten'] ) ) ); } } else $tpl->newblock ( "artiest.norow" ); } ?>
function mysql_to_array($res) { $tab = array(); $i = 0; if (not_null($res)) { while ($r = mysql_fetch_assoc($res)) { $tab[$i++] = $r; } } return $tab; }