本文整理汇总了PHP中Profile::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::fetch方法的具体用法?PHP Profile::fetch怎么用?PHP Profile::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::fetch方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateUserUrls
function updateUserUrls()
{
printfnq("Updating user URLs...\n");
// XXX: only update user URLs where out-of-date
$qry = "SELECT * FROM profile order by id asc";
$pflQry = new Profile();
$pflQry->query($qry);
$members = array();
while ($pflQry->fetch()) {
$members[] = clone $pflQry;
}
$pflQry->free();
foreach ($members as $member) {
$user = $member->getUser();
printfv("Updating user {$user->nickname}...");
try {
$profile = $user->getProfile();
updateProfileUrl($profile);
updateAvatarUrls($profile);
// Broadcast for remote users
common_broadcast_profile($profile);
} catch (Exception $e) {
printv("Error updating URLs: " . $e->getMessage());
}
printfv("DONE.");
}
}
示例2: getTagged
static function getTagged($tagger, $tag)
{
$profile = new Profile();
$profile->query('SELECT profile.* ' . 'FROM profile JOIN profile_tag ' . 'ON profile.id = profile_tag.tagged ' . 'WHERE profile_tag.tagger = ' . $tagger . ' ' . 'AND profile_tag.tag = "' . $tag . '" ');
$tagged = array();
while ($profile->fetch()) {
$tagged[] = clone $profile;
}
return $tagged;
}
示例3: get_missing_profiles
/**
* Check for profiles in the given id range that are missing, presumed deleted.
*
* @param int $start beginning profile.id, inclusive
* @param int $end final profile.id, inclusive
* @return array of integer profile.ids
* @access private
*/
function get_missing_profiles($start, $end)
{
$query = sprintf("SELECT id FROM profile WHERE id BETWEEN %d AND %d", $start, $end);
$profile = new Profile();
$profile->query($query);
$all = range($start, $end);
$known = array();
while ($row = $profile->fetch()) {
$known[] = intval($profile->id);
}
unset($profile);
$missing = array_diff($all, $known);
return $missing;
}
示例4: showResults
/**
* Search for users matching the query and spit the results out
* as a quick-n-dirty JSON document
*
* @return void
*/
function showResults()
{
$people = array();
$profile = new Profile();
$search_engine = $profile->getSearchEngine('profile');
$search_engine->set_sort_mode('nickname_desc');
$search_engine->limit(0, 10);
$search_engine->query(strtolower($this->query . '*'));
$cnt = $profile->find();
if ($cnt > 0) {
$sql = 'SELECT profile.* FROM profile, user WHERE profile.id = user.id ' . ' AND LEFT(LOWER(profile.nickname), ' . strlen($this->query) . ') = \'%s\' ' . ' LIMIT 0, 10';
$profile->query(sprintf($sql, $this->query));
}
while ($profile->fetch()) {
$people[] = $profile->nickname;
}
header('Content-Type: application/json; charset=utf-8');
print json_encode($people);
}
示例5: archives
private function archives($q)
{
global $db, $current_year;
if (isset($this->archive_year)) {
$r = $db["archives"]->select("profiles" . sprintf("%04d", $this->archive_year), "id", $q);
foreach ($r as $row) {
$p = new Profile($row["id"], $this->archive_year);
$this->results[] = $p->fetch();
unset($p);
}
} else {
$y = $current_year - 101;
while ($y >= 607) {
$r = $db["archives"]->select("profiles" . sprintf("%04d", $y), "id", $q);
foreach ($r as $row) {
$p = new Profile($row["id"], $y);
$this->results[] = $p->fetch();
unset($p);
}
$y -= 101;
}
}
}
示例6: handle
function handle($args)
{
parent::handle($args);
$profile = new Profile();
$profile->find();
$server = common_config('site', 'server');
$path = common_config('site', 'path');
$mainpath = 'http://' . $server . '/' . $path . '/index.php/';
//'http://192.168.1.123/statusnet_copy/index.php/';
while ($profile->fetch()) {
//echo $this->ID;
//$store[] = $object; // builds an array of object lines.
$nickname = $profile->nickname;
$profileurl = $mainpath . $nickname;
$data = Profile::staticGet('id', $profile->id);
$orign = clone $data;
$data->profileurl = $profileurl;
if (!$data->update($orign)) {
echo 'profile update error' . $data->id;
echo '<br>';
}
}
}
示例7: Profile
-i --id ID of the user to send email
-n --nickname nickname of the user to send email
-g --group Nickname or alias of group to send email
-G --group-id ID of group to send email
-a --all Send email to all members
END_OF_USERROLE_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
// Si tiene la opción all
if (have_option('a', 'all')) {
$qry = "SELECT * FROM profile order by id asc";
$pflQry = new Profile();
$pflQry->query($qry);
$members = array();
while ($pflQry->fetch()) {
$members[] = clone $pflQry;
}
$pflQry->free();
} else {
if (have_option('i', 'id') || have_option('n', 'nickname')) {
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
$profile = Profile::staticGet('id', $id);
if (empty($profile)) {
print "Can't find user with ID {$id}\n";
exit(1);
}
} else {
if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
示例8: realpath
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
$shortoptions = 'y';
$longoptions = array('yes');
$helptext = <<<END_OF_HELP
clean_profiles.php [options]
Deletes all profile table entries where the profile does not occur in the
notice table, is not a group and is not a local user. Very MySQL specific I think.
WARNING: This has not been tested thoroughly. Maybe we've missed a table to compare somewhere.
-y --yes do not wait for confirmation
END_OF_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (!have_option('y', 'yes')) {
print "About to delete profiles that we think are useless to save. Are you sure? [y/N] ";
$response = fgets(STDIN);
if (strtolower(trim($response)) != 'y') {
print "Aborting.\n";
exit(0);
}
}
print "Deleting";
$profile = new Profile();
$profile->query('SELECT * FROM profile WHERE ' . 'NOT (SELECT COUNT(*) FROM notice WHERE profile_id=profile.id) ' . 'AND NOT (SELECT COUNT(*) FROM user WHERE user.id=profile.id) ' . 'AND NOT (SELECT COUNT(*) FROM user_group WHERE user_group.profile_id=profile.id) ' . 'AND NOT (SELECT COUNT(*) FROM subscription WHERE subscriber=profile.id OR subscribed=profile.id) ');
while ($profile->fetch()) {
echo ' ' . $profile->getID() . ':' . $profile->getNickname();
$profile->delete();
}
print "\nDONE.\n";
示例9: getProfileByUrl
/**
* Look up a Profile by profileurl field. Profile::staticGet() was
* not working consistently.
*
* @param string $nickname local nickname of the Twitter user
* @param string $profileurl the profile url
*
* @return mixed value the first Profile with that url, or null
*/
function getProfileByUrl($nickname, $profileurl)
{
$profile = new Profile();
$profile->nickname = $nickname;
$profile->profileurl = $profileurl;
$profile->limit(1);
if ($profile->find()) {
$profile->fetch();
return $profile;
}
return null;
}
示例10: prepare
protected function prepare(array $args = array())
{
// If we die, show short error messages.
GNUsocial::setApi(true);
parent::prepare($args);
$this->groups = array();
$this->profiles = array();
$term = $this->arg('term');
$limit = $this->arg('limit');
if ($limit > 200) {
$limit = 200;
}
//prevent DOS attacks
if (substr($term, 0, 1) == '@') {
//profile search
$term = substr($term, 1);
$profile = new Profile();
$profile->limit($limit);
$profile->whereAdd('nickname like \'' . trim($profile->escape($term), '\'') . '%\'');
$profile->whereAdd(sprintf('id in (SELECT id FROM user) OR ' . 'id in (SELECT subscribed from subscription' . ' where subscriber = %d)', $this->scoped->id));
if ($profile->find()) {
while ($profile->fetch()) {
$this->profiles[] = clone $profile;
}
}
}
if (substr($term, 0, 1) == '!') {
//group search
$term = substr($term, 1);
$group = new User_group();
$group->limit($limit);
$group->whereAdd('nickname like \'' . trim($group->escape($term), '\'') . '%\'');
//Can't post to groups we're not subscribed to...:
$group->whereAdd(sprintf('id in (SELECT group_id FROM group_member' . ' WHERE profile_id = %d)', $this->scoped->id));
if ($group->find()) {
while ($group->fetch()) {
$this->groups[] = clone $group;
}
}
}
return true;
}
示例11: fetchQQ
public static function fetchQQ($username)
{
$cached_profile = Profile::fetch($username);
return $cached_profile['qq'];
}
示例12: getTaggedSubscribers
function getTaggedSubscribers($tag)
{
$qry = 'SELECT profile.* ' . 'FROM profile JOIN (subscription, profile_tag, profile_list) ' . 'ON profile.id = subscription.subscriber ' . 'AND profile.id = profile_tag.tagged ' . 'AND profile_tag.tagger = profile_list.tagger AND profile_tag.tag = profile_list.tag ' . 'WHERE subscription.subscribed = %d ' . 'AND subscription.subscribed != subscription.subscriber ' . 'AND profile_tag.tagger = %d AND profile_tag.tag = "%s" ' . 'AND profile_list.private = false ' . 'ORDER BY subscription.created DESC';
$profile = new Profile();
$tagged = array();
$cnt = $profile->query(sprintf($qry, $this->id, $this->id, $tag));
while ($profile->fetch()) {
$tagged[] = clone $profile;
}
return $tagged;
}
示例13: getResults
function getResults()
{
$profiles = array();
$q = $this->arg('q');
$q = strtolower($q);
if (strlen($q) < 3) {
// TRANS: Error message in case a search is shorter than three characters.
$this->msg = _('The search string must be at least 3 characters long.');
}
$page = $this->arg('page');
$page = (int) (empty($page) ? 1 : $page);
$profile = new Profile();
$search_engine = $profile->getSearchEngine('profile');
if (Event::handle('StartProfileCompletionSearch', array($this, &$profile, $search_engine))) {
$search_engine->set_sort_mode('chron');
$search_engine->limit(($page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
if (false === $search_engine->query($q)) {
$cnt = 0;
} else {
$cnt = $profile->find();
}
Event::handle('EndProfileCompletionSearch', array($this, &$profile, $search_engine));
}
while ($profile->fetch()) {
$profiles[] = clone $profile;
}
return $this->filter($profiles);
}