Browse Source

Update Movim to fit with Validation 1.0

pull/101/head
Jaussoin Timothée 10 years ago
parent
commit
8fb9a255f1
  1. 1
      .gitignore
  2. 2
      app/helpers/StringHelper.php
  3. 4
      app/widgets/Account/Account.php
  4. 8
      app/widgets/Blog/Blog.php
  5. 4
      app/widgets/Chat/Chat.php
  6. 2
      app/widgets/Chats/Chats.php
  7. 2
      app/widgets/Contact/Contact.php
  8. 4
      app/widgets/Group/Group.php
  9. 4
      app/widgets/Groups/Groups.php
  10. 2
      app/widgets/Login/Login.php
  11. 2
      app/widgets/LoginAnonymous/LoginAnonymous.php
  12. 8
      app/widgets/Post/Post.php
  13. 6
      app/widgets/Publish/Publish.php
  14. 4
      app/widgets/Rooms/Rooms.php
  15. 6
      app/widgets/Vcard4/Vcard4.php

1
.gitignore

@ -4,5 +4,4 @@
/cache
*~
/config/db.inc.php
/composer.lock
/composer.phar

2
app/helpers/StringHelper.php

@ -82,7 +82,7 @@ function addHFR($string) {
$num = '';
if(count($match) == 3)
$num = $match[2].'/';
return '<img class="hfr" alt="'.$match[0].'" src="http://forum-images.hardware.fr/images/perso/'.$num.$match[1].'.gif">';
return '<img class="hfr" title="'.$match[0].'" alt="'.$match[0].'" src="http://forum-images.hardware.fr/images/perso/'.$num.$match[1].'.gif">';
}, $string
);
}

4
app/widgets/Account/Account.php

