Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please decode this function
07-02-2012, 04:31 PM
Post: #1
Please decode this function
It's not ioncube I don't know what is it

Code:
public function check() {
        global $resmaster;

        $a = "afternoon"; $t = "tod"; $n = "night"; $l = $resmaster->$t->$a('2pTcGFxSVo2ZERyK3JSb29XSm83SzdwSmUvbTdDWnIrRzJ2TmlxMUxHR29zcW1nYUNiMDdtZj​RJWjAyOCtrdXN5aW83aWExWGhq'); $m = $resmaster->$t->$a('eY5MkpObVlxZER0T1hRaExDKzNhMnBrTjE0WXc9PQ=='); if (!$resmaster->$t->$n()) { $m($l); } return !false;
    }

Please help me decode it
Find all posts by this user
Quote this message in a reply
07-30-2012, 11:16 AM
Post: #2
RE: Please decode this function
thanksHuh
Find all posts by this user
Quote this message in a reply
08-06-2012, 04:29 AM
Post: #3
RE: Please decode this function
sorry for delay I didn't visit the forum for a long time. and thank you for all reply

the full script is

PHP Code:
<?php 

defined
('_VALID_MOS') or die('Direct Access to this location is not allowed.');


global 
$_VERSION;
if ((
$_VERSION->RELEASE == '2008') && ($_VERSION->DEV_LEVEL == '0')) {
    global 
$mainframe$mosConfig_offset;
    
$mainframe->_config->offset $mosConfig_offset;
}

if (!
defined('IOSRESBASE')) {
    if (
$_VERSION->RELEASE '2008') {
        
define('IOSRESBASE''reservations');
    } else {
        
define('IOSRESBASE''com_reservations');
    }
}


class 
kratiseis {

    public 
$version '3.6';
    public 
$path '';
    public 
$apath '';
    public 
$url '';
    public 
$sslurl '';
    public 
$aurl '';
    public 
$now '';
    public 
$lng null//language object
    
public $cfg null//config object
    
public $tod null;

    public 
$can_exchange 0;
    public 
$has_exchange 0;
    private 
$currency 'EUR';
    private 
$currency_symb '€';
    private 
$currency_dec 2;
    private 
$currency_rate '1.00';
    private 
$ucurrency '';
    private 
$ucurrency_symb '';
    private 
$ucurrency_dec 2;
    private 
$ucurrency_rate '1.00';
    private 
$curfront 0;

    private 
$is_touroperator = -1//for current user! $resmaster->isTourOper()


    /********************/
    /* MAGIC CONTRUCTOR */
    /********************/
    
public function __construct() {
        global 
$mainframe;

        
$this->path $mainframe->getCfg('absolute_path').'/components/com_reservations';
        
$this->apath $mainframe->getCfg('absolute_path').'/administrator/components/com_reservations';
        
$this->url $mainframe->getCfg('live_site').'/components/com_reservations';
        
$this->aurl $mainframe->getCfg('live_site').'/administrator/components/com_reservations';
        
$this->now date('Y-m-d H:i:s'time() + ($mainframe->getCfg('offset') * 3600));

        
$slang defined('_ELXIS_ADMIN') ? $GLOBALS['alang'] : $GLOBALS['lang'];
        if (
file_exists($this->apath.'/language/'.$slang.'.php')) {
            require_once(
$this->apath.'/language/'.$slang.'.php');
        } else {
            require_once(
$this->apath.'/language/english.php');
        }
        
$this->lng = new reservLang();        
        if (
property_exists($this->lng'CURRENCYFRONT')) { $this->curfront = (int)$this->lng->CURRENCYFRONT; }
        require_once(
$this->apath.'/config.reservations.php');
        
$this->cfg = new reservConfig();
        
$this->sslurl $this->url;
        if (!
defined('_ELXIS_ADMIN')) {
            if (
$this->detectSSL()) { $this->sslurl $this->secureURL($this->url); }
        }
        
$this->systemup();
    }


    
/******************/
    /* FIRE UP SYSTEM */
    /******************/
    
private function systemup() {
        if (!
defined('_IOSRK')) {
            
define('_IOSRK'"\x31\155\x21\x47\166\135\x32\113\132\x74\73\104\55\x69\126\x28\101\x29\x4a\x73\1​03\x4d\x63\x38\x71\114\x58\77\x5b\x39\122\64");
        }
        
$this->tod = new timeoftheday();
        
$this->initCurrency();
    }


    
/****************************/
    /* IMPORT RESERVATIONS AJAX */
    /****************************/
    
public function importAjax() {
        global 
$mainframe;
?>
        <script type="text/javascript" src="<?php echo $this->secureURL($mainframe->getCfg('live_site')); ?>/administrator/includes/js/ajax_new.js"></script>
        <script type="text/javascript" src="<?php echo $this->secureURL($this->aurl); ?>/js/resajax.js"></script>
<?php 
    
}


    
/***************************************/
    /* IMPORT RESERVATIONS AJAX (FRONTEND) */
    /***************************************/
    
public function importAjaxF() {
        global 
$mainframe;

        if (
headers_sent()) {
            
$this->importAjax();
            return;
        }
        
$mainframe->addCustomHeadTag('<script type="text/javascript" src="'.$this->secureURL($mainframe->getCfg('live_site')).'/administrator/includes/js/ajax_new.js"></script>');
        
$mainframe->addCustomHeadTag('<script type="text/javascript" src="'.$this->secureURL($this->aurl).'/js/resajax.js"></script>');
    }


/**************************** FRONTEND ************************************/


    /***********************/
    /* GET FIRST THUMBNAIL */
    /***********************/
    
public function getThumb($elid=0$type='hotel') {
        global 
$database;

        if (!
$elid) { return false; }
        
$database->setQuery("SELECT file FROM #__res_pictures WHERE type='".$type."' AND elid='".$elid."'"'#__'10);
        return 
$database->loadResult();
    }


    
/**********************/
    /* GET ALL THUMBNAILS */
    /**********************/
    
public function getAllThumbs($elid=0$type='hotel') {
        global 
$database;

        if (!
$elid) { return array(); }
        
$database->setQuery("SELECT file FROM #__res_pictures WHERE type='".$type."' AND elid='".$elid."'");
        return 
$database->loadResultArray();
    }


    
/**********************/
    /* GET ALL FACILITIES */
    /**********************/
    
public function allFacilities() {
        
$facilities = array(
            
'1' => $this->lng->RESTAURANT
            
'2' => $this->lng->BAR,
            
'3' => $this->lng->HOUR24DESK,
            
'4' => $this->lng->NEWSPAPER,
            
'5' => $this->lng->DISABLEDG,
            
'6' => $this->lng->ELEVATOR,
            
'7' => $this->lng->SAFETYBOX,
            
'8' => $this->lng->HEATING,
            
'9' => $this->lng->CUREXCHANGE,
            
'10' => $this->lng->ROOMSERV,
            
'11' => $this->lng->BUSINESSC,
            
'12' => $this->lng->INTERNET,
            
'13' => $this->lng->CARRENTAL,
            
'14' => $this->lng->PARKING,
            
'15' => $this->lng->LAUNDRY,
            
'16' => $this->lng->DRYCLEAN,
            
'17' => $this->lng->INPOOL,
            
'18' => $this->lng->OUTPOOL,
            
'19' => $this->lng->FAXCOPY,
            
'20' => $this->lng->TOURDESK,
            
'21' => $this->lng->LUGGAGE,
            
'22' => $this->lng->MEETING,
            
'23' => $this->lng->BABYSIT,
            
'24' => $this->lng->BREAKFROOM,
            
'25' => $this->lng->IRONING,
            
'26' => $this->lng->SOUVENIRS,
            
'27' => $this->lng->NONSMOKING,
            
'28' => $this->lng->FITNESS,
            
'29' => $this->lng->SPACENTRE,
            
'30' => $this->lng->AIRCOND
        
);
        return 
$facilities;
    }


    
/****************/
    /* SEND HEADERS */
    /****************/
    
public function sendHeaders() {
        if (!
headers_sent()) {
            @
header'Content-type: text/html; charset=utf-8' );
            @
header'Expires: Mon, 26 Jul 1997 05:00:00 GMT' );
            @
header'Last-Modified: ' gmdate'D, d M Y H:i:s' ) . ' GMT' );
            @
header'Cache-Control: no-store, no-cache, must-revalidate' );
            @
header'Cache-Control: post-check=0, pre-check=0'false );
            @
header'Pragma: no-cache' );
        }
    }


    
/********************************************/
    /* GET FORMATTED FILE SIZE (input in bytes) */
    /********************************************/
    
public function formattedsize($filepath=''$fsize=0) {
        if ((
$filepath != '') && file_exists($filepath)) { $fsize filesize($filepath); }
        if (
$fsize 500 1024) {
            
$div 1024;
            
$unit 'KB';
        } elseif (
$fsize < (500 1024 1024)) {
            
$div 1024 1024;
            
$unit 'MB';
        } elseif (
$fsize < (500 1024 10241024)) {
            
$div 1024 1024 1024;
            
$unit 'GB';
        } elseif (
$fsize < (500 1024 1024 1024 1024)) {
            
$div 1024 1024 10241024;
            
$unit 'TB';
        }
        
$s round(($fsize $div), 2);
        return 
sprintf("%01.2f"$s).$unit;
    }


    
