Browse Source

- Clean old variables

- Remove unused code
- Fix the JID verificator and move it to Utils
pull/5/head
Jaussoin Timothée 14 years ago
parent
commit
291ed79a79
  1. 27
      system/Jabber.php
  2. 11
      system/User.php
  3. 11
      system/Utils.php
  4. 4
      system/Widget/widgets/Login/Login.php

27
system/Jabber.php

@ -133,13 +133,11 @@ class Jabber
*/
public function login($jid, $pass)
{
if(!$this->checkJid($jid)) {
if(!checkJid($jid)) {
throw new MovimException(t("jid '%s' is incorrect", $jid));
} else {
$id = explode('@',$jid);
$user = $id[0];
$userConf = $id[1];
$domain = $id[1];
$this->jaxl->user = $user;
$this->jaxl->pass = $pass;
@ -149,16 +147,6 @@ class Jabber
self::setStatus(t('Connecting...'), false, false, true);
}
/**
* postAuth
*
* @return void
*/
public function postAuth() {
//$this->jaxl->getRosterList();
//$this->jaxl->getVCard();
}
/**
* postAuthFailure
*
@ -640,19 +628,6 @@ class Jabber
$this->jaxl->setStatus($status, $show, 41, false);
}
/**
* Check the current Jid
*
* @param string $jid
* @return bool
*/
private function checkJid($jid)
{
return true; /*
preg_match('/^[a-zA-Z0-9_.-]+@[a-zA-Z0-9_.-]+\(?:.[a-z]{2,5})?$/',
$jid); */
}
/**
* Send a message
*

11
system/User.php

@ -29,7 +29,7 @@ class User {
&& isset($_POST['pass'])
&& $_POST['login'] != ''
&& $_POST['pass'] != '') {
$this->authenticate($_POST['login'], $_POST['pass'], $_POST['host'], $_POST['suffix'], $_POST['port']);
$this->authenticate($_POST['login'], $_POST['pass']);
}
}
@ -43,7 +43,7 @@ class User {
return (($this->username != '' && $this->password != '') || $sess->get('login'));
}
function authenticate($login,$pass, $boshhost, $boshsuffix, $boshport)
function authenticate($login,$pass)
{
try{
@ -115,9 +115,10 @@ class User {
function getConf($user = false, $element = false) {
$login = ($user != false) ? $user : $this->username;
global $sdb;
$conf = $sdb->select('ConfVar', array('login' => $login));
$query = ConfVar::query()
->where(array('login' => $login));
$conf = ConfVar::run_query($query);
if($conf != false) {
$array = $conf[0]->getConf();
if($element != false)

11
system/Utils.php

@ -152,6 +152,17 @@ function generateHash(){
return sha1($result);
}
/**
* Check the current Jid
*
* @param string $jid
* @return bool
*/
function checkJid($jid)
{
return filter_var($jid, FILTER_VALIDATE_EMAIL);
}
function movim_log($log) {
ob_start();
// var_dump($log);

4
system/Widget/widgets/Login/Login.php

@ -119,8 +119,8 @@ class Login extends WidgetBase {
<div style="padding-top: 20px; width: 100%; text-align: center; clear: both;">
<?php
global $sdb;
$contacts = $sdb->select('ConfVar', array());
$query = ConfVar::query();
$contacts = ConfVar::run_query($query);
echo t('This server host %s accounts', count($contacts));
?>
</div>

Loading…
Cancel
Save