Exemplo n.º 1
0
 private static function ListMergeIssues(Profile $profile)
 {
     if (Platal::globals()->merge->state != 'done') {
         return null;
     }
     $flags = XDB::fetchOneCell('SELECT  issues
                                   FROM  profile_merge_issues
                                  WHERE  pid = {?}', $profile->id());
     if (!$flags) {
         return null;
     }
     return new PlFlagSet($flags);
 }
 protected function modify(Profile $profile)
 {
     $q = $this->dao->prepare('UPDATE ' . $this->table() . ' SET GENDER = :gender, LASTNAME = :lastname, FIRSTNAME = :firstname, DESCRIPTION = :description, PHONE = :phone, MOBILE_PHONE = :mobilePhone, OFFICE_PHONE = :officePhone, WEBSITE = :website, AVATAR = :avatar, USER_ID = :userId, MAIN_ADDRESS_ID = :mainAddressId, ALTERNATE_CURRENCIES_USED = :alternateCurrenciesUsed WHERE ID = :id');
     $q->bindValue(':gender', $profile->getGender());
     $q->bindValue(':lastname', $profile->getLastname());
     $q->bindValue(':firstname', $profile->getFirstname());
     $q->bindValue(':description', $profile->getDescription());
     $q->bindValue(':phone', $profile->getPhone());
     $q->bindValue(':mobilePhone', $profile->getMobilePhone());
     $q->bindValue(':officePhone', $profile->getOfficePhone());
     $q->bindValue(':website', $profile->getWebsite());
     $q->bindValue(':avatar', $profile->getAvatar());
     $q->bindValue(':userId', $profile->getUserId(), PDO::PARAM_INT);
     $q->bindValue(':mainAddressId', $profile->getMainAddressId(), PDO::PARAM_INT);
     $q->bindValue(':alternateCurrenciesUsed', $profile->getAlternateCurrenciesUsed());
     $q->bindValue(':id', $profile->id(), PDO::PARAM_INT);
     $q->execute();
 }
Exemplo n.º 3
0
 public function delRegistered(PlPage $page, Profile $profile)
 {
     XDB::execute('DELETE FROM  contacts
                         WHERE  uid = {?} AND contact = {?}', S::i('uid'), $profile->id());
     if (XDB::affectedRows() > 0) {
         S::user()->invalidWatchCache();
         Platal::session()->updateNbNotifs();
         $page->trigSuccess("Contact retiré !");
     }
 }
Exemplo n.º 4
0
 /** Check that the profile match the given rule.
  */
 public function checkProfile(Profile $profile)
 {
     $this->requireProfiles();
     $this->buildQuery();
     $count = (int) XDB::rawFetchOneCell('SELECT  COUNT(*)
                                        ' . $this->query . XDB::format(' AND p.pid = {?}', $profile->id()));
     return $count == 1;
 }
Exemplo n.º 5
0
 public function isWatchedUser(Profile $profile)
 {
     return in_array($profile->id(), $this->watchUsers());
 }
Exemplo n.º 6
0
function update_display_names(Profile $profile, array $public_names, array $private_names = null)
{
    if (is_null($private_names)) {
        $private_names = XDB::fetchAllAssoc('SELECT  type, name
                                               FROM  profile_private_names
                                              WHERE  pid = {?}
                                           ORDER BY  type, id', $profile->id());
    }
    $display_names = build_display_names($public_names, $private_names, $profile->isFemale());
    XDB::execute('UPDATE  profile_display
                     SET  public_name = {?}, private_name = {?},
                          directory_name = {?}, short_name = {?}, sort_name = {?}
                   WHERE  pid = {?}', $display_names['public_name'], $display_names['private_name'], $display_names['directory_name'], $display_names['short_name'], $display_names['sort_name'], $profile->id());
    Profile::rebuildSearchTokens($profile->id(), false);
    if ($profile->owner()) {
        update_account_from_profile($profile->owner()->id());
    }
}
Exemplo n.º 7
0
 public static function register(Profile $profile, $field)
 {
     XDB::execute('INSERT INTO  watch_profile (pid, ts, field)
                        VALUES  ({?}, NOW(), {?})
       ON DUPLICATE KEY UPDATE  ts = NOW()', $profile->id(), $field);
 }