Пример #1
0
 public function Execute(Template $template, Session $session, $request)
 {
     /* Create the ancestors Bar */
     $template = CreateAncestors($template, $template['L_PROFILE']);
     /* If the user is allowed to see his/her/any user CP */
     if ($session['user'] instanceof Member) {
         /* Connect to the db */
         $dba = DBA::Open();
         /* Quote out the REQUEST fields */
         foreach ($request as $key => $val) {
             $request[$key] = $request[$key] != '' ? $dba->Quote($val) : '';
         }
         if (check_mail($request['email']) != $request['email']) {
             return new Error($template['L_INVALIDEMAIL'], $template);
         }
         if ($request['signature'] != '') {
             if ($template['allowbbcode'] == 1) {
                 $parser = new BBParser($request['signature']);
                 if ($template['allowbbimagecode'] != 1) {
                     $parser->addOmit('img', 'img');
                 }
                 $request['signature'] = $parser->Execute();
             }
         }
         if ($request['month'] != -1 && $request['day'] != -1 && $request['year'] != '') {
             $birthday = mktime(0, 0, 0, intval($request['month']), intval($request['day']), intval($request['year']));
         } else {
             $birthday = 0;
         }
         if ($dba->Query("UPDATE " . USERS . " SET email = '" . $request['email'] . "', signature = '" . $request['signature'] . "', birthday = '" . $birthday . "', homepage = '" . $request['homepage'] . "', icq = '" . $request['icq'] . "', aim = '" . $request['aim'] . "', msn = '" . $request['msn'] . "', yahoo = '" . $request['yahoo'] . "', location = '" . $request['location'] . "', occupation = '" . $request['occupation'] . "', interests = '" . $request['interests'] . "', biography = '" . $request['biography'] . "' WHERE id = " . intval($request['id']))) {
             return new Error($template['L_PROFILESUCCESS'] . '<meta http-equiv="refresh" content="2; url=member.php?act=profile">', $template);
         }
     } else {
         return new Error($template['L_NEEDLOGGEDIN'], $template);
     }
     /* Set the number of queries */
     $template['num_queries'] = $session->dba->num_queries;
     return TRUE;
 }