@ -56,7 +56,7 @@ class Account extends WidgetBase
function ajaxChangePassword($form)
{
$validate = Validator::string()->length(6, 40);
$validate = Validator::stringType()->length(6, 40);
$p1 = $form->password->value;
$p2 = $form->password_confirmation->value;
@ -113,7 +113,7 @@ class Account extends WidgetBase
private function validateServer($server)
{
$validate_server = Validator::string()->noWhitespace()->length(6, 80);
$validate_server = Validator::stringType()->noWhitespace()->length(6, 80);
if(!$validate_server->validate($server)) return false;
else return true;
}

8
app/widgets/Blog/Blog.php

@ -59,7 +59,7 @@ class Blog extends WidgetBase {
$this->_messages = $pd->getNodeUnfiltered($this->_from, $this->_node, $this->_id * $this->_paging, $this->_paging + 1);
}
$this->_page = $this->_id + 1;
} elseif(Validator::string()->length(5, 100)->validate($this->_id)) {
} elseif(Validator::stringType()->length(5, 100)->validate($this->_id)) {
$this->_messages = $pd->getPublicItem($this->_from, $this->_node, $this->_id);
if(is_object($this->_messages[0])) {
@ -126,8 +126,8 @@ class Blog extends WidgetBase {
private function validateServerNode($server, $node)
{
$validate_server = Validator::string()->noWhitespace()->length(6, 40);
$validate_node = Validator::string()->length(3, 100);
$validate_server = Validator::stringType()->noWhitespace()->length(6, 40);
$validate_node = Validator::stringType()->length(3, 100);
if(!$validate_server->validate($server)
|| !$validate_node->validate($node)
@ -137,7 +137,7 @@ class Blog extends WidgetBase {
private function validateTag($tag)
{
return Validator::string()->notEmpty()->alnum()->validate($tag);
return Validator::stringType()->notEmpty()->alnum()->validate($tag);
}
function getComments($post)

4
app/widgets/Chat/Chat.php

@ -394,7 +394,7 @@ class Chat extends WidgetBase
{
if(!$this->validateJid($room)) return;
$validate_subject = Validator::string()->length(0, 200);
$validate_subject = Validator::stringType()->length(0, 200);
if(!$validate_subject->validate($form->subject->value)) return;
$p = new SetSubject;
@ -549,7 +549,7 @@ class Chat extends WidgetBase
*/
private function validateJid($jid)
{
$validate_jid = Validator::string()->noWhitespace()->length(6, 60);
$validate_jid = Validator::stringType()->noWhitespace()->length(6, 60);
if(!$validate_jid->validate($jid)) return false;
else return true;
}

2
app/widgets/Chats/Chats.php

@ -210,7 +210,7 @@ class Chats extends WidgetBase
private function validateJid($jid)
{
$validate_jid = Validator::string()->noWhitespace()->length(6, 40);
$validate_jid = Validator::stringType()->noWhitespace()->length(6, 40);
if($validate_jid->validate($jid)) return true;
else return false;

2
app/widgets/Contact/Contact.php

@ -289,7 +289,7 @@ class Contact extends WidgetBase
*/
private function validateJid($jid)
{
$validate_jid = Validator::string()->noWhitespace()->length(6, 60);
$validate_jid = Validator::stringType()->noWhitespace()->length(6, 60);
if(!$validate_jid->validate($jid)) return false;
else return true;
}

4
app/widgets/Group/Group.php

@ -421,8 +421,8 @@ class Group extends WidgetBase
private function validateServerNode($server, $node)
{
$validate_server = Validator::string()->noWhitespace()->length(6, 40);
$validate_node = Validator::string()->length(3, 100);
$validate_server = Validator::stringType()->noWhitespace()->length(6, 40);
$validate_node = Validator::stringType()->length(3, 100);
if(!$validate_server->validate($server)
|| !$validate_node->validate($node)

4
app/widgets/Groups/Groups.php

@ -118,7 +118,7 @@ class Groups extends WidgetBase
{
if(!$this->validateServer($server)) return;
$validate_name = Validator::string()->length(4, 80);
$validate_name = Validator::stringType()->length(4, 80);
if(!$validate_name->validate($form->name->value)) {
Notification::append(null, $this->__('groups.name_error'));
return;
@ -191,7 +191,7 @@ class Groups extends WidgetBase
*/
private function validateServer($server)
{
$validate_server = Validator::string()->noWhitespace()->length(6, 40);
$validate_server = Validator::stringType()->noWhitespace()->length(6, 40);
if(!$validate_server->validate($server)) return false;
else return true;
}

2
app/widgets/Login/Login.php

@ -167,7 +167,7 @@ class Login extends WidgetBase
// First we check the form
$validate_login = Validator::email()->length(6, 40);
$validate_password = Validator::string()->length(4, 40);
$validate_password = Validator::stringType()->length(4, 40);
if(!$validate_login->validate($login)) {
$this->showErrorBlock('login_format');

2
app/widgets/LoginAnonymous/LoginAnonymous.php

@ -27,7 +27,7 @@ class LoginAnonymous extends WidgetBase
function ajaxLogin($username)
{
$validate_user = Validator::string()->length(4, 40);
$validate_user = Validator::stringType()->length(4, 40);
if(!$validate_user->validate($username)) {
Notification::append(null, $this->__('login_anonymous.bad_username'));
return;

8
app/widgets/Post/Post.php

@ -147,8 +147,8 @@ class Post extends WidgetBase
{
$comment = trim($form->comment->value);
$validate_comment = Validator::string()->notEmpty();
$validate_id = Validator::string()->length(6, 128)->noWhitespace();
$validate_comment = Validator::stringType()->notEmpty();
$validate_id = Validator::stringType()->length(6, 128)->noWhitespace();
if(!$validate_comment->validate($comment)
|| !$validate_id->validate($id)) return;
@ -218,7 +218,7 @@ class Post extends WidgetBase
}
function ajaxTogglePrivacy($id) {
$validate = Validator::string()->length(6, 128);
$validate = Validator::stringType()->length(6, 128);
if(!$validate->validate($id))
return;
@ -249,7 +249,7 @@ class Post extends WidgetBase
function display()
{
$validate_nodeid = Validator::string()->length(10, 100);
$validate_nodeid = Validator::stringType()->length(10, 100);
$this->view->assign('nodeid', false);
if($validate_nodeid->validate($this->get('n'))) {

6
app/widgets/Publish/Publish.php

@ -189,7 +189,7 @@ class Publish extends WidgetBase
}
}
if(Validator::string()->notEmpty()->alnum(',')->validate($form->tags->value)) {
if(Validator::stringType()->notEmpty()->alnum(',')->validate($form->tags->value)) {
$p->setTags(array_unique(
array_filter(
array_map(
@ -279,8 +279,8 @@ class Publish extends WidgetBase
private function validateServerNode($server, $node)
{
$validate_server = Validator::string()->noWhitespace()->length(6, 40);
$validate_node = Validator::string()->length(3, 100);
$validate_server = Validator::stringType()->noWhitespace()->length(6, 40);
$validate_node = Validator::stringType()->length(3, 100);
if(!$validate_server->validate($server)
|| !$validate_node->validate($node)

4
app/widgets/Rooms/Rooms.php

@ -272,7 +272,7 @@ class Rooms extends WidgetBase
*/
private function validateRoom($room)
{
$validate_server = Validator::string()->noWhitespace()->length(6, 80);
$validate_server = Validator::stringType()->noWhitespace()->length(6, 80);
if(!$validate_server->validate($room)) return false;
else return true;
}
@ -284,7 +284,7 @@ class Rooms extends WidgetBase
*/
private function validateResource($resource)
{
$validate_resource = Validator::string()->length(2, 40);
$validate_resource = Validator::stringType()->length(2, 40);
if(!$validate_resource->validate($resource)) return false;
else return true;
}

6
app/widgets/Vcard4/Vcard4.php

@ -144,9 +144,9 @@ class Vcard4 extends WidgetBase
$c->date = $vcard->date->value;
}
if(Validator::string()->length(0, 40)->validate($vcard->name->value))
if(Validator::stringType()->length(0, 40)->validate($vcard->name->value))
$c->name = $vcard->name->value;
if(Validator::string()->length(0, 40)->validate($vcard->fn->value))
if(Validator::stringType()->length(0, 40)->validate($vcard->fn->value))
$c->fn = $vcard->fn->value;
if(Validator::url()->validate($vcard->url->value))
@ -167,7 +167,7 @@ class Vcard4 extends WidgetBase
$c->skype = $vcard->skype->value;
$c->yahoo = $vcard->yahoo->value;
if(Validator::string()->validate($vcard->desc->value))
if(Validator::stringType()->validate($vcard->desc->value))
$c->description = trim($vcard->desc->value);
$cd = new \Modl\ContactDAO();

Loading…
Cancel
Save