/**
 *  Get chart changer
 *  	@param $tabid
 *  	@param $chart_type
 *  	@param $year
 *  	@param $page
 **/
function get_chart_changer($tabid, $chart_type, $year, $page = 'statistics')
{
    $output = '<form action="' . APPHP_BASE . 'index.php?admin=' . $page . '" name="frmStatistics" method="post">
		' . draw_hidden_field('tabid', $tabid, false) . '
		' . draw_token_field(false) . '
		
		<table width="98%" align="center" style="background-color:#efefef;border:1px solid #ddd;">
		<tr>
			<td valign="middle">
			
			' . _TYPE . ': <select name="chart_type">
				<option value="barchart" ' . ($chart_type == 'barchart' ? ' selected="selected"' : '') . '>Barchart</option>
				<option value="columnchart" ' . ($chart_type == 'columnchart' ? ' selected="selected"' : '') . '>ColumnChart</option>
				<option value="piechart" ' . ($chart_type == 'piechart' ? ' selected="selected"' : '') . '>PieChart</option>
				<option value="areachart" ' . ($chart_type == 'areachart' ? ' selected="selected"' : '') . '>AreaChart</option>
			</select>&nbsp;&nbsp;
			
			' . _YEAR . ': <select name="year">';
    for ($y = date('Y') - 5; $y < date('Y') + 5; $y++) {
        $output .= '<option value="' . $y . '" ' . ($year == $y ? ' selected="selected"' : '') . '>' . $y . '</option>';
    }
    $output .= '</select>&nbsp;&nbsp;';
    $output .= '</td>
			<td valign="middle" align="' . Application::Get('defined_right') . '">
				<input type="button" class="form_button" onclick="frmStatistics_Submit();" value="' . _SUBMIT . '" />
			</td>
		</tr>
		</table>
		</form>';
    return $output;
}
Example #2
0
 public function _Write($key, $data)
 {
     global $user;
     $userId = empty($user->Id) ? 0 : $user->Id;
     $app = Application::Get();
     if (!$this->_save || empty($data) && empty($_COOKIE[$this->_name]) && $userId > 0) {
         return TRUE;
     }
     return db_get()->Call('system_session_write', $key, $userId, $app->RemoteIP, 1, $data);
 }
Example #3
0
 /**
  * Do a reverse rewrite of a link
  *
  * @access public
  * @param string $url
  * @return string $reverse_rewrite
  */
 public static function rewrite_reverse($url)
 {
     $application = Application::Get();
     $url = Util::rewrite_reverse_routes($url);
     if (isset($application->config->base_uri) and $application->config->base_uri !== null) {
         $url = trim($application->config->base_uri, '/') . '/' . trim($url, '/');
     }
     // We don't support relative URIs at all
     if (strpos($url, '/') !== 0) {
         $url = '/' . $url;
     }
     return $url;
 }
Example #4
0
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
$task = isset($_POST['task']) ? prepare_input($_POST['task']) : '';
$keyword = isset($_POST['keyword']) ? strip_tags(prepare_input($_POST['keyword'])) : '';
if ($keyword == _SEARCH_KEYWORDS . '...') {
    $keyword = '';
}
$p = isset($_POST['p']) ? (int) $_POST['p'] : '';
$objSearch = new Search();
$search_result = '';
$title_bar = _LOOK_IN . ': 
		<select class="look_in" name="search_in" onchange="javascript:document.getElementById(\'search_in\').value=this.value;appQuickSearch();">
			<option value="listings" ' . (Application::Get('search_in') == 'listings' ? 'selected="selected"' : '') . '>' . _LISTINGS . '</option>
			<option value="pages" ' . (Application::Get('search_in') == 'pages' ? 'selected="selected"' : '') . '>' . _PAGES . '</option>
			<option value="news" ' . (Application::Get('search_in') == 'news' ? 'selected="selected"' : '') . '>' . _NEWS . '</option>
		</select>';
// Check if there is a page
if ($keyword != '') {
    draw_title_bar(_SEARCH_RESULT_FOR . ': ' . $keyword . '', $title_bar);
    if ($task == 'quick_search') {
        $search_result = $objSearch->SearchBy($keyword, $p, Application::Get('search_in'));
    }
    $objSearch->DrawPopularSearches();
    $objSearch->DrawSearchResult($search_result, $p, $keyword);
} else {
    draw_title_bar(_SEARCH_RESULT_FOR . ': ' . $keyword);
    draw_important_message(_NO_RECORDS_FOUND);
}
Example #5
0
    /**
     * Returns levels info
     */
    public function GetLevelsInfo($category_id, $target = 'category')
    {
        $lang = Application::Get('lang');
        $output = array('first' => array('id' => '', 'name' => '', 'link' => ''), 'second' => array('id' => '', 'name' => '', 'link' => ''), 'third' => array('id' => '', 'name' => '', 'link' => ''));
        $sql = 'SELECT
					c.id,
					c.parent_id,
					cd.name									
				FROM ' . TABLE_CATEGORIES . ' c
					LEFT OUTER JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' cd ON c.id = cd.category_id
				WHERE
					c.id = _CID_ AND
					cd.language_id = \'' . $lang . '\'';
        $sql_1 = str_replace('_CID_', (int) $category_id, $sql);
        $result = database_query($sql_1, DATA_AND_ROWS, FIRST_ROW_ONLY);
        if ($result[1] > 0) {
            $output['first']['id'] = $result[0]['id'];
            $output['first']['name'] = $result[0]['name'];
            $output['first']['link'] = prepare_link($target, 'cid', $result[0]['id'], '', $result[0]['name'], '', '', true);
            $sql_2 = str_replace('_CID_', $result[0]['parent_id'], $sql);
            $result_2 = database_query($sql_2, DATA_AND_ROWS, FIRST_ROW_ONLY);
            if ($result_2[1] > 0) {
                $output['second']['id'] = $result_2[0]['id'];
                $output['second']['name'] = $result_2[0]['name'];
                $output['second']['link'] = prepare_link($target, 'cid', $result_2[0]['id'], '', $result_2[0]['name'], '', '', true);
                $sql_3 = str_replace('_CID_', $result_2[0]['parent_id'], $sql);
                $result_3 = database_query($sql_3, DATA_AND_ROWS, FIRST_ROW_ONLY);
                if ($result_3[1] > 0) {
                    $output['third']['id'] = $result_3[0]['id'];
                    $output['third']['name'] = $result_3[0]['name'];
                    $output['third']['link'] = prepare_link($target, 'cid', $result_3[0]['id'], '', $result_3[0]['name'], '', '', true);
                }
            }
        }
        return $output;
    }
    /**
     * Returns all email templates
     * 		@param @where_clause
     */
    private function GetAllTemplates($where_clause = '')
    {
        $sql = 'SELECT
					language_id,
					template_code,
					template_name,
					template_subject,
					template_content,
					is_system_template
				FROM ' . $this->tableName . '
				WHERE language_id = \'' . Application::Get('lang') . '\' ' . ($where_clause != '' ? ' AND ' . $where_clause : '') . '
				ORDER BY is_system_template ASC';
        $result = database_query($sql, DATA_AND_ROWS, ALL_ROWS);
        return $result;
    }
