Exemplo n.º 1
0
function mod_guestbook()
{
    require_once BASE_DIR . '/functions/func.modulglobals.php';
    set_modul_globals('guestbook');
    require_once BASE_DIR . '/modules/guestbook/class.guest.php';
    $Guest = new Guest();
    $Guest->guestbookShow("standalone");
}
Exemplo n.º 2
0
/**
* 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 <*****@*****.**> 
*/
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&lt;" . MetabaseFetchResult($gDatabase, $result, 0, 15) . "&gt;?subject={$bookingtype}" . "&body=" . rawurlencode($body);
        }
        return $str;
    }
}
 /**
  * Log statistics on navigation (resolution, plugins, etc.)
  */
 protected function processNavigationStats()
 {
     $id_guest = (int) Tools::getValue('id_guest');
     if (sha1($id_guest . _COOKIE_KEY_) != $this->param_token) {
         die;
     }
     $guest = new Guest((int) substr($_POST['id_guest'], 0, 10));
     $guest->javascript = true;
     $guest->screen_resolution_x = (int) substr($_POST['screen_resolution_x'], 0, 5);
     $guest->screen_resolution_y = (int) substr($_POST['screen_resolution_y'], 0, 5);
     $guest->screen_color = (int) substr($_POST['screen_color'], 0, 3);
     $guest->sun_java = (int) substr($_POST['sun_java'], 0, 1);
     $guest->adobe_flash = (int) substr($_POST['adobe_flash'], 0, 1);
     $guest->adobe_director = (int) substr($_POST['adobe_director'], 0, 1);
     $guest->apple_quicktime = (int) substr($_POST['apple_quicktime'], 0, 1);
     $guest->real_player = (int) substr($_POST['real_player'], 0, 1);
     $guest->windows_media = (int) substr($_POST['windows_media'], 0, 1);
     $guest->update();
 }
 public function setPhpCookieData()
 {
     if (!isset($_COOKIE['id_guest'])) {
         if (!isset($this->context->cookie->id_guest)) {
             Guest::setNewGuest($this->context->cookie);
         }
         setcookie('id_guest', $this->context->cookie->id_guest, time() + 86400, "/");
     } else {
         $this->context->cookie->id_guest = $_COOKIE['id_guest'];
         setcookie('id_guest', $this->context->cookie->id_guest, time() + 86400, "/");
     }
     $guest = new Guest($this->context->cookie->id_guest);
     if (!isset($_COOKIE['id_cart']) && !isset($this->context->cart->id)) {
         $cart = new Cart();
         $cart->recyclable = 0;
         $cart->gift = 0;
         $cart->id_shop = (int) $this->context->shop->id;
         $cart->id_lang = ($id_lang = (int) Tools::getValue('id_lang')) ? $id_lang : Configuration::get('PS_LANG_DEFAULT');
         $cart->id_currency = ($id_currency = (int) Tools::getValue('id_currency')) ? $id_currency : Configuration::get('PS_CURRENCY_DEFAULT');
         $cart->id_address_delivery = 0;
         $cart->id_address_invoice = 0;
         $cart->id_currency = Configuration::get('PS_CURRENCY_DEFAULT');
         $cart->id_guest = (int) $this->context->cookie->id_guest;
         $cart->setNoMultishipping();
         $cart->save();
         $this->context->cart = $cart;
         $this->context->cookie->id_cart = $cart->id;
         setcookie('id_cart', $cart->id, time() + 86400, "/");
     } else {
         $cart = new Cart((int) $_COOKIE['id_cart']);
         $this->context->cart = $cart;
         $this->context->cookie->id_cart = $cart->id;
         setcookie('id_cart', $cart->id, time() + 86400, "/");
     }
     $customer = new Customer();
     $customer->id_gender = 0;
     $customer->id_default_group = 1;
     $customer->outstanding_allow_amount = 0;
     $customer->show_public_prices = 0;
     $customer->max_payment_days = 0;
     $customer->active = 1;
     $customer->is_guest = 0;
     $customer->deleted = 0;
     $customer->logged = 0;
     $customer->id_guest = $this->context->cookie->id_guest;
     $this->context->customer = $customer;
 }
Exemplo n.º 5
0
 public function register()
 {
     $data['message1'] = "";
     $data['message2'] = "";
     $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|max_length[60]|xxs_clean');
     $this->form_validation->set_rules('firstname', 'First name', 'trim|required|max_length[30]|min_length[2]');
     $this->form_validation->set_rules('lastname', 'Last name', 'trim|required|max_length[30]|min_length[2]');
     $this->form_validation->set_rules('passwd', 'Password', 'trim|required|matches[cnfpasswd]|max_length[16]|min_length[5]|md5');
     $this->form_validation->set_rules('cnfpasswd', 'Confirm password', 'trim|required|max_length[16]|md5');
     if ($this->form_validation->run() == TRUE) {
         if (ctype_alpha($this->input->post('firstname')) && ctype_alpha($this->input->post('lastname'))) {
             $user = new User_info();
             $user->user_email = $this->input->post('email');
             $user->user_name = $this->input->post('email');
             $user->password = $this->input->post('passwd');
             $user->first_name = $this->input->post('firstname');
             $user->last_name = $this->input->post('lastname');
             $user->verify_code = mt_rand(999999, 99999999);
             if ($user->register()) {
                 /**********Send email verification**************/
                 Guest::sendMail($user->email, $user->first_name, $user->verify_code);
                 Guest::setSession($user->user_email);
                 Guest::recordLoginEvent("Successful", $user->user_email);
                 $url = base_url() . "user/index/";
                 redirect($url, 'Location');
             } else {
                 $data['message1'] = "Email already registered.";
                 $data['message2'] = "retry";
             }
         } else {
             $data['message1'] = "First & Last Name must be valid.";
             $data['message2'] = "retry";
         }
     } else {
         if (isset($_POST['email'])) {
             $data['message2'] = "retry";
         }
     }
     $this->load->view('guest/header', $data);
     $this->load->view('guest/register', $data);
     $this->load->view('guest/footer', $data);
 }