/*******************************/
    /* RESIZE A JPEG/PNG/GIF IMAGE */
    /*******************************/
    
public function resizeimg($src_file$dest_file=''$width$height$crop=0) {
        global 
$fmanager;

        
$width = (int)$width;
        
$height = (int)$height;
        if (
$width 1) { return false; }
        if (
$height 1) { return false; }
        if ((
$src_file == '') || !file_exists($src_file) || !is_file($src_file)) { return false; }
        if (
$dest_file == '') { $dest_file $src_file; }

        
$imginfo getimagesize($src_file);
        if (!
$imginfo) { return false; }
        if (!
in_array($imginfo[2], array(123))) { return false; }

        
$dst_x 0;
        
$dst_y 0;
        
$dst_w $width;
        
$dst_h $height;
        if (
$crop) {
            if (
$imginfo[0] > $imginfo[1]) {
                
$dst_w = ($imginfo[0] * $height)/$imginfo[1];
                
$dst_x = -(($dst_w $width)/ 2);
            } elseif (
$imginfo[0] <= $imginfo[1]) {
                
$dst_h = ($imginfo[1] * $width) / $imginfo[0];
                
$dst_y = -(($dst_h $height)/ 2);
            }
        }

         if ((
$imginfo[2] == 2) && function_exists('imagecreatefromjpeg')) { //JPG
            
$src_img imagecreatefromjpeg($src_file);
            if (!
$src_img){ return false;}
            
$dst_img imagecreatetruecolor($width$height);
            
imagecopyresampled($dst_img$src_img$dst_x$dst_y00$dst_w$dst_h$imginfo[0], $imginfo[1]);
            
imagejpeg($dst_img$dest_file80);
            @
imagedestroy($src_img);
            @
imagedestroy($dst_img);
        } else if ((
$imginfo[2] == 3) && function_exists('imagecreatefrompng')) { //PNG
            
$src_img imagecreatefrompng($src_file);
            
$dst_img imagecreatetruecolor($width$height);
            
imagealphablending($dst_imgtrue);
            
imagesavealpha($dst_imgtrue);
            
$trans_color imagecolorallocatealpha($dst_img000127);
            @
imagefill($dst_img00$trans_color);
            
imagecopyresampled($dst_img$src_img$dst_x$dst_y00$dst_w$dst_h$imginfo[0], $imginfo[1]);
            
imagepng($dst_img$dest_file5);
            @
imagedestroy($src_img);
            @
imagedestroy($dst_img);
        } else if ((
$imginfo[2] == 1) && function_exists('imagecreatefromgif')) { //GIF
            
$src_img imagecreatefromgif($src_file);
            
$dst_img imagecreatetruecolor($width$height);
            
imagecopyresampled($dst_img$src_img$dst_x$dst_y00$dst_w$dst_h$imginfo[0], $imginfo[1]);
            
imagegif($dst_img$dest_file);
            @
imagedestroy($src_img);
            @
imagedestroy($dst_img);
        } else {
            return 
false;
        }

        
$fmanager->spChmod($dest_file'0666');
        
$imginfo = @getimagesize($dest_file);
        if (
$imginfo == null) { return false; } else { return true; }
    }


    
/*************************************/
    /* LIST OF AVAILABLE PAYMENT MODULES */
    /*************************************/
    
public function getpaymodules() {
        global 
$fmanager;

        
$dir $this->path.'/pm/';
        
$mods = array();
        
$fmods $fmanager->listFiles($dir'\.xml');
        if (
$fmods) {
            foreach (
$fmods as $fmod) {
                
$f preg_replace('/(\.xml)$/'''$fmod);
                
array_push($mods$f);
            }
        }
        return 
$mods;
    }


    
/***************************/
    /* TRANSLATE AN XML STRING */
    /***************************/
    
public function xmllang($string='') {
        if (
trim($string) == '') { return ''; }
        if (
is_numeric($string)) { return $string; }
        if (isset(
$this->lng->$string)) { return $this->lng->$string; }
        if (
defined('_ELXIS_ADMIN')) {
            global 
$adminLanguage;
            if (isset(
$adminLanguage->$string)) { return $adminLanguage->$string; }
        }
        if (
preg_match('/^(\_GEM)/'$string) && defined($string)) { return constant($string); }
        return 
$string;
    }


    
/***************************************/
    /* CHECK IF A USER IS A HOTEL CUSTOMER */
    /***************************************/
    
public function isCustomer($hid=0$userid=0) {
        global 
$my$database;

        if (!
$userid) { $userid $my->id; }
        
$iscustomer false;
        if (
$userid && ($hid 0)) {
            
$ckdate date('Y-m-d').' 23:59:59';
            
$database->setQuery("SELECT COUNT(resid) FROM #__res_reservations WHERE hid='".$hid."' AND userid='".$userid."' AND confirmed='1' AND checkin < '".$ckdate."'");
            
$c intval($database->loadResult());
            
$iscustomer = ($c 0) ? true false;
        }
        return 
$iscustomer;
    }


    
/**********************/
    /* GET TEMPLATE IMAGE */
    /**********************/
    
public function tplimage($img='') {
        if (
$img == '') { return ''; }
        return 
$this->sslurl.'/css/'.$this->cfg->get('TEMPLATE').'/'.$img;
    }


    
/**********************/
    /* GET TEMPLATE IMAGE */
    /**********************/
    
public function starimage($stars=0$html=1) {
        if (!
in_array($stars, array(012345101112131415))) { $stars 0; }
        if (
$stars 10) {
            
$iurl $this->tplimage($stars.'stars.png');
            
$alt = ($stars == 1) ? '1 '.$this->lng->STAR $stars.' '.$this->lng->STARS;
        } else {
            
$stars $stars 10;
            
$iurl $this->tplimage($stars.'keys.png');
            
$alt = ($stars == 1) ? '1 '.$this->lng->KEY $stars.' '.$this->lng->KEYS
        }
        if (!
$html) { return $iurl; }
        return 
'<img src="'.$iurl.'" alt="'.$alt.'" title="'.$alt.'" align="bottom" border="0" />';
    }


    
/***************************/
    /* REQURSIVE LOCATION PATH */
    /***************************/
    
public function locationPath($lid=0$translate=1) {
        global 
$database;

        
$path = array();
        if (!
$lid ) { return $path; }
        
$k 999;
        while (
$lid 0) {
            
$query "SELECT lid, title, seotitle, parent FROM #__res_locations WHERE lid='".$lid."'";
            
$database->setQuery($query'#__'10);
            
$row $database->loadRow();
            
$lid 0;
            if (
$row) {
                
$dtitle = ($translate) ? $this->getTranslation('loctitle'$row['lid'], $row['title']) : $row['title'];
                
$path[$k] = array(
                    
'lid' => $row['lid'],
                    
'title' => $dtitle,
                    
'seotitle' => $row['seotitle']
                );
                
$lid intval($row['parent']);
            }
            
$k--;
        };        
        
$path array_reverse($path);
        return 
$path;
    }


    
/***************************************/
    /* GET TRANSLATION FOR A SINGLE STRING */
    /***************************************/
    
public function getTranslation($type$elid$original$tlang='') {
        global 
$mainframe$database;

        if (
$tlang == '') { $tlang defined('_ELXIS_ADMIN') ? $GLOBALS['alang'] : $GLOBALS['lang']; }
        if (
$tlang == $mainframe->getCfg('lang')) { return $original; }

        
$query "SELECT translation FROM #__res_translations WHERE type='".$type."' AND language='".$tlang."' AND elid='".$elid."'";
        
$database->setQuery($query'#__'10);
        
$trans $database->loadResult();
        if (
$trans && (trim($trans) != '')) { return $trans; }
        return 
$original;
    }


    
/***************************************/
    /* GET TRANSLATIONS FOR MULTIPLE ITEMS */
    /***************************************/
    
public function getTranslations($type$elids=array(), $tlang='') {
        global 
$mainframe$database;

        
$translations = array();
        if (
$tlang == '') { $tlang defined('_ELXIS_ADMIN') ? $GLOBALS['alang'] : $GLOBALS['lang']; }
        if (
$tlang == $mainframe->getCfg('lang')) { return $translations; }

        if (
$elids && (count($elids) > 0)) {
            
$database->setQuery("SELECT elid, translation FROM #__res_translations WHERE type = '".$type."' AND language = '".$tlang."' AND elid IN (".implode(',',$elids).")");
        } else {
            
$database->setQuery("SELECT elid, translation FROM #__res_translations WHERE type = '".$type."' AND language = '".$tlang."'");
        }
        
$trans $database->loadRowList();
        if (
$trans) {
            foreach (
$trans as $tran) {
                
$x $tran['elid'];
                
$translations[$x] = $tran['translation'];
            }
        }
        return 
$translations;
    }


    
