コード例 #1
0
 /**
  * Add a new property type
  * @author Howard R <*****@*****.**>
  * @static
  * @param string $parent
  * @param string $name
  * @return int
  */
 public static function insert_property_type($parent, $name)
 {
     $query = "INSERT INTO `#__wpl_property_types`(`parent`,`enabled`,`editable`,`index`,`listing`,`name`) VALUES ('{$parent}', '1', '2', '00.00', '0', '{$name}')";
     $id = wpl_db::q($query, 'insert');
     $query = "UPDATE `#__wpl_property_types` SET `index`='{$id}.00' WHERE `id`='{$id}'";
     wpl_db::q($query);
     return $id;
 }
コード例 #2
0
 /**
  * Add a new listing type
  * @author Howard R <*****@*****.**>
  * @static
  * @param type $parent
  * @param type $name
  * @param type $gicon
  * @return type
  */
 public static function insert_listing_type($parent, $name, $gicon = NULL)
 {
     $query = "INSERT INTO `#__wpl_listing_types` (`parent`,`enabled`,`editable`,`gicon`,`name`) VALUES ('{$parent}','1','2','{$gicon}','{$name}')";
     $id = wpl_db::q($query, 'insert');
     $query = "UPDATE `#__wpl_listing_types` SET `index`='{$id}.00' WHERE `id`='{$id}'";
     wpl_db::q($query);
     /** trigger event **/
     wpl_global::event_handler('listing_type_added', array('name' => $name));
     return $id;
 }
コード例 #3
0
ファイル: wpl_ajax.php プロジェクト: amankatoch/wp-plugin
 private function save_dbst()
 {
     $dbst_id = wpl_request::getVar('dbst_id', 0);
     $post = wpl_request::get('post');
     $mode = 'edit';
     /** insert new field **/
     if (!$dbst_id) {
         $mode = 'add';
         $dbst_id = wpl_flex::create_default_dbst();
     }
     $q = '';
     foreach ($post as $field => $value) {
         if (substr($field, 0, 4) != 'fld_') {
             continue;
         }
         $key = substr($field, 4);
         if (trim($key) == '') {
             continue;
         }
         $q .= "`{$key}`='{$value}', ";
     }
     /** add options to query **/
     $options = wpl_flex::get_encoded_options($post, 'opt_', wpl_flex::get_field_options($dbst_id));
     $q .= "`options`='" . wpl_db::escape($options) . "', ";
     $q = trim($q, ", ");
     $query = "UPDATE `#__wpl_dbst` SET " . $q . " WHERE `id`='{$dbst_id}'";
     wpl_db::q($query, 'update');
     $dbst_type = wpl_flex::get_dbst_key('type', $dbst_id);
     $dbst_kind = wpl_flex::get_dbst_key('kind', $dbst_id);
     /** run queries **/
     if ($mode == 'add') {
         wpl_flex::run_dbst_type_queries($dbst_id, $dbst_type, $dbst_kind, 'add');
     }
     /** Multilingual **/
     if (wpl_global::check_addon('pro')) {
         wpl_addon_pro::multilingual($dbst_id);
     }
     /** trigger event **/
     wpl_global::event_handler('dbst_modified', array('id' => $dbst_id, 'mode' => $mode, 'kind' => $dbst_kind, 'type' => $dbst_type));
     /** echo response **/
     echo json_encode(array('success' => 1, 'message' => __('Field saved.', WPL_TEXTDOMAIN), 'data' => NULL));
     exit;
 }
コード例 #4
0
ファイル: logs.php プロジェクト: amankatoch/wp-plugin
 /**
  * For deleting logs by id or prior date or addon_id
  * @author Howard R <*****@*****.**>
  * @static
  * @param int $log_id
  * @param string $prior_date
  * @param int $addon_id
  * @return boolean
  */
 public static function delete($log_id = '', $prior_date = '', $addon_id = '')
 {
     if (trim($log_id) == '' and trim($prior_date) == '' and trim($addon_id) == '') {
         return false;
     }
     $where = '';
     if (trim($log_id) != '') {
         $where .= " AND `id`='{$log_id}'";
     }
     if (trim($prior_date) != '') {
         $where .= " AND `log_date`<'{$prior_date}'";
     }
     if (trim($addon_id) != '') {
         $where .= " AND `addon_id`='{$addon_id}'";
     }
     if (trim($where) == '') {
         return false;
     }
     $query = "DELETE FROM `#__wpl_logs` WHERE 1 " . $where;
     return wpl_db::q($query, 'delete');
 }
