コード例 #1
0
ファイル: wpl_main.php プロジェクト: amankatoch/wp-plugin
 public function generate_addons()
 {
     $tpl = 'internal_addons';
     $this->addons = wpl_db::select("SELECT * FROM `#__wpl_addons` ORDER BY `id` ASC", 'loadAssocList');
     /** import tpl **/
     parent::render($this->tpl_path, $tpl);
 }
コード例 #2
0
ファイル: wpl_main.php プロジェクト: amankatoch/wp-plugin
 public function user_manager()
 {
     /** check permission **/
     wpl_global::min_access('administrator');
     $possible_orders = array('u.id', 'u.user_registered');
     $orderby = in_array(wpl_request::getVar('orderby'), $possible_orders) ? wpl_request::getVar('orderby') : $possible_orders[0];
     $order = in_array(strtoupper(wpl_request::getVar('order')), array('ASC', 'DESC')) ? wpl_request::getVar('order') : 'ASC';
     $page_size = trim(wpl_request::getVar('page_size')) != '' ? wpl_request::getVar('page_size') : NULL;
     $this->show_all = wpl_request::getVar('show_all', 0);
     $this->filter = wpl_request::getVar('filter', '');
     $this->membership_id = wpl_request::getVar('membership_id', '');
     $where_query = wpl_db::create_query();
     if (trim($this->filter)) {
         $where_query = " AND (`user_login` LIKE '%" . $this->filter . "%' OR `user_email` LIKE '%" . $this->filter . "%' OR `first_name` LIKE '%" . $this->filter . "%' OR `last_name` LIKE '%" . $this->filter . "%')";
     }
     if (trim($this->membership_id)) {
         $where_query = " AND `membership_id`='" . $this->membership_id . "'";
     }
     $num_result = wpl_db::num("SELECT COUNT(u.ID) FROM `#__users` AS u " . ($this->show_all ? 'LEFT' : 'INNER') . " JOIN `#__wpl_users` AS wpl ON u.ID = wpl.id WHERE 1 {$where_query}");
     $this->pagination = wpl_pagination::get_pagination($num_result, $page_size);
     $where_query .= " ORDER BY {$orderby} {$order} " . $this->pagination->limit_query;
     if ($this->show_all) {
         $this->wp_users = wpl_users::get_wp_users($where_query);
     } else {
         $this->wp_users = wpl_users::get_wpl_users($where_query);
     }
     $this->memberships = wpl_users::get_wpl_memberships();
     /** import tpl **/
     parent::render($this->tpl_path, $this->tpl);
 }
コード例 #3
0
ファイル: wpl_main.php プロジェクト: amankatoch/wp-plugin
 public function home()
 {
     /** check permission **/
     wpl_global::min_access('administrator');
     $this->level = trim(wpl_request::getVar('level')) != '' ? wpl_request::getVar('level') : 1;
     $this->parent = trim(wpl_request::getVar('sf_select_parent')) != '' ? wpl_request::getVar('sf_select_parent') : "";
     $this->enabled = trim(wpl_request::getVar('sf_select_enabled')) != '' ? wpl_request::getVar('sf_select_enabled') : 1;
     $this->text_search = trim(wpl_request::getVar('sf_text_name')) != '' ? wpl_request::getVar('sf_text_name') : '';
     $this->admin_url = wpl_global::get_wp_admin_url();
     $this->load_zipcodes = trim(wpl_request::getVar('load_zipcodes')) != '' ? 1 : 0;
     /** set show all based on level **/
     if ($this->level != 1) {
         $this->enabled = '';
     }
     $possible_orders = array('id', 'name');
     $orderby = in_array(wpl_request::getVar('orderby'), $possible_orders) ? wpl_request::getVar('orderby') : $possible_orders[0];
     $order = in_array(strtoupper(wpl_request::getVar('order')), array('ASC', 'DESC')) ? wpl_request::getVar('order') : 'ASC';
     $page_size = trim(wpl_request::getVar('page_size')) != '' ? wpl_request::getVar('page_size') : NULL;
     /** create where **/
     $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET'));
     $vars = array_merge($vars, array('sf_select_parent' => $this->parent, 'sf_select_enabled' => $this->enabled));
     $where_query = wpl_db::create_query($vars);
     $num_result = wpl_db::num("SELECT COUNT(id) FROM `#__wpl_location" . $this->level . "` WHERE 1 " . $where_query);
     $this->pagination = wpl_pagination::get_pagination($num_result, $page_size);
     $where_query .= " ORDER BY {$orderby} {$order} " . $this->pagination->limit_query;
     $this->wp_locations = wpl_locations::get_locations(!$this->load_zipcodes ? $this->level : 'zips', '', '', $where_query);
     $this->zipcode_parent_level = wpl_settings::get('zipcode_parent_level');
     /** import tpl **/
     parent::render($this->tpl_path, $this->tpl);
 }
