当前位置: 首页>>代码示例>>PHP>>正文


PHP common_log_objstring函数代码示例

本文整理汇总了PHP中common_log_objstring函数的典型用法代码示例。如果您正苦于以下问题:PHP common_log_objstring函数的具体用法?PHP common_log_objstring怎么用?PHP common_log_objstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了common_log_objstring函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setNotify

 function setNotify($user, $notify)
 {
     global $_PEAR;
     $user_im_prefs = new User_im_prefs();
     $user_im_prefs->transport = $this->imPlugin->transport;
     $user_im_prefs->user_id = $user->id;
     if ($user_im_prefs->find() && $user_im_prefs->fetch()) {
         if ($user_im_prefs->notify == $notify) {
             //notify is already set the way they want
             return true;
         } else {
             $original = clone $user_im_prefs;
             $user_im_prefs->notify = $notify;
             $result = $user_im_prefs->update($original);
             if (!$result) {
                 $last_error =& $_PEAR->getStaticProperty('DB_DataObject', 'lastError');
                 common_log(LOG_ERR, 'Could not set notify flag to ' . $notify . ' for user ' . common_log_objstring($user) . ' on transport ' . $this->imPlugin->transport . ' : ' . $last_error->message);
                 return false;
             } else {
                 common_log(LOG_INFO, 'User ' . $user->nickname . ' set notify flag to ' . $notify);
                 return true;
             }
         }
     } else {
         common_log(LOG_ERR, 'Could not set notify flag to ' . $notify . ' for user ' . common_log_objstring($user) . ' on transport ' . $this->imPlugin->transport . ' : user preference does not exist');
         return false;
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:28,代码来源:imchannel.php

示例2: set_notify

 function set_notify(&$user, $notify)
 {
     $orig = clone $user;
     $user->jabbernotify = $notify;
     $result = $user->update($orig);
     if (!$result) {
         $last_error =& PEAR::getStaticProperty('DB_DataObject', 'lastError');
         common_log(LOG_ERR, 'Could not set notify flag to ' . $notify . ' for user ' . common_log_objstring($user) . ': ' . $last_error->message);
         return false;
     } else {
         common_log(LOG_INFO, 'User ' . $user->nickname . ' set notify flag to ' . $notify);
         return true;
     }
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:14,代码来源:channel.php

示例3: setOriginal

 function setOriginal($filename)
 {
     $imagefile = new ImageFile($this->id, Avatar::path($filename));
     $orig = clone $this;
     $this->original_logo = Avatar::url($filename);
     $this->homepage_logo = Avatar::url($imagefile->resize(AVATAR_PROFILE_SIZE));
     $this->stream_logo = Avatar::url($imagefile->resize(AVATAR_STREAM_SIZE));
     $this->mini_logo = Avatar::url($imagefile->resize(AVATAR_MINI_SIZE));
     common_debug(common_log_objstring($this));
     return $this->update($orig);
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:11,代码来源:User_group.php

示例4: debugDump

 function debugDump()
 {
     common_debug("debugDump: " . common_log_objstring($this));
 }
开发者ID:jianoll,项目名称:SpeakEnglish_Server,代码行数:4,代码来源:Memcached_DataObject.php

示例5: common_log_db_error

function common_log_db_error(&$object, $verb, $filename = null)
{
    $objstr = common_log_objstring($object);
    $last_error =& PEAR::getStaticProperty('DB_DataObject', 'lastError');
    common_log(LOG_ERR, $last_error->message . '(' . $verb . ' on ' . $objstr . ')', $filename);
}
开发者ID:himmelex,项目名称:NTW,代码行数:6,代码来源:util.php

示例6: common_log_db_error

function common_log_db_error(&$object, $verb, $filename = null)
{
    $objstr = common_log_objstring($object);
    $last_error =& PEAR::getStaticProperty('DB_DataObject', 'lastError');
    if (is_object($last_error)) {
        $msg = $last_error->message;
    } else {
        $msg = 'Unknown error (' . var_export($last_error, true) . ')';
    }
    common_log(LOG_ERR, $msg . '(' . $verb . ' on ' . $objstr . ')', $filename);
}
开发者ID:harriewang,项目名称:InnertieWebsite,代码行数:11,代码来源:util.php

示例7: onStartEnqueueNotice

 function onStartEnqueueNotice($notice, &$transports)
 {
     $profile = Profile::getKV($notice->profile_id);
     if (!$profile) {
         common_log(LOG_WARNING, 'Refusing to broadcast notice with ' . 'unknown profile ' . common_log_objstring($notice), __FILE__);
     } else {
         $transports[] = $this->transport;
     }
     return true;
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:10,代码来源:implugin.php

示例8: setOriginal

 function setOriginal($filename)
 {
     $imagefile = new ImageFile($this->id, Avatar::path($filename));
     // XXX: Do we want to have a bunch of different size icons? homepage, stream, mini?
     // or just one and control size via CSS? --Zach
     $orig = clone $this;
     $this->icon = Avatar::url($filename);
     common_debug(common_log_objstring($this));
     return $this->update($orig);
 }
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:10,代码来源:Oauth_application.php

示例9: handlePost


//.........这里部分代码省略.........
             $user->nickname = $nickname;
             $user->language = $language;
             $user->timezone = $timezone;
             $result = $user->updateKeys($original);
             if ($result === false) {
                 common_log_db_error($user, 'UPDATE', __FILE__);
                 // TRANS: Server error thrown when user profile settings could not be updated.
                 $this->serverError(_('Could not update user.'));
                 return;
             } else {
                 // Re-initialize language environment if it changed
                 common_init_language();
                 // Clear the site owner, in case nickname changed
                 if ($user->hasRole(Profile_role::OWNER)) {
                     User::blow('user:site_owner');
                 }
             }
         }
         // XXX: XOR
         if ($user->autosubscribe ^ $autosubscribe || $user->private_stream ^ $private_stream || $user->subscribe_policy != $subscribe_policy) {
             $original = clone $user;
             $user->autosubscribe = $autosubscribe;
             $user->private_stream = $private_stream;
             $user->subscribe_policy = $subscribe_policy;
             $result = $user->update($original);
             if ($result === false) {
                 common_log_db_error($user, 'UPDATE', __FILE__);
                 // TRANS: Server error thrown when user profile settings could not be updated to
                 // TRANS: automatically subscribe to any subscriber.
                 $this->serverError(_('Could not update user for autosubscribe or subscribe_policy.'));
                 return;
             }
         }
         $profile = $user->getProfile();
         $orig_profile = clone $profile;
         $profile->nickname = $user->nickname;
         $profile->fullname = $fullname;
         $profile->homepage = $homepage;
         $profile->bio = $bio;
         $profile->location = $location;
         $loc = Location::fromName($location);
         if (empty($loc)) {
             $profile->lat = null;
             $profile->lon = null;
             $profile->location_id = null;
             $profile->location_ns = null;
         } else {
             $profile->lat = $loc->lat;
             $profile->lon = $loc->lon;
             $profile->location_id = $loc->location_id;
             $profile->location_ns = $loc->location_ns;
         }
         $profile->profileurl = common_profile_url($nickname);
         if (common_config('location', 'share') == 'user') {
             $exists = false;
             $prefs = User_location_prefs::staticGet('user_id', $user->id);
             if (empty($prefs)) {
                 $prefs = new User_location_prefs();
                 $prefs->user_id = $user->id;
                 $prefs->created = common_sql_now();
             } else {
                 $exists = true;
                 $orig = clone $prefs;
             }
             $prefs->share_location = $this->boolean('sharelocation');
             if ($exists) {
                 $result = $prefs->update($orig);
             } else {
                 $result = $prefs->insert();
             }
             if ($result === false) {
                 common_log_db_error($prefs, $exists ? 'UPDATE' : 'INSERT', __FILE__);
                 // TRANS: Server error thrown when user profile location preference settings could not be updated.
                 $this->serverError(_('Could not save location prefs.'));
                 return;
             }
         }
         common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
         common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
         $result = $profile->update($orig_profile);
         if ($result === false) {
             common_log_db_error($profile, 'UPDATE', __FILE__);
             // TRANS: Server error thrown when user profile settings could not be saved.
             $this->serverError(_('Could not save profile.'));
             return;
         }
         // Set the user tags
         $result = $user->setSelfTags($tags, $tag_priv);
         if (!$result) {
             // TRANS: Server error thrown when user profile settings tags could not be saved.
             $this->serverError(_('Could not save tags.'));
             return;
         }
         $user->query('COMMIT');
         Event::handle('EndProfileSaveForm', array($this));
         common_broadcast_profile($profile);
         // TRANS: Confirmation shown when user profile settings are saved.
         $this->showForm(_('Settings saved.'), true);
     }
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:101,代码来源:profilesettings.php

示例10: handlePost


//.........这里部分代码省略.........
             }
         }
         $user = common_current_user();
         $user->query('BEGIN');
         if ($user->nickname != $nickname || $user->language != $language || $user->timezone != $timezone) {
             common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname, __FILE__);
             common_debug('Updating user language from ' . $user->language . ' to ' . $language, __FILE__);
             common_debug('Updating user timezone from ' . $user->timezone . ' to ' . $timezone, __FILE__);
             $original = clone $user;
             $user->nickname = $nickname;
             $user->language = $language;
             $user->timezone = $timezone;
             $result = $user->updateKeys($original);
             if ($result === false) {
                 common_log_db_error($user, 'UPDATE', __FILE__);
                 $this->serverError(_('Couldn\'t update user.'));
                 return;
             } else {
                 // Re-initialize language environment if it changed
                 common_init_language();
                 // Clear the site owner, in case nickname changed
                 if ($user->hasRole(Profile_role::OWNER)) {
                     User::blow('user:site_owner');
                 }
             }
         }
         // XXX: XOR
         if ($user->autosubscribe ^ $autosubscribe) {
             $original = clone $user;
             $user->autosubscribe = $autosubscribe;
             $result = $user->update($original);
             if ($result === false) {
                 common_log_db_error($user, 'UPDATE', __FILE__);
                 $this->serverError(_('Couldn\'t update user for autosubscribe.'));
                 return;
             }
         }
         $profile = $user->getProfile();
         $orig_profile = clone $profile;
         $profile->nickname = $user->nickname;
         $profile->fullname = $fullname;
         $profile->homepage = $homepage;
         $profile->bio = $bio;
         $profile->location = $location;
         $loc = Location::fromName($location);
         if (empty($loc)) {
             $profile->lat = null;
             $profile->lon = null;
             $profile->location_id = null;
             $profile->location_ns = null;
         } else {
             $profile->lat = $loc->lat;
             $profile->lon = $loc->lon;
             $profile->location_id = $loc->location_id;
             $profile->location_ns = $loc->location_ns;
         }
         $profile->profileurl = common_profile_url($nickname);
         if (common_config('location', 'share') == 'user') {
             $exists = false;
             $prefs = User_location_prefs::staticGet('user_id', $user->id);
             if (empty($prefs)) {
                 $prefs = new User_location_prefs();
                 $prefs->user_id = $user->id;
                 $prefs->created = common_sql_now();
             } else {
                 $exists = true;
                 $orig = clone $prefs;
             }
             $prefs->share_location = $this->boolean('sharelocation');
             if ($exists) {
                 $result = $prefs->update($orig);
             } else {
                 $result = $prefs->insert();
             }
             if ($result === false) {
                 common_log_db_error($prefs, $exists ? 'UPDATE' : 'INSERT', __FILE__);
                 $this->serverError(_('Couldn\'t save location prefs.'));
                 return;
             }
         }
         common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
         common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
         $result = $profile->update($orig_profile);
         if ($result === false) {
             common_log_db_error($profile, 'UPDATE', __FILE__);
             $this->serverError(_('Couldn\'t save profile.'));
             return;
         }
         // Set the user tags
         $result = $user->setSelfTags($tags);
         if (!$result) {
             $this->serverError(_('Couldn\'t save tags.'));
             return;
         }
         $user->query('COMMIT');
         Event::handle('EndProfileSaveForm', array($this));
         common_broadcast_profile($profile);
         $this->showForm(_('Settings saved.'), true);
     }
 }
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:101,代码来源:profilesettings.php