Example #7
0
    /**
     * Returns currencies dropdown list
     * 		@param $allow_seo_links
     */
    public static function GetCurrenciesDDL($allow_seo_links = true)
    {
        global $objSettings;
        $sel_currency = Application::Get('currency_code');
        $currency = Application::Get('currency');
        $output = '';
        $sql = 'SELECT id, name, symbol, code, rate, decimals, primary_order
				FROM ' . TABLE_CURRENCIES . '
				WHERE is_active = 1';
        if ($result = database_query($sql, DATA_AND_ROWS, ALL_ROWS)) {
            if ($result[1] > 1) {
                $base_url = APPHP_BASE;
                $url = get_page_url();
                // prevent wrong re-loading for some problematic cases
                if (self::$PROJECT == 'HotelSite') {
                    $url = str_replace(array('page=booking_payment'), 'page=booking_checkout', $url);
                    $url = str_replace(array('page=check_availability'), 'page=index', $url);
                } else {
                    if (self::$PROJECT == 'ShoppingCart') {
                        $url = str_replace(array('&act=add', '&act=remove'), '', $url);
                        $url = str_replace(array('page=order_proccess'), 'page=checkout', $url);
                        $url = str_replace(array('page=search'), 'page=index', $url);
                    }
                }
                // trim last character if ? or &
                $url = trim($url, '?&');
                if ($objSettings->GetParameter('seo_urls') == '1' && $allow_seo_links) {
                    // remove lang parameters
                    $url = str_replace('/' . Application::Get('lang') . '/', '/', $url);
                    if (preg_match('/\\/' . Application::Get('currency_code') . '\\//i', $url)) {
                        $url = str_replace('/' . Application::Get('currency_code') . '/', '/__CUR__/', $url);
                    } else {
                        $url = str_replace($base_url, $base_url . '__CUR__/', $url);
                    }
                } else {
                    if (preg_match('/currency=' . Application::Get('currency_code') . '/i', $url)) {
                        $url = str_replace('currency=' . Application::Get('currency_code'), 'currency=__CUR__', $url);
                    } else {
                        $url = $url . (preg_match('/\\?/', $url) ? '&amp;' : '?') . 'currency=__CUR__';
                    }
                }
                $output .= '<select onchange="javascript:appSetNewCurrency(\'' . $url . '\',this.value)" name="currency" class="currency_select">';
                for ($i = 0; $i < $result[1]; $i++) {
                    $output .= '<option value="' . $result[0][$i]['code'] . '" ' . ($sel_currency == $result[0][$i]['code'] ? ' selected="selected"' : '') . '>' . $result[0][$i]['name'] . '</option>';
                }
                $output .= '</select>';
            }
        }
        return $output;
    }
    /**
     *  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;
        }
    }
    function __construct($login_type = '')
    {
        parent::__construct();
        global $objSettings;
        $this->params = array();
        if (isset($_POST['first_name'])) {
            $this->params['first_name'] = prepare_input($_POST['first_name']);
        }
        if (isset($_POST['last_name'])) {
            $this->params['last_name'] = prepare_input($_POST['last_name']);
        }
        if (isset($_POST['user_name'])) {
            $this->params['user_name'] = prepare_input($_POST['user_name']);
        }
        if (isset($_POST['password'])) {
            $this->params['password'] = prepare_input($_POST['password']);
        }
        if (isset($_POST['email'])) {
            $this->params['email'] = prepare_input($_POST['email']);
        }
        if (isset($_POST['preferred_language'])) {
            $this->params['preferred_language'] = prepare_input($_POST['preferred_language']);
        }
        if (isset($_POST['account_type'])) {
            $this->params['account_type'] = prepare_input($_POST['account_type']);
        }
        if (isset($_POST['date_created'])) {
            $this->params['date_created'] = prepare_input($_POST['date_created']);
        }
        if (isset($_POST['is_active'])) {
            $this->params['is_active'] = (int) $_POST['is_active'];
        } else {
            $this->params['is_active'] = '0';
        }
        if (self::$PROJECT == 'HotelSite') {
            if (isset($_POST['hotels'])) {
                $this->params['hotels'] = prepare_input($_POST['hotels']);
            }
        }
        $this->primaryKey = 'id';
        $this->tableName = TABLE_ACCOUNTS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=admins_management';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        if ($login_type == 'owner') {
            $this->WHERE_CLAUSE = 'WHERE (' . TABLE_ACCOUNTS . '.account_type = \'mainadmin\' || ' . TABLE_ACCOUNTS . '.account_type = \'admin\' || ' . TABLE_ACCOUNTS . '.account_type = \'hotelowner\')';
        } else {
            if ($login_type == 'mainadmin') {
                $this->WHERE_CLAUSE = 'WHERE (' . TABLE_ACCOUNTS . '.account_type = \'admin\' || ' . TABLE_ACCOUNTS . '.account_type = \'hotelowner\')';
            } else {
                if ($login_type == 'admin') {
                    $this->WHERE_CLAUSE = 'WHERE ' . TABLE_ACCOUNTS . '.account_type = \'admin\'';
                } else {
                    if ($login_type == 'hotelowner') {
                        $this->WHERE_CLAUSE = 'WHERE ' . TABLE_ACCOUNTS . '.account_type = \'hotelowner\'';
                    }
                }
            }
        }
        $this->ORDER_CLAUSE = 'ORDER BY id ASC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        // define filtering fields
        $this->arrFilteringFields = array(_FIRST_NAME => array('table' => $this->tableName, 'field' => 'first_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _LAST_NAME => array('table' => $this->tableName, 'field' => 'last_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _ACTIVE => array('table' => $this->tableName, 'field' => 'is_active', 'type' => 'dropdownlist', 'source' => array('0' => _NO, '1' => _YES), 'sign' => '=', 'width' => '85px'));
        // prepare languages array
        $total_languages = Languages::GetAllActive();
        $arr_languages = array();
        foreach ($total_languages[0] as $key => $val) {
            $arr_languages[$val['abbreviation']] = $val['lang_name'];
        }
        $arr_account_types = array('admin' => _ADMIN, 'mainadmin' => _MAIN_ADMIN);
        if (self::$PROJECT == 'HotelSite') {
            $arr_account_types['hotelowner'] = _HOTEL_OWNER;
        }
        $arr_is_active = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        $datetime_format = get_datetime_format();
        if (self::$PROJECT == 'HotelSite') {
            $total_hotels = Hotels::GetAllActive();
            $arr_hotels = array();
            foreach ($total_hotels[0] as $key => $val) {
                $this->arrCompanies[$val['id']] = $val['name'];
            }
            $this->additionalFields = ', hotels';
            $this->accountTypeOnChange = 'onchange="javascript:AccountType_OnChange(this.value)"';
        }
        if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') {
            $this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i';
        } else {
            $this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i';
        }
        $this->SetLocale(Application::Get('lc_time_name'));
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									first_name,
		                            last_name,
									CONCAT(first_name, \' \', last_name) as full_name,
									user_name,
									email,
									preferred_language,
									account_type,
									DATE_FORMAT(date_lastlogin, \'' . $this->sqlFieldDatetimeFormat . '\') as date_lastlogin,
									is_active
									' . $this->additionalFields . '
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('full_name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => ''), 'user_name' => array('title' => _USER_NAME, 'type' => 'label', 'align' => 'left', 'width' => ''), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'link', 'maxlength' => '35', 'href' => 'mailto:{email}', 'align' => 'left', 'width' => ''), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'align' => 'center', 'width' => '120px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_account_types), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'align' => 'center', 'width' => '80px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_active), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label', 'align' => 'center', 'width' => '110px', 'format' => 'date', 'format_parameter' => $datetime_format), 'id' => array('title' => 'ID', 'type' => 'label', 'align' => 'center', 'width' => '40px'));
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '70', 'validation_type' => 'email', 'unique' => true)), 'separator_2' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USER_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'alpha_numeric', 'unique' => true, 'username_generator' => true), 'password' => array('title' => _PASSWORD, 'type' => 'password', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'password', 'cryptography' => PASSWORDS_ENCRYPTION, 'cryptography_type' => PASSWORDS_ENCRYPTION_TYPE, 'aes_password' => PASSWORDS_ENCRYPT_KEY, 'password_generator' => true), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'source' => $arr_account_types, 'javascript_event' => $this->accountTypeOnChange), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'default' => Application::Get('lang'), 'source' => $arr_languages)), 'separator_3' => array('separator_info' => array('legend' => _OTHER), 'date_lastlogin' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => ''), 'date_created' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => date('Y-m-d H:i:s')), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0', 'unique' => false)));
        if (self::$PROJECT == 'HotelSite') {
            $this->arrAddModeFields['separator_3']['hotels'] = array('title' => _HOTELS, 'type' => 'enum', 'width' => '', 'required' => false, 'readonly' => false, 'default' => '', 'source' => $this->arrCompanies, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'checkboxes', 'multi_select' => true);
        }
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.first_name,
								' . $this->tableName . '.last_name,
								' . $this->tableName . '.user_name,
								' . $this->tableName . '.password,
								' . $this->tableName . '.email,
								' . $this->tableName . '.account_type,
								' . $this->tableName . '.preferred_language,
								DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as date_created,
								DATE_FORMAT(' . $this->tableName . '.date_lastlogin, \'' . $this->sqlFieldDatetimeFormat . '\') as date_lastlogin,
								' . $this->tableName . '.is_active
								' . $this->additionalFields . '
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '32', 'required' => true, 'validation_type' => 'text'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '32', 'required' => true, 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '70', 'required' => true, 'validation_type' => 'email', 'unique' => true)), 'separator_2' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USER_NAME, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '32', 'required' => true, 'readonly' => true, 'validation_type' => 'alpha_numeric', 'unique' => true), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'width' => '120px', 'required' => true, 'maxlength' => '32', 'readonly' => $login_type == 'owner' ? false : true, 'source' => $arr_account_types, 'javascript_event' => $this->accountTypeOnChange), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'width' => '120px', 'required' => true, 'readonly' => false, 'source' => $arr_languages)), 'separator_3' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label'), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0')));
        if (self::$PROJECT == 'HotelSite') {
            $this->arrEditModeFields['separator_3']['hotels'] = array('title' => _HOTELS, 'type' => 'enum', 'width' => '', 'required' => false, 'readonly' => false, 'default' => '', 'source' => $this->arrCompanies, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'checkboxes', 'multi_select' => true);
        }
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.first_name,
								' . $this->tableName . '.last_name,
								' . $this->tableName . '.user_name,
								' . $this->tableName . '.password,
								' . $this->tableName . '.email,
								' . $this->tableName . '.preferred_language,
								' . $this->tableName . '.account_type,
								DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as date_created,
								DATE_FORMAT(' . $this->tableName . '.date_lastlogin, \'' . $this->sqlFieldDatetimeFormat . '\') as date_lastlogin,
								' . $this->tableName . '.is_active
								' . $this->additionalFields . '
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        $this->arrDetailsModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'label'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'label'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label')), 'separator_2' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USER_NAME, 'type' => 'label'), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'source' => $arr_account_types), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'source' => $arr_languages)), 'separator_3' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label'), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'source' => $arr_is_active)));
        if (self::$PROJECT == 'HotelSite') {
            $this->arrDetailsModeFields['separator_3']['hotels'] = array('title' => _HOTELS, 'type' => 'enum', 'width' => '', 'required' => false, 'readonly' => false, 'default' => '', 'source' => $this->arrCompanies, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'checkboxes', 'multi_select' => true);
        }
    }
Example #10
0
    /**
     *	Draws article comments
     *		@param $article_id
     *		@param $draw
     */
    public function DrawArticleComments($article_id = '', $draw = true)
    {
        if (!$article_id) {
            return '';
        }
        global $objLogin;
        $delete_pending_time = ModulesSettings::Get('comments', 'delete_pending_time');
        $user_type = ModulesSettings::Get('comments', 'user_type');
        $comment_length = ModulesSettings::Get('comments', 'comment_length');
        $image_verification = ModulesSettings::Get('comments', 'image_verification_allow');
        $comments_on_page = ModulesSettings::Get('comments', 'page_size');
        $is_published = ModulesSettings::Get('comments', 'pre_moderation_allow') == 'yes' ? '0' : '1';
        if ($image_verification == 'yes') {
            include_once 'modules/captcha/securimage.php';
            $objImg = new Securimage();
        }
        //echo '<pre>';
        //print_r($_SERVER);
        //echo '</pre>';
        $task = isset($_POST['task']) ? prepare_input($_POST['task']) : '';
        $comment_id = isset($_POST['comment_id']) ? (int) $_POST['comment_id'] : '';
        $init_state = 'closed';
        $user_id = isset($_POST['user_id']) ? (int) $_POST['user_id'] : '';
        $user_name = isset($_POST['comment_user_name']) ? prepare_input($_POST['comment_user_name']) : '';
        $user_email = isset($_POST['comment_user_email']) ? prepare_input($_POST['comment_user_email']) : '';
        $comment_text = isset($_POST['comment_text']) ? prepare_input($_POST['comment_text']) : '';
        $captcha_code = isset($_POST['captcha_code']) ? prepare_input($_POST['captcha_code']) : '';
        $msg = '';
        $task_completed = false;
        $focus_field = '';
        $current_page = isset($_GET['p']) ? abs((int) $_GET['p']) : '1';
        if ($task == 'publish_comment') {
            $init_state = 'opened';
            if ($user_name == '') {
                $msg = draw_important_message(_USERNAME_EMPTY_ALERT, false);
                $focus_field = 'comment_user_name';
            } else {
                if (!check_email_address($user_email) && !$objLogin->IsLoggedInAs($this->user_type_name)) {
                    $msg = draw_important_message(_EMAIL_IS_WRONG, false);
                    $focus_field = 'comment_user_email';
                } else {
                    if ($comment_text == '') {
                        $msg = draw_important_message(_MESSAGE_EMPTY_ALERT, false);
                        $focus_field = 'comment_text';
                    } else {
                        if ($comment_text != '' && strlen($comment_text) > $comment_length) {
                            $msg = draw_important_message(str_replace('_LENGTH_', $comment_length, _COMMENT_LENGTH_ALERT), false);
                            $focus_field = 'comment_text';
                        } else {
                            if ($image_verification == 'yes' && !$objImg->check($captcha_code)) {
                                $msg = draw_important_message(_WRONG_CODE_ALERT, false);
                                $focus_field = 'captcha_code';
                            } else {
                                // Block operation in demo mode
                                if (strtolower(SITE_MODE) == 'demo') {
                                    $msg = draw_important_message(_OPERATION_BLOCKED, false);
                                } else {
                                    if ($objLogin->IpAddressBlocked(get_current_ip())) {
                                        $msg = draw_important_message(_IP_ADDRESS_BLOCKED, false);
                                    } else {
                                        if ($objLogin->EmailBlocked($user_email)) {
                                            $msg = draw_important_message(_EMAIL_BLOCKED, false);
                                        } else {
                                            $sql = 'INSERT INTO ' . TABLE_COMMENTS . '(
									id,
									article_id,
									user_id,
									user_name,
									user_email,
									comment_text,
									date_created,
									date_published,
									is_published
								)VALUES(
									NULL,
									' . (int) $article_id . ',
									' . (int) $user_id . ',
									\'' . encode_text($user_name) . '\',
									\'' . encode_text($user_email) . '\',
									\'' . encode_text(strip_tags($comment_text, '<b><i><u><br>')) . '\',
									\'' . date('Y-m-d H:i:s') . '\',
									\'' . ($is_published == '1' ? date('Y-m-d H:i:s') : '0000-00-00 00:00:00') . '\',
									\'' . $is_published . '\'
								)';
                                            if (database_void_query($sql)) {
                                                if ($is_published == '1') {
                                                    $msg = draw_success_message(_COMMENT_POSTED_SUCCESS, false);
                                                } else {
                                                    $msg = draw_success_message(_COMMENT_SUBMITTED_SUCCESS, false);
                                                }
                                                $task_completed = true;
                                            } else {
                                                $msg = draw_important_message(_TRY_LATER, false);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        } else {
            if ($task == 'delete_comment') {
                $init_state = 'opened';
                $sql = 'DELETE FROM ' . $this->tableName . '
					WHERE TIMESTAMPDIFF(MINUTE, date_published, \'' . date('Y-m-d H:i:s') . '\') < ' . $delete_pending_time . ' AND
						  id = ' . (int) $comment_id;
                if (database_void_query($sql)) {
                    $msg = draw_success_message(_COMMENT_DELETED_SUCCESS, false);
                } else {
                    $msg = draw_important_message(_TRY_LATER, false);
                }
            }
        }
        // -------- pagination
        $total_comments = 0;
        $page_size = $comments_on_page;
        $sql = 'SELECT COUNT(*) as cnt FROM ' . TABLE_COMMENTS . ' WHERE is_published = 1 AND article_id = ' . (int) $article_id;
        $comments_result = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY);
        $total_comments = $comments_result['cnt'];
        $total_pages = (int) ($total_comments / $page_size);
        if ($current_page > $total_pages + 1) {
            $current_page = 1;
        }
        if ($total_comments % $page_size != 0) {
            $total_pages++;
        }
        if ($task_completed) {
            $current_page = $total_pages;
        }
        if (!is_numeric($current_page) || (int) $current_page <= 0) {
            $current_page = 1;
        }
        $start_row = ($current_page - 1) * $page_size;
        if (isset($_GET['p'])) {
            $init_state = 'opened';
        }
        // --------
        $sql = 'SELECT *
				FROM ' . TABLE_COMMENTS . '
				WHERE article_id = ' . (int) $article_id . ' AND is_published = 1
				ORDER BY date_published ASC 
				LIMIT ' . $start_row . ', ' . $page_size;
        $result = database_query($sql, DATA_AND_ROWS);
        $output = '<script type="text/javascript">function deleteComment(cid) {
			if(confirm(\'' . _PERFORM_OPERATION_COMMON_ALERT . '\')){
				jQuery(\'#comment_task\').val(\'delete_comment\');
				jQuery(\'#comment_id\').val(cid);
				jQuery(\'#frmComments\').submit();				
				return true;
			}
			return false;
		} </script>';
        $output .= '<div id="commentsLink"><a href="javascript:void(0);" onclick="javascript:jQuery(\'#commentsWrapper\').slideToggle(\'fast\');">' . str_replace('_COUNT_', $total_comments, _COMMENTS_LINK) . '</a><br /><br /></div>';
        $output .= '<div id="commentsWrapper" style="display:' . ($init_state == 'opened' ? '' : 'none') . ';">';
        $output .= '<div id="commentsPublished">';
        if ($result[1] > 0) {
            for ($i = 0; $i < $result[1]; $i++) {
                $output .= '<div class="comment">';
                $output .= '<div class="comment_user_name"><b>' . $result[0][$i]['user_name'] . '</b> ' . _SAID . '...</div>';
                $output .= '<div class="comment_test">' . $result[0][$i]['comment_text'] . '</div>';
                $output .= '<div class="comment_date">';
                if ($result[0][$i]['user_id'] == $objLogin->GetLoggedID() && floor(time_diff(date('Y-m-d H:i:s'), $result[0][$i]['date_published']) / 60) < $delete_pending_time) {
                    $output .= '<img src="images/published_x.gif" alt="" style="cursor:pointer;margin-bottom:-3px;margin-right:3px;" onclick="deleteComment(\'' . $result[0][$i]['id'] . '\');">';
                }
                $output .= '<i>' . _PUBLISHED . ': ' . format_datetime($result[0][$i]['date_published']) . '</i></div>';
                $output .= '</div>';
            }
            // draw pagination links
            if ($total_pages > 1) {
                $output .= '<div class="paging">';
                for ($page_ind = 1; $page_ind <= $total_pages; $page_ind++) {
                    $output .= prepare_permanent_link('index.php?page=' . Application::Get('page') . '&pid=' . Application::Get('page_id') . '&p=' . $page_ind, $page_ind == $current_page ? '<b>[' . $page_ind . ']</b>' : $page_ind, '', 'paging_link') . ' ';
                }
                $output .= '</div>';
            }
        } else {
            $output .= '<div class="comment">';
            $output .= '<b>' . _NO_COMMENTS_YET . '</b><br /><br />';
            $output .= '</div>';
        }
        $output .= '</div>';
        $output .= $msg != '' ? $msg . '<br />' : '';
        if ($user_type == 'registered' && !$objLogin->IsLoggedInAs($this->user_type_name)) {
            $output .= draw_message(_POST_COM_REGISTERED_ALERT, false);
        } else {
            $output .= $this->DrawCommentsForm($article_id, $image_verification, $focus_field, $task_completed, false);
        }
        $output .= '</div>';
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
Example #11
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 #12
0
            $params['tag_keywords'] = prepare_input($_POST['tag_keywords']);
        }
        if (isset($_POST['tag_description'])) {
            $params['tag_description'] = prepare_input($_POST['tag_description']);
        }
        if (isset($_POST['page_title'])) {
            $params['page_title'] = prepare_input($_POST['page_title']);
        }
        if (isset($_POST['page_text'])) {
            $params['page_text'] = prepare_input($_POST['page_text'], false, 'low');
        }
        if (isset($_POST['menu_link'])) {
            $params['menu_link'] = prepare_input($_POST['menu_link']);
        }
        $params['menu_id'] = isset($_POST['menu_id']) ? prepare_input($_POST['menu_id']) : '0';
        $params['page_key'] = create_seo_url(prepare_input($_POST['page_title']));
        $params['language_id'] = isset($_POST['language_id']) ? prepare_input($_POST['language_id']) : '';
        $params['finish_publishing'] = isset($_POST['finish_publishing']) && check_date($_POST['finish_publishing']) ? prepare_input($_POST['finish_publishing']) : '0000-00-00';
        if ($objPage->PageCreate($params, $copy_to_other_langs)) {
            $msg = draw_success_message(_PAGE_CREATED, false);
            $objSession->SetMessage('notice', $msg);
            header('location: index.php?admin=pages' . (Application::Get('type') != '' ? '&type=' . Application::Get('type') : '') . '&mg_language_id=' . $params['language_id']);
            exit;
        } else {
            $msg = draw_important_message($objPage->error, false);
        }
    }
    if ($msg == '') {
        $msg = draw_message(_ALERT_REQUIRED_FILEDS, false);
    }
}
Example #13
0
 /**
  * Draw recent listings side block with listings links
  * 		@param $draw
  */
 public static function DrawRecentBlock($draw = true)
 {
     global $objLogin;
     $show_expired_listings = ModulesSettings::Get('listings', 'show_expired_listings');
     $output = draw_block_top(_RECENT_LISTINGS, '', 'maximized', false);
     $listings_name_length = ModulesSettings::Get('listings', 'listings_name_length');
     $max_listings = 5;
     $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', $max_listings + 1);
     if ($result[1] > 0) {
         $output .= '<ul>';
         for ($i = 0; $i < $result[1] && $i < $max_listings; $i++) {
             $output .= '<li>' . prepare_link('listing', 'lid', $result[0][$i]['id'], $result[0][$i]['business_name'], substr_by_word($result[0][$i]['business_name'], $listings_name_length, true, Application::Get('lang')), '', $result[0][$i]['business_name']) . '</li>';
         }
         if ($result[1] > $max_listings) {
             $output .= '<li>' . prepare_link('listings', 'type', 'recent', 'all', _MORE . ' &raquo;', '', _MORE) . '</li>';
         }
         $output .= '</ul>';
     } else {
         $output .= _NO_LISTINGS_TO_DISPLAY;
     }
     $output .= draw_block_bottom(false);
     if ($draw) {
         echo $output;
     } else {
         return $output;
     }
 }
Example #14
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 #15
0
			</tr>

			<tr>
				<td colspan="3" align="center">
				<br /><br />
				<input type="submit" class="form_button" name="btnSubmitPD" id="btnSubmitPD" value="<?php 
        echo _SUBMIT;
        ?>
" onclick="return btnSubmitPD_OnClick()">
				</td>
			</tr>
			<tr><td colspan="2">&nbsp;</td></tr>
			
			<tr>
			<td colspan="3" align="<?php 
        echo Application::Get('defined_left');
        ?>
">
				<p><?php 
        echo _CREATE_ACCOUNT_NOTE;
        ?>
</p>
			</td>
			</tr>
			
			</table>
		</form>
	</div>	

	<script type="text/javascript">
		appSetFocus('<?php 
Example #16
0
    /**
     * 	Draw Installation form
     */
    public function DrawInstallationForm()
    {
        $output = '<table align="center" width="100%" border="0" cellspacing="0" cellpadding="3" class="main_text">
		<tr valign="top">
			<td width="45%">
				<form action="' . APPHP_BASE . 'index.php?admin=mod_backup_installation" method="post">
				' . draw_hidden_field('submition_type', '1', false) . '
				' . draw_token_field(false) . '
				<table align="center" width="100%" border="0" cellspacing="0" cellpadding="3" class="main_text">
				<tr><td colspan="2">&nbsp;</td></tr>
				<tr>
					<td align="' . Application::Get('defined_left') . '" colspan="2"><b>' . _BACKUP_YOUR_INSTALLATION . ': </b></td>		
				</tr>
				<tr>
					<td align="' . Application::Get('defined_left') . '" width="1%"><input type="text" name="backup_file" value="' . date('M-d-Y') . '" size="24" maxlength="20" /></td>
					<td align="' . Application::Get('defined_left') . '"><input class="form_button" type="submit" name="submit" value="' . _BACKUP . '" /></td>
				</tr>
				</table>
				</form>
			</td>
			<td width="55%">
				<table align="center" width="100%" border="0" cellspacing="0" cellpadding="3" class="main_text">
				<tr><td colspan="2">&nbsp;</td></tr>
				<tr>
					<td align="left" colspan="2"><b>' . _BACKUPS_EXISTING . ': </b></td>		
				</tr>
				' . $this->ShowPreviousBackups('delete', false) . '
				</table>			
			</td>
		</tr>
		</table>';
        echo $output;
    }
Example #17
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 (Modules::IsModuleInstalled('gallery')) {
    $objGalleryAlbum = new GalleryAlbums();
    $objGalleryAlbum->DrawAlbum(Application::Get('album_code'));
} else {
    draw_important_message(_PAGE_UNKNOWN);
}
?>
	
	
Example #18
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');
//--------------------------------------------------------------------------
$listing_type = Application::Get('type');
$listing_type_title = '';
if ($listing_type == 'featured') {
    $listing_type_title = _FEATURED_LISTINGS;
} else {
    if ($listing_type == 'recent') {
        $listing_type_title = _RECENT_LISTINGS;
    }
}
draw_title_bar(prepare_breadcrumbs(array(_LISTINGS => '', $listing_type_title => '')));
if (!empty($listing_type_title)) {
    if ($listing_type == 'featured') {
        Listings::DrawFeaturedAll();
    } else {
        if ($listing_type == 'recent') {
            Listings::DrawRecentAll();
        }
    }
} else {
    draw_important_message(_PAGE_UNKNOWN);
Example #19
0
?>
index.php"><?php 
echo $objSiteDescription->DrawHeader('header_text');
?>
</a>
	</div>
	<div id="siteSlogan" class="<?php 
echo 'float_' . Application::Get('defined_left');
?>
">
		<?php 
echo $objLogin->IsLoggedInAsAdmin() ? _ADMIN_PANEL : $objSiteDescription->GetParameter('slogan_text');
?>
	</div>	
	<div id="siteLinks" class="<?php 
echo 'float_' . Application::Get('defined_right');
?>
">
		<?php 
if ($objLogin->IsLoggedIn()) {
    ?>
			<form name="frmLogout" id="frmLogout" style="padding:0px;margin:0px;" action="index.php" method="post">
				<?php 
    draw_hidden_field('submit_logout', 'logout');
    ?>
				
				<?php 
    /*_YOU_ARE_LOGGED_AS.': '*/
    echo $objLogin->GetLoggedName();
    ?>
				<?php 
Example #20
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');
//--------------------------------------------------------------------------
$objListing = Listings::Instance(Application::Get('listing_id'));
$objCategory = Categories::Instance();
$category_info = $objCategory->GetLevelsInfo($objListing->GetField('category_id'));
draw_title_bar(prepare_breadcrumbs(array(_CATEGORIES => prepare_link('categories', '', '', 'all', _SEE_ALL, '', '', true), $category_info['third']['name'] => $category_info['third']['link'], $category_info['second']['name'] => $category_info['second']['link'], $category_info['first']['name'] => $category_info['first']['link'])));
$objListing->DrawListing();
Example #21
0
    /**
     *	Draws gallery
     *		@param $draw
     */
    public function DrawGallery($draw = true)
    {
        $lang = Application::Get('lang');
        $output = '';
        if (!Modules::IsModuleInstalled('gallery')) {
            return $output;
        }
        $icon_width = ModulesSettings::Get('gallery', 'album_icon_width');
        $icon_height = ModulesSettings::Get('gallery', 'album_icon_height');
        $albums_per_line = ModulesSettings::Get('gallery', 'albums_per_line');
        $image_gallery_type = ModulesSettings::Get('gallery', 'image_gallery_type');
        $show_items_count_in_album = ModulesSettings::Get('gallery', 'show_items_count_in_album');
        $image_gallery_rel = $image_gallery_type == 'lytebox' ? 'lyteshow' : 'rokbox';
        $sql = 'SELECT
					ga.id,
					ga.album_code,
					ga.album_type,
					gad.name,
					gad.description
				FROM ' . TABLE_GALLERY_ALBUMS . ' ga	
					LEFT OUTER JOIN ' . TABLE_GALLERY_ALBUMS_DESCRIPTION . ' gad ON ga.id = gad.gallery_album_id AND gad.language_id = \'' . $lang . '\'
				WHERE
					ga.is_active = 1
				ORDER BY ga.priority_order ASC';
        $result = database_query($sql, DATA_AND_ROWS);
        if ($result[1] > 0) {
            $output .= '<table class="gallery_table" border="0" cellspacing="5">';
            $output .= '<tr>';
            for ($i = 0; $i < $result[1]; $i++) {
                if ($i != 0 && $i % $albums_per_line == 0) {
                    $output .= '</tr><tr>';
                }
                $output .= '<td valign="top" align="center">';
                $sql = 'SELECT
							gai.item_file,
							gai.item_file_thumb,
							IF(gai.item_file_thumb != \'\', gai.item_file_thumb, gai.item_file) as mod_item_file_thumb, 
							gaid.name as item_name,
							gaid.description as item_description,
							IF(gaid.description != \'\', gaid.description, gaid.name) as item_title
						FROM ' . TABLE_GALLERY_ALBUM_ITEMS . ' gai
							INNER JOIN ' . TABLE_GALLERY_ALBUM_ITEMS_DESCRIPTION . ' gaid ON gai.id = gaid.gallery_album_item_id AND gaid.language_id = \'' . $lang . '\'
						WHERE
							gai.item_file != \'\' AND
							gai.album_code = \'' . $result[0][$i]['album_code'] . '\' AND
							gai.is_active = 1 
						ORDER BY gai.priority_order ASC';
                $result_items = database_query($sql, DATA_AND_ROWS);
                $gallery_icon = '';
                $gallery_links = '';
                $video_gallery_thumb = 'images/modules_icons/gallery/video_album.png';
                for ($j = 0; $j < $result_items[1]; $j++) {
                    if ($result[0][$i]['album_type'] == 'images') {
                        if ($gallery_icon == '' && $result_items[0][$j]['mod_item_file_thumb'] != '') {
                            $gallery_icon .= '<a href="' . APPHP_BASE . 'images/gallery/' . $result_items[0][$j]['item_file'] . '" rel="' . $image_gallery_rel . '[720 480](galbum' . $result[0][$i]['album_code'] . ')" title="' . $result_items[0][$j]['item_title'] . '"><img src="' . APPHP_BASE . 'images/gallery/' . $result_items[0][$j]['mod_item_file_thumb'] . '" width="' . $icon_width . '" ' . ($icon_height != 'px' ? 'height="' . $icon_height . '"' : '') . ' alt="" title="' . $result_items[0][$j]['item_title'] . '" border="0" /></a>';
                        } else {
                            $gallery_links .= '<a href="' . APPHP_BASE . 'images/gallery/' . $result_items[0][$j]['item_file'] . '" rel="' . $image_gallery_rel . '[720 480](galbum' . $result[0][$i]['album_code'] . ')" title="' . $result_items[0][$j]['item_title'] . '"></a>';
                        }
                    } else {
                        if ($result[0][$i]['album_type'] == 'video') {
                            if ($result_items[0][$j]['item_file_thumb'] != '' && @file_exists($video_gallery_thumb)) {
                                $video_gallery_thumb = $result_items[0][$j]['item_file_thumb'];
                            }
                        }
                    }
                }
                $output .= $gallery_icon;
                $output .= $gallery_links;
                if ($result[0][$i]['album_type'] == 'video') {
                    $output .= '<img src="' . APPHP_BASE . $video_gallery_thumb . '" width="' . $icon_width . '" ' . ($icon_height != 'px' ? 'height="' . $icon_height . '"' : '') . ' alt="" title="" border="0" />';
                    if ($j == 0) {
                        $output .= '<br /><span title="' . $result[0][$i]['description'] . '"><b>' . $result[0][$i]['name'] . '</b>' . ($show_items_count_in_album == 'yes' ? ' (' . $result_items[1] . ')' : '') . '</span>';
                    } else {
                        $output .= '<br />' . prepare_permanent_link('index.php?page=gallery&acode=' . $result[0][$i]['album_code'], '<span title="' . $result[0][$i]['description'] . '"><b>' . $result[0][$i]['name'] . '</b>' . ($show_items_count_in_album == 'yes' ? ' (' . $result_items[1] . ')' : '') . '</span>');
                    }
                } else {
                    if ($j == 0) {
                        $output .= '<img src="' . APPHP_BASE . 'images/gallery/no_image.png" width="' . $icon_width . '" ' . ($icon_height != 'px' ? 'height="' . $icon_height . '"' : '') . ' alt="" title="" border="0" />';
                        $output .= '<br /><span title="' . $result[0][$i]['description'] . '"><b>' . $result[0][$i]['name'] . '</b>' . ($show_items_count_in_album == 'yes' ? '(' . $result_items[1] . ')' : '') . '</span>';
                    } else {
                        $output .= '<br />' . prepare_permanent_link('index.php?page=gallery&acode=' . $result[0][$i]['album_code'], '<span title="' . $result[0][$i]['description'] . '"><b>' . $result[0][$i]['name'] . '</b>' . ($show_items_count_in_album == 'yes' ? ' (' . $result_items[1] . ')' : '') . '</span>');
                    }
                }
                $output .= '</td>';
            }
            $output .= '</tr>';
            $output .= '</table>';
        }
        if ($draw) {
            echo $output;
        } else {
            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');
//--------------------------------------------------------------------------
$objCategory = Categories::Instance();
$objListings = Listings::Instance();
$category_info = $objCategory->GetLevelsInfo(Application::Get('category_id'));
$button = '';
if (Modules::IsModuleInstalled('inquiries')) {
    $listings_locations = isset($_REQUEST['listings_locations']) ? (int) $_REQUEST['listings_locations'] : '';
    $listings_sub_locations = isset($_REQUEST['listings_sub_locations']) ? (int) $_REQUEST['listings_sub_locations'] : '';
    if (!empty($category_info['first']['id'])) {
        $button = '<input type="button" class="form_button" value="' . _SUBMIT_INQUIRY . '" onclick="appGoToPage(\'index.php?page=inquiry_form\',\'&inquiry_category=' . $category_info['first']['id'] . '&visitor_locations=' . $listings_locations . '&visitor_sub_locations=' . $listings_sub_locations . '\',\'post\')">';
    }
}
draw_title_bar(prepare_breadcrumbs(array(_CATEGORIES => prepare_link('categories', '', '', 'all', _SEE_ALL, '', '', true), $category_info['third']['name'] => $category_info['third']['link'], $category_info['second']['name'] => $category_info['second']['link'], $category_info['first']['name'] => '')), $button);
$objCategory->DrawSubCategories(Application::Get('category_id'), 'listings');
$objListings->DrawListings(Application::Get('category_id'));
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
</td></tr>
		<?php 
        for ($i = 0; $i < $all_pages[1]; $i++) {
            // prepare page header for display
            $page_header = $all_pages[0][$i]['page_title'];
            if (strlen($page_header) > 60) {
                $page_header = substr($page_header, 0, 60) . '..';
            }
            // prepare menu link for display
            $menu_name = $all_pages[0][$i]['menu_name'];
            if (strlen($menu_name) > 18) {
                $menu_name = substr($menu_name, 0, 18) . '..';
            }
            // display page row
            echo '<tr ' . highlight(0) . ' onmouseover="oldColor=this.style.backgroundColor;this.style.backgroundColor=\'#e7e7e7\';" onmouseout="this.style.backgroundColor=oldColor">
						<td align="' . Application::Get('defined_left') . '">' . $page_header . '</td>
						<td align="center">' . ($menu_name != '' ? $menu_name : _NOT_AVAILABLE) . '</td>
						<td align="center">' . format_datetime($all_pages[0][$i]['status_changed']) . '</td>
						<td align="center">' . ucfirst($all_pages[0][$i]['content_type']) . '</td>
						<td align="center" nowrap>
							' . prepare_permanent_link('index.php?page=pages&pid=' . $all_pages[0][$i]['id'] . '&mg_language_id=' . $language_id, _VIEW_WORD) . '&nbsp;&nbsp;' . draw_divider(false) . '&nbsp;
							' . ($objLogin->HasPrivileges('edit_pages') ? '<a href="javascript:void(0)" onclick="javascript:confirmRestore(\'' . $all_pages[0][$i]['id'] . '\');">' . _RESTORE . '</a>' : '') . '
							' . ($objLogin->HasPrivileges('edit_pages') && $objLogin->HasPrivileges('delete_pages') ? '&nbsp;' . draw_divider(false) . '' : '') . '&nbsp;
							' . ($objLogin->HasPrivileges('delete_pages') ? '<a href="javascript:void(0)" onclick="javascript:confirmDelete(\'' . $all_pages[0][$i]['id'] . '\');">' . _DELETE_WORD . '</a>' : '') . '
						</td>
					</tr>';
        }
        ?>
		</table>
<?php 
    } else {
/**
 * Send email
 * 		@param $recipient
 * 		@param $sender
 * 		@param $title
 * 		@param $body
 * 		@param $lang
 * 		@param $debug
 */
function send_email_wo_template($recipient, $sender, $subject, $body, $lang = '', $debug = false)
{
    global $objSettings;
    if ($lang == '') {
        $lang = Application::Get('lang');
        $lang_dir = Application::Get('lang_dir');
    } else {
        $lang_dir = Languages::Get($lang, 'lang_dir');
    }
    $text = '<div style="direction:' . $lang_dir . '">';
    $text .= $body;
    $text .= '</div>';
    if ($objSettings->GetParameter('mailer') == 'smtp') {
        $mail = PHPMailer::Instance();
        $mail->IsSMTP();
        // telling the class to use SMTP
        $mail->SMTPDebug = 0;
        // enables SMTP debug information (for testing)
        // 1 = errors and messages
        // 2 = messages only
        $mail->SMTPAuth = true;
        // enable SMTP authentication
        $mail->SMTPSecure = 'ssl';
        // sets the prefix to the server
        $mail->Host = $objSettings->GetParameter('smtp_host');
        $mail->Port = $objSettings->GetParameter('smtp_port');
        $mail->Username = $objSettings->GetParameter('smtp_username');
        $mail->Password = $objSettings->GetParameter('smtp_password');
        $mail->ClearAddresses();
        // clear previously added 'To' addresses
        $mail->ClearReplyTos();
        // clear previously added 'ReplyTo' addresses
        $mail->SetFrom($sender);
        // $mail->SetFrom($mail_from, 'First Last');
        $mail->AddReplyTo($sender);
        // $mail->AddReplyTo($mail_to, 'First Last');
        $mail->AddAddress($recipient);
        // $mail->AddAddress($mail_to, 'John Doe');
        $mail->Subject = $subject;
        $mail->AltBody = strip_tags($body);
        $mail->MsgHTML(nl2br($text));
        $result = $mail->Send();
    } else {
        $text_version = strip_tags($text);
        $html_version = nl2br($text);
        $objEmail = new Email($recipient, $sender, $subject);
        $objEmail->textOnly = false;
        $objEmail->content = $html_version;
        $result = $objEmail->Send();
    }
    if ($debug) {
        echo $text;
        exit;
    }
    return $result;
}
Example #26
0
/**
 *  Draw top empty block
 *  	@param $draw
 */
function draw_block_top_empty($draw = true)
{
    $output = '<div class="left_box_container" id="categories" style="padding:5px 0px 0px 0px;">
		       <div class="side_box_content' . (Application::Get('lang_dir') == 'ltr' ? ' left' : ' right') . '">';
    if ($draw) {
        echo $output;
    } else {
        return $output;
    }
}
Example #27
0
 /**
  * Include JavaScript
  * 
  */
 protected function IncludeJSFunctions($mode = '')
 {
     $nl = "\n";
     echo '<script type="text/javascript" src="include/classes/js/microgrid.js"></script>' . $nl;
     echo '<script type="text/javascript" src="include/classes/js/lang/en.js"></script>' . $nl;
     if ($this->alertOnDelete != '') {
         echo '<script type="text/javascript">Vocabulary._MSG[\'alert_delete_record\'] = \'' . $this->alertOnDelete . '\';</script>' . $nl;
     }
     // check for WYSIWYG Editor
     $include_wysiwyg_editor = false;
     if ($mode == 'add') {
         $arrModeFields =& $this->arrAddModeFields;
     } else {
         if ($mode == 'edit') {
             $arrModeFields =& $this->arrEditModeFields;
         }
     }
     if ($mode == 'add' || $mode == 'edit') {
         foreach ($arrModeFields as $key => $val) {
             if ($include_wysiwyg_editor == true) {
                 break;
             }
             if (preg_match('/separator/i', $key) && is_array($val)) {
                 foreach ($val as $v_key => $v_val) {
                     if ($v_key != 'separator_info') {
                         $type = isset($v_val['type']) ? strtolower($v_val['type']) : '';
                         $editor_type = isset($v_val['editor_type']) ? $v_val['editor_type'] : '';
                         if ($type == 'textarea' && $editor_type == 'wysiwyg') {
                             $include_wysiwyg_editor = true;
                         }
                     }
                 }
             } else {
                 $type = isset($val['type']) ? strtolower($val['type']) : '';
                 $editor_type = isset($val['editor_type']) ? $val['editor_type'] : '';
                 if ($type == 'textarea' && $editor_type == 'wysiwyg') {
                     $include_wysiwyg_editor = true;
                 }
             }
         }
     }
     $include_calendar = false;
     if ($mode == '' && is_array($this->arrFilteringFields)) {
         foreach ($this->arrFilteringFields as $key => $val) {
             $type = isset($val['type']) ? strtolower($val['type']) : '';
             if ($type == 'calendar') {
                 $include_calendar = true;
             }
         }
     }
     if ($include_wysiwyg_editor) {
         echo '<script type="text/javascript" src="modules/tinymce/tiny_mce.js"></script>';
         echo '<script type="text/javascript" src="include/classes/js/microgrid_tinymce.js"></script>';
     }
     if ($include_calendar) {
         echo '<link type="text/css" rel="stylesheet" href="modules/jscalendar/skins/aqua/theme.css" />' . $nl;
         echo '<script type="text/javascript" src="modules/jscalendar/calendar.js"></script>' . $nl;
         $lang = file_exists('modules/jscalendar/lang/calendar-' . Application::Get('lang') . '.js') ? Application::Get('lang') : 'en';
         echo '<script type="text/javascript" src="modules/jscalendar/lang/calendar-' . $lang . '.js"></script>' . $nl;
         echo '<script type="text/javascript" src="modules/jscalendar/calendar-setup.js"></script>' . $nl;
     }
 }
Example #28
0
    /**
     * Returns inquiries array
     * 		@param $where_clause
     * 		@param $order_clause
     * 		@param $limit
     */
    public static function GetAllInquiries($where_clause = '', $order_clause = 'RAND() ASC', $limit = '')
    {
        $output = array('0' => array(), '1' => '0');
        $sql = 'SELECT
					i.*,									
					cd.name as category_name,
					ld.business_name as business_name,
					ll.name as location_name
				FROM ' . TABLE_INQUIRIES . ' i
					INNER JOIN ' . TABLE_LISTINGS_LOCATIONS . ' ll ON i.location_id = ll.id
					LEFT OUTER JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' cd ON i.category_id = cd.category_id AND cd.language_id = \'' . Application::Get('lang') . '\'
					LEFT OUTER JOIN ' . TABLE_LISTINGS_DESCRIPTION . ' ld ON i.listing_id = ld.listing_id AND ld.language_id = \'' . Application::Get('lang') . '\'
				WHERE 1=1
					' . ($where_clause != '' ? ' AND ' . $where_clause : '') . '
				ORDER BY ' . $order_clause . (!empty($limit) ? ' LIMIT 0, ' . (int) $limit : '');
        $result = database_query($sql, DATA_AND_ROWS, ALL_ROWS);
        if ($result[1] > 0) {
            $output[0] = $result[0];
            $output[1] = $result[1];
        }
        return $output;
    }
Example #29
0
 /**
  * Prepare admin panel link
  * 		@param $href
  * 		@param $link
  * 		@param $params
  * 		@param $class
  * 		@param $href_array
  */
 private function PrepareLink($href, $link, $params = '', $class = '', $href_array = array())
 {
     $output = '';
     $css_class = $class != '' ? $class : '';
     $logged_as = $this->IsLoggedInAsCustomer() ? 'customer' : 'admin';
     if (Application::Get($logged_as) == $href || in_array(Application::Get($logged_as), $href_array)) {
         $is_active = true;
         if (!empty($params)) {
             $params_parts = explode('=', $params);
             $f_param = isset($params_parts[0]) && isset($_GET[$params_parts[0]]) ? $_GET[$params_parts[0]] : '';
             $s_param = isset($params_parts[1]) ? $params_parts[1] : '';
             if ($f_param != $s_param) {
                 $is_active = false;
             }
         }
     } else {
         $is_active = false;
     }
     if (!empty($css_class)) {
         $css_class = $is_active ? $css_class . ' active' : '';
     } else {
         $css_class = $is_active ? 'active' : '';
     }
     $output = prepare_permanent_link('index.php?' . $logged_as . '=' . $href . (!empty($params) ? '&' . $params : $params), $link, '', $css_class);
     return $output;
 }
Example #30
0
    /**
     *	Draws order description	
     * 		@param $rid
     */
    public function DrawOrderDescription($rid)
    {
        $output = '';
        $oid = isset($rid) ? (int) $rid : '0';
        $language_id = Languages::GetDefaultLang();
        $sql = 'SELECT
					' . $this->tableName . '.' . $this->primaryKey . ',
					' . $this->tableName . '.order_number,
					' . $this->tableName . '.order_description,
					' . $this->tableName . '.order_price,
					' . $this->tableName . '.vat_percent,
					' . $this->tableName . '.vat_fee,
					' . $this->tableName . '.total_price,
					' . $this->tableName . '.additional_info,
					' . $this->tableName . '.currency,
					' . $this->tableName . '.advertise_plan_id,
					' . $this->tableName . '.listings_amount,
					' . $this->tableName . '.customer_id,
					' . $this->tableName . '.cc_type,
					' . $this->tableName . '.cc_holder_name,
					IF(
						LENGTH(AES_DECRYPT(' . $this->tableName . '.cc_number, \'' . PASSWORDS_ENCRYPT_KEY . '\')) = 4,
						CONCAT(\'...\', AES_DECRYPT(' . $this->tableName . '.cc_number, \'' . PASSWORDS_ENCRYPT_KEY . '\')),
						AES_DECRYPT(' . $this->tableName . '.cc_number, \'' . PASSWORDS_ENCRYPT_KEY . '\')
					) as cc_number,								
					CONCAT(\'...\', SUBSTRING(AES_DECRYPT(cc_number, \'' . PASSWORDS_ENCRYPT_KEY . '\'), -4)) as cc_number_for_customer,								
					IF(
						LENGTH(AES_DECRYPT(' . $this->tableName . '.cc_number, \'' . PASSWORDS_ENCRYPT_KEY . '\')) = 4,
						\' (' . _CLEANED . ')\',
						\'\'
					) as cc_number_cleaned,								
					' . $this->tableName . '.cc_expires_month,
					' . $this->tableName . '.cc_expires_year,
					' . $this->tableName . '.cc_cvv_code, 
					' . $this->tableName . '.transaction_number,
					' . $this->tableName . '.created_date,
					' . $this->tableName . '.payment_date,
					' . $this->tableName . '.payment_type,
					' . $this->tableName . '.payment_method,
					CASE
						WHEN ' . $this->tableName . '.payment_type = 0 THEN "' . _ONLINE_ORDER . '"
						WHEN ' . $this->tableName . '.payment_type = 1 THEN "' . _PAYPAL . '"
						WHEN ' . $this->tableName . '.payment_type = 2 THEN "2CO"
						WHEN ' . $this->tableName . '.payment_type = 3 THEN "Authorize.Net"
						ELSE \'' . _UNKNOWN . '\'
					END as m_payment_type,
					CASE
						WHEN ' . $this->tableName . '.payment_method = 0 THEN "' . _PAYMENT_COMPANY_ACCOUNT . '"
						WHEN ' . $this->tableName . '.payment_method = 1 THEN "' . _CREDIT_CARD . '"
						WHEN ' . $this->tableName . '.payment_method = 2 THEN "E-Check"
						ELSE \'' . _UNKNOWN . '\'
					END as m_payment_method,
					CASE
						WHEN ' . $this->tableName . '.status = 0 THEN "<span style=color:#960000>' . _PREPARING . '</span>"
						WHEN ' . $this->tableName . '.status = 1 THEN "<span style=color:#FF9966>' . _PENDING . '</span>"
						WHEN ' . $this->tableName . '.status = 2 THEN "<span style=color:#336699>' . _PAID . '</span>"
						WHEN ' . $this->tableName . '.status = 3 THEN "<span style=color:#009600>' . _COMPLETED . '</span>"
						ELSE \'' . _UNKNOWN . '\'
					END as m_status,
					IF(' . $this->tableName . '.status_changed = "0000-00-00 00:00:00", "", ' . $this->tableName . '.status_changed) as status_changed,
					cust.user_name as customer_name,
					cur.symbol,
					cur.symbol_placement
				FROM ' . $this->tableName . '
					LEFT OUTER JOIN ' . TABLE_CURRENCIES . ' cur ON ' . $this->tableName . '.currency = cur.code
					LEFT OUTER JOIN ' . TABLE_CUSTOMERS . ' cust ON ' . $this->tableName . '.customer_id = cust.id
				WHERE
					' . $this->tableName . '.' . $this->primaryKey . ' = ' . (int) $oid;
        if ($this->customer_id != '') {
            $sql .= ' AND ' . $this->tableName . '.customer_id = ' . (int) $this->customer_id;
        }
        //camp.campaign_name,
        //camp.discount_percent
        //LEFT OUTER JOIN ".TABLE_CAMPAIGNS." camp ON ".$this->tableName.".discount_campaign_id = camp.id
        $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY, FETCH_ASSOC);
        $output .= '<div id="divDescriptionContent">';
        if ($result[1] > 0) {
            $plan_info = AdvertisePlans::GetPlanInfo($result[0]['advertise_plan_id']);
            $output .= '<table width="100%" dir="' . Application::Get('lang_dir') . '" border="0">';
            $output .= '<tr>
							<td width="20%"><b>' . _ORDER . ' #: </b></td><td width="30%">' . $result[0]['order_number'] . '</td>
							<td><b>' . _STATUS . ': </b></td><td>' . $result[0]['m_status'] . '</td>
						</tr>';
            $output .= '<tr>
							<td><b>' . _DESCRIPTION . ': </b></td><td>' . $result[0]['order_description'] . '</td>
							<td><b>' . _STATUS_CHANGED . ': </b></td><td>' . format_datetime($result[0]['status_changed']) . '</td>
						</tr>';
            $output .= '<tr>
							<td><b>' . _ADVERTISE_PLAN . ': </b></td><td>' . (isset($plan_info[0]['plan_name']) ? $plan_info[0]['plan_name'] : '') . '</td>
							<td colspan="2"></td>
						</tr>';
            $output .= '<tr>
							<td><b>' . _LISTINGS . ': </b></td><td>' . $result[0]['listings_amount'] . '</td>
							<td colspan="2"></td>
						</tr>';
            $output .= '<tr>
							<td><b>' . _ORDER_DATE . ': </b></td><td>' . format_datetime($result[0]['created_date']) . '</td>
							<td colspan="2"></td>
						</tr>';
            $output .= '<tr>
							<td><b>' . _PAYED_BY . ': </b></td><td>' . $result[0]['m_payment_type'] . '</td>
							<td colspan="2"></td>
						</tr>';
            $output .= '<tr>
							<td><b>' . _PAYMENT_METHOD . ': </b></td><td>' . $result[0]['m_payment_method'] . '</td>
							<td colspan="2"></td>
						</tr>';
            $output .= '<tr>
							<td><b>' . _TRANSACTION . ' #: </b></td><td>' . $result[0]['transaction_number'] . '</td>
							<td colspan="2"></td>
						</tr>';
            $output .= '<tr>
							<td><b>' . _ORDER_PRICE . ': </b></td><td>' . Currencies::PriceFormat($result[0]['order_price'], $result[0]['symbol'], $result[0]['symbol_placement'], $this->currency_format) . '</td>
							<td colspan="2" rowspan="4" valign="top">
								<b>' . _ADDITIONAL_INFO . '</b>:<br />
								' . ($result[0]['additional_info'] != '' ? $result[0]['additional_info'] : '--') . '
							</td>							
						</tr>';
            $output .= '<tr><td><b>' . _VAT . ': </b></td><td>' . Currencies::PriceFormat($result[0]['vat_fee'], $result[0]['symbol'], $result[0]['symbol_placement'], $this->currency_format) . ' (' . $result[0]['vat_percent'] . '%)</td></tr>';
            $output .= '<tr><td><b>' . _TOTAL_PRICE . ': </b></td><td>' . Currencies::PriceFormat($result[0]['total_price'], $result[0]['symbol'], $result[0]['symbol_placement'], $this->currency_format) . '</td></tr>';
            //if($result[0]['campaign_name'] != '') $output .= '<tr><td><b>'._DISCOUNT_CAMPAIGN.': </b></td><td>'.$result[0]['campaign_name'].' ('.$result[0]['discount_percent'].'%)</td><td colspan='2'></td></tr>';
            if ($this->customer_id == '') {
                $output .= '<tr><td><b>' . _CUSTOMER . ': </b></td><td>' . $result[0]['customer_name'] . '</td><td colspan="2"></td></tr>';
            }
            if ($result[0]['payment_type'] == '0') {
                // always show cc info, even if collecting is not requieed
                // $this->collect_credit_card == 'yes'
                $output .= '<tr><td colspan="4"></td></tr>';
                $output .= '<tr><td><b>' . _CREDIT_CARD_TYPE . ': </b></td><td>' . $result[0]['cc_type'] . '</td></tr>';
                $output .= '<tr><td><b>' . _CREDIT_CARD_HOLDER_NAME . ': </b></td><td>' . $result[0]['cc_holder_name'] . '</td></tr>';
                if ($this->customer_id == '') {
                    $output .= '<tr><td><b>' . _CREDIT_CARD_NUMBER . ': </b></td><td>' . $result[0]['cc_number'] . $result[0]['cc_number_cleaned'] . '</td></tr>';
                    $output .= '<tr><td><b>' . _EXPIRES . ': </b></td><td>' . ($result[0]['cc_expires_month'] != '' ? $result[0]['cc_expires_month'] . '/' . $result[0]['cc_expires_year'] : '') . '</td></tr>';
                    $output .= '<tr><td><b>' . _CVV_CODE . ': </b></td><td>' . $result[0]['cc_cvv_code'] . '</td></tr>';
                } else {
                    $output .= '<tr><td><b>' . _CREDIT_CARD_NUMBER . ': </b></td><td>' . $result[0]['cc_number_for_customer'] . '</td></tr>';
                }
            }
            $output .= '<tr><td colspan="4">&nbsp;</tr>';
            $output .= '</table>';
        }
        $output .= '</div>';
        $output .= '<table width="100%" border="0">';
        $output .= '<tr><td colspan="2">&nbsp;</tr>';
        $output .= '<tr>';
        $output .= '  <td colspan="2" align="left"><input type="button" class="mgrid_button" name="btnBack" value="' . _BUTTON_BACK . '" onclick="javascript:window.location.href=\'index.php?' . $this->page . '\';"></td>';
        $output .= '</tr>';
        $output .= '</table>';
        echo $output;
    }