Example #1
0
 /**
  * Returns horizontal banner code
  */
 public static function GetHorizontalBanerCode()
 {
     if (Modules::IsModuleInstalled('adsense')) {
         $activation = strtolower(ModulesSettings::Get('adsense', 'adsense_code_activation'));
         if ($activation == 'horizontal' || $activation == 'all') {
             return ModulesSettings::Get('adsense', 'adsense_code_horizontal');
         }
     }
     return '';
 }
 $b_zipcode = isset($_POST['b_zipcode']) ? prepare_input($_POST['b_zipcode']) : '';
 $b_country = isset($_POST['b_country']) ? prepare_input($_POST['b_country']) : '';
 $b_state = isset($_POST['b_state']) ? prepare_input($_POST['b_state']) : '';
 $phone = isset($_POST['phone']) ? prepare_input($_POST['phone']) : '';
 $fax = isset($_POST['fax']) ? prepare_input($_POST['fax']) : '';
 $email = isset($_POST['email']) ? prepare_input($_POST['email']) : '';
 $url = isset($_POST['url']) ? prepare_input($_POST['url'], false, 'medium') : '';
 $user_name = isset($_POST['user_name']) ? prepare_input($_POST['user_name']) : '';
 $user_password1 = isset($_POST['user_password1']) ? prepare_input($_POST['user_password1']) : '';
 $user_password2 = isset($_POST['user_password2']) ? prepare_input($_POST['user_password2']) : '';
 $agree = isset($_POST['agree']) ? prepare_input($_POST['agree']) : '';
 $user_ip = get_current_ip();
 $focus_field = '';
 $reg_confirmation = ModulesSettings::Get('customers', 'reg_confirmation');
 $image_verification_allow = ModulesSettings::Get('customers', 'image_verification_allow');
 $admin_alert_new_registration = ModulesSettings::Get('customers', 'admin_alert_new_registration');
 $msg_default = draw_message(_ACCOUNT_CREATE_MSG, false);
 $msg = '';
 $account_created = false;
 if ($act == 'create') {
     $captcha_code = isset($_POST['captcha_code']) ? prepare_input($_POST['captcha_code']) : '';
     if ($first_name == '') {
         $msg = draw_important_message(_FIRST_NAME_EMPTY_ALERT, false);
         $focus_field = 'first_name';
     } else {
         if ($last_name == '') {
             $msg = draw_important_message(_LAST_NAME_EMPTY_ALERT, false);
             $focus_field = 'last_name';
         } else {
             if ($birth_date != '' && !check_date($birth_date)) {
                 $msg = draw_important_message(_BIRTH_DATE_VALID_ALERT, false);
<?php

////////////////////////////////////////////////////////////////////////////////
// PayPal Order Notify
// Last modified: 23.02.2012
////////////////////////////////////////////////////////////////////////////////
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if (Modules::IsModuleInstalled('payments')) {
    $mode = ModulesSettings::Get('payments', 'mode');
    if (ModulesSettings::Get('payments', 'is_active') == 'yes') {
        //----------------------------------------------------------------------
        define('LOG_MODE', false);
        define('LOG_TO_FILE', false);
        define('LOG_ON_SCREEN', false);
        define('TEST_MODE', $mode == 'TEST MODE' ? true : false);
        $log_data = '';
        $msg = '';
        $nl = "\n";
        // --- Get PayPal response
        $objPaymentIPN = new PaymentIPN($_REQUEST, 'paypal');
        $status = $objPaymentIPN->GetPaymentStatus();
        $order_number = $objPaymentIPN->GetParameter('custom');
        $transaction_number = $objPaymentIPN->GetParameter('txn_id');
        $payer_status = $objPaymentIPN->GetParameter('payer_status');
        $pp_payment_type = $objPaymentIPN->GetParameter('payment_type');
        $total = $objPaymentIPN->GetParameter('mc_gross');
        // Payment Types   : 0 - Online Order, 1 - PayPal, 2 - 2CO, 3 - Authorize.Net
        // Payment Methods : 0 - Payment Company Account, 1 - Credit Card, 2 - E-Check
        if ($status == 'Completed') {
Example #4
0
    /**
     * 	Draws the login links and logout form
     */
    public function DrawLoginLinks()
    {
        if (Application::Get('preview') == 'yes') {
            return '';
        }
        $menu_index = '0';
        $text_align = Application::Get('lang_dir') == 'ltr' ? 'text-align:left;' : 'text-align:right;padding-right:15px;';
        // ---------------------------------------------------------------------
        // MAIN ADMIN LINKS
        if ($this->IsLoggedInAsAdmin()) {
            draw_block_top(_MENUS . ': [ <a id="lnk_all_open" href="javascript:void(0);" onclick="javascript:toggle_menus(1)">' . _OPEN . '</a> | <a id="lnk_all_close" href="javascript:void(0);" onclick="javascript:toggle_menus(0)">' . _CLOSE . '</a> ]');
            draw_block_bottom();
            draw_block_top(_GENERAL, $menu_index++, 'maximized');
            echo '<ul>';
            echo '<li>' . $this->PrepareLink('home', _HOME) . '</li>';
            if ($this->IsLoggedInAs('owner', 'mainadmin')) {
                echo '<li>' . $this->PrepareLink('settings', _SETTINGS) . '</li>';
            }
            echo '<li>' . $this->PrepareLink('ban_list', _BAN_LIST) . '</li>';
            if ($this->IsLoggedInAs('owner', 'mainadmin')) {
                echo '<li>' . $this->PrepareLink('countries_management', _COUNTRIES) . '</li>';
            }
            echo '<li>' . prepare_permanent_link('index.php?preview=yes', _PREVIEW . ' <img src="images/external_link.gif" alt="" />') . '</li>';
            echo '</ul>';
            draw_block_bottom();
            draw_block_top(_ACCOUNTS_MANAGEMENT, $menu_index++);
            echo '<div class="menu_category">';
            echo '<ul>';
            echo '<li>' . $this->PrepareLink('my_account', _MY_ACCOUNT) . '</li>';
            if (Modules::IsModuleInstalled('customers') && $this->IsLoggedInAs('owner', 'mainadmin')) {
                echo '<li>' . $this->PrepareLink('statistics', _STATISTICS) . '</li>';
            }
            if ($this->IsLoggedInAs('owner')) {
                echo '<li>' . $this->PrepareLink('roles_management', _ROLES_AND_PRIVILEGES, '', '', array('role_privileges_management')) . '</li>';
            }
            echo '</ul>';
            if ($this->IsLoggedInAs('owner', 'mainadmin')) {
                echo '<label>' . _ADMINS_MANAGEMENT . '</label>';
                echo '<ul>';
                echo '<li>' . $this->PrepareLink('admins_management', _ADMINS) . '</li>';
                echo '</ul>';
            }
            if (Modules::IsModuleInstalled('customers') && $this->IsLoggedInAs('owner', 'mainadmin')) {
                echo '<label>' . _CUSTOMERS_MANAGEMENT . '</label>';
                echo '<ul>';
                echo '<li>' . $this->PrepareLink('mod_customers_groups', _CUSTOMER_GROUPS) . '</li>';
                echo '<li>' . $this->PrepareLink('mod_customers_management', _CUSTOMERS) . '</li>';
                echo '</ul>';
            }
            echo '</div>';
            draw_block_bottom();
            if ($this->IsLoggedInAs('owner', 'mainadmin')) {
                draw_block_top(_LISTINGS_MANAGEMENT, $menu_index++);
                echo '<div class="menu_category">';
                if ($this->IsLoggedInAs('owner', 'mainadmin')) {
                    echo '<label>' . _SETTINGS . '</label>';
                    echo '<ul>';
                    echo '<li>' . $this->PrepareLink('mod_listings_settings', _LISTINGS_SETTINGS) . '</li>';
                    echo '<li>' . $this->PrepareLink('mod_listings_locations', _LOCATIONS, '', '', array('mod_listings_sub_locations')) . '</li>';
                    if (Modules::IsModuleInstalled('inquiries')) {
                        echo '<li>' . $this->PrepareLink('mod_listings_integration', _INTEGRATION) . '</li>';
                    }
                    echo '</ul>';
                }
                echo '<label>' . _LISTINGS . '</label>';
                echo '<ul>';
                echo '<li>' . $this->PrepareLink('mod_categories', _CATEGORIES) . '</li>';
                echo '<li>' . $this->PrepareLink('mod_listings_management', _LISTINGS, '', '', array('mod_listings_categories')) . '</li>';
                echo '</ul>';
                echo '</div>';
                draw_block_bottom();
            }
            if (Modules::IsModuleInstalled('payments')) {
                draw_block_top(_PAYMENTS, $menu_index++);
                echo '<ul>';
                if ($this->IsLoggedInAs('owner', 'mainadmin')) {
                    echo '<li>' . $this->PrepareLink('mod_payments_currencies', _CURRENCIES) . '</li>';
                    echo '<li>' . $this->PrepareLink('mod_payments_advertise_plans', _ADVERTISE_PLANS) . '</li>';
                    echo '<li>' . $this->PrepareLink('mod_payments_orders', _ORDERS) . '</li>';
                }
                echo '<li>' . $this->PrepareLink('mod_payments_statistics', _STATISTICS) . '</li>';
                echo '</ul>';
                draw_block_bottom();
            }
            if ($this->HasPrivileges('add_menus') || $this->HasPrivileges('edit_menus') || $this->HasPrivileges('add_pages') || $this->HasPrivileges('edit_pages')) {
                draw_block_top(_MENUS_AND_PAGES, $menu_index++);
                echo '<div class="menu_category">';
                if ($this->HasPrivileges('add_menus') || $this->HasPrivileges('edit_menus')) {
                    echo '<label>' . _MENU_MANAGEMENT . '</label>';
                    echo '<ul>';
                    if ($this->HasPrivileges('add_menus')) {
                        echo '<li>' . $this->PrepareLink('menus_add', _ADD_NEW_MENU) . '</li>';
                    }
                    echo '<li>' . $this->PrepareLink('menus', _EDIT_MENUS, '', '', array('menus_edit')) . '</li>';
                    echo '</ul>';
                }
                if ($this->HasPrivileges('add_pages') || $this->HasPrivileges('edit_pages')) {
                    echo '<label>' . _PAGE_MANAGEMENT . '</label>';
                    echo '<ul>';
                    if ($this->HasPrivileges('add_pages')) {
                        echo '<li>' . $this->PrepareLink('pages_add', _PAGE_ADD_NEW) . '</li>';
                    }
                    if ($this->HasPrivileges('edit_pages')) {
                        echo '<li>' . $this->PrepareLink('pages_edit', _PAGE_EDIT_HOME, 'type=home') . '</li>';
                    }
                    echo '<li>' . $this->PrepareLink('pages', _PAGE_EDIT_PAGES, 'type=general') . '</li>';
                    if ($this->HasPrivileges('edit_pages')) {
                        echo '<li>' . $this->PrepareLink('pages', _PAGE_EDIT_SYS_PAGES, 'type=system') . '</li>';
                    }
                    if ($this->HasPrivileges('edit_pages')) {
                        echo '<li>' . $this->PrepareLink('pages_trash', _TRASH) . '</li>';
                    }
                    echo '</ul>';
                }
                echo '</div>';
                draw_block_bottom();
            }
            draw_block_top(_LANGUAGES_SETTINGS, $menu_index++);
            echo '<ul>';
            if ($this->IsLoggedInAs('owner', 'mainadmin')) {
                echo '<li>' . $this->PrepareLink('languages', _LANGUAGES, '', '', array('languages_add', 'languages_edit')) . '</li>';
            }
            echo '<li>' . $this->PrepareLink('vocabulary', _VOCABULARY, 'filter_by=A') . '</li>';
            echo '</ul>';
            draw_block_bottom();
            if ($this->IsLoggedInAs('owner', 'mainadmin')) {
                draw_block_top(_MASS_MAIL_AND_TEMPLATES, $menu_index++);
                echo '<ul>';
                if ($this->IsLoggedInAs('owner', 'mainadmin')) {
                    echo '<li>' . $this->PrepareLink('email_templates', _EMAIL_TEMPLATES) . '</li>';
                }
                if ($this->IsLoggedInAs('owner', 'mainadmin')) {
                    echo '<li>' . $this->PrepareLink('mass_mail', _MASS_MAIL) . '</li>';
                }
                echo '</ul>';
                draw_block_bottom();
            }
            // MODULES
            $sql = 'SELECT * FROM ' . TABLE_MODULES . ' WHERE is_installed = 1 AND is_system = 0 ORDER BY priority_order ASC';
            $modules = database_query($sql, DATA_AND_ROWS, ALL_ROWS);
            $modules_output = '';
            for ($i = 0; $i < $modules[1]; $i++) {
                $output = '';
                if ($modules[0][$i]['settings_access_by'] == '' || $modules[0][$i]['settings_access_by'] != '' && $this->IsLoggedInAs($modules[0][$i]['settings_access_by'])) {
                    if ($modules[0][$i]['settings_const'] != '') {
                        $output .= '<li>' . $this->PrepareLink($modules[0][$i]['settings_page'], constant($modules[0][$i]['settings_const'])) . '</li>';
                    }
                }
                if ($modules[0][$i]['management_access_by'] == '' || $modules[0][$i]['management_access_by'] != '' && $this->IsLoggedInAs($modules[0][$i]['management_access_by'])) {
                    $management_pages = explode(',', $modules[0][$i]['management_page']);
                    $management_consts = explode(',', $modules[0][$i]['management_const']);
                    $management_pages_total = count($management_pages);
                    for ($j = 0; $j < $management_pages_total; $j++) {
                        if (isset($management_pages[$j]) && isset($management_consts[$j]) && $management_consts[$j] != '') {
                            $output .= '<li>' . $this->PrepareLink($management_pages[$j], constant($management_consts[$j])) . '</li>';
                        }
                    }
                }
                if ($output) {
                    $modules_output .= '<label>' . constant($modules[0][$i]['name_const']) . '</label>';
                    $modules_output .= '<ul>' . $output . '</ul>';
                }
            }
            if (!empty($modules_output)) {
                draw_block_top(_MODULES, $menu_index++);
                if ($this->IsLoggedInAs('owner', 'mainadmin')) {
                    echo '<ul>';
                    echo '<li>' . $this->PrepareLink('modules', _MODULES_MANAGEMENT) . '</li>';
                    echo '</ul>';
                }
                echo '<div class="menu_category">' . $modules_output . '</div>';
                draw_block_bottom();
            }
        }
        // ---------------------------------------------------------------------
        // CUSTOMER LINKS
        if ($this->IsLoggedInAsCustomer()) {
            draw_block_top(_MY_ACCOUNT);
            echo '<ul>';
            echo '<li>' . prepare_permanent_link('index.php?page=home', _HOME, '', Application::Get('page') == 'home' && Application::Get('customer') == '' ? 'active' : '') . '</li>';
            echo '<li>' . $this->PrepareLink('home', _DASHBOARD) . '</li>';
            echo '<li>' . $this->PrepareLink('my_account', _EDIT_MY_ACCOUNT) . '</li>';
            echo '<li>' . $this->PrepareLink('my_listings', _MY_LISTINGS, '', '', array('listings_categories')) . '</li>';
            if (Modules::IsModuleInstalled('payments') && ModulesSettings::Get('payments', 'is_active') == 'yes') {
                echo '<li>' . $this->PrepareLink('advertise', _ADVERTISE, '', '', array('advertise_prepayment', 'order_proccess')) . '</li>';
                echo '<li>' . $this->PrepareLink('my_orders', _MY_ORDERS) . '</li>';
            }
            if (Modules::IsModuleInstalled('inquiries')) {
                echo '<li>' . $this->PrepareLink('inquiries', _INQUIRIES) . '</li>';
            }
            echo '</ul>';
            draw_block_bottom();
        }
        // Logout
        if ($this->IsLoggedIn()) {
            draw_block_top_empty();
            echo '<form action="index.php" method="post">
       			  ' . draw_hidden_field('submit_logout', 'logout', false) . '
				  ' . draw_token_field(false) . '
				  &nbsp;&nbsp;<input class="form_button" type="submit" name="btnLogout" value="' . _BUTTON_LOGOUT . '" />&nbsp;&nbsp;
				  </form>';
            draw_block_bottom();
            echo '<br />';
        }
        $this->activeMenuCount = $menu_index;
    }
    /**
     * After addition record
     */
    public function AfterInsertRecord()
    {
        global $objSettings, $objLogin;
        $maximum_replies = ModulesSettings::Get('inquiries', 'maximum_replies');
        // increase by 1 a number of replies and update is_active field
        $sql = 'UPDATE ' . TABLE_INQUIRIES . '
				SET replies_count = replies_count + IF(replies_count < ' . (int) $maximum_replies . ', 1, 0),
					is_active = IF(replies_count > (' . (int) $maximum_replies . ' - 1), 0, 1)
				WHERE id = ' . (int) $this->params['inquiry_id'];
        database_void_query($sql);
        $objInquiries = Inquiries::Instance();
        $inquiry_info = $objInquiries->GetInfoByID($this->params['inquiry_id']);
        $visitor_email = isset($inquiry_info['email']) ? $inquiry_info['email'] : '';
        $visitor_name = isset($inquiry_info['name']) ? $inquiry_info['name'] : '';
        $reply_details = _MESSAGE . ':';
        $reply_details .= '<br>-----------<br>';
        $reply_details .= $this->params['message'];
        $reply_details .= '<br><br>';
        $reply_details .= _CUSTOMER_DETAILS . ':';
        $reply_details .= '<br>-----------<br>';
        $reply_details .= _FIRST_NAME . ': ' . $objLogin->GetLoggedFirstName() . '<br>';
        $reply_details .= _LAST_NAME . ': ' . $objLogin->GetLoggedLastName() . '<br>';
        $reply_details .= _EMAIL . ': ' . $objLogin->GetLoggedEmail() . '<br>';
        // send inquiry reply to visitor
        send_email($visitor_email, $objSettings->GetParameter('admin_email'), 'inquiry_reply', array('{FIRST NAME}' => '', '{LAST NAME}' => $visitor_name, '{REPLY DETAILS}' => $reply_details, '{WEB SITE}' => $_SERVER['SERVER_NAME'], '{BASE URL}' => APPHP_BASE));
    }
     $title_desc = _PAYPAL_ORDER;
 } else {
     if ($payment_type == '2co') {
         $title_desc = _2CO_ORDER;
     } else {
         if ($payment_type == 'authorize') {
             $title_desc = _AUTHORIZE_NET_ORDER;
         } else {
             $title_desc = _ONLINE_ORDER;
         }
     }
 }
 if (Modules::IsModuleInstalled('payments') && ModulesSettings::Get('payments', 'is_active') == 'yes') {
     draw_title_bar(prepare_breadcrumbs(array(_MY_ACCOUNT => '', _ADVERTISE => '', $title_desc => '')), prepare_permanent_link('index.php?customer=advertise', _BUTTON_BACK));
     // test mode alert
     if (ModulesSettings::Get('payments', 'mode') == 'TEST MODE') {
         draw_message(_TEST_MODE_ALERT_SHORT, true, true);
     }
     if ($task == "do_order") {
         if (AdvertisePlans::DoOrder($payment_type)) {
             AdvertisePlans::DrawPrepayment();
         } else {
             draw_important_message(AdvertisePlans::$message);
         }
     } else {
         if ($task == "repeat_order") {
             draw_important_message($msg_text);
             AdvertisePlans::ReDrawPrepayment();
         } else {
             draw_important_message(_WRONG_PARAMETER_PASSED);
         }
Example #7
0
    /**
     * Draw top banners code
     * 		@param $banner_image
     * 		@param $show_always
     * 		@param $draw
     */
    public static function DrawBannersTop(&$banner_image, $show_always = true, $draw = true)
    {
        global $objLogin;
        $default_banner_image = '';
        $nl = "\n";
        if (Modules::IsModuleInstalled('banners')) {
            $is_banners_active = ModulesSettings::Get('banners', 'is_active');
            $rotate_delay = ModulesSettings::Get('banners', 'rotate_delay');
            $rotation_type = ModulesSettings::Get('banners', 'rotation_type');
            $caption_html = ModulesSettings::Get('banners', 'slideshow_caption_html');
            if ($is_banners_active == 'yes') {
                $objBanners = new Banners();
                if ($rotation_type == 'slide show') {
                    $arrBanners = $objBanners->GetBannersArray();
                    if ($show_always || !$show_always && Application::Get('page') == 'home' && !$objLogin->IsLoggedIn()) {
                        $output = '<script src="' . APPHP_BASE . 'modules/cslide/jquery.cross-slide.min.js" type="text/javascript"></script>' . $nl;
                        $output .= '<script type="text/javascript">' . $nl;
                        $output .= 'jQuery(function() {
							jQuery(\'#slideshow\').crossSlide({
							  sleep: ' . $rotate_delay . ', fade: 2,variant: true
							}, [						
						';
                        $ind = '0';
                        foreach ($arrBanners as $key => $val) {
                            if ($ind == '0') {
                                $default_banner_image = 'images/banners/' . $val['image_file'];
                            } else {
                                $output .= ',';
                            }
                            $output .= '{ src: \'images/banners/' . $val['image_file'] . '\', alt: \'' . encode_text($val['image_text']) . ($val['link_url'] != '' ? '##' . $val['link_url'] : '') . '\', to:\'up\' }';
                            $ind++;
                        }
                        $output .= '], function(idx, img, idxOut, imgOut) {
							var img_alt_split = img.alt.split(\'##\');
							var caption_width = jQuery(\'div#slideshow\').width() - 20;						
							if(idxOut == undefined){							
							  /* starting single image phase, put up caption */
							  if(img.alt != \'\'){
								jQuery(\'div.slideshow-caption\').click(function(){ if(img_alt_split[1] != undefined && img_alt_split[1] != \'\') appGoToPage(img_alt_split[1]); });
								jQuery(\'div.slideshow-caption\').' . ($caption_html == 'yes' ? 'html' : 'text') . '(img_alt_split[0]).animate({ opacity: .7 })
								jQuery(\'div.slideshow-caption\').fadeIn();
								if(caption_width != null) jQuery(\'div.slideshow-caption\').width(caption_width);
							  }
							}else{
							  // starting cross-fade phase, take out caption
							  jQuery(\'div.slideshow-caption\').click(function() { });
							  jQuery(\'div.slideshow-caption\').fadeOut();
							}}) });';
                        $output .= '</script>' . $nl;
                        if ($ind == 1) {
                            $banner_image = '<div class="banners-box-random" id="slideshow">' . $objBanners->GetRandomBanner() . '</div>';
                        } else {
                            if ($draw) {
                                echo $output;
                            } else {
                                return $output;
                            }
                            $banner_image = '<div class="banners-box-slideshow" id="slideshow"></div><div class="slideshow-caption"></div>';
                        }
                    }
                } else {
                    if ($show_always || !$show_always && Application::Get('page') == 'home' && !$objLogin->IsLoggedIn()) {
                        $banner_image = '<div class="banners-box-random" id="slideshow">' . $objBanners->GetRandomBanner() . '</div>';
                    }
                }
            }
        }
    }
Example #8
0
    /**
     * Sends order mail
     * 		@param $order_number
     * 		@param $order_type
     * 		@param $customer_id
     */
    public static function SendOrderEmail($order_number, $order_type = 'accepted', $customer_id = '')
    {
        global $objSettings;
        $currencyFormat = get_currency_format();
        $order_details = '';
        // send email to customer
        $sql = 'SELECT 
					o.*,
					CASE
						WHEN o.payment_type = 0 THEN "' . _ONLINE_ORDER . '"
						WHEN o.payment_type = 1 THEN "' . _PAYPAL . '"
						WHEN o.payment_type = 2 THEN "2CO"
						WHEN o.payment_type = 3 THEN "Authorize.Net"
						ELSE "' . _UNKNOWN . '"
					END as m_payment_type,
					CASE
						WHEN o.payment_method = 0 THEN "' . _PAYMENT_COMPANY_ACCOUNT . '"
						WHEN o.payment_method = 1 THEN "' . _CREDIT_CARD . '"
						WHEN o.payment_method = 2 THEN "E-Check"
						ELSE "' . _UNKNOWN . '"
					END as m_payment_method,			
					CASE
						WHEN o.status = 0 THEN "<span style=color:#960000>' . _PREPARING . '</span>"
						WHEN o.status = 1 THEN "<span style=color:#FF9966>' . _PENDING . '</span>"
						WHEN o.status = 2 THEN "<span style=color:#336699>' . _PAID . '</span>"
						WHEN o.status = 3 THEN "<span style=color:#009600>' . _COMPLETED . '</span>"
						WHEN o.status = 4 THEN "<span style=color:#969600>' . _REFUNDED . '</span>"
						ELSE "' . _UNKNOWN . '"
					END as m_status,			
					c.first_name,
					c.last_name,
					c.user_name as customer_name,
					c.preferred_language,
					c.email,
					c.b_address,
					c.b_address_2,
					c.b_city,
					c.b_state,
					count.name as b_country,
					c.b_zipcode, 
					c.phone,
					c.fax,
					cur.symbol,
					cur.symbol_placement
		FROM ' . TABLE_ORDERS . ' o
			LEFT OUTER JOIN ' . TABLE_CURRENCIES . ' cur ON o.currency = cur.code
			LEFT OUTER JOIN ' . TABLE_CUSTOMERS . ' c ON o.customer_id = c.id
			LEFT OUTER JOIN ' . TABLE_COUNTRIES . ' count ON c.b_country = count.abbrv 
		WHERE
			o.customer_id = ' . (int) $customer_id . ' AND
			o.order_number = "' . $order_number . '"';
        $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY);
        if ($result[1] > 0) {
            $plan_info = AdvertisePlans::GetPlanInfo($result[0]['advertise_plan_id']);
            if (ModulesSettings::Get('payments', 'mode') == 'TEST MODE') {
                $order_details .= '<div style="text-align:center;padding:10px;color:#a60000;border:1px dashed #a60000;width:100px">TEST MODE!</div><br />';
            }
            // Personal Info
            $order_details .= '<b>' . _PERSONAL_INFORMATION . ':</b><br />';
            $order_details .= _FIRST_NAME . ' : ' . $result[0]['first_name'] . '<br />';
            $order_details .= _LAST_NAME . ' : ' . $result[0]['last_name'] . '<br />';
            $order_details .= _EMAIL_ADDRESS . ' : ' . $result[0]['email'] . '<br />';
            $order_details .= '<br />';
            // Billing Info
            $order_details .= '<b>' . _BILLING_INFORMATION . ':</b><br />';
            $order_details .= _ADDRESS . ': ' . $result[0]['b_address'] . '<br />';
            $order_details .= _ADDRESS_2 . ': ' . $result[0]['b_address_2'] . '<br />';
            $order_details .= _CITY . ': ' . $result[0]['b_city'] . '<br />';
            $order_details .= _STATE_PROVINCE . ': ' . $result[0]['b_state'] . '<br />';
            $order_details .= _COUNTRY . ': ' . $result[0]['b_country'] . '<br />';
            $order_details .= _ZIP_CODE . ': ' . $result[0]['b_zipcode'] . '<br />';
            if (!empty($result[0]['phone'])) {
                $order_details .= _PHONE . ' : ' . $result[0]['phone'] . '<br />';
            }
            if (!empty($result[0]['fax'])) {
                $order_details .= _FAX . ' : ' . $result[0]['fax'] . '<br />';
            }
            $order_details .= '<br />';
            // Order Details
            $order_details .= '<b>' . _ORDER_DETAILS . ':</b><br />';
            $order_details .= _ORDER_DESCRIPTION . ': ' . $result[0]['order_description'] . '<br />';
            $order_details .= _ADVERTISE_PLAN . ': ' . (isset($plan_info[0]['plan_name']) ? $plan_info[0]['plan_name'] : '') . '<br />';
            $order_details .= _LISTINGS_COUNT . ': ' . $result[0]['listings_amount'] . '<br />';
            $order_details .= _CURRENCY . ': ' . $result[0]['currency'] . '<br />';
            $order_details .= _CREATED_DATE . ': ' . format_datetime($result[0]['created_date']) . '<br />';
            $order_details .= _PAYMENT_DATE . ': ' . format_datetime($result[0]['payment_date']) . '<br />';
            $order_details .= _PAYMENT_TYPE . ': ' . $result[0]['m_payment_type'] . '<br />';
            $order_details .= _PAYMENT_METHOD . ': ' . $result[0]['m_payment_method'] . '<br />';
            //$order_details .= (($result[0]['campaign_name'] != '') ? _DISCOUNT_CAMPAIGN.': '.$result[0]['campaign_name'].' ('.$result[0]['discount_percent'].'%)' : '').'<br />';
            $order_details .= _ORDER_PRICE . ': ' . Currencies::PriceFormat($result[0]['order_price'], $result[0]['symbol'], $result[0]['symbol_placement'], $currencyFormat) . '<br />';
            $order_details .= _VAT . ': ' . Currencies::PriceFormat($result[0]['vat_fee'], $result[0]['symbol'], $result[0]['symbol_placement'], $currencyFormat) . ' (' . $result[0]['vat_percent'] . '%)' . '<br />';
            $order_details .= _TOTAL_PRICE . ': ' . Currencies::PriceFormat($result[0]['total_price'], $result[0]['symbol'], $result[0]['symbol_placement'], $currencyFormat) . '<br />';
            //$order_details .= _ADDITIONAL_INFO.': '.nl2br($result[0]['additional_info']).'<br /><br />';
            $send_order_copy_to_admin = ModulesSettings::Get('payments', 'send_order_copy_to_admin');
            ////////////////////////////////////////////////////////////
            $sender = $objSettings->GetParameter('admin_email');
            $recipient = $result[0]['email'];
            if ($order_type == 'completed') {
                // exit if email was already sent
                if ($result[0]['email_sent'] == '1') {
                    return true;
                }
                $email_template = 'order_paid';
                $admin_copy_subject = 'Client order has been paid (admin copy)';
            } else {
                $email_template = 'order_accepted_online';
                $admin_copy_subject = 'Client has placed online order (admin copy)';
            }
            ////////////////////////////////////////////////////////////
            send_email($recipient, $sender, $email_template, array('{FIRST NAME}' => $result[0]['first_name'], '{LAST NAME}' => $result[0]['last_name'], '{ORDER NUMBER}' => $order_number, '{ORDER DETAILS}' => $order_details), $result[0]['preferred_language'], $send_order_copy_to_admin == 'yes' ? $sender : '', $send_order_copy_to_admin == 'yes' ? $admin_copy_subject : '');
            ////////////////////////////////////////////////////////////
            if ($order_type == 'completed') {
                $sql = 'UPDATE ' . TABLE_ORDERS . ' SET email_sent = 1 WHERE order_number = \'' . $order_number . '\'';
                database_void_query($sql);
            }
            ////////////////////////////////////////////////////////////
            return true;
        } else {
            ///echo $sql;
            ///echo mysql_error();
        }
        return false;
    }
/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAs('owner', 'mainadmin') && Modules::IsModuleInstalled('inquiries')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $mode = 'view';
    $msg = '';
    $objInquiries = new ModulesSettings('inquiries');
    if ($action == 'add') {
        $mode = 'add';
    } else {
        if ($action == 'create') {
            if ($objInquiries->AddRecord()) {
                $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                $mode = 'view';
            } else {
                $msg = draw_important_message($objInquiries->error, false);
                $mode = 'add';
            }
        } else {
            if ($action == 'edit') {
                $mode = 'edit';
            } else {
    /**
     * Do (prepare) order
     * 		@param $payment_type
     */
    public static function DoOrder($payment_type = '')
    {
        //global $objSettings;
        global $objLogin;
        if (SITE_MODE == 'demo') {
            self::$message = draw_important_message(_OPERATION_BLOCKED, false);
            return false;
        }
        // check if customer has reached the maximum number of allowed 'open' orders
        $max_orders = ModulesSettings::Get('payments', 'maximum_allowed_orders');
        $sql = 'SELECT COUNT(*) as cnt
				FROM ' . TABLE_ORDERS . '
				WHERE customer_id = ' . (int) $objLogin->GetLoggedID() . ' AND
				     (status = 0 OR status = 1)';
        $result = database_query($sql, DATA_ONLY);
        $cnt = isset($result[0]['cnt']) ? (int) $result[0]['cnt'] : 0;
        if ($cnt >= $max_orders) {
            self::$message = _MAX_ORDERS_ERROR;
            return false;
        }
        $return = false;
        $currency = MicroGrid::GetParameter('currency', false);
        $plan_id = MicroGrid::GetParameter('plan_id', false);
        $payment_type = MicroGrid::GetParameter('payment_type', false);
        $additionalInfo = '';
        $payed_by = 0;
        $listings_amount = 0;
        $order_price = 0;
        $vat_percent = ModulesSettings::Get('payments', 'vat_value');
        $vat_cost = 0;
        $total_price = 0;
        // add order to database
        if (in_array($payment_type, array('online', 'paypal', '2co', 'authorize'))) {
            if ($payment_type == 'paypal') {
                $payed_by = '1';
                $status = '0';
            } else {
                if ($payment_type == '2co') {
                    $payed_by = '2';
                    $status = '0';
                } else {
                    if ($payment_type == 'authorize') {
                        $payed_by = '3';
                        $status = '0';
                    } else {
                        $payed_by = '0';
                        $status = '0';
                    }
                }
            }
            $sql = 'SELECT ap.id, ap.listings_count, ap.price, ap.duration												
					FROM ' . TABLE_ADVERTISE_PLANS . ' ap
					WHERE ap.id = ' . (int) $plan_id;
            $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY);
            if ($result[1] > 0) {
                $listings_amount = $result[0]['listings_count'];
                $order_price = $result[0]['price'] * Application::Get('currency_rate');
                $vat_cost = $order_price * ($vat_percent / 100);
                $total_price = $order_price + $vat_cost;
                /////////////////////////////////////////////////////////////////
                $sql = 'SELECT id, order_number FROM ' . TABLE_ORDERS . ' WHERE customer_id = ' . (int) $objLogin->GetLoggedID() . ' AND status = 0 ORDER BY id DESC';
                $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY);
                if ($result[1] > 0) {
                    $sql_start = 'UPDATE ' . TABLE_ORDERS . ' SET ';
                    $order_number = $result[0]['order_number'];
                    $sql_end = ' WHERE order_number = \'' . $order_number . '\'';
                } else {
                    $sql_start = 'INSERT INTO ' . TABLE_ORDERS . ' SET ';
                    $order_number = strtoupper(get_random_string(10));
                    $sql_end = '';
                }
                $sql_middle = 'order_number = \'' . $order_number . '\',
							order_description = \'' . _LISTINGS_PURCHASING . '\',
							order_price = ' . number_format((double) $order_price, (int) Application::Get('currency_decimals'), '.', '') . ',
							vat_percent = ' . $vat_percent . ',
							vat_fee = ' . number_format((double) $vat_cost, (int) Application::Get('currency_decimals'), '.', '') . ',
							total_price = ' . number_format((double) $total_price, (int) Application::Get('currency_decimals'), '.', '') . ',
							currency = \'' . $currency . '\',
							advertise_plan_id = ' . $plan_id . ',
							listings_amount = ' . (int) $listings_amount . ',
							customer_id = ' . (int) @$objLogin->GetLoggedID() . ',
							transaction_number = \'\',
							created_date = \'' . date('Y-m-d H:i:s') . '\',
							payment_date = \'0000-00-00 00:00:00\',
							payment_type = ' . $payed_by . ',
							payment_method = 0,
							coupon_number = \'\',
							discount_campaign_id = 0,
							additional_info = \'' . $additionalInfo . '\',
							cc_type = \'\',
							cc_holder_name = \'\',
							cc_number = \'\', 
							cc_expires_month = \'\', 
							cc_expires_year = \'\', 
							cc_cvv_code = \'\',
							status = ' . (int) $status . ',
							status_changed = \'0000-00-00 00:00:00\',
							email_sent = 0';
                $sql = $sql_start . $sql_middle . $sql_end;
                if (database_void_query($sql)) {
                    $return = true;
                } else {
                    self::$message = _ORDER_PEPARING_ERROR;
                    $return = false;
                }
            } else {
                self::$message = _ORDER_PEPARING_ERROR;
                $return = false;
            }
        } else {
            self::$message = _ORDER_PEPARING_ERROR;
            $return = false;
        }
        if (SITE_MODE == 'development' && !empty(self::$message)) {
            self::$message .= '<br>' . $sql . '<br>' . mysql_error();
        }
        return $return;
    }
 public function BeforeInsertRecord()
 {
     // check if we reached the maximum allowed categories
     $arr_added_categories = self::GetCategoriesForListing($this->listingId);
     // get maximum allowed categories for current listing
     $objListing = Listings::Instance($this->listingId);
     $adv = AdvertisePlans::GetPlanInfo($objListing->GetField('advertise_plan_id'));
     $maximum_categories = isset($adv[0]['categories_count']) ? (int) $adv[0]['categories_count'] : ModulesSettings::Get('listings', 'maximum_categories');
     if ($arr_added_categories[1] >= $maximum_categories) {
         $this->error = _LISTING_MAX_CATEGORIES_ALERT;
         return false;
     }
     return true;
 }
Example #12
0
        echo '<td></td>';
    }
    ?>
			
		</tr>
		<tr><td colspan="2" nowrap height="5px"></td></tr>		
		<tr>
			<td valign="top" colspan="2">
			<?php 
    if (ModulesSettings::Get('customers', 'allow_registration') == 'yes') {
        echo prepare_permanent_link('index.php?customer=create_account', _CREATE_ACCOUNT) . '<br />';
    }
    if (ModulesSettings::Get('customers', 'allow_reset_passwords') == 'yes') {
        echo prepare_permanent_link('index.php?customer=password_forgotten', _FORGOT_PASSWORD) . '<br />';
    }
    if (ModulesSettings::Get('customers', 'allow_registration') == 'yes' && ModulesSettings::Get('customers', 'reg_confirmation') == 'by email') {
        echo prepare_permanent_link('index.php?customer=resend_activation', _RESEND_ACTIVATION_EMAIL);
    }
    ?>
			</td>
		</tr>
		<tr><td colspan="2" nowrap="nowrap" height="5px"></td></tr>		
		</table>
	</form>
	</div>
	<script type="text/javascript">	appSetFocus("txt_user_name");</script>	
<?php 
} else {
    if ($objLogin->IsLoggedInAsCustomer()) {
        echo '<div class="pages_contents">';
        draw_message(_ALREADY_LOGGED, true, true, false, 'width:100%');
Example #13
0
define('SVRATING', 'mysql');
// change 'txt' with 'mysql' if you want to save rating data in MySQL
// HERE define data for connecting to MySQL database (MySQL server, user, password, database name)
//define('DATABASE_HOST', 'localhost');
//define('DATABASE_USERNAME', 'root');
//define('DATABASE_PASSWORD', '');
//define('DATABASE_NAME', 'business_directory');
// if NRRTG is 0, the user can rate multiple items in a day, if it is 1, the user can rate only one item in a day
if (ModulesSettings::Get('ratings', 'multiple_items_per_day') == 'yes') {
    define('NRRTG', 0);
} else {
    define('NRRTG', 1);
}
// If you want than only the logged users to can rate the element(s) on page, sets USRRATE to 0
// And sets $_SESSION['username'] with the session that your script uses to keep logged users
if (ModulesSettings::Get('ratings', 'user_type') == 'registered') {
    define('USRRATE', 0);
} else {
    define('USRRATE', 1);
}
if (USRRATE !== 1) {
    //if(!isset($_SESSION)) session_start();
    //if(isset($_SESSION['username'])) define('RATER', $_SESSION['username']);
    if ($objLogin->IsLoggedIn()) {
        define('RATER', $objLogin->GetLoggedName());
    }
}
/* From Here no need to modify */
if (!headers_sent()) {
    header('Content-type: text/html; charset=utf-8');
}
Example #14
0
 /**
  *	Draws news block
  *		@param $draw
  */
 public function DrawNewsBlock($draw = true)
 {
     $text_align_left = Application::Get('lang_dir') == 'ltr' ? 'text-align:left;' : 'text-align:right;padding-right:15px;';
     $text_align_right = Application::Get('lang_dir') == 'ltr' ? 'text-align:right;padding-right:15px;' : 'text-align:left;';
     $news_header_length = ModulesSettings::Get('news', 'news_header_length');
     $news_count = ModulesSettings::Get('news', 'news_count');
     $this->WHERE_CLAUSE = 'WHERE date_created < \'' . @date('Y-m-d H:i:s') . '\' AND language_id = \'' . Application::Get('lang') . '\'';
     $all_news = $this->GetAll($this->ORDER_CLAUSE);
     $output = draw_block_top(_NEWS_AND_EVENTS, '', 'maximized', false);
     $output .= '<ul class="news-block">';
     for ($news_ind = 0; $news_ind < $all_news[1]; $news_ind++) {
         if ($news_ind + 1 > $news_count) {
             break;
         }
         // Show first X news
         $news_str = $all_news[0][$news_ind]['header_text'];
         // Display Y first chars
         $news_str = strlen($news_str) > $news_header_length ? substr($all_news[0][$news_ind]['header_text'], 0, $news_header_length) . '...' : $news_str;
         $output .= '<li>' . $news_str . '<br />';
         $output .= prepare_link('news', 'nid', $all_news[0][$news_ind]['id'], $news_str, '<i>' . _READ_MORE . ' &raquo;</i>', 'category-news');
         $output .= '</li>';
     }
     if ($news_ind == 0) {
         $output .= '<li>' . _NO_NEWS . '</li>';
     }
     $output .= '</ul>';
     $output .= draw_block_bottom(false);
     if ($draw) {
         echo $output;
     } else {
         return $output;
     }
 }
/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAs('owner', 'mainadmin') && Modules::IsModuleInstalled('contact_us')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $mode = 'view';
    $msg = '';
    $objContactSettings = new ModulesSettings('contact_us');
    if ($action == 'add') {
        $mode = 'add';
    } else {
        if ($action == 'create') {
            if ($objContactSettings->AddRecord()) {
                $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                $mode = 'view';
            } else {
                $msg = draw_important_message($objContactSettings->error, false);
                $mode = 'add';
            }
        } else {
            if ($action == 'edit') {
                $mode = 'edit';
            } else {
Example #16
0
// Draw top menu
Menu::DrawTopMenu();
?>
	</ul>
	<div class="slogan">
		<?php 
if ($objLogin->IsLoggedInAsAdmin() && Application::Get('preview') == 'yes') {
    echo prepare_permanent_link('index.php?preview=no', _BACK_TO_ADMIN_PANEL, '', 'header');
} else {
    echo $objSiteDescription->GetParameter('slogan_text');
}
?>
	</div>
	
	<?php 
if (Modules::IsModuleInstalled('news') && ModulesSettings::Get('news', 'news_rss') == 'yes') {
    echo '<div class="rss"><a href="feeds/rss.xml"><img src="templates/' . Application::Get('template') . '/images/spacer.gif" title="RSS Feed" alt="RSS Feed" border="0" width="27" height="62" /></a></div>';
}
?>
	
	
	<div class="nav_language">
		<?php 
$objLang = new Languages();
if ($objLang->GetLanguagesCount('front-end') > 1) {
    echo '<div style="padding-top:3px;margin:0px 6px;float:' . Application::Get('defined_left') . ';">' . _LANGUAGES . '</div>';
    $path = 'page';
    echo '<div style="padding-top:4px;float:left;">';
    $objLang->DrawLanguagesBar($path);
    echo '</div>';
}
Example #17
0
    /**
     * Remove very old inquiries
     */
    public static function RemoveOld()
    {
        $keep_history_days = ModulesSettings::Get('inquiries', 'keep_history_days');
        $sql = 'DELETE FROM ' . TABLE_INQUIRIES_REPLIES . '
				WHERE DATEDIFF(\'' . date('Y-m-d H:i:s') . '\', ' . TABLE_INQUIRIES_REPLIES . '.date_added) > ' . (int) $keep_history_days;
        database_void_query($sql);
        $sql = 'DELETE FROM ' . TABLE_INQUIRIES_HISTORY . '
				WHERE DATEDIFF(\'' . date('Y-m-d H:i:s') . '\', ' . TABLE_INQUIRIES_HISTORY . '.date_added) > ' . (int) $keep_history_days;
        database_void_query($sql);
        $sql = 'DELETE FROM ' . TABLE_INQUIRIES . '
				WHERE DATEDIFF(\'' . date('Y-m-d H:i:s') . '\', ' . TABLE_INQUIRIES . '.date_created) > ' . (int) $keep_history_days;
        database_void_query($sql);
    }
Example #18
0
    /**
     * Draws login form on Front-End
     * 		@param $draw
     */
    public static function DrawLoginFormBlock($draw = true)
    {
        global $objLogin;
        $username = '';
        $password = '';
        $remember_me_checked = '';
        // check if remember me cookies exists
        if (ModulesSettings::Get('customers', 'remember_me_allow') == 'yes') {
            $objLogin->CheckRememberMe($username, $password);
            if (!empty($username) && !empty($password)) {
                $remember_me_checked = 'checked="checked"';
            }
        }
        $output = draw_block_top(_AUTHENTICATION, '', 'maximized', false);
        $output .= '<form class="customer_login" action="index.php?customer=login" method="post">
			' . draw_hidden_field('submit_login', 'login', false) . '
			' . draw_hidden_field('type', 'customer', false) . '
			' . draw_token_field(false) . '			
			<table border="0" cellspacing="1" cellpadding="1">
			<tr><td>' . _USERNAME . ':</td></tr>
			<tr><td><input type="text" style="width:130px" name="user_name" id="user_name" maxlength="50" autocomplete="off" value="' . $username . '" /></td></tr>
			<tr><td>' . _PASSWORD . ':</td></tr>
			<tr><td><input type="password" style="width:130px" name="password" id="password" maxlength="20" autocomplete="off" value="' . $password . '" /></td></tr>
			<tr><td valign="middle">';
        $output .= '<input class="form_button" type="submit" name="submit" value="' . _BUTTON_LOGIN . '" /> ';
        if (ModulesSettings::Get('customers', 'remember_me_allow') == 'yes') {
            $output .= '<input class="form_checkbox" ' . $remember_me_checked . ' name="remember_me" value="1" type="checkbox" /> ' . _REMEMBER_ME . '<br>';
        }
        $output .= '</td></tr>
			<tr><td></td></tr>';
        if (ModulesSettings::Get('customers', 'allow_registration') == 'yes') {
            $output .= '<tr><td>' . prepare_permanent_link('index.php?customer=create_account', _CREATE_ACCOUNT, '', 'form_link') . '</td></tr>';
        }
        if (ModulesSettings::Get('customers', 'allow_reset_passwords') == 'yes') {
            $output .= '<tr><td>' . prepare_permanent_link('index.php?customer=password_forgotten', _FORGOT_PASSWORD, '', 'form_link') . '</td></tr>';
        }
        $output .= '</table>
		</form>';
        $output .= draw_block_bottom(false);
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
Example #19
0
    /**
     * Draws sub categories
     * 		@param $category_id
     * 		@param $show_on
     * 		@param $draw
     */
    public function DrawSubCategories($category_id = '0', $show_on = '', $draw = true)
    {
        global $objLogin;
        $listings_count_field = !$objLogin->IsLoggedIn() ? 'listings_count_public' : 'listings_count';
        $lang = Application::Get('lang');
        $output = '';
        $categories_images = false;
        $categories_columns = '3';
        if (Modules::IsModuleInstalled('listings')) {
            if (ModulesSettings::Get('listings', 'show_categories_images') == 'yes') {
                $categories_images = true;
            }
            $categories_columns = ModulesSettings::Get('listings', 'columns_number_on_page');
        }
        $category_info = $this->GetInfoByID($category_id);
        $sql = 'SELECT c.id,
					c.icon,
					c.icon_thumb, 
					c.listings_count,
					c.listings_count_public,
					c.priority_order,
					cd.language_id,
					cd.name,									
					cd.description
				FROM ' . TABLE_CATEGORIES . ' c
					LEFT OUTER JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' cd ON c.id = cd.category_id
				WHERE
					c.parent_id = ' . (int) $category_id . ' AND 
					cd.language_id = \'' . $lang . '\'';
        $result = database_query($sql, DATA_AND_ROWS, ALL_ROWS, FETCH_ASSOC);
        if ($result[1] > 0) {
            $output .= '<table class="sub_categories_table" width="100%" align="center" border="0" style="margin:10px auto">';
            $output .= '<tr>';
            for ($i = 0; $i < $result[1]; $i++) {
                if ($i > 0 && $i % $categories_columns == 0) {
                    $output .= '</tr><tr>';
                }
                $output .= '<td align="left" valign="top" width="32px">';
                $icon_file_thumb = $result[0][$i]['icon_thumb'] != '' ? $result[0][$i]['icon_thumb'] : '';
                if ($categories_images && $icon_file_thumb != '') {
                    $output .= '<img src="images/categories/' . $icon_file_thumb . '" width="24px" height="24px" alt="' . $result[0][$i]['name'] . '" title="' . $result[0][$i]['name'] . '" />';
                } else {
                    $directory_icon = $result[0][$i][$listings_count_field] > 0 ? 'not_empty_directory.gif' : 'empty_directory.gif';
                    $output .= '<img src="images/categories/' . $directory_icon . '" width="24px" height="24px" alt="' . $result[0][$i]['name'] . '" title="' . $result[0][$i]['name'] . '" />';
                }
                $output .= '</td>';
                $output .= '<td>';
                $output .= prepare_link('category', 'cid', $result[0][$i]['id'], '', $result[0][$i]['name'], '', '') . ' (' . $result[0][$i][$listings_count_field] . ')';
                //$output .= '&nbsp;&nbsp;';
                //$output .= prepare_link('category', 'cid', $result[0][$i]['id'], '', '<img src=images/external_link.gif>', '', _VIEW_LISTINGS);
                $output .= '</td>';
            }
            $output .= '</tr>';
            $output .= '</table>';
        } else {
            if ($show_on == '') {
                $output .= draw_message(_NO_SUBCATEGORIES, false, true) . '<br />';
            }
        }
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
Example #20
0
    /**
     *  Draws FAQ list
     *  	@param $draw
     */
    public static function DrawFaqList($draw = true)
    {
        $output = '';
        $page_url = get_page_url();
        if (Modules::IsModuleInstalled('faq')) {
            if (ModulesSettings::Get('faq', 'is_active') == 'yes') {
                $sql = 'SELECT
						fc.id as category_id,
						fc.name as category_name,
						fci.id as item_id,
						fci.faq_question,
						fci.faq_answer,
						fci.priority_order
					FROM ' . TABLE_FAQ_CATEGORY_ITEMS . ' fci
						INNER JOIN ' . TABLE_FAQ_CATEGORIES . ' fc ON fci.category_id = fc.id
					WHERE
						fc.is_active = 1 AND
						fci.is_active = 1
					ORDER BY
						fc.priority_order ASC,
						fci.priority_order ASC ';
                $result = database_query($sql, DATA_AND_ROWS, ALL_ROWS);
                $count = 1;
                $current_category = '';
                $output .= '<a name="up"></a>';
                $output .= '<div class="faq_questions">';
                for ($i = 0; $i < $result[1]; $i++) {
                    if ($current_category == '') {
                        $current_category = $result[0][$i]['category_name'];
                        $output .= ($i > 0 ? '<br>' : '') . '<h3>' . $current_category . '</h3>';
                    } else {
                        if ($current_category != $result[0][$i]['category_name']) {
                            $current_category = $result[0][$i]['category_name'];
                            $output .= ($i > 0 ? '<br>' : '') . '<h3>' . $current_category . '</h3>';
                        }
                    }
                    $output .= '<span>&nbsp;&#8226;&nbsp;</span><a href="' . $page_url . '#faq_' . $result[0][$i]['category_id'] . '_' . $result[0][$i]['item_id'] . '">' . str_replace('\\', '', $result[0][$i]['faq_question']) . '</a><br>';
                }
                $output .= '</div>';
                $current_category = '';
                $draw_hr = true;
                $count = 1;
                for ($i = 0; $i < $result[1]; $i++) {
                    if ($current_category == '') {
                        $current_category = $result[0][$i]['category_name'];
                        $draw_hr = false;
                        $output .= '<br />' . draw_sub_title_bar($current_category, false);
                    } else {
                        if ($current_category != $result[0][$i]['category_name']) {
                            $current_category = $result[0][$i]['category_name'];
                            $draw_hr = false;
                            $output .= '<br />' . draw_sub_title_bar($current_category, false);
                        } else {
                            $draw_hr = true;
                        }
                    }
                    $output .= '<table width="100%" border="0" cellpadding="1" cellspacing="2">
					' . ($draw_hr ? '<tr align="left" valign="top"><td colspan="2"><hr size="1" style="color:#cccccc" noshade></td></tr>' : '') . '
					<tr>
						<td><a name="faq_' . $result[0][$i]['category_id'] . '_' . $result[0][$i]['item_id'] . '"></a><strong>' . str_replace('\\', '', $result[0][$i]['faq_question']) . '</strong></td>
					</tr>
					<tr>
						<td>' . str_replace('\\', '', $result[0][$i]['faq_answer']) . '</td>
					</tr>
					<tr><td colspan="2" align="' . Application::Get('defined_right') . '"><a href="' . $page_url . '#up">top ^</a></td></tr>                
					</table>';
                }
            }
        }
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
Example #21
0
 /**
  * Include style and javascript files
  */
 public static function SetLibraries()
 {
     if (!Modules::IsModuleInstalled('gallery')) {
         return false;
     }
     $output = '';
     $nl = "\n";
     $image_gallery_type = ModulesSettings::Get('gallery', 'image_gallery_type');
     $video_gallery_type = ModulesSettings::Get('gallery', 'video_gallery_type');
     $output = '';
     if ($image_gallery_type == 'lytebox') {
         $output .= '<!-- LyteBox v3.22 Author: Markus F. Hay Website: http://www.dolem.com/lytebox -->' . $nl;
         $output .= '<link rel="stylesheet" href="' . APPHP_BASE . 'modules/lytebox/css/lytebox.css" type="text/css" media="screen" />' . $nl;
         $output .= '<script type="text/javascript" src="' . APPHP_BASE . 'modules/lytebox/js/lytebox.js"></script>' . $nl;
         Application::Set('js_included', 'lytebox');
     }
     if ($image_gallery_type == 'rokbox' || $video_gallery_type == 'rokbox' || $video_gallery_type == 'videobox') {
         $output .= '<script type="text/javascript" src="' . APPHP_BASE . 'js/mootools.js"></script>' . $nl;
         Application::Set('js_included', 'mootools');
     }
     if ($image_gallery_type == 'rokbox' || $video_gallery_type == 'rokbox') {
         $output .= '<!-- RokBox -->' . $nl;
         $output .= '<link rel="stylesheet" href="' . APPHP_BASE . 'modules/rokbox/themes/dark/rokbox-style.css" type="text/css" />' . $nl;
         $output .= '<link rel="stylesheet" href="' . APPHP_BASE . 'modules/rokbox/themes/dark/rokbox-style-ie8.css" type="text/css" />' . $nl;
         $output .= '<script type="text/javascript" src="' . APPHP_BASE . 'modules/rokbox/rokbox.js"></script>' . $nl;
         $output .= '<script type="text/javascript" src="' . APPHP_BASE . 'modules/rokbox/rokbox-config.js"></script>' . $nl;
         Application::Set('js_included', 'rokbox');
     }
     if ($video_gallery_type == 'videobox') {
         $output .= '<!-- VideoBox -->' . $nl;
         $output .= '<link rel="stylesheet" href="' . APPHP_BASE . 'modules/videobox/css/videobox.css" type="text/css" />' . $nl;
         $output .= '<script type="text/javascript" src="' . APPHP_BASE . 'modules/videobox/js/swfobject.js"></script>' . $nl;
         $output .= '<script type="text/javascript" src="' . APPHP_BASE . 'modules/videobox/js/videobox.js"></script>' . $nl;
         Application::Set('js_included', 'videobox');
     }
     return $output;
 }
Example #22
0
<?php

/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if (!$objLogin->IsLoggedIn() && ModulesSettings::Get('customers', 'allow_registration') == 'yes') {
    draw_title_bar(_CREATING_NEW_ACCOUNT);
    if ($account_created) {
        ?>

	<div class='pages_contents'>
		<?php 
        echo $msg == '' ? $msg_default : $msg;
        ?>
	</div>

<?php 
    } else {
        ?>

	<script type="text/javascript"> 
	function btnSubmitPD_OnClick(){
		frmReg = document.getElementById("frmRegistration");
		
		if(frmReg.first_name.value == "")     { alert("<?php 
Example #23
0
if ($objLogin->IsLoggedInAsAdmin()) {
    $objPage = new Pages(Application::Get('page_id'), false, $mg_language_id);
} else {
    $objPage = new Pages(Application::Get('system_page') != '' ? Application::Get('system_page') : Application::Get('page_id'), true, $mg_language_id);
}
$button_text = '';
// check if there is a page
if ($objSession->IsMessage('notice')) {
    draw_title_bar(_PAGE);
    echo $objSession->GetMessage('notice');
} else {
    if ($objPage->CheckAccessRights($objLogin->IsLoggedIn())) {
        // check if there is a page
        if ($objPage->GetId() != '') {
            if ($objLogin->IsLoggedInAsAdmin() && Application::Get('preview') != 'yes') {
                $button_text = prepare_permanent_link('index.php?admin=pages' . (Application::Get('type') == 'system' ? '&type=system' : '') . '&mg_language_id=' . $mg_language_id, _BUTTON_BACK);
            }
            $objPage->DrawTitle($button_text);
            if (Modules::IsModuleInstalled('adsense') && (ModulesSettings::Get('adsense', 'adsense_code_activation') == 'All' || ModulesSettings::Get('adsense', 'adsense_code_activation') == 'Horizontal')) {
                //echo '<div class="adsense-horizontal">'.Adsense::GetHorizontalBanerCode().'</div>';
            }
            $objPage->DrawText();
        } else {
            draw_title_bar(_PAGES);
            draw_important_message(_PAGE_UNKNOWN);
        }
    } else {
        draw_title_bar(_PAGE);
        draw_important_message(_MUST_BE_LOGGED);
    }
}
Example #24
0
 /**
  *	Draws menus 
  *		@param $menu_position
  *		@param $draw
  */
 public static function DrawMenu($menu_position = 'left', $draw = true)
 {
     global $objSettings, $objLogin;
     $output = '';
     if ($menu_position == 'left') {
         $objLogin->DrawLoginLinks();
     }
     // Get all menus which have items (links to pages)
     $menus = self::GetMenus($menu_position);
     $menus_count = $menus[1];
     $objNews = News::Instance();
     $show_news_block = ModulesSettings::Get('news', 'show_news_block');
     $show_subscribe_block = ModulesSettings::Get('news', 'show_newsletter_subscribe_block');
     if (Modules::IsModuleInstalled('news') && ($show_news_block == 'right side' || $show_subscribe_block == 'right side')) {
         $menus_count++;
     }
     $show_inquiries_block = ModulesSettings::Get('inquiries', 'show_inquiries_block');
     if (Modules::IsModuleInstalled('inquiries') && $show_inquiries_block == 'right side') {
         $menus_count++;
     }
     if (ModulesSettings::Get('listings', 'show_categories_side_block') == $menu_position . ' side') {
         $output .= Categories::DrawSideBlock(false);
         $menus_count++;
     }
     if (ModulesSettings::Get('listings', 'show_featured_block') == $menu_position . ' side') {
         $output .= Listings::DrawFeaturedBlock(false);
         $menus_count++;
     }
     if (ModulesSettings::Get('listings', 'show_recent_block') == $menu_position . ' side') {
         $output .= Listings::DrawRecentBlock(false);
         $menus_count++;
     }
     if (ModulesSettings::Get('listings', 'show_directory_statistics') == $menu_position . ' side') {
         $menus_count++;
     }
     if ($menus_count > 0) {
         $output .= '<div id="column-' . $menu_position . '-wrapper">';
     }
     // Display all menu titles (names) according to their order
     for ($menu_ind = 0; $menu_ind < $menus[1]; $menu_ind++) {
         // Start draw new menu
         $output .= draw_block_top($menus[0][$menu_ind]['menu_name'], '', 'maximazed', false);
         $menu_links = self::GetMenuLinks($menus[0][$menu_ind]['id'], Application::Get('lang'), $menu_position);
         if ($menu_links[1] > 0) {
             $output .= '<ul>';
         }
         for ($menu_link_ind = 0; $menu_link_ind < $menu_links[1]; $menu_link_ind++) {
             $class = Application::Get('page_id') == $menu_links[0][$menu_link_ind]['id'] ? ' active' : '';
             if ($menu_links[0][$menu_link_ind]['content_type'] == 'link') {
                 $output .= '<li>' . prepare_permanent_link($menu_links[0][$menu_link_ind]['link_url'], $menu_links[0][$menu_link_ind]['menu_link'], $menu_links[0][$menu_link_ind]['link_target'], 'main_menu_link' . $class) . '</li>';
             } else {
                 // draw current menu link
                 $output .= '<li>' . prepare_link('pages', 'pid', $menu_links[0][$menu_link_ind]['id'], $menu_links[0][$menu_link_ind]['page_key'], $menu_links[0][$menu_link_ind]['menu_link'], 'main_menu_link' . $class) . '</li>';
             }
         }
         if ($menu_links[1] > 0) {
             $output .= '</ul>';
         }
         $output .= draw_block_bottom(false);
     }
     if ($menu_position == 'left') {
         if (!$objLogin->IsLoggedIn() || Application::Get('preview') == 'yes') {
             if (Modules::IsModuleInstalled('customers') && ModulesSettings::Get('customers', 'allow_login') == 'yes') {
                 if (Application::Get('customer') != 'login') {
                     $output .= Customers::DrawLoginFormBlock(false);
                 }
             }
         }
         if (Modules::IsModuleInstalled('news')) {
             if ($show_news_block == 'left side') {
                 $output .= $objNews->DrawNewsBlock(false);
             }
             if ($show_subscribe_block == 'left side') {
                 $output .= $objNews->DrawSubscribeBlock(false);
             }
         }
         if (Modules::IsModuleInstalled('inquiries')) {
             if ($show_inquiries_block == 'left side') {
                 $output .= Inquiries::DrawLastInquiriesBlock(false);
             }
         }
     }
     if ($menu_position == 'right') {
         if (Modules::IsModuleInstalled('inquiries')) {
             if ($show_inquiries_block == 'right side') {
                 $output .= Inquiries::DrawLastInquiriesBlock(false);
             }
         }
         if (Modules::IsModuleInstalled('news')) {
             if ($show_news_block == 'right side') {
                 $output .= $objNews->DrawNewsBlock(false);
             }
             if ($show_subscribe_block == 'right side') {
                 $output .= $objNews->DrawSubscribeBlock(false);
             }
         }
     }
     if (ModulesSettings::Get('listings', 'show_directory_statistics') == $menu_position . ' side') {
         $output .= Listings::DrawDirectoryStatistics(false);
     }
     if ($menu_position == 'right') {
         if (Modules::IsModuleInstalled('adsense')) {
             $output .= '<div class="adsense-vertical">' . Adsense::GetVerticalBanerCode() . '</div>';
         }
     }
     if ($menus_count > 0) {
         $output .= '</div>';
     }
     $output .= '<br />';
     if ($draw) {
         echo $output;
     } else {
         return $output;
     }
 }
Example #25
0
		<tr>
			<td colspan="2">
				<input class="form_button" type="submit" name="btnSend" value="<?php 
    echo _SEND;
    ?>
">
			</td>
		</tr>
		<tr><td colspan="2" nowrap="nowrap" height="5px"></td></tr>		
		<tr>
			<td colspan="2">
				<?php 
    if (ModulesSettings::Get('customers', 'allow_login') == 'yes') {
        echo prepare_permanent_link('index.php?customer=login', _CUSTOMER_LOGIN) . '<br />';
    }
    if (ModulesSettings::Get('customers', 'allow_registration') == 'yes') {
        echo prepare_permanent_link('index.php?customer=create_account', _CREATE_ACCOUNT);
    }
    ?>
			</td>
		</tr>
		<tr><td colspan="2" nowrap="nowrap" height="5px"></td></tr>		
		</table>
	</form>
	</div>
	<script type="text/javascript">
		appSetFocus("resend_email");
	</script>	
<?php 
    //draw_content_end();
} else {
Example #26
0
    /**
     * Draw featured all links
     * 		@param $draw
     */
    public static function DrawRecentAll($draw = true)
    {
        global $objLogin;
        $show_expired_listings = ModulesSettings::Get('listings', 'show_expired_listings');
        echo '<table border="0" cellspacing="5">';
        echo '<tr><th></th><td colspan="3">' . draw_sub_title_bar(_RECENT_LISTINGS, false) . '</td></tr>';
        $where_condition = ' 1=1 ' . (!$objLogin->IsLoggedIn() ? ' AND access_level="public"' : '');
        $where_condition .= $show_expired_listings != 'yes' ? ' AND ((finish_publishing = \'0000-00-00 00:00:00\') OR (finish_publishing > \'' . date('Y-m-d H:i:s') . '\'))' : '';
        $result = self::GetAllListings($where_condition, 'date_published DESC', 100);
        if ($result[1] > 0) {
            echo '<tr>
					<th width="20px"></td>
					<th>' . _NAME . '</th>
					<th width="200px" align="center">' . _CATEGORY . '</th>
					<th width="200px" align="center">' . _DATE_PUBLISHED . '</th>
			</tr>';
            for ($i = 0; $i < $result[1] && $i < 100; $i++) {
                echo '<tr>
						<td align="right">' . ($i + 1) . '.</td>
						<td nowrap="nowrap">' . prepare_link('listing', 'lid', $result[0][$i]['id'], $result[0][$i]['business_name'], $result[0][$i]['business_name'], '') . '</td>
						<td align="center">' . $result[0][$i]['category_name'] . '</td>						
						<td align="center">' . format_datetime($result[0][$i]['date_published']) . '</td>						
				</tr>';
            }
            echo '<tr><td colspan="4">&nbsp;</td></tr>';
        } else {
            echo '<tr><td colspan="4">' . _NO_LISTINGS_TO_DISPLAY . '</td></tr>';
        }
        echo '</table>';
    }
Example #27
0
<?php

// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if (Modules::IsModuleInstalled('payments') && ModulesSettings::Get('payments', 'is_active') == 'yes') {
    draw_title_bar(prepare_breadcrumbs(array(_MY_ACCOUNT => '', _ADVERTISE => '', _ORDER_CANCELED => '')));
    draw_content_start();
    draw_message(_ORDER_WAS_CANCELED_MSG, true, true);
    draw_content_end();
} else {
    draw_important_message(_NOT_AUTHORIZED);
}
Example #28
0
    /**
     *	Draws comment submission form
     *		@param $article_id
     *		@param $image_verification
     *		@param $focus_field
     *		@param $task_completed
     *		@param $draw
     */
    private function DrawCommentsForm($article_id = '', $image_verification = 'no', $focus_field = '', $task_completed = false, $draw = true)
    {
        if (!$article_id) {
            return '';
        }
        global $objLogin;
        $user_id = '';
        $user_name = '';
        $user_name = isset($_POST['comment_user_name']) && !$task_completed ? decode_text(prepare_input($_POST['comment_user_name'])) : '';
        $user_email = isset($_POST['comment_user_email']) && !$task_completed ? decode_text(prepare_input($_POST['comment_user_email'])) : '';
        $comment_text = isset($_POST['comment_text']) && !$task_completed ? prepare_input($_POST['comment_text']) : '';
        $comment_length = ModulesSettings::Get('comments', 'comment_length');
        if ($objLogin->IsLoggedInAs($this->user_type_name)) {
            $user_id = $objLogin->GetLoggedID();
            $user_name = $objLogin->GetLoggedName();
        }
        $output = '
		<div class="comments_form_container">
		<form class="comments-form" method="post" name="frmComments" id="frmComments">
			' . draw_hidden_field('task', 'publish_comment', false, 'comment_task') . '
			' . draw_hidden_field('comment_id', '', false, 'comment_id') . '
			' . draw_hidden_field('article_id', $article_id, false) . '
			' . draw_hidden_field('user_id', $user_id, false) . '
			' . draw_token_field(false) . '
			
			<table border="0" width="98%">
			<tr><td colspan="3" nowrap height="7px"></td></tr>
			<tr>
				<td colspan="3">
					<b>' . _LEAVE_YOUR_COMMENT . '</b>	
				</td>
			</tr>
			<tr>
				<td>';
        if ($user_id == '') {
            $output .= _YOUR_NAME . ': <input type="text" name="comment_user_name" id="comment_user_name" style="width:140px" value="' . $user_name . '" maxlength="50" autocomplete="off" />&nbsp;';
            $output .= '<nobr>' . _YOUR_EMAIL . ': <input type="text" name="comment_user_email" id="comment_user_email" style="width:140px" value="' . $user_email . '" maxlength="70" autocomplete="off" /></nobr><br /><br />';
        } else {
            $output .= draw_hidden_field('comment_user_name', $user_name, false);
            $output .= draw_hidden_field('comment_user_email', $user_email, false);
        }
        $output .= _COMMENT_TEXT . ':<br />
				<textarea id="comment_text" name="comment_text" maxlength="' . $comment_length . '" style="width:96%" rows="5">' . stripcslashes($comment_text) . '</textarea><br />
				' . _CAN_USE_TAGS_MSG . ' &lt;b&gt;, &lt;i&gt;, &lt;u&gt;, &lt;br&gt; <br /><br />';
        //'._IMAGE_VERIFICATION.':<br />
        $output .= '</td>
				<td>&nbsp;</td>
				<td valign="top" width="180px" align="center">';
        if ($image_verification == 'yes') {
            $output .= '<table border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td>
								<img style="padding:0px;margin:0px;" id="captcha_image" src="modules/captcha/securimage_show.php?sid=' . md5(uniqid(time())) . '" />
							</td>	
							<td>
								<img style="cursor:pointer;padding:0px;margin:0px;" id="captcha_image_reload" src="modules/captcha/images/refresh.gif" style="cursor:pointer;" onclick="document.getElementById(\'captcha_image\').src = \'modules/captcha/securimage_show.php?sid=\' + Math.random(); appSetFocus(\'frmComments_captcha_code\'); return false" title="' . _REFRESH . '" alt="' . _REFRESH . '" /><br />
								<a href="modules/captcha/securimage_play.php"><img border="0" style="padding:0px; margin:0px;" id="captcha_image_play" src="modules/captcha/images/audio_icon.gif" title="' . _PLAY . '" alt="' . _PLAY . '" /></a>						
							</td>					
						</tr>
						<tr><td colspan="2" nowrap="nowrap" height="20px"></td></tr>
						<tr>
							<td colspan="2" align="center">
								' . _TYPE_CHARS . '
							</td>
						</tr>
						<tr><td colspan="2" nowrap="nowrap" height="10px"></td></tr>
						<tr>
							<td colspan="2">
								<input type="text" name="captcha_code" id="frmComments_captcha_code" style="width:175px" value="" maxlength="20" autocomplete="off" />
							</td>
						</tr>
						</table>';
        }
        $output .= '</td>
			</tr>			
			</table>
			<input type="submit" ' . ($objLogin->IsLoggedInAsAdmin() ? 'disabled' : '') . ' class="form_button" name="btnSubmitPC" id="btnSubmitPC" value="' . _PUBLISH_YOUR_COMMENT . '">
		</form>
		</div>';
        if ($focus_field != '') {
            $output .= '<script type="text/javascript">appSetFocus("' . $focus_field . '");</script>';
        }
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAs('owner', 'mainadmin') && Modules::IsModuleInstalled('gallery')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $mode = 'view';
    $msg = '';
    $objGallery = new ModulesSettings('gallery');
    if ($action == 'add') {
        $mode = 'add';
    } else {
        if ($action == 'create') {
            if ($objGallery->AddRecord()) {
                $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                $mode = 'view';
            } else {
                $msg = draw_important_message($objGallery->error, false);
                $mode = 'add';
            }
        } else {
            if ($action == 'edit') {
                $mode = 'edit';
            } else {
Example #30
0
 /**
  * Draw page text
  */
 public function DrawText()
 {
     global $objLogin;
     $objGallery = new GalleryAlbums();
     $objContactUs = ContactUs::Instance();
     $replace_needles = 1;
     $module_page = false;
     if (!count($this->page)) {
         return false;
     }
     // dont show this page if it was expired
     if (!$objLogin->IsLoggedInAsAdmin() && $this->page['finish_publishing'] != '0000-00-00' && date('Y-m-d') > $this->page['finish_publishing']) {
         draw_important_message(_PAGE_EXPIRED);
         return false;
     }
     if ($this->page['content_type'] == 'article' && isset($this->page['page_text'])) {
         $page_text = decode_text($this->page['page_text'], false);
         echo '<div class="pages_contents">';
         if (preg_match('/{module:gallery}/i', $page_text)) {
             $module_page = true;
             $page_text = @preg_replace('/{module:gallery}/i', $objGallery->DrawGallery(false), $page_text, 1);
         }
         if (preg_match_all('/{module:album=(.*?)}/i', $page_text, $matches)) {
             $module_page = true;
             if (is_array($matches[1])) {
                 foreach ($matches[1] as $key => $val) {
                     if (strtolower($val) != 'code') {
                         $val = @preg_replace('/[^A-Za-z0-9:]/i', '', $val);
                         $page_text = @preg_replace('/{module:album=' . $val . '}/i', $objGallery->DrawAlbum($val, false), $page_text, 1);
                     }
                 }
             }
         }
         if (self::$PROJECT == 'MedicalAppointment') {
             if (preg_match('/{module:about_us}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:about_us}/i', Clinic::DrawAboutUs(false), $page_text, 1);
             }
         }
         if (self::$PROJECT == 'HotelSite') {
             if (preg_match('/{module:about_us}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:about_us}/i', Hotels::DrawAboutUs(false), $page_text, 1);
             }
             if (preg_match('/{module:rooms}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:rooms}/i', Rooms::DrawRoomsInfo(false), $page_text, 1);
             }
             if (preg_match('/{module:testimonials}/i', $page_text)) {
                 $module_page = true;
                 $page_text = @preg_replace('/{module:testimonials}/i', Testimonials::DrawTestimonails(false), $page_text, 1);
             }
         }
         if (preg_match('/{module:contact_us}/i', $page_text)) {
             $module_page = true;
             $page_text = @preg_replace('/{module:contact_us}/i', $objContactUs->DrawContactUsForm(false), $page_text, 1);
         }
         if (preg_match('/{module:faq}/i', $page_text)) {
             $module_page = true;
             $page_text = @preg_replace('/{module:faq}/i', FaqCategories::DrawFaqList(false), $page_text, 1);
         }
         if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
             $page_text = stripslashes($page_text);
         }
         if ($this->page['is_home']) {
             if (self::$PROJECT == 'HotelSite') {
                 Campaigns::DrawCampaignBanner('standard');
                 Campaigns::DrawCampaignBanner('global');
             }
         }
         //echo $page_text;
         //echo "<hr>";
         // draw all needed blocks for Home page
         if ($this->page['is_home']) {
             if (self::$PROJECT == 'BusinessDirectory') {
                 if (ModulesSettings::Get('listings', 'show_categories_home_block') == 'yes') {
                     Categories::DrawHomePageBlock();
                 }
             } else {
                 if (self::$PROJECT == 'ShoppingCart') {
                     if (ModulesSettings::Get('products_catalog', 'is_active') == 'yes') {
                         Campaigns::DrawCampaignBanner();
                         if (ModulesSettings::Get('products_catalog', 'show_featured_block') == 'home page') {
                             Products::DrawFeaturedBlock('home');
                         }
                         if (ModulesSettings::Get('products_catalog', 'show_new_products_block') == 'home page') {
                             Products::DrawNewProductsBlock();
                         }
                         Categories::DrawHomePageBlock();
                     }
                 }
             }
         }
         // draw comments form
         if (!$this->page['is_home'] && !$module_page) {
             if (Modules::IsModuleInstalled('comments')) {
                 if (ModulesSettings::Get('comments', 'comments_allow') == 'yes' && $this->page['comments_allowed']) {
                     $objComments = new Comments();
                     $objComments->DrawArticleComments($this->page['id']);
                 }
             }
         }
         echo '</div>';
     } else {
         if ($this->page['content_type'] == 'link' && isset($this->page['link_url'])) {
             $link_url = decode_text($this->page['link_url']);
             echo '<div class="pages_contents">';
             echo '<a href="' . $link_url . '">' . $link_url . '</a>';
             echo '</div>';
         }
     }
 }