示例11: jabber_public_notice

/**
 * Queue send of a notice to all public listeners
 *
 * For notices that are generated on the local system (by users), we can optionally
 * forward them to remote listeners by XMPP.
 *
 * @param Notice $notice notice to broadcast
 *
 * @return boolean success flag
 */
function jabber_public_notice($notice)
{
    // Now, users who want everything
    $public = common_config('xmpp', 'public');
    // FIXME PRIV don't send out private messages here
    // XXX: should we send out non-local messages if public,localonly
    // = false? I think not
    if ($public && $notice->is_local == Notice::LOCAL_PUBLIC) {
        $profile = Profile::staticGet($notice->profile_id);
        if (!$profile) {
            common_log(LOG_WARNING, 'Refusing to broadcast notice with ' . 'unknown profile ' . common_log_objstring($notice), __FILE__);
            return true;
            // not recoverable; discard.
        }
        $msg = jabber_format_notice($profile, $notice);
        $entry = jabber_format_entry($profile, $notice);
        $conn = jabber_proxy();
        foreach ($public as $address) {
            common_log(LOG_INFO, 'Sending notice ' . $notice->id . ' to public listener ' . $address, __FILE__);
            $conn->message($address, $msg, 'chat', null, $entry);
        }
        $profile->free();
    }
    return true;
}
开发者ID:microcosmx,项目名称:experiments,代码行数:35,代码来源:jabber.php