コード例 #5
0
ファイル: items.php プロジェクト: amankatoch/wp-plugin
 /**
  * Updates a file
  * @author Howard R <*****@*****.**>
  * @static
  * @param string $file_name
  * @param int $parent_id
  * @param array $values
  * @return boolean
  */
 public static function update_file($file_name, $parent_id, $values = array())
 {
     /** first validation **/
     if (!trim($file_name) or !trim($parent_id) or count($values) == 0) {
         return false;
     }
     $q = '';
     foreach ($values as $key => $value) {
         $q .= "`{$key}`='{$value}', ";
     }
     $q = trim($q, ", ");
     $file_name = trim($file_name);
     $query = "UPDATE `#__wpl_items` SET " . $q . " WHERE `parent_id`='{$parent_id}' AND `item_name`='{$file_name}'";
     $affected_rows = wpl_db::q($query, 'update');
     /** trigger event **/
     wpl_global::event_handler('item_updated', array('file_name' => $file_name, 'parent_id' => $parent_id));
     return $affected_rows;
 }
コード例 #6
0
ファイル: db.php プロジェクト: amankatoch/wp-plugin
 /**
  * Fetch list of table columns or check existence of a column in a table
  * @author Howard <*****@*****.**>
  * @param string $table
  * @param string $column
  * @return mixed
  */
 public static function columns($table = 'wpl_properties', $column = NULL)
 {
     $query = "SHOW COLUMNS FROM `#__" . $table . "`";
     $results = wpl_db::q($query, "select");
     $columns = array();
     foreach ($results as $key => $result) {
         $columns[] = $result->Field;
     }
     if (trim($column) and in_array($column, $columns)) {
         return true;
     } elseif (trim($column)) {
         return false;
     }
     return $columns;
 }
コード例 #7
0
ファイル: wpl_ajax.php プロジェクト: amankatoch/wp-plugin
 private function set_parent()
 {
     $parent_id = wpl_request::getVar('parent_id', 0);
     $item_id = wpl_request::getVar('item_id', 0);
     $parent_data = wpl_property::get_property_raw_data($parent_id);
     $forbidden_fields = array('id', 'kind', 'deleted', 'mls_id', 'parent', 'pic_numb', 'att_numb', 'sent_numb', 'contact_numb', 'user_id', 'add_date', 'finalized', 'confirmed', 'visit_time', 'visit_date', 'last_modified_time_stamp', 'sp_featured', 'sp_hot', 'sp_openhouse', 'sp_forclosure', 'textsearch', 'property_title', 'location_text', 'vids_numb', 'rendered', 'alias');
     $q = '';
     foreach ($parent_data as $key => $value) {
         if (in_array($key, $forbidden_fields)) {
             continue;
         }
         $q .= "`{$key}`='{$value}', ";
     }
     $q .= trim($q, ', ');
     $query = "UPDATE `#__wpl_properties` SET `parent`='{$parent_id}', {$q} WHERE `id`='{$item_id}'";
     wpl_db::q($query);
     echo json_encode(array('success' => 1));
     exit;
 }
コード例 #8
0
ファイル: locations.php プロジェクト: gvh1993/project-vvvh
 /**
  * Updates latitude and longitude of a property
  * @author Howard <*****@*****.**>
  * @static
  * @param type $property_data
  * @param type $property_id
  * @return type
  */
 public static function update_LatLng($property_data, $property_id = NULL)
 {
     /** fetch property data if property id is setted **/
     if ($property_id) {
         $property_data = wpl_property::get_property_raw_data($property_id);
     }
     if (!$property_id) {
         $property_id = $property_data['id'];
     }
     $location_text = wpl_property::generate_location_text($property_data);
     $LatLng = self::get_LatLng($location_text);
     if ($LatLng[0] and $LatLng[1]) {
         $query = "UPDATE `#__wpl_properties` SET `googlemap_lt`='" . $LatLng[0] . "', `googlemap_ln`='" . $LatLng[1] . "' WHERE `id`='{$property_id}'";
         wpl_db::q($query);
     }
     $latitude = $LatLng[0] ? $LatLng[0] : $property_data['googlemap_lt'];
     $longitude = $LatLng[1] ? $LatLng[1] : $property_data['googlemap_ln'];
     return array($latitude, $longitude);
 }