Exemplo n.º 6
0
 public static function setNewGuest($cookie)
 {
     $guest = new Guest(isset($cookie->id_customer) ? Guest::getFromCustomer((int) $cookie->id_customer) : null);
     $guest->userAgent();
     $guest->save();
     $cookie->id_guest = (int) $guest->id;
 }
Exemplo n.º 7
0
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2011 PrestaShop SA
*  @version  Release: $Revision: 1.4 $
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
if (!isset($_POST['token']) or !isset($_POST['type'])) {
    die;
}
include dirname(__FILE__) . '/config/config.inc.php';
if ($_POST['type'] == 'navinfo') {
    if (sha1($_POST['id_guest'] . _COOKIE_KEY_) != $_POST['token']) {
        die;
    }
    $guest = new Guest((int) $_POST['id_guest']);
    $guest->javascript = true;
    $guest->screen_resolution_x = (int) $_POST['screen_resolution_x'];
    $guest->screen_resolution_y = (int) $_POST['screen_resolution_y'];
    $guest->screen_color = (int) $_POST['screen_color'];
    $guest->sun_java = (int) $_POST['sun_java'];
    $guest->adobe_flash = (int) $_POST['adobe_flash'];
    $guest->adobe_director = (int) $_POST['adobe_director'];
    $guest->apple_quicktime = (int) $_POST['apple_quicktime'];
    $guest->real_player = (int) $_POST['real_player'];
    $guest->windows_media = (int) $_POST['windows_media'];
    $guest->update();
} elseif ($_POST['type'] == 'pagetime') {
    if (sha1($_POST['id_connections'] . $_POST['id_page'] . $_POST['time_start'] . _COOKIE_KEY_) != $_POST['token']) {
        die;
    }
Exemplo n.º 8
0
 public static function setNewGuest($cookie)
 {
     $guest = new Guest(isset($cookie->id_customer) ? Guest::getFromCustomer((int) $cookie->id_customer) : null);
     $guest->userAgent();
     if ($guest->id_operating_system or $guest->id_web_browser) {
         $guest->save();
         $cookie->id_guest = (int) $guest->id;
     }
 }
Exemplo n.º 9
0
    /**
     * 
     * @param string : lastname
     * @param string : firstname
     * @param int : gender
     * @param string : email
     * @param string : phone number
     * @param string : language
     * @param int : timeZone
     * @param int : user id, not used
     */
    function profileRename($lastname, $firstname, $gender, $email, $phone, $language, $timeZone, $id = 0)
    {
        $link = Link::get_link('domoleaf');
        if ($gender != 1) {
            $gender = 0;
        }
        $langList = Guest::language();
        if (empty($langList[$language])) {
            $language = $this->getLanguage();
        }
        if (empty($timeZone) || !($timeZone > 0 && $timeZone < 42)) {
            $timeZone = 1;
        }
        $sql = 'UPDATE mcuser
		        SET lastname= :lastname,
		            firstname= :firstname,
		            gender= :gender,
		            mcuser_mail= :email,
		            phone= :phone,
		            language= :language,
					timezone= :timezone
		        WHERE mcuser_id=:user_id';
        $req = $link->prepare($sql);
        $req->bindValue(':lastname', $lastname, PDO::PARAM_STR);
        $req->bindValue(':firstname', $firstname, PDO::PARAM_STR);
        $req->bindValue(':gender', $gender, PDO::PARAM_INT);
        $req->bindValue(':email', $email, PDO::PARAM_STR);
        $req->bindValue(':phone', $phone, PDO::PARAM_STR);
        $req->bindValue(':language', $language, PDO::PARAM_STR);
        $req->bindValue(':timezone', $timeZone, PDO::PARAM_INT);
        $req->bindValue(':user_id', $this->getId(), PDO::PARAM_INT);
        $req->execute() or die(error_log(serialize($req->errorInfo())));
    }
Exemplo n.º 10
0
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Show guest documents
* 
* Guest
* 
* @since 2004-06-05
* @author Christian Ehret <*****@*****.**> 
*/
$smartyType = "www";
include_once "../includes/default.inc.php";
$auth->is_authenticated();
include_once 'guestclass.inc.php';
$guest = new Guest();
$smarty->assign("tpl_title", "Gast bearbeiten/anlegen");
if ($request->GetVar('type', 'get') == "edit") {
    $smarty->assign('tpl_nav', 'gast');
    $smarty->assign('tpl_type', 'edit');
} else {
    $smarty->assign('tpl_nav', 'showgast');
    $smarty->assign('tpl_type', 'show');
}
$smarty->assign('tpl_subnav', 'documents');
if ($request->GetVar('guestid', 'get') !== $request->undefined) {
    $guestid = $request->GetVar('guestid', 'get');
    $smarty->assign('tpl_guestid', $guestid);
    if ($request->GetVar('showall', 'get') == 'true') {
        $number = 0;
    } else {
Exemplo n.º 11
0
        exit('Error: Wrong parameter type for albumID!');
    }
    if (isset($_POST['photoID']) && preg_match('/^[0-9]{14}$/', $_POST['photoID']) !== 1) {
        exit('Error: Wrong parameter type for photoID!');
    }
    # Function for switch statement
    if (isset($_POST['function'])) {
        $fn = $_POST['function'];
    } else {
        $fn = $_GET['function'];
    }
    if (isset($_SESSION['login']) && $_SESSION['login'] === true && (isset($_SESSION['identifier']) && $_SESSION['identifier'] === $settings['identifier'])) {
        ###
        # Admin Access
        # Full access to Lychee. Only with correct password/session.
        ###
        define('LYCHEE_ACCESS_ADMIN', true);
        $admin = new Admin($database, $plugins, $settings);
        $admin->check($fn);
    } else {
        ###
        # Guest Access
        # Access to view all public folders and photos in Lychee.
        ###
        define('LYCHEE_ACCESS_GUEST', true);
        $guest = new Guest($database, $plugins, $settings);
        $guest->check($fn);
    }
} else {
    exit('Error: Called function not found!');
}
Exemplo n.º 12
0
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Manage guest categories
* 
* Guest
* 
* @since 2004-07-24
* @author Christian Ehret <*****@*****.**> 
*/
$smartyType = "www";
include_once "../includes/default.inc.php";
$auth->is_authenticated();
include_once 'guestclass.inc.php';
include_once 'guestcategoryclass.inc.php';
$guest = new Guest();
$gcategory = new GuestCategory();
$smarty->assign("tpl_title", "Gast bearbeiten/anlegen");
$smarty->assign('tpl_nav', 'gast');
$smarty->assign('tpl_subnav', 'cat');
$smarty->assign('tpl_type', 'editgast');
if ($request->GetVar('guestid', 'get') !== $request->undefined) {
    $guestid = $request->GetVar('guestid', 'get');
} elseif ($request->GetVar('frm_gastid', 'post') !== $request->undefined) {
    $guestid = $request->GetVar('frm_gastid', 'post');
} else {
    // noch kein Gast angelegt
    header("Location: " . $wwwroot . "editgast.php");
    exit;
}
if ($request->GetVar('frm_changeAction', 'post') == 'add') {
Exemplo n.º 13
0
 public function __construct()
 {
     parent::__construct();
     $this->load->helper('article');
     saveVisitor();
 }
Exemplo n.º 14
0
 public function go()
 {
     try {
         // select visitor type (user or guest)
         if (self::CheckSession()) {
             $visitor = new User($_SESSION['user']['name']);
         } elseif (self::checkCookies()) {
             $visitor = new User($_COOKIE['name']);
         } else {
             $visitor = new Guest();
         }
         // select action
         $action = $visitor->getAction();
         // perform action
         if ($action) {
             switch ($action) {
                 case "login":
                     if ($visitor->auth()) {
                         $visitor = new User($visitor->getName());
                         $visitor->login();
                     }
                     break;
                 case "register":
                     if ($visitor->register()) {
                         $visitor = new User($visitor->getName());
                         $visitor->login();
                     }
                     break;
                 case "logout":
                     $visitor->logout();
                     break;
                 case "delete":
                     $visitor->remove();
                     break;
             }
             $this->reload();
         }
         // show html
         if ($visitor instanceof User) {
             $this->templateVars['name'] = $visitor->getName();
             $this->templateVars['id'] = $visitor->getId();
             $this->templateVars['regdate'] = $visitor->getRegDate();
             $this->templateVars['lastvisit'] = $visitor->getLastVisit();
             $this->showTemplate('inner');
         } elseif ($visitor instanceof Guest) {
             if (isset($_SESSION['message'])) {
                 $this->templateVars['message'] = $_SESSION['message'];
                 unset($_SESSION['message']);
             }
             if (isset($_SESSION['guest']['entered_name'])) {
                 $this->templateVars['entered_name'] = $_SESSION['guest']['entered_name'];
                 unset($_SESSION['guest']['entered_name']);
             }
             $this->showTemplate('login');
         } else {
             throw new \Exception();
         }
     } catch (\Exception $e) {
         $_SESSION['message'] = $e->getMessage();
         $this->reload();
     }
 }
Exemplo n.º 15
0
 /**
  * Hook Header : Add Media CSS & JS
  *
  * @param array $params list of specific data
  */
 public function hookHeader($params)
 {
     if (!isset($params['cookie']->id_guest)) {
         Guest::setNewGuest($params['cookie']);
     }
     // Check if prediggo module can be executed in this page
     if ($this->oPrediggoCallController->isPageAccessible() || $this->oPrediggoCallController->getPageName() == 'prediggo_search' || $this->oPrediggoSearchConfig->search_active) {
         Tools::addCSS($this->_path . 'css/' . $this->name . '.css', 'all');
         Tools::addJS(array($this->_path . 'js/prediggo_autocomplete.js', $this->_path . 'js/' . $this->name . '.js'));
     }
 }
Exemplo n.º 16
0
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Show guest data
* 
* Guest
* 
* @since 2004-06-05
* @author Christian Ehret <*****@*****.**> 
*/
$smartyType = "www";
include_once "../includes/default.inc.php";
$auth->is_authenticated();
include_once 'guestclass.inc.php';
$guest = new Guest();
$smarty->assign("tpl_title", "Gast bearbeiten");
$smarty->assign('tpl_nav', 'showgast');
$smarty->assign('tpl_subnav', 'hauptgast');
$smarty->assign('tpl_type', 'showgast');
// select Countries
$smarty->assign("tpl_countries", $guest->GetCountries());
// select salutation
$smarty->assign("tpl_salutation", $guest->getSalutation());
if ($request->GetVar('edit', 'get') !== $request->undefined) {
    $smarty->assign('tpl_editmode', true);
}
if ($request->GetVar('guestid', 'get') !== $request->undefined) {
    $smarty->assign('tpl_gast', $guest->getGuest($request->GetVar('guestid', 'get')));
} elseif ($request->GetVar('frm_guestid', 'post') !== $request->undefined) {
    $guestid = $guest->saveupdateguest();
Exemplo n.º 17
0
 public function get_guests()
 {
     $result = array();
     foreach (Guest::select_all() as $r) {
         $guest = new Guest();
         $guest->hydrate();
         $guest->set_value("email", $r["email"]);
         $result[] = $guest;
     }
     return $result;
 }
Exemplo n.º 18
0
"/>
    <div class="modal-body">
        <div class="form-group">
            <label for="name">Access Code
                <input class="form-control" type="text" id="code" name="code" value="<?php 
echo $originalOption->Code;
?>
"/>
            </label>
        </div>
        <div class="form-group">
            <label>Staff</label>
            <select class="form-control" name="guestid" id="guestid">

                <?php 
$access = new Guest($db);
$stmt = $access->selectAll();
while ($row_access = $stmt->fetch(PDO::FETCH_ASSOC)) {
    extract($row_access);
    if ($originalOption->Guest_Id == $Id) {
        echo "<option value='{$Id}' selected='selected'>{$FirstName} {$LastName}</option>";
    } else {
        echo "<option value='{$Id}'>{$FirstName} {$LastName}</option>";
    }
}
?>
            </select>

        </div>
    </div>
    <div class="modal-footer">
Exemplo n.º 19
0
 /**
  * Checks if mobile context is possible
  *
  * @return bool
  * @throws PrestaShopException
  */
 protected function checkMobileContext()
 {
     // Check mobile context
     if (Tools::isSubmit('no_mobile_theme')) {
         Context::getContext()->cookie->no_mobile = true;
         if (Context::getContext()->cookie->id_guest) {
             $guest = new Guest(Context::getContext()->cookie->id_guest);
             $guest->mobile_theme = false;
             $guest->update();
         }
     } elseif (Tools::isSubmit('mobile_theme_ok')) {
         Context::getContext()->cookie->no_mobile = false;
         if (Context::getContext()->cookie->id_guest) {
             $guest = new Guest(Context::getContext()->cookie->id_guest);
             $guest->mobile_theme = true;
             $guest->update();
         }
     }
     return isset($_SERVER['HTTP_USER_AGENT']) && isset(Context::getContext()->cookie) && (bool) Configuration::get('PS_ALLOW_MOBILE_DEVICE') && @filemtime(_PS_THEME_MOBILE_DIR_) && !Context::getContext()->cookie->no_mobile;
 }
Exemplo n.º 20
0
<?php

include './php/GuestClass.php';
$guest = new Guest('./data.xml');
$messages = $guest->getMessages();
?>
<html>
	<head>
	<title>Гостевая книга</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link href="style.css" rel="stylesheet" media="all" />
	</head>
	<body>
	<h1>Гостевая книга</h1>	

	<!--<div class="messages" id="messages">-->


		<div class="message_block">
			<div class="add_new_message"><a href="javascript:;">добавить запись</a></div>
		</div>

		<?php 
include './php/template.php';
?>



		<!--<div class="author" id="author">Василий Тёркин 14.10.2015 20:30<a href="javascript:;">редактировать</a><a href="javascript:;">ответить</a></div> 
		
		<div class="message">Internet Explorer до версии 6.0 требует, чтобы <!DOCTYPE> стоял обязательно в первой строке кода. В противном случае браузер переходит в режим совместимости (quirk mode).
Exemplo n.º 21
0
$smartyType = "www";
include_once "../includes/default.inc.php";
$auth->is_authenticated();
include_once 'calendarclass.inc.php';
include_once 'roomclass.inc.php';
include_once 'bookingcategoryclass.inc.php';
include_once 'guestclass.inc.php';
include_once 'bookingclass.inc.php';
$smarty->assign('tpl_children_field0', $request->GetVar('children0', 'session'));
$smarty->assign('tpl_children_field1', $request->GetVar('children1', 'session'));
$smarty->assign('tpl_children_field2', $request->GetVar('children2', 'session'));
$smarty->assign('tpl_children_field3', $request->GetVar('children3', 'session'));
$cal = new Calendar();
$room = new Room();
$bcat = new BookingCategory();
$guest = new Guest();
$book = new Booking();
$navmonth = $request->GetVar('month', 'get');
$navyear = $request->GetVar('year', 'get');
$navstep = $request->GetVar('navstep', 'get');
$bookid = $request->GetVar('bookid', 'get');
if ($navmonth == "") {
    $navmonth = $request->GetVar('frm_navmonth', 'post');
}
if ($navyear == "") {
    $navyear = $request->GetVar('frm_navyear', 'post');
}
if ($navstep == "") {
    $navstep = $request->GetVar('frm_navstep', 'post');
}
if ($bookid == "") {
Exemplo n.º 22
0
    /**
     * 
     * @param string : lastname
     * @param string : firstname
     * @param int : gender
     * @param string : phone number
     * @param string : language
     * @param int : user id, not used
     */
    function profileRename($lastname, $firstname, $gender, $phone, $language, $id = 0)
    {
        $link = Link::get_link('mastercommand');
        if ($gender != 1) {
            $gender = 0;
        }
        $langList = Guest::language();
        if (empty($langList[$language])) {
            $language = $this->getLanguage();
        }
        $sql = 'UPDATE user
		        SET lastname= :lastname,
		            firstname= :firstname,
		            gender= :gender,
		            phone= :phone,
		            language= :language
		        WHERE user_id=:user_id';
        $req = $link->prepare($sql);
        $req->bindValue(':lastname', $lastname, PDO::PARAM_STR);
        $req->bindValue(':firstname', $firstname, PDO::PARAM_STR);
        $req->bindValue(':gender', $gender, PDO::PARAM_INT);
        $req->bindValue(':phone', $phone, PDO::PARAM_STR);
        $req->bindValue(':language', $language, PDO::PARAM_STR);
        $req->bindValue(':user_id', $this->getId(), PDO::PARAM_INT);
        $req->execute() or die(error_log(serialize($req->errorInfo())));
    }
Exemplo n.º 23
0
 public function makeNewLog()
 {
     unset($this->_content['id_customer']);
     unset($this->_content['id_guest']);
     Guest::setNewGuest($this);
     $this->_modified = true;
 }
Exemplo n.º 24
0
<TITLE>クラスのテスト </TITLE>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</HEAD>
<BODY bgcolor="#FFFFFF" text="#000000">
<FONT size="4">クラスのテスト</FONT> 
<BR><BR>
<?php 
class User
{
    private $name = NULL;
    public function print_hello()
    {
        print $this->name;
        print "さん、こんにちは!<BR>";
    }
}
class Guest extends User
{
    private $name = "ゲスト";
    public function print_hello()
    {
        print $this->name;
        print "さん、はじめまして!<BR>";
    }
}
$newuser = new Guest();
$newuser->print_hello();
?>
</BODY>
</HTML>
Exemplo n.º 25
0
    public function hookAuthentication($params)
    {
        // Update or merge the guest with the customer id (login and account creation)
        $guest = new Guest($params['cookie']->id_guest);
        $result = Db::getInstance()->getRow('
		SELECT `id_guest`
		FROM `' . _DB_PREFIX_ . 'guest`
		WHERE `id_customer` = ' . (int) $params['cookie']->id_customer);
        if ((int) $result['id_guest']) {
            // The new guest is merged with the old one when it's connecting to an account
            $guest->mergeWithCustomer($result['id_guest'], $params['cookie']->id_customer);
            $params['cookie']->id_guest = $guest->id;
        } else {
            // The guest is duplicated if it has multiple customer accounts
            $method = $guest->id_customer ? 'add' : 'update';
            $guest->id_customer = $params['cookie']->id_customer;
            $guest->{$method}();
        }
    }
Exemplo n.º 26
0
        }
    }
}
class Guest extends Person
{
    public $indianPhoneNumber = "";
    function setIndianPhoneNumber($phoneNumber)
    {
        if (isPhoneNumber($phoneNumber . '0')) {
            $this->indianPhoneNumber = $phoneNumber;
        } else {
            echo "Please provide valid Phone Number", "<br>";
        }
    }
}
$indian = new Guest();
$indian->name = "Daniel";
$indian->email = "*****@*****.**";
$indian->setIndianPhoneNumber("8008900910");
$indian->setPhoneNumber("80089009101");
echo $indian->name, "<br>";
echo $indian->email, "<br>";
echo $indian->phoneNumber, "<br>";
echo $indian->indianPhoneNumber, "<br>";
$person = new Person();
$person->setIndianPhoneNumber("01769757222");
class MyString
{
    public $value = "initial value";
    function myStrLen()
    {
Exemplo n.º 27
0
 function can($feature)
 {
     $user = $this->user(false) ?: Guest::singleton();
     return (bool) $user->can($feature);
 }
Exemplo n.º 28
0
 public function preProcess()
 {
     parent::preProcess();
     if (self::$cookie->isLogged() and !Tools::isSubmit('ajax')) {
         Tools::redirect('my-account.php');
     }
     if (Tools::getValue('create_account')) {
         $create_account = 1;
         self::$smarty->assign('email_create', 1);
     }
     if (Tools::isSubmit('SubmitCreate')) {
         if (!Validate::isEmail($email = Tools::getValue('email_create')) or empty($email)) {
             $this->errors[] = Tools::displayError('Invalid e-mail address');
         } elseif (Customer::customerExists($email, false, false)) {
             $this->errors[] = Tools::displayError('An account is already registered with this e-mail, please fill in the password or request a new one.');
             $_POST['email'] = $_POST['email_create'];
             unset($_POST['email_create']);
         } else {
             $create_account = 1;
             self::$smarty->assign('email_create', Tools::safeOutput($email));
             $_POST['email'] = $email;
         }
     }
     if (Tools::isSubmit('submitAccount') or Tools::isSubmit('submitGuestAccount')) {
         $create_account = 1;
         if (Tools::isSubmit('submitAccount')) {
             self::$smarty->assign('email_create', 1);
         }
         /* New Guest customer */
         if (!Tools::getValue('is_new_customer', 1) and !Configuration::get('PS_GUEST_CHECKOUT_ENABLED')) {
             $this->errors[] = Tools::displayError('You cannot create a guest account.');
         }
         if (!Tools::getValue('is_new_customer', 1)) {
             $_POST['passwd'] = md5(time() . _COOKIE_KEY_);
         }
         if (isset($_POST['guest_email']) and $_POST['guest_email']) {
             $_POST['email'] = $_POST['guest_email'];
         }
         /* Preparing customer */
         $customer = new Customer();
         $lastnameAddress = $_POST['lastname'];
         $firstnameAddress = $_POST['firstname'];
         $_POST['lastname'] = $_POST['customer_lastname'];
         $_POST['firstname'] = $_POST['customer_firstname'];
         if (!Tools::getValue('phone') and !Tools::getValue('phone_mobile')) {
             $this->errors[] = Tools::displayError('You must register at least one phone number');
         }
         if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) and !(Tools::getValue('months') == '' and Tools::getValue('days') == '' and Tools::getValue('years') == '')) {
             $this->errors[] = Tools::displayError('Invalid date of birth');
         }
         $customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
         $this->errors = array_unique(array_merge($this->errors, $customer->validateControler()));
         /* Preparing address */
         $address = new Address();
         $_POST['lastname'] = $lastnameAddress;
         $_POST['firstname'] = $firstnameAddress;
         $address->id_customer = 1;
         $this->errors = array_unique(array_merge($this->errors, $address->validateControler()));
         /* US customer: normalize the address */
         if ($address->id_country == Country::getByIso('US') && Configuration::get('PS_TAASC')) {
             include_once _PS_TAASC_PATH_ . 'AddressStandardizationSolution.php';
             $normalize = new AddressStandardizationSolution();
             $address->address1 = $normalize->AddressLineStandardization($address->address1);
             $address->address2 = $normalize->AddressLineStandardization($address->address2);
         }
         if (!($country = new Country($address->id_country)) || !Validate::isLoadedObject($country)) {
             $this->errors[] = Tools::displayError('Country cannot be loaded with address->id_country');
         }
         $postcode = Tools::getValue('postcode');
         /* Check zip code format */
         if ($country->zip_code_format && !$country->checkZipCode($postcode)) {
             $this->errors[] = '<strong>' . Tools::displayError('Zip/ Postal code') . '</strong> ' . Tools::displayError('is invalid.') . '<br />' . Tools::displayError('Must be typed as follows:') . ' ' . str_replace('C', $country->iso_code, str_replace('N', '0', str_replace('L', 'A', $country->zip_code_format)));
         } elseif (empty($postcode) && $country->need_zip_code) {
             $this->errors[] = '<strong>' . Tools::displayError('Zip/ Postal code') . '</strong> ' . Tools::displayError('is required.');
         } elseif ($postcode && !Validate::isPostCode($postcode)) {
             $this->errors[] = '<strong>' . Tools::displayError('Zip/ Postal code') . '</strong> ' . Tools::displayError('is invalid.');
         }
         if (Country::isNeedDniByCountryId($address->id_country) and (!Tools::getValue('dni') or !Validate::isDniLite(Tools::getValue('dni')))) {
             $this->errors[] = Tools::displayError('Identification number is incorrect or has already been used.');
         } elseif (!Country::isNeedDniByCountryId($address->id_country)) {
             $address->dni = NULL;
         }
         if (!count($this->errors)) {
             if (Customer::customerExists(Tools::getValue('email'), false, Configuration::get('PS_GUEST_CHECKOUT_ENABLED') && Tools::getValue('is_new_customer') == 0)) {
                 $this->errors[] = Tools::displayError('An account is already registered with this e-mail, please fill in the password or request a new one.');
             }
             if (Tools::isSubmit('newsletter')) {
                 $customer->ip_registration_newsletter = pSQL(Tools::getRemoteAddr());
                 $customer->newsletter_date_add = pSQL(date('Y-m-d H:i:s'));
             }
             if (!count($this->errors)) {
                 $country = new Country((int) $address->id_country, _PS_LANG_DEFAULT_);
                 if (!$country || !Validate::isLoadedObject($country)) {
                     die(Tools::displayError());
                 }
                 if ((int) $country->contains_states && !(int) $address->id_state) {
                     $this->errors[] = Tools::displayError('This country requires a state selection.');
                 } else {
                     $customer->active = 1;
                     /* New Guest customer */
                     if (Tools::isSubmit('is_new_customer')) {
                         $customer->is_guest = !Tools::getValue('is_new_customer', 1);
                     } else {
                         $customer->is_guest = 0;
                     }
                     if (!$customer->add()) {
                         $this->errors[] = Tools::displayError('An error occurred while creating your account.');
                     } else {
                         $address->id_customer = (int) $customer->id;
                         if (!$address->add()) {
                             $this->errors[] = Tools::displayError('An error occurred while creating your address.');
                         } else {
                             if (!$customer->is_guest) {
                                 if (!Mail::Send((int) self::$cookie->id_lang, 'account', Mail::l('Welcome!', (int) self::$cookie->id_lang), array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
                                     $this->errors[] = Tools::displayError('Cannot send email');
                                 }
                             }
                             self::$smarty->assign('confirmation', 1);
                             self::$cookie->id_customer = (int) $customer->id;
                             self::$cookie->customer_lastname = $customer->lastname;
                             self::$cookie->customer_firstname = $customer->firstname;
                             self::$cookie->passwd = $customer->passwd;
                             self::$cookie->logged = 1;
                             self::$cookie->email = $customer->email;
                             self::$cookie->is_guest = !Tools::getValue('is_new_customer', 1);
                             /* Update cart address */
                             self::$cart->secure_key = $customer->secure_key;
                             self::$cart->id_address_delivery = Address::getFirstCustomerAddressId((int) $customer->id);
                             self::$cart->id_address_invoice = Address::getFirstCustomerAddressId((int) $customer->id);
                             self::$cart->update();
                             Module::hookExec('createAccount', array('_POST' => $_POST, 'newCustomer' => $customer));
                             if (Tools::isSubmit('ajax')) {
                                 $return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => true, 'id_customer' => (int) self::$cookie->id_customer, 'id_address_delivery' => self::$cart->id_address_delivery, 'id_address_invoice' => self::$cart->id_address_invoice, 'token' => Tools::getToken(false));
                                 die(Tools::jsonEncode($return));
                             }
                             if ($back = Tools::getValue('back')) {
                                 Tools::redirect($back);
                             }
                             Tools::redirect('my-account.php');
                         }
                     }
                 }
             }
         }
         if (sizeof($this->errors)) {
             if (!Tools::getValue('is_new_customer')) {
                 unset($_POST['passwd']);
             }
             if (Tools::isSubmit('ajax')) {
                 $return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'isSaved' => false, 'id_customer' => 0);
                 die(Tools::jsonEncode($return));
             }
         }
     }
     if (Tools::isSubmit('SubmitLogin')) {
         Module::hookExec('beforeAuthentication');
         $passwd = trim(Tools::getValue('passwd'));
         $email = trim(Tools::getValue('email'));
         if (empty($email)) {
             $this->errors[] = Tools::displayError('E-mail address required');
         } elseif (!Validate::isEmail($email)) {
             $this->errors[] = Tools::displayError('Invalid e-mail address');
         } elseif (empty($passwd)) {
             $this->errors[] = Tools::displayError('Password is required');
         } elseif (Tools::strlen($passwd) > 32) {
             $this->errors[] = Tools::displayError('Password is too long');
         } elseif (!Validate::isPasswd($passwd)) {
             $this->errors[] = Tools::displayError('Invalid password');
         } else {
             $customer = new Customer();
             $authentication = $customer->getByEmail(trim($email), trim($passwd));
             if (!$authentication or !$customer->id) {
                 $this->errors[] = Tools::displayError('Authentication failed');
             } else {
                 self::$cookie->id_compare = isset(self::$cookie->id_compare) ? self::$cookie->id_compare : CompareProduct::getIdCompareByIdCustomer($customer->id);
                 self::$cookie->id_customer = (int) $customer->id;
                 self::$cookie->customer_lastname = $customer->lastname;
                 self::$cookie->customer_firstname = $customer->firstname;
                 self::$cookie->logged = 1;
                 self::$cookie->is_guest = $customer->isGuest();
                 self::$cookie->passwd = $customer->passwd;
                 self::$cookie->email = $customer->email;
                 if (Configuration::get('PS_CART_FOLLOWING') and (empty(self::$cookie->id_cart) or Cart::getNbProducts(self::$cookie->id_cart) == 0) and $id_cart = (int) Cart::lastNoneOrderedCart((int) $customer->id)) {
                     self::$cart = new Cart($id_cart);
                 } else {
                     self::$cart->id_carrier = 0;
                     self::$cart->id_address_delivery = Address::getFirstCustomerAddressId((int) $customer->id);
                     self::$cart->id_address_invoice = Address::getFirstCustomerAddressId((int) $customer->id);
                 }
                 self::$cart->id_customer = (int) $customer->id;
                 // If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated
                 self::$cart->secure_key = $customer->secure_key;
                 if ($id_guest = (int) Guest::getFromCustomer(self::$cart->id_customer)) {
                     self::$cart->id_guest = $id_guest;
                 }
                 self::$cart->save();
                 self::$cookie->id_cart = (int) self::$cart->id;
                 self::$cookie->update();
                 Module::hookExec('authentication');
                 if (!Tools::isSubmit('ajax')) {
                     if ($back = Tools::getValue('back')) {
                         Tools::redirect($back);
                     }
                     Tools::redirect('my-account.php');
                 }
             }
         }
         if (Tools::isSubmit('ajax')) {
             $return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'token' => Tools::getToken(false));
             die(Tools::jsonEncode($return));
         }
     }
     if (isset($create_account)) {
         /* Select the most appropriate country */
         if (isset($_POST['id_country']) and is_numeric($_POST['id_country'])) {
             $selectedCountry = (int) $_POST['id_country'];
         }
         /* FIXME : language iso and country iso are not similar,
         			 * maybe an associative table with country an language can resolve it,
         			 * But for now it's a bug !
         			 * @see : bug #6968
         			 * @link:http://www.prestashop.com/bug_tracker/view/6968/
         			elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
         			{
         				$array = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
         				if (Validate::isLanguageIsoCode($array[0]))
         				{
         					$selectedCountry = Country::getByIso($array[0]);
         					if (!$selectedCountry)
         						$selectedCountry = (int)(_PS_COUNTRY_DEFAULT_);
         				}
         			}*/
         if (!isset($selectedCountry)) {
             $selectedCountry = (int) _PS_COUNTRY_DEFAULT_;
         }
         if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
             $countries = Carrier::getDeliveredCountries((int) self::$cookie->id_lang, true, true);
         } else {
             $countries = Country::getCountries((int) self::$cookie->id_lang, true, false, true);
         }
         self::$smarty->assign(array('countries' => $countries, 'sl_country' => isset($selectedCountry) ? $selectedCountry : 0, 'vat_management' => Configuration::get('VATNUMBER_MANAGEMENT')));
         /* Call a hook to display more information on form */
         self::$smarty->assign(array('HOOK_CREATE_ACCOUNT_FORM' => Module::hookExec('createAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Module::hookExec('createAccountTop')));
     }
     /* Generate years, months and days */
     if (isset($_POST['years']) and is_numeric($_POST['years'])) {
         $selectedYears = (int) $_POST['years'];
     }
     $years = Tools::dateYears();
     if (isset($_POST['months']) and is_numeric($_POST['months'])) {
         $selectedMonths = (int) $_POST['months'];
     }
     $months = Tools::dateMonths();
     if (isset($_POST['days']) and is_numeric($_POST['days'])) {
         $selectedDays = (int) $_POST['days'];
     }
     $days = Tools::dateDays();
     self::$smarty->assign(array('years' => $years, 'sl_year' => isset($selectedYears) ? $selectedYears : 0, 'months' => $months, 'sl_month' => isset($selectedMonths) ? $selectedMonths : 0, 'days' => $days, 'sl_day' => isset($selectedDays) ? $selectedDays : 0));
     self::$smarty->assign('newsletter', (int) Module::getInstanceByName('blocknewsletter')->active);
 }
Exemplo n.º 29
0
    $updatedOption->Id = $_POST['id'];
    $updatedOption->FirstName = $_POST['firstname'];
    $updatedOption->LastName = $_POST['lastname'];
    $updatedOption->Gender = $_POST['gender'];
    $updatedOption->Email = $_POST['email'];
    $updatedOption->Address = $_POST['address'];
    $updatedOption->Suburb_Id = $_POST['suburb'];
    $updatedOption->Rating = $_POST['rating'];
    if ($updatedOption->update() == true) {
        header("location:guests.php");
    } else {
        echo "<script>alert('There was an error updating this item');window.location = 'guests.php' </script>";
    }
}
if (isset($_POST['delete'])) {
    $updatedOption = new Guest($db);
    $updatedOption->Id = $_POST['id'];
    if ($updatedOption->delete() == true) {
        header("location:guests.php");
    } else {
        echo "<script>alert('There was an error deleting this item');window.location = 'guests.php' </script>";
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
Exemplo n.º 30
0
<?php

error_reporting(0);
session_start();
if (!isset($_SESSION['loggedin'])) {
    header("Location: ../index.php");
}
include '../config/database.class.php';
$database = new Database();
$db = $database->getConnection();
include '../objects/guest.class.php';
include '../objects/rating.class.php';
$guest = new Guest($db);
$guest->Id = $_SESSION['id'];
$guest->selectById();
include '../header.php';
?>
<!-- Modal -->
<div class="modal fade" id="myDetails" tabindex="-1" role="dialog" aria-labelledby="memberModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="false">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="memberModalLabel">My Details</h4>
            </div>
            <div class="dash" id="modalData">
            </div>

        </div>
    </div>
</div>