Esempio n. 1
1
    function __construct($id = '')
    {
        $this->id = $id;
        $this->languageId = isset($_REQUEST['language_id']) && $_REQUEST['language_id'] != '' ? prepare_input($_REQUEST['language_id']) : Languages::GetDefaultLang();
        $this->whereClause = '';
        $this->whereClause .= $this->languageId != '' ? ' AND language_id = \'' . $this->languageId . '\'' : '';
        $this->langIdByUrl = $this->languageId != '' ? '&language_id=' . $this->languageId : '';
        if ($this->id != '') {
            $sql = 'SELECT
						' . TABLE_MENUS . '.*,
						' . TABLE_LANGUAGES . '.lang_name as language_name
					FROM ' . TABLE_MENUS . '
						LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_MENUS . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
					WHERE ' . TABLE_MENUS . '.id = \'' . (int) $this->id . '\'';
            $this->menu = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY);
        } else {
            $this->menu['menu_name'] = '';
            $this->menu['menu_placement'] = '';
            $this->menu['menu_order'] = '';
            $this->menu['language_id'] = '';
            $this->menu['language_name'] = '';
            $this->menu['access_level'] = '';
        }
    }
Esempio n. 2
0
 function __construct()
 {
     // get filter value
     $this->filterBy = isset($_REQUEST['filter_by']) ? prepare_input($_REQUEST['filter_by']) : '';
     $this->filterByUrl = $this->filterBy != '' ? '&filter_by=' . $this->filterBy : '';
     $this->languageId = isset($_REQUEST['language_id']) && $_REQUEST['language_id'] != '' ? prepare_input($_REQUEST['language_id']) : Languages::GetDefaultLang();
     $this->langIdByUrl = $this->languageId != '' ? '&language_id=' . $this->languageId : '';
     $this->whereClause = '';
     $this->whereClause .= $this->languageId != '' ? ' AND language_id = \'' . $this->languageId . '\'' : '';
     $this->whereClause .= $this->filterBy != '' ? ' AND key_value LIKE \'_' . $this->filterBy . '%\'' : '';
     $this->isKeyUpdated = false;
     $this->vocabularySize = 0;
     $this->currentKey = '';
     $this->updatedKeys = '0';
 }
Esempio n. 3
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;
    }
