コード例 #1
0
ファイル: Listings.class.php プロジェクト: mozdial/Directory
 /**
  * Before Edit mode
  */
 public function BeforeEditRecord()
 {
     // prepare array for sub-location
     $listing_location_id = MicroGrid::GetParameter('listing_location_id', false);
     if (empty($listing_location_id)) {
         $listing_location_id = (int) $this->result[0][0]['listing_location_id'];
     }
     $total_sub_locations = ListingsSubLocations::GetAllSubLocations($listing_location_id, 'name ASC');
     $arr_sub_locations = array();
     foreach ($total_sub_locations[0] as $key => $val) {
         $arr_sub_locations[$val['id']] = $val['name'];
     }
     $this->arrEditModeFields['separator_general']['listing_sub_location_id'] = array('title' => _SUB_LOCATION, 'type' => 'enum', 'width' => '', 'source' => $arr_sub_locations, 'required' => true);
 }
コード例 #2
0
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['field1'])) {
            $this->params['field1'] = prepare_input($_POST['field1']);
        }
        if (isset($_POST['field2'])) {
            $this->params['field2'] = prepare_input($_POST['field2']);
        }
        if (isset($_POST['field3'])) {
            $this->params['field3'] = prepare_input($_POST['field3']);
        }
        ## for checkboxes
        //$this->params['field4'] = isset($_POST['field4']) ? prepare_input($_POST['field4']) : '0';
        ## for images (not necessary)
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = prepare_input($_POST['icon']);
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        ## for files:
        // define nothing
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = DB_PREFIX . 'table';
        // TABLE_NAME
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=page_name';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = false;
        $this->alertOnDelete = '';
        // leave empty to use default alerts
        $this->allowLanguages = true;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->GROUP_BY_CLAUSE = '';
        // GROUP BY '.$this->tableName.'.order_number
        $this->ORDER_CLAUSE = '';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        // exporting settings
        $this->isExportingAllowed = false;
        $this->arrExportingTypes = array('csv' => false);
        // define filtering fields
        $this->isFilteringAllowed = false;
        $this->arrFilteringFields = array();
        ///$this->isAggregateAllowed = false;
        ///// define aggregate fields for View Mode
        ///$this->arrAggregateFields = array(
        ///	'field1' => array('function'=>'SUM', 'align'=>'center', 'aggregate_by'=>'', 'decimal_place'=>2),
        ///	'field2' => array('function'=>'AVG', 'align'=>'center', 'aggregate_by'=>'', 'decimal_place'=>2),
        ///);
        ///$date_format = get_date_format('view');
        ///$date_format_settings = get_date_format('view', true); /* to get pure settings format */
        ///$date_format_edit = get_date_format('edit');
        ///$datetime_format = get_datetime_format();
        ///$time_format = get_time_format(); /* by default 1st param - shows seconds */
        ///$currency_format = get_currency_format();
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        ///////////////////////////////////////////////////////////////////////////////
        // #002. prepare translation fields array
        /// $this->arrTranslations = $this->PrepareTranslateFields(
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        // #003. prepare translations array for add/edit/detail modes
        /// REMEMBER! to add '.$sql_translation_description.' in EDIT_MODE_SQL
        /// $sql_translation_description = $this->PrepareTranslateSql(
        ///	TABLE_XXX_DESCRIPTION,
        ///	'gallery_album_id',
        ///	array('field1', 'field2')
        /// );
        ///////////////////////////////////////////////////////////////////////////////
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags, nl2br, readonly_text
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A'
        // format: 'format'=>'currency', 'format_parameter'=>'european|2' or 'format_parameter'=>'american|4'
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									field1,
									field2,
									field3
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array();
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Min Length: 4, 6... Ex.: 'validation_minlength'=>'4'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        // - for editable passwords they must be defined directly in SQL : '.$this->tableName.'.user_password,
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.field1,
								' . $this->tableName . '.field2,
								' . '
								' . $this->tableName . '.field3
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array();
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array();
        ///////////////////////////////////////////////////////////////////////////////
        // #004. add translation fields to all modes
        /// $this->AddTranslateToModes(
        /// $this->arrTranslations,
        /// array('name'        => array('title'=>_NAME, 'type'=>'textbox', 'width'=>'410px', 'required'=>true, 'maxlength'=>'', 'readonly'=>false),
        /// 	  'description' => array('title'=>_DESCRIPTION, 'type'=>'textarea', 'width'=>'410px', 'height'=>'90px', 'required'=>false, 'maxlength'=>'', 'maxlength'=>'512', 'validation_maxlength'=>'512', 'readonly'=>false)
        /// )
        /// );
        ///////////////////////////////////////////////////////////////////////////////
    }
コード例 #3
0
ファイル: Countries.class.php プロジェクト: mozdial/Directory
 /**
  * After-Updating Record
  */
 public function AfterUpdateRecord()
 {
     $sql = 'SELECT id, is_active, is_default FROM ' . TABLE_COUNTRIES;
     if ($result = database_query($sql, DATA_AND_ROWS, ALL_ROWS)) {
         if ((int) $result[1] == 1) {
             // make last country always be default
             $sql = 'UPDATE ' . TABLE_COUNTRIES . ' SET is_default = \'1\', is_active = \'1\' WHERE id = ' . (int) $result[0][0]['id'];
             database_void_query($sql);
             return true;
         } else {
             // save all other countries to be not default
             $rid = MicroGrid::GetParameter('rid');
             $is_default = MicroGrid::GetParameter('is_default', false);
             if ($is_default == '1') {
                 $sql = 'UPDATE ' . TABLE_COUNTRIES . ' SET is_active = \'1\'  WHERE id = ' . (int) $rid;
                 database_void_query($sql);
                 $sql = 'UPDATE ' . TABLE_COUNTRIES . ' SET is_default = \'0\' WHERE id != ' . (int) $rid;
                 database_void_query($sql);
                 return true;
             }
         }
     }
     return true;
 }
コード例 #4
0
    /**
     *	'After'-operation methods
     */
    public function AfterInsertRecord()
    {
        // clone to other languages ---
        $total_languages = Languages::GetAllActive();
        $language_id = MicroGrid::GetParameter('language_id');
        $template_code = MicroGrid::GetParameter('template_code', false);
        $template_name = MicroGrid::GetParameter('template_name', false);
        $template_subject = MicroGrid::GetParameter('template_subject', false);
        $template_content = MicroGrid::GetParameter('template_content', false);
        $is_system_template = MicroGrid::GetParameter('is_system_template', false);
        for ($i = 0; $i < $total_languages[1]; $i++) {
            if ($language_id != '' && $total_languages[0][$i]['abbreviation'] != $language_id) {
                $sql = 'INSERT INTO ' . TABLE_EMAIL_TEMPLATES . ' (
							id,
							language_id,
							template_code,
							template_name,
							template_subject,
							template_content,
							is_system_template
						) VALUES (
							NULL,
							\'' . encode_text($total_languages[0][$i]['abbreviation']) . '\',
							\'' . encode_text($template_code) . '\',
							\'' . encode_text($template_name) . '\',
							\'' . encode_text($template_subject) . '\',
							\'' . encode_text($template_content) . '\',
							' . (int) $is_system_template . '
						)';
                database_void_query($sql);
                $this->SetSQLs('insert_lan_' . $total_languages[0][$i]['abbreviation'], $sql);
            }
        }
    }
コード例 #5
0
<?php

