X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations.inc.php;h=9b3e1f76745286fe31dab973968bc8c4c053e25e;hb=6244bf56b0f13e1c73b1c32c06d2601270d2e306;hp=734a4077a7892ceb4f6318f4c42bcbd1654e27a9;hpb=532c06cf78d430c5278df7006335df2921fa98d4;p=platal.git diff --git a/include/validations.inc.php b/include/validations.inc.php index 734a407..9b3e1f7 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -42,7 +42,7 @@ class ValidateIterator extends XOrgDBIterator public function next () { if (list($result, $stamp) = parent::next()) { - $result = unserialize($result); + $result = Validate::unserialize($result); $result->stamp = $stamp; return($result); } else { @@ -85,6 +85,10 @@ abstract class Validate $this->stamp = date('YmdHis'); $this->unique = $_unique; $this->type = $_type; + $res = XDB::query("SELECT promo_display AS promo + FROM profile_display + WHERE uid={?}", $this->user->id()); + $this->promo = $res->fetchOneCell(); } // }}} @@ -280,7 +284,7 @@ abstract class Validate $res = XDB::query('SELECT data, DATE_FORMAT(stamp, "%Y%m%d%H%i%s") FROM requests WHERE user_id={?} AND type={?} and stamp={?}', $uid, $type, $stamp); } if ($result = $res->fetchOneCell()) { - $result = unserialize($result); + $result = Validate::unserialize($result); } else { $result = false; } @@ -306,7 +310,7 @@ abstract class Validate $res = XDB::iterRow('SELECT data FROM requests WHERE user_id={?} and type={?}', $uid, $type); $array = array(); while (list($data) = $res->next()) { - $array[] = unserialize($data); + $array[] = Validate::unserialize($data); } return $array; } @@ -385,6 +389,17 @@ abstract class Validate } // }}} + // {{{ function unserialize() + public static function unserialize($data) + { + $obj = unserialize($data); + /* XXX: Temporary for hruid migration */ + if (!isset($obj->user) || !is_object($obj)) { + $obj->user =& User::get($obj->forlife); + } + /* XXX: End temporary block */ + return $obj; + } } foreach (glob(dirname(__FILE__).'/validations/*.inc.php') as $file) {