本文整理匯總了PHP中MetabaseQuery函數的典型用法代碼示例。如果您正苦於以下問題:PHP MetabaseQuery函數的具體用法?PHP MetabaseQuery怎麽用?PHP MetabaseQuery使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MetabaseQuery函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: SearchCompleteValues
function SearchCompleteValues(&$form, $text, &$found)
{
$error = '';
$found = array();
if (strlen($complete_expression = MetabaseBeginsWith($this->connection, $text)) == 0) {
return 'it was not possible to build the complete query expression: ' . MetabaseError($this->connection);
}
if (!strcmp($complete_values_query = str_replace('{BEGINSWITH}', $complete_expression, $this->complete_values_query), $this->complete_values_query)) {
return 'the complete values query does not contain the {BEGINSWITH} mark to insert the complete expression';
}
if (strlen($text) && $this->complete_values_limit) {
MetabaseSetSelectedRowRange($this->connection, 0, $this->complete_values_limit);
}
if ($r = MetabaseQuery($this->connection, $complete_values_query)) {
for ($l = 0; !MetabaseEndOfResult($this->connection, $r); $l++) {
if (!MetabaseFetchResultArray($this->connection, $r, $d, $l)) {
$error = 'Could not retrieve the complete values: ' . MetabaseError($this->connection);
break;
}
$found[$d[0]] = $this->FormatCompleteValue($d);
}
MetabaseFreeResult($this->connection, $r);
} else {
$error = 'Complete values query execution failed: ' . MetabaseError($this->connection);
}
return $error;
}
示例2: GetGroups
function GetGroups(&$g)
{
if (strlen($this->groups_query) == 0) {
return "it was not specified a valid query to retrieve all the options groups";
}
$g = array();
if (isset($this->default_option)) {
$g[] = $this->default_option;
}
$error = "";
if ($r = MetabaseQuery($this->connection, $this->groups_query)) {
for ($l = 0; !MetabaseEndOfResult($this->connection, $r); $l++) {
if (!MetabaseFetchResultArray($this->connection, $r, $d, $l)) {
$error = "Could not retrieve the options group: " . MetabaseError($this->connection);
break;
}
$g[] = $d[0];
}
if (count($g) == 0 && strlen($error) == 0) {
$error = "there are no group options";
}
MetabaseFreeResult($this->connection, $r);
} else {
$error = "Groups query execution failed: " . MetabaseError($this->connection);
}
if (strlen($error)) {
unset($g);
}
return $error;
}
示例3: checkbookingin
/**
* Checkin::checkbookingin()
*
* This function checks in a booking.
*
* @param integer $bookingid bookingid
* @access public
* @since 2003-09-02
* @author Christian Ehret <chris@uffbasse.de>
*/
function checkbookingin($bookingid)
{
global $gDatabase, $tbl_booking, $errorhandler;
$guests = array();
$query = sprintf("UPDATE {$tbl_booking} " . "SET checked_in = %s " . "WHERE pk_booking_id = %s ", MetabaseGetBooleanFieldValue($gDatabase, true), $bookingid);
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Checkin::checkin()', $query);
}
}
示例4: createEmailConfirmation
/**
* createEmailConfirmation()
*
* Create a mailto link for email confirmation
*
* @param number $bookid id of booking
* @return string mailto link
* @access public
* @since 2003-10-12
* @author Christian Ehret <chris@uffbasse.de>
*/
function createEmailConfirmation($bookid)
{
global $tbl_booking, $tbl_guest, $tbl_address, $tbl_guest_address, $tbl_bookingcat, $tbl_country, $gDatabase, $errorhandler, $request;
include_once 'guestclass.inc.php';
$guest = new Guest();
$query = "SELECT {$tbl_booking}.fk_bookingcat_id, {$tbl_booking}.fk_guest_id, \n\t UNIX_TIMESTAMP(start_date), UNIX_TIMESTAMP(end_date), \n\t\t\t TO_DAYS( end_date ) - TO_DAYS( start_date ) AS days, \n\t\t\t {$tbl_booking}.persons, children, {$tbl_guest}.firstname, \n\t\t\t {$tbl_guest}.lastname, {$tbl_bookingcat}.bookingcat, \n\t\t\t DATE_FORMAT({$tbl_guest}.date_of_birth , '%d.%m.%Y'), \n\t\t\t postalcode, city, address, country_de, email, \n\t\t\t booking_type, {$tbl_guest}.formal_greeting, \n\t\t\t {$tbl_guest}.gender, \n\t\t\t COALESCE( CASE WHEN {$tbl_bookingcat}.description = '' THEN NULL ELSE {$tbl_bookingcat}.description END, CASE WHEN {$tbl_bookingcat}.bookingcat = '' THEN NULL ELSE {$tbl_bookingcat}.bookingcat END, '' ),\n\t\t\t children2, children3, children0 \n\t\t\t FROM {$tbl_booking} \n\t\t\t LEFT JOIN {$tbl_guest} ON ({$tbl_booking}.fk_guest_id = {$tbl_guest}.pk_guest_id) \n\t\t\t LEFT JOIN {$tbl_guest_address} ON ({$tbl_guest_address}.default_address = " . MetabaseGetBooleanFieldValue($gDatabase, true) . " \n\t\t\t AND {$tbl_guest}.pk_guest_id = {$tbl_guest_address}.pk_fk_guest_id) \n\t\t\t LEFT JOIN {$tbl_address} ON ({$tbl_address}.pk_address_id = {$tbl_guest_address}.pk_fk_address_id) \n\t\t\t LEFT JOIN {$tbl_bookingcat} ON ({$tbl_booking}.fk_bookingcat_id = {$tbl_bookingcat}.pk_bookingcat_id) \n\t\t\t LEFT JOIN {$tbl_country} ON (fk_country_id = {$tbl_country}.pk_country_id )\n\t\t\t WHERE pk_booking_id = " . $bookid;
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Booking::emailConfirmation()', $query);
} else {
if (MetabaseNumberOfRows($gDatabase, $result) == 1) {
$booking = array();
$str = "";
$bookingtype = "";
$bookingstr = "";
$isformal = MetabaseFetchBooleanResult($gDatabase, $result, 0, 16);
$dirihnen = "Dir";
if ($isformal) {
$dirihnen = "Ihnen";
}
switch (MetabaseFetchResult($gDatabase, $result, 0, 16)) {
case 'R':
$bookingtype = "Reservierungsbestätigung";
$bookingstr = "Reservierung";
break;
case 'B':
$bookingtype = "Buchungsbestätigung";
$bookingstr = "Buchung";
break;
case 'P':
$bookingtype = "Buchungsbestätigung";
$bookingstr = "Buchung";
break;
}
$body = "";
$body .= $guest->GetGreeting(MetabaseFetchResult($gDatabase, $result, 0, 1)) . "\n";
$body .= "hiermit bestätigen wir " . $dirihnen . " folgende " . $bookingstr . ":\n\n";
$body .= "Anreise: " . date("d. m. Y", MetabaseFetchResult($gDatabase, $result, 0, 2)) . "\n";
$body .= "Abreise: " . date("d. m. Y", MetabaseFetchResult($gDatabase, $result, 0, 3)) . "\n";
$body .= "Kategorie: " . MetabaseFetchResult($gDatabase, $result, 0, 19) . "\n";
$body .= "Erwachsene: " . MetabaseFetchResult($gDatabase, $result, 0, 5) . "\n";
$body .= $request->GetVar('children0', 'session') . ": " . MetabaseFetchResult($gDatabase, $result, 0, 22) . "\n";
$body .= $request->GetVar('children1', 'session') . ": " . MetabaseFetchResult($gDatabase, $result, 0, 6) . "\n";
$body .= $request->GetVar('children2', 'session') . ": " . MetabaseFetchResult($gDatabase, $result, 0, 20) . "\n";
$body .= $request->GetVar('children3', 'session') . ": " . MetabaseFetchResult($gDatabase, $result, 0, 21) . "\n\n";
$body .= "für:\n";
$body .= MetabaseFetchResult($gDatabase, $result, 0, 7) . " " . MetabaseFetchResult($gDatabase, $result, 0, 8) . "\n";
$body .= MetabaseFetchResult($gDatabase, $result, 0, 13) . "\n";
$body .= MetabaseFetchResult($gDatabase, $result, 0, 11) . " " . MetabaseFetchResult($gDatabase, $result, 0, 12) . "\n";
$body .= MetabaseFetchResult($gDatabase, $result, 0, 14) . "\n\n";
$str = "mailto:" . MetabaseFetchResult($gDatabase, $result, 0, 7) . "%20" . MetabaseFetchResult($gDatabase, $result, 0, 8) . "%20<" . MetabaseFetchResult($gDatabase, $result, 0, 15) . ">?subject={$bookingtype}" . "&body=" . rawurlencode($body);
}
return $str;
}
}
示例5: query
function query($query, $obj)
{
global $mdb;
//$this->model->query_arr["query"][] = $query ;
//$db_res = MetabaseQuery($mdb,$query_chartset);
$db_res = MetabaseQuery($mdb, $query);
if (!$db_res) {
if ($obj->config->debug_mod == "Y") {
$this->sqlError($mdb, $query);
} else {
$obj->message->alertErr("system_err", $obj);
}
}
return $db_res;
}
示例6: flush
}
}
if ($support_lobs && isset($tests["lobnulls"]) && $success) {
$test = "lobnulls";
echo "Testing lob nulls... ";
flush();
$pass = 1;
if (!MetabaseQuery($database, "DELETE FROM files")) {
$success = 0;
} else {
if ($prepared_query = MetabasePrepareQuery($database, "INSERT INTO files (document,picture) VALUES (?,?)")) {
MetabaseQuerySetNULL($database, $prepared_query, 1, "clob");
MetabaseQuerySetNULL($database, $prepared_query, 2, "blob");
$success = MetabaseExecuteQuery($database, $prepared_query);
MetabaseFreePreparedQuery($database, $prepared_query);
if (!$success || !($result = MetabaseQuery($database, "SELECT document,picture FROM files"))) {
$success = 0;
} else {
if (MetabaseEndOfResult($database, $result)) {
$pass = 0;
echo "FAILED!{$eol}";
$failed++;
echo "Test {$test}: the query result seem to have reached the end of result too soon.{$eol}";
} else {
if (!MetabaseResultIsNull($database, $result, 0, $field = "document") || !MetabaseResultIsNull($database, $result, 0, $field = "picture")) {
$pass = 0;
echo "FAILED!{$eol}";
$failed++;
echo "Test {$test}: a query result large object column is not NULL unlike what was expected{$eol}";
}
}
示例7: del
/**
* Category::del()
*
* Deletes a category
*
* @param number $catid category
* @access public
* @since 2003-07-24
* @author Christian Ehret <chris@uffbasse.de>
*/
function del($catid)
{
global $gDatabase, $tbl_paycat, $request, $errorhandler;
$query = sprintf("UPDATE {$tbl_paycat} \n\t\t\t\t\t\tSET deleted_date = NOW(), \n\t\t\t\t\t\tfk_deleted_user_id = %s \n\t\t\t\t\t\tWHERE pk_paycat_id = %s ", $request->GetVar('uid', 'session'), $catid);
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'PayCategory::del()', $query);
}
}
示例8: getallwithstatus
/**
* Category::getallwithstatus()
*
* Get all categories with status if
* subscribed or not
*
* @param number $guestid id of the guest
* @return array categories and
* @access public
* @since 2003-07-24
* @author Christian Ehret <chris@uffbasse.de>
*/
function getallwithstatus($guestid)
{
global $gDatabase, $request, $tbl_guest_guestcat, $errorhandler;
$allcat = $this->getall();
$cat = array();
$query = sprintf("SELECT pk_fk_guestcat_id " . "FROM {$tbl_guest_guestcat} " . "WHERE pk_fk_guest_id = %s ", $guestid);
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'GuestCategory::getallwithstatus()', $query);
} else {
$row = 0;
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$cat[$row] = array('catid' => MetabaseFetchResult($gDatabase, $result, $row, 0));
}
}
for ($i = 0; $i < count($allcat); $i++) {
$allcat[$i][subscribed] = 'no';
for ($j = 0; $j < count($cat); $j++) {
if ($allcat[$i][catid] == $cat[$j][catid]) {
$allcat[$i][subscribed] = 'yes';
}
}
}
return $allcat;
}
示例9: saveupdate
/**
* bcat::saveupdate()
*
* save or update a booking category
*
* @return number booking category id
* @access public
* @since 2003-07-24
* @author Christian Ehret <chris@uffbasse.de>
*/
function saveupdate()
{
global $gDatabase, $request, $tbl_bookingcat, $errorhandler;
$bcatid = $request->GetVar('frm_bcatid', 'post');
// update
if ($bcatid !== '0') {
$query = sprintf("UPDATE {$tbl_bookingcat} SET \n\t\t\t\t\t\t\t bookingcat = %s, \n\t\t\t\t\t\t\t color = %s, \n\t\t\t\t\t\t\t description = %s, \n\t\t\t\t\t\t\t days = %s,\n\t\t\t\t\t\t\t updated_date = NOW(), \n\t\t\t\t\t\t\t fk_updated_user_id = %s \n\t\t\t\t\t\t\t WHERE pk_bookingcat_id = %s ", MetabaseGetTextFieldValue($gDatabase, $request->GetVar('frm_name', 'post')), MetabaseGetTextFieldValue($gDatabase, $request->GetVar('frm_color', 'post')), MetabaseGetTextFieldValue($gDatabase, $request->GetVar('frm_description', 'post')), $request->GetVar('frm_days', 'post'), $request->GetVar('uid', 'session'), $bcatid);
} else {
// new
$name = "zvs_pk_bookingcat_id";
$sequence = MetabaseGetSequenceNextValue($gDatabase, $name, &$bcatid);
$query = sprintf("INSERT INTO {$tbl_bookingcat}\n\t\t\t\t\t\t\t (pk_bookingcat_id, bookingcat, color, description, days, inserted_date, fk_inserted_user_id )\n\t\t\t\t\t\t\t VALUES (%s, %s, %s, %s, %s, NOW(), %s )", $bcatid, MetabaseGetTextFieldValue($gDatabase, $request->GetVar('frm_name', 'post')), MetabaseGetTextFieldValue($gDatabase, $request->GetVar('frm_color', 'post')), MetabaseGetTextFieldValue($gDatabase, $request->GetVar('frm_description', 'post')), $request->GetVar('frm_days', 'post'), $request->GetVar('uid', 'session'));
}
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'BookingCategory::saveupdate()', $query);
} else {
return $bcatid;
}
}
示例10: query
function query($query)
{
parent::query($query);
$this->_count = 0;
$result = MetabaseQuery($this->db, $query);
if ($result == 0) {
$this->error = MetabaseError($this->db);
return false;
} else {
$this->result = $result;
return true;
}
}
示例11: MetabaseRollbackTransaction
if (!$result) {
$success = MetabaseRollbackTransaction($gDatabase);
$errorhandler->display('SQL', 'database', $query);
}
$success = splitSqlFile($queries, $sql);
for ($i = 0; $i < count($queries); ++$i) {
if (substr($queries[$i], 0, 3) == "USE") {
$query = "USE {$schema}";
} else {
$query = $queries[$i];
}
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$success = MetabaseRollbackTransaction($gDatabase);
$errorhandler->display('SQL', 'database', $query);
}
}
$query = "SET FOREIGN_KEY_CHECKS = 0";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$success = MetabaseRollbackTransaction($gDatabase);
$errorhandler->display('SQL', 'database', $query);
}
$success = MetabaseCommitTransaction($gDatabase);
// end transaction
$auto_commit = true;
$success = MetabaseAutoCommitTransactions($gDatabase, $auto_commit);
$smarty->assign('tpl_ready', 'true');
}
}
$smarty->display('database.tpl');
示例12: getBirthdayReminders
/**
* Guestlist::getBirthdayReminders()
*
* This function returns a list of guests wich have their birthday and the reminder set.
*
* @return array guests
* @access public
* @since 2004-07-26
* @author Christian Ehret <chris@uffbasse.de>
*/
function getBirthdayReminders()
{
global $gDatabase, $tbl_guest, $request, $errorhandler;
$days = $request->GetVar('birthday_days', 'Session');
$guests = array();
$query = "SELECT pk_guest_id, firstname, lastname, DATE_FORMAT(date_of_birth ,'%d.%m.%Y'),\n\t\t\t\t\t\t DATE_FORMAT(now(), '%Y') - DATE_FORMAT(date_of_birth ,'%Y')\n\t\t FROM {$tbl_guest}\n\t\t\t\t\t\t WHERE DATE_FORMAT( date_of_birth, '%m%d' ) BETWEEN DATE_FORMAT( now(), '%m%d' ) AND DATE_FORMAT( DATE_ADD(now(), INTERVAL {$days} DAY), '%m%d' ) \t\t\t\t \n\t\t\t\t\t\t AND birthday_reminder = " . MetabaseGetBooleanFieldValue($gDatabase, true) . "\n\t\t\t\t\t\t ORDER BY DATE_FORMAT( date_of_birth, '%d') ";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Guestlist::getBirthdayReminders()', $query);
} else {
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
$guests[$row] = array('guestid' => MetabaseFetchResult($gDatabase, $result, $row, 0), 'firstname' => MetabaseFetchResult($gDatabase, $result, $row, 1), 'lastname' => MetabaseFetchResult($gDatabase, $result, $row, 2), 'birthday' => MetabaseFetchResult($gDatabase, $result, $row, 3), 'age' => MetabaseFetchResult($gDatabase, $result, $row, 4), 'color' => $color);
}
$color = 0;
if ($row % 2 != 0) {
$color = 1;
}
return $guests;
}
}
示例13: save
/**
* price::save()
*
* save prices for a season
*
* @access public
* @since 2004-01-01
* @author Christian Ehret <chris@uffbasse.de>
*/
function save()
{
global $gDatabase, $request, $tbl_price, $tbl_price2, $errorhandler, $rcat, $bcat;
// turn on Transaction Control
$auto_commit = false;
$success = MetabaseAutoCommitTransactions($gDatabase, $auto_commit);
$seasonids = array();
$seasonids = $request->getVar('frm_seasonid', 'post');
$bcats = $bcat->Get();
$rcats = $rcat->get('N');
$rcats2 = $rcat->get('A');
for ($i = 0; $i < count($seasonids); $i++) {
// delete all old entries for the season for price normal
$query = sprintf("DELETE FROM {$tbl_price} WHERE fk_season_id = %s", $seasonids[$i]);
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$success = MetabaseRollbackTransaction($gDatabase);
$errorhandler->display('SQL', 'Price::save()', $query);
}
// delete all old entries for the season for price advanced
$query = sprintf("DELETE FROM {$tbl_price2} WHERE fk_season_id = %s", $seasonids[$i]);
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$success = MetabaseRollbackTransaction($gDatabase);
$errorhandler->display('SQL', 'Price::save()', $query);
}
// insert new values
for ($j = 0; $j < count($bcats); $j++) {
for ($k = 0; $k < count($rcats); $k++) {
$frmperson = "frm_price_adult_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats[$k][catid];
$frmperson_short = "frm_price_adult_short_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats[$k][catid];
$frmchildren = "frm_price_child_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats[$k][catid];
$frmchildren_short = "frm_price_child_short_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats[$k][catid];
$frmchildren2 = "frm_price_child2_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats[$k][catid];
$frmchildren2_short = "frm_price_child2_short_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats[$k][catid];
$frmchildren3 = "frm_price_child3_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats[$k][catid];
$frmchildren3_short = "frm_price_child3_short_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats[$k][catid];
$frmabsolute = "frm_price_pausch_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats[$k][catid];
$frmabsolute_short = "frm_price_pausch_short_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats[$k][catid];
$frmtype = "frm_type_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats[$k][catid];
$priceperson = 0.0;
$pricepersonshort = 0.0;
$pricechildren = 0.0;
$pricechildrenshort = 0.0;
$pricechildren2 = 0.0;
$pricechildren2short = 0.0;
$pricechildren3 = 0.0;
$pricechildren3short = 0.0;
if ($request->GetVar($frmperson, 'post') !== "") {
$priceperson = $request->GetVar($frmperson, 'post');
}
if ($request->GetVar($frmperson_short, 'post') !== "") {
$pricepersonshort = $request->GetVar($frmperson_short, 'post');
}
if ($request->GetVar($frmchildren, 'post') !== "") {
$pricechildren = $request->GetVar($frmchildren, 'post');
}
if ($request->GetVar($frmchildren_short, 'post') !== "") {
$pricechildrenshort = $request->GetVar($frmchildren_short, 'post');
}
if ($request->GetVar($frmchildren2, 'post') !== "") {
$pricechildren2 = $request->GetVar($frmchildren2, 'post');
}
if ($request->GetVar($frmchildren2_short, 'post') !== "") {
$pricechildren2short = $request->GetVar($frmchildren2_short, 'post');
}
if ($request->GetVar($frmchildren3, 'post') !== "") {
$pricechildren3 = $request->GetVar($frmchildren3, 'post');
}
if ($request->GetVar($frmchildren3_short, 'post') !== "") {
$pricechildren3short = $request->GetVar($frmchildren3_short, 'post');
}
$name = "zvs_pk_price_id";
$sequence = MetabaseGetSequenceNextValue($gDatabase, $name, &$priceid);
$query = sprintf("INSERT INTO {$tbl_price}\n\t\t\t\t\t\t\t\t (pk_price_id, fk_roomcat_id, fk_bookingcat_id,\n\t\t\t\t\t\t\t\t fk_season_id, price_person, price_children, \n\t\t\t\t\t\t\t\t price_type, inserted_date, fk_inserted_user_id, \n\t\t\t\t\t\t\t\t price_person_short, price_children_short,\n\t\t\t\t\t\t\t\t price_children2, price_children2_short, price_children3, price_children3_short) \n\t\t\t\t\t\t\t\t VALUES\n\t\t\t\t\t\t\t\t (%s, %s, %s, %s, %s, %s, %s, NOW(), %s, %s, %s, %s, %s, %s, %s) ", $priceid, $rcats[$k][catid], $bcats[$j][bcatid], $seasonids[$i], $priceperson, $pricechildren, MetabaseGetTextFieldValue($gDatabase, 'PP'), $request->GetVar('uid', 'session'), $pricepersonshort, $pricechildrenshort, $pricechildren2, $pricechildren2short, $pricechildren3, $pricechildren3short);
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$success = MetabaseRollbackTransaction($gDatabase);
$errorhandler->display('SQL', 'Price::save()', $query);
}
}
for ($k = 0; $k < count($rcats2); $k++) {
$frmprice = "frm_price_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats2[$k][catid];
$frmprice_short = "frm_price_short_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats2[$k][catid];
$frmperson = "frm_person_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats2[$k][catid];
$frmadditional = "frm_additional_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats2[$k][catid];
$frmadditional_short = "frm_additional_short_" . $seasonids[$i] . "_" . $bcats[$j][bcatid] . "_" . $rcats2[$k][catid];
$price = 0.0;
$priceshort = 0.0;
$additional = 0.0;
$additionalshort = 0.0;
//.........這裏部分代碼省略.........
示例14: getdates
/**
* Calendar::getdates()
*
* This function returns an array with all dates.
*
* @return array dates
* @access public
* @since 2005-01-11
* @author Christian Ehret <chris@uffbasse.de>
*/
function getdates()
{
global $gDatabase, $tbl_booking_detail, $request, $errorhandler;
$dates = array();
$j = 0;
$query = "SELECT DATE_FORMAT(min( start_date ) ,'%Y') \n\t\t FROM {$tbl_booking_detail} ";
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Calendar::getdates()', $query);
} else {
$startyear = MetabaseFetchResult($gDatabase, $result, 0, 0);
$todaydate = getdate();
$todayyear = $todaydate['year'];
$i = 0;
for ($year = $startyear; $year <= $todayyear; ++$year) {
$dates[$i] = $year;
++$i;
}
for ($j = 0; $j <= 20; ++$j) {
$dates[$i] = $year + $j;
++$i;
}
}
return $dates;
}
示例15: send
/**
* Newsletter::send()
*
* This function sends eMail.
*
* @param array $cats categories
* @param string $sender sender
* @param string $senderemail sender email
* @param string $subject subject
* @param string $body body
* @param boolean $andop and operator
* @param boolean $salutation insert salutation
* @return number number of mails
* @access public
* @since 2004-07-10
* @author Christian Ehret <chris@uffbasse.de>
*/
function send($cats, $sender, $senderemail, $subject, $body, $andop, $salutation)
{
global $gDatabase, $tbl_guest, $tbl_guestcat, $tbl_guest_guestcat, $tbl_guest_address, $tbl_address, $errorhandler, $request;
set_time_limit(0);
$num = 0;
if ($andop) {
$query = "SELECT t0.pk_fk_guest_id, a.email, g.firstname, g.lastname\n\t\t\t\t FROM ";
for ($i = 0; $i < count($cats); $i++) {
$query .= "{$tbl_guest_guestcat} t{$i} ";
if ($i !== count($cats) - 1) {
$query .= ", ";
}
}
$query .= "LEFT JOIN {$tbl_guest_address} ga ON t0.pk_fk_guest_id = ga.pk_fk_guest_id AND\n\t\t\t\t \t\t\t\t\t\t\t ga.default_address = 'Y'\t\t\n\t\t\t\t LEFT JOIN {$tbl_address} a ON ga.pk_fk_address_id = a.pk_address_id \n\t\t\t\t\t LEFT JOIN {$tbl_guest} g ON t0.pk_fk_guest_id = g.pk_guest_id ";
$query .= "WHERE ";
for ($i = 0; $i < count($cats); $i++) {
$query .= "t{$i}.pk_fk_guestcat_id = {$cats[$i]} ";
if ($i > 0) {
$query .= "AND t0.pk_fk_guest_id = t{$i}.pk_fk_guest_id ";
}
if ($i !== count($cats) - 1) {
$query .= "AND ";
}
}
$query .= "AND NOT ISNULL( a.email ) ";
} else {
$query = "SELECT DISTINCT ggc.pk_fk_guest_id, a.email, g.firstname, g.lastname \n\t\t\t\t FROM {$tbl_guest_guestcat} ggc\n\t\t\t\t LEFT JOIN {$tbl_guest_address} ga ON ggc.pk_fk_guest_id = ga.pk_fk_guest_id AND\n\t\t\t\t \t\t\t\t\t\t\t ga.default_address = 'Y'\t\t\n\t\t\t\t LEFT JOIN {$tbl_address} a ON ga.pk_fk_address_id = a.pk_address_id \n\t\t\t\t LEFT JOIN {$tbl_guest} g ON ggc.pk_fk_guest_id = g.pk_guest_id\t\t \n\t\t\t\t WHERE (";
for ($i = 0; $i < count($cats); $i++) {
$query .= "ggc.pk_fk_guestcat_id = " . $cats[$i];
if ($i !== count($cats) - 1) {
$query .= " OR ";
}
}
$query .= ") AND NOT ISNULL( a.email ) ";
}
$result = MetabaseQuery($gDatabase, $query);
if (!$result) {
$errorhandler->display('SQL', 'Newsletter::send()', $query);
} else {
$row = 0;
if ($salutation) {
include_once "guestclass.inc.php";
$guestclass = new Guest();
}
for ($row = 0; ($eor = MetabaseEndOfResult($gDatabase, $result)) == 0; ++$row) {
if ($salutation) {
$salutationtxt = $guestclass->getGreeting(MetabaseFetchResult($gDatabase, $result, $row, 0)) . "\n";
} else {
$salutationtxt = "";
}
$files = $_FILES;
$message = $salutationtxt;
$message .= $body;
$email = MetabaseFetchResult($gDatabase, $result, $row, 1);
$firstname = MetabaseFetchResult($gDatabase, $result, $row, 2);
$lastname = MetabaseFetchResult($gDatabase, $result, $row, 3);
$from = $sender . " <" . $senderemail . ">";
$recipient = $firstname . " " . $lastname . " <" . $email . ">";
$mime_boundary = "<<<:" . md5(uniqid(mt_rand(), 1));
$content = "";
$header = "From: {$from}\r\n";
$header .= "Reply-To: {$from}\r\n";
$header .= "X-Priority: 3 (Normal)\r\n";
$header .= "X-Mailer: PHP/" . phpversion() . "\r\n";
$header .= "MIME-Version: 1.0\r\n";
if (is_array($files)) {
$header .= "Content-Type: multipart/mixed;\r\n";
$header .= " boundary=\"" . $mime_boundary . "\"\r\n";
$content = "This is a multi-part message in MIME format.\r\n\r\n";
$content .= "--" . $mime_boundary . "\r\n";
}
$content .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\n";
$content .= "Content-Transfer-Encoding: 8bit\r\n\r\n";
$content .= "{$message}\r\n\r\n";
if (is_array($files)) {
$content .= "--" . $mime_boundary . "\r\n";
foreach ($files as $filename => $filelocation) {
$filename = $filelocation['name'];
$filelocation = $filelocation['tmp_name'];
if (is_readable($filelocation)) {
$data = chunk_split(base64_encode(implode("", file($filelocation))));
$content .= "Content-Disposition: attachment;\r\n";
if (!function_exists("mime_content_type")) {
//.........這裏部分代碼省略.........