/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAsAdmin() && Modules::IsModuleInstalled('gallery')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $album = MicroGrid::GetParameter('album', false);
    $mode = 'view';
    $msg = '';
    $objAlbums = new GalleryAlbums();
    $album_info = $objAlbums->GetAlbumInfo($album);
    if (count($album_info) > 0) {
        $objAlbumItems = new GalleryAlbumItems();
        if ($action == 'add') {
            $mode = 'add';
        } else {
            if ($action == 'create') {
                if ($objAlbumItems->AddRecord()) {
                    $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                    $mode = 'view';
                } else {
                    $msg = draw_important_message($objAlbumItems->error, false);
                    $mode = 'add';
コード例 #6
0
ファイル: Orders.class.php プロジェクト: mozdial/Directory
 /**
  *	Before-Deleting record
  */
 public function BeforeDeleteRecord()
 {
     // update products count field
     $oid = MicroGrid::GetParameter('rid');
     $sql = 'SELECT order_number, status, customer_id, advertise_plan_id, listings_amount FROM ' . TABLE_ORDERS . ' WHERE id = ' . (int) $oid;
     $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY, FETCH_ASSOC);
     if ($result[1] > 0) {
         $this->order_number = $result[0]['order_number'];
         $this->order_status = $result[0]['status'];
         $this->order_customer_id = $result[0]['customer_id'];
         $this->order_listings = $result[0]['listings_amount'];
         $this->order_advertise_plan_id = $result[0]['advertise_plan_id'];
         return true;
     }
     return false;
 }
コード例 #7
0
<?php

/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAs('owner', 'mainadmin') && Modules::IsModuleInstalled('customers')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $email = MicroGrid::GetParameter('email', false);
    $mode = 'view';
    $msg = '';
    $objCustomers = new Customers();
    if ($action == 'add') {
        $mode = 'add';
    } else {
        if ($action == 'create') {
            if ($objCustomers->AddRecord()) {
                $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                $mode = 'view';
            } else {
                $msg = draw_important_message($objCustomers->error, false);
                $mode = 'add';
            }
        } else {
            if ($action == 'edit') {
コード例 #8
0
ファイル: News.class.php プロジェクト: mozdial/Directory
    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'));
    }
コード例 #9
0
ファイル: inquiries_reply.php プロジェクト: mozdial/Directory
<?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('inquiries')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $act = MicroGrid::GetParameter('act', false);
    $mode = 'view';
    $msg = '';
    $inq_id = isset($_GET['inq_id']) ? (int) $_GET['inq_id'] : '0';
    $customer_id = $objLogin->GetLoggedID();
    $objInquiries = Inquiries::Instance();
    if ($objInquiries->CustomerRelatedToInquire($inq_id)) {
        $objInquiriesReplies = new InquiriesReplies($inq_id, $customer_id);
        if ($act == 'add') {
            $customer_replies = !empty($customer_id) ? InquiriesReplies::GetInquiryRepliesForCustomer($inq_id, $customer_id) : 0;
            $inquiry_info = $objInquiries->GetInfoByID($inq_id);
            $is_active = isset($inquiry_info['is_active']) ? $inquiry_info['is_active'] : 0;
            $add_mode = $is_active && !empty($customer_id) && !$customer_replies ? true : false;
            if ($add_mode) {
                $action = 'add';
                $objInquiriesReplies->SetActions(array('add' => $add_mode));
            }
コード例 #10
0
ファイル: Roles.class.php プロジェクト: mozdial/Directory
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['name'])) {
            $this->params['name'] = prepare_input($_POST['name']);
        }
        if (isset($_POST['description'])) {
            $this->params['description'] = prepare_input($_POST['description']);
        }
        ## 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_ROLES;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=roles_management';
        $this->actions = array('add' => false, 'edit' => true, '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 .... / '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->isExportingAllowed = false;
        $this->arrExportingTypes = array('csv' => false);
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        ///$date_format = get_date_format('view');
        ///$date_format_edit = get_date_format('edit');
        ///$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'];
        /// }
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        // format: nl2br
        // 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 . ',
									name,
									description,
									"[ ' . _PRIVILEGES . ' ]" as link_privileges
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '20%', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '32', 'format' => '', 'format_parameter' => ''), 'description' => array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '100', 'format' => '', 'format_parameter' => ''), 'link_privileges' => array('title' => '', 'type' => 'link', 'align' => 'left', 'width' => '90px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => '', 'href' => 'index.php?admin=role_privileges_management&role_id={id}', 'target' => ''));
        //----------------------------------------------------------------------
        // 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('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'maxlength' => '50', 'default' => '', 'validation_type' => 'text', 'unique' => true, 'visible' => true), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '310px', 'required' => false, 'height' => '90px', 'editor_type' => 'simple', 'readonly' => false, 'default' => '', 'validation_type' => 'text', 'maxlength' => '255', 'validation_maxlength' => '255', 'unique' => false));
        //----------------------------------------------------------------------
        // 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'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.name,
								' . $this->tableName . '.description
							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', 'unique' => true, 'visible' => true), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '310px', 'required' => false, 'height' => '90px', 'editor_type' => 'simple', 'readonly' => false, 'default' => '', 'validation_type' => 'text', 'maxlength' => '255', 'validation_maxlength' => '255', 'unique' => false));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('name' => array('title' => _NAME, 'type' => 'label'), 'description' => array('title' => _DESCRIPTION, 'type' => 'label'));
    }
コード例 #11
0
ファイル: pages.php プロジェクト: mozdial/Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
$type = isset($_GET['type']) ? prepare_input($_GET['type']) : '';
if ($objLogin->IsLoggedInAsAdmin() && ($objLogin->HasPrivileges('add_pages') || $objLogin->HasPrivileges('edit_pages') || $objLogin->HasPrivileges('delete_pages'))) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $language_id = MicroGrid::GetParameter('language_id') != '' ? MicroGrid::GetParameter('language_id') : Languages::GetDefaultLang();
    $act = MicroGrid::GetParameter('act', false);
    $pid = MicroGrid::GetParameter('pid', false);
    $po = MicroGrid::GetParameter('po', false);
    $dir = MicroGrid::GetParameter('dir', false);
    $mode = 'view';
    $msg = '';
    $objPages = new PagesGrid(Application::Get('type'), array('add' => $objLogin->HasPrivileges('add_pages'), 'edit' => $objLogin->HasPrivileges('edit_pages'), 'details' => true, 'delete' => $objLogin->HasPrivileges('delete_pages')));
    if ($action == 'add') {
        $mode = 'add';
    } else {
        if ($action == 'create') {
            if ($objPages->AddRecord()) {
                $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                $mode = 'view';
            } else {
                $msg = draw_important_message($objPages->error, false);
                $mode = 'add';
            }
        } else {
コード例 #12
0
ファイル: BanList.class.php プロジェクト: mozdial/Directory
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        ## for standard fields
        if (isset($_POST['ban_item'])) {
            $this->params['ban_item'] = prepare_input($_POST['ban_item']);
        }
        if (isset($_POST['ban_reason'])) {
            $this->params['ban_reason'] = prepare_input($_POST['ban_reason']);
        }
        $item_validation_type = '';
        if (isset($_POST['ban_item_type'])) {
            $this->params['ban_item_type'] = prepare_input($_POST['ban_item_type']);
            if ($this->params['ban_item_type'] == 'IP') {
                $item_validation_type = 'ip_address';
            } else {
                if ($this->params['ban_item_type'] == 'Email') {
                    $item_validation_type = 'email';
                }
            }
        }
        ## for checkboxes
        //if(isset($_POST['parameter4']))   $this->params['parameter4'] = $_POST['parameter4']; else $this->params['parameter4'] = '0';
        ## for images
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = $_POST['icon'];
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_BANLIST;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=ban_list';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = '';
        // ORDER BY '.$this->tableName.'.date_created DESC
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        $arr_ban_types = array('IP' => _IP_ADDRESS, 'Email' => _EMAIL_ADDRESS);
        // define filtering fields
        $this->arrFilteringFields = array(_TYPE => array('table' => $this->tableName, 'field' => 'ban_item_type', 'type' => 'dropdownlist', 'source' => $arr_ban_types, 'sign' => '=', 'width' => '130px'));
        // prepare languages array
        /// $total_languages = Languages::GetAllActive();
        /// $arr_languages      = array();
        /// foreach($total_languages[0] as $key => $val){
        /// 	$arr_languages[$val['abbreviation']] = $val['lang_name'];
        /// }
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									ban_item,
									CASE
										WHEN ban_item_type = \'IP\' THEN \'' . _IP_ADDRESS . '\'
										WHEN ban_item_type = \'Email\' THEN \'' . _EMAIL_ADDRESS . '\'
										ELSE \'' . _UNKNOWN . '\'
									END ban_item_type,
									ban_reason
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'label', 'align' => 'left', 'width' => '170px', 'height' => '', 'maxlength' => ''), 'ban_item_type' => array('title' => _TYPE, 'type' => 'label', 'align' => 'left', 'width' => '150px', 'height' => '', 'maxlength' => ''), 'ban_reason' => array('title' => _REASON, 'type' => 'label', 'align' => 'left', 'width' => '', 'height' => '', 'maxlength' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'unique' => true, 'maxlength' => '70', 'default' => '', 'validation_type' => $item_validation_type), 'ban_item_type' => array('title' => _TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '130px', 'source' => $arr_ban_types), 'ban_reason' => array('title' => _REASON, 'type' => 'textarea', 'width' => '310px', 'height' => '90px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false, 'default' => 'Spam from this IP/Email', 'validation_type' => ''));
        //----------------------------------------------------------------------
        // EDIT MODE
        // Validation Type: alpha|numeric|float|alpha_numeric|text|email
        // Validation Sub-Type: positive (for numeric and float)
        // Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.ban_item,
								' . $this->tableName . '.ban_item_type,
								' . $this->tableName . '.ban_reason
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'readonly' => false, 'unique' => true, 'maxlength' => '70', 'default' => '', 'validation_type' => $item_validation_type), 'ban_item_type' => array('title' => _TYPE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '130px', 'source' => $arr_ban_types), 'ban_reason' => array('title' => _REASON, 'type' => 'textarea', 'width' => '310px', 'height' => '90px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false, 'default' => 'Spam from this IP/Email', 'validation_type' => ''));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('ban_item' => array('title' => _BAN_ITEM, 'type' => 'label'), 'ban_item_type' => array('title' => _TYPE, 'type' => 'label'), 'ban_reason' => array('title' => _REASON, 'type' => 'label'));
    }
コード例 #13
0
<?php

// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if (@$objLogin->IsLoggedInAsAdmin() && Modules::IsModuleInstalled('payments')) {
    $action = MicroGrid::GetParameter('action');
    $title_action = $action;
    $rid = MicroGrid::GetParameter('rid');
    $order_status = MicroGrid::GetParameter('status', false);
    $order_number = MicroGrid::GetParameter('order_number', false);
    $customer_id = MicroGrid::GetParameter('customer_id', false);
    $units_updated = MicroGrid::GetParameter('units_updated', false);
    $mode = 'view';
    $msg = '';
    $links = '';
    $objOrders = new Orders();
    if ($action == 'add') {
        $mode = 'add';
    } else {
        if ($action == 'create') {
            if ($objOrders->AddRecord()) {
                $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                $mode = 'view';
            } else {
                $msg = draw_important_message($objOrders->error, false);
                $mode = 'add';
            }
        } else {
            if ($action == 'edit') {
                $mode = 'edit';
コード例 #14
0
    function __construct()
    {
        parent::__construct();
        global $objLogin;
        $album = MicroGrid::GetParameter('album', false);
        $objAlbums = new GalleryAlbums();
        $album_info = $objAlbums->GetAlbumInfo($album);
        $this->params = array();
        if (isset($_POST['album_code'])) {
            $this->params['album_code'] = prepare_input($_POST['album_code']);
        }
        if (isset($_POST['priority_order'])) {
            $this->params['priority_order'] = prepare_input($_POST['priority_order']);
        }
        if (isset($_POST['is_active'])) {
            $this->params['is_active'] = prepare_input($_POST['is_active']);
        } else {
            $this->params['is_active'] = '0';
        }
        if ($album_info[0]['album_type'] == 'video') {
            if (isset($_POST['item_file'])) {
                $this->params['item_file'] = prepare_input($_POST['item_file']);
                if ($this->params['item_file'] != '' && !preg_match('/^http:\\/\\/i/', $this->params['item_file'])) {
                    $this->params['item_file'] = 'http://' . $this->params['item_file'];
                }
            }
            if (isset($_POST['item_file_thumb'])) {
                $this->params['item_file_thumb'] = prepare_input($_POST['item_file_thumb'], false, 'medium');
            }
        }
        ///$this->params['language_id'] 	= MicroGrid::GetParameter('language_id');
        $icon_width = ModulesSettings::Get('gallery', 'album_icon_width') != '' ? ModulesSettings::Get('gallery', 'album_icon_width') : '120px';
        $icon_height = ModulesSettings::Get('gallery', 'album_icon_height') != '' ? ModulesSettings::Get('gallery', 'album_icon_height') : '90px';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_GALLERY_ALBUM_ITEMS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_gallery_upload_items&album=' . $album;
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = true;
        $this->allowLanguages = false;
        $this->languageId = $objLogin->GetPreferredLang();
        $this->WHERE_CLAUSE = 'WHERE album_code = \'' . $album . '\'';
        $this->ORDER_CLAUSE = 'ORDER BY priority_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();
        ///////////////////////////////////////////////////////////////////////////////
        // 1. prepare translation fields array
        $this->arrTranslations = $this->PrepareTranslateFields(array('name', 'description'));
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        // 2. prepare translations array for edit/detail modes
        $sql_translation_description = $this->PrepareTranslateSql(TABLE_GALLERY_ALBUM_ITEMS_DESCRIPTION, 'gallery_album_item_id', array('name', 'description'));
        ///////////////////////////////////////////////////////////////////////////////
        $arr_is_active = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        $help_tooltip = '<br><img src=\'' . APPHP_BASE . 'images/question_mark.png\' alt=\'\' /> Ex.: http://www.youtube.com/watch?v=5VIV8nt2KkU - or - http://localhost/{your site}/my_video.wmv';
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT
									gi.' . $this->primaryKey . ',
									gi.album_code,
									gi.item_file,
									gi.item_file_thumb,
									gi.priority_order,
									gi.is_active,
									gid.name,
									gid.description
								FROM (' . $this->tableName . ' gi	
									LEFT OUTER JOIN ' . TABLE_GALLERY_ALBUM_ITEMS_DESCRIPTION . ' gid ON gi.id = gid.gallery_album_item_id AND gid.language_id = \'' . $this->languageId . '\')';
        // define view mode fields
        if ($album_info[0]['album_type'] == 'video') {
            $this->arrViewModeFields['name'] = array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '20%', 'maxlength' => '30');
            $this->arrViewModeFields['item_file'] = array('title' => _VIDEO, 'type' => 'label', 'align' => 'left', 'width' => '40%');
        } else {
            $this->arrViewModeFields['item_file_thumb'] = array('title' => _IMAGE, 'type' => 'image', 'align' => 'left', 'width' => '60px', 'sortable' => false, 'nowrap' => '', 'visible' => '', 'image_width' => '50px', 'image_height' => '30px', 'target' => 'images/gallery/', 'no_image' => 'no_image.png');
            $this->arrViewModeFields['name'] = array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '20%', 'maxlength' => '30');
        }
        $this->arrViewModeFields['description'] = array('title' => _DESCRIPTION, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '60');
        $this->arrViewModeFields['priority_order'] = array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '10%', 'movable' => true);
        $this->arrViewModeFields['is_active'] = array('title' => _ACTIVE, 'type' => 'enum', 'align' => 'center', 'width' => '10%', 'sortable' => true, 'nowrap' => '', 'visible' => true, 'source' => $arr_is_active);
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '60px', 'maxlength' => '3', 'required' => true, 'readonly' => false, 'validation_type' => 'numeric'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0'), 'album_code' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $album)));
        if ($album_info[0]['album_type'] == 'video') {
            $this->arrAddModeFields['separator_general']['item_file'] = array('title' => _VIDEO . ' (http://)', 'type' => 'textbox', 'width' => '370px', 'maxlength' => '255', 'required' => false, 'readonly' => false, 'validation_type' => '', 'post_html' => $help_tooltip);
            $this->arrAddModeFields['separator_general']['item_file_thumb'] = array('title' => _THUMBNAIL . ' (http://)', 'type' => 'textbox', 'width' => '370px', 'maxlength' => '255', 'required' => false, 'readonly' => false, 'validation_type' => '');
        } else {
            $this->arrAddModeFields['separator_general']['item_file'] = array('title' => _IMAGE, 'type' => 'image', 'width' => '210px', 'required' => true, 'readonly' => false, 'target' => 'images/gallery/', 'thumbnail_create' => true, 'thumbnail_field' => 'item_file_thumb', 'thumbnail_width' => $icon_width, 'thumbnail_height' => $icon_height, 'file_maxsize' => '900k');
        }
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->primaryKey . ',
								album_code,
								item_file,
								item_file_thumb,
								priority_order,
								' . $sql_translation_description . '
								is_active
							FROM ' . $this->tableName . '
							WHERE ' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'priority_order' => array('title' => _ORDER, 'type' => 'textbox', 'width' => '60px', 'maxlength' => '3', 'required' => true, 'readonly' => false, 'validation_type' => 'numeric'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'true_value' => '1', 'false_value' => '0'), 'album_code' => array('title' => '', 'type' => 'hidden', 'required' => true, 'readonly' => false, 'default' => $album)));
        if ($album_info[0]['album_type'] == 'video') {
            $this->arrEditModeFields['separator_general']['item_file'] = array('title' => _VIDEO . ' (http://) ', 'type' => 'textbox', 'width' => '370px', 'maxlength' => '255', 'required' => false, 'readonly' => false, 'validation_type' => '', 'post_html' => $help_tooltip);
            $this->arrEditModeFields['separator_general']['item_file_thumb'] = array('title' => _THUMBNAIL . ' (http://)', 'type' => 'textbox', 'width' => '370px', 'maxlength' => '255', 'required' => false, 'readonly' => false, 'validation_type' => '');
        } else {
            $this->arrEditModeFields['separator_general']['item_file'] = array('title' => _IMAGE, 'type' => 'image', 'width' => '210px', 'required' => true, 'readonly' => false, 'target' => 'images/gallery/', 'thumbnail_create' => true, 'thumbnail_field' => 'item_file_thumb', 'thumbnail_width' => $icon_width, 'thumbnail_height' => $icon_height, 'file_maxsize' => '900k');
        }
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('separator_general' => array('separator_info' => array('legend' => _GENERAL), 'priority_order' => array('title' => _ORDER, 'type' => 'label'), 'is_active' => array('title' => _ACTIVE, 'type' => 'enum', 'source' => $arr_is_active)));
        if ($album_info[0]['album_type'] == 'video') {
            $this->arrDetailsModeFields['separator_general']['item_file'] = array('title' => _VIDEO, 'type' => 'object', 'width' => '240px', 'height' => '200px');
            $this->arrDetailsModeFields['separator_general']['item_file_thumb'] = array('title' => _THUMBNAIL, 'type' => 'label');
        } else {
            $this->arrDetailsModeFields['separator_general']['item_file'] = array('title' => _IMAGE, 'type' => 'image', 'target' => 'images/gallery/', 'no_image' => 'no_image.png');
        }
        ///////////////////////////////////////////////////////////////////////////////
        // 3. add translation fields to all modes
        $this->AddTranslateToModes($this->arrTranslations, array('name' => array('title' => _NAME, 'type' => 'textbox', 'width' => '410px', 'required' => false, 'maxlength' => '125', 'readonly' => false), 'description' => array('title' => _DESCRIPTION, 'type' => 'textarea', 'width' => '410px', 'height' => '70px', 'required' => false, 'maxlength' => '255', 'validation_maxlength' => '255', 'readonly' => false)));
        ///////////////////////////////////////////////////////////////////////////////
    }
コード例 #15
0
ファイル: Comments.class.php プロジェクト: mozdial/Directory
    function __construct($page_id = '')
    {
        parent::__construct();
        global $objSettings;
        $this->params = array();
        ## for standard fields
        if (isset($_POST['is_published'])) {
            $this->params['is_published'] = prepare_input($_POST['is_published']);
        }
        if (isset($_POST['date_published'])) {
            $this->params['date_published'] = prepare_input($_POST['date_published']);
        }
        if ($page_id == 'home') {
            $page_id = '';
        }
        ## for checkboxes
        //$this->params['parameter4'] = isset($_POST['parameter4']) ? $_POST['parameter4'] : '0';
        ## for images
        //if(isset($_POST['icon'])){
        //	$this->params['icon'] = $_POST['icon'];
        //}else if(isset($_FILES['icon']['name']) && $_FILES['icon']['name'] != ''){
        //	// nothing
        //}else if (self::GetParameter('action') == 'create'){
        //	$this->params['icon'] = '';
        //}
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        //$this->uPrefix 		= 'prefix_';
        $this->primaryKey = 'id';
        $this->tableName = TABLE_COMMENTS;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=mod_comments_management' . ($page_id != '' ? '&pid=' . (int) $page_id : '');
        $this->actions = array('add' => false, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = $page_id != '' ? 'WHERE ' . $this->tableName . '.article_id=' . $page_id : '';
        $this->ORDER_CLAUSE = 'ORDER BY ' . $this->tableName . '.is_published ASC, ' . $this->tableName . '.date_created DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = true;
        // define filtering fields
        $this->arrFilteringFields = array(_PUBLISHED => array('table' => $this->tableName, 'field' => 'is_published', 'type' => 'dropdownlist', 'source' => array('0' => _NO, '1' => _YES), 'sign' => '=', 'width' => '90px'));
        $datetime_format = get_datetime_format();
        $arr_is_published = array('0' => '<span class=no>' . _NO . '</span>', '1' => '<span class=yes>' . _YES . '</span>');
        if ($objSettings->GetParameter('date_format') == 'mm/dd/yyyy') {
            $this->sqlFieldDatetimeFormat = '%b %d, %Y %H:%i';
            $this->sqlFieldDateFormat = '%b %d, %Y';
        } else {
            $this->sqlFieldDatetimeFormat = '%d %b, %Y %H:%i';
            $this->sqlFieldDateFormat = '%d %b, %Y';
        }
        $this->SetLocale(Application::Get('lc_time_name'));
        //----------------------------------------------------------------------
        // VIEW MODE
        // format: strip_tags
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ',
									' . $this->tableName . '.article_id,
									' . $this->tableName . '.user_id,
									' . $this->tableName . '.user_name,
									' . $this->tableName . '.user_email,
									' . $this->tableName . '.comment_text,									
									DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as mod_date_created,
									CONCAT("<img src=\\"images/", IF(' . $this->tableName . '.is_published, "published_g.gif", "published_x.gif"), "\\" alt=\\"\\" />") as is_published,
									' . TABLE_PAGES . '.page_title,
									' . TABLE_LANGUAGES . '.lang_name
								FROM ' . $this->tableName . '
									LEFT OUTER JOIN ' . TABLE_PAGES . ' ON ' . $this->tableName . '.article_id = ' . TABLE_PAGES . '.id
									LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
								';
        // define view mode fields
        $this->arrViewModeFields = array('mod_date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'align' => 'left', 'width' => '160px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => ''), 'page_title' => array('title' => _ARTICLE, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '', 'format' => ''), 'is_published' => array('title' => _PUBLISHED, 'type' => 'label', 'align' => 'center', 'width' => '80px'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '', 'format' => ''), 'user_email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label', 'align' => 'center', 'width' => '130px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '32', 'format' => ''), 'user_name' => array('title' => _USERNAME, 'type' => 'label', 'align' => 'center', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'height' => '', 'maxlength' => '32', 'format' => ''));
        //----------------------------------------------------------------------
        // ADD MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        // 	 Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255 ....
        //   Ex.: 'validation_maxlength'=>'255'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.article_id,
								' . $this->tableName . '.user_id,
								' . $this->tableName . '.user_name,
								' . $this->tableName . '.user_email,
								' . $this->tableName . '.comment_text,
								' . $this->tableName . '.is_published,
								DATE_FORMAT(' . $this->tableName . '.date_created, \'' . $this->sqlFieldDatetimeFormat . '\') as date_created,
								' . $this->tableName . '.date_published,
								IF(' . $this->tableName . '.date_published = "0000-00-00 00:00:00", "", DATE_FORMAT(' . $this->tableName . '.date_published, \'' . $this->sqlFieldDatetimeFormat . '\')) as m_date_published,
								' . TABLE_PAGES . '.page_title,
								' . TABLE_LANGUAGES . '.lang_name
							FROM ' . $this->tableName . '
								LEFT OUTER JOIN ' . TABLE_PAGES . ' ON ' . $this->tableName . '.article_id = ' . TABLE_PAGES . '.id
								LEFT OUTER JOIN ' . TABLE_LANGUAGES . ' ON ' . TABLE_PAGES . '.language_id = ' . TABLE_LANGUAGES . '.abbreviation
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('page_title' => array('title' => _ARTICLE, 'type' => 'label'), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'user_email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label'), 'comment_text' => array('title' => _TEXT, 'type' => 'label'), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'date_published' => array('title' => '', 'type' => 'hidden', 'required' => false, 'default' => date('Y-m-d H:i:s')), 'm_date_published' => array('title' => _DATE_PUBLISHED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'is_published' => array('title' => _APPROVE, 'type' => 'enum', 'width' => '80px', 'required' => true, 'readonly' => false, 'source' => array('1' => _YES), 'unique' => false));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array('page_title' => array('title' => _ARTICLE, 'type' => 'label'), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'user_email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label'), 'lang_name' => array('title' => _LANGUAGE, 'type' => 'label'), 'comment_text' => array('title' => _TEXT, 'type' => 'label', 'format' => 'nl2br'), 'is_published' => array('title' => _APPROVED, 'type' => 'enum', 'source' => $arr_is_published), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'm_date_published' => array('title' => _DATE_PUBLISHED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format));
    }
コード例 #16
0
    /**
     *	Before-Delete operations
     */
    public function BeforeDeleteRecord()
    {
        $rid = MicroGrid::GetParameter('rid');
        $sql = 'SELECT
					lc.id,
					lc.category_id,
					lc.listing_id,
					l.is_published,
					l.access_level
				FROM ' . TABLE_LISTINGS_CATEGORIES . ' lc
					INNER JOIN ' . TABLE_LISTINGS . ' l ON lc.listing_id = l.id
				WHERE lc.id = ' . (int) $rid;
        $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY);
        if ($result[1] > 0) {
            $this->selectedCategoryId = $result[0]['category_id'];
            $this->isPublished = $result[0]['is_published'];
            $this->accessLevel = $result[0]['access_level'];
        }
        return true;
    }
コード例 #17
0
<?php

/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAs('owner')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $role_id = MicroGrid::GetParameter('role_id', false);
    $mode = 'view';
    $msg = '';
    $objRoles = new Roles();
    $role_info = $objRoles->GetInfoByID($role_id);
    $role_info_name = isset($role_info['name']) ? $role_info['name'] : '';
    if (count($role_info) > 0) {
        $objRolePrivileges = new RolePrivileges($role_id);
        if ($action == 'add') {
            $mode = 'add';
        } else {
            if ($action == 'create') {
                if ($objRolePrivileges->AddRecord()) {
                    $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                    $mode = 'view';
                } else {
                    $msg = draw_important_message($objRolePrivileges->error, false);
コード例 #18
0
<?php

/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAs('owner', 'mainadmin') && Modules::IsModuleInstalled('faq')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $fcid = MicroGrid::GetParameter('fcid', false);
    $mode = 'view';
    $msg = '';
    $objFaqCategories = new FaqCategories();
    $faq_info = $objFaqCategories->GetInfoById($fcid);
    if (count($faq_info) > 0) {
        $objFaqCategoryItems = new FaqCategoryItems($fcid);
        if ($action == 'add') {
            $mode = 'add';
        } else {
            if ($action == 'create') {
                if ($objFaqCategoryItems->AddRecord()) {
                    $msg .= draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                    $mode = 'view';
                } else {
                    $msg = draw_important_message($objFaqCategoryItems->error, false);
                    $mode = 'add';
コード例 #19
0
 /**
  * After-deleting function
  */
 public function AfterDeleteRecord()
 {
     // delete from categories description table
     $cid = MicroGrid::GetParameter('rid');
     $sql = 'DELETE FROM ' . TABLE_CATEGORIES_DESCRIPTION . ' WHERE category_id = ' . (int) $cid;
     if (!database_void_query($sql)) {
         /* echo 'error!'; */
     }
     $sql = 'DELETE FROM ' . TABLE_LISTINGS_CATEGORIES . ' WHERE category_id = ' . (int) $cid;
     if (!database_void_query($sql)) {
         /* echo 'error!'; */
     }
 }
コード例 #20
0
ファイル: Modules.class.php プロジェクト: mozdial/Directory
    function __construct($id = '')
    {
        parent::__construct();
        //////////////////////////////////////////////////////////////////
        $this->id = $id;
        if ($this->id != '') {
            $sql = 'SELECT
						id, name, name_const, description_const, icon_file, module_tables, dependent_modules, is_installed, is_system, priority_order, settings_access_by
					FROM ' . TABLE_MODULES . '
					WHERE id = \'' . intval($this->id) . '\'';
            $this->modules = database_query($sql, DATA_AND_ROWS, ALL_ROWS);
        } else {
            $this->modules = $this->GetAllModules();
        }
        $this->modulesCount = $this->modules[1];
        //////////////////////////////////////////////////////////////////
        $this->params = array();
        ## for standard fields
        if (isset($_POST['is_installed'])) {
            $this->params['is_installed'] = prepare_input($_POST['is_installed']);
        }
        ## 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_MODULES;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=modules';
        $this->actions = array('add' => true, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = false;
        $this->languageId = '';
        //
        $this->WHERE_CLAUSE = '';
        // WHERE .... / 'WHERE language_id = \''.$this->languageId.'\'';
        $this->ORDER_CLAUSE = 'ORDER BY is_system DESC, priority_order DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = false;
        // define filtering fields
        $this->arrFilteringFields = array();
        $arr_installed = array('0' => _NO, '1' => _YES);
        $arr_system = array('0' => _NO, '1' => _YES);
        // 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
        // format: strip_tags
        // format: nl2br
        // format: 'format'=>'date', 'format_parameter'=>'M d, Y, g:i A' + IF(date_created = '0000-00-00 00:00:00', '', date_created) as date_created,
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->primaryKey . ',
									CONCAT(UCASE(SUBSTRING(name, 1, 1)),LCASE(SUBSTRING(name, 2))) as mod_name,
									icon_file,
									name_const,
									description_const, 
									module_tables,
									dependent_modules,
									CASE
										WHEN is_installed = 1 THEN \'success_sign.gif\'
										ELSE \'error_sign.gif\'								
									END as mod_is_installed,
									CASE
										WHEN is_system = 1 THEN \'success_sign.gif\'
										ELSE \'error_sign.gif\'								
									END as mod_is_system
								FROM ' . $this->tableName;
        // define view mode fields
        $this->arrViewModeFields = array('icon_file' => array('title' => _IMAGE, 'type' => 'image', 'align' => 'left', 'width' => '60px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'image_width' => '42px', 'image_height' => '42px', 'target' => 'images/modules_icons/', 'no_image' => 'no_image.png'), 'mod_name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'tooltip' => '', 'maxlength' => '', 'format' => '', 'format_parameter' => ''), 'mod_is_installed' => array('title' => _STATUS, 'type' => 'image', 'align' => 'center', 'width' => '120px', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'image_width' => '16px', 'image_height' => '16px', 'target' => 'images/', 'no_image' => 'error_sign.gif'));
        //----------------------------------------------------------------------
        // 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 Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        // - Validation Type: alpha|numeric|float|alpha_numeric|text|email|ip_address|password|date
        //   Validation Sub-Type: positive (for numeric and float)
        //   Ex.: 'validation_type'=>'numeric', 'validation_type'=>'numeric|positive'
        // - Validation Max Length: 12, 255... Ex.: 'validation_maxlength'=>'255'
        // - Validation Max Value: 12, 255... Ex.: 'validation_maximum'=>'99.99'
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								CONCAT(UCASE(REPLACE(' . $this->tableName . '.name,"_"," "))) as mod_name,
								' . $this->tableName . '.name,								        
								' . $this->tableName . '.name_const,
								' . $this->tableName . '.description_const, 								
								' . $this->tableName . '.icon_file,
								' . $this->tableName . '.module_tables,
								' . $this->tableName . '.dependent_modules,
								' . $this->tableName . '.is_installed,
								' . $this->tableName . '.is_system,
								"1" as truncate_tables,
								IF(' . TABLE_VOCABULARY . '.key_text IS NOT NULL, ' . TABLE_VOCABULARY . '.key_text, "") as mod_description
							FROM ' . $this->tableName . '
								LEFT OUTER JOIN ' . TABLE_VOCABULARY . ' ON (' . $this->tableName . '.description_const = ' . TABLE_VOCABULARY . '.key_value AND ' . TABLE_VOCABULARY . '.language_id = \'' . Application::Get('lang') . '\')
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array('mod_name' => array('title' => _NAME, 'type' => 'label'), 'mod_description' => array('title' => _DESCRIPTION, 'type' => 'label'), 'icon_file' => array('title' => _ICON_IMAGE, 'type' => 'image', 'width' => '', 'readonly' => true, 'required' => false, 'target' => 'images/modules_icons/', 'no_image' => '', 'random_name' => true, 'overwrite_image' => false, 'unique' => false, 'image_width' => '96px', 'image_height' => '96px', 'thumbnail_create' => false, 'thumbnail_field' => '', 'thumbnail_width' => '', 'thumbnail_height' => ''), 'is_system' => array('title' => _SYSTEM_MODULE, 'type' => 'enum', 'width' => '', 'required' => false, 'readonly' => true, 'source' => $arr_system, 'unique' => false), 'is_installed' => array('title' => _INSTALLED, 'type' => 'enum', 'width' => '', 'required' => true, 'readonly' => false, 'source' => $arr_installed, 'unique' => false, 'javascript_event' => 'onchange="appToggleElementReadonly(this.value,0,\'truncate_tables\',false,true,false)"'), 'truncate_tables' => array('title' => _TRUNCATE_RELATED_TABLES, 'type' => 'checkbox', 'readonly' => false, 'true_value' => '1', 'false_value' => '0', 'unique' => false));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array();
    }
コード例 #21
0
<?php

/**
* @project ApPHP Medical Appointment
* @copyright (c) 2012 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAsCustomer() && Modules::IsModuleInstalled('listings')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $listing_id = MicroGrid::GetParameter('listing_id', false);
    $mode = 'view';
    $msg = '';
    if (!empty($listing_id)) {
        $objListingsCategories = new ListingsCategories($listing_id, 'me');
        if ($action == 'add') {
            $mode = 'add';
        } else {
            if ($action == 'create') {
                if ($objListingsCategories->AddRecord()) {
                    $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                    $mode = 'view';
                } else {
                    $msg = draw_important_message($objListingsCategories->error, false);
                    $mode = 'add';
                }
            } else {
コード例 #22
0
    /**
     * Do (prepare) order
     * 		@param $payment_type
     */
    public static function DoOrder($payment_type = '')
    {
        //global $objSettings;
        global $objLogin;
        if (SITE_MODE == 'demo') {
            self::$message = draw_important_message(_OPERATION_BLOCKED, false);
            return false;
        }
        // check if customer has reached the maximum number of allowed 'open' orders
        $max_orders = ModulesSettings::Get('payments', 'maximum_allowed_orders');
        $sql = 'SELECT COUNT(*) as cnt
				FROM ' . TABLE_ORDERS . '
				WHERE customer_id = ' . (int) $objLogin->GetLoggedID() . ' AND
				     (status = 0 OR status = 1)';
        $result = database_query($sql, DATA_ONLY);
        $cnt = isset($result[0]['cnt']) ? (int) $result[0]['cnt'] : 0;
        if ($cnt >= $max_orders) {
            self::$message = _MAX_ORDERS_ERROR;
            return false;
        }
        $return = false;
        $currency = MicroGrid::GetParameter('currency', false);
        $plan_id = MicroGrid::GetParameter('plan_id', false);
        $payment_type = MicroGrid::GetParameter('payment_type', false);
        $additionalInfo = '';
        $payed_by = 0;
        $listings_amount = 0;
        $order_price = 0;
        $vat_percent = ModulesSettings::Get('payments', 'vat_value');
        $vat_cost = 0;
        $total_price = 0;
        // add order to database
        if (in_array($payment_type, array('online', 'paypal', '2co', 'authorize'))) {
            if ($payment_type == 'paypal') {
                $payed_by = '1';
                $status = '0';
            } else {
                if ($payment_type == '2co') {
                    $payed_by = '2';
                    $status = '0';
                } else {
                    if ($payment_type == 'authorize') {
                        $payed_by = '3';
                        $status = '0';
                    } else {
                        $payed_by = '0';
                        $status = '0';
                    }
                }
            }
            $sql = 'SELECT ap.id, ap.listings_count, ap.price, ap.duration												
					FROM ' . TABLE_ADVERTISE_PLANS . ' ap
					WHERE ap.id = ' . (int) $plan_id;
            $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY);
            if ($result[1] > 0) {
                $listings_amount = $result[0]['listings_count'];
                $order_price = $result[0]['price'] * Application::Get('currency_rate');
                $vat_cost = $order_price * ($vat_percent / 100);
                $total_price = $order_price + $vat_cost;
                /////////////////////////////////////////////////////////////////
                $sql = 'SELECT id, order_number FROM ' . TABLE_ORDERS . ' WHERE customer_id = ' . (int) $objLogin->GetLoggedID() . ' AND status = 0 ORDER BY id DESC';
                $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY);
                if ($result[1] > 0) {
                    $sql_start = 'UPDATE ' . TABLE_ORDERS . ' SET ';
                    $order_number = $result[0]['order_number'];
                    $sql_end = ' WHERE order_number = \'' . $order_number . '\'';
                } else {
                    $sql_start = 'INSERT INTO ' . TABLE_ORDERS . ' SET ';
                    $order_number = strtoupper(get_random_string(10));
                    $sql_end = '';
                }
                $sql_middle = 'order_number = \'' . $order_number . '\',
							order_description = \'' . _LISTINGS_PURCHASING . '\',
							order_price = ' . number_format((double) $order_price, (int) Application::Get('currency_decimals'), '.', '') . ',
							vat_percent = ' . $vat_percent . ',
							vat_fee = ' . number_format((double) $vat_cost, (int) Application::Get('currency_decimals'), '.', '') . ',
							total_price = ' . number_format((double) $total_price, (int) Application::Get('currency_decimals'), '.', '') . ',
							currency = \'' . $currency . '\',
							advertise_plan_id = ' . $plan_id . ',
							listings_amount = ' . (int) $listings_amount . ',
							customer_id = ' . (int) @$objLogin->GetLoggedID() . ',
							transaction_number = \'\',
							created_date = \'' . date('Y-m-d H:i:s') . '\',
							payment_date = \'0000-00-00 00:00:00\',
							payment_type = ' . $payed_by . ',
							payment_method = 0,
							coupon_number = \'\',
							discount_campaign_id = 0,
							additional_info = \'' . $additionalInfo . '\',
							cc_type = \'\',
							cc_holder_name = \'\',
							cc_number = \'\', 
							cc_expires_month = \'\', 
							cc_expires_year = \'\', 
							cc_cvv_code = \'\',
							status = ' . (int) $status . ',
							status_changed = \'0000-00-00 00:00:00\',
							email_sent = 0';
                $sql = $sql_start . $sql_middle . $sql_end;
                if (database_void_query($sql)) {
                    $return = true;
                } else {
                    self::$message = _ORDER_PEPARING_ERROR;
                    $return = false;
                }
            } else {
                self::$message = _ORDER_PEPARING_ERROR;
                $return = false;
            }
        } else {
            self::$message = _ORDER_PEPARING_ERROR;
            $return = false;
        }
        if (SITE_MODE == 'development' && !empty(self::$message)) {
            self::$message .= '<br>' . $sql . '<br>' . mysql_error();
        }
        return $return;
    }
コード例 #23
0
 /**
  * Before-Deleting Record
  */
 public function BeforeDeleteRecord()
 {
     $sql = 'SELECT COUNT(*) as cnt FROM ' . TABLE_CURRENCIES . ' WHERE is_active = 1';
     if ($result = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY)) {
         if ((int) $result['cnt'] > 1) {
             $rid = MicroGrid::GetParameter('rid');
             $sql = 'SELECT is_default FROM ' . TABLE_CURRENCIES . ' WHERE id = ' . (int) $rid;
             if ($result = database_query($sql, DATA_ONLY, FIRST_ROW_ONLY)) {
                 if ($result['is_default'] == '1') {
                     $this->error = _DEFAULT_CURRENCY_DELETE_ALERT;
                     return false;
                 }
             }
             return true;
         } else {
             $this->error = _LAST_CURRENCY_ALERT;
             return false;
         }
     }
     return false;
 }
コード例 #24
0
ファイル: Customers.class.php プロジェクト: mozdial/Directory
    function __construct()
    {
        parent::__construct();
        $this->params = array();
        if (isset($_POST['group_id'])) {
            $this->params['group_id'] = (int) prepare_input($_POST['group_id']);
        }
        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['birth_date']) && $_POST['birth_date'] != '') {
            $this->params['birth_date'] = prepare_input($_POST['birth_date']);
        } else {
            $this->params['birth_date'] = '0000-00-00';
        }
        if (isset($_POST['company'])) {
            $this->params['company'] = prepare_input($_POST['company']);
        }
        if (isset($_POST['b_address'])) {
            $this->params['b_address'] = prepare_input($_POST['b_address']);
        }
        if (isset($_POST['b_address_2'])) {
            $this->params['b_address_2'] = prepare_input($_POST['b_address_2']);
        }
        if (isset($_POST['b_city'])) {
            $this->params['b_city'] = prepare_input($_POST['b_city']);
        }
        if (isset($_POST['b_state'])) {
            $this->params['b_state'] = prepare_input($_POST['b_state']);
        }
        if (isset($_POST['b_country'])) {
            $this->params['b_country'] = prepare_input($_POST['b_country']);
        }
        if (isset($_POST['b_zipcode'])) {
            $this->params['b_zipcode'] = prepare_input($_POST['b_zipcode']);
        }
        if (isset($_POST['phone'])) {
            $this->params['phone'] = prepare_input($_POST['phone']);
        }
        if (isset($_POST['fax'])) {
            $this->params['fax'] = prepare_input($_POST['fax']);
        }
        if (isset($_POST['email'])) {
            $this->params['email'] = prepare_input($_POST['email']);
        }
        if (isset($_POST['url'])) {
            $this->params['url'] = prepare_input($_POST['url'], false, 'medium');
        }
        if (isset($_POST['user_name'])) {
            $this->params['user_name'] = prepare_input($_POST['user_name']);
        }
        if (isset($_POST['user_password'])) {
            $this->params['user_password'] = prepare_input($_POST['user_password']);
        }
        if (isset($_POST['preferred_language'])) {
            $this->params['preferred_language'] = prepare_input($_POST['preferred_language']);
        }
        if (isset($_POST['date_created'])) {
            $this->params['date_created'] = prepare_input($_POST['date_created']);
        }
        if (isset($_POST['date_lastlogin'])) {
            $this->params['date_lastlogin'] = prepare_input($_POST['date_lastlogin']);
        }
        if (isset($_POST['registered_from_ip'])) {
            $this->params['registered_from_ip'] = prepare_input($_POST['registered_from_ip']);
        }
        if (isset($_POST['last_logged_ip'])) {
            $this->params['last_logged_ip'] = prepare_input($_POST['last_logged_ip']);
        }
        if (isset($_POST['email_notifications'])) {
            $this->params['email_notifications'] = prepare_input($_POST['email_notifications']);
        } else {
            $this->params['email_notifications'] = '0';
        }
        if (isset($_POST['notification_status_changed'])) {
            $this->params['notification_status_changed'] = prepare_input($_POST['notification_status_changed']);
        }
        if (isset($_POST['is_active'])) {
            $this->params['is_active'] = (int) $_POST['is_active'];
        } else {
            $this->params['is_active'] = '0';
        }
        if (isset($_POST['is_removed'])) {
            $this->params['is_removed'] = (int) $_POST['is_removed'];
        } else {
            $this->params['is_removed'] = '0';
        }
        if (isset($_POST['comments'])) {
            $this->params['comments'] = prepare_input($_POST['comments']);
        }
        if (isset($_POST['registration_code'])) {
            $this->params['registration_code'] = prepare_input($_POST['registration_code']);
        }
        if (isset($_POST['plan1_listings'])) {
            $this->params['plan1_listings'] = prepare_input($_POST['plan1_listings']);
        }
        if (isset($_POST['plan2_listings'])) {
            $this->params['plan2_listings'] = prepare_input($_POST['plan2_listings']);
        }
        if (isset($_POST['plan3_listings'])) {
            $this->params['plan3_listings'] = prepare_input($_POST['plan3_listings']);
        }
        if (isset($_POST['plan4_listings'])) {
            $this->params['plan4_listings'] = prepare_input($_POST['plan4_listings']);
        }
        $rid = MicroGrid::GetParameter('rid');
        $action = MicroGrid::GetParameter('action');
        $this->email_notifications = '';
        $this->user_password = '';
        $this->allow_adding_by_admin = ModulesSettings::Get('customers', 'allow_adding_by_admin');
        $this->allow_changing_password = ModulesSettings::Get('customers', 'password_changing_by_admin');
        $this->reg_confirmation = ModulesSettings::Get('customers', 'reg_confirmation');
        $allow_adding = $this->allow_adding_by_admin == 'yes' ? true : false;
        $this->primaryKey = 'id';
        $this->tableName = TABLE_CUSTOMERS;
        $this->dataSet = array();
        $this->error = '';
        ///$this->languageId  	= (isset($_REQUEST['language_id']) && $_REQUEST['language_id'] != '') ? $_REQUEST['language_id'] : Languages::GetDefaultLang();
        $this->formActionURL = 'index.php?admin=mod_customers_management';
        $this->actions = array('add' => $allow_adding, 'edit' => true, 'details' => true, 'delete' => true);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowTopButtons = true;
        $this->allowLanguages = false;
        $this->WHERE_CLAUSE = '';
        $this->ORDER_CLAUSE = 'ORDER BY id DESC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $total_countries = Countries::GetAllCountries('priority_order DESC, name ASC');
        $arr_countries = array();
        foreach ($total_countries[0] as $key => $val) {
            $arr_countries[$val['abbrv']] = $val['name'];
        }
        // prepare plans array
        $total_plans = AdvertisePlans::GetAllPlans();
        $arr_plans = array();
        foreach ($total_plans[0] as $key => $val) {
            $arr_plans[$val['id']] = $val['plan_name'];
        }
        // prepare groups array
        $total_groups = CustomerGroups::GetAllGroups();
        $arr_groups = array();
        foreach ($total_groups[0] as $key => $val) {
            $arr_groups[$val['id']] = $val['name'];
        }
        // prepare languages array
        $total_languages = Languages::GetAllActive();
        $arr_languages = array();
        foreach ($total_languages[0] as $key => $val) {
            $arr_languages[$val['abbreviation']] = $val['lang_name'];
        }
        $this->isFilteringAllowed = true;
        // define filtering fields
        $this->arrFilteringFields = array(_FIRST_NAME => array('table' => 'c', 'field' => 'first_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _LAST_NAME => array('table' => 'c', 'field' => 'last_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _EMAIL => array('table' => 'c', 'field' => 'email', 'type' => 'text', 'sign' => 'like%', 'width' => '90px'), _ACTIVE => array('table' => 'c', 'field' => 'is_active', 'type' => 'dropdownlist', 'source' => array('0' => _NO, '1' => _YES), 'sign' => '=', 'width' => '85px'), _GROUP => array('table' => 'c', 'field' => 'group_id', 'type' => 'dropdownlist', 'source' => $arr_groups, 'sign' => '=', 'width' => '85px'));
        $customer_ip = get_current_ip();
        $datetime_format = get_datetime_format();
        $date_format_view = get_date_format('view');
        $date_format_edit = get_date_format('edit');
        $default_plan_info = AdvertisePlans::GetDefaultPlanInfo();
        $default_plan_id = isset($default_plan_info['id']) ? (int) $default_plan_info['id'] : 0;
        $default_plan_lc = isset($default_plan_info['listings_count']) ? (int) $default_plan_info['listings_count'] : 0;
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT
									c.' . $this->primaryKey . ',
		                            c.*,
									CONCAT(c.first_name, " ", c.last_name) as full_name,
									IF(c.is_active, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as customer_active,
									cg.name as group_name
								FROM ' . $this->tableName . ' c
									LEFT OUTER JOIN ' . TABLE_CUSTOMER_GROUPS . ' cg ON c.group_id = cg.id ';
        // define view mode fields
        $this->arrViewModeFields = array('full_name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '20'), 'user_name' => array('title' => _USERNAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '20'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'link', 'href' => 'mailto:{email}', 'align' => 'left', 'width' => '', 'maxlength' => '36'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'source' => $arr_countries), 'customer_active' => array('title' => _ACTIVE, 'type' => 'label', 'align' => 'center', 'width' => '90px'), 'group_name' => array('title' => _GROUP, 'type' => 'label', 'align' => 'left', 'width' => '90px'), 'id' => array('title' => 'ID', 'type' => 'label', 'align' => 'center', 'width' => '50px'));
        //----------------------------------------------------------------------
        // 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'), 'birth_date' => array('title' => _BIRTH_DATE, 'type' => 'date', 'width' => '210px', 'required' => false, 'readonly' => false, 'default' => '', 'validation_type' => 'date', 'unique' => false, 'visible' => true, 'min_year' => '90', 'max_year' => '0', 'format' => 'date', 'format_parameter' => $date_format_edit), 'url' => array('title' => _URL, 'type' => 'textbox', 'width' => '270px', 'required' => false, 'maxlength' => '255', 'validation_type' => 'text')), 'separator_2' => array('separator_info' => array('legend' => _BILLING_ADDRESS), 'company' => array('title' => _COMPANY, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '128', 'validation_type' => 'text'), 'b_address' => array('title' => _ADDRESS, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_address_2' => array('title' => _ADDRESS_2, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '64', 'validation_type' => 'text'), 'b_city' => array('title' => _CITY, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_zipcode' => array('title' => _ZIP_CODE, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'width' => '', 'source' => $arr_countries, 'required' => true), 'b_state' => array('title' => _STATE_PROVINCE, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text')), 'separator_3' => array('separator_info' => array('legend' => _CONTACT_INFORMATION), 'phone' => array('title' => _PHONE, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'fax' => array('title' => _FAX, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '230px', 'required' => false, 'maxlength' => '70', 'validation_type' => 'email', 'unique' => true, 'autocomplete' => 'off')), 'separator_4' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USERNAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'validation_type' => 'text', 'maxlength' => '32', 'validation_minlength' => '4', 'readonly' => false, 'unique' => true), 'user_password' => array('title' => _PASSWORD, 'type' => 'password', 'width' => '210px', 'required' => true, 'validation_type' => 'password', 'maxlength' => '20', 'cryptography' => PASSWORDS_ENCRYPTION, 'cryptography_type' => PASSWORDS_ENCRYPTION_TYPE, 'aes_password' => PASSWORDS_ENCRYPT_KEY), 'group_id' => array('title' => _CUSTOMER_GROUP, 'type' => 'enum', 'required' => false, 'readonly' => false, 'width' => '', 'source' => $arr_groups), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'default' => Application::Get('lang'), 'source' => $arr_languages)), 'separator_5' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => date('Y-m-d H:i:s')), 'registered_from_ip' => array('title' => _REGISTERED_FROM_IP, 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $customer_ip), 'last_logged_ip' => array('title' => _LAST_LOGGED_IP, 'type' => 'hidden', 'width' => '210px', 'required' => false, 'default' => ''), 'email_notifications' => array('title' => _EMAIL_NOTIFICATION, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0', 'unique' => false), 'is_removed' => array('title' => _REMOVED, 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => '0'), 'comments' => array('title' => _COMMENTS, 'type' => 'textarea', 'width' => '420px', 'height' => '70px', 'required' => false, 'readonly' => false, 'validation_type' => 'text', 'validation_maxlength' => '2048'), 'registration_code' => array('title' => _REGISTRATION_CODE, 'type' => 'hidden', 'width' => '210px', 'required' => false, 'default' => ''), 'plan1_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[1], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '1' ? (int) $default_plan_lc : '0'), 'plan2_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[2], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '2' ? (int) $default_plan_lc : '0'), 'plan3_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[3], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '3' ? (int) $default_plan_lc : '0'), 'plan4_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[4], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '4' ? (int) $default_plan_lc : '0')));
        //----------------------------------------------------------------------
        // EDIT MODE
        // * password field must be written directly in SQL!!!
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
									' . $this->tableName . '.' . $this->primaryKey . ',
		                            ' . $this->tableName . '.*,
									' . $this->tableName . '.user_password,
									' . $this->tableName . '.date_created,
									' . $this->tableName . '.date_lastlogin,
									' . $this->tableName . '.notification_status_changed
								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', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'birth_date' => array('title' => _BIRTH_DATE, 'type' => 'date', 'width' => '210px', 'required' => false, 'readonly' => false, 'default' => '', 'validation_type' => 'date', 'unique' => false, 'visible' => true, 'min_year' => '90', 'max_year' => '0', 'format' => 'date', 'format_parameter' => $date_format_edit), 'url' => array('title' => _URL, 'type' => 'textbox', 'width' => '270px', 'required' => false, 'maxlength' => '255', 'validation_type' => 'text')), 'separator_2' => array('separator_info' => array('legend' => _BILLING_ADDRESS), 'company' => array('title' => _COMPANY, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '128', 'validation_type' => 'text'), 'b_address' => array('title' => _ADDRESS, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_address_2' => array('title' => _ADDRESS_2, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '64', 'validation_type' => 'text'), 'b_city' => array('title' => _CITY, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_zipcode' => array('title' => _ZIP_CODE, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'width' => '', 'source' => $arr_countries, 'required' => true), 'b_state' => array('title' => _STATE_PROVINCE, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '64', 'validation_type' => 'text')), 'separator_3' => array('separator_info' => array('legend' => _CONTACT_INFORMATION), 'phone' => array('title' => _PHONE, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'fax' => array('title' => _FAX, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '230px', 'required' => true, 'maxlength' => '70', 'readonly' => false, 'validation_type' => 'email', 'unique' => true, 'autocomplete' => 'off')), 'separator_4' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'user_password' => array('title' => _PASSWORD, 'type' => 'password', 'width' => '210px', 'maxlength' => '20', 'required' => true, 'validation_type' => 'password', 'cryptography' => PASSWORDS_ENCRYPTION, 'cryptography_type' => PASSWORDS_ENCRYPTION_TYPE, 'aes_password' => PASSWORDS_ENCRYPT_KEY, 'visible' => $this->allow_changing_password == 'yes' ? true : false), 'group_id' => array('title' => _CUSTOMER_GROUP, 'type' => 'enum', 'required' => false, 'readonly' => false, 'width' => '', 'source' => $arr_groups), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'source' => $arr_languages)), 'separator_5' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'registered_from_ip' => array('title' => _REGISTERED_FROM_IP, 'type' => 'label'), 'last_logged_ip' => array('title' => _LAST_LOGGED_IP, 'type' => 'label'), 'email_notifications' => array('title' => _EMAIL_NOTIFICATION, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'notification_status_changed' => array('title' => _NOTIFICATION_STATUS_CHANGED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'is_removed' => array('title' => _REMOVED, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'comments' => array('title' => _COMMENTS, 'type' => 'textarea', 'width' => '420px', 'height' => '70px', 'required' => false, 'readonly' => false, 'validation_type' => 'text', 'validation_maxlength' => '2048'), 'registration_code' => array('title' => _REGISTRATION_CODE, 'type' => 'hidden', 'width' => '210px', 'required' => false, 'default' => '')), 'separator_6' => array('separator_info' => array('legend' => _LISTINGS), 'orders_count' => array('title' => _ORDERS_COUNT, 'type' => 'label'), 'plan1_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[1], 'type' => 'label'), 'plan2_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[2], 'type' => 'label'), 'plan3_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[3], 'type' => 'label'), 'plan4_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[4], 'type' => 'label')));
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = 'SELECT
									c.' . $this->primaryKey . ',
		                            c.*,
									IF(c.email_notifications, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as email_notifications,
									IF(c.is_active, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as customer_active,
									IF(c.is_removed, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as customer_removed,
									c.date_created,
									c.date_lastlogin,
									c.notification_status_changed,
									cg.name as group_name
								FROM ' . $this->tableName . ' c
									LEFT OUTER JOIN ' . TABLE_CUSTOMER_GROUPS . ' cg ON c.group_id = cg.id
								WHERE c.' . $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'), 'birth_date' => array('title' => _BIRTH_DATE, 'type' => 'date', 'format' => 'date', 'format_parameter' => $date_format_view), 'url' => array('title' => _URL, 'type' => 'label')), 'separator_2' => array('separator_info' => array('legend' => _BILLING_ADDRESS), 'company' => array('title' => _COMPANY, 'type' => 'label'), 'b_address' => array('title' => _ADDRESS, 'type' => 'label'), 'b_address_2' => array('title' => _ADDRESS_2, 'type' => 'label'), 'b_city' => array('title' => _CITY, 'type' => 'label'), 'b_zipcode' => array('title' => _ZIP_CODE, 'type' => 'label'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'source' => $arr_countries), 'b_state' => array('title' => _STATE_PROVINCE, 'type' => 'label')), 'separator_3' => array('separator_info' => array('legend' => _CONTACT_INFORMATION), 'phone' => array('title' => _PHONE, 'type' => 'label'), 'fax' => array('title' => _FAX, 'type' => 'label'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label')), 'separator_4' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'group_name' => array('title' => _CUSTOMER_GROUP, 'type' => 'label'), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'source' => $arr_languages)), 'separator_5' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'registered_from_ip' => array('title' => _REGISTERED_FROM_IP, 'type' => 'label'), 'last_logged_ip' => array('title' => _LAST_LOGGED_IP, 'type' => 'label'), 'email_notifications' => array('title' => _EMAIL_NOTIFICATION, 'type' => 'label'), 'notification_status_changed' => array('title' => _NOTIFICATION_STATUS_CHANGED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'customer_active' => array('title' => _ACTIVE, 'type' => 'label'), 'customer_removed' => array('title' => _REMOVED, 'type' => 'label'), 'comments' => array('title' => _COMMENTS, 'type' => 'label')), 'separator_6' => array('separator_info' => array('legend' => _LISTINGS), 'orders_count' => array('title' => _ORDERS_COUNT, 'type' => 'label'), 'plan1_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[1], 'type' => 'label'), 'plan2_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[2], 'type' => 'label'), 'plan3_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[3], 'type' => 'label'), 'plan4_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[4], 'type' => 'label')));
    }
コード例 #25
0
<?php

/**
* @project ApPHP Business Directory
* @copyright (c) 2011 ApPHP
* @author ApPHP <*****@*****.**>
* @license http://www.gnu.org/licenses/
*/
// *** Make sure the file isn't accessed directly
defined('APPHP_EXEC') or die('Restricted Access');
//--------------------------------------------------------------------------
if ($objLogin->IsLoggedInAs('owner', 'mainadmin') && Modules::IsModuleInstalled('gallery')) {
    $action = MicroGrid::GetParameter('action');
    $rid = MicroGrid::GetParameter('rid');
    $mode = 'view';
    $msg = '';
    $objGallery = new ModulesSettings('gallery');
    if ($action == 'add') {
        $mode = 'add';
    } else {
        if ($action == 'create') {
            if ($objGallery->AddRecord()) {
                $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false);
                $mode = 'view';
            } else {
                $msg = draw_important_message($objGallery->error, false);
                $mode = 'add';
            }
        } else {
            if ($action == 'edit') {
                $mode = 'edit';
コード例 #26
0
ファイル: PagesGrid.class.php プロジェクト: mozdial/Directory
    function __construct($type = '', $actions = array())
    {
        parent::__construct();
        $this->params = array();
        ///if(isset($_POST['parameter1']))   $this->params['parameter1'] = $_POST['parameter1'];
        ///if(isset($_POST['parameter2']))   $this->params['parameter2'] = $_POST['parameter2'];
        ///if(isset($_POST['parameter3']))   $this->params['parameter3'] = $_POST['parameter3'];
        // for checkboxes
        ///if(isset($_POST['parameter4']))   $this->params['parameter4'] = $_POST['parameter4']; else $this->params['parameter4'] = '0';
        $this->params['language_id'] = MicroGrid::GetParameter('language_id');
        $this->primaryKey = 'id';
        $this->tableName = TABLE_PAGES;
        $this->dataSet = array();
        $this->error = '';
        $this->formActionURL = 'index.php?admin=pages' . ($type != '' ? '&type=' . $type : '');
        $this->actions = array('add' => false, 'edit' => false, 'details' => false, 'delete' => false);
        $this->actionIcons = true;
        $this->allowRefresh = true;
        $this->allowLanguages = true;
        $this->languageId = $this->params['language_id'] != '' ? $this->params['language_id'] : Languages::GetDefaultLang();
        $this->WHERE_CLAUSE = 'WHERE
									' . $this->tableName . '.is_system_page = ' . ($type == 'system' ? '1' : '0') . ' AND 
									' . $this->tableName . '.is_home = 0 AND
									' . $this->tableName . '.is_removed = 0 AND
									' . $this->tableName . '.language_id = \'' . $this->languageId . '\'';
        $this->ORDER_CLAUSE = 'ORDER BY priority_order ASC';
        $this->isAlterColorsAllowed = true;
        $this->isPagingAllowed = true;
        $this->pageSize = 20;
        $this->isSortingAllowed = true;
        $this->isFilteringAllowed = $type == 'system' ? false : true;
        // prepare menus array
        $total_menus = Menu::GetAll(' menu_order ASC', TABLE_MENUS, '', $this->languageId);
        $arr_menus = array();
        foreach ($total_menus[0] as $key => $val) {
            $arr_menus[$val['id']] = $val['menu_name'] . ($val['menu_placement'] == 'hidden' ? ' (' . _HIDDEN . ')' : '');
        }
        // define filtering fields
        $this->arrFilteringFields = array(_MENU_WORD => array('table' => TABLE_MENUS, 'field' => 'id', 'type' => 'dropdownlist', 'source' => $arr_menus, 'sign' => '=', 'width' => '150px'));
        // prepare languages array
        $total_languages = Languages::GetAllActive();
        $arr_languages = array();
        foreach ($total_languages[0] as $key => $val) {
            $arr_languages[$val['abbreviation']] = $val['lang_name'];
        }
        $comments_allow = Modules::IsModuleInstalled('comments') ? ModulesSettings::Get('comments', 'comments_allow') : 'no';
        //----------------------------------------------------------------------
        // VIEW MODE
        //----------------------------------------------------------------------
        $this->VIEW_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ',
									' . $this->tableName . '.language_id,
									' . $this->tableName . '.content_type,
									' . $this->tableName . '.link_url,
									' . $this->tableName . '.link_target,
									' . $this->tableName . '.page_key,
									IF(' . $this->tableName . '.page_title != "", ' . $this->tableName . '.page_title, "- ' . _UNDEFINED . ' -") as page_title,
									' . $this->tableName . '.page_text,
									' . $this->tableName . '.menu_id,
									IF(' . $this->tableName . '.menu_link != "", ' . $this->tableName . '.menu_link, "- ' . _UNDEFINED . ' -") as menu_link,
									' . $this->tableName . '.comments_allowed,
									' . $this->tableName . '.is_home,
									' . $this->tableName . '.priority_order,
									IF(' . $this->tableName . '.access_level = "public", "' . _PUBLIC . '", "' . _REGISTERED . '") my_access_level,
									CASE
										WHEN ' . $this->tableName . '.is_published = 1 THEN
											IF(
												(finish_publishing = "0000-00-00" OR finish_publishing >= \'' . date('Y-m-d') . '\'),
												"<img src=\\"images/published_g.gif\\" alt=\\"\\" />",
												"<img src=\\"images/expired.gif\\" alt=\\"' . _EXPIRED . '\\" />"
											  ) 		
										ELSE "<img src=\\"images/published_x.gif\\" alt=\\"\\" />"
									END as is_published,
									IF(' . TABLE_MENUS . '.menu_name != "", ' . TABLE_MENUS . '.menu_name, "' . _NOT_AVAILABLE . '") as menu_name,
									CASE
										WHEN ' . $this->tableName . '.comments_allowed = 1 THEN
											CONCAT("<a href=\\"index.php?admin=mod_comments_management&pid=",
											' . $this->tableName . '.' . $this->primaryKey . ', "\\">", (SELECT COUNT(*) FROM ' . TABLE_COMMENTS . ' c WHERE c.article_id = ' . $this->tableName . '.' . $this->primaryKey . '),											
											(SELECT IF(COUNT(*) > 0, CONCAT("(",COUNT(*),")"), "") FROM ' . TABLE_COMMENTS . ' c WHERE c.is_published = 0 AND c.article_id = ' . $this->tableName . '.' . $this->primaryKey . '),
											"</a>")
										ELSE
											"<span class=gray>' . _NOT_ALLOWED . '</span>"
									END as comments_count,
									CONCAT(
										" <a href=\\"index.php?page=pages' . ($type == 'system' ? '&type=' . $type : '') . '&pid=", ' . $this->tableName . '.' . $this->primaryKey . ', "&mg_language_id=' . $this->languageId . '\\">' . _VIEW_WORD . '</a>
										' . ($actions['edit'] ? ' | <a href=\\"index.php?admin=pages_edit' . ($type != '' ? '&type=' . $type : '') . '&pid=", ' . $this->tableName . '.' . $this->primaryKey . ', "\\">' . _EDIT_WORD . '</a>' : '') . '
										' . ($actions['delete'] && $type != 'system' ? ' | <a href=\\"javascript:confirmRemoving(\'", ' . $this->tableName . '.' . $this->primaryKey . ', "\')\\">' . _REMOVE . '</a>' : '') . '
										") as action_links
								FROM ' . $this->tableName . '
									LEFT OUTER JOIN ' . TABLE_MENUS . ' ON ' . $this->tableName . '.menu_id=' . TABLE_MENUS . '.id';
        // define view mode fields
        $this->arrViewModeFields = array();
        $this->arrViewModeFields['menu_link'] = array('title' => _MENU_LINK, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '40');
        if ($type == 'system') {
            $this->arrViewModeFields['page_title'] = array('title' => _PAGE_HEADER, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '40');
        }
        $this->arrViewModeFields['menu_name'] = array('title' => _MENU_WORD, 'type' => 'label', 'align' => 'center', 'width' => '', 'visible' => $type == 'system' ? false : true);
        $this->arrViewModeFields['is_published'] = array('title' => _PUBLISHED, 'type' => 'label', 'align' => 'center', 'width' => '80px');
        $this->arrViewModeFields['my_access_level'] = array('title' => _ACCESS, 'type' => 'label', 'align' => 'center', 'width' => '75px');
        $this->arrViewModeFields['priority_order'] = array('title' => _ORDER, 'type' => 'label', 'align' => 'center', 'width' => '65px', 'visible' => 'true', 'movable' => true);
        $this->arrViewModeFields['comments_count'] = array('title' => _COMMENTS, 'type' => 'label', 'align' => 'center', 'width' => '90px', 'visible' => $comments_allow == 'yes' ? true : false);
        $this->arrViewModeFields['id'] = array('title' => 'ID', 'type' => 'label', 'align' => 'center', 'width' => '50px');
        $this->arrViewModeFields['action_links'] = array('title' => _ACTIONS, 'type' => 'label', 'align' => 'center', 'sortable' => false, 'nowrap' => 'nowrap', 'width' => $type == 'system' ? '90px' : '130px');
        //----------------------------------------------------------------------
        // ADD MODE
        //----------------------------------------------------------------------
        // define add mode fields
        $this->arrAddModeFields = array();
        //----------------------------------------------------------------------
        // EDIT MODE
        //----------------------------------------------------------------------
        $this->EDIT_MODE_SQL = 'SELECT
								' . $this->tableName . '.' . $this->primaryKey . ',
								' . $this->tableName . '.parameter1,
								' . $this->tableName . '.parameter2,
								' . $this->tableName . '.parameter3
							FROM ' . $this->tableName . '
							WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_';
        // define edit mode fields
        $this->arrEditModeFields = array();
        //----------------------------------------------------------------------
        // DETAILS MODE
        //----------------------------------------------------------------------
        $this->DETAILS_MODE_SQL = $this->EDIT_MODE_SQL;
        $this->arrDetailsModeFields = array();
    }