Ejemplo n.º 1
0
 function __construct($username, $password, $vars, $settings)
 {
     /** smart set of settings **/
     foreach ($settings as $setting => $setval) {
         if ($setval != '') {
             $this->settings[$setting] = $setval;
         }
     }
     // Authenticating
     if ($username != '') {
         $authenticate = wpl_users::authenticate($username, $password);
         if ($authenticate['status'] != 1) {
             $this->error = "ERROR: Authentication failed!";
             return false;
         }
         $this->uid = $authenticate['uid'];
     } else {
         $this->uid = 0;
     }
     if (!wpl_global::check_access($this->settings['access_view'], $this->uid)) {
         $this->error = "ERROR: No access to the command!";
         return false;
     }
     $this->access = $vars['access'];
 }
Ejemplo n.º 2
0
 function __construct($username, $password, $vars, $settings)
 {
     /** smart set of settings **/
     foreach ($settings as $setting => $setval) {
         if ($setval != '') {
             $this->settings[$setting] = $setval;
         }
     }
     // Authenticating
     if ($username != '') {
         $authenticate = wpl_users::authenticate($username, $password);
         if ($authenticate['status'] != 1) {
             $this->error = "ERROR: Authentication failed!";
             return false;
         }
         $this->uid = $authenticate['uid'];
     } else {
         $this->uid = 0;
     }
     if (!wpl_global::check_access($this->settings['access_view'], $this->uid)) {
         $this->error = "ERROR: No access to the command!";
         return false;
     }
     // Checking essential vars
     if (!isset($vars['pid']) or trim($vars['pid']) == '') {
         $this->error = "ERROR: No property id set!";
         return false;
     }
     $this->pid = $vars['pid'];
     $this->image_sizes = trim($vars['image_sizes']) != '' ? explode('-', $vars['image_sizes']) : '';
 }