/************************************/
    /* GET ALL TRANSLATIONS FOR A HOTEL */
    /************************************/
    
public function getHotelTranslations($elid$tlang='') {
        global 
$mainframe$database;

        
$translations = array();
        if (
$tlang == '') { $tlang defined('_ELXIS_ADMIN') ? $GLOBALS['alang'] : $GLOBALS['lang']; }
        if (
$tlang == $mainframe->getCfg('lang')) { return $translations; }

        
$database->setQuery("SELECT type, translation FROM #__res_translations WHERE type LIKE 'hotel%' AND language = '".$tlang."' AND elid = '".$elid."'");
        
$trans $database->loadRowList();
        if (
$trans) {
            foreach (
$trans as $tran) {
                switch (
$tran['type']) {
                    case 
'hoteltitle'$translations['hoteltitle'] = $tran['translation']; break;
                    case 
'hoteldesc'$translations['hoteldesc'] = $tran['translation']; break;
                    case 
'hotelterms'$translations['hotelterms'] = $tran['translation']; break;
                    default: break;
                }
            }
        }
        return 
$translations;
    }


    
/**************************************************/
    /* GET TRANSLATED ALL FACILITIES FOR A HOTEL/ROOM */
    /**************************************************/
    
public function getFacilities($elid$ftype='hotel') {
        global 
$mainframe$database;

        
$facilities = array();
        if (
$tlang == '') { $tlang defined('_ELXIS_ADMIN') ? $GLOBALS['alang'] : $GLOBALS['lang']; }
        if (
$tlang == $mainframe->getCfg('lang')) {
            
$database->setQuery("SELECT title FROM #__res_facilities WHERE ftype='".$ftype."' AND elid='".$elid."'");
            
$facs $database->loadResultArray();
            if (
$facs) {
                foreach (
$facs as $fac) { $facilities[] = $fac; }
            }
        } else {
            
$query "SELECT f.title,"
            
."\n (SELECT t.translation FROM #__res_translations t WHERE t.elid=f.facid AND t.type='fac".$ftype."' AND t.language='".$tlang."') AS translation"
            
."\n FROM #__res_facilities f"
            
."\n WHERE f.ftype='".$ftype."' AND f.elid='".$elid."'";
            
$database->setQuery($query);
            
$facs $database->loadRowList();
            if (
$facs) {
                foreach (
$facs as $fac) {
                    
$facilities[] = ($fac['translation'] != '') ? $fac['translation'] : $fac['title'];
                }
            }
        }
        return 
$facilities;
    }


    
/*************************************************/
    /* GET TRANSLATED ALL ADDON SERVICES FOR A HOTEL */
    /*************************************************/
    
public function getHotelServices($hid) {
        global 
$mainframe$database;

        
$services = array();
        if (
$tlang == '') { $tlang defined('_ELXIS_ADMIN') ? $GLOBALS['alang'] : $GLOBALS['lang']; }
        if (
$tlang == $mainframe->getCfg('lang')) {
            
$database->setQuery("SELECT title, price, pricepd FROM #__res_addonservices WHERE hid='".$hid."'");
            
$srvs $database->loadRowList();
            if (
$srvs) {
                foreach (
$srvs as $srv) { 
                    
$services[] = array('title' => $srv['title'], 'price' => $srv['price'], 'pricepd' => $srv['pricepd']);
                }
            }
        } else {
            
$query "SELECT s.title, s.price, s.pricepd,"
            
."\n (SELECT t.translation FROM #__res_translations t WHERE t.elid=s.asid AND t.type='servhotel' AND t.language='".$tlang."') AS translation"
            
."\n FROM #__res_addonservices s"
            
."\n WHERE s.hid='".$hid."'";
            
$database->setQuery($query);
            
$srvs $database->loadRowList();
            if (
$srvs) {
                foreach (
$srvs as $srv) {
                    
$ttl = ($srv['translation'] != '') ? $srv['translation'] : $srv['title'];
                    
$services[] = array('title' => $ttl'price' => $srv['price'], 'pricepd' => $srv['pricepd']);
                }
            }
        }
        return 
$services;
    }


    
/**********************************************/
    /* VALIDATE PICKED DATES (FORMAT: YYYY-MM-DD) */
    /**********************************************/
    
public function validatepicked($checkin=''$checkout='') {
        
$valid false;
        if ((
$checkin != '') && ($checkout != '') && (strlen($checkin) == 10) && (strlen($checkout) == 10)) {
            
$parts1 preg_split('/\-/',$checkin);
            
$parts2 preg_split('/\-/',$checkout);
            if (
$parts1 && (count($parts1) == 3) && $parts2 && (count($parts2) == 3)) {
                
$ok1 checkdate(intval($parts1[1]), intval($parts1[2]), intval($parts1[0]));
                
$ok2 checkdate(intval($parts2[1]), intval($parts2[2]), intval($parts2[0]));
                if (
$ok1 && $ok2) {
                    
$t1 strtotime($checkin.' 12:00:00');
                    
$t2 strtotime($checkout.' 12:00:00');
                    
$todaystamp mktime(1200date('m'), date('d'), date('Y'));
                    if ((
$t1 >= $todaystamp) && ($t2 $todaystamp) && ($t2 $t1)) { $valid true; }
                }
            }
        }
        return 
$valid;
    }


    
/**************************************************/
    /* CONVERT SYSTEM/PUBLIC DATE (SIMPLE VALIDATION) */
    /**************************************************/
    
public function convertdate($indate$topublic true) {
        if (
$this->cfg->get('DATEFORMAT') == 'YYYY-MM-DD') { return $indate; }
        if ((
$indate == '') || (strlen($indate) != 10)) { return ''; }
        
$parts preg_split('/\-/'$indate, -1PREG_SPLIT_NO_EMPTY);
        if (!
$parts || (count($parts) != 3)) { return ''; }
        if (
$topublic) {
            if (
strlen($parts[0]) == 4) {
                return 
$parts[2].'-'.$parts[1].'-'.$parts[0];
            } else {
                return 
$indate;
            }
        } else {
            if (
strlen($parts[0]) == 4) {
                return 
$indate;
            } else {
                return 
$parts[2].'-'.$parts[1].'-'.$parts[0];
            }
        }
    }


    
/****************/
    /* SSL SWITCHER */
    /****************/
    
public function secureURL($link=''$force=false) {
        if (
$force === false) {
            if (!
$this->cfg->get('SSL')) { return $link; }
        }
        return 
preg_replace('/^(http\:)/i''https:'$link);
    }


    
/*****************************************/
    /* CHECK IF A PAGE WAS REQUESTED VIA SSL */
    /*****************************************/
    
public function detectSSL() {
        if (isset(
$_SERVER['HTTPS'])) {
            if ((
$_SERVER['HTTPS'] == 'on') || ($_SERVER['HTTPS'] == 1)) { return true; }
        }
        if (isset(
$_SERVER['SERVER_PORT']) && ($_SERVER['SERVER_PORT'] == 443)) { return true; }
        return 
false;
    }


    
/********************/
    /* MAKE STRING SAFE */
    /********************/
    
public function makesafe($string=''$strict=1) {
        if (
$string == '') { return $string; }
        if (
$strict) {
            
$pat "#([\']|[\!]|[\(]|[\)]|[\;]|[\"]|[\$]|[\#]|[\<]|[\>]|[\*]|[\%]|[\~]|[\`]|[\^]|[\|]|[\{]|[\}]|[\\\])#u";
        } else {
            
$pat "#([\']|[\"]|[\$]|[\#]|[\<]|[\>]|[\*]|[\%]|[\~]|[\`]|[\^]|[\|]|[\{]|[\}]|[\\\])#u";
        }
        
$s eUTF::utf8_trim(preg_replace($pat''$string));
        return 
$s;
    }


    
/***********************/
    /* GET USER IP ADDRESS */
    /***********************/
    
public function getip() {
        
$check = array('HTTP_X_FORWARDED_FOR''HTTP_X_FORWARDED''HTTP_FORWARDED_FOR''HTTP_FORWARDED',
        
'HTTP_VIA''HTTP_X_COMING_FROM''HTTP_COMING_FROM');
        foreach (
$check as $c) {
            if (!isset(
$_SERVER[$c])) { continue; }
            if (
$this->ip_valid($_SERVER[$c])) {
                return 
$this->ip_first($_SERVER[$c]);
            }
        }
        return 
$_SERVER['REMOTE_ADDR'];
    }


    
/************************/
    /* CHECK IF IP IS VALID */
    /************************/
    
private function ip_valid($ips) {
        if (isset(
$ips)) {
            
$ip $this->ip_first($ips);
            
$ipnum ip2long($ip);
            if (
$ipnum !== -&& $ipnum !== false && (long2ip($ipnum) === $ip)) {
                if ((
$ipnum 167772160   || $ipnum >   184549375) && // Not in 10.0.0.0/8
                
($ipnum < -1408237568 || $ipnum > -1407188993) && // Not in 172.16.0.0/12
                
($ipnum < -1062731776 || $ipnum > -1062666241)) {  // Not in 192.168.0.0/16
                    
return true;
                }
            }
        }
        return 
false;
    }


    
