function store($data) { $config =& AFactory::getConfig(); $id = (int) $data['id']; $this->_table->init(); $this->_table->load($id); if (!$this->_table->bind($data)) { $this->setError($this->_db->getErrorMsg()); return false; } unset($data['id']); if (!$this->_table->check()) { $this->setError($this->_db->getErrorMsg()); return false; } if (!$this->_table->store()) { $this->setError($this->_db->getErrorMsg()); return false; } return $this->_table->id; }
/** * @package Bookpro * @author Ngo Van Quan * @link http://joombooking.com * @copyright Copyright (C) 2011 - 2012 Ngo Van Quan * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html * @version $Id: flight.php 105 2012-08-30 13:20:09Z quannv $ **/ defined('_JEXEC') or die('Restricted access'); AImporter::model('bustrips', 'bustrip', 'passengers'); AImporter::helper('date'); $passModel = new BookProModelPassengers(); $lists = array('order_id' => $this->order->id); $passModel->init($lists); $passengers = $passModel->getData(); $config = AFactory::getConfig(); ?> <fieldset class="adminform"> <legend> <?php echo JText::_('Trip Information'); ?> </legend> <table class="table"> <thead> <tr> <th width="20%"><?php echo JText::_('COM_BOOKPRO_ORDER_FROM');
public function CheckKey($hostname = false) { /* Let's check if there is no period in the hostname, if so, no need to check further */ $config = AFactory::getConfig(); if (stripos($hostname, '.') !== false) { /* Clean up the hostname */ $pos = strpos($hostname, '/'); if ($pos) { $hostname = substr($hostname, 0, $pos); } /* See how many parts the domain name consists of */ $hostparts = explode('.', $hostname); $hostcount = count($hostparts); if ($hostcount > 1) { /* The last part contains any subfolders, lets drop those */ $hostparts[$hostcount - 1] = str_replace(strstr($hostparts[$hostcount - 1], '/'), '', $hostparts[$hostcount - 1]); /* Check if we have an IP address instead of a domain name */ $countip = 0; foreach ($hostparts as $key => $value) { $oldlength = strlen($value); $value = (int) $value; $newlength = strlen($value); if ($oldlength == $newlength) { $countip++; } } /* Do we have an IP or a domain name */ if ($countip == 4) { /* We have an IP address */ $hostname = $hostparts[$hostcount - 4] . '.' . $hostparts[$hostcount - 3] . '.' . $hostparts[$hostcount - 2] . '.' . $hostparts[$hostcount - 1]; } else { if (strlen($hostparts[$hostcount - 1]) == 2 && strlen($hostparts[$hostcount - 2]) == 3) { /* We have a 3-part domain */ $hostname = $hostparts[$hostcount - 3] . '.' . $hostparts[$hostcount - 2] . '.' . $hostparts[$hostcount - 1]; } else { if (strlen($hostparts[$hostcount - 1]) == 2 && strlen($hostparts[$hostcount - 2]) == 2) { /* We have a 3-part domain */ $hostname = $hostparts[$hostcount - 3] . '.' . $hostparts[$hostcount - 2] . '.' . $hostparts[$hostcount - 1]; } else { if (strlen($hostparts[$hostcount - 1]) == 3 || strlen($hostparts[$hostcount - 1]) == 2) { /* We have a 2-part domain */ $hostname = $hostparts[$hostcount - 2] . '.' . $hostparts[$hostcount - 1]; } else { if (strlen($hostparts[$hostcount - 1]) == 4) { /* We have a 2-part domain */ $hostname = $hostparts[$hostcount - 2] . '.' . $hostparts[$hostcount - 1]; } else { /* Guessing this is a local domain */ } } } } } } else { /* This is a local domain */ /* The last part contains any subfolders, lets drop those */ } } /* Get the IP address */ if (array_key_exists('SERVER_ADDR', $_SERVER)) { $ipaddress = $_SERVER['SERVER_ADDR']; } else { $ipaddress = gethostbyname($_SERVER['SERVER_NAME']); } /* Local check */ if (strpos($ipaddress, '127.0') == 0 && strpos($ipaddress, '127.0') !== false || strpos($ipaddress, '192.168') == 0 && strpos($ipaddress, '192.168') !== false || strpos($ipaddress, '10.0') == 0 && strpos($ipaddress, '10.0') !== false || stripos($hostname, 'localhost') == 0 && stripos($hostname, 'localhost') !== false || stripos($hostname, '.') === false) { $result = JText::_('WORK_LOCAL'); $errorcode = 0; $uxdate = false; } else { $ct_period = 0; $uxdate = 0; $license_key = str_replace('.', '.', $config->bookpro_key, $ct_period); if ($ct_period == 2) { list($key, $hash, $uxdate) = explode(".", $license_key); if (md5($hostname . $hash) == $key) { $errorcode = 0; $result = JText::_('LICENSE_KEY_OK'); } else { $errorcode = 1; $result = JText::_('LICENSE_KEY_NOK'); } } else { $errorcode = 1; $result = JText::_('LICENSE_KEY_NOK'); } } return array('result' => $result, 'uxdate' => $uxdate, 'hostname' => $hostname, 'errorcode' => $errorcode); }
/** * Get absolute path to directory with image. * * @param $image add * into path image name * @return string */ function getIPath($image = null) { static $ipath; $image = str_replace("\\", "/", $image); if (empty($ipath)) { $config = AFactory::getConfig(); $ipath = $config->images; $ipath = AImage::getIPath($ipath); if (!file_exists($ipath)) { @mkdir($ipath, 0775, true); } } return is_null($image) ? $ipath : $ipath . $image; }
function display($tpl = null) { $this->config = AFactory::getConfig(); $this->_prepare(); parent::display($tpl); }