Ejemplo n.º 3
0
 public function display($instance = array())
 {
     $this->uid = wpl_request::getVar('uid', 0);
     if (!$this->uid) {
         $this->uid = wpl_request::getVar('sf_select_user_id', 0);
         wpl_request::setVar('uid', $this->uid);
     }
     /** check user id **/
     if (!$this->uid) {
         /** import message tpl **/
         $this->message = __("No profile found or it's not available now!", WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message', false, true);
     }
     /** set the user id to search credentials **/
     wpl_request::setVar('sf_select_user_id', $this->uid);
     /** set the kind **/
     $this->kind = wpl_request::getVar('kind', '0');
     wpl_request::setVar('kind', $this->kind);
     /** User Type **/
     $this->user_type = wpl_users::get_user_user_type($this->uid);
     /** trigger event **/
     wpl_global::event_handler('profile_show', array('id' => $this->uid, 'kind' => $this->kind));
     /** import tpl **/
     $this->tpl = wpl_users::get_user_type_tpl($this->tpl_path, $this->tpl, $this->user_type);
     /** import tpl **/
     return parent::render($this->tpl_path, $this->tpl, false, true);
 }
Ejemplo n.º 4
0
 /**
  * Service runner
  * @author Howard <*****@*****.**>
  * @return void
  */
 public function run()
 {
     $wpl_format = wpl_request::getVar('wpl_format');
     if (trim($wpl_format) == '') {
         return;
     }
     /** add listing menu **/
     if ($wpl_format == 'b:listing:ajax') {
         $wpl_function = wpl_request::getVar('wpl_function');
         if ($wpl_function == 'save') {
             $table_name = wpl_request::getVar('table_name');
             $table_column = wpl_request::getVar('table_column');
             $value = wpl_request::getVar('value');
             /** for checking limitation on feature and hot tag **/
             if (($table_column == 'sp_featured' or $table_column == 'sp_hot') and $value == 1) {
                 _wpl_import('libraries.property');
                 $current_user_id = wpl_users::get_cur_user_id();
                 $user_data = wpl_users::get_wpl_user($current_user_id);
                 $user_limit = $table_column == 'sp_featured' ? $user_data->maccess_num_feat : $user_data->maccess_num_hot;
                 $model = new wpl_property();
                 $used = $model->get_properties_count(" AND `user_id`='{$current_user_id}' AND `{$table_column}`='1'");
                 if ($used >= $user_limit and $user_limit != '-1') {
                     self::response(array('success' => '0', 'message' => '', 'data' => '', 'js' => "wplj(form_element_id).prop('checked', false); wpl_alert(\"" . __('Your membership limit reached. contact to administrator if you want to upgrade!', WPL_TEXTDOMAIN) . "\");"));
                 }
             }
         }
     }
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
 /**
  * For inserting logs in the logs table
  * @author Howard R <*****@*****.**>
  * @static
  * @param string $log_text
  * @param string $section
  * @param int $status
  * @param int $user_id
  * @param int $addon_id
  * @param int $priority
  * @param array $params
  * @return int
  */
 public static function add($log_text, $section = '', $status = 1, $user_id = '', $addon_id = '', $priority = 3, $params = array())
 {
     if (trim($log_text) == '') {
         return 0;
     }
     /** set parameters **/
     $section = trim($section) != '' ? $section : 'no section';
     $status = trim($status) != '' ? $status : 1;
     $user_id = trim($user_id) != '' ? $user_id : wpl_users::get_cur_user_id();
     $addon_id = trim($addon_id) != '' ? $addon_id : 0;
     $log_date = date("Y-m-d H:i:s");
     $ip = wpl_users::get_current_ip();
     $params = json_encode($params);
     $query = "INSERT INTO `#__wpl_logs` (`user_id`,`addon_id`,`section`,`status`,`log_text`,`log_date`,`ip`,`priority`,`params`) VALUES ('{$user_id}','{$addon_id}','{$section}','{$status}','{$log_text}','{$log_date}','{$ip}','{$priority}','{$params}');";
     return wpl_db::q($query, 'insert');
 }
Ejemplo n.º 8
0
 /**
  * User Contact activity. It's for contacting to user directly from profile show page
  * @author Howard <*****@*****.**>
  * @static
  * @param type $params
  * @return boolean
  */
 public static function contact_profile($params)
 {
     $replacements = $params[0];
     $notification = new wpl_notifications('email');
     $notification->prepare(3, $replacements);
     /** Disabled **/
     if (!$notification->notification_data['enabled']) {
         return false;
     }
     $user = wpl_users::get_user($params[0]['user_id']);
     $notification->replacements = $notification->set_replacements($replacements);
     $notification->rendered_content = $notification->render_notification_content();
     $notification->recipients = $notification->set_recipients(array($user->data->user_email));
     $notification->send();
     return true;
 }
Ejemplo n.º 9
0
 public function wizard($instance = array())
 {
     /** load assets **/
     $this->load_assets();
     /** check access **/
     if (!wpl_users::check_access('propertywizard')) {
         /** import message tpl **/
         $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message');
     }
     $this->kind = trim(wpl_request::getVar('kind')) != '' ? wpl_request::getVar('kind') : 0;
     $this->property_id = trim(wpl_request::getVar('pid')) != '' ? wpl_request::getVar('pid') : 0;
     $this->mode = $this->property_id ? 'edit' : 'add';
     if ($this->mode == 'add') {
         /** checking access **/
         if (!wpl_users::check_access($this->mode)) {
             $this->message = __("Limit reached. You can not add more property!", WPL_TEXTDOMAIN);
             return parent::render($this->tpl_path, 'message');
         }
         /** generate new property **/
         $this->property_id = wpl_property::create_property_default('', $this->kind);
     }
     $this->values = wpl_property::get_property_raw_data($this->property_id);
     $this->finalized = isset($this->values['finalized']) ? $this->values['finalized'] : 0;
     $this->kind = isset($this->values['kind']) ? $this->values['kind'] : 0;
     $this->field_categories = wpl_flex::get_categories(0, $this->kind);
     $this->kind_label = wpl_flex::get_kind_label($this->kind);
     if ($this->mode == 'edit') {
         if (!$this->values) {
             $this->message = __("Property does not exist!", WPL_TEXTDOMAIN);
             return parent::render($this->tpl_path, 'message');
         }
         /** checking access **/
         if (!wpl_users::check_access($this->mode, $this->values['user_id'])) {
             $this->message = __("You can not edit this property.", WPL_TEXTDOMAIN);
             return parent::render($this->tpl_path, 'message');
         }
     }
     /** import tpl **/
     $this->tpl = wpl_flex::get_kind_tpl($this->tpl_path, 'wizard', $this->kind);
     parent::render($this->tpl_path, $this->tpl);
 }
Ejemplo n.º 10
0
 public function profile($instance = array())
 {
     /** check access **/
     if (!wpl_users::check_access('profilewizard')) {
         /** import message tpl **/
         $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message');
     }
     _wpl_import('libraries.flex');
     $this->tpl = 'profile';
     $this->kind = wpl_flex::get_kind_id('user');
     $this->user_id = wpl_users::get_cur_user_id();
     if (wpl_users::is_administrator($this->user_id) and wpl_request::getVar('id', 0)) {
         $this->user_id = wpl_request::getVar('id');
     }
     $this->user_fields = wpl_flex::get_fields('', 1, $this->kind, 'pwizard', 1);
     $this->user_data = (array) wpl_users::get_wpl_data($this->user_id);
     /** import tpl **/
     parent::render($this->tpl_path, $this->tpl);
 }
Ejemplo n.º 11
0
 /**
  * Sends welcome email to user after registeration
  * @author Howard <*****@*****.**>
  * @static
  * @param array $params
  * @return boolean
  */
 public static function user_registered($params)
 {
     $replacements = $params[0];
     $notification = new wpl_notifications('email');
     $notification->prepare(5, $replacements);
     /** Disabled **/
     if (!$notification->notification_data['enabled']) {
         return false;
     }
     $user = wpl_users::get_user($params[0]['user_id']);
     $replacements['name'] = isset($user->data->wpl_data) ? $user->data->wpl_data->first_name : $user->data->display_name;
     $replacements['password'] = $params[0]['password'];
     $replacements['username'] = $user->data->user_login;
     $link = wpl_global::get_wp_site_url();
     $replacements['site_address'] = '<a target="_blank" href="' . $link . '">' . $link . '</a>';
     $notification->replacements = $notification->set_replacements($replacements);
     $notification->rendered_content = $notification->render_notification_content();
     $notification->recipients = $notification->set_recipients(array($user->data->user_email));
     $notification->send();
     return true;
 }
Ejemplo n.º 12
0
 /**
  * Initialization the commands before build
  * @param string $username
  * @param string $password
  * @param array $params
  * @return boolean
  */
 public function init($username, $password, $params)
 {
     if ($this->initialization == false) {
         return;
     }
     $this->username = $username;
     $this->password = base64_decode($password);
     $this->params = $params;
     if ($this->authentication) {
         if ($username != '') {
             $authenticate = wpl_users::authenticate($username, $password);
             if ($authenticate['status'] != 1) {
                 $this->error = "Authentication failed!";
                 return false;
             }
             $this->user_id = $authenticate['uid'];
         } else {
             $this->user_id = 0;
         }
     }
 }
Ejemplo n.º 13
0
 /**
  * Generates wizard form using dbst fields
  * @author Howard R <*****@*****.**>
  * @param objects $fields
  * @param array $values
  * @param int $item_id
  * @param array $finds
  * @return void
  */
 public function generate_wizard_form($fields, $values, $item_id = 0, &$finds = array())
 {
     /** first validation **/
     if (!$fields) {
         return;
     }
     /** get files **/
     $path = WPL_ABSPATH . DS . 'libraries' . DS . 'dbst_wizard';
     $files = array();
     if (wpl_folder::exists($path)) {
         $files = wpl_folder::files($path, '.php$', false, false);
     }
     $wpllangs = wpl_global::check_multilingual_status() ? wpl_addon_pro::get_wpl_languages() : array();
     $has_more_details = false;
     foreach ($fields as $key => $field) {
         if (!$field) {
             return;
         }
         $done_this = false;
         $type = $field->type;
         $label = $field->name;
         $mandatory = $field->mandatory;
         $options = json_decode($field->options, true);
         $value = isset($values[$field->table_column]) ? stripslashes($values[$field->table_column]) : NULL;
         $kind = isset($values['kind']) ? $values['kind'] : NULL;
         $display = '';
         /** Specific **/
         if (trim($field->listing_specific) != '') {
             $specified_listings = explode(',', trim($field->listing_specific, ', '));
             self::$category_listing_specific_array[$field->id] = $specified_listings;
             if (!in_array($values['listing'], $specified_listings)) {
                 $display = 'display: none;';
             }
         } elseif (trim($field->property_type_specific) != '') {
             $specified_property_types = explode(',', trim($field->property_type_specific, ', '));
             self::$category_property_type_specific_array[$field->id] = $specified_property_types;
             if (!in_array($values['property_type'], $specified_property_types)) {
                 $display = 'display: none;';
             }
         } elseif (trim($field->user_specific) != '') {
             $specified_user_types = explode(',', trim($field->user_specific, ', '));
             self::$category_user_specific_array[$field->id] = $specified_user_types;
             if (!in_array($values['membership_type'], $specified_user_types)) {
                 $display = 'display: none;';
             }
         } elseif (isset($options['access'])) {
             foreach ($options['access'] as $access) {
                 if (!wpl_global::check_access($access)) {
                     $display = 'display: none;';
                     break;
                 }
             }
         }
         /** More Details **/
         if ($type == 'more_details' and !$has_more_details) {
             echo '<div class="wpl_listing_field_container wpl-pwizard-prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '">';
             echo '<label for="wpl_c_' . $field->id . '"><span>' . __($label, WPL_TEXTDOMAIN) . '</span></label>';
             echo '<div id="wpl_more_details' . $field->id . '" style="display: none;" class="wpl-fields-more-details-block">';
             $has_more_details = true;
         } elseif ($type == 'more_details' and $has_more_details) {
             /** Only one details field is acceptable in each category **/
             continue;
         }
         /** Accesses **/
         if (isset($field->accesses) and trim($field->accesses) != '' and wpl_global::check_addon('membership')) {
             $accesses = explode(',', trim($field->accesses, ', '));
             $cur_membership_id = wpl_users::get_user_membership();
             if (!in_array($cur_membership_id, $accesses) and trim($field->accesses_message) == '') {
                 continue;
             } elseif (!in_array($cur_membership_id, $accesses) and trim($field->accesses_message) != '') {
                 echo '<div class="prow wpl_listing_field_container prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '" style="' . $display . '">';
                 echo '<label for="wpl_c_' . $field->id . '">' . __($label, WPL_TEXTDOMAIN) . '</label>';
                 echo '<span class="wpl-access-blocked-message">' . __($field->accesses_message, WPL_TEXTDOMAIN) . '</span>';
                 echo '</div>';
                 continue;
             }
         }
         /** js validation **/
         self::$wizard_js_validation[$field->id] = self::generate_js_validation($field);
         if (isset($finds[$type])) {
             echo '<div class="prow wpl_listing_field_container prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '" style="' . $display . '">';
             include $path . DS . $finds[$type];
             echo '</div>';
             continue;
         }
         echo '<div class="prow wpl_listing_field_container prow-' . $type . '" id="wpl_listing_field_container' . $field->id . '" style="' . $display . '">';
         foreach ($files as $file) {
             include $path . DS . $file;
             if ($done_this) {
                 $finds[$type] = $file;
                 break;
             }
         }
         echo '</div>';
     }
     if ($has_more_details) {
         echo '</div></div>';
     }
 }
Ejemplo n.º 14
0
 public function build()
 {
     /** property listing model **/
     $this->model = new wpl_property();
     if (!in_array($this->kind, wpl_flex::get_valid_kinds())) {
         $this->error = "ERROR: Invalid property kind!";
         return false;
     }
     $default_where = array('sf_select_confirmed' => 1, 'sf_select_finalized' => 1, 'sf_select_deleted' => 0, 'sf_select_expired' => 0, 'sf_select_kind' => $this->kind);
     $this->where = array_merge($default_where, $this->where);
     /** Add search conditions to the where **/
     $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET'));
     $this->where = array_merge($vars, $this->where);
     /** start search **/
     $this->model->start($this->start, $this->limit, $this->orderby, $this->order, $this->where);
     $this->model->total = $this->model->get_properties_count();
     $this->built['listings']['total'] = $this->model->total;
     /** run the search **/
     $query = $this->model->query();
     $properties = $this->model->search();
     /** finish search **/
     $this->model->finish();
     $plisting_fields = $this->model->get_plisting_fields();
     foreach ($properties as $property) {
         $rendered = array();
         $rendered = $this->model->full_render($property->id, $plisting_fields, $property);
         $rendered['property_id'] = $property->id;
         $items = $rendered['items'];
         /** render gallery **/
         if ($this->pictures) {
             $rendered['images'] = wpl_items::render_gallery($items['gallery']);
         }
         /** render attachments **/
         if ($this->attachments) {
             $rendered['attachments'] = wpl_items::render_attachments($items['attachment']);
         }
         /** render videos **/
         if ($this->videos) {
             $rendered['videos'] = wpl_items::render_videos($items['video']);
         }
         /** render rooms **/
         if ($this->rooms) {
             $rendered['rooms'] = $items['rooms'];
         }
         /** render gallery custom sizes **/
         if (is_array($this->image_sizes)) {
             $rendered['custom_sizes'] = wpl_items::render_gallery_custom_sizes($property_id, $items['gallery'], $this->image_sizes);
         }
         /** render agent data **/
         if ($this->agentinfo) {
             $rendered['agent'] = wpl_users::full_render($property->user_id);
             unset($rendered['agent']['data']);
             unset($rendered['agent']['items']);
         }
         unset($rendered['items']);
         $this->built['listings'][$property->id] = $rendered;
     }
     return $this->built;
 }
Ejemplo n.º 15
0
 /**
  * Returns admin ID of website
  * @author Howard R <*****@*****.**>
  * @static
  * @return int
  */
 public static function get_admin_id()
 {
     return wpl_users::get_id_by_email(wpl_global::get_wp_option('admin_email', NULL));
 }
Ejemplo n.º 16
0
 public function build()
 {
     /** property listing model **/
     $this->model = new wpl_property();
     $property = (array) $this->model->get_property_raw_data($this->pid);
     /** no property found **/
     if (!$property) {
         $this->error = "ERROR: Property id is not valid.";
         return false;
     }
     $this->pshow_fields = $this->model->get_pshow_fields('', $property['kind']);
     $this->pshow_categories = wpl_flex::get_categories('', '', " AND `enabled`>='1' AND `kind`='" . $property['kind'] . "' AND `pshow`='1'");
     /** BUILD **/
     $this->built['listing']['raw'] = $property;
     $find_files = array();
     $rendered_fields = $this->model->render_property($property, $this->pshow_fields, $find_files, true);
     $this->built['listing']['materials'] = $rendered_fields['columns'];
     foreach ($this->pshow_categories as $pshow_category) {
         $pshow_cat_fields = $this->model->get_pshow_fields($pshow_category->id, $property['kind']);
         $this->built['listing']['rendered'][$pshow_category->id]['self'] = (array) $pshow_category;
         $this->built['listing']['rendered'][$pshow_category->id]['data'] = $this->model->render_property($property, $pshow_cat_fields);
     }
     $items = wpl_items::get_items($this->pid, '', $property['kind'], '', 1);
     /** render gallery **/
     $this->built['listing']['images'] = wpl_items::render_gallery($items['gallery']);
     /** render attachments **/
     $this->built['listing']['attachments'] = wpl_items::render_attachments($items['attachment']);
     /** render videos **/
     $this->built['listing']['videos'] = wpl_items::render_videos($items['video']);
     /** render rooms **/
     $this->built['listing']['rooms'] = $items['rooms'];
     /** render gallery custom sizes **/
     if (is_array($this->image_sizes)) {
         $this->built['listing']['custom_sizes'] = wpl_items::render_gallery_custom_sizes($this->pid, $items['gallery'], $this->image_sizes);
     }
     /** property full link **/
     $this->built['listing']['property_link'] = $this->model->get_property_link($property);
     /** location text **/
     $this->built['listing']['location_text'] = $property['location_text'];
     /** render agent data **/
     $rendered_agent = wpl_users::full_render($property['user_id']);
     unset($rendered_agent['data']);
     $this->built['listing']['agent'] = $rendered_agent;
     /** updating the visited times and etc **/
     $this->model->property_visited($this->pid);
     return $this->built;
 }
Ejemplo n.º 17
0
    ?>
" class="change-user-cnt-wp">
            <div class="change-user-wp">
                <label id="pmanager_change_user_label<?php 
    echo $pid;
    ?>
"
                       for="pmanager_change_user_select<?php 
    echo $pid;
    ?>
"><?php 
    echo __('User', WPL_TEXTDOMAIN);
    ?>
: </label>
                <?php 
    $wpl_users = wpl_users::get_wpl_users();
    ?>
                <select id="pmanager_change_user_select<?php 
    echo $pid;
    ?>
" data-has-chosen onchange="change_user(<?php 
    echo $pid;
    ?>
, this.value);">
                    <?php 
    foreach ($wpl_users as $wpl_user) {
        ?>
                        <option value="<?php 
        echo $wpl_user->ID;
        ?>
"
Ejemplo n.º 18
0
 public function display($instance = array())
 {
     /** do cronjobs **/
     _wpl_import('libraries.events');
     wpl_events::do_cronjobs();
     /** check access **/
     if (!wpl_users::check_access('propertyshow')) {
         /** import message tpl **/
         $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message', false, true);
     }
     $this->tpl = wpl_request::getVar('tpl', 'default');
     /** property listing model **/
     $this->model = new wpl_property();
     $this->pid = wpl_request::getVar('pid', 0);
     $listing_id = wpl_request::getVar('mls_id', 0);
     if (trim($listing_id)) {
         $this->pid = wpl_property::pid($listing_id);
         wpl_request::setVar('pid', $this->pid);
     }
     $property = $this->model->get_property_raw_data($this->pid);
     /** no property found **/
     if (!$property or $property['finalized'] == 0 or $property['confirmed'] == 0 or $property['deleted'] == 1 or $property['expired'] >= 1) {
         /** import message tpl **/
         $this->message = __("No property found or it's not available now!", WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message', false, true);
     }
     $this->pshow_fields = $this->model->get_pshow_fields('', $property['kind']);
     $this->pshow_categories = wpl_flex::get_categories('', '', " AND `enabled`>='1' AND `kind`='" . $property['kind'] . "' AND `pshow`='1'");
     $wpl_properties = array();
     /** define current index **/
     $wpl_properties['current']['data'] = (array) $property;
     $wpl_properties['current']['raw'] = (array) $property;
     $find_files = array();
     $rendered_fields = $this->model->render_property($property, $this->pshow_fields, $find_files, true);
     $wpl_properties['current']['rendered_raw'] = $rendered_fields['ids'];
     $wpl_properties['current']['materials'] = $rendered_fields['columns'];
     foreach ($this->pshow_categories as $pshow_category) {
         $pshow_cat_fields = $this->model->get_pshow_fields($pshow_category->id, $property['kind']);
         $wpl_properties['current']['rendered'][$pshow_category->id]['self'] = (array) $pshow_category;
         $wpl_properties['current']['rendered'][$pshow_category->id]['data'] = $this->model->render_property($property, $pshow_cat_fields);
     }
     $wpl_properties['current']['items'] = wpl_items::get_items($this->pid, '', $property['kind'], '', 1);
     /** property location text **/
     $wpl_properties['current']['location_text'] = $this->model->generate_location_text((array) $property);
     /** property full link **/
     $wpl_properties['current']['property_link'] = $this->model->get_property_link((array) $property);
     /** property page title **/
     $wpl_properties['current']['property_page_title'] = $this->model->update_property_page_title($property);
     /** property title **/
     $wpl_properties['current']['property_title'] = $this->model->update_property_title($property);
     /** apply filters (This filter must place after all proccess) **/
     _wpl_import('libraries.filters');
     @extract(wpl_filters::apply('property_listing_after_render', array('wpl_properties' => $wpl_properties)));
     $this->wpl_properties = $wpl_properties;
     $this->kind = $property['kind'];
     $this->property = $wpl_properties['current'];
     /** updating the visited times and etc **/
     wpl_property::property_visited($this->pid);
     /** trigger event **/
     wpl_global::event_handler('property_show', array('id' => $this->pid));
     /** import tpl **/
     $this->tpl = wpl_flex::get_kind_tpl($this->tpl_path, $this->tpl, $this->kind);
     return parent::render($this->tpl_path, $this->tpl, false, true);
 }
Ejemplo n.º 19
0
defined('_WPLEXEC') or die('Restricted access');
/** set params **/
$user_id = isset($params['user_id']) ? $params['user_id'] : '';
$wpl_properties = isset($params['wpl_properties']) ? $params['wpl_properties'] : NULL;
$picture_width = isset($params['picture_width']) ? $params['picture_width'] : '175';
$picture_height = isset($params['picture_height']) ? $params['picture_height'] : '145';
$mailto = isset($params['mailto']) ? $params['mailto'] : 0;
$description_column = 'about';
if (wpl_global::check_multilingual_status() and wpl_addon_pro::get_multiligual_status_by_column($description_column, 2)) {
    $description_column = wpl_addon_pro::get_column_lang_name($description_column, wpl_global::get_current_language(), false);
}
/** getting user id from current property (used in property_show and property_listing) **/
if (!trim($user_id)) {
    $user_id = $wpl_properties['current']['data']['user_id'];
}
$wpl_user = wpl_users::full_render($user_id, wpl_users::get_pshow_fields(), NULL, array(), true);
/** resizing profile image **/
$params = array();
$params['image_parentid'] = $user_id;
$params['image_name'] = isset($wpl_user['profile_picture']['name']) ? $wpl_user['profile_picture']['name'] : '';
$profile_path = isset($wpl_user['profile_picture']['path']) ? $wpl_user['profile_picture']['path'] : '';
$profile_image = wpl_images::create_profile_images($profile_path, $picture_width, $picture_height, $params);
/** resizing company logo **/
$params = array();
$params['image_parentid'] = $user_id;
$params['image_name'] = isset($wpl_user['company_logo']['name']) ? $wpl_user['company_logo']['name'] : '';
$logo_path = isset($wpl_user['company_logo']['path']) ? $wpl_user['company_logo']['path'] : '';
$logo_image = isset($wpl_user['company_logo']['url']) ? $wpl_user['company_logo']['url'] : '';
$agent_name = isset($wpl_user['materials']['first_name']['value']) ? $wpl_user['materials']['first_name']['value'] : '';
$agent_l_name = isset($wpl_user['materials']['last_name']['value']) ? $wpl_user['materials']['last_name']['value'] : '';
$company_name = isset($wpl_user['materials']['company_name']['value']) ? $wpl_user['materials']['company_name']['value'] : '';
Ejemplo n.º 20
0
if (isset($wpl_user['data']['company_address'])) {
    ?>
	            <div itemprop="address" class="company_address"><?php 
    echo $wpl_user['data']['company_address'];
    ?>
</div>
			<?php 
}
?>
		</div>
	</div>
    
	<div class="wpl_agent_info_r">
		<ul>
			<li class="name" itemprop="name" ><a href="<?php 
echo wpl_users::get_profile_link($user_id);
?>
"><?php 
echo $agent_name . ' ' . $agent_l_name;
?>
</a></li>
			
			<?php 
if (isset($wpl_user['materials']['website']['value'])) {
    ?>
            <li class="website"><a itemprop="url"  href="<?php 
    echo $wpl_user['materials']['website']['value'];
    ?>
" target="_blank"><?php 
    echo __('View website', WPL_TEXTDOMAIN);
    ?>
Ejemplo n.º 21
0
         $any = false;
         $label = true;
         break;
     case 'radios':
         $show = 'radios';
         $any = false;
         $label = true;
         break;
     case 'radios_any':
         $show = 'radios';
         $any = true;
         $label = true;
         break;
 }
 /** current value **/
 $raw_options = $type == 'user_type' ? wpl_users::get_user_types(1) : wpl_users::get_wpl_memberships();
 $options = array();
 foreach ($raw_options as $raw_option) {
     $options[$raw_option->id] = array('key' => $raw_option->id, 'value' => isset($raw_option->membership_name) ? $raw_option->membership_name : $raw_option->name);
 }
 $current_value = wpl_request::getVar('sf_select_' . $field_data['table_column'], '');
 if ($label) {
     $html .= '<label>' . __($field['name'], WPL_TEXTDOMAIN) . '</label>';
 }
 if ($show == 'select') {
     $html .= '<select name="sf' . $widget_id . '_select_' . $field_data['table_column'] . '" class="wpl_search_widget_field_' . $field['id'] . '" id="sf' . $widget_id . '_select_' . $field_data['table_column'] . '">';
     if ($any) {
         $html .= '<option value="">' . __($field['name'], WPL_TEXTDOMAIN) . '</option>';
     }
     foreach ($options as $option) {
         $html .= '<option value="' . $option['key'] . '" ' . ($current_value == $option['key'] ? 'selected="selected"' : '') . '>' . __($option['value'], WPL_TEXTDOMAIN) . '</option>';
Ejemplo n.º 22
0
 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;
 }
Ejemplo n.º 23
0
 public function display($instance = array())
 {
     /** check access **/
     if (!wpl_users::check_access('propertylisting')) {
         /** import message tpl **/
         $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message', false, true);
     }
     $this->tpl = wpl_request::getVar('tpl', 'default');
     $this->method = wpl_request::getVar('wplmethod', NULL);
     /** global settings **/
     $this->settings = wpl_settings::get_settings();
     /** listing settings **/
     $this->page_number = wpl_request::getVar('wplpage', 1, '', true);
     $this->limit = wpl_request::getVar('limit', $this->settings['default_page_size']);
     $this->start = wpl_request::getVar('start', ($this->page_number - 1) * $this->limit, '', true);
     $this->orderby = wpl_request::getVar('wplorderby', $this->settings['default_orderby'], '', true);
     $this->order = wpl_request::getVar('wplorder', $this->settings['default_order'], '', true);
     /** Set Property CSS class **/
     $this->property_css_class = !$this->wplraw ? wpl_request::getVar('wplpcc', NULL) : NULL;
     if (!$this->property_css_class) {
         $this->property_css_class = wpl_request::getVar('wplpcc', 'grid_box', 'COOKIE');
     }
     $this->property_css_class_switcher = wpl_request::getVar('wplpcc_switcher', '1');
     $this->property_listview = wpl_request::getVar('wplplv', '1');
     #Show listview or not
     /** RSS Feed Setting **/
     $this->listings_rss_enabled = isset($this->settings['listings_rss_enabled']) ? $this->settings['listings_rss_enabled'] : 0;
     /** detect kind **/
     $this->kind = wpl_request::getVar('kind', 0);
     if (!$this->kind) {
         $this->kind = wpl_request::getVar('sf_select_kind', 0);
     }
     if (!in_array($this->kind, wpl_flex::get_valid_kinds())) {
         /** import message tpl **/
         $this->message = __('Invalid Request!', WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message', false, true);
     }
     /** pagination types **/
     $this->wplpagination = wpl_request::getVar('wplpagination', 'normal', '', true);
     wpl_request::setVar('wplpagination', $this->wplpagination);
     /** property listing model **/
     $this->model = new wpl_property();
     /** set page if start var passed **/
     $this->page_number = $this->start / $this->limit + 1;
     wpl_request::setVar('wplpage', $this->page_number);
     $where = array('sf_select_confirmed' => 1, 'sf_select_finalized' => 1, 'sf_select_deleted' => 0, 'sf_select_expired' => 0, 'sf_select_kind' => $this->kind);
     /** Add search conditions to the where **/
     $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET'));
     $where = array_merge($vars, $where);
     /** start search **/
     $this->model->start($this->start, $this->limit, $this->orderby, $this->order, $where, $this->kind);
     $this->model->total = $this->model->get_properties_count();
     /** validation for page_number **/
     $this->total_pages = ceil($this->model->total / $this->limit);
     if ($this->page_number <= 0 or $this->page_number > $this->total_pages) {
         $this->model->start = 0;
     }
     /** run the search **/
     $query = $this->model->query();
     $properties = $this->model->search();
     /** finish search **/
     $this->model->finish();
     $plisting_fields = $this->model->get_plisting_fields('', $this->kind);
     $wpl_properties = array();
     foreach ($properties as $property) {
         $wpl_properties[$property->id] = $this->model->full_render($property->id, $plisting_fields, $property);
     }
     /** define current index **/
     $wpl_properties['current'] = array();
     /** apply filters (This filter must place after all proccess) **/
     _wpl_import('libraries.filters');
     @extract(wpl_filters::apply('property_listing_after_render', array('wpl_properties' => $wpl_properties)));
     $this->pagination = wpl_pagination::get_pagination($this->model->total, $this->limit, true, $this->wplraw);
     $this->wpl_properties = $wpl_properties;
     if ($this->wplraw and $this->method == 'get_markers') {
         $markers = array('markers' => $this->model->render_markers($wpl_properties), 'total' => $this->model->total);
         echo json_encode($markers);
         exit;
     } elseif ($this->wplraw and $this->method == 'get_listings') {
         if ($this->return_listings) {
             return $wpl_properties;
         } else {
             echo json_encode($wpl_properties);
             exit;
         }
     }
     /** import tpl **/
     $this->tpl = wpl_flex::get_kind_tpl($this->tpl_path, $this->tpl, $this->kind);
     return parent::render($this->tpl_path, $this->tpl, false, true);
 }
Ejemplo n.º 24
0
 /**
  * Sets recipients
  * @author Howard R <*****@*****.**>
  * @param array $recipients
  * @return array
  */
 public function set_recipients($recipients)
 {
     if (!is_array($recipients)) {
         $recipients = array($recipients);
     }
     $ex = trim($this->notification_data['additional_memberships']) != '' ? explode(',', $this->notification_data['additional_memberships']) : array();
     if (is_array($ex) and count($ex) >= 1) {
         foreach ($ex as $value) {
             array_push($recipients, $value);
         }
     }
     $ex = trim($this->notification_data['additional_users']) != '' ? explode(',', $this->notification_data['additional_users']) : array();
     if (is_array($ex) and count($ex) >= 1) {
         foreach ($ex as $value) {
             array_push($recipients, $value);
         }
     }
     $ex = trim($this->notification_data['additional_emails']) != '' ? explode(',', $this->notification_data['additional_emails']) : array();
     if (is_array($ex) and count($ex) >= 1) {
         foreach ($ex as $value) {
             array_push($recipients, $value);
         }
     }
     $emails = array();
     foreach ($recipients as $recipient) {
         /** user **/
         if (is_numeric($recipient) and $recipient >= 0) {
             $user_data = wpl_users::get_user($recipient);
             array_push($emails, array($user_data->ID, $user_data->user_email));
         } elseif (is_numeric($recipient) and $recipient < 0) {
             $users = wpl_users::get_wpl_users("AND `membership_id`='{$recipient}'");
             foreach ($users as $user) {
                 array_push($emails, array($user->ID, $user->user_email));
             }
         } elseif (is_string($recipient)) {
             $user_id = wpl_users::get_id_by_email($recipient);
             if (!$user_id) {
                 $user_id = 0;
             }
             array_push($emails, array($user_id, $recipient));
         }
     }
     return $emails;
 }
Ejemplo n.º 25
0
 /**
  * This function is for importing/updating properties into the WPL. It uses WPL standard format for importing
  * This function must call in everywhere that we need to import properties like MLS and IMPORTER Addons.
  * @author Howard <*****@*****.**>
  * @static
  * @param array $properties_to_import
  * @param string $wpl_unique_field
  * @param int $user_id
  * @param string $source
  * @param boolean $finalize
  * @param array $log_params
  * @return array property IDs
  */
 public static function import($properties_to_import, $wpl_unique_field = 'mls_id', $user_id = '', $source = 'mls', $finalize = true, $log_params = array())
 {
     if (!$user_id) {
         $user_id = wpl_users::get_cur_user_id();
     }
     $pids = array();
     $added = array();
     // Used for logging results
     $updated = array();
     // Used for logging results
     /** model **/
     $model = new wpl_property();
     $possible_columns = wpl_db::columns('wpl_properties');
     foreach ($properties_to_import as $property_to_import) {
         $q = '';
         $unique_value = '';
         foreach ($property_to_import as $key => $row) {
             $wpl_field = $row['wpl_table_column'] ? $row['wpl_table_column'] : $key;
             $wpl_value = $row['wpl_value'] ? $row['wpl_value'] : '';
             /** validation table column **/
             if (!in_array($wpl_field, $possible_columns)) {
                 continue;
             }
             /** set unique value **/
             if ($wpl_field == $wpl_unique_field) {
                 $unique_value = $wpl_value;
             }
             /** set user id value **/
             if ($wpl_field == 'user_id') {
                 $user_id = $wpl_value;
             }
             $q .= "`{$wpl_field}`='" . wpl_db::escape($wpl_value) . "',";
         }
         $exists = $model->get_properties_count(" AND `{$wpl_unique_field}`='{$unique_value}'");
         if (!$exists) {
             $pid = $model->create_property_default($user_id);
         } else {
             $pid = $model->pid($unique_value, $wpl_unique_field);
         }
         /** add property id to return **/
         $pids[] = $pid;
         /** Add source and last sync date **/
         if (in_array('source', $possible_columns) and in_array('last_sync_date', $possible_columns)) {
             $q .= "`source`='{$source}',";
             $q .= "`last_sync_date`='" . date('Y-m-d H:i:s') . "',";
         }
         $q = trim($q, ', ');
         $query = "UPDATE `#__wpl_properties` SET " . $q . " WHERE `id`='" . $pid . "'";
         wpl_db::q($query);
         if ($finalize) {
             $mode = $exists ? 'edit' : 'add';
             $model->finalize($pid, $mode, $user_id);
         }
         if ($exists) {
             $added[] = $unique_value;
         } else {
             $updated[] = $unique_value;
         }
     }
     /** Creating Log **/
     if ($source == 'mls' and wpl_global::check_addon('mls')) {
         _wpl_import('libraries.addon_mls');
         if (method_exists('wpl_addon_mls', 'log')) {
             wpl_addon_mls::log($added, $updated, $log_params);
         }
     }
     return $pids;
 }
Ejemplo n.º 26
0
 public function render_search_fields($instance, $widget_id, $finds = array())
 {
     /** first validation **/
     if (!$instance) {
         return array();
     }
     $path = WPL_ABSPATH . DS . 'libraries' . DS . 'widget_search' . DS . 'frontend';
     $files = array();
     if (wpl_folder::exists($path)) {
         $files = wpl_folder::files($path, '.php$');
     }
     $fields = $instance['data'];
     uasort($fields, array('wpl_global', 'wpl_array_sort'));
     $rendered = array();
     foreach ($fields as $key => $field) {
         /** proceed to next field if field is not enabled **/
         if (!isset($field['enable']) or isset($field['enable']) and $field['enable'] != 'enable') {
             continue;
         }
         /** Fix empty id issue **/
         if ((!isset($field['id']) or isset($field['id']) and !$field['id']) and $key) {
             $field['id'] = $key;
         }
         $field_data = (array) wpl_flex::get_field($field['id']);
         if (!$field_data) {
             continue;
         }
         $field['name'] = $field_data['name'];
         $type = $field_data['type'];
         $field_id = $field['id'];
         $options = json_decode($field_data['options'], true);
         $display = '';
         $done_this = false;
         $html = '';
         /** listing and property type specific **/
         if (trim($field_data['listing_specific']) != '') {
             $specified_listings = explode(',', trim($field_data['listing_specific'], ', '));
             $this->listing_specific_array[$field_data['id']] = $specified_listings;
         } elseif (trim($field_data['property_type_specific']) != '') {
             $specified_property_types = explode(',', trim($field_data['property_type_specific'], ', '));
             $this->property_type_specific_array[$field_data['id']] = $specified_property_types;
         }
         /** Accesses **/
         if (trim($field_data['accesses']) != '') {
             $accesses = explode(',', trim($field_data['accesses'], ', '));
             $cur_membership_id = wpl_users::get_user_membership();
             if (!in_array($cur_membership_id, $accesses)) {
                 continue;
             }
         }
         if (isset($finds[$type])) {
             $html .= '<div class="wpl_search_field_container ' . (isset($field['type']) ? $field['type'] . '_type' : '') . ' ' . ((isset($field['type']) and $field['type'] == 'predefined') ? 'wpl_hidden' : '') . '" id="wpl' . $widget_id . '_search_field_container_' . $field['id'] . '">';
             include $path . DS . $finds[$type];
             $html .= '</div>';
             $rendered[$field_id]['id'] = $field_id;
             $rendered[$field_id]['field_data'] = $field_data;
             $rendered[$field_id]['field_options'] = json_decode($field_data['options'], true);
             $rendered[$field_id]['search_options'] = isset($field['extoption']) ? $field['extoption'] : NULL;
             $rendered[$field_id]['html'] = $html;
             $rendered[$field_id]['current_value'] = isset($current_value) ? $current_value : NULL;
             $rendered[$field_id]['display'] = $display;
             continue;
         }
         $html .= '<div class="wpl_search_field_container ' . (isset($field['type']) ? $field['type'] . '_type' : '') . ' ' . ((isset($field['type']) and $field['type'] == 'predefined') ? 'wpl_hidden' : '') . '" id="wpl' . $widget_id . '_search_field_container_' . $field['id'] . '" style="' . $display . '">';
         foreach ($files as $file) {
             include $path . DS . $file;
             /** proceed to next field **/
             if ($done_this) {
                 $finds[$type] = $file;
                 break;
             }
         }
         $html .= '</div>';
         $rendered[$field_id]['id'] = $field_id;
         $rendered[$field_id]['field_data'] = $field_data;
         $rendered[$field_id]['field_options'] = json_decode($field_data['options'], true);
         $rendered[$field_id]['search_options'] = isset($field['extoption']) ? $field['extoption'] : NULL;
         $rendered[$field_id]['html'] = $html;
         $rendered[$field_id]['current_value'] = isset($current_value) ? $current_value : NULL;
         $rendered[$field_id]['display'] = $display;
     }
     return $rendered;
 }
Ejemplo n.º 27
0
 /**
  * For creating admin bar menu
  * @author Howard <*****@*****.**>
  * @global object $wp_admin_bar
  */
 public function wpl_admin_bar_menu()
 {
     $cur_user_id = wpl_users::get_cur_user_id();
     $cur_user_data = wpl_users::get_user($cur_user_id);
     $cur_role = wpl_users::get_role($cur_user_id, false);
     $wpl_roles = wpl_users::get_wpl_roles();
     $menus = wpl_global::get_menus('menu', 'backend');
     $submenus = wpl_global::get_menus('submenu', 'backend');
     global $wp_admin_bar;
     /** generate pages object **/
     $controller = new wpl_controller();
     if (wpl_users::is_administrator($cur_user_id) or $cur_user_data->data->wpl_data->id) {
         /** add menus **/
         foreach ($menus as $menu) {
             $menu_slug = (!wpl_users::is_administrator($cur_user_id) and $menu->capability != 'current') ? 'wpl_admin_profile' : $menu->menu_slug;
             $wp_admin_bar->add_menu(array('id' => $menu->menu_slug, 'title' => __($menu->menu_title, WPL_TEXTDOMAIN), 'href' => wpl_global::get_wp_admin_url() . 'admin.php?page=' . $menu_slug));
         }
         /** add sub menus **/
         foreach ($submenus as $submenu) {
             if (!wpl_users::has_menu_access($submenu->menu_slug)) {
                 continue;
             }
             if (!wpl_users::is_administrator($cur_user_id) and $submenu->capability != 'current') {
                 continue;
             }
             $menu_title = $submenu->separator ? $controller->wpl_add_separator() . __($submenu->menu_title, WPL_TEXTDOMAIN) : __($submenu->menu_title, WPL_TEXTDOMAIN);
             $wp_admin_bar->add_menu(array('id' => $submenu->menu_slug, 'parent' => $submenu->parent, 'title' => $menu_title, 'href' => wpl_global::get_wp_admin_url() . 'admin.php?page=' . $submenu->menu_slug));
         }
     }
 }
Ejemplo n.º 28
0
    ?>
" <?php 
    echo $current_value == $property_type['id'] ? 'selected="selected"' : '';
    ?>
><?php 
    echo __($property_type['name'], WPL_TEXTDOMAIN);
    ?>
</option>
                            <?php 
}
?>
                        </select>
                    </div>

                    <?php 
if (wpl_users::is_administrator()) {
    ?>
                        <?php 
    $current_value = wpl_request::getVar('sf_select_user_id', '-1');
    ?>
                        <div class="wpl_listing_manager_search_form_element_cnt">
                            <select name="sf_select_user_id" id="sf_select_user_id">
                                <option value="-1"><?php 
    echo __('User', WPL_TEXTDOMAIN);
    ?>
</option>
                                <?php 
    foreach ($this->users as $user) {
        ?>
                                    <option
                                        value="<?php 
Ejemplo n.º 29
0
 /**
  * This is a very useful function for rendering whole data of user. you need to just pass user_id and get everything!
  * @author Howard R <*****@*****.**>
  * @static
  * @param int $user_id
  * @param array $plisting_fields
  * @param array $profile
  * @param array $params
  * @return array
  */
 public static function full_render($user_id, $plisting_fields = NULL, $profile = NULL, $params = array())
 {
     /** get plisting fields **/
     if (!$plisting_fields) {
         $plisting_fields = self::get_plisting_fields();
     }
     $raw_data = (array) self::get_wpl_user($user_id);
     if (!$profile) {
         $profile = (object) $raw_data;
     }
     $column = 'rendered';
     if (wpl_global::check_multilingual_status()) {
         $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false);
     }
     /** generate rendered data if rendered data is empty **/
     if (!trim($raw_data[$column]) and wpl_settings::get('cache')) {
         $rendered = json_decode(wpl_users::generate_rendered_data($user_id), true);
     } elseif (!wpl_settings::get('cache')) {
         $rendered = array();
     } else {
         $rendered = json_decode($raw_data[$column], true);
     }
     $result = array();
     $result['data'] = (array) $profile;
     $result['items'] = wpl_items::get_items($profile->id, '', 2, '', 1);
     $result['raw'] = $raw_data;
     if (!isset($rendered['rendered']) or !isset($rendered['materials'])) {
         /** render data on the fly **/
         $find_files = array();
         $rendered_fields = self::render_profile($profile, $plisting_fields, $find_files, true);
     }
     if (isset($rendered['rendered'])) {
         $result['rendered'] = $rendered['rendered'];
     } else {
         $result['rendered'] = $rendered_fields['ids'];
     }
     if (isset($rendered['materials']) and $rendered['materials']) {
         $result['materials'] = $rendered['materials'];
     } else {
         $result['materials'] = $rendered_fields['columns'];
     }
     /** location text **/
     if (isset($rendered['location_text'])) {
         $result['location_text'] = $rendered['location_text'];
     } else {
         $result['location_text'] = self::generate_location_text($raw_data);
     }
     /** profile full link **/
     $target_id = isset($params['wpltarget']) ? $params['wpltarget'] : 0;
     $result['profile_link'] = self::get_profile_link($profile->id, $target_id);
     /** profile picture **/
     if (trim($raw_data['profile_picture']) != '') {
         $result['profile_picture'] = array('url' => wpl_items::get_folder($profile->id, 2) . $raw_data['profile_picture'], 'path' => wpl_items::get_path($profile->id, 2) . $raw_data['profile_picture'], 'name' => $raw_data['profile_picture']);
     }
     /** company logo **/
     if (trim($raw_data['company_logo']) != '') {
         $result['company_logo'] = array('url' => wpl_items::get_folder($profile->id, 2) . $raw_data['company_logo'], 'path' => wpl_items::get_path($profile->id, 2) . $raw_data['company_logo'], 'name' => $raw_data['company_logo']);
     }
     /** Emails url **/
     if (wpl_file::exists(wpl_items::get_path($profile->id, 2) . 'main_email.png')) {
         $result['main_email_url'] = wpl_items::get_folder($profile->id, 2) . 'main_email.png';
     }
     if (wpl_file::exists(wpl_items::get_path($profile->id, 2) . 'second_email.png')) {
         $result['second_email_url'] = wpl_items::get_folder($profile->id, 2) . 'second_email.png';
     }
     return $result;
 }
Ejemplo n.º 30
0
        ?>
 value="<?php 
        echo $membership_type->id;
        ?>
"><?php 
        echo __($membership_type->name, WPL_TEXTDOMAIN);
        ?>
</option>
            <?php 
    }
    ?>
        </select>
    </div>
    
    <?php 
    $memberships = wpl_users::get_wpl_memberships();
    ?>
    <div>
    	<label for="<?php 
    echo $this->get_field_id('data_membership');
    ?>
"><?php 
    echo __('Membership', WPL_TEXTDOMAIN);
    ?>
: </label>
        <select id="<?php 
    echo $this->get_field_id('data_membership');
    ?>
" name="<?php 
    echo $this->get_field_name('data');
    ?>