示例12: doPost


//.........这里部分代码省略.........
         $tag_priv = array();
         if (is_string($tagstring) && strlen($tagstring) > 0) {
             $tags = preg_split('/[\\s,]+/', $tagstring);
             foreach ($tags as &$tag) {
                 $private = @$tag[0] === '.';
                 $tag = common_canonical_tag($tag);
                 if (!common_valid_profile_tag($tag)) {
                     // TRANS: Validation error in form for profile settings.
                     // TRANS: %s is an invalid tag.
                     throw new ClientException(sprintf(_('Invalid tag: "%s".'), $tag));
                 }
                 $tag_priv[$tag] = $private;
             }
         }
         $user = $this->scoped->getUser();
         $user->query('BEGIN');
         // $user->nickname is updated through Profile->update();
         // XXX: XOR
         if ($user->autosubscribe ^ $autosubscribe || $user->private_stream ^ $private_stream || $user->timezone != $timezone || $user->language != $language || $user->subscribe_policy != $subscribe_policy) {
             $original = clone $user;
             $user->autosubscribe = $autosubscribe;
             $user->language = $language;
             $user->private_stream = $private_stream;
             $user->subscribe_policy = $subscribe_policy;
             $user->timezone = $timezone;
             $result = $user->update($original);
             if ($result === false) {
                 common_log_db_error($user, 'UPDATE', __FILE__);
                 $user->query('ROLLBACK');
                 // TRANS: Server error thrown when user profile settings could not be updated to
                 // TRANS: automatically subscribe to any subscriber.
                 throw new ServerException(_('Could not update user for autosubscribe or subscribe_policy.'));
             }
             // Re-initialize language environment if it changed
             common_init_language();
         }
         $original = clone $this->scoped;
         if (common_config('profile', 'changenick') == true && $this->scoped->getNickname() !== $nickname) {
             assert(Nickname::normalize($nickname) === $nickname);
             common_debug("Changing user nickname from '{$this->scoped->getNickname()}' to '{$nickname}'.");
             $this->scoped->nickname = $nickname;
             $this->scoped->profileurl = common_profile_url($this->scoped->getNickname());
         }
         $this->scoped->fullname = $fullname;
         $this->scoped->homepage = $homepage;
         $this->scoped->bio = $bio;
         $this->scoped->location = $location;
         $loc = Location::fromName($location);
         if (empty($loc)) {
             $this->scoped->lat = null;
             $this->scoped->lon = null;
             $this->scoped->location_id = null;
             $this->scoped->location_ns = null;
         } else {
             $this->scoped->lat = $loc->lat;
             $this->scoped->lon = $loc->lon;
             $this->scoped->location_id = $loc->location_id;
             $this->scoped->location_ns = $loc->location_ns;
         }
         if (common_config('location', 'share') == 'user') {
             $exists = false;
             $prefs = User_location_prefs::getKV('user_id', $this->scoped->getID());
             if (empty($prefs)) {
                 $prefs = new User_location_prefs();
                 $prefs->user_id = $this->scoped->getID();
                 $prefs->created = common_sql_now();
             } else {
                 $exists = true;
                 $orig = clone $prefs;
             }
             $prefs->share_location = $this->booleanintstring('sharelocation');
             if ($exists) {
                 $result = $prefs->update($orig);
             } else {
                 $result = $prefs->insert();
             }
             if ($result === false) {
                 common_log_db_error($prefs, $exists ? 'UPDATE' : 'INSERT', __FILE__);
                 $user->query('ROLLBACK');
                 // TRANS: Server error thrown when user profile location preference settings could not be updated.
                 throw new ServerException(_('Could not save location prefs.'));
             }
         }
         common_debug('Old profile: ' . common_log_objstring($original), __FILE__);
         common_debug('New profile: ' . common_log_objstring($this->scoped), __FILE__);
         $result = $this->scoped->update($original);
         if ($result === false) {
             common_log_db_error($this->scoped, 'UPDATE', __FILE__);
             $user->query('ROLLBACK');
             // TRANS: Server error thrown when user profile settings could not be saved.
             throw new ServerException(_('Could not save profile.'));
         }
         // Set the user tags
         $result = Profile_tag::setSelfTags($this->scoped, $tags, $tag_priv);
         $user->query('COMMIT');
         Event::handle('EndProfileSaveForm', array($this));
         // TRANS: Confirmation shown when user profile settings are saved.
         return _('Settings saved.');
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:101,代码来源:profilesettings.php

