本文整理汇总了PHP中JHotelUtil::makePathFile方法的典型用法代码示例。如果您正苦于以下问题:PHP JHotelUtil::makePathFile方法的具体用法?PHP JHotelUtil::makePathFile怎么用?PHP JHotelUtil::makePathFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHotelUtil
的用法示例。
在下文中一共展示了JHotelUtil::makePathFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
function remove()
{
$cids = JRequest::getVar('room_id', array(0), 'post', 'array');
try {
$query = " \tSELECT \r\n\t\t\t\t\t\t\t* \r\n\t\t\t\t\t\tFROM #__hotelreservation_confirmations\t\t\t\tc\r\n\t\t\t\t\t\tINNER JOIN #__hotelreservation_confirmations_rooms\thr USING( confirmation_id )\r\n\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\thr.room_id IN (" . implode(',', $cids) . ") AND c.reservation_status NOT IN (" . CANCELED_ID . ", " . CHECKEDOUT_ID . " )\r\n\t\t\t\t\t\t";
$checked_records = $this->_getList($query);
if (count($checked_records) > 0) {
JError::raiseWarning(500, JText::_('LNG_SKIP_ROOM_REMOVE', true));
return false;
}
$query = "START TRANSACTION";
$this->_db->setQuery($query);
$this->_db->queryBatch();
if (count($cids)) {
foreach ($cids as $cid) {
$query = " DELETE FROM #__hotelreservation_rooms WHERE room_id = " . $cid;
$this->_db->setQuery($query);
if (!$this->_db->query()) {
throw new Exception($this->_db->getErrorMsg());
}
$query = " DELETE FROM #__hotelreservation_rooms_intervals_numbers WHERE room_id = " . $cid;
$this->_db->setQuery($query);
if (!$this->_db->query()) {
throw new Exception($this->_db->getErrorMsg());
}
$query = " DELETE FROM #__hotelreservation_rooms_numbers WHERE room_id = " . $cid;
$this->_db->setQuery($query);
if (!$this->_db->query()) {
throw new Exception($this->_db->getErrorMsg());
}
$query = " DELETE FROM #__hotelreservation_rooms_pictures WHERE room_id = " . $cid;
$this->_db->setQuery($query);
if (!$this->_db->query()) {
throw new Exception($this->_db->getErrorMsg());
}
$query = " DELETE FROM #__hotelreservation_rooms_numbers_date_ignored WHERE room_id = " . $cid;
$this->_db->setQuery($query);
if (!$this->_db->query()) {
throw new Exception($this->_db->getErrorMsg());
}
$query = " DELETE FROM #__hotelreservation_rooms_seasons WHERE room_id = " . $cid;
$this->_db->setQuery($query);
if (!$this->_db->query()) {
throw new Exception($this->_db->getErrorMsg());
}
$query = " DELETE FROM #__hotelreservation_rooms_seasons_date_ignored WHERE room_id = " . $cid;
$this->_db->setQuery($query);
if (!$this->_db->query()) {
throw new Exception($this->_db->getErrorMsg());
}
if (is_dir(JPATH_COMPONENT . PATH_ROOM_PICTURES . $cid)) {
$files = glob(JHotelUtil::makePathFile(JPATH_COMPONENT . PATH_ROOM_PICTURES . $cid . "/" . "*.*"));
foreach ($files as $pic) {
if (!@unlink($pic)) {
throw new Exception($this->_db->getErrorMsg());
}
}
if (!@rmdir(JPATH_COMPONENT . PATH_ROOM_PICTURES . $cid)) {
throw new Exception($this->_db->getErrorMsg());
}
}
}
}
$query = "COMMIT";
$this->_db->setQuery($query);
$this->_db->queryBatch();
} catch (Exception $ex) {
// dmp($ex);
// exit;
$query = "ROLLBACK";
$this->_db->setQuery($query);
$this->_db->queryBatch();
$msg = JText::_('LNG_ERROR_DELETE_ROOM', true);
return false;
}
return true;
}
示例2: readdir
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";
}
closedir($dh);
}
}
*/
} else {
//dmp('Am '.$dir);
}
$_target_tmp .= $e . DIRECTORY_SEPARATOR;
}
if ($is_error == false) {
$_target = $_root_app . $_target . basename($_FILES['uploadedfile']['name']);
$file_tmp = JHotelUtil::makePathFile($_target);
/* if( is_file($file_tmp) )
{
$p = '';
$n = basename( $file_tmp);
$i = 'This file exist !';
$e = 1;
}
else
{ */
//dmp($_FILES['uploadedfile']['name']);
if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $file_tmp)) {
if ($resizeImage) {
$image = new Resize_Image();
$image->ratio = true;
$ratio = PICTURE_WIDTH / PICTURE_HEIGHT;
示例3: savePictures
public function savePictures($data)
{
//prepare photos
$path_old = JHotelUtil::makePathFile(JPATH_ROOT . DS . PATH_PICTURES . PATH_EXCURSION_PICTURES . ($data['excursion_id'] + 0) . "/");
$files = glob($path_old . "*.*");
$data['id'] = $this->getState('excursion.id');
$path_new = JHotelUtil::makePathFile(JPATH_ROOT . DS . PATH_PICTURES . PATH_EXCURSION_PICTURES . ($data['excursion_id'] + 0) . "/");
$picture_ids = array();
foreach ($data['pictures'] as $value) {
$row = $this->getTable('ExcursionPictures');
// dmp($key);
$pic = new stdClass();
$pic->picture_id = 0;
$pic->excursion_id = $data['excursion_id'];
$pic->picture_info = $value['excursion_picture_info'];
$pic->picture_path = $value['excursion_picture_path'];
$pic->picture_enable = $value['excursion_picture_enable'];
$file_tmp = JHotelUtil::makePathFile($path_old . basename($pic->picture_path));
if (!is_file($file_tmp)) {
continue;
}
if (!is_dir($path_new)) {
if (!@mkdir($path_new)) {
throw new Exception($this->_db->getErrorMsg());
}
}
// dmp(($path_old.basename($pic->excursion_picture_path).",".$path_new.basename($pic->excursion_picture_path)));
// exit;
if ($path_old . basename($pic->excursion_picture_path) != $path_new . basename($pic->excursion_picture_path)) {
if (@rename($path_old . basename($pic->excursion_picture_path), $path_new . basename($pic->excursion_picture_path))) {
$pic->excursion_picture_path = PATH_EXCURSION_PICTURES . ($data['excursion_id'] + 0) . '/' . basename($pic->excursion_picture_path);
//@unlink($path_old.basename($pic->excursion_picture_path));
} else {
throw new Exception($this->_db->getErrorMsg());
}
}
if (!$row->bind($pic)) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
return false;
}
// Make sure the record is valid
if (!$row->check()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
return false;
}
// Store the web link table to the database
if (!$row->store()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
return false;
}
$picture_ids[] = $this->_db->insertid();
}
$files = glob($path_new . "*.*");
foreach ($files as $pic) {
$is_find = false;
foreach ($data['pictures'] as $value) {
//echo $pic."==".JHotelUtil::makePathFile(JPATH_ROOT.DS.PATH_PICTURES.$value['excursion_picture_path']);
if ($pic == JHotelUtil::makePathFile(JPATH_ROOT . DS . PATH_PICTURES . $value['excursion_picture_path'])) {
$is_find = true;
break;
}
}
/*if( $is_find == false )
@unlink( JHotelUtil::makePathFile(JPATH_ROOT.DS.PATH_PICTURES.DS.$value['excursion_picture_path']) );*/
}
$query = " DELETE FROM #__hotelreservation_excursion_pictures\r\n\t\tWHERE excursion_id = '" . $data['excursion_id'] . "'\r\n\t\t" . (count($picture_ids) > 0 ? " AND picture_id NOT IN (" . implode(',', $picture_ids) . ")" : "");
// dmp($query);
// exit;
$this->_db->setQuery($query);
if (!$this->_db->query()) {
throw new Exception($this->_db->getErrorMsg());
}
//~prepare photos
return true;
}
示例4: basename
$_pos = '';
$is_error = false;
if (!isset($_GET['_pos']) || $_GET['_filename'] == '' || !isset($_GET['_filename']) || $_GET['_root_app'] == '' || !isset($_GET['_root_app'])) {
$f = $n = '';
$i = 'Invalid params !';
$e = 2;
$is_error = true;
}
if ($is_error == false) {
$_root_app = $_GET['_root_app'];
$_filename = $_GET['_filename'];
$_pos = $_GET['_pos'];
if ($_root_app[strlen($_root_app) - 1] != '/' && $_filename[strlen($_filename) - 1] != '/') {
$_root_app .= '/';
}
$file_tmp = JHotelUtil::makePathFile($_root_app . $_filename);
// dmp($file_tmp);
if (!is_file($file_tmp)) {
$f = $file_tmp;
$n = basename($file_tmp);
$i = 'This file doesn\'t exist !';
$e = 0;
// this must be set to 0 - it wont delete a record that exists only in the database
} else {
if (@unlink($file_tmp)) {
$f = htmlentities($file_tmp);
$n = basename($file_tmp);
$i = $file_tmp;
$e = 0;
//print_r( array( htmlentities( $_uri.$_target), "") );
} else {
示例5: storePictures
function storePictures($data)
{
//prepare photos
$path_old = JHotelUtil::makePathFile(JPATH_ROOT . DS . PATH_PICTURES . PATH_OFFER_PICTURES . ($data['offer_id'] + 0) . "/");
$files = glob($path_old . "*.*");
$path_new = JHotelUtil::makePathFile(JPATH_ROOT . DS . PATH_PICTURES . PATH_OFFER_PICTURES . ($data['offer_id'] + 0) . "/");
$picture_ids = array();
foreach ($data['pictures'] as $value) {
$row = $this->getTable('ManageOfferPictures', 'Table');
// dmp($key);
$pic = new stdClass();
$pic->offer_picture_id = 0;
$pic->offer_id = $data['offer_id'];
$pic->offer_picture_info = $value['offer_picture_info'];
$pic->offer_picture_path = $value['offer_picture_path'];
$pic->offer_picture_enable = $value['offer_picture_enable'];
//dmp($pic);
$file_tmp = JHotelUtil::makePathFile($path_old . basename($pic->offer_picture_path));
if (!is_file($file_tmp)) {
continue;
}
if (!is_dir($path_new)) {
if (!@mkdir($path_new)) {
throw new Exception($this->_db->getErrorMsg());
}
}
if ($path_old . basename($pic->offer_picture_path) != $path_new . basename($pic->offer_picture_path)) {
if (@rename($path_old . basename($pic->offer_picture_path), $path_new . basename($pic->offer_picture_path))) {
$pic->offer_picture_path = PATH_OFFER_PICTURES . ($data['room_id'] + 0) . '/' . basename($pic->offer_picture_path);
//@unlink($path_old.basename($pic->offer_picture_path));
} else {
throw new Exception($this->_db->getErrorMsg());
}
}
if (!$row->bind($pic)) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
// Make sure the record is valid
if (!$row->check()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
// Store the web link table to the database
if (!$row->store()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
$picture_ids[] = $this->_db->insertid();
}
$files = glob($path_new . "*.*");
foreach ($files as $pic) {
$is_find = false;
foreach ($data['pictures'] as $value) {
if ($pic == JHotelUtil::makePathFile(JPATH_ROOT . $value['offer_picture_path'])) {
$is_find = true;
break;
}
}
//if( $is_find == false )
// @unlink( JHotelUtil::makePathFile(JPATH_COMPONENT.$value['offer_picture_path']) );
}
$query = " DELETE FROM #__hotelreservation_offers_pictures\r\n\t\t\t\t\t\tWHERE offer_id = '" . $data['offer_id'] . "'\r\n\t\t\t\t\t\t" . (count($picture_ids) > 0 ? " AND offer_picture_id NOT IN (" . implode(',', $picture_ids) . ")" : "");
// dmp($query);
// exit;
$this->_db->setQuery($query);
if (!$this->_db->query()) {
throw new Exception($this->_db->getErrorMsg());
}
//~prepare photos
}
示例6: storePicture
function storePicture($picturePath, $id, $oldId)
{
//prepare photos
$path_old = JHotelUtil::makePathFile(JPATH_ROOT . DS . PATH_PICTURES . EXTRA_OPTISON_PICTURE_PATH . $picturePath);
$files = glob($path_old . "*.*");
$path_new = JHotelUtil::makePathFile(JPATH_ROOT . DS . PATH_PICTURES . EXTRA_OPTISON_PICTURE_PATH . $id . "/");
$file_tmp = JHotelUtil::makePathFile($path_old);
if (!is_file($file_tmp)) {
return;
}
//dmp("is file");
if (!is_dir($path_new)) {
if (!@mkdir($path_new)) {
throw new Exception($this->_db->getErrorMsg());
}
}
//dmp(($path_old.basename($picturePath).",".$path_new.basename($picturePath)));
// exit;
if ($path_old . basename($picturePath) != $path_new . basename($picturePath)) {
//dmp($file_tmp);
//dmp($picturePath);
//dmp(strpos($file_tmp,"\\0\\"));
if (strpos($file_tmp, "\\0\\") > 0 && $oldId == 0 && @rename($path_old, $path_new . basename($picturePath))) {
//dmp(1);
$picturePath = $id . '/' . basename($picturePath);
} else {
if (strpos($file_tmp, "\\0\\") == false && @copy($path_old, $path_new . basename($picturePath))) {
//dmp(2);
$picturePath = $id . '/' . basename($picturePath);
} else {
//throw( new Exception($this->_db->getErrorMsg()) );
}
}
//dmp($picturePath);
}
$data = array();
$data["image_path"] = $picturePath;
// Get a row instance.
$table = $this->getTable();
// Load the row if saving an existing item.
if ($id > 0) {
$table->load($id);
$isNew = false;
}
// Bind the data.
if (!$table->bind($data)) {
$this->setError($table->getError());
return false;
}
// Check the data.
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// Store the data.
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
return true;
}
示例7: store
function store($data)
{
try {
$this->_db->BeginTrans();
$row = $this->getTable('hotels');
//$data["hotel_description"]= strip_tags($data["hotel_description"]);
$this->checkHotelRestrictions($data['hotel_id']);
$data['start_date'] = JHotelUtil::convertToMysqlFormat($data['start_date']);
$data['end_date'] = JHotelUtil::convertToMysqlFormat($data['end_date']);
//dmp($data);
//exit;
// Bind the form fields to the table
if (!$row->bind($data)) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
// return false;
}
// Make sure the record is valid
if (!$row->check()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
// return false;
}
// Store the web link table to the database
if (!$row->store()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
// return false;
}
if ($data['hotel_id'] == '' || $data['hotel_id'] == 0 || $data['hotel_id'] == null) {
$data['hotel_id'] = $this->_db->insertid();
$this->_hotel_id = $data['hotel_id'];
self::copyEmailContent($this->_hotel_id);
}
//prepare photos
$managePictures = JRequest::getVar("manage_pictures", null);
if (!empty($managePictures)) {
$path_old = JHotelUtil::makePathFile(JPATH_ROOT . DS . PATH_HOTEL_PICTURES . ($data['hotel_id'] + 0) . "/");
$files = glob($path_old . "*.*");
$path_new = JHotelUtil::makePathFile(JPATH_ROOT . DS . PATH_HOTEL_PICTURES . ($data['hotel_id'] + 0) . "/");
//dmp($data);
//dmp($data['pictures']);
//exit;
$picture_ids = array();
foreach ($data['pictures'] as $value) {
$row = $this->getTable('ManageHotelPictures');
//dmp($key);
$pic = new stdClass();
$pic->hotel_picture_id = 0;
$pic->hotel_id = $data['hotel_id'];
$pic->hotel_picture_info = $value['hotel_picture_info'];
$pic->hotel_picture_path = $value['hotel_picture_path'];
$pic->hotel_picture_enable = $value['hotel_picture_enable'];
$file_tmp = JHotelUtil::makePathFile($path_old . basename($pic->hotel_picture_path));
if (!is_file($file_tmp)) {
continue;
}
if (!is_dir($path_new)) {
if (!@mkdir($path_new)) {
throw new Exception($this->_db->getErrorMsg());
}
}
//dmp(($path_old.basename($pic->hotel_picture_path).",".$path_new.basename($pic->hotel_picture_path)));
//exit;
if ($path_old . basename($pic->hotel_picture_path) != $path_new . basename($pic->hotel_picture_path)) {
if (@rename($path_old . basename($pic->hotel_picture_path), $path_new . basename($pic->hotel_picture_path))) {
$pic->hotel_picture_path = PATH_HOTEL_PICTURES . ($data['hotel_id'] + 0) . '/' . basename($pic->hotel_picture_path);
//@unlink($path_old.basename($pic->room_picture_path));
} else {
throw new Exception($this->_db->getErrorMsg());
}
}
if (!$row->bind($pic)) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
// Make sure the record is valid
if (!$row->check()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
// Store the web link table to the database
if (!$row->store()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
$picture_ids[] = $this->_db->insertid();
}
//dmp($picture_ids);
$files = glob($path_new . "*.*");
foreach ($files as $pic) {
$is_find = false;
foreach ($data['pictures'] as $value) {
$path = JHotelUtil::makePathFile(JPATH_ROOT . DS . $value['hotel_picture_path']);
if ($pic == JHotelUtil::makePathFile(JPATH_ROOT . DS . $value['hotel_picture_path'])) {
$is_find = true;
break;
}
}
//if( $is_find == false )
//.........这里部分代码省略.........