コード例 #4
0
ファイル: sort_options.php プロジェクト: amankatoch/wp-plugin
 /**
  * Updates wpl_sort_options table
  * @author Howard <*****@*****.**>
  * @static
  * @param string $table
  * @param int $id
  * @param string $key
  * @param string $value
  * @return boolean
  */
 public static function update($table = 'wpl_sort_options', $id, $key, $value = '')
 {
     /** first validation **/
     if (trim($table) == '' or trim($id) == '' or trim($key) == '') {
         return false;
     }
     return wpl_db::set($table, $id, $key, $value);
 }
コード例 #5
0
ファイル: sort_options.php プロジェクト: gvh1993/project-vvvh
 /**
  * Updates wpl_sort_options table
  * @author Howard <*****@*****.**>
  * @static
  * @param string $table
  * @param int $id
  * @param string $key
  * @param string $value
  * @return boolean
  */
 public static function update($table = 'wpl_sort_options', $id, $key, $value = '')
 {
     /** first validation **/
     if (trim($table) == '' or trim($id) == '' or trim($key) == '') {
         return false;
     }
     /** trigger event **/
     wpl_global::event_handler('sort_options_updated', array('id' => $id, 'key' => $value));
     return wpl_db::set($table, $id, $key, $value);
 }
コード例 #6
0
ファイル: wpl_ajax.php プロジェクト: gvh1993/project-vvvh
 private function locationtextsearch_autocomplete($term)
 {
     $limit = 10;
     $query = "SELECT `count`, `location_text` AS name FROM `#__wpl_locationtextsearch` WHERE `location_text` LIKE '" . $term . "%' ORDER BY `count` DESC LIMIT " . $limit;
     $results = wpl_db::select($query, 'loadAssocList');
     $output = array();
     foreach ($results as $result) {
         $output[] = array('label' => $result['name'], 'value' => $result['name']);
     }
     echo json_encode($output);
     exit;
 }
コード例 #7
0
ファイル: wpl_main.php プロジェクト: gvh1993/project-vvvh
 public function modify()
 {
     $this->notification = wpl_notifications::get_notifications("AND `id`='" . wpl_db::escape($this->id) . "'", 'loadObject');
     $this->additional_memberships = explode(',', $this->notification->additional_memberships);
     $this->additional_users = explode(',', $this->notification->additional_users);
     $this->additional_emails = explode(',', $this->notification->additional_emails);
     $this->users = wpl_users::get_wpl_users();
     $this->memberships = wpl_users::get_wpl_memberships();
     $this->memberships_array = self::unset_additional_receipts($this->additional_memberships, $this->memberships);
     $this->users_array = self::unset_additional_receipts($this->additional_users, $this->users);
     $this->template_path = wpl_notifications::get_template_path($this->notification->template);
     $this->template = wpl_notifications::get_template_content($this->template_path, true);
     $this->template = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">' . $this->template;
     parent::render($this->tpl_path, $this->tpl);
 }
コード例 #8
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;
 }
コード例 #9
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;
 }
コード例 #10
0
ファイル: global.php プロジェクト: gvh1993/project-vvvh
 /**
  * Returns column with multilingual columns
  * @author Howard <*****@*****.**>
  * @static
  * @param array $columns
  * @param string $table
  * @return array
  */
 public static function get_multilingual_columns($columns, $validation = true, $table = 'wpl_properties')
 {
     if (wpl_global::check_multilingual_status()) {
         $valid_columns = wpl_db::columns($table);
         $languages = wpl_addon_pro::get_wpl_languages();
         foreach ($columns as $column) {
             foreach ($languages as $language) {
                 $language_column = wpl_addon_pro::get_column_lang_name($column, $language, false);
                 if ($validation and in_array($language_column, $valid_columns)) {
                     $columns[] = $language_column;
                 } elseif (!$validation) {
                     $columns[] = $language_column;
                 }
             }
         }
     }
     return $columns;
 }