Esempio n. 4
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->IsLoggedInAsAdmin() && $objLogin->HasPrivileges('edit_pages') || $objLogin->HasPrivileges('delete_pages')) {
    $act = isset($_GET['act']) ? prepare_input($_GET['act']) : '';
    $language_id = isset($_REQUEST['language_id']) && $_REQUEST['language_id'] != '' ? prepare_input($_REQUEST['language_id']) : Languages::GetDefaultLang();
    $pid = isset($_GET['pid']) ? (int) $_GET['pid'] : '';
    $msg = '';
    $objPage = new Pages($pid);
    // do delete action
    if ($act == 'delete') {
        if ($objPage->PageDelete() && $objLogin->HasPrivileges('delete_pages')) {
            $msg = draw_success_message(_PAGE_DELETED, false);
        } else {
            $msg = draw_important_message($objPage->error, false);
        }
        // do restore action
    } else {
        if ($act == 'restore' && $objLogin->HasPrivileges('edit_pages')) {
            if ($objPage->PageRestore()) {
                $msg = draw_success_message(_PAGE_RESTORED, false);
            } else {
                $msg = draw_important_message($objPage->error, false);
Esempio n. 5
0
 /**
  *  Updates Feeds
  */
 public static function UpdateFeeds()
 {
     global $objSettings, $objSiteDescription;
     $default_lang = Languages::GetDefaultLang();
     $current_rss_ids = $objSettings->GetParameter('rss_last_ids');
     $rss_ids = '';
     self::SetType($objSettings->GetParameter('rss_feed_type'));
     self::SetChannel(APPHP_BASE . 'feeds/rss.xml', $objSiteDescription->GetParameter('header_text'), $objSiteDescription->GetParameter('tag_description'), 'en-us', '(c) copyright', $objSettings->GetParameter('admin_email'), $objSiteDescription->GetParameter('tag_description'));
     self::SetImage(APPHP_BASE . 'images/icons/logo.png');
     $all_news = News::GetAllNews('previous', $default_lang);
     for ($i = 0; $i < $all_news[1] && $i < 10; $i++) {
         $rss_ids .= ($i > 0 ? '-' : '') . $all_news[0][$i]['id'];
     }
     // check if there difference between RSS IDs, so we have to update RSS file
     if ($current_rss_ids != $rss_ids) {
         for ($i = 0; $i < $all_news[1] && $i < 10; $i++) {
             $rss_text = RSSFeed::CleanTextRss(strip_tags($all_news[0][$i]['body_text']));
             if (strlen($rss_text) > 512) {
                 $rss_text = substr_by_word($rss_text, 512) . '...';
             }
             #$rss_text = htmlentities($post_text, ENT_COMPAT, 'UTF-8');
             self::SetItem(APPHP_BASE . 'index.php?page=news&nid=' . $all_news[0][$i]['id'], $all_news[0][$i]['header_text'], $rss_text, $all_news[0][$i]['date_created']);
         }
         $objSettings->UpdateFields(array('rss_last_ids' => $rss_ids));
     }
     return self::SaveFeed();
 }
Esempio n. 6
0
 public static function Init()
 {
     global $objLogin, $objSettings, $objSiteDescription;
     self::$params['page'] = isset($_GET['page']) ? prepare_input($_GET['page']) : 'home';
     self::$params['page_id'] = isset($_REQUEST['pid']) ? prepare_input_alphanumeric($_REQUEST['pid']) : 'home';
     self::$params['system_page'] = isset($_GET['system_page']) ? prepare_input($_GET['system_page']) : '';
     self::$params['type'] = isset($_GET['type']) ? prepare_input($_GET['type']) : '';
     self::$params['admin'] = isset($_GET['admin']) ? prepare_input($_GET['admin']) : '';
     self::$params['user'] = isset($_GET['user']) ? prepare_input($_GET['user']) : '';
     self::$params['customer'] = isset($_GET['customer']) ? prepare_input($_GET['customer']) : '';
     self::$params['patient'] = isset($_GET['patient']) ? prepare_input($_GET['patient']) : '';
     self::$params['doctor'] = isset($_GET['doctor']) ? prepare_input($_GET['doctor']) : '';
     self::$params['news_id'] = isset($_GET['nid']) ? (int) $_GET['nid'] : '';
     self::$params['album_code'] = isset($_GET['acode']) ? strip_tags(prepare_input($_GET['acode'])) : '';
     self::$params['search_in'] = isset($_POST['search_in']) ? prepare_input($_POST['search_in']) : '';
     if (self::$params['search_in'] == '') {
         if (self::$PROJECT == 'BusinessDirectory') {
             self::$params['search_in'] = 'listings';
         } else {
             if (self::$PROJECT == 'ShoppingCart') {
                 self::$params['search_in'] = 'products';
             } else {
                 if (self::$PROJECT == 'HotelSite') {
                     self::$params['search_in'] = 'rooms';
                 }
             }
         }
     }
     self::$params['lang'] = isset($_GET['lang']) ? prepare_input($_GET['lang']) : '';
     self::$params['currency'] = isset($_GET['currency']) ? prepare_input($_GET['currency']) : '';
     self::$params['token'] = isset($_GET['token']) ? prepare_input($_GET['token']) : '';
     self::$params['listing_id'] = isset($_GET['lid']) ? (int) $_GET['lid'] : '';
     self::$params['category_id'] = isset($_GET['cid']) ? (int) $_GET['cid'] : '';
     self::$params['manufacturer_id'] = isset($_GET['mid']) ? (int) $_GET['mid'] : '';
     self::$params['product_id'] = isset($_REQUEST['prodid']) ? (int) $_REQUEST['prodid'] : '';
     $req_preview = isset($_GET['preview']) ? prepare_input($_GET['preview']) : '';
     //------------------------------------------------------------------------------
     // check and set token
     $token = md5(uniqid(rand(), true));
     self::$params['token'] = $token;
     Session::Set('token', $token);
     //------------------------------------------------------------------------------
     // save last visited page
     if (self::$params['allow_last_visited'] && !$objLogin->IsLoggedIn()) {
         $condition = !empty(self::$params['page']) && self::$params['page'] != 'home';
         if (self::$PROJECT == 'HotelSite') {
             $condition = self::$params['page'] == 'booking' || self::$params['page'] == 'booking_details';
         } else {
             if (self::$PROJECT == 'ShoppingCart') {
                 $condition = self::$params['page'] == 'shopping_cart' || self::$params['page'] == 'checkout';
             } else {
                 if (self::$PROJECT == 'MedicalAppointment') {
                     $condition = self::$params['page'] == 'checkout_signin';
                 }
             }
         }
         if ($condition) {
             Session::Set('last_visited', 'index.php?page=' . self::$params['page']);
             if (self::$params['page'] == 'pages' && !empty(self::$params['page_id']) && self::$params['page_id'] != 'home') {
                 Session::Set('last_visited', Session::Get('last_visited') . '&pid=' . self::$params['page_id']);
             } else {
                 if (self::$params['page'] == 'news' && !empty(self::$params['news_id'])) {
                     Session::Set('last_visited', Session::Get('last_visited') . '&nid=' . self::$params['news_id']);
                 } else {
                     if (self::$params['page'] == 'listing' && !empty(self::$params['listing_id'])) {
                         Session::Set('last_visited', Session::Get('last_visited') . '&lid=' . self::$params['listing_id']);
                     } else {
                         if (self::$params['page'] == 'category' && !empty(self::$params['category_id'])) {
                             Session::Set('last_visited', Session::Get('last_visited') . '&cid=' . self::$params['category_id']);
                         } else {
                             if (self::$params['page'] == 'manufacturer' && !empty(self::$params['manufacturer_id'])) {
                                 Session::Set('last_visited', Session::Get('last_visited') . '&mid=' . self::$params['product_id']);
                             } else {
                                 if (self::$params['page'] == 'product' && !empty(self::$params['product_id'])) {
                                     Session::Set('last_visited', Session::Get('last_visited') . '&prodid=' . self::$params['product_id']);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     //------------------------------------------------------------------------------
     // set language
     if ($objLogin->IsLoggedInAsAdmin()) {
         $pref_lang = $objLogin->GetPreferredLang();
         self::$params['lang'] = Languages::LanguageExists($pref_lang, false) ? $pref_lang : Languages::GetDefaultLang();
         $language_info = Languages::GetLanguageInfo(self::$params['lang']);
         self::$params['lang_dir'] = $language_info['lang_dir'];
         self::$params['lang_name'] = $language_info['lang_name'];
         self::$params['lang_name_en'] = $language_info['lang_name_en'];
         self::$params['lc_time_name'] = $language_info['lc_time_name'];
     } else {
         if (!$objLogin->IsLoggedIn() && (self::$params['admin'] == 'login' || self::$params['admin'] == 'password_forgotten')) {
             self::$params['lang'] = Languages::GetDefaultLang();
             $language_info = Languages::GetLanguageInfo(self::$params['lang']);
             self::$params['lang_dir'] = $language_info['lang_dir'];
             self::$params['lang_name'] = $language_info['lang_name'];
             self::$params['lang_name_en'] = $language_info['lang_name_en'];
             self::$params['lc_time_name'] = $language_info['lc_time_name'];
         } else {
             if (!empty(self::$params['lang']) && Languages::LanguageExists(self::$params['lang'])) {
                 //self::$params['lang']         = self::$params['lang'];
                 $language_info = Languages::GetLanguageInfo(self::$params['lang']);
                 Session::Set('lang', self::$params['lang']);
                 Session::Set('lang_dir', self::$params['lang_dir'] = $language_info['lang_dir']);
                 Session::Set('lang_name', self::$params['lang_name'] = $language_info['lang_name']);
                 Session::Set('lang_name_en', self::$params['lang_name_en'] = $language_info['lang_name_en']);
                 Session::Set('lc_time_name', self::$params['lc_time_name'] = $language_info['lc_time_name']);
             } else {
                 if (Session::Get('lang') != '' && Session::Get('lang_dir') != '' && Session::Get('lang_name') != '' && Session::Get('lang_name_en') != '') {
                     self::$params['lang'] = Session::Get('lang');
                     self::$params['lang_dir'] = Session::Get('lang_dir');
                     self::$params['lang_name'] = Session::Get('lang_name');
                     self::$params['lang_name_en'] = Session::Get('lang_name_en');
                     self::$params['lc_time_name'] = Session::Get('lc_time_name');
                 } else {
                     self::$params['lang'] = Languages::GetDefaultLang();
                     $language_info = Languages::GetLanguageInfo(self::$params['lang']);
                     self::$params['lang_dir'] = isset($language_info['lang_dir']) ? $language_info['lang_dir'] : '';
                     self::$params['lang_name'] = isset($language_info['lang_name']) ? $language_info['lang_name'] : '';
                     self::$params['lang_name_en'] = isset($language_info['lang_name_en']) ? $language_info['lang_name_en'] : '';
                     self::$params['lc_time_name'] = isset($language_info['lc_time_name']) ? $language_info['lc_time_name'] : '';
                 }
             }
         }
     }
     //------------------------------------------------------------------------------
     // set currency
     if (self::$PROJECT == 'ShoppingCart' || self::$PROJECT == 'HotelSite' || self::$PROJECT == 'BusinessDirectory' || self::$PROJECT == 'MedicalAppointment') {
         if (!empty(self::$params['currency']) && Currencies::CurrencyExists(self::$params['currency'])) {
             self::$params['currency_code'] = self::$params['currency'];
             $currency_info = Currencies::GetCurrencyInfo(self::$params['currency_code']);
             self::$params['currency_symbol'] = $currency_info['symbol'];
             self::$params['currency_rate'] = $currency_info['rate'];
             self::$params['currency_decimals'] = $currency_info['decimals'];
             self::$params['currency_symbol_place'] = $currency_info['symbol_placement'];
             Session::Set('currency_code', self::$params['currency']);
             Session::Set('currency_symbol', $currency_info['symbol']);
             Session::Set('currency_rate', $currency_info['rate']);
             Session::Set('currency_decimals', $currency_info['decimals']);
             Session::Set('symbol_placement', $currency_info['symbol_placement']);
         } else {
             if (Session::Get('currency_code') != '' && Session::Get('currency_symbol') != '' && Session::Get('currency_rate') != '' && Session::Get('currency_decimals') != '' && Session::Get('symbol_placement') != '' && Currencies::CurrencyExists(Session::Get('currency_code'))) {
                 self::$params['currency_code'] = Session::Get('currency_code');
                 self::$params['currency_symbol'] = Session::Get('currency_symbol');
                 self::$params['currency_rate'] = Session::Get('currency_rate');
                 self::$params['currency_decimals'] = Session::Get('currency_decimals');
                 self::$params['currency_symbol_place'] = Session::Get('symbol_placement');
             } else {
                 $currency_info = Currencies::GetDefaultCurrencyInfo();
                 self::$params['currency_code'] = $currency_info['code'];
                 self::$params['currency_symbol'] = $currency_info['symbol'];
                 self::$params['currency_rate'] = $currency_info['rate'];
                 self::$params['currency_decimals'] = $currency_info['decimals'];
                 self::$params['currency_symbol_place'] = $currency_info['symbol_placement'];
             }
         }
     }
     // preview allowed only for admins
     // -----------------------------------------------------------------------------
     if ($objLogin->IsLoggedInAsAdmin()) {
         if ($req_preview == 'yes' || $req_preview == 'no') {
             self::$params['preview'] = $req_preview;
             Session::Set('preview', self::$params['preview']);
         } else {
             if (self::$params['admin'] == '' && (Session::Get('preview') == 'yes' || Session::Get('preview') == 'no')) {
                 self::$params['preview'] = Session::Get('preview');
             } else {
                 self::$params['preview'] = 'no';
                 Session::Set('preview', self::$params['preview']);
             }
         }
     }
     // *** get site description
     // -----------------------------------------------------------------------------
     $objSiteDescription->LoadData(self::$params['lang']);
     // *** draw offline message
     // -----------------------------------------------------------------------------
     if ($objSettings->GetParameter('is_offline')) {
         if (!$objLogin->IsLoggedIn() && self::$params['admin'] != 'login') {
             $offline_content = @file_get_contents('html/site_offline.html');
             if (!empty($offline_content)) {
                 $offline_content = str_ireplace(array('{HEADER_TEXT}', '{SLOGAN_TEXT}', '{OFFLINE_MESSAGE}', '{FOOTER}'), array($objSiteDescription->GetParameter('header_text'), $objSiteDescription->GetParameter('slogan_text'), $objSettings->GetParameter('offline_message'), $objSiteDescription->DrawFooter(false)), $offline_content);
             } else {
                 $offline_content = $objSettings->GetParameter('offline_message');
             }
             echo $offline_content;
             exit;
         }
     }
     // *** draw offline message
     // -----------------------------------------------------------------------------
     if ($objSettings->GetParameter('is_offline')) {
         if (!$objLogin->IsLoggedIn() && self::$params['admin'] != 'login') {
             echo '<html>';
             echo '<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>';
             echo '<body>' . $objSettings->GetParameter('offline_message') . '</body>';
             echo '</html>';
             exit;
         }
     }
     // *** run cron jobs file
     // -----------------------------------------------------------------------------
     if ($objSettings->GetParameter('cron_type') == 'non-batch') {
         include_once 'cron.php';
     }
     // *** default user page
     // -----------------------------------------------------------------------------
     if (self::$PROJECT == 'MicroCMS') {
         if ($objLogin->IsLoggedInAsUser()) {
             if (self::$params['user'] == '' && self::$params['page'] == '') {
                 self::$params['user'] = '******';
             }
         }
     } else {
         if (self::$PROJECT == 'BusinessDirectory') {
             if ($objLogin->IsLoggedInAsCustomer()) {
                 if (self::$params['customer'] == '' && self::$params['page'] == '') {
                     self::$params['customer'] = 'home';
                 }
             }
         } else {
             if (self::$PROJECT == 'ShoppingCart') {
                 if ($objLogin->IsLoggedInAsCustomer()) {
                     if (self::$params['customer'] == '' && self::$params['page'] == '') {
                         self::$params['customer'] = 'home';
                     }
                 }
             } else {
                 if (self::$PROJECT == 'HotelSite') {
                     if ($objLogin->IsLoggedInAsCustomer()) {
                         if (self::$params['customer'] == '' && self::$params['page'] == '') {
                             self::$params['customer'] = 'home';
                         }
                     }
                 } else {
                     if (self::$PROJECT == 'MedicalAppointment') {
                         if ($objLogin->IsLoggedInAsPatient()) {
                             if (self::$params['patient'] == '' && self::$params['page'] == '') {
                                 self::$params['patient'] = 'home';
                             }
                         }
                         if ($objLogin->IsLoggedInAsDoctor()) {
                             if (self::$params['doctor'] == '' && self::$params['page'] == '') {
                                 self::$params['doctor'] = 'home';
                             }
                         }
                     }
                 }
             }
         }
     }
     // *** get site template
     // -----------------------------------------------------------------------------
     self::$params['template'] = $objSettings->GetTemplate() != '' ? $objSettings->GetTemplate() : DEFAULT_TEMPLATE;
     if ($objLogin->IsLoggedInAsAdmin() && (self::$params['preview'] != 'yes' || self::$params['admin'] != '')) {
         self::$params['template'] = 'admin';
     } else {
         if (!$objLogin->IsLoggedIn() && (self::$params['admin'] == 'login' || self::$params['admin'] == 'password_forgotten')) {
             self::$params['template'] = 'admin';
         }
     }
     // *** use direction of selected language
     // -----------------------------------------------------------------------------
     self::$params['defined_left'] = self::$params['lang_dir'] == 'ltr' ? 'left' : 'right';
     self::$params['defined_right'] = self::$params['lang_dir'] == 'ltr' ? 'right' : 'left';
     self::$params['defined_alignment'] = self::$params['lang_dir'] == 'ltr' ? 'left' : 'right';
     // *** prepare META tags
     // -----------------------------------------------------------------------------
     if (self::$params['page'] == 'news' && self::$params['news_id'] != '') {
         $news_info = News::GetNewsInfo(self::$params['news_id'], self::$params['lang']);
         self::$params['tag_title'] = isset($news_info['header_text']) ? $news_info['header_text'] : $objSiteDescription->GetParameter('tag_title');
         self::$params['tag_keywords'] = isset($news_info['header_text']) ? str_replace(' ', ',', $news_info['header_text']) : $objSiteDescription->GetParameter('tag_keywords');
         self::$params['tag_description'] = isset($news_info['header_text']) ? $news_info['header_text'] : $objSiteDescription->GetParameter('tag_description');
     } else {
         if (self::$params['system_page'] != '') {
             $objPage = new Pages(self::$params['system_page'], true);
         } else {
             $objPage = new Pages(self::$params['page_id'], true);
         }
         self::$params['tag_title'] = $objPage->GetParameter('tag_title') != '' ? $objPage->GetParameter('tag_title') : $objSiteDescription->GetParameter('tag_title');
         self::$params['tag_keywords'] = $objPage->GetParameter('tag_keywords') != '' ? $objPage->GetParameter('tag_keywords') : $objSiteDescription->GetParameter('tag_keywords');
         self::$params['tag_description'] = $objPage->GetParameter('tag_description') != '' ? $objPage->GetParameter('tag_description') : $objSiteDescription->GetParameter('tag_description');
         if (self::$PROJECT == 'BusinessDirectory') {
             if (self::$params['page'] == 'category') {
                 $category_info = Categories::GetCategoryInfo(self::$params['category_id']);
                 self::$params['tag_title'] = isset($category_info['name']) ? strip_tags($category_info['name']) : '';
                 self::$params['tag_keywords'] = isset($category_info['name']) ? strip_tags($category_info['name']) : '';
                 self::$params['tag_description'] = isset($category_info['description']) ? strip_tags($category_info['description']) : '';
             } else {
                 if (self::$params['page'] == 'listing') {
                     $listing_info = Listings::GetListingInfo(self::$params['listing_id']);
                     self::$params['tag_title'] = isset($listing_info['business_name']) ? strip_tags($listing_info['business_name']) : '';
                     self::$params['tag_keywords'] = isset($listing_info['business_name']) ? trim(strip_tags($listing_info['business_name'])) : '';
                     self::$params['tag_description'] = isset($listing_info['business_address']) ? trim(strip_tags($listing_info['business_address'])) : self::$params['tag_title'];
                 }
             }
         }
     }
     // *** included js libraries
     // -----------------------------------------------------------------------------
     self::$params['js_included'] = array();
 }
Esempio n. 7
0
    function __construct($page_id = '')
    {
        parent::__construct();
        global $objSettings;
        $this->params = array();
        ## for standard fields
        if (isset($_POST['is_published'])) {
            $this->params['is_published'] = prepare_input($_POST['is_published']);
        }
        if (isset($_POST['date_published'])) {
            $this->params['date_published'] = prepare_input($_POST['date_published']);
        }
        if ($page_id == 'home') {
            $page_id = '';
        }
        ## for checkboxes
        //$this->params['parameter4'] = isset($_POST['parameter4']) ? $_POST['parameter4'] : '0';
        ## for images
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = $_POST['icon'];
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_COMMENTS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_comments_management' . ($page_id != '' ? '&pid=' . (int) $page_id : '');
        $this->actions = array('add' => false, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = $page_id != '' ? 'WHERE ' . $this->tableName . '.article_id=' . $page_id : '';
        $this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.is_published ASC, ' . $this->tableName . '.date_created DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        // define filtering fields
        $this->arrFilteringFields = array(_PUBLISHED => array('table' => $this->tableName, 'field' => 'is_published', 'type' => 'dropdownlist', 'source' => array('0' => _NO, '1' => _YES), 'sign' => '=', 'width' => '90px'));
        $datetime_format = get_datetime_format();
        $arr_is_published = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') {
            $this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i';
            $this->sqlFieldDateFormat = '%b %d, %Y';
        } else {
            $this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i';
            $this->sqlFieldDateFormat = '%d %b, %Y';
        }
        $this->SetLocale(Application::Get('lc_time_name'));
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ',
									' . $this->tableName . '.article_id,
									' . $this->tableName . '.user_id,
									' . $this->tableName . '.user_name,
									' . $this->tableName . '.user_email,
									' . $this->tableName . '.comment_text,									
									DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_created,
									CONCAT("<img src=\\"images/", IF(' . $this->tableName . '.is_published, "published_g.gif", "published_x.gif"), "\\" alt=\\"\\" />") as is_published,
									' . TABLE_PAGES . '.page_title,
									' . TABLE_LANGUAGES . '.lang_name
								FROM ' . $this->tableName . '
									LEFT OUTER JOIN ' . TABLE_PAGES . ' ON ' . $this->tableName . '.article_id = ' . TABLE_PAGES . '.id
									LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
								';
        // define view mode fields
        $this->arrViewModeFields = array('mod_date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'align' => 'left', 'width' => '160px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => ''), 'page_title' => array('title' => _ARTICLE, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '', 'format' => ''), 'is_published' => array('title' => _PUBLISHED, 'type' => 'label', 'align' => 'center', 'width' => '80px'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '', 'format' => ''), 'user_email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label', 'align' => 'center', 'width' => '130px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '32', 'format' => ''), 'user_name' => array('title' => _USERNAME, 'type' => 'label', 'align' => 'center', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '32', 'format' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.article_id,
								' . $this->tableName . '.user_id,
								' . $this->tableName . '.user_name,
								' . $this->tableName . '.user_email,
								' . $this->tableName . '.comment_text,
								' . $this->tableName . '.is_published,
								DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as date_created,
								' . $this->tableName . '.date_published,
								IF(' . $this->tableName . '.date_published = "0000-00-00 00:00:00", "", DATE_FORMAT(' . $this->tableName . '.date_published, \'' . $this->sqlFieldDatetimeFormat . '\')) as m_date_published,
								' . TABLE_PAGES . '.page_title,
								' . TABLE_LANGUAGES . '.lang_name
							FROM ' . $this->tableName . '
								LEFT OUTER JOIN ' . TABLE_PAGES . ' ON ' . $this->tableName . '.article_id = ' . TABLE_PAGES . '.id
								LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('page_title' => array('title' => _ARTICLE, 'type' => 'label'), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'user_email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label'), 'comment_text' => array('title' => _TEXT, 'type' => 'label'), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'date_published' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => date('Y-m-d H:i:s')), 'm_date_published' => array('title' => _DATE_PUBLISHED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'is_published' => array('title' => _APPROVE, 'type' => 'enum', 'width' => '80px', 'required' => true, 'readonly' => false, 'source' => array('1' => _YES), 'unique' => false));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('page_title' => array('title' => _ARTICLE, 'type' => 'label'), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'user_email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label'), 'comment_text' => array('title' => _TEXT, 'type' => 'label', 'format' => 'nl2br'), 'is_published' => array('title' => _APPROVED, 'type' => 'enum', 'source' => $arr_is_published), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'm_date_published' => array('title' => _DATE_PUBLISHED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format));
    }
Esempio n. 8
0
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['field1'])) {
            $this->params['field1'] = prepare_input($_POST['field1']);
        }
        if (isset($_POST['field2'])) {
            $this->params['field2'] = prepare_input($_POST['field2']);
        }
        if (isset($_POST['field3'])) {
            $this->params['field3'] = prepare_input($_POST['field3']);
        }
        ## for checkboxes
        //$this->params['field4'] = isset($_POST['field4']) ? prepare_input($_POST['field4']) : '0';
        ## for images (not necessary)
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = prepare_input($_POST['icon']);
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        ## for files:
        // define nothing
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = DB_PREFIX . 'table';
        // TABLE_NAME
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=page_name';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = false;
        $this->alertOnDelete = '';
        // leave empty to use default alerts
        $this->allowLanguages = true;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->GROUP_BY_CLAUSE = '';
        // GROUP BY '.$this->tableName.'.order_number
        $this->ORDER_CLAUSE = '';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        // exporting settings
        $this->isExportingAllowed = false;
        $this->arrExportingTypes = array('csv' => false);
        // define filtering fields
        $this->isFilteringAllowed = false;
        $this->arrFilteringFields = array();
        ///$this->isAggregateAllowed = false;
        ///// define aggregate fields for View Mode
        ///$this->arrAggregateFields = array(
        ///	'field1' => array('function'=>'SUM', 'align'=>'center', 'aggregate_by'=>'', 'decimal_place'=>2),
        ///	'field2' => array('function'=>'AVG', 'align'=>'center', 'aggregate_by'=>'', 'decimal_place'=>2),
        ///);
        ///$date_format = get_date_format('view');
        ///$date_format_settings = get_date_format('view', true); /* to get pure settings format */
        ///$date_format_edit = get_date_format('edit');
        ///$datetime_format = get_datetime_format();
        ///$time_format = get_time_format(); /* by default 1st param - shows seconds */
        ///$currency_format = get_currency_format();
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        ///////////////////////////////////////////////////////////////////////////////
        // #002. prepare translation fields array
        /// $this->arrTranslations = $this->PrepareTranslateFields(
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        // #003. prepare translations array for add/edit/detail modes
        /// REMEMBER! to add '.$sql_translation_description.' in EDIT_MODE_SQL
        /// $sql_translation_description = $this->PrepareTranslateSql(
        ///	TABLE_XXX_DESCRIPTION,
        ///	'gallery_album_id',
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags, nl2br, readonly_text
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A'
        // format: 'format'=>'currency', 'format_parameter'=>'european|2' or 'format_parameter'=>'american|4'
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									field1,
									field2,
									field3
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array();
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        // - for editable passwords they must be defined directly in SQL : '.$this->tableName.'.user_password,
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.field1,
								' . $this->tableName . '.field2,
								' . '
								' . $this->tableName . '.field3
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array();
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array();
        ///////////////////////////////////////////////////////////////////////////////
        // #004. add translation fields to all modes
        /// $this->AddTranslateToModes(
        /// $this->arrTranslations,
        /// array('name'        => array('title'=>_NAME, 'type'=>'textbox', 'width'=>'410px', 'required'=>true, 'maxlength'=>'', 'readonly'=>false),
        /// 	  'description' => array('title'=>_DESCRIPTION, 'type'=>'textarea', 'width'=>'410px', 'height'=>'90px', 'required'=>false, 'maxlength'=>'', 'maxlength'=>'512', 'validation_maxlength'=>'512', 'readonly'=>false)
        /// )
        /// );
        ///////////////////////////////////////////////////////////////////////////////
    }
Esempio n. 9
0
/**
* @project ApPHP Business Directory
* @copyright (c) 2012 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->IsLoggedInAsAdmin()) {
    $submition_type = isset($_POST['submition_type']) ? prepare_input($_POST['submition_type']) : '';
    $site_template = isset($_POST['site_template']) ? prepare_input($_POST['site_template']) : '';
    $cron_type = isset($_POST['cron_type']) ? prepare_input($_POST['cron_type']) : $objSettings->GetParameter('cron_type');
    $http_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : _UNKNOWN;
    $language_id = isset($_POST['sel_language_id']) ? prepare_input($_POST['sel_language_id']) : Languages::GetDefaultLang();
    $msg = '';
    $focus_on_field = '';
    $objSiteDescription->LoadData($language_id);
    $params = array();
    $params['seo_urls'] = isset($_POST['seo_urls']) ? prepare_input($_POST['seo_urls']) : $objSettings->GetParameter('seo_urls');
    $params['rss_feed'] = isset($_POST['rss_feed']) ? prepare_input($_POST['rss_feed']) : $objSettings->GetParameter('rss_feed');
    $params['rss_feed_type'] = isset($_POST['rss_feed_type']) ? prepare_input($_POST['rss_feed_type']) : $objSettings->GetParameter('rss_feed_type');
    $params['is_offline'] = isset($_POST['is_offline']) ? prepare_input($_POST['is_offline']) : $objSettings->GetParameter('is_offline');
    $params['offline_message'] = isset($_POST['offline_message']) ? prepare_input($_POST['offline_message']) : $objSettings->GetParameter('offline_message');
    $params['caching_allowed'] = isset($_POST['caching_allowed']) ? prepare_input($_POST['caching_allowed']) : $objSettings->GetParameter('caching_allowed');
    $params['cache_lifetime'] = isset($_POST['cache_lifetime']) ? prepare_input($_POST['cache_lifetime']) : $objSettings->GetParameter('cache_lifetime');
    $params['wysiwyg_type'] = isset($_POST['wysiwyg_type']) ? prepare_input($_POST['wysiwyg_type']) : $objSettings->GetParameter('wysiwyg_type');
    $params_tab2a = array();
    $params_tab2a['header_text'] = isset($_POST['header_text']) ? strip_tags(prepare_input($_POST['header_text'], false, 'medium'), '<b><u><i>') : $objSiteDescription->GetParameter('header_text');
    $params_tab2a['slogan_text'] = isset($_POST['slogan_text']) ? prepare_input($_POST['slogan_text']) : $objSiteDescription->GetParameter('slogan_text');
Esempio n. 10
0
    function __construct()
    {
        parent::__construct();
        global $objSettings;
        $this->params = array();
        if (isset($_POST['news_code'])) {
            $this->params['news_code'] = prepare_input($_POST['news_code']);
        }
        if (isset($_POST['header_text'])) {
            $this->params['header_text'] = prepare_input($_POST['header_text']);
        }
        if (isset($_POST['body_text'])) {
            $this->params['body_text'] = prepare_input($_POST['body_text'], false, 'medium');
        }
        if (isset($_POST['type'])) {
            $this->params['type'] = prepare_input($_POST['type']);
        }
        if (isset($_POST['date_created'])) {
            $this->params['date_created'] = prepare_input($_POST['date_created']);
        }
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        $this->isHtmlEncoding = true;
        $this->primaryKey = 'id';
        $this->tableName = TABLE_NEWS;
        $this->dataSet = array();
        $this->error = '';
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->formActionURL = 'index.php?admin=mod_news_management';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = true;
        $this->WHERE_CLAUSE = 'WHERE language_id = \'' . $this->languageId . '\'';
        $this->ORDER_CLAUSE = 'ORDER BY date_created DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        // 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_types = array('news' => _NEWS, 'events' => _EVENTS);
        $datetime_format = get_datetime_format();
        if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') {
            $this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i';
            $this->sqlFieldDateFormat = '%b %d, %Y';
        } else {
            $this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i';
            $this->sqlFieldDateFormat = '%d %b, %Y';
        }
        $this->SetLocale(Application::Get('lc_time_name'));
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									type,
									header_text,
									body_text,
									DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_created,
									CASE
										WHEN type = "events" THEN
											CONCAT("<a href=javascript:void(0) onclick=javascript:__mgDoPostBack(\'' . $this->tableName . '\',\'details\',\'", ' . $this->primaryKey . ', "\')>events",
											       " (", (SELECT COUNT(*) as cnt FROM ' . TABLE_EVENTS_REGISTERED . ' er WHERE er.event_id = ' . $this->tableName . '.' . $this->primaryKey . '), ")</a>")
										ELSE type										
									END as type_link
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('mod_date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'align' => 'left', 'width' => '190px', 'format' => 'date', 'format_parameter' => $datetime_format), 'header_text' => array('title' => _HEADER, 'type' => 'label', 'align' => 'left', 'width' => '', 'nowrap' => 'wrap', 'maxlength' => '90'), 'type_link' => array('title' => _TYPE, 'type' => 'label', 'align' => 'center', 'width' => '9%'));
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('header_text' => array('title' => _HEADER, 'type' => 'textbox', 'required' => true, 'width' => '410px', 'maxlength' => '255'), 'body_text' => array('title' => _TEXT, 'type' => 'textarea', 'width' => '490px', 'height' => '200px', 'editor_type' => 'wysiwyg', 'readonly' => false, 'default' => '', 'required' => true, 'validation_type' => '', 'unique' => false, 'maxlength' => '4096', 'validation_maxlength' => '4096'), 'type' => array('title' => _TYPE, 'type' => 'enum', 'source' => $arr_types, 'required' => true, 'default' => 'news'), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'datetime', 'required' => true, 'readonly' => false, 'default' => @date('Y-m-d H:i:s'), 'validation_type' => '', 'unique' => false, 'visible' => true, 'format' => 'date', 'format_parameter' => $datetime_format, 'min_year' => '10', 'max_year' => '5'), 'language_id' => array('title' => _LANGUAGE, 'type' => 'enum', 'source' => $arr_languages, 'required' => true), 'news_code' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => get_random_string(10)));
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.type,
								' . $this->tableName . '.header_text,
								' . $this->tableName . '.body_text,
								' . $this->tableName . '.language_id,
								' . $this->tableName . '.date_created,
								DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_created,
								' . TABLE_LANGUAGES . '.lang_name as language_name 
							FROM ' . $this->tableName . '
								INNER JOIN ' . TABLE_LANGUAGES . ' ON ' . $this->tableName . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('header_text' => array('title' => _HEADER, 'type' => 'textbox', 'required' => true, 'width' => '410px', 'maxlength' => '255'), 'body_text' => array('title' => _TEXT, 'type' => 'textarea', 'width' => '490px', 'height' => '200px', 'editor_type' => 'wysiwyg', 'readonly' => false, 'default' => '', 'required' => true, 'validation_type' => '', 'unique' => false, 'maxlength' => '4096', 'validation_maxlength' => '4096'), 'type' => array('title' => _TYPE, 'type' => 'enum', 'source' => $arr_types, 'required' => true), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'datetime', 'required' => true, 'readonly' => false, 'unique' => false, 'visible' => true, 'format' => 'date', 'format_parameter' => $datetime_format, 'min_year' => '10', 'max_year' => '5'), 'language_id' => array('title' => _LANGUAGE, 'type' => 'enum', 'source' => $arr_languages, 'required' => true, 'readonly' => true));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('header_text' => array('title' => _HEADER, 'type' => 'label'), 'body_text' => array('title' => _TEXT, 'type' => 'html'), 'type' => array('title' => _TYPE, 'type' => 'label'), 'mod_date_created' => array('title' => _DATE_CREATED, 'type' => 'label'), 'language_name' => array('title' => _LANGUAGE, 'type' => 'label'));
    }
Esempio n. 11
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');
//--------------------------------------------------------------------------
$type = isset($_GET['type']) ? prepare_input($_GET['type']) : '';
if ($objLogin->IsLoggedInAsAdmin() && ($objLogin->HasPrivileges('add_pages') || $objLogin->HasPrivileges('edit_pages') || $objLogin->HasPrivileges('delete_pages'))) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $language_id = MicroGrid::GetParameter('language_id') != '' ? MicroGrid::GetParameter('language_id') : Languages::GetDefaultLang();
    $act = MicroGrid::GetParameter('act', false);
    $pid = MicroGrid::GetParameter('pid', false);
    $po = MicroGrid::GetParameter('po', false);
    $dir = MicroGrid::GetParameter('dir', false);
    $mode = 'view';
    $msg = '';
    $objPages = new PagesGrid(Application::Get('type'), array('add' => $objLogin->HasPrivileges('add_pages'), 'edit' => $objLogin->HasPrivileges('edit_pages'), 'details' => true, 'delete' => $objLogin->HasPrivileges('delete_pages')));
    if ($action == 'add') {
        $mode = 'add';
    } else {
        if ($action == 'create') {
            if ($objPages->AddRecord()) {
                $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                $mode = 'view';
            } else {
Esempio n. 12
0
    function __construct($page_id = '', $is_active = false, $lang_id = '')
    {
        $this->focusOnField = 'page_title';
        $lang = $lang_id != '' ? $lang_id : Application::Get('lang');
        if ($page_id == 'home' || $page_id == 'public_home') {
            $this->languageId = $lang != '' ? $lang : Languages::GetDefaultLang();
        } else {
            $this->languageId = isset($_REQUEST['language_id']) && $_REQUEST['language_id'] != '' ? prepare_input($_REQUEST['language_id']) : Languages::GetDefaultLang();
        }
        if ($page_id != '') {
            if ($page_id == 'home' || $page_id == 'public_home') {
                $sql_home = 'SELECT
							' . TABLE_PAGES . '.*,
							' . TABLE_LANGUAGES . '.lang_name as language_name
						FROM ' . TABLE_PAGES . '
							LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
						WHERE
							' . TABLE_PAGES . '.is_home = 1 AND
							' . TABLE_PAGES . '.language_id = \'' . $this->languageId . '\'';
                $this->page = database_query($sql_home, DATA_ONLY, FIRST_ROW_ONLY);
                if (empty($this->page)) {
                    $page_code = get_random_string(10);
                    // create Home Page
                    $sql = 'INSERT INTO ' . TABLE_PAGES . '(
							id, page_code, language_id, content_type,
							link_url, link_target, page_key, page_title, page_text,
							menu_id, menu_link, tag_title, tag_keywords, tag_description, 
							comments_allowed, show_in_search, date_created, date_updated, finish_publishing,
							is_home, is_removed, is_published, is_system_page, system_page,
							status_changed, access_level, priority_order
						)VALUES(
							NULL, \'' . $page_code . '\', \'' . $this->languageId . '\', \'article\',
							\'\', \'\', \'\', \'Home\', \'\',
							0, \'\', \'\', \'\', \'\', 
							0, 1, \'0000-00-00 00:00:00\', \'0000-00-00 00:00:00\', \'0000-00-00 00:00:00\',
							1, 0, 0, 0, \'\',
							\'0000-00-00 00:00:00\', \'public\', 0
						)';
                    if (database_void_query($sql)) {
                        $this->page = database_query($sql_home, DATA_ONLY, FIRST_ROW_ONLY);
                        // update home pages code
                        $sql_update = 'UPDATE ' . TABLE_PAGES . ' SET page_code = \'' . $page_code . '\' WHERE is_home = 1';
                        database_void_query($sql_update);
                    }
                }
            } else {
                if ($page_id != '' && !is_numeric($page_id)) {
                    $sql_home = 'SELECT
							' . TABLE_PAGES . '.*,
							' . TABLE_LANGUAGES . '.lang_name as language_name
						FROM ' . TABLE_PAGES . '
							LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
						WHERE
							' . TABLE_PAGES . '.is_system_page = 1 AND
							' . TABLE_LANGUAGES . '.abbreviation = \'' . $lang . '\' AND
							' . TABLE_PAGES . '.system_page = \'' . $page_id . '\' AND
							' . TABLE_PAGES . '.is_published = 1 ';
                    $this->page = database_query($sql_home, DATA_ONLY, FIRST_ROW_ONLY);
                } else {
                    $sql = 'SELECT
							' . TABLE_PAGES . '.*,
							' . TABLE_LANGUAGES . '.lang_name as language_name,
							' . TABLE_MENUS . '.access_level as menu_access_level
						FROM ' . TABLE_PAGES . '
							LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
							LEFT OUTER JOIN ' . TABLE_MENUS . ' ON ' . TABLE_PAGES . '.menu_id = ' . TABLE_MENUS . '.id
						WHERE
							' . TABLE_PAGES . '.id = \'' . (int) $page_id . '\'';
                    if ($is_active) {
                        $sql .= ' AND ' . TABLE_PAGES . '.is_removed = 0 ';
                        $sql .= ' AND ' . TABLE_PAGES . '.is_published = 1 ';
                    }
                    $this->page = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY);
                }
            }
            if (empty($this->page)) {
                $this->page_id = '';
            } else {
                $this->page_id = $page_id;
            }
        } else {
            $this->page_id = $page_id;
            $this->page['id'] = '';
            $this->page['page_code'] = '';
            $this->page['language_id'] = '';
            $this->page['content_type'] = 'article';
            $this->page['link_url'] = '';
            $this->page['link_target'] = '';
            $this->page['page_key'] = '';
            $this->page['page_title'] = '';
            $this->page['page_text'] = '';
            $this->page['menu_id'] = '0';
            $this->page['menu_link'] = '';
            $this->page['tag_title'] = '';
            $this->page['tag_keywords'] = '';
            $this->page['tag_description'] = '';
            $this->page['comments_allowed'] = '0';
            $this->page['date_created'] = '';
            $this->page['date_updated'] = '';
            $this->page['finish_publishing'] = '';
            $this->page['show_in_search'] = '1';
            $this->page['is_home'] = '0';
            $this->page['is_removed'] = '0';
            $this->page['is_published'] = '0';
            $this->page['is_system_page'] = '0';
            $this->page['language_name'] = '';
            $this->page['language_id'] = '';
            $this->page['access_level'] = '0';
            $this->page['priority_order'] = '0';
        }
    }
Esempio n. 13
0
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['ban_item'])) {
            $this->params['ban_item'] = prepare_input($_POST['ban_item']);
        }
        if (isset($_POST['ban_reason'])) {
            $this->params['ban_reason'] = prepare_input($_POST['ban_reason']);
        }
        $item_validation_type = '';
        if (isset($_POST['ban_item_type'])) {
            $this->params['ban_item_type'] = prepare_input($_POST['ban_item_type']);
            if ($this->params['ban_item_type'] == 'IP') {
                $item_validation_type = 'ip_address';
            } else {
                if ($this->params['ban_item_type'] == 'Email') {
                    $item_validation_type = 'email';
                }
            }
        }
        ## for checkboxes
        //if(isset($_POST['parameter4']))   $this->params['parameter4'] = $_POST['parameter4']; else $this->params['parameter4'] = '0';
        ## for images
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = $_POST['icon'];
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_BANLIST;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=ban_list';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = '';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        $arr_ban_types = array('IP' => _IP_ADDRESS, 'Email' => _EMAIL_ADDRESS);
        // define filtering fields
        $this->arrFilteringFields = array(_TYPE => array('table' => $this->tableName, 'field' => 'ban_item_type', 'type' => 'dropdownlist', 'source' => $arr_ban_types, 'sign' => '=', 'width' => '130px'));
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									ban_item,
									CASE
										WHEN ban_item_type = \'IP\' THEN \'' . _IP_ADDRESS . '\'
										WHEN ban_item_type = \'Email\' THEN \'' . _EMAIL_ADDRESS . '\'
										ELSE \'' . _UNKNOWN . '\'
									END ban_item_type,
									ban_reason
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'label', 'align' => 'left', 'width' => '170px', 'height' => '', 'maxlength' => ''), 'ban_item_type' => array('title' => _TYPE, 'type' => 'label', 'align' => 'left', 'width' => '150px', 'height' => '', 'maxlength' => ''), 'ban_reason' => array('title' => _REASON, 'type' => 'label', 'align' => 'left', 'width' => '', 'height' => '', 'maxlength' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'unique' => true, 'maxlength' => '70', 'default' => '', 'validation_type' => $item_validation_type), 'ban_item_type' => array('title' => _TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '130px', 'source' => $arr_ban_types), 'ban_reason' => array('title' => _REASON, 'type' => 'textarea', 'width' => '310px', 'height' => '90px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false, 'default' => 'Spam from this IP/Email', 'validation_type' => ''));
        //----------------------------------------------------------------------
        // EDIT MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.ban_item,
								' . $this->tableName . '.ban_item_type,
								' . $this->tableName . '.ban_reason
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'unique' => true, 'maxlength' => '70', 'default' => '', 'validation_type' => $item_validation_type), 'ban_item_type' => array('title' => _TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '130px', 'source' => $arr_ban_types), 'ban_reason' => array('title' => _REASON, 'type' => 'textarea', 'width' => '310px', 'height' => '90px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false, 'default' => 'Spam from this IP/Email', 'validation_type' => ''));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'label'), 'ban_item_type' => array('title' => _TYPE, 'type' => 'label'), 'ban_reason' => array('title' => _REASON, 'type' => 'label'));
    }
Esempio n. 14
0
    /**
     *	Returns all existing categories
     */
    public function GetAllExistingCategories()
    {
        $lang = Languages::GetDefaultLang();
        $sql = 'SELECT c.id,
					c.icon,
					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 = _CAT_ID_ AND 
					cd.language_id = \'' . $lang . '\'
				ORDER BY priority_order ASC';
        $sql_1 = str_replace('_CAT_ID_', '0', $sql);
        $result = database_query($sql_1, DATA_AND_ROWS, ALL_ROWS, FETCH_ASSOC);
        $output = array();
        if ($result[1] > 0) {
            for ($i = 0; $i < $result[1]; $i++) {
                $output[$result[0][$i]['id']] = array('id' => $result[0][$i]['id'], 'name' => $result[0][$i]['name'], 'parent_name' => '', 'level' => '1');
                $sql_2 = str_replace('_CAT_ID_', (int) $result[0][$i]['id'], $sql);
                $result_2 = database_query($sql_2, DATA_AND_ROWS, ALL_ROWS, FETCH_ASSOC);
                for ($j = 0; $j < $result_2[1]; $j++) {
                    $output[$result_2[0][$j]['id']] = array('id' => $result_2[0][$j]['id'], 'name' => $result_2[0][$j]['name'], 'parent_name' => $result[0][$i]['name'], 'level' => '2');
                    $sql_3 = str_replace('_CAT_ID_', (int) $result_2[0][$j]['id'], $sql);
                    $result_3 = database_query($sql_3, DATA_AND_ROWS, ALL_ROWS, FETCH_ASSOC);
                    for ($k = 0; $k < $result_3[1]; $k++) {
                        $output[$result_3[0][$k]['id']] = array('id' => $result_3[0][$k]['id'], 'name' => $result_3[0][$k]['name'], 'parent_name' => $result_2[0][$j]['name'], 'level' => '3');
                    }
                }
            }
        }
        #echo '<pre>';
        #print_r($output);
        #echo '</pre>';
        return $output;
    }
Esempio n. 15
0
/**
* @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->IsLoggedInAsAdmin() && $objLogin->HasPrivileges('add_pages')) {
    if (isset($_REQUEST['language_id'])) {
        $language_id = prepare_input($_REQUEST['language_id']);
        $objSiteDescription->LoadData($language_id);
    } else {
        $language_id = Languages::GetDefaultLang();
    }
    $wysiwyg_dir = Languages::GetLanguageDirection($language_id);
    $objPage = new Pages();
    $link_target = isset($_POST['link_target']) ? prepare_input($_POST['link_target']) : '_self';
    $tag_title = isset($_POST['tag_title']) ? prepare_input($_POST['tag_title']) : $objSiteDescription->GetParameter('tag_title');
    $tag_keywords = isset($_POST['tag_keywords']) ? prepare_input($_POST['tag_keywords']) : $objSiteDescription->GetParameter('tag_keywords');
    $tag_description = isset($_POST['tag_description']) ? prepare_input($_POST['tag_description']) : $objSiteDescription->GetParameter('tag_description');
    $meta_tags_status = isset($_POST['meta_tags_status']) ? prepare_input($_POST['meta_tags_status']) : 'closed';
    $copy_to_other_langs = isset($_POST['copy_to_other_langs']) ? prepare_input($_POST['copy_to_other_langs']) : 'yes';
    $access_level = isset($_POST['access_level']) ? prepare_input($_POST['access_level']) : '0';
    $show_in_search = isset($_POST['show_in_search']) ? prepare_input($_POST['show_in_search']) : '1';
    $priority_order = isset($_POST['priority_order']) ? (int) $_POST['priority_order'] : $objPage->GetMaxOrder($language_id) + 1;
    $finish_publishing = isset($_POST['finish_publishing']) && check_date($_POST['finish_publishing']) ? prepare_input($_POST['finish_publishing']) : _NEVER;
    $is_published = isset($_POST['is_published']) ? prepare_input($_POST['is_published']) : '1';
    $submit = isset($_POST['subSavePage']) ? prepare_input($_POST['subSavePage']) : '';
Esempio n. 16
0
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        global $objSettings;
        ## for standard fields
        if (isset($_POST['template_code'])) {
            $this->params['template_code'] = prepare_input($_POST['template_code']);
        }
        if (isset($_POST['template_name'])) {
            $this->params['template_name'] = prepare_input($_POST['template_name']);
        }
        if (isset($_POST['template_subject'])) {
            $this->params['template_subject'] = prepare_input($_POST['template_subject']);
        }
        if (isset($_POST['template_content'])) {
            $this->params['template_content'] = prepare_input($_POST['template_content'], false, 'medium');
        }
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_EMAIL_TEMPLATES;
        if (self::$PROJECT == 'ShoppingCart' || self::$PROJECT == 'BusinessDirectory' || self::$PROJECT == 'HotelSite') {
            $this->TABLE_NAME = TABLE_CUSTOMERS;
            $this->MODULE_NAME = 'customers';
            $this->MEMBERS_NAME = _CUSTOMERS;
            $this->ADMINS_MEMBERS_NAME = _ADMINS_AND_CUSTOMERS;
        } else {
            if (self::$PROJECT == 'MedicalAppointment') {
                $this->TABLE_NAME = TABLE_PATIENTS;
                $this->MODULE_NAME = 'patients';
                $this->MEMBERS_NAME = _PATIENTS;
                $this->ADMINS_MEMBERS_NAME = _ADMINS_AND_PATIENTS;
            } else {
                $this->TABLE_NAME = TABLE_USERS;
                $this->MODULE_NAME = 'users';
                $this->MEMBERS_NAME = _USERS;
                $this->ADMINS_MEMBERS_NAME = _ADMINS_AND_USERS;
            }
        }
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=email_templates';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = true;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = 'WHERE language_id = \'' . $this->languageId . '\'';
        $this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.template_code ASC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 25;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        $arr_is_system = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        // prepare languages array
        $total_languages = Languages::GetAllActive();
        $arr_languages = array();
        foreach ($total_languages[0] as $key => $val) {
            $arr_languages[$val['abbreviation']] = $val['lang_name'];
        }
        $wysiwyg_type = $objSettings->GetParameter('mailer_wysiwyg_type') == 'tinymce' ? 'wysiwyg' : 'simple';
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									language_id,
									template_code,
									template_name,
									template_subject,
									template_content,
									is_system_template
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('template_subject' => array('title' => _SUBJECT, 'type' => 'label', 'align' => 'left', 'width' => '35%', 'sortable' => true, 'nowrap' => 'wrap', 'visible' => '', 'height' => '', 'maxlength' => '50', 'format' => ''), 'template_name' => array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => 'wrap', 'visible' => '', 'height' => '', 'maxlength' => '65', 'format' => ''), 'is_system_template' => array('title' => _SYSTEM, 'type' => 'enum', 'align' => 'center', 'width' => '80px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_system));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('language_id' => array('title' => _LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => true, 'width' => '210px', 'source' => $arr_languages, 'unique' => false), 'template_code' => array('title' => _TEMPLATE_CODE, 'type' => 'textbox', 'width' => '350px', 'required' => true, 'readonly' => false, 'maxlength' => '40', 'default' => '', 'validation_type' => 'alpha_numeric', 'unique' => true), 'template_name' => array('title' => _DESCRIPTION, 'type' => 'textbox', 'width' => '350px', 'required' => true, 'readonly' => false, 'maxlength' => '100', 'default' => '', 'validation_type' => '', 'unique' => true), 'template_subject' => array('title' => _SUBJECT, 'type' => 'textbox', 'width' => '510px', 'required' => true, 'readonly' => false, 'maxlength' => '125', 'default' => '', 'validation_type' => '', 'unique' => false), 'template_content' => array('title' => _TEXT, 'type' => 'textarea', 'width' => '530px', 'height' => '290px', 'required' => true, 'editor_type' => $wysiwyg_type, 'maxlength' => '4096', 'validation_maxlength' => '4096', 'readonly' => false, 'default' => '', 'validation_type' => '', 'unique' => false), 'is_system_template' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => '0'));
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.language_id,
								' . $this->tableName . '.template_name,
								' . $this->tableName . '.template_code,
								' . $this->tableName . '.template_subject,
								' . $this->tableName . '.template_content,
								' . $this->tableName . '.is_system_template
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('language_id' => array('title' => _LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => true, 'width' => '210px', 'source' => $arr_languages, 'unique' => false), 'template_code' => array('title' => _TEMPLATE_CODE, 'type' => 'label'), 'template_name' => array('title' => _DESCRIPTION, 'type' => 'textbox', 'width' => '350px', 'required' => true, 'readonly' => false, 'maxlength' => '100', 'default' => '', 'validation_type' => '', 'unique' => false), 'template_subject' => array('title' => _SUBJECT, 'type' => 'textbox', 'width' => '510px', 'required' => true, 'readonly' => false, 'maxlength' => '125', 'default' => '', 'validation_type' => '', 'unique' => false), 'template_content' => array('title' => _TEXT, 'type' => 'textarea', 'width' => '530px', 'height' => '300px', 'required' => true, 'editor_type' => $wysiwyg_type, 'maxlength' => '4096', 'validation_maxlength' => '4096', 'readonly' => false, 'default' => '', 'validation_type' => '', 'unique' => false), 'is_system_template' => array('title' => _SYSTEM_TEMPLATE, 'type' => 'enum', 'readonly' => true, 'source' => $arr_is_system));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('template_name' => array('title' => _DESCRIPTION, 'type' => 'label'), 'template_subject' => array('title' => _SUBJECT, 'type' => 'label'), 'template_content' => array('title' => _TEXT, 'type' => 'label', 'format' => 'readonly_text'), 'is_system_template' => array('title' => _SYSTEM_TEMPLATE, 'type' => 'enum', 'source' => $arr_is_system));
    }
Esempio n. 17
0
    /**
     * Draws listings in category
     * 		@param $category_id
     * 		@param $draw
     */
    public function DrawListings($category_id, $draw = true)
    {
        global $objLogin, $objSettings;
        $lang = Application::Get('lang');
        $nl = "\n";
        if (empty($lang)) {
            $lang = Languages::GetDefaultLang();
        }
        $listings_locations = isset($_REQUEST['listings_locations']) ? prepare_input($_REQUEST['listings_locations']) : '';
        $listings_sub_locations = isset($_REQUEST['listings_sub_locations']) ? prepare_input($_REQUEST['listings_sub_locations']) : '';
        $listings_sort_by = isset($_REQUEST['listings_sort_by']) && $_REQUEST['listings_sort_by'] != '' ? prepare_input($_REQUEST['listings_sort_by']) : 'rating';
        $listings_order_by = isset($_REQUEST['listings_order_by']) && $_REQUEST['listings_order_by'] != '' ? prepare_input($_REQUEST['listings_order_by']) : 'ASC';
        $sort_by = '';
        $order_by = '';
        $output = '';
        if ($listings_sort_by == 'name') {
            $sort_by = 'ld.business_name';
            $order_by = $listings_order_by;
        } else {
            if ($listings_sort_by == 'date') {
                $sort_by = 'l.date_published';
                $order_by = $listings_order_by;
            } else {
                if ($listings_sort_by == 'rating') {
                    // rating according to advertising plans high rate = high advertising plan
                    $sort_by = 'l.advertise_plan_id';
                    $order_by = ($listings_order_by == 'ASC' ? 'DESC' : 'ASC') . ', RAND()';
                } else {
                    $sort_by = 'l.priority_order';
                    $order_by = $listings_order_by;
                }
            }
        }
        if (!Application::Get('js_included', 'lytebox')) {
            $output .= '<!-- LyteBox v3.22 Author: Markus F. Hay Website: http://www.dolem.com/lytebox -->' . $nl;
            $output .= '<link rel="stylesheet" href="modules/lytebox/css/lytebox.css" type="text/css" media="screen" />' . $nl;
            $output .= '<script type="text/javascript" src="modules/lytebox/js/lytebox.js"></script>' . $nl;
        }
        // draw category description
        $category_info = Categories::GetCategoryInfo($category_id);
        if ($category_info['description'] != '') {
            $output .= draw_message($category_info['description'], false);
        }
        // draw result
        $sql_from = TABLE_LISTINGS . ' l 
					INNER JOIN ' . TABLE_LISTINGS_DESCRIPTION . ' ld ON l.id = ld.listing_id
					INNER JOIN ' . TABLE_LISTINGS_LOCATIONS . ' ll ON l.listing_location_id = ll.id
				WHERE
					' . (!empty($listings_locations) ? 'l.listing_location_id = \'' . $listings_locations . '\' AND ' : '') . '
					' . (!empty($listings_sub_locations) ? 'l.listing_sub_location_id = \'' . $listings_sub_locations . '\' AND ' : '') . '
					' . (!$objLogin->IsLoggedIn() ? 'l.access_level=\'public\' AND ' : '') . '
					l.is_published = 1 AND
					' . ($this->show_expired_listings != 'yes' ? ' ((l.finish_publishing = \'0000-00-00 00:00:00\') OR (l.finish_publishing > \'' . date('Y-m-d H:i:s') . '\')) AND ' : '') . '
					ld.language_id = \'' . $lang . '\'
					' . ($category_id != '' ? ' AND l.id IN (SELECT listing_id FROM ' . TABLE_LISTINGS_CATEGORIES . ' lc WHERE category_id = ' . (int) $category_id . ')' : '') . '
				ORDER BY ' . $sort_by . ' ' . $order_by;
        // pagination prepare
        $page_size = ModulesSettings::Get('listings', 'listings_per_page');
        $start_row = '0';
        $total_pages = '1';
        pagination_prepare($page_size, $sql_from, $start_row, $total_pages);
        $sql = 'SELECT l.id,
					l.image_file,
					l.image_file_thumb,
					l.priority_order,
					l.date_published,
					l.website_url,
					l.business_email,
					l.advertise_plan_id,
					ll.name as listing_location_name,
					ld.language_id,					
					ld.business_name,
					ld.business_address,
					ld.business_description
				FROM ' . $sql_from . '
				LIMIT ' . $start_row . ', ' . $page_size;
        $result = database_query($sql, DATA_AND_ROWS, ALL_ROWS);
        if ($result[1] > 0 || !empty($listings_locations)) {
            $output .= '<form id="frmCategoryView" action="index.php?page=category&cid=' . $category_id . '" method="post">';
            $output .= draw_token_field(false);
            $output .= draw_hidden_field('p', '1', false);
            $output .= '<table width="98%" border="0" align="center">';
            $output .= '<tr><th colspan="3" nowrap="nowrap" height="5px"></th></tr>';
            $output .= '<tr><th colspan="2" align="' . Application::Get('defined_left') . '" valign="middle">';
            $output .= '&nbsp;' . _FILTER_BY . ': ';
            $output .= ListingsLocations::DrawAllLocations(array('tag_name' => 'listings_locations', 'selected_value' => $listings_locations, 'javascript_event' => 'onchange="jQuery(\'#frmCategoryView\').submit();"'), false) . ' &nbsp;';
            $output .= ListingsSubLocations::DrawAllSubLocations($listings_locations, array('tag_name' => 'listings_sub_locations', 'selected_value' => $listings_sub_locations, 'javascript_event' => 'onchange="jQuery(\'#frmCategoryView\').submit();"'), false);
            $output .= '</th>';
            $output .= '<th colspan="2" align="' . Application::Get('defined_right') . '" valign="middle">';
            $output .= _SORT_BY . ': 
					<select name="listings_sort_by" onchange="jQuery(\'#frmCategoryView\').submit();">
						<option value="rating" ' . ($listings_sort_by == 'rating' ? ' selected="selected"' : '') . '>' . _RATING . '</option>
						<option value="name" ' . ($listings_sort_by == 'name' ? ' selected="selected"' : '') . '>' . _NAME . '</option>
						<option value="date" ' . ($listings_sort_by == 'date' ? ' selected="selected"' : '') . '>' . _DATE_PUBLISHED . '</option>
					</select>&nbsp;
					<select name="listings_order_by" onchange="jQuery(\'#frmCategoryView\').submit();">
						<option value="ASC" ' . ($listings_order_by == 'ASC' ? ' selected="selected"' : '') . '>' . _ASCENDING . '</option>
						<option value="DESC" ' . ($listings_order_by == 'DESC' ? ' selected="selected"' : '') . '>' . _DESCENDING . '</option>
					</select>
					</th>
				</tr>
			</table>
			</form>';
        }
        if ($result[1] > 0) {
            $output .= '<table width="99%" border="0" align="center">';
            $output .= '<tr><th colspan="2" nowrap="nowrap" height="5px"></th></tr>
				<tr>
					<th align="' . Application::Get('defined_left') . '">&nbsp; ' . _LISTINGS . ' &nbsp;</th>
					<th align="center">' . _IMAGE . '</th>
				</tr>';
            for ($i = 0; $i < $result[1]; $i++) {
                $image_file = $result[0][$i]['image_file'] != '' ? $result[0][$i]['image_file'] : 'no_image.png';
                ///$result[0][$i]['advertise_plan_id'] > 1 &&
                $image_file_thumb = $result[0][$i]['image_file_thumb'] != '' ? $result[0][$i]['image_file_thumb'] : 'no_image.png';
                $output .= '<tr><td colspan="2" style="padding:7px;">' . draw_line('no_margin_line', IMAGE_DIRECTORY, false) . '</td></tr>
					<tr valign="top">
						<td>';
                $link_1 = prepare_link('listing', 'lid', $result[0][$i]['id'], '', $result[0][$i]['business_name'], '', _CLICK_TO_SEE_DESCR);
                $link_2 = prepare_link('listing', 'lid', $result[0][$i]['id'], '', _MORE_INFO, '', _CLICK_TO_SEE_DESCR);
                $output .= '<div class="listing_info">';
                $output .= '<div class="header">' . $link_1 . '</div>';
                $output .= '<div class="address">' . substr_by_word(strip_tags($result[0][$i]['business_address']), 300, true, Application::Get('lang')) . ' ' . $result[0][$i]['listing_location_name'] . '</div>';
                $output .= '<div class="description">' . substr_by_word(strip_tags($result[0][$i]['business_description']), 180, true, Application::Get('lang')) . '</div>';
                $output .= '<div class="links">
											' . $link_2 . '
											' . ($result[0][$i]['website_url'] != '' ? ' : <a href="' . $result[0][$i]['website_url'] . '" target="_new">' . _WEBSITE_URL . '</a>' : '') . '
											' . ($result[0][$i]['business_email'] != '' ? ' : <a href="mailto:' . $result[0][$i]['business_email'] . '">' . _EMAIL . '</a>' : '') . '
											' . ($result[0][$i]['date_published'] != '0000-00-00 00:00:00' ? '<div class="published">' . _PUBLISHED . ': ' . format_datetime($result[0][$i]['date_published'], get_datetime_format(false), _UNKNOWN) . '<div>' : '') . '
										</div>';
                $output .= '</div>';
                $output .= '
						</td>
						<td width="130px" align="center">
							<div class="listing_icon">';
                if ($image_file != 'no_image.png') {
                    $output .= '<a href="images/listings/' . $image_file . '" rel="lyteshow_' . $result[0][$i]['id'] . '">';
                }
                $output .= '<img class="listings_image' . ($image_file == 'no_image.png' ? ' no_hover' : '') . '" src="images/listings/' . $image_file_thumb . '" width="120px" height="90px" title="' . ($image_file != 'no_image.png' ? _CLICK_TO_INCREASE : '') . '" alt="" />';
                if ($image_file != 'no_image.png') {
                    $output .= '</a>';
                }
                $output .= '
							</div>
						</td>
					</tr>';
            }
            // draw pagination links
            if ($total_pages > 1) {
                $output .= '<tr><td colspan="2" style="padding:7px;">' . draw_line('no_margin_line', IMAGE_DIRECTORY, false) . '</td></tr>';
            }
            $output .= '<tr><td colspan="2">';
            $output .= pagination_get_links($total_pages, '');
            $output .= '</td></tr>';
            $output .= '<tr><td colspan="2">&nbsp;</td></tr>';
            $output .= '</table>';
        } else {
            // draw message only if this is a last-level empty category
            $categories = Categories::GetAllActive('c.parent_id = ' . (int) $category_id);
            if (!$categories[1]) {
                $output .= draw_message(_NO_LISTINGS_FOUND, false, true);
            }
        }
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
Esempio n. 18
0
 /**
  * 	Sets the session variables and performs the login
  * 		@param $account_information - array
  */
 private function SetSessionVariables($account_information)
 {
     Session::Set('session_account_id', $account_information['id']);
     Session::Set('session_account_logged', $account_information['id'] ? $this->GetUniqueUrl() . $account_information['id'] : false);
     Session::Set('session_user_name', $account_information['user_name']);
     Session::Set('session_user_first_name', $account_information['first_name']);
     Session::Set('session_user_last_name', $account_information['last_name']);
     Session::Set('session_user_email', $account_information['email']);
     Session::Set('session_account_type', $this->accountType == 'admin' ? $account_information['account_type'] : 'customer');
     Session::Set('session_last_login', $account_information['date_lastlogin']);
     if (isset($account_information['b_country'])) {
         Session::Set('session_user_country', $account_information['b_country']);
     }
     // check if predefined lang still exists, if not set default language
     if (isset($account_information['preferred_language']) && Languages::LanguageActive($account_information['preferred_language'])) {
         $preferred_language = $account_information['preferred_language'];
     } else {
         $preferred_language = Languages::GetDefaultLang();
     }
     Session::Set('session_preferred_language', $preferred_language);
     // prepare role privileges
     $result = Roles::GetPrivileges(Session::Get('session_account_type'));
     $privileges_info = array();
     for ($i = 0; $i < $result[1]; $i++) {
         $privileges_info[$result[0][$i]['code']] = $result[0][$i]['is_active'] == '1' ? true : false;
     }
     Session::Set('session_user_privileges', $privileges_info);
     $this->LoadListings();
     // clean some session variables
     Session::Set('preview', '');
 }
Esempio n. 19
0
    function __construct($type = '', $actions = array())
    {
        parent::__construct();
        $this->params = array();
        ///if(isset($_POST['parameter1']))   $this->params['parameter1'] = $_POST['parameter1'];
        ///if(isset($_POST['parameter2']))   $this->params['parameter2'] = $_POST['parameter2'];
        ///if(isset($_POST['parameter3']))   $this->params['parameter3'] = $_POST['parameter3'];
        // for checkboxes
        ///if(isset($_POST['parameter4']))   $this->params['parameter4'] = $_POST['parameter4']; else $this->params['parameter4'] = '0';
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_PAGES;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=pages' . ($type != '' ? '&type=' . $type : '');
        $this->actions = array('add' => false, 'edit' => false, 'details' => false, 'delete' => false);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = true;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = 'WHERE
									' . $this->tableName . '.is_system_page = ' . ($type == 'system' ? '1' : '0') . ' AND 
									' . $this->tableName . '.is_home = 0 AND
									' . $this->tableName . '.is_removed = 0 AND
									' . $this->tableName . '.language_id = \'' . $this->languageId . '\'';
        $this->ORDER_CLAUSE = 'ORDER BY priority_order ASC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = $type == 'system' ? false : true;
        // prepare menus array
        $total_menus = Menu::GetAll(' menu_order ASC', TABLE_MENUS, '', $this->languageId);
        $arr_menus = array();
        foreach ($total_menus[0] as $key => $val) {
            $arr_menus[$val['id']] = $val['menu_name'] . ($val['menu_placement'] == 'hidden' ? ' (' . _HIDDEN . ')' : '');
        }
        // define filtering fields
        $this->arrFilteringFields = array(_MENU_WORD => array('table' => TABLE_MENUS, 'field' => 'id', 'type' => 'dropdownlist', 'source' => $arr_menus, 'sign' => '=', 'width' => '150px'));
        // prepare languages array
        $total_languages = Languages::GetAllActive();
        $arr_languages = array();
        foreach ($total_languages[0] as $key => $val) {
            $arr_languages[$val['abbreviation']] = $val['lang_name'];
        }
        $comments_allow = Modules::IsModuleInstalled('comments') ? ModulesSettings::Get('comments', 'comments_allow') : 'no';
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ',
									' . $this->tableName . '.language_id,
									' . $this->tableName . '.content_type,
									' . $this->tableName . '.link_url,
									' . $this->tableName . '.link_target,
									' . $this->tableName . '.page_key,
									IF(' . $this->tableName . '.page_title != "", ' . $this->tableName . '.page_title, "- ' . _UNDEFINED . ' -") as page_title,
									' . $this->tableName . '.page_text,
									' . $this->tableName . '.menu_id,
									IF(' . $this->tableName . '.menu_link != "", ' . $this->tableName . '.menu_link, "- ' . _UNDEFINED . ' -") as menu_link,
									' . $this->tableName . '.comments_allowed,
									' . $this->tableName . '.is_home,
									' . $this->tableName . '.priority_order,
									IF(' . $this->tableName . '.access_level = "public", "' . _PUBLIC . '", "' . _REGISTERED . '") my_access_level,
									CASE
										WHEN ' . $this->tableName . '.is_published = 1 THEN
											IF(
												(finish_publishing = "0000-00-00" OR finish_publishing >= \'' . date('Y-m-d') . '\'),
												"<img src=\\"images/published_g.gif\\" alt=\\"\\" />",
												"<img src=\\"images/expired.gif\\" alt=\\"' . _EXPIRED . '\\" />"
											  ) 		
										ELSE "<img src=\\"images/published_x.gif\\" alt=\\"\\" />"
									END as is_published,
									IF(' . TABLE_MENUS . '.menu_name != "", ' . TABLE_MENUS . '.menu_name, "' . _NOT_AVAILABLE . '") as menu_name,
									CASE
										WHEN ' . $this->tableName . '.comments_allowed = 1 THEN
											CONCAT("<a href=\\"index.php?admin=mod_comments_management&pid=",
											' . $this->tableName . '.' . $this->primaryKey . ', "\\">", (SELECT COUNT(*) FROM ' . TABLE_COMMENTS . ' c WHERE c.article_id = ' . $this->tableName . '.' . $this->primaryKey . '),											
											(SELECT IF(COUNT(*) > 0, CONCAT("(",COUNT(*),")"), "") FROM ' . TABLE_COMMENTS . ' c WHERE c.is_published = 0 AND c.article_id = ' . $this->tableName . '.' . $this->primaryKey . '),
											"</a>")
										ELSE
											"<span class=gray>' . _NOT_ALLOWED . '</span>"
									END as comments_count,
									CONCAT(
										" <a href=\\"index.php?page=pages' . ($type == 'system' ? '&type=' . $type : '') . '&pid=", ' . $this->tableName . '.' . $this->primaryKey . ', "&mg_language_id=' . $this->languageId . '\\">' . _VIEW_WORD . '</a>
										' . ($actions['edit'] ? ' | <a href=\\"index.php?admin=pages_edit' . ($type != '' ? '&type=' . $type : '') . '&pid=", ' . $this->tableName . '.' . $this->primaryKey . ', "\\">' . _EDIT_WORD . '</a>' : '') . '
										' . ($actions['delete'] && $type != 'system' ? ' | <a href=\\"javascript:confirmRemoving(\'", ' . $this->tableName . '.' . $this->primaryKey . ', "\')\\">' . _REMOVE . '</a>' : '') . '
										") as action_links
								FROM ' . $this->tableName . '
									LEFT OUTER JOIN ' . TABLE_MENUS . ' ON ' . $this->tableName . '.menu_id=' . TABLE_MENUS . '.id';
        // define view mode fields
        $this->arrViewModeFields = array();
        $this->arrViewModeFields['menu_link'] = array('title' => _MENU_LINK, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '40');
        if ($type == 'system') {
            $this->arrViewModeFields['page_title'] = array('title' => _PAGE_HEADER, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '40');
        }
        $this->arrViewModeFields['menu_name'] = array('title' => _MENU_WORD, 'type' => 'label', 'align' => 'center', 'width' => '', 'visible' => $type == 'system' ? false : true);
        $this->arrViewModeFields['is_published'] = array('title' => _PUBLISHED, 'type' => 'label', 'align' => 'center', 'width' => '80px');
        $this->arrViewModeFields['my_access_level'] = array('title' => _ACCESS, 'type' => 'label', 'align' => 'center', 'width' => '75px');
        $this->arrViewModeFields['priority_order'] = array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '65px', 'visible' => 'true', 'movable' => true);
        $this->arrViewModeFields['comments_count'] = array('title' => _COMMENTS, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'visible' => $comments_allow == 'yes' ? true : false);
        $this->arrViewModeFields['id'] = array('title' => 'ID', 'type' => 'label', 'align' => 'center', 'width' => '50px');
        $this->arrViewModeFields['action_links'] = array('title' => _ACTIONS, 'type' => 'label', 'align' => 'center', 'sortable' => false, 'nowrap' => 'nowrap', 'width' => $type == 'system' ? '90px' : '130px');
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.parameter1,
								' . $this->tableName . '.parameter2,
								' . $this->tableName . '.parameter3
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array();
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array();
    }