A PHP Error was encountered

Severity: 8192

Message: Function set_magic_quotes_runtime() is deprecated

Filename: codeigniter/CodeIgniter.php

Line Number: 60

A PHP Error was encountered

Severity: 8192

Message: Assigning the return value of new by reference is deprecated

Filename: libraries/Loader.php

Line Number: 255

A PHP Error was encountered

Severity: 8192

Message: Assigning the return value of new by reference is deprecated

Filename: database/DB.php

Line Number: 133

0 && strlen($password)>0) { $q = $this->db->query("SELECT * FROM `users` WHERE `username`='".$username."'"); if ($q!==false && $q->num_rows()>0) { $r = $q->row(); if ($r->pass == $password){ $_SESSION['login']['name']=$r->fname; $_SESSION['login']['id']=$r->id; $q->free_result(); return true; } } $q->free_result(); } } return false; } function parse($content,$page){ foreach($page as $f=>$v){ @$content=str_replace("{".$f."}",$v,$content); } return $content; } function site_title(){ $q = $this->db->query("SELECT * FROM `setup` WHERE `name`='site_title'"); if ($q!==false && $q->num_rows()>0){ foreach($q->result() as $r){ $res=$r->value; } } return $res; } function short_str($str,$len){ if(strlen($str)>$len){ $new_string=substr($str,0,$len)."[...]"; }else{ $new_string=$str; } return $new_string; } function save_post_img($name,$max_x,$max_y,$path,$water=false) { if (isset($_FILES[$name]) && isset($_FILES[$name]['tmp_name']) && $_FILES[$name]['size']>0 && is_file($_FILES[$name]['tmp_name']) && strpos($_FILES[$name]['name'],'.php')===false && strpos($_FILES[$name]['type'],'image/')==0 && strpos($_FILES[$name]['type'],'image/')!==false) { $error = error_reporting(); // error_reporting(0); $img = imagecreatefromjpeg($_FILES[$name]['tmp_name']); // error_reporting($error); if (!is_resource($img)) return false; $x = imagesx($img); $y = imagesy($img); if ($x>$max_x || $y>$max_y) {//resize $new_x = $x; $new_y = $y; if (($new_x>$max_x) || ($new_y>$max_y)) { if ( ($new_x/$max_x)>($new_y/$max_y) ) { $r = $new_x/$max_x; $new_x = $max_x; $new_y /= $r; }else { $r = $new_y/$max_y; $new_y = $max_y; $new_x /= $r; } } $img2 = imagecreatetruecolor($new_x,$new_y); imagecopyresampled($img2,$img,0,0,0,0,$new_x,$new_y,$x,$y); if ($water===true) $this->water($img2); imagejpeg($img2,$path,100); imagedestroy($img2); imagedestroy($img); return true; }elseif ($water===true) { $this->water($img); imagejpeg($img,$path,100); imagedestroy($img); return true; }else {//do not resize or watermark, just save imagedestroy($img); $f = fopen($_FILES[$name]['tmp_name'],"rb"); $photo = fread($f,filesize($_FILES[$name]['tmp_name'])); fclose($f); $f = fopen($path,"wb"); fwrite($f,$photo); fclose($f); return true; } } return false; } function water(&$img) { $size_x = imagesx($img); $size_y = imagesy($img); // becouse id could be resized!! $img_water = imagecreatefrompng('images/img_watermark.png'); //$img_water = imagecreatefromgif('img/img_watermark.gif'); $w_x = imagesx($img_water); $w_y = imagesy($img_water); $step_x = $size_x/$w_x; $step_y = $size_y/$w_y; if ($step_x==0)$step_x = 1; if($step_y==0)$step_y=1; for ($i=0;$i<$step_x;$i++) for ($j=0;$j<$step_y;$j++) { $f_x = ($i+1)*$w_x; $f_y = ($j+1)*$w_y;//final x/y - for last repeat to not go outside the image if ($f_x>$size_x) $width_x = $size_x - $w_x*$i; else $width_x = $w_x; if ($f_y>$size_y) $width_y = $size_y - $w_y*$j; else $width_y = $w_y; imagecopyresampled($img,$img_water,$i*$w_x,$j*$w_y,0,0,$width_x,$width_y,$width_x,$width_y); } imagedestroy($img_water); } function proc_img($path_load,$path_save,$max_x,$max_y,$water=false,$photo_id=0) { $x_to_save = 0; $y_to_save = 0; $error = error_reporting(); error_reporting(0); $img = @imagecreatefromjpeg($path_load); error_reporting($error); if (!is_resource($img)) return false; $x = imagesx($img); $y = imagesy($img); $x_to_save = $x; $y_to_save = $y; if ($x>$max_x || $y>$max_y) {//resize $new_x = $x; $new_y = $y; if (($new_x>$max_x) || ($new_y>$max_y)) { if ( ($new_x/$max_x)>($new_y/$max_y) ) { $r = $new_x/$max_x; $new_x = $max_x; $new_y /= $r; }else { $r = $new_y/$max_y; $new_y = $max_y; $new_x /= $r; } } $x_to_save = $new_x; $y_to_save = $new_y; $img2 = imagecreatetruecolor($new_x,$new_y); imagecopyresampled($img2,$img,0,0,0,0,$new_x,$new_y,$x,$y); if ($water===true) $this->water($img2); imagejpeg($img2,$path_save,100); imagedestroy($img2); imagedestroy($img); }elseif ($water===true) { $this->water($img); imagejpeg($img,$path_save,100); imagedestroy($img); }else {//do not resize or watermark, just save imagedestroy($img); $f = fopen($path_load,"rb"); $photo = fread($f,filesize($path_load)); fclose($f); $f = fopen($path_save,"wb"); fwrite($f,$photo); fclose($f); } if ($photo_id>0) $this->db->query("UPDATE `` SET `size_x`='".$x_to_save."',`size_y`='".$y_to_save."' WHERE `id`='".$photo_id."'"); return true; } function get_photo_size($path,$max_x,$max_y) { if (!file_exists($path)) return array('x'=>$max_x,'y'=>$max_y);; $error = error_reporting(); error_reporting(0); $img = imagecreatefromjpeg($path); error_reporting($error); if (!is_resource($img)) return array('x'=>$max_x,'y'=>$max_y); $x = imagesx($img); $y = imagesy($img); imagedestroy($img); $new_x = $x; $new_y = $y; if (($new_x>$max_x) || ($new_y>$max_y)) { if ( ($new_x/$max_x)>($new_y/$max_y) ) { $r = $new_x/$max_x; $new_x = $max_x; $new_y /= $r; }else { $r = $new_y/$max_y; $new_y = $max_y; $new_x /= $r; } } return array('x'=>$new_x,'y'=>$new_y); } function genRandomString($length) { $characters="0123456789abcdefghijklmnopqrstuvwxyz"; $string=""; for ($p=0; $p<$length; $p++) { @$string.=$characters[mt_rand(0, strlen($characters))]; } return $string; } function send_mail($to,$subject,$body){ $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: BizAfriq ' . "\r\n"; @mail($to,$subject,$body,$headers); } function main_menu(){ $page = array(); $page['base_url'] = base_url(); $main_menu=array(); $qmm = $this->db->query("SELECT * FROM `site_pages` WHERE `main_menu`='1' AND `parent`='0' ORDER BY `order` ASC"); if ($qmm!==false && $qmm->num_rows()>0){ foreach($qmm->result() as $rmm){ $submenu_items=array(); $qmm2 = $this->db->query("SELECT * FROM `site_pages` WHERE `main_menu`='1' AND `parent`='".$rmm->id."' ORDER BY `order` ASC"); if ($qmm2!==false && $qmm2->num_rows()>0){ foreach($qmm2->result() as $rmm2){ $submenu_items[]=array("sub_menu_title"=>$rmm2->menu_title,"sub_name"=>$rmm2->name); } } $main_menu[]=array("menu_title"=>$rmm->menu_title,"name"=>$rmm->name,"submenu_items"=>$submenu_items); } } $page["main_menu_items"]=$main_menu; $main_menu=$this->parser->parse("templates/main_menu.html",$page,TRUE); return $main_menu; } function secondary_menu(){ $page = array(); $page['base_url'] = base_url(); $secondary_menu=array(); $qmm = $this->db->query("SELECT * FROM `site_pages` WHERE `sec_menu`='1' ORDER BY `order` ASC"); if ($qmm!==false && $qmm->num_rows()>0){ foreach($qmm->result() as $rmm){ $secondary_menu[]=array("menu_title"=>$rmm->menu_title,"name"=>$rmm->name); } } $page["secondary_menu_items"]=$secondary_menu; $secondary_menu=$this->parser->parse("templates/secondary_menu.html",$page,TRUE); return $secondary_menu; } function page_menu($par){ $page = array(); $page['base_url'] = base_url(); $page["edit_content"]=$edit; $page["edit_content2"]=$edit; $page["pid"]=$n; $page_menu=array(); while($par!=0){ $qp1 = $this->db->query("SELECT * FROM `site_pages` WHERE `id`='".$par."' ORDER BY `order` ASC"); $rowp1 = $qp1->row(); $par=$rowp1->parent; } $page_items=array(); $qmm2 = $this->db->query("SELECT * FROM `site_pages` WHERE `parent`='".$rowp1->id."' ORDER BY `order` ASC"); if ($qmm2!==false && $qmm2->num_rows()>0){ foreach($qmm2->result() as $rmm2){ if($n==$rmm2->id){ $hlight="hlight"; }else{ $hlight=""; } $page_items[]=array("menu_title"=>$rmm2->menu_title,"name"=>$rmm2->name,"hlight"=>$hlight,"margin"=>5); $qmm3 = $this->db->query("SELECT * FROM `site_pages` WHERE `parent`='".$rmm2->id."' ORDER BY `order` ASC"); if ($qmm3!==false && $qmm3->num_rows()>0){ foreach($qmm3->result() as $rmm3){ if($n==$rmm3->id){ $hlight="hlight"; }else{ $hlight=""; } $page_items[]=array("menu_title"=>$rmm3->menu_title,"name"=>$rmm3->name,"hlight"=>$hlight,"margin"=>15); } } } } $page["main_page_name"]=$rowp1->name; $page["page_menu_items"]=$page_items; $page_menu=$this->parser->parse("templates/page_menu.html",$page); return $page_menu; } } ?>