コード例 #11
0
ファイル: filters.php プロジェクト: gvh1993/project-vvvh
 /**
  * Gets filters by trigger and enabled status
  * @author Howard <*****@*****.**>
  * @param string $trigger
  * @param int $enabled
  * @return array
  */
 public static function get_filters($trigger, $enabled = 1)
 {
     $query = "SELECT * FROM `#__wpl_filters` WHERE `trigger`='{$trigger}' AND `enabled`>='{$enabled}'";
     return wpl_db::select($query);
 }
コード例 #12
0
ファイル: wpl_ajax.php プロジェクト: gvh1993/project-vvvh
 /**
  * load activity options such a layout and options
  * @param string $activity_name Activity name
  * @param string $current_layout current selected layout for this activity
  */
 private function load_options($activity_name, $current_layout)
 {
     $current_activity = wpl_activity::get_activity("AND `activity`='" . wpl_db::escape($activity_name) . "'");
     $current_activity = wpl_activity::get_activity_name_layout($current_activity->activity);
     $returnData = array();
     $optionPath = wpl_activity::get_activity_option_form($activity_name);
     $returnData['layouts'] = wpl_activity::load_layouts_html($activity_name, $current_layout);
     if ($optionPath) {
         ob_start();
         include $optionPath;
         $returnData['options'] = ob_get_contents();
         ob_end_clean();
     } else {
         $returnData['options'] = __("This activity doesn't have options!", WPL_TEXTDOMAIN);
     }
     echo json_encode($returnData);
     exit;
 }
コード例 #13
0
 /**
  * Checks if a property type has properties or not
  * @author Howard R <*****@*****.**>
  * @static
  * @param int $property_type_id
  * @return int
  */
 public static function have_properties($property_type_id)
 {
     $query = "SELECT count(`id`) as 'id' FROM `#__wpl_properties` WHERE `property_type`='{$property_type_id}'";
     $res = wpl_db::select($query, 'loadAssoc');
     return $res['id'];
 }
コード例 #14
0
 private function forget_password()
 {
     $error_array = array();
     $error_array['authentication'] = array('type' => 'forget_password', 'status' => 'false');
     $db = wpl_db::get_DBO();
     $user_login = wpl_db::sanitize($this->username);
     if (trim($user_login) == '') {
         return $error_array;
     } elseif (strpos($user_login, '@')) {
         $user_data = wpl_users::get_user_by('email', $user_login);
         if (trim($user_data) == '') {
             return $error_array;
         }
     } else {
         $login = trim($user_login);
         $user_data = wpl_users::get_user_by('login', $login);
     }
     do_action('lostpassword_post');
     if (!$user_data) {
         return $this->failed_array;
     }
     $user_login = $user_data->user_login;
     $user_email = $user_data->user_email;
     do_action('retreive_password', $user_login);
     do_action('retrieve_password', $user_login);
     $allow = apply_filters('allow_password_reset', true, $user_data->ID);
     if (is_wp_error($allow)) {
         return $error_array;
     }
     $key = wpl_global::generate_password(20, false);
     do_action('retrieve_password_key', $user_login, $key);
     $hashed = wpl_global::wpl_hasher(8, $key);
     wpl_db::update('users', array('user_activation_key' => $hashed), 'user_login', $user_login);
     $message = __('Someone requested that the password be reset for the following account:', WPL_TEXTDOMAIN) . "\r\n";
     $message .= network_home_url('/') . "\r\n";
     $message .= sprintf(__('Username: %s', WPL_TEXTDOMAIN), $user_login) . "\r\n";
     $message .= __('If this was a mistake, just ignore this email and nothing will happen.', WPL_TEXTDOMAIN) . "\r\n";
     $message .= __('To reset your password, visit the following address:', WPL_TEXTDOMAIN) . "\r\n";
     $message .= '<' . network_site_url("wp-login.php?action=rp&key={$key}&login="******">\r\n";
     if (is_multisite()) {
         $blogname = $GLOBALS['current_site']->site_name;
     } else {
         $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     }
     $title = sprintf(__('[%s] Password Reset', WPL_TEXTDOMAIN), $blogname);
     $title = apply_filters('retrieve_password_title', $title);
     $message = apply_filters('retrieve_password_message', $message, $key);
     if ($message && !wp_mail($user_email, $title, $message)) {
         return $error_array;
     }
     $this->built['authentication'] = array('type' => 'forget_password', 'status' => 'true');
     return $this->built;
 }
コード例 #15
0
ファイル: locations.php プロジェクト: gvh1993/project-vvvh
 /**
  * Returns abbreviation by location name
  * @author Howard <*****@*****.**>
  * @static
  * @param string $name
  * @param int $location_level
  * @return string
  */
 public static function get_location_abbr_by_name($name, $location_level = 1)
 {
     /** First Validation **/
     if (!$location_level) {
         $location_level = 1;
     }
     if ($location_level == 'zips') {
         return $name;
     }
     $abbr = wpl_db::select("SELECT `abbr` FROM `#__wpl_location" . $location_level . "` WHERE LOWER(`name`)='" . strtolower($name) . "'", 'loadResult');
     return trim($abbr) ? $abbr : $name;
 }
コード例 #16
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;
 }
