示例#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'];
 }
 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']) : '';
 }
示例#3
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;
         }
     }
 }
示例#4
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;
     }
     /** global settings **/
     $this->wpl_settings = wpl_settings::get_settings();
     $this->orderby = $this->wpl_settings['default_orderby'];
     $this->order = $this->wpl_settings['default_order'];
     // Include Thumbnails
     if (trim($vars['ithmb']) != '' and in_array($vars['ithmb'], array('0', '1'))) {
         $this->include_thumbnails = $vars['ithmb'];
     }
     // get special keys
     if (trim($vars['get_special_key']) != '' and in_array($vars['get_special_key'], array('0', '1'))) {
         $this->get_special_key = $vars['get_special_key'];
         $this->special_keys = explode('-', $vars['special_keys']);
     }
     // Set result type
     if (trim($vars['result_type']) != '' and in_array($vars['result_type'], array('1', '2', '3'))) {
         $this->result_type = $vars['result_type'];
     }
     // translate status
     if (trim($vars['dtranslated']) != '' and in_array($vars['dtranslated'], array('0', '1'))) {
         $this->dtranslated = $vars['dtranslated'];
     }
     // setting vars
     if (isset($vars['pictures'])) {
         $this->pictures = $vars['pictures'];
     }
     if (isset($vars['attachments'])) {
         $this->attachments = $vars['attachments'];
     }
     if (isset($vars['videos'])) {
         $this->attachments = $vars['videos'];
     }
     if (isset($vars['rooms'])) {
         $this->attachments = $vars['rooms'];
     }
     if (isset($vars['agentinfo'])) {
         $this->agentinfo = $vars['agentinfo'];
     }
     if (isset($vars['sort'])) {
         $this->orderby = $vars['sort'];
     }
     if (isset($vars['asc'])) {
         $this->order = $vars['asc'];
     }
     if (isset($vars['start'])) {
         $this->start = $vars['start'];
     }
     if (isset($vars['limit'])) {
         $this->limit = $vars['limit'];
     }
     if (isset($vars['type'])) {
         $this->type = $vars['type'];
     }
     if (isset($vars['kind'])) {
         $this->kind = $vars['kind'];
     }
     /** customized size of images **/
     $this->image_sizes = trim($vars['image_sizes']) != '' ? explode('-', $vars['image_sizes']) : '';
     // Checking essential vars
     foreach ($vars as $field => $value) {
         if (substr($field, 0, 3) != 'sf_') {
             continue;
         }
         if (strpos($field, 'sf_select_') === false) {
             $field = str_replace('sf_select', 'sf_select_', $field);
         }
         if (strpos($field, 'sf_unit_') === false) {
             $field = str_replace('sf_unit', 'sf_unit_', $field);
         }
         if (strpos($field, 'sf_min_') === false) {
             $field = str_replace('sf_min', 'sf_min_', $field);
         }
         if (strpos($field, 'sf_max_') === false) {
             $field = str_replace('sf_max', 'sf_max_', $field);
         }
         if (strpos($field, 'sf_tmin_') === false) {
             $field = str_replace('sf_tmin', 'sf_tmin_', $field);
         }
         if (strpos($field, 'sf_tmax_') === false) {
             $field = str_replace('sf_tmax', 'sf_tmax_', $field);
         }
         if (strpos($field, 'sf_multiple_') === false) {
             $field = str_replace('sf_multiple', 'sf_multiple_', $field);
         }
         if (strpos($field, 'sf_datemin_') === false) {
             $field = str_replace('sf_datemin', 'sf_datemin_', $field);
         }
         if (strpos($field, 'sf_datemax_') === false) {
             $field = str_replace('sf_datemax', 'sf_datemax_', $field);
         }
         if (strpos($field, 'sf_locationtextsearch_') === false) {
             $field = str_replace('sf_locationtextsearch', 'sf_locationtextsearch_', $field);
         }
         if (strpos($field, 'sf_notselect_') === false) {
             $field = str_replace('sf_notselect', 'sf_notselect_', $field);
         }
         if (strpos($field, 'sf_radiussearchunit_') === false) {
             $field = str_replace('sf_radiussearchunit', 'sf_radiussearchunit_', $field);
         }
         if (strpos($field, 'sf_text_') === false) {
             $field = str_replace('sf_text', 'sf_text_', $field);
         }
         if (strpos($field, 'sf_textsearch_') === false) {
             $field = str_replace('sf_textsearch', 'sf_textsearch_', $field);
         }
         $this->where[$field] = $value;
     }
 }