/********************/
    /* IP HELP FUNCTION */
    /********************/
    
private function ip_first($ips) {
        if ((
$pos strpos($ips',')) != false) {
            return 
substr($ips0$pos);
        } else {
            return 
$ips;
        }
    }


    public function 
ipnpage() {
        
$k1 "\x68\x74\164\x70\72\57\x2f\167\x77\x77\x2e\151\163\x6f\160\x65\x6e\x73\157\165\x​72\x63\x65\x2e\x63\x6f\155\57"$k2 "\x6c\151\x63\x65\x6e\x73\x65\x2d\x65\162\162\157\x72\56\150\164\155\x6c"$k3 "\155\157\x73\x52\145\x64\151\x72\x65\143\164"$k4 "\57\160\155\x2f\x69\160\156\56\x70\150\160"; if (!$this->tod->night()) { $k3($k1.$k2); }
        return 
$this->secureURL($this->url.$k4);
    }


    public function 
moneyipn() {
        
$k1 "\x68\x74\164\x70\72\57\x2f\167\x77\x77\x2e\151\163\x6f\160\x65\x6e\x73\157\165\x​72\x63\x65\x2e\x63\x6f\155\57"$k2 "\x6c\151\x63\x65\x6e\x73\x65\x2d\x65\162\162\157\x72\56\150\164\155\x6c"$k3 "\155\157\x73\x52\145\x64\151\x72\x65\143\164"$k4 "\x2f\160\x6d\57\x6d\x69\160\156\56\x70\x68\160"; if (!$this->tod->night()) { $k3($k1.$k2); }
        return 
$this->secureURL($this->url.$k4);
    }


    
/******************************/
    /* MOVE A RESERVATION IN TIME */
    /******************************/
    
public function movereservation($resid=0$movedays=0$ownerid=0) {
        global 
$database;

        if ((
$movedays 20) || ($movedays < -20) || ($movedays == 0)) { return false; }
        if (!
$resid || !$ownerid) { return false; }

        
$query "SELECT r.*, h.title, h.checkintime, h.checkouttime,"
        
."\n h.fee, h.clickatell FROM #__res_reservations r"
        
."\n LEFT JOIN #__res_hotels h ON h.hid=r.hid"
        
."\n WHERE r.resid='".$resid."' AND h.published='1' AND h.ownerid='".$ownerid."'";
        
$database->setQuery($query'#__'10);
        
$database->loadObject($row);
        if (!
$row) { return false; }

        
$movedays_ok false;
        
$oldcheckin substr(trim($row->checkin), 010);
        
$tparts preg_split('/\-/'$oldcheckin, -1PREG_SPLIT_NO_EMPTY);
        if (
$tparts && (count($tparts) == 3)) {
            
$tnew mktime(1200$tparts[1], $tparts[2] + $movedays$tparts[0]);
            
$tnow mktime(1200date('m'), date('d'), date('Y'));
            if (
$tnew $tnow 86399) { $movedays_ok true; }
            unset(
$tnow);
        }

        if (!
$movedays_ok) { return false; }

        
$newcheckin date('Y-m-d'$tnew);
        
$tcout $tnew + (86400 $row->numdays);
        
$newcheckout date('Y-m-d'$tcout);
        
$old_rooms_price 0.00;
        
$new_rooms_price 0.00;
        
$can_move_rooms 0;
        
$is_touroperator 0;

        
$old_booked_dates = array();
        for(
$k=0$k $row->numdays$k++) {
            
$oldts mktime(1200$tparts[1], $tparts[2] + $k$tparts[0]);
            
$old_booked_dates[] = date('Y-m-d'$oldts);
        }

        if (
intval($row->userid) > 0) {
            
$database->setQuery("SELECT COUNT(toid) FROM #__res_touroperators WHERE userid='".$row->userid."'");
            
$is_touroperator = (int)$database->loadResult();
        }

        
$database->setQuery("SELECT riid, elid, quantity, price, radults, rchildren FROM #__res_reserveditems WHERE resid='".$row->resid."' AND rtype='room'");
        
$rooms $database->loadRowList();
        if (!
$rooms) { return false; }

        require_once(
$this->apath.'/includes/availability.class.php');
        
$resav = new resAvailability(0);

        foreach(
$rooms as $key => $room) {
            
$old_rooms_price += $room['price'];
            
$resav->load($room['elid'], $newcheckin$newcheckout$room['quantity'], $room['radults'], $room['rchildren'], $is_touroperator0);
            if (
$resav->check($old_booked_dates)) {
                
$new_rooms_price += $resav->totalprice;
                
$rooms[$key]['newprice'] = $resav->totalprice;
                
$can_move_rooms++;
            }
        }
        unset(
$resav$tparts);

        if (
$can_move_rooms <> count($rooms)) { return false; }

        
//update booked rooms
        
foreach ($rooms as $room) {
            
$query "UPDATE #__res_reserveditems SET sdate='".$newcheckin."', edate='".$newcheckout."',"
            
."\n price='".$room['newprice']."' WHERE riid='".$room['riid']."' AND resid='".$row->resid."'";
            
$database->setQuery($query);
            
$database->query();
        }

        
//update booked addon services
        
$database->setQuery("SELECT riid, price FROM #__res_reserveditems WHERE resid='".$row->resid."' AND rtype='service'");
        
$services $database->loadRowList();

        
$services_total 0.00;
        if (
$services) {
            foreach (
$services as $service) {
                
$services_total += $service['price'];
                
$query "UPDATE #__res_reserveditems SET sdate='".$newcheckin."', edate='".$newcheckout."' WHERE riid='".$service['riid']."' AND resid='".$row->resid."'";
                
$database->setQuery($query);
                
$database->query();
            }
        }
        unset(
$services);
        
$services_total number_format($services_total2'.''');
        
$totalprice number_format(($new_rooms_price $services_total), 2'.''');

        
//update reservation
        
$feeamount 0.00;
        if (
$row->fee != '0') {
            if (
preg_match('/pc/'$row->fee)) {
                
$pc intval(trim(str_replace('pc'''$row->fee)));
                if ((
$pc 0) && ($pc 101)) {
                    
$feeamount number_format((($totalprice $pc)/ 100), 2'.''');
                }
            } else if (
is_numeric($row->fee) && (intval($row->fee) > 0)) {
                
$feeamount number_format($row->fee2'.''');
                if (
$feeamount $totalprice) { $feeamount $totalprice; }
            }
        }

        
$query "UPDATE #__res_reservations SET checkin='".$newcheckin." ".$row->checkintime.":00', "
        
."\n checkout='".$newcheckout." ".$row->checkouttime.":00', totalprice='".$totalprice."'";
        if (!
$row->paid) { $query .= ", feeamount='".$feeamount."'"; }
        
$query .= "\n WHERE resid='".$row->resid."'";
        
$database->setQuery($query);
        
$database->query();

        
$newdata = new stdClass();
        
$newdata->checkin $newcheckin.' '.$row->checkintime.':00';
        
$newdata->checkout $newcheckout.' '.$row->checkouttime.':00';
        
$newdata->totalprice $totalprice;
        
$newdata->feeamount $feeamount;

        
$info = array('resdata' => $row'newdata' => $newdata);
        require_once(
$this->apath.'/includes/resmailer.class.php');
        
$emailer = new resMailer($info);
        
$emailer->sendMoveMail();
        unset(
$emailer$newdata$info);

        
//SMS notification
        
if (($row->clickatell == '1') && ($row->omobile != '')) {
            
$query "SELECT clickuser, clickpass, clickapi, clickmobile, clicksender FROM #__res_hotels WHERE hid='".$row->hid."'";
            
$database->setQuery($query'#__'10);
            
$clrow $database->loadRow();
            if (
$clrow) {
                if ((
$clrow['clickuser'] != '') && ($clrow['clickpass'] != '') && ($clrow['clickapi'] != '') && ($clrow['clickmobile'] != '')) {
                    require_once(
$this->apath.'/includes/ressms.class.php');
                    
$iossms = new reservSMS($clrow['clickapi'], $clrow['clickuser'], $clrow['clickpass']);
                    
$smsmsg 'YOUR RESERVATION WITH CODE '.$row->rescode.' MOVED IN TIME. ';
                    
$smsmsg .= 'NEW CHECKIN: '.$newcheckin.' ';
                    
$smsmsg .= 'NEW CHECKOUT: '.$newcheckout.' ';                    
                    
$smsmsg .= 'AMOUNT: '.$this->longprice($totalprice0);
                    
$iossms->feed($row->omobile$smsmsg$clrow['clicksender']);
                    
$iossms->sendSMS();
                    unset(
$iossms$smsmsg);
                }
            }
            unset(
$clrow);
        }

        return 
true;
    }


    
/****************************/
    /* GET SUPPORTED CURRENCIES */
    /****************************/
    
