本文整理匯總了PHP中Languages::GetDefaultLang方法的典型用法代碼示例。如果您正苦於以下問題:PHP Languages::GetDefaultLang方法的具體用法?PHP Languages::GetDefaultLang怎麽用?PHP Languages::GetDefaultLang使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Languages
的用法示例。
在下文中一共展示了Languages::GetDefaultLang方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
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'] = '';
}
}
示例2: __construct
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';
}
示例3: DrawOrderDescription
/**
* Draws order description
* @param $rid
*/
public function DrawOrderDescription($rid)
{
$output = '';
$oid = isset($rid) ? (int) $rid : '0';
$language_id = Languages::GetDefaultLang();
$sql = 'SELECT
' . $this->tableName . '.' . $this->primaryKey . ',
' . $this->tableName . '.order_number,
' . $this->tableName . '.order_description,
' . $this->tableName . '.order_price,
' . $this->tableName . '.vat_percent,
' . $this->tableName . '.vat_fee,
' . $this->tableName . '.total_price,
' . $this->tableName . '.additional_info,
' . $this->tableName . '.currency,
' . $this->tableName . '.advertise_plan_id,
' . $this->tableName . '.listings_amount,
' . $this->tableName . '.customer_id,
' . $this->tableName . '.cc_type,
' . $this->tableName . '.cc_holder_name,
IF(
LENGTH(AES_DECRYPT(' . $this->tableName . '.cc_number, \'' . PASSWORDS_ENCRYPT_KEY . '\')) = 4,
CONCAT(\'...\', AES_DECRYPT(' . $this->tableName . '.cc_number, \'' . PASSWORDS_ENCRYPT_KEY . '\')),
AES_DECRYPT(' . $this->tableName . '.cc_number, \'' . PASSWORDS_ENCRYPT_KEY . '\')
) as cc_number,
CONCAT(\'...\', SUBSTRING(AES_DECRYPT(cc_number, \'' . PASSWORDS_ENCRYPT_KEY . '\'), -4)) as cc_number_for_customer,
IF(
LENGTH(AES_DECRYPT(' . $this->tableName . '.cc_number, \'' . PASSWORDS_ENCRYPT_KEY . '\')) = 4,
\' (' . _CLEANED . ')\',
\'\'
) as cc_number_cleaned,
' . $this->tableName . '.cc_expires_month,
' . $this->tableName . '.cc_expires_year,
' . $this->tableName . '.cc_cvv_code,
' . $this->tableName . '.transaction_number,
' . $this->tableName . '.created_date,
' . $this->tableName . '.payment_date,
' . $this->tableName . '.payment_type,
' . $this->tableName . '.payment_method,
CASE
WHEN ' . $this->tableName . '.payment_type = 0 THEN "' . _ONLINE_ORDER . '"
WHEN ' . $this->tableName . '.payment_type = 1 THEN "' . _PAYPAL . '"
WHEN ' . $this->tableName . '.payment_type = 2 THEN "2CO"
WHEN ' . $this->tableName . '.payment_type = 3 THEN "Authorize.Net"
ELSE \'' . _UNKNOWN . '\'
END as m_payment_type,
CASE
WHEN ' . $this->tableName . '.payment_method = 0 THEN "' . _PAYMENT_COMPANY_ACCOUNT . '"
WHEN ' . $this->tableName . '.payment_method = 1 THEN "' . _CREDIT_CARD . '"
WHEN ' . $this->tableName . '.payment_method = 2 THEN "E-Check"
ELSE \'' . _UNKNOWN . '\'
END as m_payment_method,
CASE
WHEN ' . $this->tableName . '.status = 0 THEN "<span style=color:#960000>' . _PREPARING . '</span>"
WHEN ' . $this->tableName . '.status = 1 THEN "<span style=color:#FF9966>' . _PENDING . '</span>"
WHEN ' . $this->tableName . '.status = 2 THEN "<span style=color:#336699>' . _PAID . '</span>"
WHEN ' . $this->tableName . '.status = 3 THEN "<span style=color:#009600>' . _COMPLETED . '</span>"
ELSE \'' . _UNKNOWN . '\'
END as m_status,
IF(' . $this->tableName . '.status_changed = "0000-00-00 00:00:00", "", ' . $this->tableName . '.status_changed) as status_changed,
cust.user_name as customer_name,
cur.symbol,
cur.symbol_placement
FROM ' . $this->tableName . '
LEFT OUTER JOIN ' . TABLE_CURRENCIES . ' cur ON ' . $this->tableName . '.currency = cur.code
LEFT OUTER JOIN ' . TABLE_CUSTOMERS . ' cust ON ' . $this->tableName . '.customer_id = cust.id
WHERE
' . $this->tableName . '.' . $this->primaryKey . ' = ' . (int) $oid;
if ($this->customer_id != '') {
$sql .= ' AND ' . $this->tableName . '.customer_id = ' . (int) $this->customer_id;
}
//camp.campaign_name,
//camp.discount_percent
//LEFT OUTER JOIN ".TABLE_CAMPAIGNS." camp ON ".$this->tableName.".discount_campaign_id = camp.id
$result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY, FETCH_ASSOC);
$output .= '<div id="divDescriptionContent">';
if ($result[1] > 0) {
$plan_info = AdvertisePlans::GetPlanInfo($result[0]['advertise_plan_id']);
$output .= '<table width="100%" dir="' . Application::Get('lang_dir') . '" border="0">';
$output .= '<tr>
<td width="20%"><b>' . _ORDER . ' #: </b></td><td width="30%">' . $result[0]['order_number'] . '</td>
<td><b>' . _STATUS . ': </b></td><td>' . $result[0]['m_status'] . '</td>
</tr>';
$output .= '<tr>
<td><b>' . _DESCRIPTION . ': </b></td><td>' . $result[0]['order_description'] . '</td>
<td><b>' . _STATUS_CHANGED . ': </b></td><td>' . format_datetime($result[0]['status_changed']) . '</td>
</tr>';
$output .= '<tr>
<td><b>' . _ADVERTISE_PLAN . ': </b></td><td>' . (isset($plan_info[0]['plan_name']) ? $plan_info[0]['plan_name'] : '') . '</td>
<td colspan="2"></td>
</tr>';
$output .= '<tr>
<td><b>' . _LISTINGS . ': </b></td><td>' . $result[0]['listings_amount'] . '</td>
<td colspan="2"></td>
</tr>';
$output .= '<tr>
//.........這裏部分代碼省略.........
示例4: defined
<?php
/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <info@apphp.com>
* @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);
示例5: UpdateFeeds
/**
* Updates Feeds
*/
public static function UpdateFeeds()
{
global $objSettings, $objSiteDescription;
$default_lang = Languages::GetDefaultLang();
$current_rss_ids = $objSettings->GetParameter('rss_last_ids');
$rss_ids = '';
self::SetType($objSettings->GetParameter('rss_feed_type'));
self::SetChannel(APPHP_BASE . 'feeds/rss.xml', $objSiteDescription->GetParameter('header_text'), $objSiteDescription->GetParameter('tag_description'), 'en-us', '(c) copyright', $objSettings->GetParameter('admin_email'), $objSiteDescription->GetParameter('tag_description'));
self::SetImage(APPHP_BASE . 'images/icons/logo.png');
$all_news = News::GetAllNews('previous', $default_lang);
for ($i = 0; $i < $all_news[1] && $i < 10; $i++) {
$rss_ids .= ($i > 0 ? '-' : '') . $all_news[0][$i]['id'];
}
// check if there difference between RSS IDs, so we have to update RSS file
if ($current_rss_ids != $rss_ids) {
for ($i = 0; $i < $all_news[1] && $i < 10; $i++) {
$rss_text = RSSFeed::CleanTextRss(strip_tags($all_news[0][$i]['body_text']));
if (strlen($rss_text) > 512) {
$rss_text = substr_by_word($rss_text, 512) . '...';
}
#$rss_text = htmlentities($post_text, ENT_COMPAT, 'UTF-8');
self::SetItem(APPHP_BASE . 'index.php?page=news&nid=' . $all_news[0][$i]['id'], $all_news[0][$i]['header_text'], $rss_text, $all_news[0][$i]['date_created']);
}
$objSettings->UpdateFields(array('rss_last_ids' => $rss_ids));
}
return self::SaveFeed();
}
示例6: Init
public static function Init()
{
global $objLogin, $objSettings, $objSiteDescription;
self::$params['page'] = isset($_GET['page']) ? prepare_input($_GET['page']) : 'home';
self::$params['page_id'] = isset($_REQUEST['pid']) ? prepare_input_alphanumeric($_REQUEST['pid']) : 'home';
self::$params['system_page'] = isset($_GET['system_page']) ? prepare_input($_GET['system_page']) : '';
self::$params['type'] = isset($_GET['type']) ? prepare_input($_GET['type']) : '';
self::$params['admin'] = isset($_GET['admin']) ? prepare_input($_GET['admin']) : '';
self::$params['user'] = isset($_GET['user']) ? prepare_input($_GET['user']) : '';
self::$params['customer'] = isset($_GET['customer']) ? prepare_input($_GET['customer']) : '';
self::$params['patient'] = isset($_GET['patient']) ? prepare_input($_GET['patient']) : '';
self::$params['doctor'] = isset($_GET['doctor']) ? prepare_input($_GET['doctor']) : '';
self::$params['news_id'] = isset($_GET['nid']) ? (int) $_GET['nid'] : '';
self::$params['album_code'] = isset($_GET['acode']) ? strip_tags(prepare_input($_GET['acode'])) : '';
self::$params['search_in'] = isset($_POST['search_in']) ? prepare_input($_POST['search_in']) : '';
if (self::$params['search_in'] == '') {
if (self::$PROJECT == 'BusinessDirectory') {
self::$params['search_in'] = 'listings';
} else {
if (self::$PROJECT == 'ShoppingCart') {
self::$params['search_in'] = 'products';
} else {
if (self::$PROJECT == 'HotelSite') {
self::$params['search_in'] = 'rooms';
}
}
}
}
self::$params['lang'] = isset($_GET['lang']) ? prepare_input($_GET['lang']) : '';
self::$params['currency'] = isset($_GET['currency']) ? prepare_input($_GET['currency']) : '';
self::$params['token'] = isset($_GET['token']) ? prepare_input($_GET['token']) : '';
self::$params['listing_id'] = isset($_GET['lid']) ? (int) $_GET['lid'] : '';
self::$params['category_id'] = isset($_GET['cid']) ? (int) $_GET['cid'] : '';
self::$params['manufacturer_id'] = isset($_GET['mid']) ? (int) $_GET['mid'] : '';
self::$params['product_id'] = isset($_REQUEST['prodid']) ? (int) $_REQUEST['prodid'] : '';
$req_preview = isset($_GET['preview']) ? prepare_input($_GET['preview']) : '';
//------------------------------------------------------------------------------
// check and set token
$token = md5(uniqid(rand(), true));
self::$params['token'] = $token;
Session::Set('token', $token);
//------------------------------------------------------------------------------
// save last visited page
if (self::$params['allow_last_visited'] && !$objLogin->IsLoggedIn()) {
$condition = !empty(self::$params['page']) && self::$params['page'] != 'home';
if (self::$PROJECT == 'HotelSite') {
$condition = self::$params['page'] == 'booking' || self::$params['page'] == 'booking_details';
} else {
if (self::$PROJECT == 'ShoppingCart') {
$condition = self::$params['page'] == 'shopping_cart' || self::$params['page'] == 'checkout';
} else {
if (self::$PROJECT == 'MedicalAppointment') {
$condition = self::$params['page'] == 'checkout_signin';
}
}
}
if ($condition) {
Session::Set('last_visited', 'index.php?page=' . self::$params['page']);
if (self::$params['page'] == 'pages' && !empty(self::$params['page_id']) && self::$params['page_id'] != 'home') {
Session::Set('last_visited', Session::Get('last_visited') . '&pid=' . self::$params['page_id']);
} else {
if (self::$params['page'] == 'news' && !empty(self::$params['news_id'])) {
Session::Set('last_visited', Session::Get('last_visited') . '&nid=' . self::$params['news_id']);
} else {
if (self::$params['page'] == 'listing' && !empty(self::$params['listing_id'])) {
Session::Set('last_visited', Session::Get('last_visited') . '&lid=' . self::$params['listing_id']);
} else {
if (self::$params['page'] == 'category' && !empty(self::$params['category_id'])) {
Session::Set('last_visited', Session::Get('last_visited') . '&cid=' . self::$params['category_id']);
} else {
if (self::$params['page'] == 'manufacturer' && !empty(self::$params['manufacturer_id'])) {
Session::Set('last_visited', Session::Get('last_visited') . '&mid=' . self::$params['product_id']);
} else {
if (self::$params['page'] == 'product' && !empty(self::$params['product_id'])) {
Session::Set('last_visited', Session::Get('last_visited') . '&prodid=' . self::$params['product_id']);
}
}
}
}
}
}
}
}
//------------------------------------------------------------------------------
// set language
if ($objLogin->IsLoggedInAsAdmin()) {
$pref_lang = $objLogin->GetPreferredLang();
self::$params['lang'] = Languages::LanguageExists($pref_lang, false) ? $pref_lang : Languages::GetDefaultLang();
$language_info = Languages::GetLanguageInfo(self::$params['lang']);
self::$params['lang_dir'] = $language_info['lang_dir'];
self::$params['lang_name'] = $language_info['lang_name'];
self::$params['lang_name_en'] = $language_info['lang_name_en'];
self::$params['lc_time_name'] = $language_info['lc_time_name'];
} else {
if (!$objLogin->IsLoggedIn() && (self::$params['admin'] == 'login' || self::$params['admin'] == 'password_forgotten')) {
self::$params['lang'] = Languages::GetDefaultLang();
$language_info = Languages::GetLanguageInfo(self::$params['lang']);
self::$params['lang_dir'] = $language_info['lang_dir'];
self::$params['lang_name'] = $language_info['lang_name'];
self::$params['lang_name_en'] = $language_info['lang_name_en'];
//.........這裏部分代碼省略.........
示例7: __construct
function __construct($page_id = '')
{
parent::__construct();
global $objSettings;
$this->params = array();
## for standard fields
if (isset($_POST['is_published'])) {
$this->params['is_published'] = prepare_input($_POST['is_published']);
}
if (isset($_POST['date_published'])) {
$this->params['date_published'] = prepare_input($_POST['date_published']);
}
if ($page_id == 'home') {
$page_id = '';
}
## for checkboxes
//$this->params['parameter4'] = isset($_POST['parameter4']) ? $_POST['parameter4'] : '0';
## for images
//if(isset($_POST['icon'])){
// $this->params['icon'] = $_POST['icon'];
//}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
// // nothing
//}else if (self::GetParameter('action') == 'create'){
// $this->params['icon'] = '';
//}
$this->params['language_id'] = MicroGrid::GetParameter('language_id');
//$this->uPrefix = 'prefix_';
$this->primaryKey = 'id';
$this->tableName = TABLE_COMMENTS;
$this->dataSet = array();
$this->error = '';
$this->formActionURL = 'index.php?admin=mod_comments_management' . ($page_id != '' ? '&pid=' . (int) $page_id : '');
$this->actions = array('add' => false, 'edit' => true, 'details' => true, 'delete' => true);
$this->actionIcons = true;
$this->allowRefresh = true;
$this->allowLanguages = false;
$this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
$this->WHERE_CLAUSE = $page_id != '' ? 'WHERE ' . $this->tableName . '.article_id=' . $page_id : '';
$this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.is_published ASC, ' . $this->tableName . '.date_created DESC';
$this->isAlterColorsAllowed = true;
$this->isPagingAllowed = true;
$this->pageSize = 20;
$this->isSortingAllowed = true;
$this->isFilteringAllowed = true;
// define filtering fields
$this->arrFilteringFields = array(_PUBLISHED => array('table' => $this->tableName, 'field' => 'is_published', 'type' => 'dropdownlist', 'source' => array('0' => _NO, '1' => _YES), 'sign' => '=', 'width' => '90px'));
$datetime_format = get_datetime_format();
$arr_is_published = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') {
$this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i';
$this->sqlFieldDateFormat = '%b %d, %Y';
} else {
$this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i';
$this->sqlFieldDateFormat = '%d %b, %Y';
}
$this->SetLocale(Application::Get('lc_time_name'));
//----------------------------------------------------------------------
// VIEW MODE
// format: strip_tags
//----------------------------------------------------------------------
$this->VIEW_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ',
' . $this->tableName . '.article_id,
' . $this->tableName . '.user_id,
' . $this->tableName . '.user_name,
' . $this->tableName . '.user_email,
' . $this->tableName . '.comment_text,
DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_created,
CONCAT("<img src=\\"images/", IF(' . $this->tableName . '.is_published, "published_g.gif", "published_x.gif"), "\\" alt=\\"\\" />") as is_published,
' . TABLE_PAGES . '.page_title,
' . TABLE_LANGUAGES . '.lang_name
FROM ' . $this->tableName . '
LEFT OUTER JOIN ' . TABLE_PAGES . ' ON ' . $this->tableName . '.article_id = ' . TABLE_PAGES . '.id
LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
';
// define view mode fields
$this->arrViewModeFields = array('mod_date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'align' => 'left', 'width' => '160px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => ''), 'page_title' => array('title' => _ARTICLE, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '', 'format' => ''), 'is_published' => array('title' => _PUBLISHED, 'type' => 'label', 'align' => 'center', 'width' => '80px'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '', 'format' => ''), 'user_email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label', 'align' => 'center', 'width' => '130px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '32', 'format' => ''), 'user_name' => array('title' => _USERNAME, 'type' => 'label', 'align' => 'center', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '32', 'format' => ''));
//----------------------------------------------------------------------
// ADD MODE
// - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
// Validation Sub-Type: positive (for numeric and float)
// Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
// - Validation Max Length: 12, 255 ....
// Ex.: 'validation_maxlength'=>'255'
//----------------------------------------------------------------------
// define add mode fields
$this->arrAddModeFields = array();
//----------------------------------------------------------------------
// EDIT MODE
// - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
// Validation Sub-Type: positive (for numeric and float)
// Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
// - Validation Max Length: 12, 255 ....
// Ex.: 'validation_maxlength'=>'255'
//----------------------------------------------------------------------
$this->EDIT_MODE_SQL = 'SELECT
' . $this->tableName . '.' . $this->primaryKey . ',
' . $this->tableName . '.article_id,
' . $this->tableName . '.user_id,
' . $this->tableName . '.user_name,
' . $this->tableName . '.user_email,
//.........這裏部分代碼省略.........
示例8: __construct
function __construct()
{
parent::__construct();
$this->params = array();
## for standard fields
if (isset($_POST['field1'])) {
$this->params['field1'] = prepare_input($_POST['field1']);
}
if (isset($_POST['field2'])) {
$this->params['field2'] = prepare_input($_POST['field2']);
}
if (isset($_POST['field3'])) {
$this->params['field3'] = prepare_input($_POST['field3']);
}
## for checkboxes
//$this->params['field4'] = isset($_POST['field4']) ? prepare_input($_POST['field4']) : '0';
## for images (not necessary)
//if(isset($_POST['icon'])){
// $this->params['icon'] = prepare_input($_POST['icon']);
//}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
// // nothing
//}else if (self::GetParameter('action') == 'create'){
// $this->params['icon'] = '';
//}
## for files:
// define nothing
$this->params['language_id'] = MicroGrid::GetParameter('language_id');
//$this->uPrefix = 'prefix_';
$this->primaryKey = 'id';
$this->tableName = DB_PREFIX . 'table';
// TABLE_NAME
$this->dataSet = array();
$this->error = '';
$this->formActionURL = 'index.php?admin=page_name';
$this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
$this->actionIcons = true;
$this->allowRefresh = true;
$this->allowTopButtons = false;
$this->alertOnDelete = '';
// leave empty to use default alerts
$this->allowLanguages = true;
$this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
$this->WHERE_CLAUSE = '';
// WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
$this->GROUP_BY_CLAUSE = '';
// GROUP BY '.$this->tableName.'.order_number
$this->ORDER_CLAUSE = '';
// ORDER BY '.$this->tableName.'.date_created DESC
$this->isAlterColorsAllowed = true;
$this->isPagingAllowed = true;
$this->pageSize = 20;
$this->isSortingAllowed = true;
// exporting settings
$this->isExportingAllowed = false;
$this->arrExportingTypes = array('csv' => false);
// define filtering fields
$this->isFilteringAllowed = false;
$this->arrFilteringFields = array();
///$this->isAggregateAllowed = false;
///// define aggregate fields for View Mode
///$this->arrAggregateFields = array(
/// 'field1' => array('function'=>'SUM', 'align'=>'center', 'aggregate_by'=>'', 'decimal_place'=>2),
/// 'field2' => array('function'=>'AVG', 'align'=>'center', 'aggregate_by'=>'', 'decimal_place'=>2),
///);
///$date_format = get_date_format('view');
///$date_format_settings = get_date_format('view', true); /* to get pure settings format */
///$date_format_edit = get_date_format('edit');
///$datetime_format = get_datetime_format();
///$time_format = get_time_format(); /* by default 1st param - shows seconds */
///$currency_format = get_currency_format();
// prepare languages array
/// $total_languages = Languages::GetAllActive();
/// $arr_languages = array();
/// foreach($total_languages[0] as $key => $val){
/// $arr_languages[$val['abbreviation']] = $val['lang_name'];
/// }
///////////////////////////////////////////////////////////////////////////////
// #002. prepare translation fields array
/// $this->arrTranslations = $this->PrepareTranslateFields(
/// array('field1', 'field2')
/// );
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// #003. prepare translations array for add/edit/detail modes
/// REMEMBER! to add '.$sql_translation_description.' in EDIT_MODE_SQL
/// $sql_translation_description = $this->PrepareTranslateSql(
/// TABLE_XXX_DESCRIPTION,
/// 'gallery_album_id',
/// array('field1', 'field2')
/// );
///////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------
// VIEW MODE
// format: strip_tags, nl2br, readonly_text
// format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A'
// format: 'format'=>'currency', 'format_parameter'=>'european|2' or 'format_parameter'=>'american|4'
//----------------------------------------------------------------------
$this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
field1,
field2,
//.........這裏部分代碼省略.........
示例9: defined
/**
* @project ApPHP Business Directory
* @copyright (c) 2012 ApPHP
* @author ApPHP <info@apphp.com>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAsAdmin()) {
$submition_type = isset($_POST['submition_type']) ? prepare_input($_POST['submition_type']) : '';
$site_template = isset($_POST['site_template']) ? prepare_input($_POST['site_template']) : '';
$cron_type = isset($_POST['cron_type']) ? prepare_input($_POST['cron_type']) : $objSettings->GetParameter('cron_type');
$http_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : _UNKNOWN;
$language_id = isset($_POST['sel_language_id']) ? prepare_input($_POST['sel_language_id']) : Languages::GetDefaultLang();
$msg = '';
$focus_on_field = '';
$objSiteDescription->LoadData($language_id);
$params = array();
$params['seo_urls'] = isset($_POST['seo_urls']) ? prepare_input($_POST['seo_urls']) : $objSettings->GetParameter('seo_urls');
$params['rss_feed'] = isset($_POST['rss_feed']) ? prepare_input($_POST['rss_feed']) : $objSettings->GetParameter('rss_feed');
$params['rss_feed_type'] = isset($_POST['rss_feed_type']) ? prepare_input($_POST['rss_feed_type']) : $objSettings->GetParameter('rss_feed_type');
$params['is_offline'] = isset($_POST['is_offline']) ? prepare_input($_POST['is_offline']) : $objSettings->GetParameter('is_offline');
$params['offline_message'] = isset($_POST['offline_message']) ? prepare_input($_POST['offline_message']) : $objSettings->GetParameter('offline_message');
$params['caching_allowed'] = isset($_POST['caching_allowed']) ? prepare_input($_POST['caching_allowed']) : $objSettings->GetParameter('caching_allowed');
$params['cache_lifetime'] = isset($_POST['cache_lifetime']) ? prepare_input($_POST['cache_lifetime']) : $objSettings->GetParameter('cache_lifetime');
$params['wysiwyg_type'] = isset($_POST['wysiwyg_type']) ? prepare_input($_POST['wysiwyg_type']) : $objSettings->GetParameter('wysiwyg_type');
$params_tab2a = array();
$params_tab2a['header_text'] = isset($_POST['header_text']) ? strip_tags(prepare_input($_POST['header_text'], false, 'medium'), '<b><u><i>') : $objSiteDescription->GetParameter('header_text');
$params_tab2a['slogan_text'] = isset($_POST['slogan_text']) ? prepare_input($_POST['slogan_text']) : $objSiteDescription->GetParameter('slogan_text');
示例10: __construct
function __construct()
{
parent::__construct();
global $objSettings;
$this->params = array();
if (isset($_POST['news_code'])) {
$this->params['news_code'] = prepare_input($_POST['news_code']);
}
if (isset($_POST['header_text'])) {
$this->params['header_text'] = prepare_input($_POST['header_text']);
}
if (isset($_POST['body_text'])) {
$this->params['body_text'] = prepare_input($_POST['body_text'], false, 'medium');
}
if (isset($_POST['type'])) {
$this->params['type'] = prepare_input($_POST['type']);
}
if (isset($_POST['date_created'])) {
$this->params['date_created'] = prepare_input($_POST['date_created']);
}
$this->params['language_id'] = MicroGrid::GetParameter('language_id');
$this->isHtmlEncoding = true;
$this->primaryKey = 'id';
$this->tableName = TABLE_NEWS;
$this->dataSet = array();
$this->error = '';
$this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
$this->formActionURL = 'index.php?admin=mod_news_management';
$this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
$this->actionIcons = true;
$this->allowRefresh = true;
$this->allowLanguages = true;
$this->WHERE_CLAUSE = 'WHERE language_id = \'' . $this->languageId . '\'';
$this->ORDER_CLAUSE = 'ORDER BY date_created DESC';
$this->isAlterColorsAllowed = true;
$this->isPagingAllowed = true;
$this->pageSize = 20;
$this->isSortingAllowed = true;
// prepare languages array
$total_languages = Languages::GetAllActive();
$arr_languages = array();
foreach ($total_languages[0] as $key => $val) {
$arr_languages[$val['abbreviation']] = $val['lang_name'];
}
$arr_types = array('news' => _NEWS, 'events' => _EVENTS);
$datetime_format = get_datetime_format();
if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') {
$this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i';
$this->sqlFieldDateFormat = '%b %d, %Y';
} else {
$this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i';
$this->sqlFieldDateFormat = '%d %b, %Y';
}
$this->SetLocale(Application::Get('lc_time_name'));
//----------------------------------------------------------------------
// VIEW MODE
//----------------------------------------------------------------------
$this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
type,
header_text,
body_text,
DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_created,
CASE
WHEN type = "events" THEN
CONCAT("<a href=javascript:void(0) onclick=javascript:__mgDoPostBack(\'' . $this->tableName . '\',\'details\',\'", ' . $this->primaryKey . ', "\')>events",
" (", (SELECT COUNT(*) as cnt FROM ' . TABLE_EVENTS_REGISTERED . ' er WHERE er.event_id = ' . $this->tableName . '.' . $this->primaryKey . '), ")</a>")
ELSE type
END as type_link
FROM ' . $this->tableName;
// define view mode fields
$this->arrViewModeFields = array('mod_date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'align' => 'left', 'width' => '190px', 'format' => 'date', 'format_parameter' => $datetime_format), 'header_text' => array('title' => _HEADER, 'type' => 'label', 'align' => 'left', 'width' => '', 'nowrap' => 'wrap', 'maxlength' => '90'), 'type_link' => array('title' => _TYPE, 'type' => 'label', 'align' => 'center', 'width' => '9%'));
//----------------------------------------------------------------------
// ADD MODE
//----------------------------------------------------------------------
// define add mode fields
$this->arrAddModeFields = array('header_text' => array('title' => _HEADER, 'type' => 'textbox', 'required' => true, 'width' => '410px', 'maxlength' => '255'), 'body_text' => array('title' => _TEXT, 'type' => 'textarea', 'width' => '490px', 'height' => '200px', 'editor_type' => 'wysiwyg', 'readonly' => false, 'default' => '', 'required' => true, 'validation_type' => '', 'unique' => false, 'maxlength' => '4096', 'validation_maxlength' => '4096'), 'type' => array('title' => _TYPE, 'type' => 'enum', 'source' => $arr_types, 'required' => true, 'default' => 'news'), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'datetime', 'required' => true, 'readonly' => false, 'default' => @date('Y-m-d H:i:s'), 'validation_type' => '', 'unique' => false, 'visible' => true, 'format' => 'date', 'format_parameter' => $datetime_format, 'min_year' => '10', 'max_year' => '5'), 'language_id' => array('title' => _LANGUAGE, 'type' => 'enum', 'source' => $arr_languages, 'required' => true), 'news_code' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => get_random_string(10)));
//----------------------------------------------------------------------
// EDIT MODE
//----------------------------------------------------------------------
$this->EDIT_MODE_SQL = 'SELECT
' . $this->tableName . '.' . $this->primaryKey . ',
' . $this->tableName . '.type,
' . $this->tableName . '.header_text,
' . $this->tableName . '.body_text,
' . $this->tableName . '.language_id,
' . $this->tableName . '.date_created,
DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_created,
' . TABLE_LANGUAGES . '.lang_name as language_name
FROM ' . $this->tableName . '
INNER JOIN ' . TABLE_LANGUAGES . ' ON ' . $this->tableName . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
// define edit mode fields
$this->arrEditModeFields = array('header_text' => array('title' => _HEADER, 'type' => 'textbox', 'required' => true, 'width' => '410px', 'maxlength' => '255'), 'body_text' => array('title' => _TEXT, 'type' => 'textarea', 'width' => '490px', 'height' => '200px', 'editor_type' => 'wysiwyg', 'readonly' => false, 'default' => '', 'required' => true, 'validation_type' => '', 'unique' => false, 'maxlength' => '4096', 'validation_maxlength' => '4096'), 'type' => array('title' => _TYPE, 'type' => 'enum', 'source' => $arr_types, 'required' => true), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'datetime', 'required' => true, 'readonly' => false, 'unique' => false, 'visible' => true, 'format' => 'date', 'format_parameter' => $datetime_format, 'min_year' => '10', 'max_year' => '5'), 'language_id' => array('title' => _LANGUAGE, 'type' => 'enum', 'source' => $arr_languages, 'required' => true, 'readonly' => true));
//----------------------------------------------------------------------
// DETAILS MODE
//----------------------------------------------------------------------
$this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
$this->arrDetailsModeFields = array('header_text' => array('title' => _HEADER, 'type' => 'label'), 'body_text' => array('title' => _TEXT, 'type' => 'html'), 'type' => array('title' => _TYPE, 'type' => 'label'), 'mod_date_created' => array('title' => _DATE_CREATED, 'type' => 'label'), 'language_name' => array('title' => _LANGUAGE, 'type' => 'label'));
}
示例11: defined
<?php
/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <info@apphp.com>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
$type = isset($_GET['type']) ? prepare_input($_GET['type']) : '';
if ($objLogin->IsLoggedInAsAdmin() && ($objLogin->HasPrivileges('add_pages') || $objLogin->HasPrivileges('edit_pages') || $objLogin->HasPrivileges('delete_pages'))) {
$action = MicroGrid::GetParameter('action');
$rid = MicroGrid::GetParameter('rid');
$language_id = MicroGrid::GetParameter('language_id') != '' ? MicroGrid::GetParameter('language_id') : Languages::GetDefaultLang();
$act = MicroGrid::GetParameter('act', false);
$pid = MicroGrid::GetParameter('pid', false);
$po = MicroGrid::GetParameter('po', false);
$dir = MicroGrid::GetParameter('dir', false);
$mode = 'view';
$msg = '';
$objPages = new PagesGrid(Application::Get('type'), array('add' => $objLogin->HasPrivileges('add_pages'), 'edit' => $objLogin->HasPrivileges('edit_pages'), 'details' => true, 'delete' => $objLogin->HasPrivileges('delete_pages')));
if ($action == 'add') {
$mode = 'add';
} else {
if ($action == 'create') {
if ($objPages->AddRecord()) {
$msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
$mode = 'view';
} else {
示例12: __construct
function __construct($page_id = '', $is_active = false, $lang_id = '')
{
$this->focusOnField = 'page_title';
$lang = $lang_id != '' ? $lang_id : Application::Get('lang');
if ($page_id == 'home' || $page_id == 'public_home') {
$this->languageId = $lang != '' ? $lang : Languages::GetDefaultLang();
} else {
$this->languageId = isset($_REQUEST['language_id']) && $_REQUEST['language_id'] != '' ? prepare_input($_REQUEST['language_id']) : Languages::GetDefaultLang();
}
if ($page_id != '') {
if ($page_id == 'home' || $page_id == 'public_home') {
$sql_home = 'SELECT
' . TABLE_PAGES . '.*,
' . TABLE_LANGUAGES . '.lang_name as language_name
FROM ' . TABLE_PAGES . '
LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
WHERE
' . TABLE_PAGES . '.is_home = 1 AND
' . TABLE_PAGES . '.language_id = \'' . $this->languageId . '\'';
$this->page = database_query($sql_home, DATA_ONLY, FIRST_ROW_ONLY);
if (empty($this->page)) {
$page_code = get_random_string(10);
// create Home Page
$sql = 'INSERT INTO ' . TABLE_PAGES . '(
id, page_code, language_id, content_type,
link_url, link_target, page_key, page_title, page_text,
menu_id, menu_link, tag_title, tag_keywords, tag_description,
comments_allowed, show_in_search, date_created, date_updated, finish_publishing,
is_home, is_removed, is_published, is_system_page, system_page,
status_changed, access_level, priority_order
)VALUES(
NULL, \'' . $page_code . '\', \'' . $this->languageId . '\', \'article\',
\'\', \'\', \'\', \'Home\', \'\',
0, \'\', \'\', \'\', \'\',
0, 1, \'0000-00-00 00:00:00\', \'0000-00-00 00:00:00\', \'0000-00-00 00:00:00\',
1, 0, 0, 0, \'\',
\'0000-00-00 00:00:00\', \'public\', 0
)';
if (database_void_query($sql)) {
$this->page = database_query($sql_home, DATA_ONLY, FIRST_ROW_ONLY);
// update home pages code
$sql_update = 'UPDATE ' . TABLE_PAGES . ' SET page_code = \'' . $page_code . '\' WHERE is_home = 1';
database_void_query($sql_update);
}
}
} else {
if ($page_id != '' && !is_numeric($page_id)) {
$sql_home = 'SELECT
' . TABLE_PAGES . '.*,
' . TABLE_LANGUAGES . '.lang_name as language_name
FROM ' . TABLE_PAGES . '
LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
WHERE
' . TABLE_PAGES . '.is_system_page = 1 AND
' . TABLE_LANGUAGES . '.abbreviation = \'' . $lang . '\' AND
' . TABLE_PAGES . '.system_page = \'' . $page_id . '\' AND
' . TABLE_PAGES . '.is_published = 1 ';
$this->page = database_query($sql_home, DATA_ONLY, FIRST_ROW_ONLY);
} else {
$sql = 'SELECT
' . TABLE_PAGES . '.*,
' . TABLE_LANGUAGES . '.lang_name as language_name,
' . TABLE_MENUS . '.access_level as menu_access_level
FROM ' . TABLE_PAGES . '
LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
LEFT OUTER JOIN ' . TABLE_MENUS . ' ON ' . TABLE_PAGES . '.menu_id = ' . TABLE_MENUS . '.id
WHERE
' . TABLE_PAGES . '.id = \'' . (int) $page_id . '\'';
if ($is_active) {
$sql .= ' AND ' . TABLE_PAGES . '.is_removed = 0 ';
$sql .= ' AND ' . TABLE_PAGES . '.is_published = 1 ';
}
$this->page = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY);
}
}
if (empty($this->page)) {
$this->page_id = '';
} else {
$this->page_id = $page_id;
}
} else {
$this->page_id = $page_id;
$this->page['id'] = '';
$this->page['page_code'] = '';
$this->page['language_id'] = '';
$this->page['content_type'] = 'article';
$this->page['link_url'] = '';
$this->page['link_target'] = '';
$this->page['page_key'] = '';
$this->page['page_title'] = '';
$this->page['page_text'] = '';
$this->page['menu_id'] = '0';
$this->page['menu_link'] = '';
$this->page['tag_title'] = '';
$this->page['tag_keywords'] = '';
$this->page['tag_description'] = '';
$this->page['comments_allowed'] = '0';
$this->page['date_created'] = '';
$this->page['date_updated'] = '';
$this->page['finish_publishing'] = '';
//.........這裏部分代碼省略.........
示例13: __construct
function __construct()
{
parent::__construct();
$this->params = array();
## for standard fields
if (isset($_POST['ban_item'])) {
$this->params['ban_item'] = prepare_input($_POST['ban_item']);
}
if (isset($_POST['ban_reason'])) {
$this->params['ban_reason'] = prepare_input($_POST['ban_reason']);
}
$item_validation_type = '';
if (isset($_POST['ban_item_type'])) {
$this->params['ban_item_type'] = prepare_input($_POST['ban_item_type']);
if ($this->params['ban_item_type'] == 'IP') {
$item_validation_type = 'ip_address';
} else {
if ($this->params['ban_item_type'] == 'Email') {
$item_validation_type = 'email';
}
}
}
## for checkboxes
//if(isset($_POST['parameter4'])) $this->params['parameter4'] = $_POST['parameter4']; else $this->params['parameter4'] = '0';
## for images
//if(isset($_POST['icon'])){
// $this->params['icon'] = $_POST['icon'];
//}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
// // nothing
//}else if (self::GetParameter('action') == 'create'){
// $this->params['icon'] = '';
//}
$this->params['language_id'] = MicroGrid::GetParameter('language_id');
$this->primaryKey = 'id';
$this->tableName = TABLE_BANLIST;
$this->dataSet = array();
$this->error = '';
$this->formActionURL = 'index.php?admin=ban_list';
$this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
$this->actionIcons = true;
$this->allowRefresh = true;
$this->allowLanguages = false;
$this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
$this->WHERE_CLAUSE = '';
// WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
$this->ORDER_CLAUSE = '';
// ORDER BY '.$this->tableName.'.date_created DESC
$this->isAlterColorsAllowed = true;
$this->isPagingAllowed = true;
$this->pageSize = 20;
$this->isSortingAllowed = true;
$this->isFilteringAllowed = true;
$arr_ban_types = array('IP' => _IP_ADDRESS, 'Email' => _EMAIL_ADDRESS);
// define filtering fields
$this->arrFilteringFields = array(_TYPE => array('table' => $this->tableName, 'field' => 'ban_item_type', 'type' => 'dropdownlist', 'source' => $arr_ban_types, 'sign' => '=', 'width' => '130px'));
// prepare languages array
/// $total_languages = Languages::GetAllActive();
/// $arr_languages = array();
/// foreach($total_languages[0] as $key => $val){
/// $arr_languages[$val['abbreviation']] = $val['lang_name'];
/// }
//----------------------------------------------------------------------
// VIEW MODE
//----------------------------------------------------------------------
$this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
ban_item,
CASE
WHEN ban_item_type = \'IP\' THEN \'' . _IP_ADDRESS . '\'
WHEN ban_item_type = \'Email\' THEN \'' . _EMAIL_ADDRESS . '\'
ELSE \'' . _UNKNOWN . '\'
END ban_item_type,
ban_reason
FROM ' . $this->tableName;
// define view mode fields
$this->arrViewModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'label', 'align' => 'left', 'width' => '170px', 'height' => '', 'maxlength' => ''), 'ban_item_type' => array('title' => _TYPE, 'type' => 'label', 'align' => 'left', 'width' => '150px', 'height' => '', 'maxlength' => ''), 'ban_reason' => array('title' => _REASON, 'type' => 'label', 'align' => 'left', 'width' => '', 'height' => '', 'maxlength' => ''));
//----------------------------------------------------------------------
// ADD MODE
// Validation Type: alpha|numeric|float|alpha_numeric|text|email
// Validation Sub-Type: positive (for numeric and float)
// Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
//----------------------------------------------------------------------
// define add mode fields
$this->arrAddModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'unique' => true, 'maxlength' => '70', 'default' => '', 'validation_type' => $item_validation_type), 'ban_item_type' => array('title' => _TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '130px', 'source' => $arr_ban_types), 'ban_reason' => array('title' => _REASON, 'type' => 'textarea', 'width' => '310px', 'height' => '90px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false, 'default' => 'Spam from this IP/Email', 'validation_type' => ''));
//----------------------------------------------------------------------
// EDIT MODE
// Validation Type: alpha|numeric|float|alpha_numeric|text|email
// Validation Sub-Type: positive (for numeric and float)
// Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
//----------------------------------------------------------------------
$this->EDIT_MODE_SQL = 'SELECT
' . $this->tableName . '.' . $this->primaryKey . ',
' . $this->tableName . '.ban_item,
' . $this->tableName . '.ban_item_type,
' . $this->tableName . '.ban_reason
FROM ' . $this->tableName . '
WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
// define edit mode fields
$this->arrEditModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'unique' => true, 'maxlength' => '70', 'default' => '', 'validation_type' => $item_validation_type), 'ban_item_type' => array('title' => _TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '130px', 'source' => $arr_ban_types), 'ban_reason' => array('title' => _REASON, 'type' => 'textarea', 'width' => '310px', 'height' => '90px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false, 'default' => 'Spam from this IP/Email', 'validation_type' => ''));
//----------------------------------------------------------------------
// DETAILS MODE
//.........這裏部分代碼省略.........
示例14: GetAllExistingCategories
/**
* Returns all existing categories
*/
public function GetAllExistingCategories()
{
$lang = Languages::GetDefaultLang();
$sql = 'SELECT c.id,
c.icon,
c.listings_count,
c.listings_count_public,
c.priority_order,
cd.language_id,
cd.name,
cd.description
FROM ' . TABLE_CATEGORIES . ' c
LEFT OUTER JOIN ' . TABLE_CATEGORIES_DESCRIPTION . ' cd ON c.id = cd.category_id
WHERE
c.parent_id = _CAT_ID_ AND
cd.language_id = \'' . $lang . '\'
ORDER BY priority_order ASC';
$sql_1 = str_replace('_CAT_ID_', '0', $sql);
$result = database_query($sql_1, DATA_AND_ROWS, ALL_ROWS, FETCH_ASSOC);
$output = array();
if ($result[1] > 0) {
for ($i = 0; $i < $result[1]; $i++) {
$output[$result[0][$i]['id']] = array('id' => $result[0][$i]['id'], 'name' => $result[0][$i]['name'], 'parent_name' => '', 'level' => '1');
$sql_2 = str_replace('_CAT_ID_', (int) $result[0][$i]['id'], $sql);
$result_2 = database_query($sql_2, DATA_AND_ROWS, ALL_ROWS, FETCH_ASSOC);
for ($j = 0; $j < $result_2[1]; $j++) {
$output[$result_2[0][$j]['id']] = array('id' => $result_2[0][$j]['id'], 'name' => $result_2[0][$j]['name'], 'parent_name' => $result[0][$i]['name'], 'level' => '2');
$sql_3 = str_replace('_CAT_ID_', (int) $result_2[0][$j]['id'], $sql);
$result_3 = database_query($sql_3, DATA_AND_ROWS, ALL_ROWS, FETCH_ASSOC);
for ($k = 0; $k < $result_3[1]; $k++) {
$output[$result_3[0][$k]['id']] = array('id' => $result_3[0][$k]['id'], 'name' => $result_3[0][$k]['name'], 'parent_name' => $result_2[0][$j]['name'], 'level' => '3');
}
}
}
}
#echo '<pre>';
#print_r($output);
#echo '</pre>';
return $output;
}
示例15: defined
/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <info@apphp.com>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAsAdmin() && $objLogin->HasPrivileges('add_pages')) {
if (isset($_REQUEST['language_id'])) {
$language_id = prepare_input($_REQUEST['language_id']);
$objSiteDescription->LoadData($language_id);
} else {
$language_id = Languages::GetDefaultLang();
}
$wysiwyg_dir = Languages::GetLanguageDirection($language_id);
$objPage = new Pages();
$link_target = isset($_POST['link_target']) ? prepare_input($_POST['link_target']) : '_self';
$tag_title = isset($_POST['tag_title']) ? prepare_input($_POST['tag_title']) : $objSiteDescription->GetParameter('tag_title');
$tag_keywords = isset($_POST['tag_keywords']) ? prepare_input($_POST['tag_keywords']) : $objSiteDescription->GetParameter('tag_keywords');
$tag_description = isset($_POST['tag_description']) ? prepare_input($_POST['tag_description']) : $objSiteDescription->GetParameter('tag_description');
$meta_tags_status = isset($_POST['meta_tags_status']) ? prepare_input($_POST['meta_tags_status']) : 'closed';
$copy_to_other_langs = isset($_POST['copy_to_other_langs']) ? prepare_input($_POST['copy_to_other_langs']) : 'yes';
$access_level = isset($_POST['access_level']) ? prepare_input($_POST['access_level']) : '0';
$show_in_search = isset($_POST['show_in_search']) ? prepare_input($_POST['show_in_search']) : '1';
$priority_order = isset($_POST['priority_order']) ? (int) $_POST['priority_order'] : $objPage->GetMaxOrder($language_id) + 1;
$finish_publishing = isset($_POST['finish_publishing']) && check_date($_POST['finish_publishing']) ? prepare_input($_POST['finish_publishing']) : _NEVER;
$is_published = isset($_POST['is_published']) ? prepare_input($_POST['is_published']) : '1';
$submit = isset($_POST['subSavePage']) ? prepare_input($_POST['subSavePage']) : '';