示例13: handlePost

 /**
  * Handle a post
  *
  * Validate input and save changes. Reload the form with a success
  * or error message.
  *
  * @return void
  */
 function handlePost()
 {
     // CSRF protection
     $token = $this->trimmed('token');
     if (!$token || $token != common_session_token()) {
         $this->showForm(_('网页错误,请返回重试
                           '));
         return;
     }
     if (Event::handle('StartProfileSaveForm', array($this))) {
         $fullname = $this->trimmed('fullname');
         $homepage = $this->trimmed('homepage');
         $bio = $this->trimmed('bio');
         $location = $this->trimmed('location');
         $tagstring = $this->trimmed('tags');
         // Some validation
         if (!is_null($homepage) && strlen($homepage) > 0 && !Validate::uri($homepage, array('allowed_schemes' => array('http', 'https')))) {
             $this->showForm(_('个人主页地址不正确'));
             return;
         } else {
             if (!is_null($fullname) && mb_strlen($fullname) > 255) {
                 $this->showForm(_('真实姓名过长'));
                 return;
             } else {
                 if (Profile::bioTooLong($bio)) {
                     $this->showForm(sprintf(_('自我描述过长'), Profile::maxBio()));
                     return;
                 } else {
                     if (!is_null($location) && mb_strlen($location) > 255) {
                         $this->showForm(_('位置信息过长'));
                         return;
                     }
                 }
             }
         }
         if ($tagstring) {
             $tags = array_map('common_canonical_tag', preg_split('/[\\s,]+/', $tagstring));
         } else {
             $tags = array();
         }
         foreach ($tags as $tag) {
             if (!common_valid_profile_tag($tag)) {
                 $this->showForm(sprintf(_('标签格式不正确: "%s"'), $tag));
                 return;
             }
         }
         $user = common_current_user();
         $user->query('BEGIN');
         $profile = $user->getProfile();
         $orig_profile = clone $profile;
         $profile->nickname = $user->nickname;
         $profile->fullname = $fullname;
         $profile->homepage = $homepage;
         $profile->bio = $bio;
         $profile->location = $location;
         $loc = Location::fromName($location);
         if (empty($loc)) {
             $profile->lat = null;
             $profile->lon = null;
             $profile->location_id = null;
             $profile->location_ns = null;
         } else {
             $profile->lat = $loc->lat;
             $profile->lon = $loc->lon;
             $profile->location_id = $loc->location_id;
             $profile->location_ns = $loc->location_ns;
         }
         if (common_config('location', 'share') == 'user') {
             $exists = false;
             $prefs = User_location_prefs::staticGet('user_id', $user->id);
             if (empty($prefs)) {
                 $prefs = new User_location_prefs();
                 $prefs->user_id = $user->id;
                 $prefs->created = common_sql_now();
             } else {
                 $exists = true;
                 $orig = clone $prefs;
             }
             $prefs->share_location = $this->boolean('sharelocation');
             if ($exists) {
                 $result = $prefs->update($orig);
             } else {
                 $result = $prefs->insert();
             }
             if ($result === false) {
                 common_log_db_error($prefs, $exists ? 'UPDATE' : 'INSERT', __FILE__);
                 $this->serverError(_('Couldn\'t save location prefs.'));
                 return;
             }
         }
         common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
         common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
//.........这里部分代码省略.........
开发者ID:himmelex,项目名称:NTW,代码行数:101,代码来源:profilesettings.php

示例14: setOriginal

 function setOriginal($filename)
 {
     // This should be handled by the Profile->setOriginal function so user and group avatars are handled the same
     $imagefile = new ImageFile(null, Avatar::path($filename));
     $sizes = array('homepage_logo' => AVATAR_PROFILE_SIZE, 'stream_logo' => AVATAR_STREAM_SIZE, 'mini_logo' => AVATAR_MINI_SIZE);
     $orig = clone $this;
     $this->original_logo = Avatar::url($filename);
     foreach ($sizes as $name => $size) {
         $filename = Avatar::filename($this->profile_id, image_type_to_extension($imagefile->preferredType()), $size, common_timestamp());
         $imagefile->resizeTo(Avatar::path($filename), array('width' => $size, 'height' => $size));
         $this->{$name} = Avatar::url($filename);
     }
     common_debug(common_log_objstring($this));
     return $this->update($orig);
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:15,代码来源:User_group.php

示例15: handlePost


//.........这里部分代码省略.........
                 if (!is_null($fullname) && mb_strlen($fullname) > 255) {
                     $this->showForm(_('Full name is too long (max 255 chars).'));
                     return;
                 } else {
                     if (!is_null($bio) && mb_strlen($bio) > 140) {
                         $this->showForm(_('Bio is too long (max 140 chars).'));
                         return;
                     } else {
                         if (!is_null($location) && mb_strlen($location) > 255) {
                             $this->showForm(_('Location is too long (max 255 chars).'));
                             return;
                         } else {
                             if (is_null($timezone) || !in_array($timezone, DateTimeZone::listIdentifiers())) {
                                 $this->showForm(_('Timezone not selected.'));
                                 return;
                             } else {
                                 if ($this->nicknameExists($nickname)) {
                                     $this->showForm(_('Nickname already in use. Try another one.'));
                                     return;
                                 } else {
                                     if (!is_null($language) && strlen($language) > 50) {
                                         $this->showForm(_('Language is too long (max 50 chars).'));
                                         return;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($tagstring) {
         $tags = array_map('common_canonical_tag', preg_split('/[\\s,]+/', $tagstring));
     } else {
         $tags = array();
     }
     foreach ($tags as $tag) {
         if (!common_valid_profile_tag($tag)) {
             $this->showForm(sprintf(_('Invalid tag: "%s"'), $tag));
             return;
         }
     }
     $user = common_current_user();
     $user->query('BEGIN');
     if ($user->nickname != $nickname || $user->language != $language || $user->timezone != $timezone) {
         common_debug('Updating user nickname from ' . $user->nickname . ' to ' . $nickname, __FILE__);
         common_debug('Updating user language from ' . $user->language . ' to ' . $language, __FILE__);
         common_debug('Updating user timezone from ' . $user->timezone . ' to ' . $timezone, __FILE__);
         $original = clone $user;
         $user->nickname = $nickname;
         $user->language = $language;
         $user->timezone = $timezone;
         $result = $user->updateKeys($original);
         if ($result === false) {
             common_log_db_error($user, 'UPDATE', __FILE__);
             $this->serverError(_('Couldn\'t update user.'));
             return;
         } else {
             # Re-initialize language environment if it changed
             common_init_language();
         }
     }
     # XXX: XOR
     if ($user->autosubscribe ^ $autosubscribe) {
         $original = clone $user;
         $user->autosubscribe = $autosubscribe;
         $result = $user->update($original);
         if ($result === false) {
             common_log_db_error($user, 'UPDATE', __FILE__);
             $this->serverError(_('Couldn\'t update user for autosubscribe.'));
             return;
         }
     }
     $profile = $user->getProfile();
     $orig_profile = clone $profile;
     $profile->nickname = $user->nickname;
     $profile->fullname = $fullname;
     $profile->homepage = $homepage;
     $profile->bio = $bio;
     $profile->location = $location;
     $profile->profileurl = common_profile_url($nickname);
     common_debug('Old profile: ' . common_log_objstring($orig_profile), __FILE__);
     common_debug('New profile: ' . common_log_objstring($profile), __FILE__);
     $result = $profile->update($orig_profile);
     if (!$result) {
         common_log_db_error($profile, 'UPDATE', __FILE__);
         $this->serverError(_('Couldn\'t save profile.'));
         return;
     }
     # Set the user tags
     $result = $user->setSelfTags($tags);
     if (!$result) {
         $this->serverError(_('Couldn\'t save tags.'));
         return;
     }
     $user->query('COMMIT');
     common_broadcast_profile($profile);
     $this->showForm(_('Settings saved.'), true);
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:101,代码来源:profilesettings.php


注:本文中的common_log_objstring函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。