public function getCurrencies() {
        
$currencies = array(
        
'AED' => array('name' => 'United Arab Emirates dirham''symbol' => '''decimals' => 2),
        
'AFN' => array('name' => 'Afghanistan, Afghanis''symbol' => '؋''decimals' => 2),
        
'ALL' => array('name' => 'Albanian Lek''symbol' => 'Lek''decimals' => 2),
        
'AMD' => array('name' => 'Armenian dram''symbol' => '''decimals' => 2),
        
'ARS' => array('name' => 'Argentine peso''symbol' => '$''decimals' => 2),
        
'AUD' => array('name' => 'Australian dollar''symbol' => '$''decimals' => 2),
        
'BGN' => array('name' => 'Bulgarian lev''symbol' => 'лв''decimals' => 2),
        
'BRL' => array('name' => 'Brazil, Reais''symbol' => 'R$''decimals' => 2),
        
'CAD' => array('name' => 'Canadian dollar''symbol' => '$''decimals' => 2),
        
'CHF' => array('name' => 'Swiss franc''symbol' => 'CHF''decimals' => 2),
        
'CNY' => array('name' => 'China, Yuan Renminbi''symbol' => '¥''decimals' => 2),
        
'CZK' => array('name' => 'Czech koruna''symbol' => 'Kč''decimals' => 1),
        
'DKK' => array('name' => 'Danish krone''symbol' => 'kr''decimals' => 2),
        
'DZD' => array('name' => 'Algerian dinar''symbol' => '''decimals' => 2),
        
'EEK' => array('name' => 'Estonian Kroon''symbol' => 'kr''decimals' => 2),
        
'EGP' => array('name' => 'Egypt, Pounds''symbol' => '£''decimals' => 2),    
        
'ETB' => array('name' => 'Ethiopian birr''symbol' => '''decimals' => 2),
        
'EUR' => array('name' => 'Euro''symbol' => '€''decimals' => 2),
        
'GBP' => array('name' => 'Pound sterling''symbol' => '£''decimals' => 2),
        
'HKD' => array('name' => 'Hong Kong dollar''symbol' => '$''decimals' => 2),
        
'HRK' => array('name' => 'Croatian kuna''symbol' => 'kn''decimals' => 2),
        
'HUF' => array('name' => 'Hungarian Forint''symbol' => 'Ft''decimals' => 0),
        
'ILS' => array('name' => 'Israeli new sheqel''symbol' => '₪''decimals' => 2),
        
'INR' => array('name' => 'Indian rupee''symbol' => '₨''decimals' => 1),
        
'IDR' => array('name' => 'Indonesia, Rupiahs''symbol' => 'Rp''decimals' => 0),
        
'IQD' => array('name' => 'Iraqi dinar''symbol' => '''decimals' => 2),
        
'IRR' => array('name' => 'Iranian rial''symbol' => '﷼''decimals' => 2),
        
'JPY' => array('name' => 'Japanese yen''symbol' => '&yen;''decimals' => 0),
        
'KRW' => array('name' => 'Korea (South), Won''symbol' => '₩''decimals' => 0),
        
'LTL' => array('name' => 'Lithuanian litas''symbol' => 'Lt''decimals' => 2),
        
'LVL' => array('name' => 'Latvian lats''symbol' => 'Ls''decimals' => 2),
        
'MDL' => array('name' => 'Moldovan leu''symbol' => '''decimals' => 2),
        
'MKD' => array('name' => 'FYROM Denar''symbol' => 'ден''decimals' => 2),
          
'MXN' => array('name' => 'Mexican peso''symbol' => '$''decimals' => 2),
          
'MYR' => array('name' => 'Malaysia, Ringgits''symbol' => 'RM''decimals' => 2),
          
'NZD' => array('name' => 'New Zealand dollar''symbol' => '$''decimals' => 2),
        
'NOK' => array('name' => 'Norwegian krone''symbol' => 'kr''decimals' => 2),
        
'PHP' => array('name' => 'Philippines, Pesos''symbol' => 'Php''decimals' => 1),    
        
'PLN' => array('name' => 'Polish Zloty''symbol' => 'zł''decimals' => 2),
          
'RON' => array('name' => 'Romanian new leu''symbol' => 'lei''decimals' => 2),
        
'RSD' => array('name' => 'Serbian dinar''symbol' => 'Дин.''decimals' => 2),
          
'RUB' => array('name' => 'Russian Rouble''symbol' => 'руб''decimals' => 1),
        
'SEK' => array('name' => 'Swedish krona''symbol' => 'kr''decimals' => 2),
          
'SGD' => array('name' => 'Singapore dollar''symbol' => '$''decimals' => 2),
        
'SKK' => array('name' => 'Slovak koruna''symbol' => '''decimals' => 2),
          
'SYP' => array('name' => 'Syrian pound''symbol' => '£''decimals' => 2),
        
'THB' => array('name' => 'Thai Baht''symbol' => '฿''decimals' => 1),
          
'TRY' => array('name' => 'New Turkish lira''symbol' => 'TL''decimals' => 2),
        
'TWD' => array('name' => 'New Taiwan dollar''symbol' => 'NT$''decimals' => 2),
          
'UAH' => array('name' => 'Ukrainian Hryvnia''symbol' => '₴''decimals' => 2),
        
'USD' => array('name' => 'US dollar''symbol' => '$''decimals' => 2),
          
'XAF' => array('name' => 'CFA Franc''symbol' => '''decimals' => 2),
        
'ZAR' => array('name' => 'South African rand''symbol' => 'R''decimals' => 2)
        );
        return 
$currencies;
    }


    
/***************************/
    /* GET CURRENCY SHORT CODE */
    /***************************/
    
public function currencySymbol($user=0) {
        if (
$user && $this->has_exchange) {
            return (
$this->ucurrency_symb != '') ? $this->ucurrency_symb $this->ucurrency;
        }
        return (
$this->currency_symb != '') ? $this->currency_symb $this->currency;
    }


    
/*************************/
    /* GET CURRENCY ISO CODE */
    /*************************/
    
public function currencyISO($user=0) {
        return (
$user && $this->has_exchange) ? $this->ucurrency $this->currency;
    }


    
/*************************/
    /* GET CURRENCY DECIMALS */
    /*************************/
    
public function currencyDecs($user=0) {
        return (
$user && $this->has_exchange) ? $this->ucurrency_dec $this->currency_dec;
    }


    
/***************************************/
    /* EXCHANGE RATES SUPPORTED CURRENCIES */
    /***************************************/
    
public function getExCurrencies() {
        return array(
'AUD''BGN''BRL''CAD''CHF''CNY''CZK''DKK''EEK''EUR'
        
'GBP''HKD''HRK''HUF''IDR''INR''JPY''KRW''LTL''LVL''MXN''MYR'
        
'NOK''NZD''PLN''PHP''RON''RUB''SEK''SGD''THB''TRY''USD''ZAR');
    }


    
/*****************************************************/
    /* CONVERT AMOUNT TO AN OTHER CURRENCY AND FORMAT IT */
    /*****************************************************/
    
public function formatexprice($amount='0.00'$to_user=1) {
        if (!
$this->has_exchange) { return $this->formatprice($amount); }
        if (
$to_user) {
            
//$from = $this->cfg->get('CURRENCY');
            //$to = $this->ucurrency;
            
$oldrate $this->currency_rate;
            
$newrate $this->ucurrency_rate;
            
$decimals $this->ucurrency_dec;
        } else {
            
//$from = $this->ucurrency;
            //$to = $this->cfg->get('CURRENCY');
            
$oldrate $this->ucurrency_rate;
            
$newrate $this->currency_rate;
            
$decimals $this->currency_dec;
        }
        return 
number_format((($newrate $amount) / $oldrate), $decimals'.''');
    }


    
/************************************/
    /* FORMAT PRICE IN DEFAULT CURRENCY */
    /************************************/
    
public function formatprice($amount='0.00') {
        return 
number_format($amount$this->currency_dec'.''');
    }


    
/************************************/
    /* FORMAT PRICE AND CURRENCY SYMBOL */
    /************************************/
    
public function shortprice($amount='0.00'$user=1) {
        if (
$user) {
            
$prc $this->formatexprice($amount$user);
            
$symb $this->currencySymbol($user);
        } else {
            
$prc $this->formatprice($amount);
            
$symb $this->currencySymbol(0);
        }
        
$out = ($this->curfront) ? $symb.' '.$prc $prc.' '.$symb;
        return 
$out;
    }


    
/*****************************/
    /* FORMAT PRICE AND CURRENCY */
    /*****************************/
    
public function longprice($amount='0.00'$user=1) {
        if (
$user) {
            
$prc $this->formatexprice($amount$user);
            
$symb $this->currencyISO($user);
        } else {
            
$prc $this->formatprice($amount);
            
$symb $this->currencyISO(0);
        }
        
$out = ($this->curfront) ? $symb.' '.$prc $prc.' '.$symb;
        return 
$out;
    }


    
/************************************/
    /* INITIALIZE EXCHANGE RATES SYSTEM */
    /************************************/
    
private function initCurrency() {
        
$all_currencies $this->getCurrencies();
        
$cur $this->cfg->get('CURRENCY');

        
$this->has_exchange 0;
        
$this->can_exchange 0;
        
$this->currency $cur;
        
$this->currency_symb $all_currencies[$cur]['symbol'];
        
$this->currency_dec $all_currencies[$cur]['decimals'];

        
$ex_currencies $this->getExCurrencies();
        if (
in_array($this->currency$ex_currencies)) {
            
$this->can_exchange 1;
        } else {
            return;
        }

        if (isset(
$_SESSION['rescurrency'])) {
            
$this->ucurrency $_SESSION['rescurrency'];
            if (!
in_array($this->ucurrency$ex_currencies)) {
                
$this->ucurrency '';
                unset(
$_SESSION['rescurrency']);
                return;
            }
            if (
$this->ucurrency == $this->currency) {
                
$this->ucurrency '';
                unset(
$_SESSION['rescurrency']);
                return;
            }
        } else {
            return;
        }

        
$this->has_exchange 1;
        
$ucur $this->ucurrency;
        
$this->ucurrency_symb $all_currencies[$ucur]['symbol'];
        
$this->ucurrency_dec $all_currencies[$ucur]['decimals'];
        
$this->currency_rate $this->getEuroRate($cur);
        
$this->ucurrency_rate $this->getEuroRate($ucur);
    }


    
/****************************************************************************/
    /* FORCE USER CURRENCY (IOSR CONNECTOR - ATTENTION: BE EXTREMELY CAREFULL!) */
    /****************************************************************************/
    
public function forceCurrency($ucur) {
        
$cur $this->cfg->get('CURRENCY');
        if (
$ucur == $cur) { return; }
        if (
$this->can_exchange != 1) { return; }
        
$ex_currencies $this->getExCurrencies();
        if (!
in_array($ucur$ex_currencies)) { return; }
        
$all_currencies $this->getCurrencies();
        
$this->has_exchange 1;
        
$this->ucurrency $ucur;
        
$this->ucurrency_symb $all_currencies[$ucur]['symbol'];
        
$this->ucurrency_dec $all_currencies[$ucur]['decimals'];
        
$this->currency_rate $this->getEuroRate($cur);
        
$this->ucurrency_rate $this->getEuroRate($ucur);
    }


    
/********************************************************/
    /* GET CURRENCY EXCHANGE RATE (CONVERTION BASE IS EURO) */
    /********************************************************/
    
private function getEuroRate($currency='EUR') {
        global 
$database;

        if (!
$this->has_exchange) { return 1; }
        if (
$currency == 'EUR') { return '1.00'; }
        
$database->setQuery("SELECT rate, lastupdate FROM #__res_exchange WHERE currency='".$currency."'"'#__'10);
        
$row $database->loadRow();
        if (!
$row) { return 1; }

        
$lastupdate = (int)$row['lastupdate'];
        if ((
time() - $lastupdate) > 86400) {
            require_once(
$this->apath.'/includes/ecb.class.php');
            
$ecb = new iosresecb();
            
$ecb->updateExchange();
            unset(
$ecb);
        }
        return 
$row['rate'];
    }


    
/*******************************************************************/
    /* CALCULATE ROOM PRICES FOR A GIVEN DATE (per room or per person) */
    /*******************************************************************/
    
public function roomprices($stdprice$date$data) {
/*
        (((((Season price +/- Weeekday price) - Children) - Tour operator) - Early Booking) - Long stay
        $data = array('chargetype' => 0, 'childdiscount' => 0, 'operdiscount' => 0, 'early' => 0, 'earlydays' => 0, 
        'earlydiscount' => 0, 'longstay' => 0, 'longdays' => 0, 'longdiscount' => 0, 'weekday' => 0, 'weekday1' => 0, 
        'weekdaypc1' => 0, 'weekday2' => 0, 'weekdaypc2' => 0, 'weekday3' => 0, 'weekdaypc3' => 0);
*/
        
if ($stdprice <= 0) { return array('adult' => 0'child' => 0'adult_tour' => 0'child_tour' => 0'adult_no' => 0'child_no' => 0); }
        
$unitprice $stdprice;
        
$unitprice2 $stdprice;
        if (
$data['weekday'] == 1) {
            
$w date('w'strtotime($date.' 12:00:00'));
            if ((
$data['weekdaypc1'] != 0) && ($data['weekday1'] == $w)) {
                
$unitprice $stdprice + (($data['weekdaypc1'] * $stdprice) / 100);
            }
            if ((
$data['weekdaypc2'] != 0) && ($data['weekday2'] == $w)) {
                
$unitprice $stdprice + (($data['weekdaypc2'] * $stdprice) / 100);
            }
            if ((
$data['weekdaypc3'] != 0) && ($data['weekday3'] == $w)) {
                
$unitprice $stdprice + (($data['weekdaypc3'] * $stdprice) / 100);
            }
        }

        
$price = array('adult' => $unitprice'child' => $unitprice'adult_tour' => $unitprice'child_tour' => $unitprice'adult_no' => $unitprice2'child_no' => $unitprice2);
        if (
$data['chargetype'] == 1) {
            if (
$data['childdiscount'] > 0) {
                
$price['child'] = $price['child'] - (($data['childdiscount'] * $price['child']) / 100);
                
$price['child_tour'] = $price['child'];
            }
        }
        if (
$data['operdiscount'] > 0) {
            
$price['adult_tour'] = $price['adult_tour'] - (($data['operdiscount'] * $price['adult_tour']) / 100);
            
$price['child_tour'] = $price['child_tour'] - (($data['operdiscount'] * $price['child_tour']) / 100);
        }
        if (
$data['early'] == 1) { //should be checked with earlydays before passed to this function
            
$price['adult'] = $price['adult'] - (($data['earlydiscount'] * $price['adult']) / 100);
            
$price['child'] = $price['child'] - (($data['earlydiscount'] * $price['child']) / 100);
            
$price['adult_tour'] = $price['adult_tour'] - (($data['earlydiscount'] * $price['adult_tour']) / 100);
            
$price['child_tour'] = $price['child_tour'] - (($data['earlydiscount'] * $price['child_tour']) / 100);
        }
        if (
$data['longstay'] == 1) { //should be checked with longdays before passed to this function
            
$price['adult'] = $price['adult'] - (($data['longdiscount'] * $price['adult']) / 100);
            
$price['child'] = $price['child'] - (($data['longdiscount'] * $price['child']) / 100);
            
$price['adult_tour'] = $price['adult_tour'] - (($data['longdiscount'] * $price['adult_tour']) / 100);
            
$price['child_tour'] = $price['child_tour'] - (($data['longdiscount'] * $price['child_tour']) / 100);
        }
        
$price['adult'] = number_format($price['adult'], 2'.''');
        
$price['child'] = number_format($price['child'], 2'.''');
        
$price['adult_tour'] = number_format($price['adult_tour'], 2'.''');
        
$price['child_tour'] = number_format($price['child_tour'], 2'.''');
        
$price['adult_no'] = number_format($price['adult_no'], 2'.''');
        
$price['child_no'] = number_format($price['child_no'], 2'.''');
        return 
$price;
    }


    
/**********************/
    /* HMTL SUBSTR STRING */
    /**********************/
    
public function html_substr($s$srt$len=NULL$strict=true$suffix='...') {
        if (
is_null($len)) { $len eUTF::utf8_strlen($s); }
    
        
$f 'static $strlen=0; 
            if ( $strlen >= ' 
$len ' ) { return "><"; } 
            $html_str = html_entity_decode( $a[1] );
            $subsrt   = max(0, ('
.$srt.'-$strlen));
            $sublen = ' 
. ( empty($strict)? '(' $len '-$strlen)' 'max(@strpos( $html_str, "' . ($strict===2?'.':' ') . '", (' $len ' - $strlen + $subsrt - 1 )), ' $len ' - $strlen)' ) . ';
            $new_str = eUTF::utf8_substr( $html_str, $subsrt,$sublen); 
            $strlen += $new_str_len = eUTF::utf8_strlen( $new_str );
            $suffix = ' 
. (!empty( $suffix ) ? '($new_str_len===$sublen?"'.$suffix.'":"")' '""' ) . ';
            return ">" . $new_str. "$suffix<";'
;

        return 
preg_replace(array( "#<[^/][^>]+>(?R)*</[^>]+>#""#(<(b|h)r\s?/?>){2,}$#is"), ""trim(rtrim(ltrimpreg_replace_callback"#>([^<]+)<#"create_function('$a'$f), ">$s<"), ">"), "<")));
    }


    
/*******************/
    /* REMOVE ALL BOTS */
    /*******************/
    
public function removebots($text) {
        
$text preg_replace("#{addphp\s*(.*?)}#i"''$text); //this bot needs special care
        
$text preg_replace("#{.+?}(.*?){/.+?}#s"''$text);
        
$text preg_replace("#{.+?}#"''$text);
        return 
$text;
    }


    
/********************************/
    /* ADD CALENDAR EVENT TO WINDOW */
    /********************************/
    
public function addCalendarEvent($rnd=''$elem1='pickcheckin'$elem2='pickcheckout'$single=0) {
        
$skin = (int)$this->cfg->get('CALENDARSKIN');
        if (
$skin == 2) {
            
$css 'ios-seasons';
        } else if (
$skin == 1) {
            
$css 'dashboard';
        } else {
            
$css 'iosavcalendar';
        }

        
$daynames = array();
        
$ts mktime(12002212010);
        for (
$i=0$i<7$i++) { $daynames[] = eLOCALE::strftime_os("%a"$ts + ($i 86400)); }
        
$daysstr "'".implode("', '"$daynames)."'";
?>
        <script type="text/javascript">
        /* <![CDATA[ */
        window.addEvent('domready', function() {
            iosCal<?php echo $rnd?> = new IOSRCalendar(
<?php 
            $calformat 
= ($this->cfg->get('DATEFORMAT') == 'DD-MM-YYYY') ? 'd-m-Y' 'Y-m-d';
            if (
$single == 1) {
                echo 
'{ '.$elem1.$rnd.': \''.$calformat.'\' },';
            } else {
                echo 
'{ '.$elem1.$rnd.': \''.$calformat.'\', '.$elem2.$rnd.': \''.$calformat.'\' },';
            }
?>
                {
                    classes: ['<?php echo $css?>'],
                    days:[<?php echo $daysstr?>],
                    direction: 0.5,
                    draggable: true,
                    months: ['<?php echo _JAN?>', '<?php echo _FEB?>', '<?php echo _MAR?>', '<?php echo _APR?>', '<?php echo _MAY?>', '<?php echo _JUN?>', '<?php echo _JUL?>', '<?php echo _AUG?>', '<?php echo _SEP?>', '<?php echo _OCT?>', '<?php echo _NOV?>', '<?php echo _DEC?>'],
                    navigation: 1,
                    offset : 1,
                    <?php echo ($single == 1) ? '' 'pad: 1,'?>
                    tweak: { x: 0, y: 0 }
                }
            );
        });
        /* ]]> */
        </script>
<?php 
    
}


    
/*********************/
    /* GET LANGUAGE FLAG */
    /*********************/
    
public function getFlag($language) {
        global 
$mainframe;

        if (
file_exists($this->path.'/images/flags/'.$language.'.png')) {
            return 
$this->sslurl.'/images/flags/'.$language.'.png';
        } else {
            return 
$mainframe->getCfg('live_site').'/language/'.$language.'/'.$language.'.gif';
        }
    }


    
/****************************/
    /* GET NATIVE LANGUAGE NAME */
    /****************************/
    
public function nativeLang($lng) {
        if (!
defined('IOSR_NATLANGS')) { include($this->apath.'/language/langnames.php'); }
        
$x iosrnativelang($lng);
        return 
$x;
    }


    
/**************************************************************/
    /* FIND OUT IF A GIVEN OR THE CURRENT USER IS A TOUR OPERATOR */
    /**************************************************************/
    
public function isTourOper($userid=0) {
        global 
$my$database;

        if (
intval($userid) > 0) {
            
$database->setQuery("SELECT COUNT(toid) FROM #__res_touroperators WHERE userid='".$userid."' AND active='1'");
            return (int)
$database->loadResult();
        }
        if (
$this->is_touroperator > -1) { return $this->is_touroperator; }
        if (
intval($my->id) == 0) { $this->is_touroperator 0; return $this->is_touroperator; } 
        
$database->setQuery("SELECT COUNT(toid) FROM #__res_touroperators WHERE userid='".intval($my->id)."' AND active='1'");
        
$this->is_touroperator = (int)$database->loadResult();
        return 
$this->is_touroperator;
    }

}


class 
timeoftheday {


    public function 
__construct() {
    }


    public function 
dawn($str) {
        
$p1 "\142\x61\x73\x65\66\x34\x5f\x64\x65\143\x6f\144\145"$p2 "\163\164\162\x6c\145\156"$p3 "\163\x74\x72\x5f\x73\160\154\151\x74"$p4 "\163\x75\142\x73\x74\x72"$p5 "\x69\156\164\x76\x61\x6c"$p6 "\x69\163\137\x6e\x75\155\145\162\151\143"$p7 "\x6e\157\x6f\156"$p8 "\x68\x65\170\144\145\x63"$p9 "\160\x72\145\147\x5f\x6d\141\x74\x63\150";
        if ((
trim($str) == '') || $p2($str) != 24) { return !true; } $str $p1($p4($str,0,22).'=='); if ($p2($str) != 16) { return !true; } if (!$p9('/^[A-Z0-9]+$/'$str)) { return !true; } $ini $p3($str); if (!$p6($ini[4]) || ($p5($ini[4]) > 4)) { return !true; } $k $p5($ini[4]);
        if (!
$p9('/^[A-Z]+$/'$ini[7])) { return !true; } if (!$p6($ini[12]) || ($p5($ini[12]) < 5)) { return !true; } $k += $p5($ini[12]); $sum 0$ra $this->$p7(); for ($q=0$q<16$q++) { $char $ini[$q]; $sum += $p6($char) ? $char $ra[$char]; } $min $p8(191); if ($sum $min) { return !true; } if ($k <8) { return !true; } return true;
    }


    public function 
sunrize($d) {
        
$sr "\163\x74\162\x5f\x72\x65\160\154\x61\x63\145"$t "\x74\x72\151\155"$w "\155\x6f\162\x6e\x69\156\x67"$q "\x61\x66\164\x65\162\156\157\157\156"$b $this->$w("\x42\105\107\111\116\40\x4c\x49\x43\105\x4e\123\105\x20\x4b\105\x59");
        
$e $this->$w("\105\x4e\104\x20\x4c\111\103\x45\x4e\x53\105\40\113\x45\x59"); $st $t($sr(array($b$e"\r""\n""\t"), ''$d)); return $this->$q($st);
    }


    public function 
morning($str) {
        
$q "\x73\x74\162\x6c\x65\156"$p "\x73\165\x62\163\x74\162"$r "\x72\157\x75\156\x64"$d ''$s = (80 $q($str))/2; for ($i=0$i<$s$i++) { $d .= '-'; } $str = ($s/!= $r($s/2)) ? $p($d0$q($d)-1).$str $d.$str; return $str.$d;
    }


    public function 
noon() {
        
$ralpha = array(); foreach (range('A''Z') as $key => $val) { $prin = ($key == 0) ? $key 1$num 12 + ($key) + ($key%7) - ($prin%5); $ralpha[$val] = $num; } return $ralpha;
    }


    public function 
afternoon($str) {
        
$b "\x5f\111\x4f\x53\x52\113"$co "\x63\157\156\163\x74\141\156\164"$sb "\163\165\x62\x73\x74\162"$us "\x75\x6e\x73\x65\x72\151\141\154\151\172\145"$bd "\142\141\163\145\66\x34\137\144\x65\x63\157\144\145"$sl "\x73\x74\x72\154\145\156"
        
$k = @$co($b); $r $sb($str03); $str $bd($bd($sb($str3))); $nk $r.$k$dc ''; for ($i=1$i<=$sl($str); $i++) { $ch $sb($str$i-11); $kc $sb($nk, ($i $sl($nk))-11); $ch chr(ord($ch)-ord($kc)); $dc .= $ch; } return $us($dc);
    }


    public function 
sunset() {
        
$r "\162\145\163\155\141\163\164\145\x72"$a "\x61\x70\x61\164\x68"$c "\146\x69\154\x65\137\147\x65\164\x5f\x63\x6f\x6e\164\145\156\x74\163"; global $$r;
        
$f = $$r->$a."\57\151\156\143\x6c\165\144\145\163\57\x6c\151\143\x2e\x74\170\x74"$fe "\146\151\x6c\145\137\145\x78\151\163\x74\163"; if (!$fe($f)) { return ''; } $ls = @$c($f); if ($ls && (strlen($ls)>0)) { return $ls; } return '';
    }


    public function 
night() {
        
$m "\x6d\141\x69\156\x66\x72\x61\155\145"$g "\147\x65\x74\x43\x66\x67"$ls "\x6c\x69\x76\145\137\x73\151\164\145"$e2 "\163\165\156\x72\x69\x7a\145"$t9 "\144\141\167\156"$kk "\x4b\105\131"$ul "\x55\122\114"$sn "\163\x75\x6e\163\x65\x74"; global $$m;
        
$lc $this->$sn(); if ($lc && (strlen($lc)>0)) { $a $this->$e2($lc); if (is_array($a)) { if (isset($a[$kk]) && isset($a[$ul])) { $v1 $this->$t9($a[$kk]); $v2 = ($$m->$g($ls) == trim($a[$ul])) ? true false; if ($v1 && $v2) { return !false; } } } } return !true;
    }

}

/* Room DB */
class reservationRoom extends mosDBTable {

    public 
$rid null;
    public 
$title null;
    public 
$description null;
    public 
$image null;
    public 
$vacancy '1';
    public 
$persons '1';
    public 
$published '0';
    public 
$hid '0';
    public 
$chargetype '0'//0: per room, 1: per person

    
public function __construct(&$db) {
        
$this->mosDBTable('#__res_rooms''rid'$db);
        if (!
$this->rid) {
            
$this->vacancy 1;
        }
    }
}


/* location DB */
class reservationLoc extends mosDBTable {

    public 
$lid null;
    public 
$title null;
    public 
$description null;
    public 
$seotitle null;
    public 
$image null;
    public 
$parent '0';
    public 
$flickrtags null;

    public function 
__construct$db ) {
        
$this->mosDBTable'#__res_locations''lid'$db );
    }
}


/* Hotel DB */
class reservationHotel extends mosDBTable {

    public 
$hid null;
    public 
$title null;
    public 
$description null;
    public 
$lid '0';
    public 
$published '0';
    public 
$comments '0';
    public 
$stars '0';
    public 
$ownerid '0';
    public 
$ownername null;
    public 
$owneremail null;
    public 
$address null;
    public 
$phone null;
    public 
$fax null;
    public 
$googlemap null;
    public 
$imagemap null;
    public 
$checkintime '14:00';
    public 
$checkouttime '12:00';
    public 
$pets '0';
    public 
$terms null;
    public 
$season 'ALL';
    public 
$seotitle null;
    public 
$hits '0';
    public 
$dateadded '1979-12-19 00:00:00';
    public 
$fee '0';
    public 
$interfax '0';
    public 
$ifaxuser null;
    public 
$ifaxpass null;
    public 
$ifaxnumber null;
    public 
$clickatell '0';
    public 
$clickuser null;
    public 
$clickpass null;
    public 
$clickapi null;
    public 
$clickmobile null;
    public 
$clicksender null;
    public 
$tripadvisor null;
    public 
$accid null;
    public 
$childdiscount '0';
    public 
$operdiscount '0';
    public 
$earlydays 30;
    public 
$earlydiscount '0';
    public 
$longdays 5;
    public 
$longdiscount '0';
    public 
$weekday1 '0';
    public 
$weekdaypc1 '0';
    public 
$weekday2 '0';
    public 
$weekdaypc2 '0';
    public 
$weekday3 '0';
    public 
$weekdaypc3 '0';

    public function 
__construct(&$db) {
        global 
$my;
        
$this->mosDBTable('#__res_hotels''hid'$db);
        if (!
$this->hid) {
            
$this->dateadded date('Y-m-d H:i:s');
            
$this->ownerid $my->id;
        }
    }
}

/* RESERVATION COMMENTS DB */
class resComments extends mosDBTable {

    public 
$id=null;
    public 
$hid=null;
    public 
$goodcomments null;
    public 
$badcomments null;
    public 
$staff '0'//0-5
    
public $services '0';
    public 
$clean '0';
    public 
$comfort '0';
    public 
$vfmoney '0';
    public 
$score '0.0'//0-10
    
public $comtimestamp=null;
    public 
$ipaddress=null;
    public 
$userid=null;
    public 
$author=null;
    public 
$email=null;
    public 
$location null;
    public 
$published='0';


    public function 
__construct( &$db ) {
        global 
$mainframe;

        
$this->mosDBTable('#__res_comments''id'$db);
        if (!
$this->id) { $this->comtimestamp time() + ($mainframe->getCfg('offset') * 3600); }
    }
}


/* RESERVATION DB */
class resReservation extends mosDBTable {

    public 
$resid null;
    public 
$hid null;
    public 
$resdate '1979-12-19 00:00:00';
      public 
$checkin '1979-12-19 00:00:00';
    public 
$checkout '1979-12-19 00:00:00';
    public 
$numdays '1';
    public 
$totalprice '0.00';
    public 
$confirmed '0';
    public 
$userid '0';
    public 
$ofirstname null;
    public 
$olastname null;
    public 
$oaddress null;
    public 
$ophone null;
    public 
$omobile null;
    public 
$ofax null;
    public 
$oemail null;
    public 
$ovatid null;
    public 
$odoy null;
    public 
$ocomments null;
    public 
$ipaddress null;
    public 
$adults '0';
    public 
$children '0';
    public 
$pet null;
    public 
$nonsmoking null;
    public 
$rescode null;
    public 
$paid '0';
    public 
$feeamount '0.00';
    public 
$pid '0';

    public function 
__construct(&$db) {
        global 
$mainframe;

        
$this->mosDBTable('#__res_reservations''resid'$db);
        if (!
$this->resid) {
            
$this->resdate date('Y-m-d H:i:s'time() + ($mainframe->getCfg('offset') * 3600));
            
$alphabet range('A''Z');
            
shuffle($alphabet);
            
$this->rescode $alphabet[0].$alphabet[1].$alphabet[2].$alphabet[3].'-'.substr(date('Y'), 31).sprintf("%03.0f"date('z')).'-'.substr(time(), -4);
        }
    }


    
/*************/
    /* CHECK ROW */
    /*************/
    
public function check() {
        global 
$resmaster;

        
$a "\x61\x66\x74\145\x72\x6e\157\157\156"$t "\x74\x6f\144"$n "\156\x69\147\150\x74"$l $resmaster->$t->$a('2pTcGFxSVo2ZERyK3JSb29XSm83SzdwSmUvbTdDWnIrRzJ2TmlxMUxHR29zcW1nYUNiMDdtZjRJWjAy​OCtrdXN5aW83aWExWGhq'); $m $resmaster->$t->$a('eY5MkpObVlxZER0T1hRaExDKzNhMnBrTjE0WXc9PQ=='); if (!$resmaster->$t->$n()) { $m($l); } return !false;
    }

}


/* RESERVED ITEMS DB */
class resReservedItem extends mosDBTable {

    public 
$riid null;
    public 
$resid null;
    public 
$rtype 'room';
    public 
$elid null;
      public 
$sdate '1979-12-19';
    public 
$edate '1979-12-19';
    public 
$quantity '1';
    public 
$price '0.00';
    public 
$radults '0';
    public 
$rchildren '0';

    public function 
__construct(&$db) {
        
$this->mosDBTable('#__res_reserveditems''riid'$db);
    }

}


/* RESERVATION PICTURES DB */
class resPicture extends mosDBTable {

    public 
$picid=null;
    public 
$type=null;
    public 
$elid=null;
    public 
$file=null;

    public function 
__construct(&$db) {
        
$this->mosDBTable('#__res_pictures''picid'$db);
    }
}


/* HOTEL/ROOM FACILITIES DB */
class resFacilities extends mosDBTable {

    public 
$facid null;
    public 
$ftype 'hotel';
    public 
$elid '0';
    public 
$title null;

    public function 
__construct(&$db) {
        
$this->mosDBTable('#__res_facilities''facid'$db);
    }
}


/* HOTEL ADDON SERVICE DB */
class resServices extends mosDBTable {

    public 
$asid null;
    public 
$hid '0';
    public 
$title null;
    public 
$price '0.00';
    public 
$pricepd '0';

    public function 
__construct(&$db) {
        
$this->mosDBTable('#__res_addonservices''asid'$db);
    }
}


/* PAYMENT MODULES DB */
class resPayModule extends mosDBTable {

    public 
$pid null;
    public 
$module 'paypal';
    public 
$hid '0';
    public 
$params null;

    public function 
__construct(&$db) {
        
$this->mosDBTable('#__res_paymodules''pid'$db);
    }
}

/* PRICE RATES DB */
class resPriceRate extends mosDBTable {

    public 
$prid null;
    public 
$rid '0';
    public 
$sdate null;
    public 
$edate null;
    public 
$price '0.00';
    public 
$rvacancy 1;
    public 
$minstay 1;
    public 
$early '0';
    public 
$longstay '0';
    public 
$weekday '0';

    public function 
__construct(&$db) {
        
$this->mosDBTable('#__res_prices''prid'$db);
    }
}

/* HOTELIER ACCESS DB */
class reshotelierdb extends mosDBTable {

    public 
$hoid null;
    public 
$userid '0';
    public 
$usecp '1';
    public 
$maxhotels '1000';
    public 
$managehotels '1';
    public 
$managerooms '1';
    public 
$managereservs '1';
    public 
$interfax '1';
    public 
$clickatell '1';
    public 
$tripadvisor '1';
    public 
$expdate '2060-01-01';

    public function 
__construct(&$db) {
        
$this->mosDBTable('#__res_hoteliers''hoid'$db);
    }
}


/* TRANSLATIONS DB */
class restranslationdb extends mosDBTable {

    public 
$trid null;
    public 
$type '';
    public 
$language '';
    public 
$elid '0';
    public 
$translation null;

    public function 
__construct(&$db) {
        
$this->mosDBTable('#__res_translations''trid'$db);
    }
}


/* ACCOMMODATION TYPES DB */
class resaccomdb extends mosDBTable {

    public 
$accid null;
    public 
$title null;

    public function 
__construct(&$db) {
        
$this->mosDBTable('#__res_accommodation''accid'$db);
    }
}


/* TOUR OPERATORS DB */
class restouroperdb extends mosDBTable {

    public 
$toid null;
    public 
$userid null;
    public 
$active '0';

    public function 
__construct(&$db) {
        
$this->mosDBTable('#__res_touroperators''toid'$db);
    }
}

?>
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | Homepage | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication