本文整理汇总了PHP中Profile::free方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::free方法的具体用法?PHP Profile::free怎么用?PHP Profile::free使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::free方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showResults
function showResults($q, $page)
{
$profile = new Profile();
$search_engine = $profile->getSearchEngine('profile');
$search_engine->set_sort_mode('chron');
// Ask for an extra to see if there's more.
$search_engine->limit(($page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
if (false === $search_engine->query($q)) {
$cnt = 0;
} else {
$cnt = $profile->find();
}
if ($cnt > 0) {
$terms = preg_split('/[\\s,]+/', $q);
$results = new PeopleSearchResults($profile, $terms, $this);
$results->show();
$profile->free();
$this->pagination($page > 1, $cnt > PROFILES_PER_PAGE, $page, 'peoplesearch', array('q' => $q));
} else {
// TRANS: Message on the "People search" page where a query has no results.
$this->element('p', 'error', _('No results.'));
$this->searchSuggestions($q);
$profile->free();
}
}
示例2: 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.");
}
}
示例3: showResults
function showResults($q, $page)
{
$profile = new Profile();
// lcase it for comparison
// $q = strtolower($q);
$search_engine = $profile->getSearchEngine('identica_people');
$search_engine->set_sort_mode('chron');
// Ask for an extra to see if there's more.
$search_engine->limit(($page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
if (false === $search_engine->query($q)) {
$cnt = 0;
} else {
$cnt = $profile->find();
}
if ($cnt > 0) {
$terms = preg_split('/[\\s,]+/', $q);
$results = new PeopleSearchResults($profile, $terms, $this);
$results->show();
} else {
$this->element('p', 'error', _('No results'));
}
$profile->free();
$this->pagination($page > 1, $cnt > PROFILES_PER_PAGE, $page, 'peoplesearch', array('q' => $q));
}
示例4: Profile
-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');
$user = User::staticGet('nickname', $nickname);
if (empty($user)) {
print "Can't find user with nickname '{$nickname}'\n";
示例5: showContent
function showContent()
{
// XXX: Note I'm doing it this two-stage way because a raw query
// with a JOIN was *not* working. --Zach
$featured_nicks = common_config('nickname', 'featured');
if (count($featured_nicks) > 0) {
$quoted = array();
foreach ($featured_nicks as $nick) {
$quoted[] = "'{$nick}'";
}
$user = new User();
$user->whereAdd(sprintf('nickname IN (%s)', implode(',', $quoted)));
$user->limit(($this->page - 1) * PROFILES_PER_PAGE, PROFILES_PER_PAGE + 1);
$user->orderBy(common_database_tablename('user') . '.nickname ASC');
$user->find();
$profile_ids = array();
while ($user->fetch()) {
$profile_ids[] = $user->id;
}
$profile = new Profile();
$profile->whereAdd(sprintf('profile.id IN (%s)', implode(',', $profile_ids)));
$profile->orderBy('nickname ASC');
$cnt = $profile->find();
if ($cnt > 0) {
$featured = new ProfileList($profile, $this);
$featured->show();
}
$profile->free();
$this->pagination($this->page > 1, $cnt > PROFILES_PER_PAGE, $this->page, 'featured');
}
}
示例6: action_permitted_settings
/**
* Function to check the permission related to the setting module data
* @param string $current_file
* @param integer $sqrecord
* @return boolean
*/
public function action_permitted_settings($current_file, $sqrecord = '')
{
$retval = true;
if (preg_match("#^group(.*)\$#i", $current_file) == 1 && (int) $sqrecord > 0) {
$do_check = new Group();
$do_check->getId((int) $sqrecord);
if ($do_check->getNumRows() == 0) {
$retval = false;
}
$do_check->free();
}
if (preg_match("#^profile(.*)\$#i", $current_file) == 1 && (int) $sqrecord > 0) {
$do_check = new Profile();
$do_check->getId((int) $sqrecord);
if ($do_check->getNumRows() == 0) {
$retval = false;
} else {
if ($do_check->editable == 0 && ($current_file == 'profile_permissions' || $current_file == 'profile_details')) {
$retval = false;
}
}
$do_check->free();
}
if (preg_match("#^roles(.*)\$#i", $current_file) == 1) {
$idrole = '';
if ($_GET["parentrole"] != '') {
$idrole = $_GET["parentrole"];
} elseif ($_GET["idrole"] != '') {
$idrole = $_GET["idrole"];
}
if ($idrole != '') {
$do_check = new Roles();
$qry = "select * from `role` where idrole = :idrole";
$stmt = $do_check->getDbConnection()->prepare($qry);
$stmt->bindValue(":idrole", $idrole);
$stmt->execute();
if ($stmt->rowCount() == 0) {
$retval = false;
} else {
$row = $stmt->fetch();
if ($row["editable"] == 0 && ($current_file == 'roles_edit' || $current_file == 'roles_detail')) {
$retval = false;
}
}
$do_check->free();
}
}
return $retval;
}
示例7: initGroupProfileId
function initGroupProfileId()
{
printfnq("Ensuring all User_group entries have a Profile and profile_id...");
$group = new User_group();
$group->whereAdd('NOT EXISTS (SELECT id FROM profile WHERE id = user_group.profile_id)');
$group->find();
while ($group->fetch()) {
try {
// We must create a new, incrementally assigned profile_id
$profile = new Profile();
$profile->nickname = $group->nickname;
$profile->fullname = $group->fullname;
$profile->profileurl = $group->mainpage;
$profile->homepage = $group->homepage;
$profile->bio = $group->description;
$profile->location = $group->location;
$profile->created = $group->created;
$profile->modified = $group->modified;
$profile->query('BEGIN');
$id = $profile->insert();
if (empty($id)) {
$profile->query('ROLLBACK');
throw new Exception('Profile insertion failed, profileurl: ' . $profile->profileurl);
}
$group->query("UPDATE user_group SET profile_id={$id} WHERE id={$group->id}");
$profile->query('COMMIT');
$profile->free();
} catch (Exception $e) {
printfv("Error initializing Profile for group {$group->nickname}:" . $e->getMessage());
}
}
printfnq("DONE.\n");
}