$msg: $err
\n"; } } function get_mysql_query($sql, $output = TRUE) { global $_HOST, $_USER, $_PASSWORD, $_DB; static $db = null; if (! $db) { $db = mysql_connect ( $_HOST, $_USER, $_PASSWORD ); check_mysql_error ( "Cannot connect to the database" ); mysql_select_db ( $_DB, $db ); check_mysql_error ( "Cannot select the database" ); mysql_query ( 'SET NAMES utf8' ); mysql_query ( 'SET lc_time_names="sk_SK"' ); } $query = mysql_query ( $sql, $db ); if ($output) { check_mysql_error ( "Cannot get query " . $sql ); } return $query; } } ?>'') $class = ' class="'.$class.'"'; if ($win != '') $win = ' target="'.$win.'" '; $rs = "'.$title.''; return $rs; } define ('ICON_EDIT', '../images/admin/icons/edit.png'); define ('ICON_SUPPORT', '../images/admin/icons/support.png'); define ('ICON_HOME', '../images/admin/icons/home.png'); define ('ICON_DELETE', '../images/admin/icons/delete.png'); define ('ICON_NEW', '../images/admin/icons/new.png'); define ('ICON_NEW_SUB', '../images/admin/icons/newsub.png'); function MakeHREFIcon($icon, $url_address, $title, $class='', $win='') { if ( $class <>'') $class = ' class="'.$class.'"'; if ($win != '') $win = ' target="'.$win.'" '; $img = ''; $rs = "
'.$img.''."'.$title.'
'; return $rs; } function is_ie() { global $HTTP_USER_AGENT; $_is_ie = eregi("MSIE",$HTTP_USER_AGENT); return $_is_ie; } function TextToDB($t) { $textb = AddSlashes($t); return $textb; } function TextFromDB($t) { $textb = StripSlashes($t); return $textb; } /** * @return unknown * @param text unknown * @desc Replace quote and accute signs with html entities */ function Sc2HTML($text) { $text1 = ereg_replace('"', """, $text); return ereg_replace("'", "´", $text1); } function div($s, $class ) { return '
'.$s.'
'; } function GetInfoByID($table, $field_to_take, $field_to_search, $field_value) { $qs = "SELECT $field_to_take FROM $table WHERE $field_to_search='$field_value'"; $q = get_mysql_query($qs); //echo $qs; if ($q) { $row = mysql_fetch_array($q); if ($row) return TextFromDb($row[$field_to_take]); } return ""; } function GetArrayById($table_name, $field_to_search, $value) { $res = array(); $qs = "SELECT * FROM $table_name WHERE $field_to_search='$value'"; $q = get_mysql_query($qs); if ($q) $res = mysql_fetch_array($q); return $res; } function GetValuesById($table_name, $field_to_take, $field_to_search, $field_value, $additional_where_clause = '', $order_field = '', $limit_start = '', $limit_end = '') { $res = array(); $order_clause = ''; if ($order_field != '') $order_clause = ' ORDER BY '.$order_field.' '; /*if ($additional_where_clause) $additional_where_clause = ' AND '.$additional_where_clause;*/ $qs = "SELECT $field_to_take FROM $table_name WHERE $field_to_search='$field_value' $additional_where_clause $order_clause"; //echo $qs; $q = get_mysql_query($qs); if ($q) { while ( $row = mysql_fetch_array($q)) array_push($res,$row[$field_to_take]); return array_values($res); } else return ""; } function GetDataArray($qs) { $res = array(); $q = get_mysql_query($qs); if ($q) { while ($row = mysql_fetch_array($q)) { array_push($res,$row); } } else return null; return $res; } function bn_GetArraysById($table_name,$field_use_as_id, $field_use_as_value, $add_to_where_clause = '', $order_field = '') { $res = array(); $order_clause = ''; if ($order_field != '') $order_clause = ' ORDER BY '.$order_field.' '; $where_clause = ''; if ($add_to_where_clause != '') $where_clause = ' WHERE '.$add_to_where_clause; $qs = "SELECT $field_use_as_id, $field_use_as_value FROM $table_name $where_clause $order_clause"; //echo $qs; $q = get_mysql_query($qs); if ($q) { while ($row = mysql_fetch_array($q)) { $id = $row[$field_use_as_id]; $res[$id] = TextFromDb($row[$field_use_as_value]); } return $res; } else return ""; } // function /** * @return unknown * @param table_name unknown * @param field_name unknown * @desc Enter description here... */ function GetMaxNumber($table_name,$field_name, $where_part_of_query='') { $where_clause = ''; if ($where_part_of_query != '') $where_clause = " WHERE ".$where_part_of_query; $qs = "SELECT MAX($field_name) as max_nbr FROM $table_name ".$where_clause; $q = get_mysql_query($qs); if ($row = mysql_fetch_array($q)) { return $row['max_nbr']; } else return null; } // function GetMinNumber($table_name,$field_name, $where_part_of_query=''){ $where_clause = ''; if ($where_part_of_query != '') $where_clause = " WHERE ".$where_part_of_query; $qs = "SELECT MIN($field_name) as min_nbr FROM $table_name ".$where_clause; $q = get_mysql_query($qs); if ($row = mysql_fetch_array($q)) { return $row['min_nbr']; } else return null; } function GetVectorFromDbAsStr($table_name, $field_name, $where_clause='', $order_clause=''){ $where=($where_clause)?" WHERE $where_clause":''; $order=($order_clause)?" ORDER BY $order_clause":''; $qs="SELECT $field_name FROM $table_name $where $order"; //echo "qs=$qs
"; $q=get_mysql_query($qs); $str=''; $data=array(); while($row=mysql_fetch_array($q)){ $data[]=$row[$field_name]; } return $str=implode($data, ','); }//GetVectorFromDbAsStr /** * @return array * @param table_name string * @param field_name string * @param where_clause = '' string * @param order_clause = '' string * @desc Gets Array of data from table of db, using 'where' and 'order by' clauses of sql */ function GetVectorFromDbAsArr($table_name, $field_name, $where_clause='', $order_clause=''){ $where=($where_clause)?" WHERE $where_clause":''; $order=($order_clause)?" ORDER BY $order_clause":''; $qs="SELECT $field_name FROM $table_name $where $order"; //echo "qs=$qs
"; $q=get_mysql_query($qs); $data=array(); while($row=mysql_fetch_array($q)){ $data[]=$row[$field_name]; } return $data; }//GetVectorFromDbAsStr /** * @return string * @param table_name string (name of table) * @param fields string (comma separated list of fields) * @param where_clause string (sql where statement) * @desc Get 1 row from table as per where condition */ function GetRowByConditionAsStr($table_name, $fields, $where_clause){ $where=($where_clause)?" WHERE $where_clause":''; $qs="SELECT $fields FROM $table_name $where LIMIT 1"; $q=get_mysql_query($qs); $str=''; $row=mysql_fetch_row($q); $num=mysql_num_rows($q); if (($where_clause=='') OR ($num!=1)){ return ''; }else{ return $str=implode($row, ','); } }//GetRowByCondition /** * @return string or '' * @param table_name string (name of table) * @param fields string (comma separated list of fields) * @param where_clause string (sql where statement) * @desc Get 1 row from table as per where condition */ function GetRowByConditionAsArr($table_name, $fields, $where_clause){ $where=($where_clause)?" WHERE $where_clause":''; $qs="SELECT $fields FROM $table_name $where LIMIT 1"; //echo $qs; $q=get_mysql_query($qs); $str=''; $row=mysql_fetch_assoc($q); $num=mysql_num_rows($q); if (($where_clause=='') OR ($num!=1)){ return ''; }else{ return $row; } }//GetRowByConditionAsArr /** * @return array or null * @param table_name string * @param fields = '*' string * @param key_field = 'id' string * @param where = '' string * @param order = '' string * @param limit = '' string * @desc Gets assoc array from table, where key is one of the fields */ function GetAssocColumnRows ($table_name, $key_field='id', $fields='*', $where='', $order='', $groupby='', $limit='' ){ $data=array(); if ($where){ $where=" WHERE $where "; } if ($order){ $order=" ORDER BY $order "; } if ($limit){ $limit=" LIMIT $limit "; } if ($groupby){ $limit=" GROUP BY $groupby "; } if ($fields!='*'){ $fields=$key_field.', '.$fields; } $qs="SELECT $fields FROM $table_name $where $order $limit"; $q=get_mysql_query($qs); //echo $qs; if ($q){ while($row=mysql_fetch_assoc($q)){ $data[$row[$key_field]]=$row; } }else{ echo "Error getting data from db !!!
"; $data=null; } return $data; }//GetAssocColumnRows function GetCount($table_name, $where=''){ if ($where){ $where=" WHERE $where "; } $qs="SELECT COUNT(*) FROM $table_name $where"; $q=get_mysql_query($qs); $row=mysql_fetch_row($q); return $row[0]; }//GetCount function hfi($name, $value) { return ""; } function SetCurLang($lang) { global $BINAMICA_LANGUAGE; if (!isset($lang)) { $lang='RU'; } elseif ($lang == '') { $lang='RU'; } elseif ($lang == 'engl' || $lang == 'en' || $lang =='english' || $lang == 'EN' ) { $lang = 'EN'; } elseif ($lang == 'hebrew' || $lang == 'he' || $lang =='heb' || $lang == 'HE') { $lang = 'HE'; } elseif ($lang == 'russian' || $lang == 'ru' || $lang =='rus' || $lang == 'RU') { $lang = 'RU'; } else $lang = ''; $BINAMICA_LANGUAGE=$lang; return $lang; } // function function redirect_to($href, $brother_frame= '') { $parent = ''; if ($brother_frame!='') $parent = 'parent.frames.["'.$brother_frame.'"].'; ?> table = $table; } function SetWhere($where) { $this->where = $where; } function GetRow() { $where_clause = ''; if ($this->where) $where_clause = " WHERE ".$this->where; $qs = "SELECT * FROM $table ".$where_clause; $q = get_mysql_query($qs); $row = mysql_fetch_array(); $this->row = $row; return $row; } function GetField($field) { if (isset($row[$field])) return $this->row[$field]; else ''; } } function br($k=1){ for($i=0;$i<$k;$i++){ echo '
'; } }//br() function isNS(){ if (strstr($_SERVER["HTTP_USER_AGENT"], "Netscape")) { return 1; }else{ return 0; } }//isNS function isIE(){ if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE")) { return 1; }else{ return 0; } }//isIE } // DEFINES /** * @return void * @param to_path str * @param relative = true str * @desc Creates rel/abs path in filesystem of win and unix */ function CreatePath($to_path, $relative=true) { $debug=false; $path_array = explode('/', $to_path); // split the path by directories /* echo '
';            // show everything in the $path_array variable
var_dump($path_array);
echo '
'; */ $dir=''; // start with empty directory foreach($path_array as $key => $val) { // echo "$key => $val\n"; if (!strpos($val, ':')) { // if it's not a drive letter if ($relative){ $dir .= $val.'/'; }else{ $dir .= '/'.$val; } if (!is_dir($dir)) { // echo "Not a dir: $dir\n"; if (!mkdir($dir, 0777)) echo "Failed creating directory: $dir\n"; else if ($debug) echo "Created directory: $dir\n"; } } } }//create_path function GetLanguageCharset($lang) { if ($lang == 'en') return "windows-1252"; if ($lang == 'he') return "window-1255"; if ($lang == 'ru') return "windows-1251"; return ""; } ?> 'Január', 'február', 'marec', 'apríl', 'máj', 'jún', 'júl', 'august', 'september', 'október', 'november'); $tmp = split ( "-|:| ", $s ); $this -> day = $tmp [ 2 ]; $this -> dayWZ = ClearFirstZero( $this->day); $this -> month = $tmp [ 1 ]; $this -> year = $tmp [ 0 ]; $this -> year = $tmp [ 0 ]; $this -> hour = $tmp [ 3 ]; $this -> hourWZ = ClearFirstZero( $this->hour); $this -> minute = $tmp [ 4 ]; $this -> second = $tmp [ 5 ]; $this -> name_of_month = $months [ (int) $tmp [ 1 ] ]; $timestamp = mktime ( $tmp [ 3 ], $tmp [ 4 ], $tmp [ 5 ], $tmp [ 1 ], $tmp [ 2 ], $tmp [ 0 ] ); $this->ts = $timestamp; $date = getdate ( $timestamp ); $this -> name_of_day = date ( "l", $timestamp) ; $this -> name_of_month_short = date('M', $timestamp); } function hdl() { //echo "returned date is: ".date("H:i M-d-y", $this->ts)."ts is: ".$this->ts."
"; return date("H:i M-d-y", $this->ts); } function date_only() { return date("M d, 'y", $this->ts); } function hd2() { return date("H:i M d, 'y", $this->ts); } function article() { return date("M d, 'y", $this->ts); } function Mon3Day() { return date("M-d", $this->ts); } function responses() { return date("(H:i, M-d, y)", $this->ts); } function str () { return $this -> name_of_day . ", " . $this -> day . " " . $this -> name_of_month . " " . $this -> year . " �., " . $this -> hour . ":" . $this -> minute . ":" . $this -> second; } function str_date_long() { return $this -> name_of_day . ", " . $this -> dayWZ. " " . $this -> name_of_month . " " . $this -> year ; } function letter_long() { return $this -> name_of_day . ", " . $this -> name_of_month . " " . $this -> dayWZ. ", " . $this -> year; } function str_date_short() { return $this -> dayWZ. " " . $this -> name_of_month . " " . $this -> year ; } function news_format() { return $this -> hourWZ.":".$this -> minute. " ".$this -> dayWZ."/" .$this -> month ; } function letter_time () { return $this -> hourWZ . ":" . $this -> minute; } function time () { return $this -> hourWZ . ":" . $this -> minute . " "; } function formatted ($bold = FALSE) { $b_open = ''; $b_close = ''; if ($bold) { $b_open = ''; $b_close = ''; }; return $b_open.$this -> hour . ":" . $this -> minute . " " .$b_close. $this -> day . " " . $this -> name_of_month . " " . $this -> year . " " ; } function str_short () { return $this -> name_of_day_short . " " . $this -> day . " " . $this -> name_of_month_short . " " . $this -> year . ", " . $this -> hour . ":" . $this -> minute . ":" . $this -> second; } function video_fp () { return $this -> name_of_month_short . "-" .$this -> day; } function video_p2 () { return $this -> name_of_month_short . "-" .$this -> day.', '.$this->year; } function print_full_report() { return $this -> name_of_day . ", " . $this -> name_of_month . " " . $this -> dayWZ. ", " . $this -> year ; } }; class CTime { var $day; var $month; var $year; var $hour; var $minute; var $second; var $name_of_day_short; var $name_of_month_short; var $name_of_day; var $name_of_month; function CTime($s) { $tmp = split ( "-|:| ", $s ); $this -> day = $tmp [ 2 ]; $this -> month = $tmp [ 1 ]; $this -> year = $tmp [ 0 ]; $this -> hour = $tmp [ 3 ]; $this -> minute = $tmp [ 4 ]; $this -> second = $tmp [ 5 ]; } function init ( $s, $use_declension = TRUE, $shift_from_GMT = 0 ) { $months_short = array ( 1 => "���", "���", "���", "���", "���", "���", "���", "���", "���", "���", "���", "���" ); $months = array ( 1 => "������", "�������", "����", "������", "���", "����", "����", "������", "��������", "�������", "������", "�������" ); $days_short = array ( "���", "���", "���", "���", "���", "���", "���" ); $days = array ( "�����������", "�����������", "�������", "�����", "�������", "�������", "�������" ); $tmp = split ( "-|:| ", $s ); $this -> day = $tmp [ 2 ]; $this -> month = $tmp [ 1 ]; $this -> year = $tmp [ 0 ]; $this -> hour = $tmp [ 3 ]; $this -> minute = $tmp [ 4 ]; $this -> second = $tmp [ 5 ]; $this -> name_of_month = $months [ (int) $tmp [ 1 ] ]; $this -> name_of_month_short = $months_short [ (int) $tmp [ 1 ] ]; $timestamp = mktime ( $tmp [ 3 ], $tmp [ 4 ], $tmp [ 5 ], $tmp [ 1 ], $tmp [ 2 ], $tmp [ 0 ] ); $date = getdate ( $timestamp ); $this -> name_of_day = $days [ $date [ "wday" ] ]; $this -> name_of_day_short = $days_short [ $date [ "wday" ] ]; if ( $use_declension ) if ( $tmp [ 1 ] == 3 || $tmp [ 1 ] == 8 ) $this -> name_of_month .= "�"; else $this -> name_of_month [ strlen ( $this -> name_of_month ) - 1 ] = "�"; } function str () { return $this -> name_of_day . ", " . $this -> day . " " . $this -> name_of_month . " " . $this -> year . " �., " . $this -> hour . ":" . $this -> minute . ":" . $this -> second; } function formatted ($bold = FALSE) { $b_open = ''; $b_close = ''; if ($bold) { $b_open = ''; $b_close = ''; }; return $b_open.$this -> hour . ":" . $this -> minute . " " .$b_close. $this -> day . " " . $this -> name_of_month . " " . $this -> year . " " ; } function str_date_short() { return $this -> day. " " . $this -> name_of_month . " " . $this -> year ; } function str_short () { return $this -> name_of_day_short . " " . $this -> day . " " . $this -> name_of_month_short . " " . $this -> year . ", " . $this -> hour . ":" . $this -> minute . ":" . $this -> second; } }; } ?> -1)) array_push($this->arr_ids, $id); } function LoadImages() { if (count($this->arr_ids) == 0) return; $s = implode(',',$this->arr_ids); $qs = "SELECT * FROM images WHERE id IN($s)"; $db_function = ''; if ($this->db_function == '') { $db_function= 'get_mysql_query'; } else { $db_function=$this->db_function; } $q = $db_function($qs); if ($q) { while ($row = mysql_fetch_array($q)) { $id = $row["id"]; $this->arr_images[$id] = $row; } } else { echo "Error in ImageStorage.class
"; } } // function function GetImage($id) { return $this->arr_images[$id]; } function WriteImage($id, $insert = "") { echo $this->GetImageTag($id, $insert); } function GetImageSrc($id) { if (!isset($this->arr_images[$id])) return ''; $image = $this->arr_images[$id]; $image_str = $image['image_path']; $ipath = ''; if ($this->prefix_delete_len == 0) { $ipath = $image_str ; } else { $ipath = substr($image_str, $this->prefix_delete_len); } if ($this->prefix_add_len > 0) $ipath = $this->prefix_add.$ipath; return $ipath; } function AddImagesPrefix($prefix, $prefix_len=-1) { $this->prefix_add = $prefix; if ($prefix_len == -1) $this->prefix_add_len = strlen($prefix); else { $this->prefix_add_len = $prefix_len; } } function DepictImagesPrefix($prefix, $prefix_len=-1) { $this->prefix_delete = $prefix; if ($prefix_len == -1) $this->prefix_delete_len = strlen($prefix); else { $this->prefix_delete_len = $prefix_len; } } /*function SetImagesPrefix($prefix) { $this->path_prefix = $prefix; $this->prefix_length = strlen($prefix); }*/ function GetImageTag($id, $insert) { if ($id == -1 || $id == '') return ''; if (!isset($this->arr_images[$id])) return ''; $ipath = $this->GetImageSrc($id); $image = $this->arr_images[$id]; $ih = $image['image_h']; $iw = $image['image_w']; $height = ''; $width = ''; if ($ih > 0) $height = " HEIGHT=\"$ih\""; if ($iw > 0) $width = " WIDTH=\"$iw\""; $text = "'; return $text; } function GetImageWidth($id) { if ($id == -1 || $id == '') return ''; $image = $this->arr_images[$id]; return $image["image_w"]; } function GetImageHeight($id) { if ($id == -1 || $id == '') return ''; $image = $this->arr_images[$id]; return $image["image_h"]; } function GetImageData($id, &$src, &$w, &$h) { if ($id == -1 || $id == '') return ''; $image = $this->arr_images[$id]; $src = $image["image_path"]; $w = $image["image_w"]; $h = $image["image_h"]; return $ipath; } function Clear() { $this->arr_images = ""; $this->arr_ids = ""; } function GetExtendedImageTag($id, $align, $caption, $cap_class, $exp_width='100%', $wrapper_table_width=0, $image_border = true) { if ($id == -1 || $id == '') return ''; if (!isset($this->arr_images[$id])) return ''; $image = $this->arr_images[$id]; if ($image == '') return ''; $ipath = $ipath = $this->GetImageSrc($id); $ih = $image['image_h']; $iw = $image['image_w']; $table_width=$iw; $image_text = ''; $cellpadding = $wrapper_table_width; if ($align == 'left-100%' || $align =='right-100%') { $table_width='100%'; $align = ($align == 'left-100%') ? 'left' : 'right'; $cellpadding = 0; } $text = ''; if ($caption != '') $text .= ''; $text .='
'.$image_text.'
'.$caption.'
'; return $text; } /* this function is obsolete function SetPrefixLength($len) { $this->prefix_length = $len; } // function */ } //class function GetImageString($row, $insert = "", $dir_prefix = '') { $ipath = $dir_prefix.$row['image_path']; $ih = $row['image_h']; $iw = $row['image_w']; return ''; } } ?> 0 ) { $supplier_id = $_GET['supplier_id']; $where_clause = "AND p.supplier_id='$supplier_id'"; } else $where_clause = ''; $qs = "SELECT min(si.size_price) as size_price,p.*, p.name_$lang AS name, p.description_short_$lang AS description_short, im.image_path AS medium_picture, ims.image_path AS small_picture FROM products as p LEFT JOIN product_sizes as si ON si.product_id=p.id LEFT JOIN related_items as ri ON ri.item_id=p.id LEFT JOIN images AS im ON im.id=p.medium_picture_id LEFT JOIN images AS ims ON ims.id=p.small_picture_id WHERE ri.what='$what' AND ri.root_id='$root_id' $where_clause GROUP BY si.product_id ORDER BY ri.place ASC "; $DATA = array(); $q = get_mysql_query($qs); if ( !$q ) return; $num_rows = @mysql_num_rows($q); for ($n=1; $n <= $num_rows; $n++) { $row = mysql_fetch_array($q); $row['color_group_id'] = GetColorGroupForProductByPlace($n); $DATA[] = $row; } return $DATA; } function GetAllListProductsForCategory($lang, $cat_id, $sort='place', $start=false, $portion=false) { $where_clause = ''; if ( isset($_GET['supplier_id']) && is_numeric($_GET['supplier_id']) && $_GET['supplier_id'] > 0 ) { $supplier_id = $_GET['supplier_id']; $where_clause .= "AND p.supplier_id='$supplier_id'"; } else { if ( isset($_GET['price_from']) && is_numeric($_GET['price_from']) ) $where_clause .= " AND IF (p.is_sale='Y' AND p.sale_price > 0, p.sale_price, p.price) >= '".$_GET['price_from']."'"; if ( isset($_GET['price_to']) && is_numeric($_GET['price_to']) ) $where_clause .= " AND IF (p.is_sale='Y' AND p.sale_price > 0, p.sale_price, p.price) <= '".$_GET['price_to']."'"; } switch($sort) { case 'name': $ord='p.name_'.$lang; break; case 'priceasc': $ord='p.price ASC'; break; case 'pricedesc': $ord='p.price DESC'; break; case 'place': $ord='pcl.place ASC'; break; default: $ord='pcl.place ASC'; break; } if ( empty($start) ) $start = 0; if ($portion) $limit_clause = "LIMIT $start, $portion"; else $limit_clause = ''; $qs = "SELECT min(si.size_price) as size_price,p.*, p.name_$lang AS name, p.description_short_$lang AS description_short, im.image_path AS medium_picture, ims.image_path AS small_picture FROM products as p LEFT JOIN product_sizes as si ON si.product_id=p.id LEFT JOIN product_cat_links as pcl ON pcl.product_id=p.id LEFT JOIN images AS im ON im.id=p.medium_picture_id LEFT JOIN images AS ims ON ims.id=p.small_picture_id WHERE pcl.cat_id='$cat_id' $where_clause GROUP BY si.product_id ORDER BY $ord $limit_clause "; $DATA = array(); $q = get_mysql_query($qs); if ( !$q ) return; $num_rows = @mysql_num_rows($q); for ($n=1; $n <= $num_rows; $n++) { $row = mysql_fetch_array($q); $row['color_group_id'] = GetColorGroupForProductByPlace($n); $DATA[] = $row; } return $DATA; } function GetColorGroupForProductByPlace($place) { static $color_group = 'orange'; switch($color_group) { case 'orange': $color_group = 'blue'; break; case 'blue': $color_group = 'lilac'; break; case 'lilac': $color_group = 'orange'; break; default: $ord='orange'; break; } return $color_group; } function GetMainCategoryOnSubCat($subcat_id) { $qs = "SELECT * FROM product_categories WHERE parent_id = '$subcat_id'"; $q=get_mysql_query($qs); if($q) { $row=mysql_fetch_array($q); if($row) return $row; else return false; } else return false; } function GetMainCategoryOnProduct($product_id) { } function GetCategoryOnProduct($product_id) { $qs = "SELECT cat_id FROM product_cat_links WHERE product_id='$product_id' LIMIT 1"; $q = get_mysql_query($qs); if ($q) { $row = mysql_fetch_array($q); if ($row) return $row['cat_id']; else return; } else return; } function str_to_array($num) { $num=floor($num); $len=strlen($num); for($i=0; $i<$len; $i++){ $nn=substr($num, $i, 1); $out[]=$nn; } return $out; } ////////////////////////////////////////////////////////////end common function//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////admin area//////////////////////////////////////////////////////////////////////// function getSearchForm($word='', $by='') { global $lang, $group_value, $cat_id; $out=''; $array_by=array('name'=>'Name', 'our_code'=>'Our code', 'supplier_code'=>'Supplier code', ); $out.='
'; $out.=""; if ( isset($group_value) ) $out.=""; $out.=""; $out.=''; $out.=''; $out.=''; $out.=''; $out.=''; $out.=''; $out.=''; $out.=''; $out.='
SEARCH    By '; $out.='   
'; $out.='
'; return $out; } function getProductQS($lang, $words, $by, $setqs=false, $setqsc=false, $sort=false) { switch($sort){ case 'place': $ord='place'; break; case 'name': $ord='p.name_'.$lang; break; case 'priceasc': $ord='p.price ASC'; break; case 'pricedesc': $ord='p.price DESC'; break; case false: $ord='p.id DESC'; break; default: $ord='p.id DESC'; break; } $words=trim($words); switch($by){ case 'name': $sr="p.name_$lang LIKE '%$words%'"; break; case 'our_code': $sr="p.our_code LIKE '%$words%'"; break; case 'supplier_code': $sr="p.supplier_code LIKE '%$words%'"; break; default: $sr="1=1"; break; if(empty($words)) $sr="1=1"; } if(!$setqs) { $qs='SELECT p.* FROM products as p WHERE '.$sr.' ORDER BY '.$ord; $qsc='SELECT count(p.id) FROM products as p WHERE '.$sr; } else { $qs=$setqs.' AND '.$sr.' ORDER BY '.$ord; $qsc=$setqsc.' AND '.$sr; } $out=array($qs, $qsc); return $out; } ?>assign("HEAD_DATA",$HEAD_DATA); $sm->assign("MONTH",$HEAD_DATA[0]["ar_date"]); $sm->assign("ARCH_MONTH",$HEAD_DATA[0]["arch_month"]); $sm->assign("ARCH_YEAR",$HEAD_DATA[0]["arch_year"]); $qs="SELECT a.headlines_text, i.image_path FROM article_cats a LEFT JOIN images i ON i.id=a.headlines_pic WHERE a.type='headlines'"; $q=get_mysql_query($qs); if($q) { $dat=mysql_fetch_assoc($q); $sm->assign("IMG_PATH",$dat["image_path"]); $sm->assign("IMG_TEXT",$dat["headlines_text"]); } $sm->assign('SERVER_PATH', $GLOBALS['SERVER_PATH']); $RES = $sm->fetch('element_news_headlines.tpl'); return $RES; } function GetActionCorner() { $sm = GetSmartyLang(); // Headlines - type_id=39 $qs="SELECT DISTINCT DATE_FORMAT(a.article_date,'%Y') as ar_year FROM articles a LEFT JOIN article_cats b ON b.id=a.type_id WHERE b.type='headlines' ORDER BY a.article_date DESC"; $q=get_mysql_query($qs); $YEARS_DATA=Array(); if($q) { while($dat=mysql_fetch_assoc($q)) $YEARS_DATA[]=$dat["ar_year"]; } $sm->assign("YEARS_DATA",$YEARS_DATA); $sm->assign('SERVER_PATH', $GLOBALS['SERVER_PATH']); $RES = $sm->fetch('element_news_action.tpl'); return $RES; } function GetCommentary() { $sm = GetSmartyLang(); // Commentary - type_id=41 $qs="SELECT a.title, a.url_text, DATE_FORMAT(a.article_date,'%d %b %Y') as art_date,a.author,i.image_path,a.quotes,a.id FROM articles a LEFT JOIN article_cats b ON b.id=a.type_id LEFT JOIN images i ON i.id=a.author_icon_id WHERE b.type='commentary' ORDER BY a.article_date DESC LIMIT 0,4"; $q=get_mysql_query($qs); $COMMENTARY_DATA=Array(); if($q) { while($dat=mysql_fetch_assoc($q)) $COMMENTARY_DATA[]=$dat; } $sm->assign("COMMENTARY_DATA",$COMMENTARY_DATA); $sm->assign('SERVER_PATH', $GLOBALS['SERVER_PATH']); $RES = $sm->fetch('element_news_commentary.tpl'); return $RES; } function GetSpecialReport() { $sm = GetSmartyLang(); // Special Report - type_id=40 $qs="SELECT a.title,a.url_text,a.specialreport_pic_id as pic_id,a.subtitle,a.quotes, DATE_FORMAT(a.article_date,'%d %b %Y') as art_date,a.author,i.image_path,a.id,a.article_text FROM articles a LEFT JOIN article_cats b ON b.id=a.type_id LEFT JOIN images i ON i.id=a.specialreport_pic_id WHERE b.type='special_reports' ORDER BY a.article_date DESC LIMIT 0,4"; $q=get_mysql_query($qs); $SPECIALREPORT_DATA=Array(); if($q) { while($dat=mysql_fetch_assoc($q)) $SPECIALREPORT_DATA[]=$dat; } $sm->assign("SPECIALREPORT_DATA",$SPECIALREPORT_DATA); $sm->assign('SERVER_PATH', $GLOBALS['SERVER_PATH']); $RES = $sm->fetch('element_news_special_report.tpl'); return $RES; } function GetNewsMainPage() { $sm = GetSmartyLang(); $sm->assign("HEADLINES_BODY",GetHeadLines()); $sm->assign("ACTION_BODY",GetActionCorner()); $sm->assign("COMMENTARY_BODY",GetCommentary()); $sm->assign("SPECIAL_REPORT_BODY",GetSpecialreport()); $sm->assign('SERVER_PATH', $GLOBALS['SERVER_PATH']); $RES = $sm->fetch('element_news_main_middle.tpl'); return $RES; } function GetNewsPage() { $RES = GetNewsMainPage(); $sm = GetSmartyLang(); $qs="SELECT a.default_child_cat_id,a.type,l.image_path as logo_path, p.image_path as right_path FROM article_cats a LEFT JOIN images l ON l.id=a.color_logo LEFT JOIN images p ON p.id=a.right_pic WHERE a.id=21"; $q=get_mysql_query($qs); if($q) { $data=mysql_fetch_assoc($q); $sm->assign('DESIGN', $data); } $sm->assign('LEFT_SEARCH_NO', "NO"); $sm->assign('SERVER_PATH', $GLOBALS['SERVER_PATH']); $TYPES["about_us"]=GetArrayById("article_cats","type","about_us"); $TYPES["programmes"]=GetArrayById("article_cats","type","programmes"); $TYPES["events"]=GetArrayById("article_cats","type","events"); $TYPES["icej_worldwide"]=GetArrayById("article_cats","type","icej_worldwide"); $TYPES["news"]=GetArrayById("article_cats","type","news"); $sm->assign("TYPES",$TYPES); $sm->assign("ARTICLE_BODY",$RES); $RES = $sm->fetch('element_article_main.tpl'); $RES = GetMainPage($RES,21); return $RES; } ?>
Notice: Undefined index: language in /www/i/c/u7853/public_html/_sub/new/cutils/overall_functions.php on line 152

Notice: Undefined index: language in /www/i/c/u7853/public_html/_sub/new/cutils/overall_functions.php on line 152

Notice: Undefined index: SERVER_PATH in /www/i/c/u7853/public_html/_sub/new/cutils/overall_functions.php on line 167

Notice: Undefined index: HTTPS_SERVER_PATH in /www/i/c/u7853/public_html/_sub/new/cutils/overall_functions.php on line 169

Fatal error: Call to undefined function get_mysql_query() in /www/i/c/u7853/public_html/_sub/new/cutils/index_functions.php on line 37