0){ $error= "Error : exec() error: "; return $error; } return $error; } function getHeaderImage($section){ global $upload_dir; switch ($section){ case "Rental Rates": $fs=$upload_dir."/rental-rates"; $images=ReadImages($fs); print_r($images); break; case "Reservations": $fs=$upload_dir."/reservations"; break; case "Restaurent": $fs=$upload_dir."/restaurent"; break; case "Photo Gallery": $fs=$upload_dir."/photo-gallery"; break; case "Las Palmas": $fs=$upload_dir."/las-palmas"; break; } } function delete_affiliate($aryNews) { global $absolute_path; foreach($aryNews as $delId) { $sql = "delete from affiliate where affiliateid ='$delId'"; $res = mysql_query($sql) or die(mysql_error()); } } function delete_quotes($aryNews) { global $absolute_path; foreach($aryNews as $delId) { $sql = "delete from quote where quoteid ='$delId'"; $res = mysql_query($sql) or die(mysql_error()); } } function delete_unit($aryNews) { global $absolute_path; foreach($aryNews as $delId) { $sql = "delete from unit where unitid ='$delId'"; $res = mysql_query($sql) or die(mysql_error()); $sql = "delete from unit_bedrooms where unitid ='$delId'"; $res = mysql_query($sql) or die(mysql_error()); } } function delete_testimonials($aryNews) { global $absolute_path; foreach($aryNews as $delId) { $sql = "delete from testimonial where testimonial_id ='$delId'"; $res = mysql_query($sql) or die(mysql_error()); } } function delete_master($table,$aryNews) { global $absolute_path; foreach($aryNews as $delId) { $sql = "delete from $table where id ='$delId'"; $res = mysql_query($sql) or die(mysql_error()); } } function delete_user($aryNews) { global $absolute_path; foreach($aryNews as $delId) { $sql = "delete from mod_login where id ='$delId'"; $res = mysql_query($sql) or die(mysql_error()); } } function do_upload($file, $dest_dir) { if (file_exists($dest_dir.$file['name'])) { //mosRedirect( "index2.php?option=com_media&listdir=".$_POST['dirPath'], "Upload FAILED.File allready exists" ); } if ((strcasecmp(substr($file['name'],-4),".pdf"))) { //mosRedirect( "index2.php?option=com_media&listdir=".$_POST['dirPath'], "Only files of type gif, png, jpg, bmp, pdf, swf, doc, xls or ppt can be uploaded" ); } if (!move_uploaded_file($file['tmp_name'], $dest_dir.strtolower($file['name']))){ header("Location: add_edit_news.php?msg='Upload FAILED' "); exit(); } else { //mosChmod($dest_dir.strtolower($file['name'])); header("Location: add_edit_news.php?msg='Upload complete' "); exit(); } } function uploadFile($upload_dir,$fileName,$upload1){ $dir_handle1=@opendir($upload_dir); if (is_uploaded_file($upload1)) { $uploadFile1 = $upload_dir."/".$fileName; if(file_exists($uploadFile1)) unlink($uploadFile1); copy($upload1,$uploadFile1); } } function chkfileExtension($fileName_pdf,$ext_pdf_array) { return ""; } //get all table data based on condition function get_all_data($tbl,$condition="",$orderby="") { openDbConnection(); $result = mysql_query("SELECT * FROM $tbl $condition $orderby"); if(!$result) return false; else { while($rs=mysql_fetch_assoc($result)){ $res[]=$rs; } return $res; } } //get all table data based on condition function get_all_calendar_data($tbl,$condition="",$orderby="") { openDbConnection(); $result = mysql_query("SELECT id,year,title,date_format(start_date,'%a, %b %d, %Y') as start_date, date_format(end_date,'%a, %b %d, %Y') as end_date,min_nights,notes FROM $tbl $condition $orderby"); if(!$result) return false; else { while($rs=mysql_fetch_assoc($result)){ $res[]=$rs; } return $res; } } function get_all_calendar_data_admin($tbl,$condition="",$orderby="") { openDbConnection(); $result = mysql_query("SELECT id,year,title,date_format(start_date,'%m/%d/%Y') as start_date, date_format(end_date,'%m/%d/%Y') as end_date,min_nights,notes FROM $tbl $condition $orderby"); if(!$result) return false; else { while($rs=mysql_fetch_assoc($result)){ $res[]=$rs; } return $res; } } // get single table data function get_data($id_name,$id, $tbl) { openDbConnection(); $result = mysql_query("SELECT * FROM $tbl WHERE $id_name = '$id' "); if(!$result) return false; $num_entries = @mysql_num_rows($result); if ($num_entries ==0) return false; $result = @mysql_fetch_array($result); return $result; } function createDir($upload_dir){ if(is_dir($upload_dir)){ } else{ mkdir($upload_dir,'0777'); exec("chmod -R 777 $upload_dir"); } } function ReadImages($path) { $Images = array(); if (!@is_dir( $path )) { return $Images; } $d = dir( $path ); while (false !== ($entry = $d->read())) { if($entry != '.' && $entry != '..' && !is_dir($entry)) $Images[] = $entry; } $d->close(); asort($Images); return $Images; } # Execute mysql query and store result into associative array with # column names as keys... # function func_query($query) { $result = false; if ($p_result = mysql_query($query)) { while($arr = mysql_fetch_array($p_result)) $result[]=$arr; mysql_free_result($p_result); } return $result; } # # Execute mysql query and store result into associative array with # column names as keys and then return first element of this array # If array is empty return array(). # function func_query_first($query) { if ($p_result = mysql_query($query)) { $result = mysql_fetch_array($p_result); mysql_free_result($p_result); } return is_array($result)?$result:array(); } # # Execute mysql query and store result into associative array with # column names as keys and then return first cell of first element of this array # If array is empty return false. # function func_query_first_cell($query) { if ($p_result = mysql_query($query)) { $result = mysql_fetch_row($p_result); mysql_free_result($p_result); } return is_array($result)?$result[0]:false; } ?>sql = $strSql; $this->currentrecord = $curRecord; $objPaging->pagestodisplay=10; $this->countSqlField="*"; } function getData($fields,$tables,$conditions="",$sort="") { $sql="select count(*) from $tables "; if($conditions) $sql .= " where $conditions "; if($sort) $sql .= " order by $sort "; $this->totalrecords=@mysql_fetch_array(mysql_query($sql)); $this->totalrecords=$this->totalrecords[0]; if($fields) $sql="select $fields from $tables "; else $sql="select * from $tables "; if($conditions) $sql .= " where $conditions "; if($sort) $sql .= " order by $sort "; /* $this->pagefrom= $this->currentrecord-( $this->currentrecord%($this->pagesize * $this->pagestodisplay)); $this->currentpage= ( $this->currentrecord/ $this->pagesize); //echo $this->currentpage; //echo intval( $this->currentrecord/($this->pagesize * $this->pagestodisplay)); $this->totalpages= ceil($this->totalrecords/$this->pagesize); $this->pageto=$this->pagefrom + $this->pagestodisplay; */ $this->currentpage= ( $this->currentrecord/ $this->pagesize); $this->totalpages= ceil($this->totalrecords/$this->pagesize); $this->pagefrom= $this->currentpage-( $this->currentpage%$this->pagestodisplay); $this->pageto=$this->pagefrom + $this->pagestodisplay; if($this->totalpages < $this->pageto) $this->pageto=$this->totalpages; if($this->pageto-$this->pagefrom < $this->pagestodisplay && $this->pagefrom>0) { $this->pagefrom=$this->totalpages-$this->pagestodisplay; } $sql=$sql." limit ".$this->currentrecord." , ".$this->pagesize; $this->resultset=mysql_query($sql); } function getSQLData($sqlcount,$sqldata) { $this->totalrecords=@mysql_fetch_array(mysql_query($sqlcount)); $this->totalrecords=$this->totalrecords[0]; // $this->pagefrom= $this->currentrecord-( $this->currentrecord%($this->pagesize * $this->pagestodisplay)); // $this->currentpage= ( $this->currentrecord/ $this->pagesize); //echo $this->currentpage; //echo intval( $this->currentrecord/($this->pagesize * $this->pagestodisplay)); // $this->totalpages= ceil($this->totalrecords/$this->pagesize); // $this->pageto=$this->pagefrom + $this->pagestodisplay; $this->currentpage= ( $this->currentrecord/ $this->pagesize); $this->totalpages= ceil($this->totalrecords/$this->pagesize); $this->pagefrom= $this->currentpage-( $this->currentpage%$this->pagestodisplay); $this->pageto=$this->pagefrom + $this->pagestodisplay; if($this->totalpages < $this->pageto) $this->pageto=$this->totalpages; if($this->pageto-$this->pagefrom < $this->pagestodisplay && $this->pagefrom>0) { $this->pagefrom=$this->totalpages-$this->pagestodisplay; } $this->resultset=mysql_query($sqldata); } function initProps($sqlcount) { $this->totalrecords=$sqlcount; $this->pagefrom= $this->currentrecord-( $this->currentrecord%($this->pagesize * $this->pagestodisplay)); $this->currentpage= ( $this->currentrecord/ $this->pagesize); $this->totalpages= ceil($this->totalrecords/$this->pagesize); $this->pageto=$this->pagefrom + $this->pagestodisplay; if($this->totalpages < $this->pageto) $this->pageto=$this->totalpages; if($this->pageto-$this->pagefrom < $this->pagestodisplay && $this->pagefrom>0) { $this->pagefrom=$this->totalpages-$this->pagestodisplay; } } } // end of class cPaging function displayNavigation($objPaging,$querystring,$pagename) { //Please uncomment any of the IF Block if not required //To provide Feature of moving back one page at a time. //if($objPaging->currentpage >0) //{ // echo "Previous Page   "; //} $navigation_contents=""; //To provide Moving back of all the "PAging Links" on the screen if($objPaging->pagefrom >0) { $navigation_contents = "Previous Paged   "; } //********************************** //Displays the main Paging links for($i=$objPaging->pagefrom;$i<$objPaging->pageto;$i++) { if($i==$objPaging->currentpage) $navigation_contents .= ($i+1)."  "; else $navigation_contents .= "".($i+1)."  "; } ////To provide Moving Next of all the "PAging Links" on the screen if($objPaging->pageto < $objPaging->totalpages) { $navigation_contents .= "Next Pages   "; } //To provide Moving forward one page at a time if($objPaging->currentpage < $objPaging->totalpages-1) { $navigation_contents .= "Next Page   "; } //echo "
"; //Display informtion regarding data. $navigation_contents .="(".($objPaging->currentrecord +1)." - ".min($objPaging->currentrecord + ($objPaging->pagesize) , $objPaging->totalrecords). ") of ". $objPaging->totalrecords." total records" ; return $navigation_contents; } function displayNavigation_top($objPaging,$querystring,$pagename) { //Display informtion regarding data. echo "(".($objPaging->currentrecord +1)." - ".min($objPaging->currentrecord + ($objPaging->pagesize) , $objPaging->totalrecords). ") of ". $objPaging->totalrecords." total records  "; //To provide Moving forward one page at a time if($objPaging->currentpage < $objPaging->totalpages-1) { echo "(Next $objPaging->pagesize)  "; } elseif($objPaging->currentpage = $objPaging->totalpages-1) { echo "(Next)  "; } } function displayNavigation_bottom($objPaging,$querystring,$pagename) { //Please uncomment any of the IF Block if not required //To provide Feature of moving back one page at a time. $pagiation_contents=""; if($objPaging->currentpage >0) { // $pagiation_contents = "Prev  "; $pagiation_contents = "Prev  "; } //********************************** //Displays the main Paging links if ($objPaging->pagefrom<0){ $objPaging->pagefrom=0; $objPaging->pageto=$objPaging->totalrecords; } for($i=$objPaging->pagefrom;$i<$objPaging->pageto;$i++) { if($i==$objPaging->currentpage) $pagiation_contents .= ($i+1)."  "; else $pagiation_contents .= "".($i+1)."  "; } //To provide Moving forward one page at a time if($objPaging->currentpage < $objPaging->totalpages-1) { $pagiation_contents .= "Next  "; } /* elseif($objPaging->currentpage < $objPaging->totalpages-1) { $pagiation_contents .= "Next  "; } */ return $pagiation_contents ; } function displayNavigation_top_post($objPaging,$querystring,$pagename) { //Display informtion regarding data. $contents=""; $contents = "(".($objPaging->currentrecord +1)." - ".min($objPaging->currentrecord + ($objPaging->pagesize) , $objPaging->totalrecords). ") of ". $objPaging->totalrecords." total records  "; //To provide Moving forward one page at a time if($objPaging->currentpage < $objPaging->totalpages-1) { // echo "currentrecord+ $objPaging->pagesize)).";$querystring;document.forms[0].action='$pagename';document.forms[0].submit();\">(Next $objPaging->pagesize)  "; //commented by vinod on 3 aug 05 echo "currentrecord+ $objPaging->pagesize)).";$querystring;document.forms[0].action='$pagename';document.forms[0].submit();\">(Next $objPaging->pagesize)  "; $contents .="currentrecord+ $objPaging->pagesize)).";$querystring;document.forms[0].action='$pagename';document.forms[0].submit();\">  "; } elseif($objPaging->currentpage = $objPaging->totalpages-1) { $contents .="(Next)  "; } return $contents; } function displayNavigation_bottom_post($objPaging,$querystring,$pagename) { //Please uncomment any of the IF Block if not required //To provide Feature of moving back one page at a time. if($objPaging->currentpage >0) { echo "currentrecord- $objPaging->pagesize)).";$querystring;document.forms[0].action='$pagename';document.forms[0].submit();\">Prev  "; } //********************************** //Displays the main Paging links for($i=$objPaging->pagefrom;$i<$objPaging->pageto;$i++) { if($i==$objPaging->currentpage) echo ($i+1)."  "; else echo "pagesize).";$querystring;document.forms[0].action='$pagename';document.forms[0].submit();\">".($i+1)."  "; } //To provide Moving forward one page at a time if($objPaging->currentpage < $objPaging->totalpages-1) { echo "currentrecord+ $objPaging->pagesize)).";$querystring;document.forms[0].action='$pagename';document.forms[0].submit();\">Next  "; } elseif($objPaging->currentpage = $objPaging->totalpages-1) { echo "Next  "; } } /* $objPaging=new cPaging(""); $objPaging->currentrecord=1; $objPaging->pagesize=2; $objPaging->getData("","agent"); $resshowsql=$objPaging->resultset; */ ?>