コード例 #17
0
} else {
    echo __('No data!', WPL_TEXTDOMAIN);
}
?>
        </div>
    </div>
</div>
<div class="side-6 side-statistic2">
    <div class="panel-wp">
        <h3><?php 
echo __('Properties by property types', WPL_TEXTDOMAIN);
?>
</h3>
        <div class="panel-body">
        	<?php 
$properties = wpl_db::select("SELECT COUNT(*) as count, `property_type` FROM `#__wpl_properties` WHERE `finalized`='1' AND `expired`='0' AND `confirmed`='1' AND `deleted`='0' AND `property_type`!='0' GROUP BY `property_type`", 'loadAssocList');
$data = array();
$total = 0;
foreach ($properties as $property) {
    $property_type = wpl_global::get_property_types($property['property_type']);
    if (is_object($property_type)) {
        $data[__($property_type->name, WPL_TEXTDOMAIN)] = $property['count'];
        $total += $property['count'];
    }
}
$params = array('chart_background' => '#fafafa', 'chart_width' => '100%', 'chart_height' => '250px', 'show_value' => 1, 'data' => $data);
if (count($data)) {
    echo '<div class="wpl-total-properties">' . sprintf(__('Total Properties: %s', WPL_TEXTDOMAIN), $total) . '</div>';
    wpl_global::import_activity('charts:bar', '', $params);
} else {
    echo __('No data!', WPL_TEXTDOMAIN);
コード例 #18
0
ファイル: room_types.php プロジェクト: amankatoch/wp-plugin
 /**
  * Get a room type by name
  * @author Howard <*****@*****.**>
  * @static
  * @param string $name
  * @return array
  */
 public static function get_room_type($name)
 {
     $query = "SELECT * FROM `#__wpl_room_types` WHERE `name`='{$name}' LIMIT 1";
     return wpl_db::select($query, 'loadAssoc');
 }
コード例 #19
0
ファイル: main.php プロジェクト: amankatoch/wp-plugin
 private function query($instance)
 {
     /** property listing model **/
     $model = new wpl_property();
     $data = $instance['data'];
     $this->start = 0;
     $this->limit = $data['limit'];
     $this->orderby = urldecode($data['orderby']);
     $this->order = $data['order'];
     /** detect kind **/
     if (isset($data['kind']) and (trim($data['kind']) != '' or trim($data['kind']) != '-1')) {
         $kind = $data['kind'];
     } else {
         $kind = 0;
     }
     $where = array('sf_select_confirmed' => 1, 'sf_select_finalized' => 1, 'sf_select_deleted' => 0, 'sf_select_expired' => 0, 'sf_select_kind' => $kind);
     if (trim($data['listing']) and $data['listing'] != '-1') {
         $where['sf_select_listing'] = $data['listing'];
     }
     if (trim($data['property_type']) and $data['property_type'] != '-1') {
         $where['sf_select_property_type'] = $data['property_type'];
     }
     if (trim($data['property_ids'])) {
         $where['sf_multiple_id'] = trim($data['property_ids'], ', ');
     }
     if (trim($data['only_featured'])) {
         $where['sf_select_sp_featured'] = 1;
     }
     if (trim($data['only_hot'])) {
         $where['sf_select_sp_hot'] = 1;
     }
     if (trim($data['only_openhouse'])) {
         $where['sf_select_sp_openhouse'] = 1;
     }
     if (trim($data['only_forclosure'])) {
         $where['sf_select_sp_forclosure'] = 1;
     }
     /** Parent **/
     if (isset($data['parent']) and trim($data['parent'])) {
         $where['sf_parent'] = $data['parent'];
     }
     if (isset($data['auto_parent']) and trim($data['auto_parent'])) {
         /** current proeprty id - This features works only in single property page **/
         $property_data = NULL;
         $pid = wpl_request::getVar('pid', 0);
         if ($pid) {
             $property_data = $model->get_property_raw_data($pid);
         }
         if (isset($property_data['mls_id'])) {
             $where['sf_parent'] = $property_data['mls_id'];
         }
     }
     if (isset($data['random']) and trim($data['random']) and trim($data['property_ids']) == '') {
         $query_rand = "SELECT p.`id` FROM `#__wpl_properties` AS p WHERE 1 " . wpl_db::create_query($where) . " ORDER BY RAND() LIMIT " . $this->limit;
         $results = wpl_db::select($query_rand);
         $rand_ids = array();
         foreach ($results as $result) {
             $rand_ids[] = $result->id;
         }
         $where['sf_multiple_id'] = implode(',', $rand_ids);
     }
     /** Similar properties **/
     if (isset($data['sml_only_similars']) and $data['sml_only_similars']) {
         $sml_where = array('sf_select_confirmed' => 1, 'sf_select_finalized' => 1, 'sf_select_deleted' => 0, 'sf_select_expired' => 0);
         /** current proeprty id - This features works only in single property page **/
         $pid = wpl_request::getVar('pid', 0);
         $property_data = wpl_property::get_property_raw_data($pid);
         if ($property_data) {
             $sml_where['sf_notselect_id'] = $pid;
             $sml_where['sf_select_kind'] = $property_data['kind'];
             if (isset($data['sml_inc_listing']) and $data['sml_inc_listing']) {
                 $sml_where['sf_select_listing'] = $property_data['listing'];
             }
             if (isset($data['sml_inc_property_type']) and $data['sml_inc_property_type']) {
                 $sml_where['sf_select_property_type'] = $property_data['property_type'];
             }
             if (isset($data['sml_inc_price']) and $data['sml_inc_price']) {
                 $down_rate = $data['sml_price_down_rate'] ? $data['sml_price_down_rate'] : 0.8;
                 $up_rate = $data['sml_price_up_rate'] ? $data['sml_price_up_rate'] : 1.2;
                 $price_down_range = $property_data['price_si'] * $down_rate;
                 $price_up_range = $property_data['price_si'] * $up_rate;
                 $sml_where['sf_tmin_price_si'] = $price_down_range;
                 $sml_where['sf_tmax_price_si'] = $price_up_range;
             }
             if (isset($data['sml_inc_radius']) and $data['sml_inc_radius']) {
                 $latitude = $property_data['googlemap_lt'];
                 $longitude = $property_data['googlemap_ln'];
                 $radius = $data['sml_radius'];
                 $unit_id = $data['sml_radius_unit'];
                 if ($latitude and $longitude and $radius and $unit_id) {
                     $sml_where['sf_radiussearchunit'] = $unit_id;
                     $sml_where['sf_radiussearch_lat'] = $latitude;
                     $sml_where['sf_radiussearch_lng'] = $longitude;
                     $sml_where['sf_radiussearchradius'] = $radius;
                 }
             }
         }
         /** overwrite $where if similar where is correct **/
         if (count($sml_where) > 3) {
             $where = $sml_where;
         }
     }
     /** start search **/
     $model->start($this->start, $this->limit, $this->orderby, $this->order, $where);
     /** run the search **/
     return $model->query();
 }
コード例 #20
0
ファイル: draw_search.php プロジェクト: gvh1993/project-vvvh
        $longitude = isset($vars['sf_radiussearch_lng']) ? $vars['sf_radiussearch_lng'] : 0;
    }
    if ($latitude and $longitude and $radius and $unit_id) {
        $unit = wpl_units::get_unit($unit_id);
        if ($unit) {
            $tosi = 6371 * 1000 / $unit['tosi'];
            $radius_si = $radius * $unit['tosi'];
            $query .= " AND (( " . $tosi . " * acos( cos( radians(" . $latitude . ") ) * cos( radians( googlemap_lt ) ) * cos( radians( googlemap_ln ) - radians(" . $longitude . ") ) + sin( radians(" . $latitude . ") ) * sin( radians( googlemap_lt ) ) ) ) < " . $radius . ") AND `show_address`='1'";
        }
    }
    $done_this = true;
} elseif ($format == 'polygonsearch' and wpl_global::check_addon('aps') and !$done_this) {
    /** importing library **/
    _wpl_import('libraries.addon_aps');
    $raw_points = isset($vars['sf_polygonsearchpoints']) ? $vars['sf_polygonsearchpoints'] : '[]';
    if (version_compare(wpl_db::version(), '5.6.1', '>=')) {
        $sql_function = 'ST_Contains';
    } else {
        $sql_function = 'Contains';
    }
    $APS = new wpl_addon_aps();
    $polygons = $APS->toPolygons($raw_points);
    $qq = array();
    foreach ($polygons as $polygon) {
        $polygon_str = '';
        foreach ($polygon as $polygon_point) {
            $polygon_str .= $polygon_point[1] . ' ' . $polygon_point[0] . ', ';
        }
        $polygon_str = trim($polygon_str, ', ');
        $qq[] = $sql_function . "(GeomFromText('Polygon((" . $polygon_str . "))'), geopoints) = 1";
    }
コード例 #21
0
ファイル: wpl_ajax.php プロジェクト: amankatoch/wp-plugin
 private function delete_file($field_id, $user_id, $output = true)
 {
     $field_data = (array) wpl_db::get('*', 'wpl_dbst', 'id', $field_id);
     $user_data = (array) wpl_users::get_wpl_user($user_id);
     $path = wpl_items::get_path($user_id, $field_data['kind']) . $user_data[$field_data['table_column']];
     /** delete file and reset db **/
     wpl_file::delete($path);
     wpl_db::set('wpl_users', $user_id, $field_data['table_column'], '');
     /** delete thumbnails **/
     wpl_users::remove_thumbnails($user_id);
     /** called from other functions (upload function) **/
     if (!$output) {
         return;
     }
     $res = 1;
     $message = $res ? __('Saved.', WPL_TEXTDOMAIN) : __('Error Occured.', WPL_TEXTDOMAIN);
     $data = NULL;
     $response = array('success' => $res, 'message' => $message, 'data' => $data);
     echo json_encode($response);
     exit;
 }
コード例 #22
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;
 }