コード例 #9
0
 private function save_listing_type()
 {
     $key = wpl_request::getVar('key');
     $value = wpl_request::getVar('value');
     $id = wpl_request::getVar('listing_type_id');
     $query = "UPDATE `#__wpl_listing_types` SET `{$key}`='{$value}' WHERE id='{$id}'";
     $res = wpl_db::q($query);
     $res = (int) $res;
     $message = $res ? __('Saved.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN);
     $data = NULL;
     $response = array('success' => $res, 'message' => $message, 'data' => $data);
     echo json_encode($response);
     exit;
 }
コード例 #10
0
ファイル: property.php プロジェクト: amankatoch/wp-plugin
 /**
  * Removes property cache
  * @author Howard R <*****@*****.**>
  * @static
  * @param int $property_id
  * @return boolean
  */
 public static function clear_property_cache($property_id)
 {
     /** First Validation **/
     if (!trim($property_id)) {
         return false;
     }
     _wpl_import('libraries.settings');
     $q = " `location_text`='', `rendered`=''";
     if (wpl_global::check_multilingual_status()) {
         $q = wpl_settings::get_multilingual_query(array('location_text', 'rendered'));
     }
     $query = "UPDATE `#__wpl_properties` SET " . $q . " WHERE `id`='{$property_id}'";
     return wpl_db::q($query, 'UPDATE');
 }
コード例 #11
0
ファイル: settings.php プロジェクト: gvh1993/project-vvvh
 /**
  * Removes WPL cached data
  * @author Howard <*****@*****.**>
  * @static
  * @param type $cache_type
  * @return boolean
  */
 public static function clear_cache($cache_type = 'all')
 {
     /** first validation **/
     $cache_type = strtolower($cache_type);
     if (trim($cache_type) == '') {
         return false;
     }
     /** import libraries **/
     _wpl_import('libraries.property');
     _wpl_import('libraries.items');
     if ($cache_type == 'unfinalized_properties' or $cache_type == 'all') {
         $properties = wpl_db::select("SELECT `id` FROM `#__wpl_properties` WHERE `finalized`='0'", 'loadAssocList');
         foreach ($properties as $property) {
             wpl_property::purge($property['id']);
         }
     }
     if ($cache_type == 'properties_cached_data' or $cache_type == 'all') {
         $q = " `location_text`='', `rendered`='', `alias`=''";
         if (wpl_global::check_multilingual_status()) {
             $q = self::get_multilingual_query(array('alias', 'location_text', 'rendered'));
         }
         $query = "UPDATE `#__wpl_properties` SET " . $q;
         wpl_db::q($query);
     }
     if ($cache_type == 'location_texts' or $cache_type == 'all') {
         $q = " `location_text`=''";
         if (wpl_global::check_multilingual_status()) {
             $q = self::get_multilingual_query(array('location_text'));
         }
         $query = "UPDATE `#__wpl_properties` SET " . $q;
         wpl_db::q($query);
     }
     if ($cache_type == 'listings_thumbnails' or $cache_type == 'all') {
         $properties = wpl_db::select("SELECT `id`, `kind` FROM `#__wpl_properties` WHERE `id`>0", 'loadAssocList');
         $ext_array = array('jpg', 'jpeg', 'gif', 'png');
         foreach ($properties as $property) {
             $path = wpl_items::get_path($property['id'], $property['kind']);
             $thumbnails = wpl_folder::files($path, 'th.*\\.(' . implode('|', $ext_array) . ')$', 3, true);
             foreach ($thumbnails as $thumbnail) {
                 wpl_file::delete($thumbnail);
             }
         }
     }
     if ($cache_type == 'users_cached_data' or $cache_type == 'all') {
         $q = " `location_text`='', `rendered`=''";
         if (wpl_global::check_multilingual_status()) {
             $q = self::get_multilingual_query(array('location_text', 'rendered'), 'wpl_users');
         }
         $query = "UPDATE `#__wpl_users` SET " . $q;
         wpl_db::q($query);
     }
     if ($cache_type == 'users_thumbnails' or $cache_type == 'all') {
         $users = wpl_db::select("SELECT `id` FROM `#__wpl_users` WHERE `id`>0", 'loadAssocList');
         $ext_array = array('jpg', 'jpeg', 'gif', 'png');
         foreach ($users as $user) {
             $path = wpl_items::get_path($user['id'], 2);
             $thumbnails = wpl_folder::files($path, 'th.*\\.(' . implode('|', $ext_array) . ')$', 3, true);
             foreach ($thumbnails as $thumbnail) {
                 wpl_file::delete($thumbnail);
             }
         }
     }
     /** trigger event **/
     wpl_global::event_handler('cache_cleared', array('cache_type' => $cache_type));
     return true;
 }
コード例 #12
0
ファイル: activities.php プロジェクト: amankatoch/wp-plugin
 /**
  * Update Activity by Given ID
  * @author Kevin J <*****@*****.**>
  * @static
  * @param array $information
  * @return boolean
  */
 public static function update_activity($information)
 {
     $information = wpl_db::escape($information);
     $query = 'UPDATE `#__wpl_activities` SET ';
     $query .= "`activity` = '{$information['activity']}',`position` = '{$information['position']}',`enabled` = {$information['enabled']},";
     $query .= "`params` = '{$information['params']}',`show_title` = {$information['show_title']},";
     $query .= "`title` = '{$information['title']}', `index` = " . (double) $information['index'] . ",";
     $query .= "`association_type` = '{$information['association_type']}', `associations` = '{$information['associations']}', `client` = '{$information['client']}'";
     $query .= " WHERE `id` = '" . $information['activity_id'] . "'";
     /** trigger event **/
     wpl_global::event_handler('activity_updated', array('id' => $information['activity_id']));
     return wpl_db::q($query);
 }
コード例 #13
0
ファイル: db.php プロジェクト: gvh1993/project-vvvh
 /**
  * Returns MySQL Version
  * @author Howard <*****@*****.**>
  * @static
  * @return string
  */
 public static function version()
 {
     $query = "SELECT VERSION();";
     return wpl_db::q($query, 'loadResult');
 }
コード例 #14
0
ファイル: global.php プロジェクト: gvh1993/project-vvvh
 /**
  * Run a SQL Query file
  * @author Howard <*****@*****.**>
  * @static
  * @param string $sql_file
  * @param boolean $delete
  * @param boolean $exception
  * @return boolean
  */
 public static function do_file_queries($sql_file, $delete = false, $exception = false)
 {
     if (!wpl_file::exists($sql_file)) {
         return false;
     }
     $read_file = wpl_file::read($sql_file);
     if ($read_file != '') {
         $read_file = str_replace(";\r\n", "-=++=-", $read_file);
         $read_file = str_replace(";\r", "-=++=-", $read_file);
         $read_file = str_replace(";\n", "-=++=-", $read_file);
         $list_query = explode("-=++=-", $read_file);
         for ($i = 0; $i < count($list_query); $i++) {
             if (trim($list_query[$i]) == '') {
                 continue;
             }
             $query = $list_query[$i];
             if ($exception) {
                 wpl_db::q($query);
             } else {
                 try {
                     wpl_db::q($query);
                 } catch (Exception $e) {
                 }
             }
         }
     }
     if ($delete) {
         wpl_file::delete($sql_file);
     }
     return true;
 }
コード例 #15
0
ファイル: events.php プロジェクト: gvh1993/project-vvvh
 /**
  * Update latest run of cronjobs
  * @author Howard <*****@*****.**>
  * @param type $cronjob_id
  * @return boolean
  */
 public static function update_cronjob_latest_run($cronjob_id)
 {
     /** first validation **/
     if (!trim($cronjob_id)) {
         return false;
     }
     $query = "UPDATE `#__wpl_cronjobs` SET `latest_run`='" . date("Y-m-d H:i:s") . "' WHERE `id`='{$cronjob_id}'";
     wpl_db::q($query);
 }
コード例 #16
0
ファイル: request.php プロジェクト: amankatoch/wp-plugin
 public function validate_token($token, $delete = false)
 {
     $query = "SELECT COUNT(*) FROM `#__wpl_items` WHERE `item_name`='{$token}' AND `parent_kind`='-1'";
     $num = wpl_db::num($query);
     if ($num and $delete) {
         $query = "DELETE FROM `#__wpl_items` WHERE `parent_kind`='-1' AND `item_name`='{$token}'";
         wpl_db::q($query, 'DELETE');
     }
     return $num ? true : false;
 }
コード例 #17
0
ファイル: wpl_ajax.php プロジェクト: amankatoch/wp-plugin
 public function save_user_do($inputs)
 {
     $restricted_fields = array('page', 'wpl_format', 'wpl_function', 'function', 'id');
     /** edit user **/
     $query = "";
     $id = $inputs['id'];
     $columns = wpl_db::columns('wpl_users');
     $crm_access = array();
     /** set restriction to none **/
     if (!isset($inputs['maccess_lrestrict'])) {
         $inputs['maccess_listings'] = '';
     }
     if (!isset($inputs['maccess_ptrestrict'])) {
         $inputs['maccess_property_types'] = '';
     }
     foreach ($inputs as $field => $value) {
         if (substr($field, 0, 11) == 'maccess_crm') {
             if ($value == 1) {
                 $crm_access[] = substr($field, 11);
             }
             continue;
         }
         if (in_array($field, $restricted_fields) or !in_array($field, $columns)) {
             continue;
         }
         $query .= "`" . $field . "`='" . $value . "', ";
     }
     /** update CRM access list if available **/
     if (count($crm_access) > 0) {
         $query .= "`maccess_crm` = '" . implode(',', $crm_access) . "', ";
     }
     $query = rtrim($query, ', ');
     $query = "UPDATE `#__wpl_users` SET " . $query . " WHERE `id`='" . $id . "'";
     /** update user **/
     wpl_db::q($query);
     return true;
 }
コード例 #18
0
ファイル: flex.php プロジェクト: gvh1993/project-vvvh
 /**
  * Runs dbst type queries for a dbst field
  * @author Howard R <*****@*****.**>
  * @static
  * @param int $dbst_id
  * @param string $dbst_type
  * @param int $dbst_kind
  * @param string $query_type
  */
 public static function run_dbst_type_queries($dbst_id, $dbst_type, $dbst_kind, $query_type = 'add')
 {
     $dbst_type_data = self::get_dbst_type(0, $dbst_kind, $dbst_type);
     $kind_table = self::get_kind_table($dbst_kind);
     if ($query_type == 'add') {
         $options = self::get_field_options($dbst_id);
     }
     /** Configure dbst columns if add mode **/
     if ($query_type == 'add' and $dbst_type_data->options) {
         $dbst_type_options = json_decode($dbst_type_data->options, true);
         $q = '';
         foreach ($dbst_type_options as $key => $value) {
             $q .= "`{$key}`='{$value}',";
         }
         if (trim($q)) {
             wpl_db::q("UPDATE `#__wpl_dbst` SET " . trim($q, ', ') . " WHERE `id`='{$dbst_id}'");
         }
     }
     /** running all necessary queries **/
     if ($query_type == 'add') {
         $queries = $dbst_type_data->queries_add;
     } elseif ($query_type == 'delete') {
         $queries = $dbst_type_data->queries_delete;
     }
     $queries = explode(';', $queries);
     foreach ($queries as $query) {
         if (trim($query) == '') {
             continue;
         }
         $query = str_replace('[TABLE_NAME]', $kind_table, $query);
         $query = str_replace('[FIELD_ID]', $dbst_id, $query);
         /** Set default value if exists **/
         if (isset($options['default_value'])) {
             $query = str_replace('[DEFAULT_VALUE]', $options['default_value'], $query);
         }
         wpl_db::q($query);
     }
 }
コード例 #19
0
ファイル: room_types.php プロジェクト: amankatoch/wp-plugin
 /**
  * Adds a new room type
  * @author Howard <*****@*****.**>
  * @static
  * @param string $name
  * @return int
  */
 public static function save_room_type($name)
 {
     $query = "INSERT INTO `#__wpl_room_types` (`name`,`icon`) VALUES ('{$name}', 'default.png')";
     $id = wpl_db::q($query, 'insert');
     /** trigger event **/
     wpl_global::event_handler('room_type_added', array('id' => $id));
     return $id;
 }
コード例 #20
0
ファイル: extensions.php プロジェクト: amankatoch/wp-plugin
 /**
  * Uninstalling WPL
  * @author Howard <*****@*****.**>
  * @return boolean
  */
 public function uninstall_wpl()
 {
     $tables = wpl_db::select('SHOW TABLES');
     $database = wpl_db::get_DBO();
     foreach ($tables as $table_name => $table) {
         if (strpos($table_name, $database->prefix . 'wpl_') !== false) {
             /** drop table **/
             wpl_db::q("DROP TABLE `{$table_name}`");
         }
     }
     /** delete options **/
     wpl_db::q("DELETE FROM `#__options` WHERE `option_name` LIKE 'wpl_%' AND `option_name` NOT LIKE 'wpl_theme%'", 'delete');
     /** remove WPL upload directory **/
     if (function_exists('is_multisite') and is_multisite() and wpl_global::check_addon('multisite')) {
         $original_blog_id = wpl_global::get_current_blog_id();
         // Get all blogs
         $blogs = wpl_db::select("SELECT `blog_id` FROM `#__blogs`", 'loadColumn');
         foreach ($blogs as $blog) {
             if (!isset($blog->blog_id)) {
                 continue;
             }
             switch_to_blog($blog->blog_id);
             $upload_path = wpl_global::get_upload_base_path($blog->blog_id);
             if (wpl_folder::exists($upload_path)) {
                 wpl_folder::delete($upload_path);
             }
         }
         switch_to_blog($original_blog_id);
     } else {
         $upload_path = wpl_global::get_upload_base_path();
         if (wpl_file::exists($upload_path)) {
             wpl_file::delete($upload_path);
         }
     }
     return true;
 }
コード例 #21
0
 /**
  * save notification data
  * @author Kevin J <*****@*****.**> 
  * @static
  * @param array $data notification data to save reperesantion in arrray
  * @return boolean
  */
 public static function save_notification($data)
 {
     wpl_file::write(self::get_template_path($data['template_path'], true), $data['template']);
     $data = wpl_db::escape($data);
     $query = "UPDATE #__wpl_notifications SET `description` = '{$data['description']}',`template` = '{$data['template_path']}',";
     $query .= "`additional_emails` = '{$data['include_email']}',`additional_memberships` = '{$data['include_membership']}',`additional_users` = '{$data['include_user']}',`subject` = '{$data['subject']}' ";
     $query .= "WHERE id = {$data['id']}";
     return wpl_db::q($query);
 }
コード例 #22
0
ファイル: users.php プロジェクト: amankatoch/wp-plugin
 /**
  * Generate location text of User
  * @author Howard R <*****@*****.**>
  * @static
  * @param array $user_data
  * @param int $user_id
  * @param string $glue
  * @return string
  */
 public static function generate_location_text($user_data, $user_id = 0, $glue = ',')
 {
     /** fetch user data if user id is setted **/
     if ($user_id) {
         $user_data = (array) wpl_users::get_wpl_user($user_id);
     }
     if (!$user_id) {
         $user_id = $user_data['id'];
     }
     $locations = array();
     if (isset($user_data['location7_name']) and trim($user_data['location7_name']) != '') {
         $locations['location7_name'] = __($user_data['location7_name'], WPL_TEXTDOMAIN);
     }
     if (isset($user_data['location6_name']) and trim($user_data['location6_name']) != '') {
         $locations['location6_name'] = __($user_data['location6_name'], WPL_TEXTDOMAIN);
     }
     if (isset($user_data['location5_name']) and trim($user_data['location5_name']) != '') {
         $locations['location5_name'] = __($user_data['location5_name'], WPL_TEXTDOMAIN);
     }
     if (isset($user_data['location4_name']) and trim($user_data['location4_name']) != '') {
         $locations['location4_name'] = __($user_data['location4_name'], WPL_TEXTDOMAIN);
     }
     if (isset($user_data['location3_name']) and trim($user_data['location3_name']) != '') {
         $locations['location3_name'] = __($user_data['location3_name'], WPL_TEXTDOMAIN);
     }
     if (isset($user_data['location2_name']) and trim($user_data['location2_name']) != '') {
         $locations['location2_name'] = __($user_data['location2_name'], WPL_TEXTDOMAIN);
     }
     if (isset($user_data['zip_name']) and trim($user_data['zip_name']) != '') {
         $locations['zip_name'] = __($user_data['zip_name'], WPL_TEXTDOMAIN);
     }
     if (isset($user_data['location1_name']) and trim($user_data['location1_name']) != '') {
         $locations['location1_name'] = __($user_data['location1_name'], WPL_TEXTDOMAIN);
     }
     $location_pattern = wpl_global::get_setting('user_location_pattern');
     if (trim($location_pattern) == '') {
         $location_pattern = '[location5_name][glue][location4_name][glue][location3_name][glue][location2_name][glue][location1_name] [zip_name]';
     }
     $location_text = '';
     $location_text = isset($locations['location7_name']) ? str_replace('[location7_name]', $locations['location7_name'], $location_pattern) : str_replace('[location7_name]', '', $location_pattern);
     $location_text = isset($locations['location6_name']) ? str_replace('[location6_name]', $locations['location6_name'], $location_pattern) : str_replace('[location6_name]', '', $location_pattern);
     $location_text = isset($locations['location5_name']) ? str_replace('[location5_name]', $locations['location5_name'], $location_pattern) : str_replace('[location5_name]', '', $location_pattern);
     $location_text = isset($locations['location4_name']) ? str_replace('[location4_name]', $locations['location4_name'], $location_text) : str_replace('[location4_name]', '', $location_text);
     $location_text = isset($locations['location3_name']) ? str_replace('[location3_name]', $locations['location3_name'], $location_text) : str_replace('[location3_name]', '', $location_text);
     $location_text = isset($locations['location2_name']) ? str_replace('[location2_name]', $locations['location2_name'], $location_text) : str_replace('[location2_name]', '', $location_text);
     $location_text = isset($locations['zip_name']) ? str_replace('[zip_name]', $locations['zip_name'], $location_text) : str_replace('[zip_name]', '', $location_text);
     $location_text = isset($locations['location1_name']) ? str_replace('[location1_name]', $locations['location1_name'], $location_text) : str_replace('[location1_name]', '', $location_text);
     $location_text = str_replace('[glue]', $glue, $location_text);
     /** apply filters **/
     _wpl_import('libraries.filters');
     @extract(wpl_filters::apply('generate_user_location_text', array('location_text' => $location_text, 'glue' => $glue, 'user_data' => $user_data)));
     $final = '';
     $ex = explode($glue, $location_text);
     foreach ($ex as $value) {
         if (trim($value) == '') {
             continue;
         }
         $final .= trim($value) . $glue . ' ';
     }
     $location_text = trim($final, $glue . ' ');
     $column = 'location_text';
     $field_id = wpl_flex::get_dbst_id($column, 2);
     $field = wpl_flex::get_field($field_id);
     if (isset($field->multilingual) and $field->multilingual and wpl_global::check_multilingual_status()) {
         $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false);
     }
     /** update **/
     $query = "UPDATE `#__wpl_users` SET `{$column}`='" . $location_text . "' WHERE `id`='{$user_id}'";
     wpl_db::q($query, 'update');
     return $location_text;
 }
コード例 #23
0
ファイル: logs.php プロジェクト: gvh1993/project-vvvh
 /**
  * For deleting all logs
  * @author Matthew N. <*****@*****.**>
  * @return boolean
  */
 public static function delete_all_logs()
 {
     return wpl_db::q("DELETE FROM `#__wpl_logs`", 'delete');
 }