/**
  * Change password procedure
  *
  * @param	array	$user_data
  * @return	boolean	true on success or false on fail
  */
 function change_password($user_data)
 {
     if (!$this->check_token()) {
         return false;
     }
     if (!vivvo_hooks_manager::call('login_changePassword', array(&$user_data))) {
         return vivvo_hooks_manager::get_status();
     }
     $key = $user_data['key'];
     $user_list = new Users_list();
     $user = $user_list->get_user_by_forgot_md5($key);
     if ($user === false) {
         $this->set_error_code(2713);
         return false;
     } else {
         if (strlen($user_data['password']) < 6) {
             $this->set_error_code(2706);
             return false;
         }
         if ($user_data['password'] != $user_data['retype_password']) {
             $this->set_error_code(2707);
             return false;
         }
         $user_data['password'] = md5($user_data['password']);
         $user->set_password($user_data['password']);
         $this->_post_master->set_data_object($user);
         if ($this->_post_master->sql_update()) {
             admin_log($user->get_username(), ' Changed password');
             return true;
         } else {
             $this->set_error_code(2711);
             return false;
         }
     }
 }
 function check_email($email)
 {
     if (!vivvo_hooks_manager::call('user_checkEmail', array(&$email))) {
         return vivvo_hooks_manager::get_status();
     }
     $user_list = new Users_list();
     echo json_encode(!!$user_list->get_email_exists($email));
     exit;
 }
 function _leftnav()
 {
     $content_template = $this->load_template($this->_template_root . 'tabs.xml');
     require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Comments.class.php';
     $comments_list = new Comments_list();
     $content_template->assign('pending_comments', $comments_list->get_count(array('search_status' => 0)));
     require_once VIVVO_FS_INSTALL_ROOT . 'lib/vivvo/core/Users.class.php';
     $users_list = new Users_list();
     $content_template->assign('pending_users', $users_list->get_count(array('search_activated' => 0)));
     return $content_template;
 }
 function remove_user_subscriber()
 {
     $sm = vivvo_lite_site::get_instance();
     if ($sm->user) {
         $user_list = new Users_list();
         $user = $user_list->get_user_from_session();
         if ($user !== false) {
             $user->__set('subscriber', 0);
             $this->_post_master->set_data_object($user);
             if ($this->_post_master->sql_update()) {
                 $this->_post_master->sql_delete_list('maillist', "user_id=" . $user->get_id());
                 return true;
             } else {
                 $this->set_error_code(10263);
                 return false;
             }
         } else {
             $this->set_error_code(10264);
             return false;
         }
     } else {
         $this->set_error_code(10265);
         return false;
     }
 }