コード例 #23
0
ファイル: flex.php プロジェクト: gvh1993/project-vvvh
 /**
  * Sorts flex fields
  * @author Howard R <*****@*****.**>
  * @static
  * @param string $sort_ids
  */
 public static function sort_flex($sort_ids)
 {
     $query = "SELECT DISTINCT `category`  FROM `#__wpl_dbst` WHERE `id` IN ({$sort_ids}) ORDER BY `index` ASC";
     $flex_category = wpl_db::select($query, 'loadAssoc');
     $conter = 0;
     $ex_sort_ids = explode(',', $sort_ids);
     foreach ($ex_sort_ids as $ex_sort_id) {
         if ($conter < 10) {
             $index = $flex_category["category"] . '.0' . $conter;
         } else {
             $index = $flex_category["category"] . '.' . $conter;
         }
         self::update('wpl_dbst', $ex_sort_id, 'index', $index);
         $conter++;
     }
 }
コード例 #24
0
ファイル: items.php プロジェクト: amankatoch/wp-plugin
 /**
  * Returns maximum index for sorting a new item
  * @author Howard R <*****@*****.**>
  * @static
  * @param int $parent_id
  * @param string $item_type
  * @param int $parent_kind
  * @param mixed $category
  * @param int $enabled
  * @param string $condition
  * @return int
  */
 public static function get_maximum_index($parent_id, $item_type = '', $parent_kind = 0, $category = '', $enabled = '', $condition = '')
 {
     /** first validation **/
     if (trim($parent_id) == '') {
         return NULL;
     }
     if (trim($condition) == '') {
         $condition = "";
         $condition .= " AND `parent_id`='{$parent_id}' AND `parent_kind`='{$parent_kind}'";
         if (trim($item_type) != '') {
             $condition .= " AND `item_type`='{$item_type}'";
         }
         if (trim($category) != '') {
             $condition .= " AND `item_cat`='{$category}'";
         }
         if (trim($enabled) != '') {
             $condition .= " AND `enabled`>='{$enabled}'";
         }
     }
     $query = "SELECT MAX(`index`) as max FROM `#__wpl_items` WHERE 1 " . $condition;
     $index = wpl_db::select($query, 'loadObject');
     return $index->max;
 }
