function __construct() { $this->ipAddressBlocked = false; $this->emailBlocked = false; $this->loginError = ''; $submit_login = isset($_POST['submit_login']) ? prepare_input($_POST['submit_login']) : ''; $submit_logout = isset($_POST['submit_logout']) ? prepare_input($_POST['submit_logout']) : ''; $user_name = isset($_POST['user_name']) ? prepare_input($_POST['user_name'], true) : ''; $password = isset($_POST['password']) ? prepare_input($_POST['password'], true) : ''; $this->accountType = isset($_POST['type']) ? prepare_input($_POST['type']) : 'customer'; $remember_me = isset($_POST['remember_me']) ? prepare_input($_POST['remember_me']) : ''; $this->wrongLogin = false; if (!$this->IsLoggedIn()) { if ($submit_login == 'login') { if (empty($user_name) || empty($password)) { if (isset($_POST['user_name']) && empty($user_name)) { $this->loginError = '_USERNAME_EMPTY_ALERT'; } else { if (isset($_POST['password']) && empty($password)) { $this->loginError = '_WRONG_LOGIN'; } } $this->wrongLogin = true; } else { $this->DoLogin($user_name, $password, $remember_me); } } } else { if ($submit_logout == 'logout') { $this->DoLogout(); } } $this->activeMenuCount = 0; }
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'] = ''; } }
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'; }
function prepare_input(&$var) { if (is_array($var)) { foreach ($var as $key => $value) { prepare_input($var[$key]); } } else { if (get_magic_quotes_gpc()) { $var = stripslashes($var); } $var = str_replace("\r\n", "\n", $var); //windows linefeeds $var = str_replace("\r", "\n", $var); //mac linefeeds } }
function __construct($login_type = '') { parent::__construct(); global $objSettings; $this->params = array(); if (isset($_POST['first_name'])) { $this->params['first_name'] = prepare_input($_POST['first_name']); } if (isset($_POST['last_name'])) { $this->params['last_name'] = prepare_input($_POST['last_name']); } if (isset($_POST['user_name'])) { $this->params['user_name'] = prepare_input($_POST['user_name']); } if (isset($_POST['password'])) { $this->params['password'] = prepare_input($_POST['password']); } if (isset($_POST['email'])) { $this->params['email'] = prepare_input($_POST['email']); } if (isset($_POST['preferred_language'])) { $this->params['preferred_language'] = prepare_input($_POST['preferred_language']); } if (isset($_POST['account_type'])) { $this->params['account_type'] = prepare_input($_POST['account_type']); } if (isset($_POST['date_created'])) { $this->params['date_created'] = prepare_input($_POST['date_created']); } if (isset($_POST['is_active'])) { $this->params['is_active'] = (int) $_POST['is_active']; } else { $this->params['is_active'] = '0'; } if (self::$PROJECT == 'HotelSite') { if (isset($_POST['hotels'])) { $this->params['hotels'] = prepare_input($_POST['hotels']); } } $this->primaryKey = 'id'; $this->tableName = TABLE_ACCOUNTS; $this->dataSet = array(); $this->error = ''; $this->formActionURL = 'index.php?admin=admins_management'; $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true); $this->actionIcons = true; $this->allowRefresh = true; $this->allowLanguages = false; if ($login_type == 'owner') { $this->WHERE_CLAUSE = 'WHERE (' . TABLE_ACCOUNTS . '.account_type = \'mainadmin\' || ' . TABLE_ACCOUNTS . '.account_type = \'admin\' || ' . TABLE_ACCOUNTS . '.account_type = \'hotelowner\')'; } else { if ($login_type == 'mainadmin') { $this->WHERE_CLAUSE = 'WHERE (' . TABLE_ACCOUNTS . '.account_type = \'admin\' || ' . TABLE_ACCOUNTS . '.account_type = \'hotelowner\')'; } else { if ($login_type == 'admin') { $this->WHERE_CLAUSE = 'WHERE ' . TABLE_ACCOUNTS . '.account_type = \'admin\''; } else { if ($login_type == 'hotelowner') { $this->WHERE_CLAUSE = 'WHERE ' . TABLE_ACCOUNTS . '.account_type = \'hotelowner\''; } } } } $this->ORDER_CLAUSE = 'ORDER BY id ASC'; $this->isAlterColorsAllowed = true; $this->isPagingAllowed = true; $this->pageSize = 20; $this->isSortingAllowed = true; $this->isFilteringAllowed = true; // define filtering fields $this->arrFilteringFields = array(_FIRST_NAME => array('table' => $this->tableName, 'field' => 'first_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _LAST_NAME => array('table' => $this->tableName, 'field' => 'last_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _ACTIVE => array('table' => $this->tableName, 'field' => 'is_active', 'type' => 'dropdownlist', 'source' => array('0' => _NO, '1' => _YES), 'sign' => '=', 'width' => '85px')); // prepare languages array $total_languages = Languages::GetAllActive(); $arr_languages = array(); foreach ($total_languages[0] as $key => $val) { $arr_languages[$val['abbreviation']] = $val['lang_name']; } $arr_account_types = array('admin' => _ADMIN, 'mainadmin' => _MAIN_ADMIN); if (self::$PROJECT == 'HotelSite') { $arr_account_types['hotelowner'] = _HOTEL_OWNER; } $arr_is_active = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>'); $datetime_format = get_datetime_format(); if (self::$PROJECT == 'HotelSite') { $total_hotels = Hotels::GetAllActive(); $arr_hotels = array(); foreach ($total_hotels[0] as $key => $val) { $this->arrCompanies[$val['id']] = $val['name']; } $this->additionalFields = ', hotels'; $this->accountTypeOnChange = 'onchange="javascript:AccountType_OnChange(this.value)"'; } if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') { $this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i'; } else { $this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i'; } $this->SetLocale(Application::Get('lc_time_name')); //---------------------------------------------------------------------- // VIEW MODE //---------------------------------------------------------------------- $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ', first_name, last_name, CONCAT(first_name, \' \', last_name) as full_name, user_name, email, preferred_language, account_type, DATE_FORMAT(date_lastlogin, \'' . $this->sqlFieldDatetimeFormat . '\') as date_lastlogin, is_active ' . $this->additionalFields . ' FROM ' . $this->tableName; // define view mode fields $this->arrViewModeFields = array('full_name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => ''), 'user_name' => array('title' => _USER_NAME, 'type' => 'label', 'align' => 'left', 'width' => ''), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'link', 'maxlength' => '35', 'href' => 'mailto:{email}', 'align' => 'left', 'width' => ''), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'align' => 'center', 'width' => '120px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_account_types), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'align' => 'center', 'width' => '80px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_active), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label', 'align' => 'center', 'width' => '110px', 'format' => 'date', 'format_parameter' => $datetime_format), 'id' => array('title' => 'ID', 'type' => 'label', 'align' => 'center', 'width' => '40px')); //---------------------------------------------------------------------- // ADD MODE //---------------------------------------------------------------------- // define add mode fields $this->arrAddModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '70', 'validation_type' => 'email', 'unique' => true)), 'separator_2' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USER_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'alpha_numeric', 'unique' => true, 'username_generator' => true), 'password' => array('title' => _PASSWORD, 'type' => 'password', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'password', 'cryptography' => PASSWORDS_ENCRYPTION, 'cryptography_type' => PASSWORDS_ENCRYPTION_TYPE, 'aes_password' => PASSWORDS_ENCRYPT_KEY, 'password_generator' => true), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'source' => $arr_account_types, 'javascript_event' => $this->accountTypeOnChange), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'default' => Application::Get('lang'), 'source' => $arr_languages)), 'separator_3' => array('separator_info' => array('legend' => _OTHER), 'date_lastlogin' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => ''), 'date_created' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => date('Y-m-d H:i:s')), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0', 'unique' => false))); if (self::$PROJECT == 'HotelSite') { $this->arrAddModeFields['separator_3']['hotels'] = array('title' => _HOTELS, 'type' => 'enum', 'width' => '', 'required' => false, 'readonly' => false, 'default' => '', 'source' => $this->arrCompanies, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'checkboxes', 'multi_select' => true); } //---------------------------------------------------------------------- // EDIT MODE //---------------------------------------------------------------------- $this->EDIT_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ', ' . $this->tableName . '.first_name, ' . $this->tableName . '.last_name, ' . $this->tableName . '.user_name, ' . $this->tableName . '.password, ' . $this->tableName . '.email, ' . $this->tableName . '.account_type, ' . $this->tableName . '.preferred_language, DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as date_created, DATE_FORMAT(' . $this->tableName . '.date_lastlogin, \'' . $this->sqlFieldDatetimeFormat . '\') as date_lastlogin, ' . $this->tableName . '.is_active ' . $this->additionalFields . ' FROM ' . $this->tableName . ' WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_'; // define edit mode fields $this->arrEditModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '32', 'required' => true, 'validation_type' => 'text'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '32', 'required' => true, 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '70', 'required' => true, 'validation_type' => 'email', 'unique' => true)), 'separator_2' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USER_NAME, 'type' => 'textbox', 'width' => '210px', 'maxlength' => '32', 'required' => true, 'readonly' => true, 'validation_type' => 'alpha_numeric', 'unique' => true), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'width' => '120px', 'required' => true, 'maxlength' => '32', 'readonly' => $login_type == 'owner' ? false : true, 'source' => $arr_account_types, 'javascript_event' => $this->accountTypeOnChange), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'width' => '120px', 'required' => true, 'readonly' => false, 'source' => $arr_languages)), 'separator_3' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label'), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'))); if (self::$PROJECT == 'HotelSite') { $this->arrEditModeFields['separator_3']['hotels'] = array('title' => _HOTELS, 'type' => 'enum', 'width' => '', 'required' => false, 'readonly' => false, 'default' => '', 'source' => $this->arrCompanies, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'checkboxes', 'multi_select' => true); } //---------------------------------------------------------------------- // DETAILS MODE //---------------------------------------------------------------------- $this->DETAILS_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ', ' . $this->tableName . '.first_name, ' . $this->tableName . '.last_name, ' . $this->tableName . '.user_name, ' . $this->tableName . '.password, ' . $this->tableName . '.email, ' . $this->tableName . '.preferred_language, ' . $this->tableName . '.account_type, DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as date_created, DATE_FORMAT(' . $this->tableName . '.date_lastlogin, \'' . $this->sqlFieldDatetimeFormat . '\') as date_lastlogin, ' . $this->tableName . '.is_active ' . $this->additionalFields . ' FROM ' . $this->tableName . ' WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_'; $this->arrDetailsModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'label'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'label'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label')), 'separator_2' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USER_NAME, 'type' => 'label'), 'account_type' => array('title' => _ACCOUNT_TYPE, 'type' => 'enum', 'source' => $arr_account_types), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'source' => $arr_languages)), 'separator_3' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label'), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'source' => $arr_is_active))); if (self::$PROJECT == 'HotelSite') { $this->arrDetailsModeFields['separator_3']['hotels'] = array('title' => _HOTELS, 'type' => 'enum', 'width' => '', 'required' => false, 'readonly' => false, 'default' => '', 'source' => $this->arrCompanies, 'default_option' => '', 'unique' => false, 'javascript_event' => '', 'view_type' => 'checkboxes', 'multi_select' => true); } }
function __construct() { parent::__construct(); $this->params = array(); ## for standard fields if (isset($_POST['name'])) { $this->params['name'] = prepare_input($_POST['name']); } if (isset($_POST['is_active'])) { $this->params['is_active'] = (int) $_POST['is_active']; } // $this->params['language_id'] = MicroGrid::GetParameter('language_id'); $this->primaryKey = 'id'; $this->tableName = TABLE_LISTINGS_LOCATIONS; $this->dataSet = array(); $this->error = ''; $this->formActionURL = 'index.php?admin=mod_listings_locations'; $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 name ASC'; // ORDER BY '.$this->tableName.'.date_created DESC $this->isAlterColorsAllowed = true; $this->isPagingAllowed = true; $this->pageSize = 30; $this->isSortingAllowed = true; $this->isFilteringAllowed = true; $arr_default_types = array('0' => _NO, '1' => _YES); $arr_activity_types = array('0' => _NO, '1' => _YES); // define filtering fields $this->arrFilteringFields = array(_NAME => array('table' => $this->tableName, 'field' => 'name', 'type' => 'text', 'sign' => 'like%', 'width' => '100px'), _ACTIVE => array('table' => $this->tableName, 'field' => 'is_active', 'type' => 'dropdownlist', 'source' => $arr_activity_types, 'sign' => '=', 'width' => '90px', 'visible' => true)); //---------------------------------------------------------------------- // VIEW MODE //---------------------------------------------------------------------- $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ', name, CONCAT("<a href=index.php?admin=mod_listings_sub_locations&lid=", ' . $this->tableName . '.' . $this->primaryKey . ', ">[ ", "' . _SUB_LOCATIONS . ' ]</a> (", (SELECT COUNT(*) FROM ' . TABLE_LISTINGS_SUB_LOCATIONS . ' sl WHERE sl.location_id = ' . $this->tableName . '.' . $this->primaryKey . '), ")") as link_sub_locations, IF(is_active, \'<span class=yes>' . _YES . '</span>\', \'<span class=no>' . _NO . '</span>\') as mod_is_active FROM ' . $this->tableName; // define view mode fields $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'height' => '', 'maxlength' => ''), 'mod_is_active' => array('title' => _ACTIVE, 'type' => 'label', 'align' => 'center', 'width' => '110px', 'height' => '', 'maxlength' => ''), 'link_sub_locations' => array('title' => '', 'type' => 'label', 'align' => 'left', 'width' => '160px', 'maxlength' => '', 'visible' => true)); //---------------------------------------------------------------------- // 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('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => 'text'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'required' => true, 'width' => '90px', 'readonly' => false, 'default' => '1', 'source' => $arr_activity_types, 'unique' => false, 'javascript_event' => '')); //---------------------------------------------------------------------- // 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 . '.name, ' . $this->tableName . '.is_active, IF(is_active, \'<span class=yes>' . _YES . '</span>\', \'<span class=no>' . _NO . '</span>\') as mod_is_active FROM ' . $this->tableName . ' WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_'; // define edit mode fields $this->arrEditModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => 'text'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'required' => true, 'width' => '90px', 'readonly' => false, 'default' => '1', 'source' => $arr_activity_types, 'unique' => false, 'javascript_event' => '')); //---------------------------------------------------------------------- // DETAILS MODE //---------------------------------------------------------------------- $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL; $this->arrDetailsModeFields = array('name' => array('title' => _NAME, 'type' => 'label'), 'mod_is_active' => array('title' => _ACTIVE, 'type' => 'label')); }
<?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'); //-------------------------------------------------------------------------- $mg_language_id = isset($_REQUEST['mg_language_id']) ? prepare_input($_REQUEST['mg_language_id']) : Application::Get('lang'); if ($objLogin->IsLoggedInAsAdmin()) { $objPage = new Pages(Application::Get('page_id'), false, $mg_language_id); } else { $objPage = new Pages(Application::Get('system_page') != '' ? Application::Get('system_page') : Application::Get('page_id'), true, $mg_language_id); } $button_text = ''; // check if there is a page if ($objSession->IsMessage('notice')) { draw_title_bar(_PAGE); echo $objSession->GetMessage('notice'); } else { if ($objPage->CheckAccessRights($objLogin->IsLoggedIn())) { // check if there is a page if ($objPage->GetId() != '') { if ($objLogin->IsLoggedInAsAdmin() && Application::Get('preview') != 'yes') { $button_text = prepare_permanent_link('index.php?admin=pages' . (Application::Get('type') == 'system' ? '&type=system' : '') . '&mg_language_id=' . $mg_language_id, _BUTTON_BACK); } $objPage->DrawTitle($button_text); if (Modules::IsModuleInstalled('adsense') && (ModulesSettings::Get('adsense', 'adsense_code_activation') == 'All' || ModulesSettings::Get('adsense', 'adsense_code_activation') == 'Horizontal')) {
<?php /** * @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'); //-------------------------------------------------------------------------- $act = isset($_POST['act']) ? prepare_input($_POST['act']) : ''; $password_sent = (bool) Session::Get('activation_email_resent'); $email = isset($_POST['email']) ? prepare_input($_POST['email']) : ''; $msg = ''; if ($act == 'resend') { if (!$password_sent) { if (Customers::Reactivate($email)) { $msg = draw_success_message(str_replace('_EMAIL_', $email, _ACTIVATION_EMAIL_WAS_SENT), false); Session::Set('activation_email_resent', true); } else { $msg = draw_important_message(Customers::GetStaticError(), false); } } else { $msg = draw_message(_ACTIVATION_EMAIL_ALREADY_SENT, false); } } // Draw title bar draw_title_bar(_RESEND_ACTIVATION_EMAIL); // Check if customer is logged in if (!$objLogin->IsLoggedIn() && ModulesSettings::Get('customers', 'allow_registration') == 'yes') {
if (!empty($_POST) && isset($_POST['shippay'])) { $email_info = prepare_input($_POST['email_info']); $phone = prepare_input($_POST['phone']); $ship_address1 = prepare_input($_POST['ship_address1']); $ship_address2 = prepare_input($_POST['ship_address2']); $ship_city = prepare_input($_POST['ship_city']); $ship_state = prepare_input($_POST['ship_state']); $ship_postalcode = prepare_input($_POST['ship_postalcode']); $sameBilling = prepare_input($_POST['sameBilling']); $bill_address1 = $sameBilling == "1" ? $ship_address1 : prepare_input($_POST['bill_address1']); $bill_address2 = $sameBilling == "1" ? $ship_address2 : prepare_input($_POST['bill_address2']); $bill_city = $sameBilling == "1" ? $ship_city : prepare_input($_POST['bill_city']); $bill_state = $sameBilling == "1" ? $ship_state : prepare_input($_POST['bill_state']); $bill_postalcode = $sameBilling == "1" ? $ship_postalcode : prepare_input($_POST['bill_postalcode']); $paytype = prepare_input($_POST['paytype']); $sess_orderID = prepare_input($_POST["currOrderId"]); $_SESSION['orderStatus'] = $sess_orderStatus = "review"; //update orders table with these values. //run the update query for the $pieceid. $updQuery1 = "UPDATE `orders` SET `status` = ?, `paymenttype` = ?, `shippingaddress1` = ?, `shippingaddress2` = ?, `shippingstate` = ?, `shippingcity` = ?, `shippingpostal` = ?, `billingaddress1` = ?, `billingaddress2` = ?, `billingcity` = ?, `billingstate` = ?, `billingpostal` = ?, `useremail`= ?, `phone`= ? WHERE `orders`.`orderid` = {$sess_orderID} "; $stmt = $dbcon->prepare($updQuery1); $stmt->bind_param('ssssssssssssss', $sess_orderStatus, $paytype, $ship_address1, $ship_address2, $ship_state, $ship_city, $ship_postalcode, $bill_address1, $bill_address2, $bill_state, $bill_city, $bill_postalcode, $email_info, $phone); if (!$stmt->execute()) { die('Error : (' . $dbcon->errno . ') ' . $dbcon->error); } $stmt->close(); $shipAddressStr = $ship_address1 . ", <br>"; if (!empty($ship_address2)) { $shipAddressStr .= $ship_address2 . ", <br>"; } $shipAddressStr .= $ship_city . ", " . $ship_state . ", India <br>";
$INSTALL_OS_TYPE_INFO = $INSTALL_EMAIL_ADDRESS_INFO = $INSTALL_SITE_NAME_INFO = ''; $INSTALL_EMAIL_PASSWORD_INFO = $INSTALL_HELPDESK_MAILSERVER_INFO = $INSTALL_SEO_URLS_INFO = ''; if (file_exists(FILE_TMP_CONFIG)) { @unlink(FILE_TMP_CONFIG); } if ($action == 'config') { break; } $error = false; $INSTALL_TEMPLATE = isset($_POST['TEMPLATE']) ? prepare_input($_POST['TEMPLATE']) : DEFAULT_TEMPLATE; $INSTALL_OS_TYPE = isset($_POST['INSTALL_OS_TYPE']) ? (int) $_POST['INSTALL_OS_TYPE'] : 0; $INSTALL_SEO_URLS = isset($_POST['INSTALL_SEO_URLS']) ? 1 : 0; $INSTALL_EMAIL_ADDRESS = isset($_POST['INSTALL_EMAIL_ADDRESS']) ? prepare_input($_POST['INSTALL_EMAIL_ADDRESS']) : ''; $INSTALL_EMAIL_PASSWORD = isset($_POST['INSTALL_EMAIL_PASSWORD']) ? prepare_input($_POST['INSTALL_EMAIL_PASSWORD']) : ''; $INSTALL_SITE_NAME = isset($_POST['INSTALL_SITE_NAME']) ? prepare_input($_POST['INSTALL_SITE_NAME']) : ''; $INSTALL_HELPDESK_MAILSERVER = isset($_POST['INSTALL_HELPDESK_MAILSERVER']) ? prepare_input($_POST['INSTALL_HELPDESK_MAILSERVER']) : ''; if (empty($INSTALL_EMAIL_ADDRESS)) { $INSTALL_EMAIL_ADDRESS_INFO = ERROR_EMAIL_ADDRESS; $error = true; } if (empty($INSTALL_SITE_NAME)) { $INSTALL_SITE_NAME_INFO = ERROR_SITE_NAME; $error = true; } $contents = ''; read_contents(FILE_TMP_FRONT_SERVER, $contents); eval($contents); $templates_array = array(); $dir_array = array_filter(glob('templates/' . '*'), 'is_dir'); $template_found = false; foreach ($dir_array as $key => $value) {
$params_tab3 = array(); $params_tab3['date_format'] = isset($_POST['date_format']) ? prepare_input($_POST['date_format']) : $objSettings->GetParameter('date_format'); $params_tab3['time_zone'] = isset($_POST['time_zone']) ? prepare_input($_POST['time_zone']) : $objSettings->GetParameter('time_zone'); $params_tab3["price_format"] = isset($_POST['price_format']) ? prepare_input($_POST['price_format']) : $objSettings->GetParameter("price_format"); $params_tab4 = array(); $params_tab4['mailer'] = isset($_POST['mailer']) ? prepare_input($_POST['mailer']) : $objSettings->GetParameter('mailer'); $params_tab4['admin_email'] = isset($_POST['admin_email']) ? prepare_input($_POST['admin_email']) : $objSettings->GetParameter('admin_email'); $params_tab4['mailer_type'] = isset($_POST['mailer_type']) ? prepare_input($_POST['mailer_type']) : $objSettings->GetParameter('mailer_type'); $params_tab4['smtp_host'] = isset($_POST['smtp_host']) ? prepare_input($_POST['smtp_host']) : $objSettings->GetParameter('smtp_host'); $params_tab4['smtp_port'] = isset($_POST['smtp_port']) ? prepare_input($_POST['smtp_port']) : $objSettings->GetParameter('smtp_port'); $params_tab4['smtp_username'] = isset($_POST['smtp_username']) ? prepare_input($_POST['smtp_username']) : $objSettings->GetParameter('smtp_username'); $params_tab4['smtp_password'] = isset($_POST['smtp_password']) ? prepare_input($_POST['smtp_password']) : $objSettings->GetParameter('smtp_password'); $params_cron = array(); $params_cron['cron_type'] = isset($_POST['cron_type']) ? prepare_input($_POST['cron_type']) : $objSettings->GetParameter('cron_type'); $params_cron['cron_run_period'] = isset($_POST['cron_run_period']) ? prepare_input($_POST['cron_run_period']) : $objSettings->GetParameter('cron_run_period'); $params_cron['cron_run_period_value'] = isset($_POST['cron_run_period_value']) ? prepare_input($_POST['cron_run_period_value']) : $objSettings->GetParameter('cron_run_period_value'); // SAVE CHANGES if ($submition_type == 'general') { if (strlen($params['offline_message']) > 255) { $msg_text = str_replace('_FIELD_', '<b>' . _OFFLINE_MESSAGE . '</b>', _FIELD_LENGTH_ALERT); $msg_text = str_replace('_LENGTH_', '255', $msg_text); $msg = draw_important_message($msg_text, false); $focus_on_field = 'offline_message'; } else { if ($objSettings->UpdateFields($params) == true) { $msg = draw_success_message(_SETTINGS_SAVED, false); } else { $msg = draw_important_message($objSettings->error, false); } } } else {
<?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->IsLoggedInAs('owner', 'mainadmin')) { $file = isset($_GET['file']) ? prepare_input($_GET['file']) : ''; if ($file == 'export.csv') { $file_path = 'tmp/export/' . $file; header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1 header('Pragma: no-cache'); // HTTP/1.0 header('Content-type: application/force-download'); header('Content-Disposition: inline; filename="' . $file . '"'); header('Content-Transfer-Encoding: binary'); header('Content-length: ' . filesize($file_path)); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $file . '"'); readfile($file_path); exit(0);
} if (substr($imagebasedir, -1, 1) != '/' && $imagebasedir != '') { $imagebasedir = $imagebasedir . '/'; } $leadon = $imagebasedir; if ($leadon == '.') { $leadon = ''; } if (substr($leadon, -1, 1) != '/' && $leadon != '') { $leadon = $leadon . '/'; } $startdir = $leadon; $file = isset($_GET['file']) ? prepare_input($_GET['file']) : ""; $get_dir = isset($_GET['dir']) ? prepare_input($_GET['dir']) : ""; $get_sort = isset($_GET['sort']) ? prepare_input($_GET['sort']) : ""; $get_order = isset($_GET['order']) ? prepare_input($_GET['order']) : ""; $dotdotdir = ""; $dirok = false; $basedir = ""; // delete image from gallery if ($allowuploads) { if (!$is_demo) { @unlink($leadon . $file); } } if ($get_dir) { $dir = base64_decode($get_dir); if (substr($dir, -1, 1) != '/') { $dir = $dir . '/'; } $dirok = true;
/** * After-insertion function */ public function AfterInsertRecord() { $name = isset($_POST['descr_name']) ? prepare_input($_POST['descr_name']) : ''; $description = isset($_POST['descr_description']) ? prepare_input($_POST['descr_description']) : ''; // languages array $total_languages = Languages::GetAllActive(); foreach ($total_languages[0] as $key => $val) { $sql = 'INSERT INTO ' . TABLE_CATEGORIES_DESCRIPTION . '( id, category_id, language_id, name, description) VALUES( NULL, ' . $this->lastInsertId . ', \'' . $val['abbreviation'] . '\', \'' . $name . '\', \'' . $description . '\' )'; if (!database_void_query($sql)) { // error } } }
<?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'); //-------------------------------------------------------------------------- $task = isset($_POST['task']) ? prepare_input($_POST['task']) : ''; $keyword = isset($_POST['keyword']) ? strip_tags(prepare_input($_POST['keyword'])) : ''; if ($keyword == _SEARCH_KEYWORDS . '...') { $keyword = ''; } $p = isset($_POST['p']) ? (int) $_POST['p'] : ''; $objSearch = new Search(); $search_result = ''; $title_bar = _LOOK_IN . ': <select class="look_in" name="search_in" onchange="javascript:document.getElementById(\'search_in\').value=this.value;appQuickSearch();"> <option value="listings" ' . (Application::Get('search_in') == 'listings' ? 'selected="selected"' : '') . '>' . _LISTINGS . '</option> <option value="pages" ' . (Application::Get('search_in') == 'pages' ? 'selected="selected"' : '') . '>' . _PAGES . '</option> <option value="news" ' . (Application::Get('search_in') == 'news' ? 'selected="selected"' : '') . '>' . _NEWS . '</option> </select>'; // Check if there is a page if ($keyword != '') { draw_title_bar(_SEARCH_RESULT_FOR . ': ' . $keyword . '', $title_bar); if ($task == 'quick_search') { $search_result = $objSearch->SearchBy($keyword, $p, Application::Get('search_in')); }
function __construct($customer_id = '') { global $objLogin; $this->SetRunningTime(); $this->params = array(); if (isset($_POST['status'])) { $this->params['status'] = prepare_input($_POST['status']); } if (isset($_POST['status_changed'])) { $this->params['status_changed'] = prepare_input($_POST['status_changed']); } if (isset($_POST['additional_info'])) { $this->params['additional_info'] = prepare_input($_POST['additional_info']); } $this->currencyFormat = get_currency_format(); $this->params['language_id'] = MicroGrid::GetParameter('language_id'); $rid = MicroGrid::GetParameter('rid'); $this->primaryKey = 'id'; $this->tableName = TABLE_ORDERS; $this->dataSet = array(); $this->error = ''; $this->order_number = ''; $this->order_status = ''; $this->order_customer_id = ''; $this->order_listings = ''; $this->order_advertise_plan_id = ''; $arr_statuses = array('0' => _PREPARING, '1' => _PENDING, '2' => _PAID, '3' => _COMPLETED, '4' => _REFUNDED); $arr_statuses_edit = array('1' => _PENDING, '2' => _PAID, '3' => _COMPLETED, '4' => _REFUNDED); $arr_statuses_edit_cut = array('1' => _PENDING, '2' => _PAID, '3' => _COMPLETED); $arr_statuses_refund = array('4' => _REFUNDED); $arr_statuses_customer_edit = array('4' => ''); if ($customer_id != '') { $this->customer_id = $customer_id; $this->page = 'customer=my_orders'; $this->actions = array('add' => false, 'edit' => false, 'details' => false, 'delete' => false); } else { $this->customer_id = ''; $this->page = 'admin=mod_payments_orders'; $this->actions = array('add' => false, 'edit' => false, 'details' => false, 'delete' => $objLogin->IsLoggedInAs('owner') ? true : false); } $this->actionIcons = true; $this->allowRefresh = true; $this->formActionURL = 'index.php?' . $this->page; $this->allowLanguages = false; $this->languageId = ''; // ($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang(); $this->WHERE_CLAUSE = 'WHERE 1=1'; if ($customer_id != '') { $this->WHERE_CLAUSE = 'WHERE ' . $this->tableName . '.status != 0 AND ' . $this->tableName . '.customer_id = ' . (int) $customer_id; } $this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.id DESC'; // ORDER BY date_created DESC $this->isAlterColorsAllowed = true; $this->isPagingAllowed = true; $this->pageSize = 30; $this->isSortingAllowed = true; $datetime_format = get_datetime_format(); $date_format = get_date_format(); $date_format_settings = get_date_format('view', true); $this->currency_format = get_currency_format(); $pre_currency_symbol = Application::Get('currency_symbol_place') == 'left' ? Application::Get('currency_symbol') : ''; $post_currency_symbol = Application::Get('currency_symbol_place') == 'right' ? Application::Get('currency_symbol') : ''; $this->collect_credit_card = ModulesSettings::Get('payments', 'online_collect_credit_card'); $this->isFilteringAllowed = true; // define filtering fields $this->arrFilteringFields = array(_ORDER_NUMBER => array('table' => $this->tableName, 'field' => 'order_number', 'type' => 'text', 'sign' => 'like%', 'width' => '70px'), _DATE => array('table' => $this->tableName, 'field' => 'payment_date', 'type' => 'calendar', 'date_format' => $date_format_settings, 'sign' => 'like%', 'width' => '80px', 'visible' => true)); if ($this->customer_id == '') { $this->arrFilteringFields[_CUSTOMER] = array('table' => TABLE_CUSTOMERS, 'field' => 'user_name', 'type' => 'text', 'sign' => 'like%', 'width' => '70px'); } $this->arrFilteringFields[_STATUS] = array('table' => $this->tableName, 'field' => 'status', 'type' => 'dropdownlist', 'source' => $arr_statuses_edit, 'sign' => '=', 'width' => ''); //---------------------------------------------------------------------- // VIEW MODE //---------------------------------------------------------------------- $this->VIEW_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ', ' . $this->tableName . '.order_number, ' . $this->tableName . '.order_description, ' . $this->tableName . '.order_price, ' . $this->tableName . '.total_price, CONCAT(' . TABLE_CURRENCIES . '.symbol, "", ' . $this->tableName . '.total_price) as mod_total_price, ' . $this->tableName . '.currency, ' . $this->tableName . '.advertise_plan_id, ' . $this->tableName . '.listings_amount, ' . $this->tableName . '.customer_id, ' . $this->tableName . '.transaction_number, ' . $this->tableName . '.created_date, ' . $this->tableName . '.payment_date, ' . $this->tableName . '.payment_type, ' . $this->tableName . '.payment_method, ' . $this->tableName . '.status, ' . $this->tableName . '.status_changed, 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>" WHEN ' . $this->tableName . '.status = 4 THEN "<span style=color:#969600>' . _REFUNDED . '</span>" ELSE "' . _UNKNOWN . '" END as m_status, ' . TABLE_CUSTOMERS . '.user_name as customer_name, ' . TABLE_CURRENCIES . '.symbol, CONCAT("<a href=\\"javascript:void(\'description\')\\" onclick=\\"javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'description\', \'", ' . $this->tableName . '.' . $this->primaryKey . ', "\')\\">[ ", "' . _DESCRIPTION . '", " ]</a>") as link_order_description, IF(' . $this->tableName . '.status >= 2, CONCAT("<a href=\\"javascript:void(\'invoice\')\\" onclick=\\"javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'invoice\', \'", ' . $this->tableName . '.' . $this->primaryKey . ', "\')\\">[ ", "' . _INVOICE . '", " ]</a>"), "<span class=lightgray>' . _INVOICE . '</span>") as link_order_invoice, IF(' . $this->tableName . '.status = 0 OR ' . $this->tableName . '.status = 1, CONCAT("<a href=\\"javascript:void(0);\\" title=\\"Delete\\" onclick=\\"javascript:__mgDoPostBack(\'' . TABLE_ORDERS . '\', \'delete\', \'", ' . $this->tableName . '.' . $this->primaryKey . ', "\');\\">[ ' . _DELETE_WORD . ' ]</a>"), "<span class=lightgray>' . _DELETE_WORD . '</span>") as link_order_delete, IF(' . $this->tableName . '.status != 0, CONCAT("<a href=\\"javascript:void(0);\\" title=\\"' . _EDIT_WORD . '\\" onclick=\\"javascript:__mgDoPostBack(\'' . TABLE_ORDERS . '\', \'edit\', \'", ' . $this->tableName . '.' . $this->primaryKey . ', "\');\\">[ ' . _EDIT_WORD . ' ]</a>"), "<span class=lightgray>' . _EDIT_WORD . '</span>") as link_admin_order_edit, ' . TABLE_ADVERTISE_PLANS_DESCRIPTION . '.name as plan_name, ' . TABLE_CUSTOMERS . '.b_country FROM ' . $this->tableName . ' LEFT OUTER JOIN ' . TABLE_CURRENCIES . ' ON ' . $this->tableName . '.currency = ' . TABLE_CURRENCIES . '.code LEFT OUTER JOIN ' . TABLE_CUSTOMERS . ' ON ' . $this->tableName . '.customer_id = ' . TABLE_CUSTOMERS . '.id LEFT OUTER JOIN ' . TABLE_ADVERTISE_PLANS_DESCRIPTION . ' ON (' . $this->tableName . '.advertise_plan_id = ' . TABLE_ADVERTISE_PLANS_DESCRIPTION . '.advertise_plan_id AND language_id = "' . Application::Get('lang') . '") '; // define view mode fields if ($this->customer_id != '') { $this->arrViewModeFields = array('order_number' => array('title' => _ORDER_NUMBER, 'type' => 'label', 'align' => 'left', 'width' => '', 'header' => '', 'maxlength' => ''), 'created_date' => array('title' => _DATE, 'type' => 'label', 'align' => 'left', 'width' => '', 'header' => '', 'maxlength' => '', 'format' => 'date', 'format_parameter' => $datetime_format), 'plan_name' => array('title' => _PLAN, 'header_tooltip' => _ADVERTISE_PLAN, 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => ''), 'listings_amount' => array('title' => _LISTINGS, 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => ''), 'mod_total_price' => array('title' => _TOTAL_PRICE, 'type' => 'label', 'align' => 'right', 'width' => '', 'header' => '', 'maxlength' => '', 'sort_by' => 'total_price', 'sort_type' => 'numeric', 'format' => 'currency', 'format_parameter' => $this->currency_format . '|2'), 'm_status' => array('title' => _STATUS, 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => ''), 'link_order_description' => array('title' => '', 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => ''), 'link_order_invoice' => array('title' => '', 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => ''), 'link_order_delete' => array('title' => '', 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => '')); } else { $this->arrViewModeFields = array('order_number' => array('title' => _ORDER, 'type' => 'label', 'align' => 'left', 'width' => '', 'header' => '', 'maxlength' => ''), 'created_date' => array('title' => _DATE, 'type' => 'label', 'align' => 'left', 'width' => '', 'header' => '', 'maxlength' => '', 'format' => 'date', 'format_parameter' => $datetime_format), 'customer_name' => array('title' => _CUSTOMER, 'type' => 'label', 'align' => 'left', 'width' => '', 'header' => '', 'maxlength' => ''), 'b_country' => array('title' => _COUNTRY, 'type' => 'label', 'align' => 'center', 'width' => '', 'height' => '', 'maxlength' => ''), 'plan_name' => array('title' => _PLAN, 'header_tooltip' => _ADVERTISE_PLAN, 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => ''), 'listings_amount' => array('title' => _LISTINGS, 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => ''), 'm_payment_type' => array('title' => _METHOD, 'header_tooltip' => _PAYMENT_METHOD, 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => ''), 'total_price' => array('title' => _TOTAL_PRICE, 'type' => 'label', 'align' => 'right', 'width' => '', 'header' => '', 'maxlength' => '', 'sort_by' => 'total_price', 'sort_type' => 'numeric', 'format' => 'currency', 'format_parameter' => $this->currency_format . '|2'), 'symbol' => array('title' => '', 'type' => 'label', 'align' => 'left', 'width' => '', 'header' => '', 'maxlength' => ''), 'm_status' => array('title' => _STATUS, 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => ''), 'link_order_description' => array('title' => '', 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => ''), 'link_order_invoice' => array('title' => '', 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => ''), 'link_admin_order_edit' => array('title' => '', 'type' => 'label', 'align' => 'center', 'width' => '', 'header' => '', 'maxlength' => '')); } //---------------------------------------------------------------------- // ADD MODE //---------------------------------------------------------------------- // define add mode fields $this->arrAddModeFields = array(); //---------------------------------------------------------------------- // EDIT MODE //---------------------------------------------------------------------- $this->EDIT_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ', ' . $this->tableName . '.order_number, ' . $this->tableName . '.order_number as order_number_view, ' . $this->tableName . '.order_description, ' . $this->tableName . '.order_price, ' . $this->tableName . '.vat_fee, ' . $this->tableName . '.total_price, ' . $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 . '"), " (' . _CLEANED . ')"), AES_DECRYPT(' . $this->tableName . '.cc_number, "' . PASSWORDS_ENCRYPT_KEY . '") ) as m_cc_number, ' . $this->tableName . '.cc_cvv_code, ' . $this->tableName . '.cc_expires_month, ' . $this->tableName . '.cc_expires_year, IF(' . $this->tableName . '.cc_expires_month != "", CONCAT(' . $this->tableName . '.cc_expires_month, "/", ' . $this->tableName . '.cc_expires_year), "") as m_cc_expires_date, ' . $this->tableName . '.transaction_number, ' . $this->tableName . '.payment_date, ' . $this->tableName . '.payment_type, ' . $this->tableName . '.payment_method, ' . $this->tableName . '.status, ' . $this->tableName . '.status_changed, ' . $this->tableName . '.additional_info FROM ' . $this->tableName . ' LEFT OUTER JOIN ' . TABLE_CURRENCIES . ' ON ' . $this->tableName . '.currency = ' . TABLE_CURRENCIES . '.code LEFT OUTER JOIN ' . TABLE_CUSTOMERS . ' ON ' . $this->tableName . '.customer_id = ' . TABLE_CUSTOMERS . '.id '; if ($this->customer_id != '') { $WHERE_CLAUSE = 'WHERE ' . $this->tableName . '.status = 3 AND ' . $this->tableName . '.customer_id = ' . $this->customer_id . ' AND ' . $this->tableName . '.id = _RID_'; } else { $WHERE_CLAUSE = 'WHERE ' . $this->tableName . '.id = _RID_'; } $this->EDIT_MODE_SQL = $this->EDIT_MODE_SQL . $WHERE_CLAUSE; // prepare trigger $sql = 'SELECT status, IF(TRIM(cc_number) = \'\' OR LENGTH(AES_DECRYPT(cc_number, \'' . PASSWORDS_ENCRYPT_KEY . '\')) <= 4, \'hide\', \'show\') as cc_number_trigger FROM ' . $this->tableName . ' WHERE id = ' . (int) $rid; $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY, FETCH_ASSOC); if ($result[1] > 0) { $cc_number_trigger = $result[0]['cc_number_trigger']; $status_trigger = $result[0]['status']; } else { $cc_number_trigger = 'hide'; $status_trigger = '0'; } // define edit mode fields if ($customer_id != '') { $this->arrEditModeFields = array('order_number_view' => array('title' => _ORDER_NUMBER, 'type' => 'label'), 'status_changed' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => date('Y-m-d H:i:s')), 'status' => array('title' => _STATUS, 'type' => 'enum', 'width' => '210px', 'required' => true, 'readonly' => false, 'source' => $arr_statuses_customer_edit), 'order_number' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => ''), 'customer_id' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => '')); } else { $status_readonly = $status_trigger == '6' ? true : false; if ($status_trigger >= '2' && $status_trigger <= '6') { $ind = $status_trigger; while ($ind--) { unset($arr_statuses_edit[$ind]); } $status_source = $arr_statuses_edit; } else { $status_source = $arr_statuses_edit_cut; } $this->arrEditModeFields = array('order_number_view' => array('title' => _ORDER_NUMBER, 'type' => 'label'), 'status_changed' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => date('Y-m-d H:i:s')), 'status' => array('title' => _STATUS, 'type' => 'enum', 'width' => '210px', 'required' => true, 'readonly' => $status_readonly, 'source' => $status_source, 'javascript_event' => ''), 'order_number' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => ''), 'customer_id' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => ''), 'cc_type' => array('title' => _CREDIT_CARD_TYPE, 'type' => 'label'), 'cc_holder_name' => array('title' => _CREDIT_CARD_HOLDER_NAME, 'type' => 'label'), 'm_cc_number' => array('title' => _CREDIT_CARD_NUMBER, 'type' => 'label', 'post_html' => $cc_number_trigger == 'show' ? ' [ <a href="javascript:void(0);" onclick="if(confirm(\'' . _PERFORM_OPERATION_COMMON_ALERT . '\')) __mgDoPostBack(\'' . $this->tableName . '\',\'clean_credit_card\',\'' . $rid . '\')">' . _REMOVE . '</a> ]' : ''), 'm_cc_expires_date' => array('title' => _EXPIRES, 'type' => 'label'), 'cc_cvv_code' => array('title' => _CVV_CODE, 'type' => 'label'), 'additional_info' => array('title' => _ADDITIONAL_INFO, 'type' => 'textarea', 'width' => '390px', 'header' => '90px', 'editor_type' => 'simple', 'readonly' => false, 'default' => '', 'required' => false, 'validation_type' => '', 'unique' => false)); } //---------------------------------------------------------------------- // DETAILS MODE //---------------------------------------------------------------------- $this->DETAILS_MODE_SQL = $this->VIEW_MODE_SQL . $WHERE_CLAUSE; $this->arrDetailsModeFields = array('order_number' => array('title' => _ORDER, 'type' => 'label'), 'order_description' => array('title' => _DESCRIPTION, 'type' => 'label'), 'order_price' => array('title' => _ORDER_PRICE, 'type' => 'label'), 'vat_fee' => array('title' => _VAT, 'type' => 'label'), 'total_price' => array('title' => _TOTAL_PRICE, 'type' => 'label'), 'currency' => array('title' => _CURRENCY, 'type' => 'label'), 'listings_amount' => array('title' => _LISTINGS, 'type' => 'label'), 'customer_name' => array('title' => _CUSTOMER, 'type' => 'label'), 'transaction_number' => array('title' => _TRANSACTION, 'type' => 'label'), 'payment_date' => array('title' => _DATE, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'm_payment_type' => array('title' => _PAYED_BY, 'type' => 'label'), 'm_payment_method' => array('title' => _PAYMENT_METHOD, 'type' => 'label'), 'm_status' => array('title' => _STATUS, 'type' => 'label'), 'status_changed' => array('title' => _STATUS_CHANGED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format)); }
/** * Draws inquiry form * @param $params * @param $draw */ public static function DrawInquiryForm($params, $draw = true) { $output = ''; $inquiry_category = isset($params['inquiry_category']) ? prepare_input($params['inquiry_category']) : ''; $widget = isset($params['widget']) ? prepare_input($params['widget']) : ''; $widget_host = isset($params['widget_host']) ? prepare_input($params['widget_host']) : ''; $widget_key = isset($params['widget_key']) ? prepare_input($params['widget_key']) : ''; // prepare categories array $objCategories = Categories::Instance(); $total_categories = $objCategories->GetAllExistingCategories(); $arr_categories = array(); foreach ($total_categories as $key => $val) { if ($val['level'] == '1') { $arr_categories[$val['id']] = $val['name']; } else { if ($val['level'] == '2') { $arr_categories[$val['id']] = ' • ' . $val['name']; } else { if ($val['level'] == '3') { $arr_categories[$val['id']] = ' :: ' . $val['name']; } } } } if ($widget) { $output .= '<form id="frmInquiryForm" action="' . APPHP_BASE . 'index.php?host=' . $widget_host . '&key=' . $widget_key . '" method="post">'; } else { $output .= '<form id="frmInquiryForm" action="index.php?page=inquiry_form" method="post">'; } $output .= draw_token_field(false); $output .= draw_hidden_field('act', 'send', false, 'id_act'); $output .= draw_hidden_field('inquiry_type', '0', false); $output .= '<div class="inquiry_wrapper">'; $output .= _WHAT_DO_YOU_NEED . '<br>'; $output .= '<select id="inquiry_category" name="inquiry_category">'; $output .= '<option value="">-- ' . _SELECT . ' --</option>'; foreach ($arr_categories as $key => $val) { $output .= '<option value="' . $key . '"' . ($inquiry_category == $key ? ' selected="selected"' : '') . '>' . $val . '</option>'; } $output .= '</select><br><br>'; $output .= self::DrawInquirySubForm($params, false); $output .= '</div>'; $output .= '</form>'; if ($draw) { echo $output; } else { return $output; } }
<?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);
/** * Get page URL * @param $urlencode */ function get_page_url($urlencode = true) { $protocol = 'http://'; $port = ''; $http_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''; if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' || strtolower(substr($_SERVER['SERVER_PROTOCOL'], 0, 5)) == 'https') { $protocol = 'https://'; } if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != '80') { if (!strpos($http_host, ':')) { $port = ':' . $_SERVER['SERVER_PORT']; } } // fixed for work with both Apache and IIS if (!isset($_SERVER['REQUEST_URI'])) { $uri = substr(prepare_input($_SERVER['PHP_SELF'], false, 'extra'), 0); if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '') { $uri .= '?' . prepare_input($_SERVER['QUERY_STRING'], false, 'extra'); } } else { $uri = prepare_input($_SERVER['REQUEST_URI'], false, 'extra'); if (preg_match("/:|;|'|\\(|\\)/", $uri)) { $uri = ''; } } if (isset($_GET['p'])) { $uri = remove_url_param($uri, 'p'); } if ($urlencode) { $uri = str_replace('&', '&', $uri); } return $protocol . $http_host . $port . $uri; }
<?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->IsLoggedInAs('owner') && Modules::IsModuleInstalled('backup')) { $submition_type = isset($_POST['submition_type']) ? prepare_input($_POST['submition_type']) : ''; $backup_file = isset($_POST['backup_file']) ? prepare_input($_POST['backup_file']) : ''; $st = isset($_GET['st']) ? prepare_input($_GET['st']) : ''; $fname = isset($_GET['fname']) ? prepare_input($_GET['fname']) : ''; $msg = ''; $objBackup = new Backup(); if ($st == 'restore') { // restore previouse backup if ($objBackup->RestoreBackup($fname)) { $msg = draw_success_message(str_replace('_FILE_NAME_', $fname, _BACKUP_WAS_RESTORED), false); } else { $msg = draw_important_message($objBackup->error, false); } } else { $msg = draw_message(_BACKUP_RESTORE_NOTE, false); } // draw title bar and message draw_title_bar(prepare_breadcrumbs(array(_MODULES => '', _BACKUP => '', _BACKUP_RESTORE => '')), prepare_permanent_link('index.php?admin=mod_backup_installation', _BACKUP_INSTALLATION)); echo $msg;
/** * Draws mass mail form * $param $draw */ public function DrawMassMailForm($draw = true) { global $objSettings; $template_subject = ''; $template_content = ''; $result = database_query('SELECT COUNT(*) as cnt FROM ' . $this->TABLE_NAME . ' WHERE is_active = 1 AND email_notifications = 1 AND email != \'\'', DATA_ONLY, FIRST_ROW_ONLY); $members_emails_count = isset($result['cnt']) ? $result['cnt'] : 0; $result = database_query('SELECT COUNT(*) as cnt FROM ' . TABLE_ACCOUNTS . ' WHERE is_active = 1 AND email != \'\'', DATA_ONLY, FIRST_ROW_ONLY); $admins_emails_count = isset($result['cnt']) ? $result['cnt'] : 0; $emails_count = $members_emails_count + $admins_emails_count; $result = database_query('SELECT COUNT(*) as cnt FROM ' . TABLE_NEWS_SUBSCRIBED . ' WHERE email != \'\'', DATA_ONLY, FIRST_ROW_ONLY); $newsletter_subscribers_count = isset($result['cnt']) ? $result['cnt'] : 0; $send_copy_to_admin = '1'; $email_from = $objSettings->GetParameter('admin_email'); $template_code = isset($_GET['template_code']) ? prepare_input($_GET['template_code']) : ''; $duration = isset($_POST['duration']) ? (int) $_POST['duration'] : '5'; $members_module_installed = Modules::IsModuleInstalled($this->MODULE_NAME); // load appropriate email template if ($template_code != '') { $template = $this->GetTemplate($template_code, Application::Get('lang')); $template_subject = $template['template_subject']; $template_content = $template['template_content']; } if ($this->error == true) { $template_code = isset($_POST['template_name']) ? prepare_input($_POST['template_name']) : ''; $template_subject = isset($_POST['subject']) ? prepare_input($_POST['subject']) : ''; $template_content = isset($_POST['message']) ? prepare_input($_POST['message']) : ''; } $output = '<script type="text/javascript"> function duration_OnChange(val){ var el_package_size = (document.getElementById(\'package_size\')) ? document.getElementById(\'package_size\') : null; if(val == \'\' && el_package_size){ el_package_size.selectedIndex = 0; el_package_size.disabled = \'disabled\'; }else{ el_package_size.disabled = \'\'; } } function email_to_OnChange(val){ var el_send_copy_to_admin = (document.getElementById(\'send_copy_to_admin\')) ? document.getElementById(\'send_copy_to_admin\') : null; if(val == \'admins\' && el_send_copy_to_admin){ el_send_copy_to_admin.disabled = \'disabled\'; }else{ el_send_copy_to_admin.disabled = \'\'; } } function OnSubmit_Check(){ var email_to = (document.getElementById(\'email_to\')) ? document.getElementById(\'email_to\').value : \'\'; var email_from = (document.getElementById(\'email_from\')) ? document.getElementById(\'email_from\').value : \'\'; var subject = (document.getElementById(\'subject\')) ? document.getElementById(\'subject\').value : \'\'; var message = (document.getElementById(\'message\')) ? document.getElementById(\'message\').value : \'\'; if(email_to == \'\'){ alert(\'' . str_replace('_FIELD_', _EMAIL_TO, _FIELD_CANNOT_BE_EMPTY) . '\'); document.getElementById(\'email_to\').focus(); return false; }else if(email_from == \'\'){ alert(\'' . str_replace('_FIELD_', _EMAIL_FROM, _FIELD_CANNOT_BE_EMPTY) . '\'); document.getElementById(\'email_from\').focus(); return false; }else if(email_from != \'\' && !appIsEmail(email_from)){ alert(\'' . str_replace('_FIELD_', _EMAIL_FROM, _FIELD_MUST_BE_EMAIL) . '\'); document.getElementById(\'email_from\').focus(); return false; }else if(subject == \'\'){ alert(\'' . str_replace('_FIELD_', _SUBJECT, _FIELD_CANNOT_BE_EMPTY) . '\'); document.getElementById(\'subject\').focus(); return false; }else if(message == \'\'){ alert(\'' . str_replace('_FIELD_', _MESSAGE, _FIELD_CANNOT_BE_EMPTY) . '\'); document.getElementById(\'message\').focus(); return false; }else if(email_to == \'all\'){ if(!confirm(\'' . _PERFORM_OPERATION_COMMON_ALERT . '\')){ return false; } } return true; } </script>'; $output .= '<form action="index.php?admin=mass_mail" method="post" style="margin:0px;"> ' . draw_hidden_field('task', 'send', false) . ' ' . draw_hidden_field('email_random_code', get_random_string(10), false) . ' ' . draw_token_field(false) . ' <table border="0" cellspacing="10"> <tr> <td align="left" valign="top"> <fieldset style="height:410px;"> <legend><b>' . _FORM . ':</b></legend> <table width="97%" align="center" border="0" cellspacing="5"> <tr> <td align="right" nowrap="nowrap"> <label>' . _EMAIL_TEMPLATES . ':</label><br> ' . prepare_permanent_link('index.php?admin=email_templates', '[ ' . _MANAGE_TEMPLATES . ' ]', '', '') . ' </td> <td></td> <td> <table cellpadding="0" cellspacing="0"> <tr valign="middle"> <td> <select name="template_name" id="template_name" style="margin-bottom:3px;" onchange="javascript:appGoTo(\'admin=mass_mail&template_code=\'+this.value)"> <option value="">-- ' . _NO_TEMPLATE . ' --</option>'; $templates = $this->GetAllTemplates('is_system_template=0'); for ($i = 0; $i < $templates[1]; $i++) { $output .= '<option'; $output .= $templates[0][$i]['is_system_template'] == '1' ? ' style="background-color:#ffffcc;color:#000055"' : ''; $output .= $template_code == $templates[0][$i]['template_code'] ? ' selected="selected"' : ''; $output .= ' value="' . encode_text($templates[0][$i]['template_code']) . '">' . $templates[0][$i]['template_name'] . '</option>'; } $output .= ' </select> </td> </tr> </table> </td> </tr> <tr> <td align="right" nowrap="nowrap"><label>' . _EMAIL_TO . ':</label></td> <td><span class="mandatory_star">*</span></td> <td> <select name="email_to" id="email_to" style="margin-bottom:3px;" onchange="email_to_OnChange(this.value)"> <option value="">-- ' . _SELECT . ' --</option> <option value="test" style="background-color:#ffffcc;color:#000055">' . _TEST_EMAIL . ' (' . $email_from . ')</option>'; if (Modules::IsModuleInstalled('news')) { $output .= '<option value="newsletter_subscribers" style="background-color:#ffccff;color:#000055">' . _NEWSLETTER_SUBSCRIBERS . ' (' . $newsletter_subscribers_count . ')</option>'; } if ($members_module_installed) { $output .= '<optgroup label="' . $this->MEMBERS_NAME . '">'; $output .= '<option value="members|all">' . _ALL . ' (' . $members_emails_count . ')</option>'; if (self::$PROJECT == 'ShoppingCart' || self::$PROJECT == 'BusinessDirectory' || self::$PROJECT == 'HotelSite') { $arrMembersGroups = CustomerGroups::GetAllGroupsByCustomers(); } else { if (self::$PROJECT == 'MedicalAppointment') { $arrMembersGroups = PatientGroups::GetAllGroupsByPatiens(); } else { $arrMembersGroups = UserGroups::GetAllGroupsByUsers(); } } $member_groups_emails_count = 0; if ($arrMembersGroups[1] > 0) { foreach ($arrMembersGroups[0] as $key => $val) { if ($val[$this->MODULE_NAME . '_count']) { $output .= '<option value="members|' . $val['id'] . '">' . $val['name'] . ' (' . $val[$this->MODULE_NAME . '_count'] . ')</option>'; $member_groups_emails_count += $val[$this->MODULE_NAME . '_count']; } } } $member_non_groups_emails = $members_emails_count - $member_groups_emails_count; $output .= '<option value="members|uncategorized">' . _UNCATEGORIZED . ' (' . $member_non_groups_emails . ')</option>'; $output .= '</optgroup>'; } $output .= '<option value="admins">' . _ADMINS . ' (' . $admins_emails_count . ')</option>'; if ($members_module_installed) { $output .= '<option value="all">' . $this->ADMINS_MEMBERS_NAME . ' (' . $emails_count . ')</option>'; } $output .= '</select> </td> </tr> <tr> <td align="right" nowrap="nowrap"><label for="email">' . _EMAIL_FROM . ':</label></td> <td><span class="mandatory_star">*</span></td> <td> <input type="text" name="email_from" style="width:210px" id="email_from" value="' . decode_text($email_from) . '" maxlength="70" /> </td> </tr> <tr valign="top"> <td align="right" nowrap="nowrap"><label>' . _SUBJECT . ':</label></td> <td><span class="mandatory_star">*</span></td> <td> <input type="text" style="width:410px" name="subject" id="subject" value="' . decode_text($template_subject) . '" maxlength="255" /> </td> </tr> <tr valign="top"> <td align="right" nowrap="nowrap"><label>' . _MESSAGE . ':</label></td> <td><span class="mandatory_star">*</span></td> <td> <textarea style="width:465px;margin-right:10px;" rows="10" name="message" id="message">' . $template_content . '</textarea> </td> </tr>'; $output .= '<tr valign="middle"> <td colspan="2"></td> <td><img src="images/question_mark.png" alt="">' . _MASS_MAIL_ALERT . '</td> </tr>'; $output .= '<tr><td colspan="3" nowrap style="height:6px;"></td></tr> <tr> <td align="right" nowrap="nowrap"><a href="javascript:void(0);" onclick="appPopupWindow(\'mail_preview.html\',\'message\')">[ ' . _PREVIEW . ' ]</a></td> <td></td> <td> <div style="float:left"><input type="checkbox" class="form_checkbox" name="send_copy_to_admin" id="send_copy_to_admin" ' . ($send_copy_to_admin == '1' ? 'checked="checked"' : '') . ' value="1"> <label for="send_copy_to_admin">' . _SEND_COPY_TO_ADMIN . '</label></div> <div style="float:right"><input class="form_button" type="submit" name="btnSubmit" value="' . _SEND . '" onclick="return OnSubmit_Check();"> </div> </td> </tr> </table> </fieldset> </td> <td align="left" valign="top"> <fieldset style="padding-' . Application::Get('defined_right') . ':10px;"> <legend>' . _PREDEFINED_CONSTANTS . ':</legend> <ul> <li>{FIRST NAME} <br><span style="color:a0a0a0">' . _PC_FIRST_NAME_TEXT . '</span></li> <li>{LAST NAME} <br><span style="color:a0a0a0">' . _PC_LAST_NAME_TEXT . '</span></li> <li>{USER NAME} <br><span style="color:a0a0a0">' . _PC_USER_NAME_TEXT . '</span></li> <li>{USER EMAIL} <br><span style="color:a0a0a0">' . _PC_USER_EMAIL_TEXT . '</span></li> <li>{BASE URL} <br><span style="color:a0a0a0">' . _PC_WEB_SITE_BASED_URL_TEXT . '</span></li> <li>{WEB SITE} <br><span style="color:a0a0a0">' . _PC_WEB_SITE_URL_TEXT . '</span></li> <li>{YEAR} <br><span style="color:a0a0a0">' . _PC_YEAR_TEXT . '</span></li> </ul> </fieldset> </td> </tr> </table> </form>'; if ($draw) { echo $output; } else { return $output; } }
/** * After-Updating - update banner descriptions to description table */ public function AfterUpdateRecord() { foreach ($this->arrTranslations as $key => $val) { $sql = 'UPDATE ' . TABLE_BANNERS_DESCRIPTION . ' SET image_text = \'' . encode_text(prepare_input($val['image_text'])) . '\' WHERE banner_id = ' . $this->curRecordId . ' AND language_id = \'' . encode_text($key) . '\''; if (database_void_query($sql)) { // } else { //echo mysql_error(); } } }
function __construct() { parent::__construct(); $this->params = array(); if (isset($_POST['name'])) { $this->params['name'] = prepare_input($_POST['name']); } if (isset($_POST['symbol'])) { $this->params['symbol'] = prepare_input($_POST['symbol']); } if (isset($_POST['symbol_placement'])) { $this->params['symbol_placement'] = prepare_input($_POST['symbol_placement']); } if (isset($_POST['code'])) { $this->params['code'] = prepare_input($_POST['code']); } if (isset($_POST['rate'])) { $this->params['rate'] = prepare_input($_POST['rate']); } if (isset($_POST['decimals'])) { $this->params['decimals'] = prepare_input($_POST['decimals']); } if (isset($_POST['primary_order'])) { $this->params['primary_order'] = (int) $_POST['primary_order']; } // for checkboxes if (isset($_POST['is_default'])) { $this->params['is_default'] = (int) $_POST['is_default']; } else { $this->params['is_default'] = '0'; } if (isset($_POST['is_active'])) { $this->params['is_active'] = (int) $_POST['is_active']; } else { $this->params['is_active'] = '0'; } $this->params['language_id'] = MicroGrid::GetParameter('language_id'); $this->primaryKey = 'id'; $this->tableName = TABLE_CURRENCIES; $this->dataSet = array(); $this->error = ''; if (self::$PROJECT == 'HotelSite') { $this->formActionURL = 'index.php?admin=mod_booking_currencies'; } else { if (self::$PROJECT == 'ShoppingCart') { $this->formActionURL = 'index.php?admin=mod_catalog_currencies'; } else { if (self::$PROJECT == 'BusinessDirectory') { $this->formActionURL = 'index.php?admin=mod_payments_currencies'; } else { if (self::$PROJECT == 'MedicalAppointments') { $this->formActionURL = 'index.php?admin=mod_appointments_currencies'; } } } } $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 . '.primary_order ASC'; // ORDER BY date_created DESC $this->isAlterColorsAllowed = true; $this->isPagingAllowed = true; $this->pageSize = 20; $this->isSortingAllowed = true; $this->isFilteringAllowed = false; // define filtering fields ///$this->arrFilteringFields = array( /// 'parameter1' => array('title'=>'', 'type'=>'text', 'sign'=>'=|like%|%like|%like%', 'width'=>'80px'), /// 'parameter2' => array('title'=>'', 'type'=>'text', 'sign'=>'=|like%|%like|%like%', 'width'=>'80px'), ///); $currency_format = get_currency_format(); $arr_is_active = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>'); $arr_is_default = array('0' => '<span class=gray>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>'); $arr_decimals = array('0' => '0', '1' => '1', '2' => '2'); $arr_symbol_placement = array('left' => _LEFT, 'right' => _RIGHT); // 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 . ', name, symbol, symbol_placement, code, rate, decimals, primary_order, is_default, is_active FROM ' . $this->tableName; // define view mode fields $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'height' => '', 'maxlength' => ''), 'symbol' => array('title' => _SYMBOL, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'height' => '', 'maxlength' => ''), 'code' => array('title' => _CODE, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'height' => '', 'maxlength' => ''), 'rate' => array('title' => _RATE, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'height' => '', 'maxlength' => '', 'format' => 'currency', 'format_parameter' => $currency_format . '|4'), 'decimals' => array('title' => _DECIMALS, 'type' => 'label', 'align' => 'center', 'width' => '80px', 'height' => '', 'maxlength' => ''), 'primary_order' => array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '80px', 'height' => '', 'maxlength' => '', 'movable' => true), 'is_default' => array('title' => _DEFAULT, 'type' => 'enum', 'align' => 'center', 'width' => '80px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_default), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'align' => 'center', 'width' => '80px', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_active)); //---------------------------------------------------------------------- // ADD MODE //---------------------------------------------------------------------- // define add mode fields $this->arrAddModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'validation_type' => 'text'), 'symbol' => array('title' => _SYMBOL, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '5', 'validation_type' => 'text'), 'symbol_placement' => array('title' => _SYMBOL_PLACEMENT, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '100px', 'source' => $arr_symbol_placement), 'code' => array('title' => _CODE, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '3', 'validation_type' => 'alpha'), 'rate' => array('title' => _RATE, 'type' => 'textbox', 'width' => '80px', 'required' => true, 'readonly' => false, 'maxlength' => '10', 'validation_type' => 'float', 'validation_maximum' => '999999'), 'decimals' => array('title' => _DECIMALS, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '80px', 'source' => $arr_decimals, 'default' => '2'), 'primary_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '40px', 'required' => true, 'readonly' => false, 'maxlength' => '2', 'validation_type' => 'numeric'), 'is_default' => array('title' => _DEFAULT, 'type' => 'checkbox', 'readonly' => false, 'default' => '0', 'true_value' => '1', 'false_value' => '0'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0')); //---------------------------------------------------------------------- // EDIT MODE //---------------------------------------------------------------------- $this->EDIT_MODE_SQL = 'SELECT ' . $this->primaryKey . ', name, symbol, symbol_placement, code, rate, decimals, primary_order, is_default, is_active FROM ' . $this->tableName . ' WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_'; $rid = MicroGrid::GetParameter('rid'); $sql = 'SELECT is_default FROM ' . TABLE_CURRENCIES . ' WHERE id = ' . (int) $rid; $readonly = false; if ($result = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY)) { $readonly = isset($result['is_default']) && $result['is_default'] == '1' ? true : false; } // define edit mode fields $this->arrEditModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'validation_type' => 'text'), 'symbol' => array('title' => _SYMBOL, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '5', 'validation_type' => 'text'), 'symbol_placement' => array('title' => _SYMBOL_PLACEMENT, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '100px', 'source' => $arr_symbol_placement), 'code' => array('title' => _CODE, 'type' => 'textbox', 'width' => '50px', 'required' => true, 'readonly' => false, 'maxlength' => '3', 'validation_type' => 'alpha'), 'rate' => array('title' => _RATE, 'type' => 'textbox', 'width' => '80px', 'required' => true, 'readonly' => $readonly, 'maxlength' => '10', 'validation_type' => 'float', 'validation_maximum' => '999999'), 'decimals' => array('title' => _DECIMALS, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '80px', 'source' => $arr_decimals), 'primary_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '40px', 'required' => true, 'readonly' => false, 'maxlength' => '2', 'validation_type' => 'numeric'), 'is_default' => array('title' => _DEFAULT, 'type' => 'checkbox', 'readonly' => $readonly, 'default' => '0', 'true_value' => '1', 'false_value' => '0'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => $readonly, 'default' => '1', 'true_value' => '1', 'false_value' => '0')); //---------------------------------------------------------------------- // DETAILS MODE //---------------------------------------------------------------------- $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL; $this->arrDetailsModeFields = array('name' => array('title' => _NAME, 'type' => 'label'), 'symbol' => array('title' => _SYMBOL, 'type' => 'label'), 'symbol_placement' => array('title' => _SYMBOL_PLACEMENT, 'type' => 'label'), 'code' => array('title' => _CODE, 'type' => 'label'), 'rate' => array('title' => _RATE, 'type' => 'label', 'format' => 'currency', 'format_parameter' => $currency_format . '|4'), 'decimals' => array('title' => _DECIMALS, 'type' => 'enum', 'source' => $arr_decimals), 'primary_order' => array('title' => _ORDER, 'type' => 'label'), 'is_default' => array('title' => _DEFAULT, 'type' => 'enum', 'source' => $arr_is_default), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'source' => $arr_is_active)); }
/** * Draws comment submission form * @param $article_id * @param $image_verification * @param $focus_field * @param $task_completed * @param $draw */ private function DrawCommentsForm($article_id = '', $image_verification = 'no', $focus_field = '', $task_completed = false, $draw = true) { if (!$article_id) { return ''; } global $objLogin; $user_id = ''; $user_name = ''; $user_name = isset($_POST['comment_user_name']) && !$task_completed ? decode_text(prepare_input($_POST['comment_user_name'])) : ''; $user_email = isset($_POST['comment_user_email']) && !$task_completed ? decode_text(prepare_input($_POST['comment_user_email'])) : ''; $comment_text = isset($_POST['comment_text']) && !$task_completed ? prepare_input($_POST['comment_text']) : ''; $comment_length = ModulesSettings::Get('comments', 'comment_length'); if ($objLogin->IsLoggedInAs($this->user_type_name)) { $user_id = $objLogin->GetLoggedID(); $user_name = $objLogin->GetLoggedName(); } $output = ' <div class="comments_form_container"> <form class="comments-form" method="post" name="frmComments" id="frmComments"> ' . draw_hidden_field('task', 'publish_comment', false, 'comment_task') . ' ' . draw_hidden_field('comment_id', '', false, 'comment_id') . ' ' . draw_hidden_field('article_id', $article_id, false) . ' ' . draw_hidden_field('user_id', $user_id, false) . ' ' . draw_token_field(false) . ' <table border="0" width="98%"> <tr><td colspan="3" nowrap height="7px"></td></tr> <tr> <td colspan="3"> <b>' . _LEAVE_YOUR_COMMENT . '</b> </td> </tr> <tr> <td>'; if ($user_id == '') { $output .= _YOUR_NAME . ': <input type="text" name="comment_user_name" id="comment_user_name" style="width:140px" value="' . $user_name . '" maxlength="50" autocomplete="off" /> '; $output .= '<nobr>' . _YOUR_EMAIL . ': <input type="text" name="comment_user_email" id="comment_user_email" style="width:140px" value="' . $user_email . '" maxlength="70" autocomplete="off" /></nobr><br /><br />'; } else { $output .= draw_hidden_field('comment_user_name', $user_name, false); $output .= draw_hidden_field('comment_user_email', $user_email, false); } $output .= _COMMENT_TEXT . ':<br /> <textarea id="comment_text" name="comment_text" maxlength="' . $comment_length . '" style="width:96%" rows="5">' . stripcslashes($comment_text) . '</textarea><br /> ' . _CAN_USE_TAGS_MSG . ' <b>, <i>, <u>, <br> <br /><br />'; //'._IMAGE_VERIFICATION.':<br /> $output .= '</td> <td> </td> <td valign="top" width="180px" align="center">'; if ($image_verification == 'yes') { $output .= '<table border="0" cellspacing="0" cellpadding="0"> <tr> <td> <img style="padding:0px;margin:0px;" id="captcha_image" src="modules/captcha/securimage_show.php?sid=' . md5(uniqid(time())) . '" /> </td> <td> <img style="cursor:pointer;padding:0px;margin:0px;" id="captcha_image_reload" src="modules/captcha/images/refresh.gif" style="cursor:pointer;" onclick="document.getElementById(\'captcha_image\').src = \'modules/captcha/securimage_show.php?sid=\' + Math.random(); appSetFocus(\'frmComments_captcha_code\'); return false" title="' . _REFRESH . '" alt="' . _REFRESH . '" /><br /> <a href="modules/captcha/securimage_play.php"><img border="0" style="padding:0px; margin:0px;" id="captcha_image_play" src="modules/captcha/images/audio_icon.gif" title="' . _PLAY . '" alt="' . _PLAY . '" /></a> </td> </tr> <tr><td colspan="2" nowrap="nowrap" height="20px"></td></tr> <tr> <td colspan="2" align="center"> ' . _TYPE_CHARS . ' </td> </tr> <tr><td colspan="2" nowrap="nowrap" height="10px"></td></tr> <tr> <td colspan="2"> <input type="text" name="captcha_code" id="frmComments_captcha_code" style="width:175px" value="" maxlength="20" autocomplete="off" /> </td> </tr> </table>'; } $output .= '</td> </tr> </table> <input type="submit" ' . ($objLogin->IsLoggedInAsAdmin() ? 'disabled' : '') . ' class="form_button" name="btnSubmitPC" id="btnSubmitPC" value="' . _PUBLISH_YOUR_COMMENT . '"> </form> </div>'; if ($focus_field != '') { $output .= '<script type="text/javascript">appSetFocus("' . $focus_field . '");</script>'; } if ($draw) { echo $output; } else { return $output; } }
function __construct($inq_id, $customer_id = 0) { parent::__construct(); $this->params = array(); ## for standard fields if (isset($_POST['inquiry_id'])) { $this->params['inquiry_id'] = prepare_input($_POST['inquiry_id']); } if (isset($_POST['customer_id'])) { $this->params['customer_id'] = prepare_input($_POST['customer_id']); } if (isset($_POST['date_added'])) { $this->params['date_added'] = prepare_input($_POST['date_added']); } if (isset($_POST['message'])) { $this->params['message'] = prepare_input($_POST['message']); } ## 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 = TABLE_INQUIRIES_REPLIES; // TABLE_NAME $this->dataSet = array(); $this->error = ''; $this->formActionURL = (!empty($customer_id) ? 'index.php?customer=inquiries_reply' : 'index.php?admin=mod_inquiries_reply') . '&inq_id=' . (int) $inq_id; $this->actions = array('add' => false, 'edit' => false, 'details' => true, 'delete' => false); $this->actionIcons = true; $this->allowRefresh = true; $this->allowTopButtons = false; $this->alertOnDelete = ''; // leave empty to use default alerts $this->allowLanguages = false; $this->languageId = ''; // ($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang(); $this->WHERE_CLAUSE = 'WHERE ir.inquiry_id = ' . (int) $inq_id . (!empty($customer_id) ? ' AND customer_id = ' . (int) $customer_id : ''); $this->GROUP_BY_CLAUSE = ''; // GROUP BY '.$this->tableName.'.order_number $this->ORDER_CLAUSE = 'ORDER BY ir.date_added DESC'; $this->isAlterColorsAllowed = true; $this->isPagingAllowed = true; $this->pageSize = 20; $this->isSortingAllowed = true; $this->isExportingAllowed = false; $this->arrExportingTypes = array('csv' => false); $this->isFilteringAllowed = false; // define filtering fields $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 ir.' . $this->primaryKey . ', ir.inquiry_id, ir.customer_id, ir.message, ir.date_added, CONCAT(c.first_name, \' \', c.last_name) as customer_name FROM ' . $this->tableName . ' ir INNER JOIN ' . TABLE_CUSTOMERS . ' c ON ir.customer_id = c.id '; // define view mode fields $this->arrViewModeFields = array('customer_name' => array('title' => _CUSTOMER, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => ''), 'date_added' => array('title' => _DATE_ADDED, 'type' => 'label', 'align' => 'left', 'width' => '200px', 'header' => '', 'maxlength' => '', 'format' => 'date', 'format_parameter' => $datetime_format)); //---------------------------------------------------------------------- // 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('message' => array('title' => _MESSAGE, 'type' => 'textarea', 'width' => '510px', 'required' => true, 'readonly' => false, 'maxlength' => '2048', 'default' => '', 'height' => '200px', 'editor_type' => 'simple|wysiwyg', 'validation_type' => '', 'unique' => false, 'visible' => true), 'customer_id' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $customer_id), 'inquiry_id' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $inq_id), 'date_added' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => date('Y-m-d H:i:s'))); //---------------------------------------------------------------------- // 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 . '.inquiry_id, ' . $this->tableName . '.customer_id, ' . $this->tableName . '.message, ' . $this->tableName . '.date_added, CONCAT(c.first_name, \' \', c.last_name) as customer_name FROM ' . $this->tableName . ' INNER JOIN ' . TABLE_CUSTOMERS . ' c ON ' . $this->tableName . '.customer_id = c.id WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_'; // define edit mode fields $this->arrEditModeFields = array('customer_name' => array('title' => _CUSTOMER, 'type' => 'label', 'format' => '', 'format_parameter' => '', 'visible' => true), 'date_added' => array('title' => _DATE_ADDED, 'type' => 'date', 'required' => true, 'readonly' => true, 'unique' => false, 'visible' => true, 'default' => '', 'validation_type' => 'date', 'format' => 'date', 'format_parameter' => $datetime_format, 'min_year' => '90', 'max_year' => '10'), 'message' => array('title' => _MESSAGE, 'type' => 'textarea', 'width' => '510px', 'required' => false, 'readonly' => true, 'maxlength' => '', 'default' => '', 'height' => '200px', 'editor_type' => 'simple|wysiwyg', 'validation_type' => '', 'unique' => false, 'visible' => true)); //---------------------------------------------------------------------- // DETAILS MODE //---------------------------------------------------------------------- $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL; $this->arrDetailsModeFields = array('customer_name' => array('title' => _CUSTOMER, 'type' => 'label', 'format' => '', 'format_parameter' => '', 'visible' => true), 'date_added' => array('title' => _DATE_ADDED, 'type' => 'datetime', 'format' => 'date', 'format_parameter' => $datetime_format, 'visible' => true), 'message' => array('title' => _MESSAGE, 'type' => 'html', 'visible' => true)); /////////////////////////////////////////////////////////////////////////////// // #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) /// ) /// ); /////////////////////////////////////////////////////////////////////////////// }
<?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->IsLoggedInAsCustomer() && Modules::IsModuleInstalled('listings')) { // handle order $task = isset($_REQUEST['task']) ? prepare_input($_REQUEST['task']) : ''; $payment_type = isset($_REQUEST['payment_type']) ? prepare_input($_REQUEST['payment_type']) : ''; $msg = isset($_REQUEST['msg']) ? prepare_input($_REQUEST['msg']) : ''; $ccErrors[0] = ''; // No errors $ccErrors[1] = _CC_UNKNOWN_CARD_TYPE; $ccErrors[2] = _CC_NO_CARD_NUMBER_PROVIDED; $ccErrors[3] = _CC_CARD_INVALID_FORMAT; $ccErrors[4] = _CC_CARD_INVALID_NUMBER; $ccErrors[5] = _CC_CARD_WRONG_LENGTH; $ccErrors[6] = _CC_CARD_NO_CVV_NUMBER; $ccErrors[7] = _CC_CARD_WRONG_EXPIRE_DATE; $ccErrors[8] = _CC_CARD_HOLDER_NAME_EMPTY; $msg_text = isset($ccErrors[$msg]) ? $ccErrors[$msg] : ''; if ($payment_type == 'paypal') { $title_desc = _PAYPAL_ORDER; } else { if ($payment_type == '2co') {
function __construct() { parent::__construct(); $cid = isset($_GET['cid']) ? (int) $_GET['cid'] : '0'; $cdid = isset($_GET['cdid']) ? (int) $_GET['cdid'] : '0'; $this->params = array(); if (isset($_POST['name'])) { $this->params['name'] = prepare_input($_POST['name']); } if (isset($_POST['description'])) { $this->params['description'] = prepare_input($_POST['description']); } //$default_lang = Languages::GetDefaultLang(); // 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_CATEGORIES_DESCRIPTION; $this->dataSet = array(); $this->error = ''; $this->formActionURL = 'index.php?admin=mod_categories_description&cid=' . (int) $cid . '&cdid=' . (int) $cdid; $this->actions = array('add' => false, 'edit' => true, 'details' => true, 'delete' => false); $this->actionIcons = true; $this->allowRefresh = true; $this->isHtmlEncoding = true; $this->allowLanguages = false; $this->languageId = ''; //($this->params['language_id'] != '') ? $this->params['language_id'] : Languages::GetDefaultLang(); $this->WHERE_CLAUSE = 'WHERE ' . $this->tableName . '.category_id = \'' . $cdid . '\''; $this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.id ASC'; $this->isAlterColorsAllowed = true; $this->isPagingAllowed = false; $this->pageSize = 100; $this->isSortingAllowed = true; $this->isFilteringAllowed = false; // define filtering fields $this->arrFilteringFields = array('price' => array('title' => _CATEGORY, 'type' => 'text', 'sign' => 'like%', 'width' => '80px')); // 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->tableName . '.' . $this->primaryKey . ', ' . $this->tableName . '.category_id, ' . $this->tableName . '.language_id, ' . $this->tableName . '.name, ' . $this->tableName . '.description, ' . TABLE_LANGUAGES . '.lang_name FROM ' . $this->tableName . ' INNER JOIN ' . TABLE_CATEGORIES . ' ON ' . $this->tableName . '.category_id = ' . TABLE_CATEGORIES . '.id INNER JOIN ' . TABLE_LANGUAGES . ' ON ' . $this->tableName . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation AND ' . TABLE_LANGUAGES . '.is_active = 1 '; // define view mode fields $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '200px', 'maxlength' => ''), 'description' => array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '50'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label', 'align' => 'center', 'width' => '120px', 'maxlength' => '')); //---------------------------------------------------------------------- // ADD MODE //---------------------------------------------------------------------- // define add mode fields $this->arrAddModeFields = array(); //---------------------------------------------------------------------- // EDIT MODE //---------------------------------------------------------------------- $this->EDIT_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ', ' . $this->tableName . '.category_id, ' . $this->tableName . '.language_id, ' . $this->tableName . '.name, ' . $this->tableName . '.description, ' . TABLE_LANGUAGES . '.lang_name FROM ' . $this->tableName . ' INNER JOIN ' . TABLE_CATEGORIES . ' ON ' . $this->tableName . '.category_id = ' . TABLE_CATEGORIES . '.id INNER JOIN ' . TABLE_LANGUAGES . ' ON ' . $this->tableName . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation AND ' . TABLE_LANGUAGES . '.is_active = 1 WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_'; // define edit mode fields $this->arrEditModeFields = array('lang_name' => array('title' => _LANGUAGE, 'type' => 'label'), 'name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'default' => '', 'validation_type' => 'text', 'maxlength' => '50'), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '400px', 'height' => '100px', 'required' => false, 'readonly' => false, 'default' => '', 'validation_type' => 'text', 'validation_maxlength' => '255')); //---------------------------------------------------------------------- // DETAILS MODE //---------------------------------------------------------------------- $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL; $this->arrDetailsModeFields = array('lang_name' => array('title' => _LANGUAGE, 'type' => 'label'), 'name' => array('title' => _NAME, 'type' => 'label'), 'description' => array('title' => _DESCRIPTION, 'type' => 'label')); }
function __construct($lid) { parent::__construct(); $this->params = array(); ## for standard fields if (isset($_POST['name'])) { $this->params['name'] = prepare_input($_POST['name']); } if (isset($_POST['location_id'])) { $this->params['location_id'] = prepare_input($_POST['location_id']); } // $this->params['language_id'] = MicroGrid::GetParameter('language_id'); $this->primaryKey = 'id'; $this->tableName = TABLE_LISTINGS_SUB_LOCATIONS; $this->dataSet = array(); $this->error = ''; $this->formActionURL = 'index.php?admin=mod_listings_sub_locations&lid=' . (int) $lid; $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 location_id = ' . (int) $lid; $this->ORDER_CLAUSE = 'ORDER BY name ASC'; // ORDER BY '.$this->tableName.'.date_created DESC $this->isAlterColorsAllowed = true; $this->isPagingAllowed = true; $this->pageSize = 100; $this->isSortingAllowed = true; $this->isFilteringAllowed = true; $arr_default_types = array('0' => _NO, '1' => _YES); $arr_activity_types = array('0' => _NO, '1' => _YES); // define filtering fields $this->arrFilteringFields = array(_NAME => array('table' => $this->tableName, 'field' => 'name', 'type' => 'text', 'sign' => 'like%', 'width' => '100px')); //---------------------------------------------------------------------- // VIEW MODE //---------------------------------------------------------------------- $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ', name FROM ' . $this->tableName; // define view mode fields $this->arrViewModeFields = array('name' => array('title' => _NAME, '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('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '240px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => 'text'), 'location_id' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $lid)); //---------------------------------------------------------------------- // 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 . '.name FROM ' . $this->tableName . ' WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_'; // define edit mode fields $this->arrEditModeFields = array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '240px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => 'text'), 'location_id' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $lid)); //---------------------------------------------------------------------- // DETAILS MODE //---------------------------------------------------------------------- $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL; $this->arrDetailsModeFields = array('name' => array('title' => _NAME, 'type' => 'label')); }
/** * After-Updating - update album descriptions to description table */ public function AfterUpdateRecord() { foreach ($this->arrTranslations as $key => $val) { $sql = 'UPDATE ' . TABLE_GALLERY_ALBUMS_DESCRIPTION . ' SET name = \'' . encode_text(prepare_input($val['name'])) . '\', description = \'' . encode_text(prepare_input($val['description'])) . '\' WHERE gallery_album_id = ' . $this->curRecordId . ' AND language_id = \'' . $key . '\''; database_void_query($sql); //echo mysql_error(); } }
/** * Draw Preview mode */ public static function DrawPreview() { $preview = isset($_GET['preview']) ? prepare_input($_GET['preview']) : ''; $preview_type = isset($_GET['preview_type']) ? prepare_input($_GET['preview_type']) : ''; $page = isset($_GET['page']) ? prepare_input($_GET['page']) : 'home'; $page_id = isset($_GET['pid']) ? prepare_input($_GET['pid']) : 'home'; $output = ''; if ($preview = 'yes' && $preview_type == 'single' && $page == 'pages' && $page_id != '') { $output .= '<div style="display:block; position:absolute; top:0%; left:0%; width:100%; height:1900px; background-color:black; z-index:1001; -moz-opacity:0.05; opacity:.05; filter:alpha(opacity=5);"></div>'; $output .= '<div style="display:block; position: absolute; top: 75px; left: -225px; width: 600px; padding: 10px; font-size: 24px; text-align: center; color: rgb(255, 255, 255); font-family: \'trebuchet ms\',verdana,arial,sans-serif; -o-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -webkit-transform: rotate(-45deg); transform: rotate(-45deg); background-color: rgb(0, 0, 0); border: 1px solid rgb(170, 170, 170); z-index: 12; opacity: 0.5;">PREVIEW</div>'; } echo $output; }