コード例 #25
0
                if (trim($value_raw) == '') {
                    continue;
                }
                $value_raw = trim($value_raw);
                if (strlen($value_raw) == 2 and $l <= 2) {
                    $value_raw = wpl_locations::get_location_name_by_abbr($value_raw, $l);
                }
                $ex_space = explode(' ', $value_raw);
                foreach ($ex_space as $value_raw) {
                    array_push($values, $value_raw);
                }
            }
            if (count($values)) {
                $qqq = array();
                $qq = array();
                $column = 'textsearch';
                /** Multilingual location text search **/
                if (wpl_global::check_multilingual_status()) {
                    $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false);
                }
                foreach ($values as $val) {
                    $qq[] = " `{$column}` LIKE '%LOC-" . wpl_db::escape($val) . "%' ";
                }
                $qqq[] = '(' . implode(' AND ', $qq) . ')';
                $qqqq[] = '(' . implode(' OR ', $qqq) . ')';
            }
        }
        $query .= " AND (" . implode(' OR ', $qqqq) . ") AND `show_address`='1'";
    }
    $done_this = true;
}
コード例 #26
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);
 }
コード例 #27
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;
 }
コード例 #28
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);
 }
コード例 #29
0
ファイル: users.php プロジェクト: amankatoch/wp-plugin
 /**
  * Validate activation key
  * @author Howard <*****@*****.**>
  * @static
  * @param string $key
  * @return int User ID
  */
 public static function validate_activation_key($key)
 {
     /** first validation **/
     if (!trim($key)) {
         return 0;
     }
     $query = "SELECT `id` FROM `#__users` WHERE `user_activation_key`='{$key}'";
     $id = wpl_db::select($query, 'loadResult');
     if ($id) {
         return $id;
     }
     return 0;
 }
コード例 #30
0
ファイル: logs.php プロジェクト: amankatoch/wp-plugin
 /**
  * For inserting logs using WPL events API
  * @author Howard R <*****@*****.**>
  * @static
  * @param array $params
  * @return int
  */
 public static function autolog($params = array())
 {
     $dynamic_params = $params[0];
     $static_params = $params[1];
     $section = isset($static_params['section']) ? $static_params['section'] : 'no-section';
     $addon_id = isset($static_params['addon_id']) ? $static_params['addon_id'] : 0;
     $user_id = isset($static_params['user_id']) ? $static_params['user_id'] : NULL;
     $status = isset($static_params['status']) ? $static_params['status'] : 1;
     $priority = isset($static_params['priority']) ? $static_params['priority'] : 3;
     if ($static_params['type'] == 1) {
     } elseif ($static_params['type'] == 2) {
         $query = str_replace('[VALUE]', $dynamic_params, $static_params['pattern']);
         $contents = wpl_db::select($query, 'loadAssoc');
         $log_text = $static_params['message'];
         foreach ($contents as $key => $value) {
             $log_text = str_replace('[' . $key . ']', $value, $log_text);
         }
     }
     return self::add($log_text, $section, $status, $user_id, $addon_id, $priority);
 }