public function setVisibility($type, $vvalue)
 {
     if (is_null($this->visibility)) {
         $this->visibility = new Visibility();
     }
     $this->visibility->setType($type);
     $this->visibility->setValue($vvalue);
     return $this;
 }
示例#2
0
 function up()
 {
     $sql = "CREATE TABLE IF NOT EXISTS `user_visibility_settings` (\n  `user_id` varchar(32)  NOT NULL DEFAULT '',\n  `visibilityid` int(11) NOT NULL AUTO_INCREMENT,\n  `parent_id` int(11) NOT NULL,\n  `category` int(2)  NOT NULL,\n  `name` varchar(128)  NOT NULL,\n  `state` int(2) NULL,\n  `plugin` int(11),\n  `identifier` varchar(64)  NOT NULL,\n  PRIMARY KEY (`visibilityid`),\n  KEY `parent_id` (`parent_id`),\n  KEY `identifier` (`identifier`),\n  KEY `userid` (`user_id`)\n) ENGINE=MyISAM";
     $db = DBManager::get();
     $stmt = $db->prepare($sql);
     $stmt->execute();
     $category = array('Studien-/Einrichtungsdaten' => 'studdata', 'Private Daten' => 'privatedata', 'Zusätzliche Datenfelder' => 'additionaldata', 'Eigene Kategorien' => 'owncategory', 'Allgemeine Daten' => 'commondata');
     $result = $db->query("SELECT value FROM config WHERE field = 'HOMEPAGE_VISIBILITY_DEFAULT' ORDER BY is_default LIMIT 1");
     $default_visibility = constant($result->fetchColumn());
     $sql = "SELECT `username` FROM `auth_user_md5`";
     $stmt = $db->prepare($sql);
     $stmt->execute();
     while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $about = new about($result['username'], '');
         Visibility::createDefaultCategories($about->auth_user['user_id']);
         //copy all homepage visibility
         $elements = $about->get_homepage_elements();
         if (is_array($elements)) {
             foreach ($elements as $key => $state) {
                 if ($state['visibility'] != $default_visibility) {
                     Visibility::addPrivacySetting($state['name'], $key, $category[$state['category']], 1, $about->auth_user['user_id'], $state['visibility']);
                 }
             }
         }
     }
 }
 public static function data_objects_taxon_concepts()
 {
     // create a temporary table for this session
     $GLOBALS['db_connection']->query("DROP TABLE IF EXISTS `data_objects_taxon_concepts_tmp`");
     $GLOBALS['db_connection']->query("CREATE TABLE `data_objects_taxon_concepts_tmp` (\n                  `taxon_concept_id` int unsigned NOT NULL,\n                  `data_object_id` int unsigned NOT NULL,\n                  PRIMARY KEY  (`taxon_concept_id`, `data_object_id`),\n                  KEY `data_object_id` (`data_object_id`)\n                ) ENGINE=InnoDB DEFAULT CHARSET=utf8");
     $GLOBALS['db_connection']->insert("CREATE TABLE IF NOT EXISTS data_objects_taxon_concepts LIKE data_objects_taxon_concepts_tmp");
     // $GLOBALS['db_connection']->insert("CREATE TABLE IF NOT EXISTS data_objects_taxon_concepts_tmp LIKE data_objects_taxon_concepts");
     // $GLOBALS['db_connection']->delete("TRUNCATE TABLE data_objects_taxon_concepts_tmp");
     $start = 0;
     $stop = 0;
     $batch_size = 50000;
     $result = $GLOBALS['db_connection']->query("SELECT MIN(id) min, MAX(id) max FROM data_objects");
     if ($result && ($row = $result->fetch_assoc())) {
         $start = $row['min'];
         $stop = $row['max'];
     }
     for ($i = $start; $i < $stop; $i += $batch_size) {
         debug("Inserting " . ($i - $start + $batch_size) / $batch_size . " of " . ceil(($stop - $start) / $batch_size));
         $outfile = $GLOBALS['db_connection']->select_into_outfile("SELECT tc.id, do.id FROM taxon_concepts tc JOIN hierarchy_entries he ON (tc.id=he.taxon_concept_id) JOIN data_objects_hierarchy_entries dohe ON (he.id=dohe.hierarchy_entry_id) JOIN data_objects do ON (dohe.data_object_id=do.id) WHERE (tc.supercedure_id IS NULL OR tc.supercedure_id=0) AND (do.published=1 OR dohe.visibility_id!=" . Visibility::visible()->id . ") AND do.id BETWEEN {$i} AND " . ($i + $batch_size));
         $GLOBALS['db_connection']->load_data_infile($outfile, 'data_objects_taxon_concepts_tmp');
         unlink($outfile);
         $outfile = $GLOBALS['db_connection']->select_into_outfile("SELECT tc.id, do.id FROM taxon_concepts tc JOIN hierarchy_entries he ON (tc.id=he.taxon_concept_id) JOIN curated_data_objects_hierarchy_entries cdohe ON (he.id=cdohe.hierarchy_entry_id) JOIN data_objects do ON (cdohe.data_object_id=do.id) WHERE (tc.supercedure_id IS NULL OR tc.supercedure_id=0) AND (do.published=1 OR cdohe.visibility_id!=" . Visibility::visible()->id . ") AND do.id BETWEEN {$i} AND " . ($i + $batch_size));
         $GLOBALS['db_connection']->load_data_infile($outfile, 'data_objects_taxon_concepts_tmp');
         unlink($outfile);
         $outfile = $GLOBALS['db_connection']->select_into_outfile("SELECT tc.id, do.id FROM taxon_concepts tc JOIN users_data_objects udo ON (tc.id=udo.taxon_concept_id) JOIN data_objects do ON (udo.data_object_id=do.id) WHERE (tc.supercedure_id IS NULL OR tc.supercedure_id=0) AND (do.published=1 OR udo.visibility_id!=" . Visibility::visible()->id . ") AND do.id BETWEEN {$i} AND " . ($i + $batch_size));
         $GLOBALS['db_connection']->load_data_infile($outfile, 'data_objects_taxon_concepts_tmp');
         unlink($outfile);
     }
     $result = $GLOBALS['db_connection']->query("SELECT 1 FROM data_objects_taxon_concepts_tmp LIMIT 1");
     if ($result && ($row = $result->fetch_assoc())) {
         $GLOBALS['db_connection']->swap_tables("data_objects_taxon_concepts", "data_objects_taxon_concepts_tmp");
     }
 }
示例#4
0
 public function __construct($photos = true, $freetext = null)
 {
     PlVCard::$folding = false;
     $this->visibility = Visibility::defaultForRead(Visibility::VIEW_PRIVATE);
     $this->freetext = $freetext;
     $this->photos = $photos;
 }
示例#5
0
 public function __construct(array $data)
 {
     foreach ($data as $key => $val) {
         $this->{$key} = $val;
     }
     $this->partner = PartnerSharing::fetchById($this->partner_id);
     $this->sharing_visibility = Visibility::get($this->sharing_level);
 }
 private function lookup_curated_best_entries($start, $limit)
 {
     $curated_best_entries = array();
     $query = "SELECT c.taxon_concept_id, c.hierarchy_entry_id\n            FROM curated_taxon_concept_preferred_entries c\n            JOIN hierarchy_entries he ON (c.hierarchy_entry_id=he.id)\n            WHERE c.taxon_concept_id BETWEEN {$start} AND " . ($start + $limit) . " AND he.published=1 AND he.visibility_id=" . Visibility::visible()->id;
     foreach ($this->mysqli->iterate_file($query) as $row_num => $row) {
         $taxon_concept_id = $row[0];
         $hierarchy_entry_id = $row[1];
         $curated_best_entries[$taxon_concept_id] = $hierarchy_entry_id;
     }
     return $curated_best_entries;
 }
示例#7
0
文件: studies.php 项目: ratbird/hope
 /**
  * Stores the study information of a user (subject and degree-wise).
  */
 public function store_sg_action()
 {
     $this->check_ticket();
     $any_change = false;
     $fach_abschluss_delete = Request::getArray('fach_abschluss_delete');
     if (count($fach_abschluss_delete) > 0) {
         $query = "DELETE FROM user_studiengang\n                      WHERE user_id = ? AND studiengang_id = ? AND abschluss_id IN (?)";
         $statement = DBManager::get()->prepare($query);
         foreach ($fach_abschluss_delete as $studiengang_id => $abschluesse) {
             $statement->execute(array($this->user->user_id, $studiengang_id, $abschluesse));
             if ($statement->rowCount() > 0) {
                 $any_change = true;
             }
             // if we have no studies anymore we delete the visibilitysetting
             if (!$this->hasStudiengang()) {
                 Visibility::removePrivacySetting('studying');
             }
         }
     }
     if (!$any_change) {
         $query = "UPDATE IGNORE user_studiengang\n                      SET semester = ?\n                      WHERE user_id = ? AND studiengang_id = ? AND abschluss_id = ?";
         $statement = DBManager::get()->prepare($query);
         $change_fachsem = Request::getArray('change_fachsem');
         foreach ($change_fachsem as $studiengang_id => $abschluesse) {
             foreach ($abschluesse as $abschluss_id => $semester) {
                 $statement->execute(array($semester, $this->user->user_id, $studiengang_id, $abschluss_id));
                 if ($statement->rowCount() > 0) {
                     $any_change = true;
                 }
             }
         }
         $new_studiengang = Request::option('new_studiengang');
         if ($new_studiengang && $new_studiengang != 'none') {
             if (!$this->hasStudiengang()) {
                 Visibility::addPrivacySetting(_("Wo ich studiere"), 'studying', 'studdata');
             }
             $query = "INSERT IGNORE INTO user_studiengang\n                            (user_id, studiengang_id, abschluss_id, semester)\n                          VALUES (?, ?, ?, ?)";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($this->user->user_id, $new_studiengang, Request::option('new_abschluss'), Request::int('fachsem')));
             if ($statement->rowCount() > 0) {
                 $any_change = true;
             }
         }
     }
     if ($any_change) {
         $this->reportSuccess(_('Die Zuordnung zu Studiengängen wurde geändert.'));
         setTempLanguage($this->user->user_id);
         $this->postPrivateMessage(_("Die Zuordnung zu Studiengängen wurde geändert!\n"));
         restoreLanguage();
     }
     $this->redirect('settings/studies');
 }
示例#8
0
文件: vCard.php 项目: ratbird/hope
 /**
  * Export of a single user
  * 
  * @param User $user Userobject
  * @return String vCard export string
  */
 private static function exportUser(User $user)
 {
     // If user is not visible export nothing
     if (!get_visibility_by_id($user->id)) {
         return "";
     }
     // vCard exportheader
     $vCard['BEGIN'] = 'VCARD';
     $vCard['VERSION'] = '3.0';
     $vCard['PRODID'] = 'Stud.IP//' . $GLOBALS['UNI_NAME_CLEAN'] . '//DE';
     $vCard['REV'] = date('Y-m-d  H:i:s');
     $vCard['TZ'] = date('O');
     // User specific data
     //Fullname
     $vCard['FN'] = studip_utf8encode($user->getFullname());
     //Name
     $vCard['N'][] = studip_utf8encode($user->Nachname);
     $vCard['N'][] = studip_utf8encode($user->Vorname);
     $vCard['N'][] = studip_utf8encode($user->info->title_rear);
     $vCard['N'][] = studip_utf8encode($user->info->title_front);
     // Adress
     if (Visibility::verify('privadr', $user->id)) {
         $vCard['ADR;TYPE=HOME'] = studip_utf8encode($user->info->privadr);
     }
     // Tel
     if (Visibility::verify('private_phone', $user->id)) {
         $vCard['TEL;TYPE=HOME'] = studip_utf8encode($user->info->privatnr);
     }
     if (Visibility::verify('private_cell', $user->id)) {
         $vCard['TEL;TYPE=CELL'] = studip_utf8encode($user->info->privatcell);
     }
     // Email
     if (get_local_visibility_by_id($user->id, 'email')) {
         $vCard['EMAIL'] = studip_utf8encode($user->email);
     }
     // Photo
     if (Visibility::verify('picture', $user->id)) {
         // Fetch avatar
         $avatar = Avatar::getAvatar($user->id);
         // Only export if
         if ($avatar->is_customized()) {
             $vCard['PHOTO;JPEG;ENCODING=BASE64'] = base64_encode(file_get_contents($avatar->getFilename(Avatar::NORMAL)));
         }
     }
     // vCard end
     $vCard['END'] = 'VCARD';
     // Produce string
     foreach ($vCard as $index => $value) {
         $exportString .= $value ? $index . ':' . (is_array($value) ? join(';', $value) : $value) . "\r\n" : "";
     }
     return $exportString;
 }
示例#9
0
文件: User.php 项目: ratbird/hope
 /**
  * getUser - retrieves data of a user
  *
  * @get /user/:user_id
  * @get /user
  */
 public function getUser($user_id = '')
 {
     $user_id = $user_id ?: $GLOBALS['user']->id;
     $user = \User::find($user_id);
     if (!$user) {
         $this->halt(404, sprintf('User %s not found', $user_id));
     }
     $visibilities = get_local_visibility_by_id($user_id, 'homepage');
     if (is_array(json_decode($visibilities, true))) {
         $visibilities = json_decode($visibilities, true);
     } else {
         $visibilities = array();
     }
     $get_field = function ($field, $visibility) use($user_id, $user, $visibilities) {
         if (!$user[$field] || !is_element_visible_for_user($GLOBALS['user']->id, $user_id, $visibilities[$visibility])) {
             return '';
         }
         return $user[$field];
     };
     $avatar = \Avatar::getAvatar($user_id);
     $user = array('user_id' => $user_id, 'username' => $user['username'], 'name' => self::getNamesOfUser($user), 'perms' => $user['perms'], 'email' => get_visible_email($user_id), 'avatar_small' => $avatar->getURL(\Avatar::SMALL), 'avatar_medium' => $avatar->getURL(\Avatar::MEDIUM), 'avatar_normal' => $avatar->getURL(\Avatar::NORMAL), 'avatar_original' => $avatar->getURL(\Avatar::ORIGINAL), 'phone' => $get_field('privatnr', 'private_phone'), 'homepage' => $get_field('Home', 'homepage'), 'privadr' => strip_tags($get_field('privadr', 'privadr')));
     $query = "SELECT value\n                  FROM user_config\n                  WHERE field = ? AND user_id = ?";
     $statement = \DBManager::get()->prepare($query);
     $statement->execute(array('SKYPE_NAME', $user_id));
     $user['skype'] = $statement->fetchColumn() ?: '';
     $statement->closeCursor();
     if ($user['skype']) {
         $statement->execute(array('SKYPE_ONLINE_STATUS', $user_id));
         $user['skype_show'] = (bool) $statement->fetchColumn();
     } else {
         $user['skype_show'] = false;
     }
     // Data fields
     $datafields = array();
     foreach (\DataFieldEntry::getDataFieldEntries($user_id, 'user') as $entry) {
         if (!$entry->isVisible()) {
             continue;
         }
         if (!\Visibility::verify($entry->getID(), $user_id)) {
             continue;
         }
         $datafields[] = array('type' => $entry->getType(), 'id' => $entry->getId(), 'name' => $entry->getName(), 'value' => $entry->getValue());
     }
     $user['datafields'] = $datafields;
     $this->etag(md5(serialize($user)));
     return $user;
 }
示例#10
0
 public function value(ProfilePage $page, $field, $value, &$success)
 {
     $success = true;
     $addresses = array();
     if (is_null($value)) {
         $it = Address::iterate(array($page->pid()), array(Address::LINK_PROFILE), array(0), Visibility::get(Visibility::VIEW_ADMIN));
         while ($address = $it->next()) {
             $addresses[] = $address->toFormArray();
         }
         if (count($addresses) == 0) {
             $address = new Address(array('mail' => 1));
             $addresses[] = $address->toFormArray();
         }
         return $addresses;
     }
     return Address::formatFormArray($value, $success);
 }
示例#11
0
 function lookup_ranks($start, $limit, &$taxon_concept_ids = array())
 {
     debug("querying ranks");
     $query = "SELECT he.taxon_concept_id, he.rank_id\n          FROM hierarchy_entries he USE INDEX (taxon_concept_id)\n          WHERE he.visibility_id=" . Visibility::visible()->id . "\n          AND he.taxon_concept_id ";
     if ($taxon_concept_ids) {
         $query .= "IN (" . implode(",", $taxon_concept_ids) . ")";
     } else {
         $query .= "BETWEEN {$start} AND " . ($start + $limit);
     }
     foreach ($this->mysqli_slave->iterate_file($query) as $row_num => $row) {
         $taxon_concept_id = $row[0];
         $rank_id = $row[1];
         if ($rank_id) {
             if (!isset($this->ranks_ids[$taxon_concept_id][$rank_id])) {
                 $this->ranks_ids[$taxon_concept_id][$rank_id] = 1;
             } else {
                 $this->ranks_ids[$taxon_concept_id][$rank_id] += 1;
             }
         }
     }
 }
示例#12
0
 /**
  * Returns all the categorys and it's items
  * @return array categorys and it's items
  */
 public function getProfileSettings()
 {
     if (!isset($this->profileSettings)) {
         // if the default categories have not been created, do this now
         if (User_Visibility_Settings::countBySQL('user_id = ? AND category = 0', array($this->userid)) == 0) {
             Visibility::createDefaultCategories($this->userid);
         }
         $this->profileSettings = User_Visibility_Settings::findBySQL("user_id = ? AND parent_id = 0 AND identifier <> 'plugins'", array($this->userid));
         foreach ($this->profileSettings as $i => $vis) {
             $vis->loadChildren();
             // remap child settings to default categories
             if ($vis->category == 1) {
                 $idmap[$vis->identifier] = $vis;
                 unset($this->profileSettings[$i]);
             }
         }
         $about = new about($GLOBALS['user']->username, '');
         $elements = $about->get_homepage_elements();
         foreach ($elements as $key => $element) {
             foreach ($this->profileSettings as $vis) {
                 if ($vis->name === $element['category']) {
                     foreach ($vis->children as $child) {
                         if ($child->identifier === $key) {
                             $child->name = $element['name'];
                             break 2;
                         }
                     }
                     $child = $idmap[$key] ?: new User_Visibility_Settings();
                     $child->setData(array('user_id' => $this->userid, 'parent_id' => $vis->id, 'category' => 1, 'name' => $element['name'], 'state' => $element['visibility'], 'identifier' => $key));
                     $child->store();
                     $child->parent = $vis;
                     $child->setDisplayed();
                     $vis->children[] = $child;
                     break;
                 }
             }
         }
     }
     return $this->profileSettings;
 }
示例#13
0
文件: avatar.php 项目: ratbird/hope
 /**
  * Upload a new avatar or removes the current avatar.
  * Upon Sends an information email to the user if the action was not invoked
  * by himself.
  */
 public function upload_action()
 {
     $this->check_ticket();
     if (Request::submitted('reset')) {
         Avatar::getAvatar($this->user->user_id)->reset();
         Visibility::removePrivacySetting('picture', $this->user->user_id);
         $this->reportSuccess(_('Bild gelöscht.'));
     } elseif (Request::submitted('upload')) {
         try {
             Avatar::getAvatar($this->user->user_id)->createFromUpload('imgfile');
             NotificationCenter::postNotification('AvatarDidUpload', $this->user->user_id);
             $message = _('Die Bilddatei wurde erfolgreich hochgeladen. ' . 'Eventuell sehen Sie das neue Bild erst, nachdem Sie diese Seite ' . 'neu geladen haben (in den meisten Browsern F5 drücken).');
             $this->reportSuccess($message);
             setTempLanguage($this->user->user_id);
             $this->postPrivateMessage(_("Ein neues Bild wurde hochgeladen.\n"));
             restoreLanguage();
             Visibility::addPrivacySetting(_('Eigenes Bild'), 'picture', 'commondata', 1, $this->user->user_id);
         } catch (Exception $e) {
             $this->reportError($e->getMessage());
         }
     }
     $this->redirect('settings/avatar');
 }
示例#14
0
 public function get()
 {
     $cond = $this->getCond();
     $cond->addChild(new UFC_PartnerSharing($this->partner->id));
     $pf = new ProfileFilter($cond, $this->getOrders());
     $pf->restrictVisibilityForPartner($this->partner->id);
     $response = array();
     $matches = $pf->getTotalProfileCount();
     $response['matches'] = $matches;
     $profiles = array();
     if ($matches) {
         // TODO : improve fetching by passing an adequate FETCH field
         $iter = $pf->iterProfiles(new PlLimit($this->amount), 0x0, Visibility::get(Visibility::VIEW_PRIVATE));
         while ($profile = $iter->next()) {
             if ($profile->getPartnerSettings($this->partner->id)->exposed_uid !== 0) {
                 $profile_data = new WSRequestEntry($this->partner, $profile);
                 $profiles[] = $profile_data->getFields($this->fields);
             }
         }
     }
     $response['profiles'] = $profiles;
     return $response;
 }
示例#15
0
 /**
  * Collect user datafield informations
  *
  * @return array
  */
 function getDatafields()
 {
     // generische Datenfelder aufsammeln
     $short_datafields = array();
     $long_datafields = array();
     foreach (DataFieldEntry::getDataFieldEntries($this->current_user->user_id, 'user') as $entry) {
         if ($entry->isVisible() && $entry->getDisplayValue() && Visibility::verify($entry->getID(), $this->current_user->user_id)) {
             if ($entry instanceof DataFieldTextareaEntry) {
                 $long_datafields[] = $entry;
             } else {
                 $short_datafields[] = $entry;
             }
         }
     }
     return array('long' => $long_datafields, 'short' => $short_datafields);
 }
示例#16
0
文件: details.php 项目: ratbird/hope
 /**
  * Stores a user's details.
  */
 public function store_action()
 {
     $this->check_ticket();
     $changed = false;
     if (Config::get()->ENABLE_SKYPE_INFO) {
         $new_skype_name = Request::get('skype_name');
         if ($new_skype_name != $this->config->SKYPE_NAME) {
             $this->config->store('SKYPE_NAME', $new_skype_name);
             Visibility::updatePrivacySettingWithTest(Request::get('skype_name'), _("Skype Name"), "skype_name", 'privatedata', 1, $this->user->user_id);
             $changed = true;
         }
         if (Request::int('skype_online_status') != $this->config->SKYPE_ONLINE_STATUS) {
             $this->config->store('SKYPE_ONLINE_STATUS', Request::int('skype_online_status'));
             Visibility::updatePrivacySettingWithTest(Request::int('skype_online_status'), _("Skype Online Status"), "skype_online_status", 'skype_name', 1, $this->user->user_id);
             $changed = true;
         }
     }
     $mapping = array('telefon' => 'privatnr', 'cell' => 'privatcell', 'anschrift' => 'privadr', 'home' => 'Home', 'motto' => 'motto', 'hobby' => 'hobby', 'lebenslauf' => 'lebenslauf', 'schwerp' => 'schwerp', 'publi' => 'publi');
     // Visibilitymapping Remove in Stud.IP 3.0 with a migration
     $vis_mapping = array('telefon' => 'private_phone', 'cell' => 'private_cell', 'anschrift' => 'privadr', 'home' => 'homepage', 'motto' => 'motto', 'hobby' => 'hobby', 'lebenslauf' => 'lebenslauf', 'schwerp' => 'schwerp', 'publi' => 'publi');
     $settingsname = array('telefon' => _('Private Telefonnummer'), 'cell' => _('Private Handynummer'), 'anschrift' => _('Private Adresse'), 'home' => _('Homepage-Adresse'), 'motto' => _('Motto'), 'hobby' => _('Hobbies'), 'lebenslauf' => _('Lebenslauf'), 'schwerp' => _('Arbeitsschwerpunkte'), 'publi' => _('Publikationen'));
     foreach ($mapping as $key => $column) {
         $value = Request::get($key);
         if (in_array($key, array('hobby', 'lebenslauf', 'schwerp', 'publi'))) {
             // purify HTML input for these fields if wysiwyg is used
             $value = Studip\Markup::purifyHtml($value);
         }
         if ($this->user->{$column} != $value && $this->shallChange('user_info.' . $column, $column, $value)) {
             $this->user->{$column} = $value;
             Visibility::updatePrivacySettingWithTest($value, $settingsname[$key], $vis_mapping[$key], 'privatedata', 1, $this->user->user_id);
             $changed = true;
         }
     }
     $datafields_changed = false;
     $errors = array();
     $datafields = DataFieldEntry::getDataFieldEntries($this->user->user_id, 'user');
     $data = Request::getArray('datafields');
     foreach ($datafields as $id => $entry) {
         if (isset($data[$id]) && $data[$id] != $entry->getValue()) {
             // i really dont know if this is correct but it works
             Visibility::updatePrivacySettingWithTest($data[$id], $entry->getName(), $entry->getID(), 'additionaldata', 1, $this->user->user_id);
             $entry->setValueFromSubmit($data[$id]);
             if ($entry->isValid()) {
                 if ($entry->store()) {
                     $datafields_changed = true;
                 }
             } else {
                 $errors[] = sprintf(_('Fehlerhafter Eintrag im Feld <em>%s</em>: %s (Eintrag wurde nicht gespeichert)'), $entry->getName(), $entry->getDisplayValue());
             }
         }
     }
     if (count($errors) > 0) {
         $this->reportErrorWithDetails(_('Bitte überprüfen Sie Ihre Eingaben.'), $errors);
     } else {
         if ($this->user->store() || $changed || $datafields_changed) {
             $this->reportSuccess(_('Daten im Lebenslauf u.a. wurden geändert.'));
             setTempLanguage($this->user->user_id);
             $this->postPrivateMessage(_('Daten im Lebenslauf u.a. wurden geändert.'));
             restoreLanguage();
         }
     }
     $this->redirect('settings/details');
 }
示例#17
0
 /**
  * Updates a privacySetting. Important: The whole privacySetting gets
  * deleted and recreated if the teststring is not empty. Therefore a new
  * visibilityID is created. If you use the privacyID you will have to update
  * it as well.
  *
  * @param string $test A teststring to determine if the privacySetting is
  * only deleted or if it is deleted and recreated. Use this with a request-
  * string for example.
  *
  * @param string $name The setting's name, that will be displayed in the
  * user's settingtab (Important: Don't mix the name up with the identifier)
  *
  * @param string $identifier the identifier is used to simplify the usage
  * of the visibilityAPI. An identifier maps a string to a visibilityid
  * (under the usage of a userid) therefore all identifier set for one user
  * MUST be unique.
  *
  * @param int|string $parent Determines the parent of the visibility to add.
  * Use the direct visibilityid of the parent visibility or the identifier.
  * If the visibility should be created on the top level the value has to be
  * 0. Plugins creating a privacysetting will automaticly be added to the
  * parent "plugins". Important: If u add a visibility without a parent and
  * without beeing a toplevelpoint itself it will NEVER be displayed.
  *
  * @param int $category Sets the type of the visibilitysetting. Currently
  * there are only 2 types available:
  * 0 - The setting is only a header without any options
  * 1 (Default) - Normal setting
  *
  * @param string $user Userid of the user that should be added the visibility.
  * Default: The current logged on user
  *
  * @param int $default int representation of the visibility that should be
  * set. Use with caution since the API provides the easy change of the
  * visibility int representation
  *
  * @param int $pluginid Connects the created visibility with a plugin.
  * Important: If addPrivacySetting is called in a file of a plugin there is
  * no need to set the pluginid manually, because the API will normally find
  * it
  *
  * @return int the created visibilityid
  */
 public static function updatePrivacySettingWithTest($test, $name, $id, $parent = null, $category = 1, $user = null, $default = null, $pluginid = null)
 {
     $default = Visibility::removePrivacySetting($id, $user);
     if ($test != "") {
         return Visibility::addPrivacySetting($name, $id, $parent, $category, $user, $default, $pluginid);
     }
     return false;
 }
 protected function getVisibility($context)
 {
     return Visibility::getForContext($context);
 }
 private static function concept_published_in_hierarchy($taxon_concept_id, $hierarchy_id)
 {
     $mysqli =& $GLOBALS['mysqli_connection'];
     $result = $mysqli->query("SELECT 1 FROM hierarchy_entries WHERE taxon_concept_id={$taxon_concept_id} AND hierarchy_id={$hierarchy_id} AND visibility_id=" . Visibility::visible()->id . " LIMIT 1");
     if ($result && ($row = $result->fetch_assoc())) {
         return true;
     }
     return false;
 }
 private function lookup_family($name, $synonyms, $ancestors)
 {
     $order = @$ancestors[15];
     $class = @$ancestors[11];
     $phylum = @$ancestors[6];
     if (!$order && !$class && !$phylum) {
         echo "This is a line that doesnt have a order, class or phylum:\n{$line_number}: {$line} :: {$name}\n\n\n";
         exit;
     }
     $synonyms[] = $name;
     $result = $this->mysqli->query("\n            (SELECT n.id name_id, h.id hierarchy_id, h.browsable, he.taxon_concept_id, 'valid' match_type\n                FROM canonical_forms cf\n                JOIN names n ON (cf.id=n.canonical_form_id)\n                JOIN hierarchy_entries he ON (n.id=he.name_id)\n                JOIN hierarchies h ON (he.hierarchy_id=h.id)\n                WHERE cf.string IN ('" . implode("','", $synonyms) . "')\n                AND he.published=1 AND he.visibility_id=" . Visibility::visible()->id . ")\n            UNION\n            (SELECT n.id name_id, h.id hierarchy_id, h.browsable, he.taxon_concept_id, 'synonym' match_type\n                FROM canonical_forms cf\n                JOIN names n ON (cf.id=n.canonical_form_id)\n                JOIN synonyms s ON (n.id=s.name_id AND s.synonym_relation_id=" . SynonymRelation::synonym()->id . ")\n                JOIN hierarchy_entries he ON (s.hierarchy_entry_id=he.id)\n                JOIN hierarchies h ON (he.hierarchy_id=h.id)\n                WHERE cf.string IN ('" . implode("','", $synonyms) . "')\n                AND he.published=1 AND he.visibility_id=" . Visibility::visible()->id . ")");
     if ($result && $result->num_rows) {
         return $this->get_best_concept_from_result($result, $name);
     }
 }
示例#21
0
文件: privacy.php 项目: ratbird/hope
 /**
  * Performs bulk actions on the privacy settings of a user. This can be
  * either the setting of new default values or the changing of all privacy
  * values at once.
  * 
  * @return boolean Returns <b>true</b> if all visibilities have been set
  */
 public function bulk()
 {
     if ($default_visibility = Request::int('default')) {
         $this->about->set_default_homepage_visibility(Request::int('default'));
     }
     if ($visiblity = Request::int('all')) {
         if (Visibility::setAllSettingsForUser($visiblity)) {
             $this->reportSuccess(_('Die Sichtbarkeit der Profilelemente wurde gespeichert.'));
             return true;
         } else {
             $this->reportError(_('Die Sichtbarkeitseinstellungen der Profilelemente wurden nicht gespeichert!'));
         }
     }
     return false;
 }
示例#22
0
 static function lookup_existing_entry_and_ancestors($hierarchy_entry, $hierarchy_id)
 {
     $params = array();
     $params["name_id"] = $hierarchy_entry->name_id;
     $params["guid"] = $hierarchy_entry->guid;
     $params["hierarchy_id"] = $hierarchy_id;
     $params["rank_id"] = $hierarchy_entry->rank_id;
     $params["ancestry"] = $hierarchy_entry->ancestry;
     $params["taxon_concept_id"] = $hierarchy_entry->taxon_concept_id;
     $params["parent_id"] = 0;
     // $params["identifier"] = $taxon['identifier'];
     // $params["source_url"] = $taxon['source_url'];
     $params["visibility_id"] = Visibility::preview()->id;
     if ($parent = $hierarchy_entry->parent()) {
         if ($parent_entry = self::lookup_existing_entry_and_ancestors($parent, $hierarchy_id)) {
             $params["parent_id"] = $parent_entry->id;
         } else {
             return false;
         }
     }
     return HierarchyEntry::find_or_create_by_array($params);
 }
 public function insert_gbif_references($row, $parameters)
 {
     self::debug_iterations("Inserting GBIF reference");
     $this->commit_iterations("GBIFReference", 500);
     if ($this->archive_validator->has_error_by_line('http://rs.gbif.org/terms/1.0/reference', $parameters['archive_table_definition']->location, $parameters['archive_line_number'])) {
         write_to_resource_harvesting_log("ERROR: insert_agents: insert_gbif_references" . ",file_location:" . $parameters['archive_table_definition']->location . ",line_number:" . $parameters['archive_line_number']);
         return false;
     }
     $reference_id = @self::field_decode($row['http://purl.org/dc/terms/identifier']);
     $taxon_id = @self::field_decode($row['http://rs.tdwg.org/dwc/terms/taxonID']);
     // we really only need to insert the references that relate to taxa
     if (!isset($this->taxon_ids_inserted[$taxon_id])) {
         return;
     }
     $full_reference = @self::field_decode($row['http://purl.org/dc/terms/bibliographicCitation']);
     $title = @self::field_decode($row['http://purl.org/dc/terms/title']);
     $author = @self::field_decode($row['http://purl.org/dc/terms/creator']);
     $date = @self::field_decode($row['http://purl.org/dc/terms/date']);
     $description = @self::field_decode($row['http://purl.org/dc/terms/description']);
     // $subject = @self::field_decode($row['http://purl.org/dc/terms/subject']);
     $source = @self::field_decode($row['http://purl.org/dc/terms/source']);
     $language = Language::find_or_create_for_parser(@self::field_decode($row['http://purl.org/dc/terms/language']));
     $type = @self::field_decode($row['http://purl.org/dc/terms/type']);
     if ($type != 'taxon') {
         return;
     }
     $reference_parts = array();
     if ($author) {
         $reference_parts[] = $author;
     }
     if ($date) {
         $reference_parts[] = $date;
     }
     if ($title) {
         $reference_parts[] = $title;
     }
     if ($source) {
         $reference_parts[] = $source;
     }
     if ($description) {
         $reference_parts[] = $description;
     }
     $full_reference = implode(". ", $reference_parts);
     $full_reference = str_replace("..", ".", $full_reference);
     $full_reference = str_replace("  ", " ", $full_reference);
     if (!$full_reference) {
         return;
     }
     $title = null;
     $author = null;
     $date = null;
     $description = null;
     $source = null;
     $type = null;
     if ($taxon_info = @$this->taxon_ids_inserted[$taxon_id]) {
         self::uncompress_array($taxon_info);
         $params = array("provider_mangaed_id" => $reference_id, "full_reference" => $full_reference, "title" => $title, "authors" => $author, "publication_created_at" => @$created ?: '0000-00-00 00:00:00', "language_id" => @$language->id ?: 0);
         $reference = Reference::find_or_create($params);
         $he_id = $taxon_info['hierarchy_entry_id'];
         $this->mysqli->insert("INSERT IGNORE INTO hierarchy_entries_refs (hierarchy_entry_id, ref_id) VALUES ({$he_id}, {$reference->id})");
         $this->mysqli->query("UPDATE refs SET published=1, visibility_id=" . Visibility::visible()->id . " WHERE id={$reference->id}");
         // TODO: find_or_create doesn't work here because of the dual primary key
         // HierarchyEntriesRef::find_or_create(array(
         //     'hierarchy_entry_id'    => $hierarchy_entry_id,
         //     'ref_id'                => $reference->id));
     }
 }
示例#24
0
 public function __construct($cond = null, $sort = null)
 {
     if (empty($this->joinMethods)) {
         $class = new ReflectionClass('UserFilter');
         foreach ($class->getMethods() as $method) {
             $name = $method->getName();
             if (substr($name, -5) == 'Joins' && $name != 'buildJoins') {
                 $this->joinMethods[] = $name;
             }
         }
     }
     if (!is_null($cond)) {
         if ($cond instanceof PlFilterCondition) {
             $this->setCondition($cond);
         }
     }
     if (!is_null($sort)) {
         if ($sort instanceof PlFilterOrder) {
             $this->addSort($sort);
         } else {
             if (is_array($sort)) {
                 foreach ($sort as $s) {
                     $this->addSort($s);
                 }
             }
         }
     }
     // This will set the visibility to the default correct level.
     $this->visibility = Visibility::defaultForRead();
 }
示例#25
0
$aux = 0;
$deleted = 0;
$phones = array();
$duplicates = array();
foreach ($pids as $pid) {
    $count = 0;
    $it = Phone::iterate(array($pid), array(Phone::LINK_PROFILE), array(0), Visibility::get(Visibility::VIEW_PRIVATE));
    while ($item = $it->next()) {
        $phones[] = $item;
        ++$count;
    }
    for ($i = 0; $i < $count; ++$i) {
        for ($j = $i + 1; $j < $count; ++$j) {
            if ($phones[$i]->search == $phones[$j]->search) {
                $duplicates[$j] = true;
                if (Visibility::isLessRestrictive($phones[$i]->pub, $phones[$j]->pub)) {
                    $phones[$i]->pub = $phones[$j]->pub;
                }
            }
        }
    }
    if (count($duplicates)) {
        foreach ($duplicates as $key => $bool) {
            unset($phones[$key]);
        }
    }
    if (count($phones) != $count) {
        $deleted += $count - count($phones);
        Phone::deletePhones($pid, 'user');
        $id = 0;
        foreach ($phones as $phone) {
示例#26
0
 public static function update_taxon_concept_names($taxon_concept_ids)
 {
     if (!$taxon_concept_ids) {
         return false;
     }
     if (is_numeric($taxon_concept_ids)) {
         $taxon_concept_ids = array($taxon_concept_ids);
     }
     $mysqli =& $GLOBALS['db_connection'];
     $started_new_transaction = false;
     if (!$mysqli->in_transaction()) {
         $mysqli->begin_transaction();
         $started_new_transaction = true;
     }
     $batches = array_chunk($taxon_concept_ids, 500);
     foreach ($batches as $batch_ids) {
         usleep(500000);
         $name_ids = array();
         $matching_ids = array();
         $query = "\n            (SELECT he.taxon_concept_id, he.id, he.name_id, 'preferred' as type FROM hierarchy_entries he WHERE taxon_concept_id IN (" . implode(",", $batch_ids) . ") AND ((he.published=1 AND he.visibility_id=" . Visibility::visible()->id . ") OR (he.published=0 AND he.visibility_id=" . Visibility::preview()->id . ")))\n            UNION\n            (SELECT he.taxon_concept_id, s.hierarchy_entry_id, s.name_id, 'synonym' as type\n            FROM hierarchy_entries he\n            JOIN synonyms s ON (he.id=s.hierarchy_entry_id)\n            WHERE he.taxon_concept_id IN (" . implode(",", $batch_ids) . ")\n            AND s.language_id=0\n            AND s.synonym_relation_id!=" . SynonymRelation::find_or_create_by_translated_label('genbank common name')->id . "\n            AND s.synonym_relation_id!=" . SynonymRelation::find_or_create_by_translated_label('common name')->id . "\n            AND s.synonym_relation_id!=" . SynonymRelation::find_or_create_by_translated_label('blast name')->id . "\n            AND s.synonym_relation_id!=" . SynonymRelation::find_or_create_by_translated_label('genbank acronym')->id . "\n            AND s.synonym_relation_id!=" . SynonymRelation::find_or_create_by_translated_label('acronym')->id . "\n            AND ((he.published=1 AND he.visibility_id=" . Visibility::visible()->id . ") OR (he.published=0 AND he.visibility_id=" . Visibility::preview()->id . ")))";
         foreach ($mysqli->iterate_file($query) as $row_num => $row) {
             $taxon_concept_id = $row[0];
             $hierarchy_entry_id = $row[1];
             $name_id = $row[2];
             $name_type = $row[3];
             $name_ids[$name_id][$taxon_concept_id] = 1;
             $matching_ids[$taxon_concept_id][$name_id][$hierarchy_entry_id] = $name_type;
         }
         if ($name_ids) {
             //This makes sure we have a scientific name, gets the canonicalFormID
             $query = "SELECT n.id, n_match.id FROM names n JOIN canonical_forms cf ON (n.canonical_form_id=cf.id) JOIN names n_match ON (cf.id=n_match.canonical_form_id) WHERE n.id IN (" . implode(",", array_keys($name_ids)) . ") AND n_match.string=cf.string";
             foreach ($mysqli->iterate_file($query) as $row_num => $row) {
                 $original_name_id = $row[0];
                 $canonical_name_id = $row[1];
                 if ($original_name_id != $canonical_name_id) {
                     foreach ($name_ids[$original_name_id] as $taxon_concept_id => $junk) {
                         $matching_ids[$taxon_concept_id][$canonical_name_id][0] = 1;
                     }
                 }
             }
         }
         $common_names = array();
         $preferred_in_language = array();
         $query = "SELECT he.taxon_concept_id, he.published, he.visibility_id, s.id, s.hierarchy_id, s.hierarchy_entry_id, s.name_id, s.language_id, s.preferred, s.vetted_id FROM hierarchy_entries he JOIN synonyms s ON (he.id=s.hierarchy_entry_id) JOIN vetted v ON (s.vetted_id=v.id) WHERE he.taxon_concept_id IN (" . implode(",", $batch_ids) . ") AND s.language_id!=0 AND (s.synonym_relation_id=" . SynonymRelation::genbank_common_name()->id . " OR s.synonym_relation_id=" . SynonymRelation::common_name()->id . ") ORDER BY s.language_id, (s.hierarchy_id=" . Hierarchy::contributors()->id . ") DESC, v.view_order ASC, s.preferred DESC, s.id DESC";
         foreach ($mysqli->iterate_file($query) as $row_num => $row) {
             $taxon_concept_id = $row[0];
             $published = $row[1];
             $visibility_id = $row[2];
             $synonym_id = $row[3];
             $hierarchy_id = $row[4];
             $hierarchy_entry_id = $row[5];
             $name_id = $row[6];
             $language_id = $row[7];
             $preferred = $row[8];
             $vetted_id = $row[9];
             // skipping Wikipedia common names entirely
             if ($hierarchy_id == @Hierarchy::wikipedia()->id) {
                 continue;
             }
             $curator_name = $hierarchy_id == @Hierarchy::contributors()->id;
             $ubio_name = $hierarchy_id == @Hierarchy::ubio()->id;
             if ($curator_name || $ubio_name || $curator_name || $published == 1 && $visibility_id == Visibility::visible()->id) {
                 if (isset($preferred_in_language[$taxon_concept_id][$language_id])) {
                     $preferred = 0;
                 }
                 if ($preferred && $curator_name && ($vetted_id == Vetted::trusted()->id || $vetted_id == Vetted::unknown()->id)) {
                     $preferred_in_language[$taxon_concept_id][$language_id] = 1;
                 } else {
                     $preferred = 0;
                 }
                 if (!isset($common_names[$taxon_concept_id])) {
                     $common_names[$taxon_concept_id] = array();
                 }
                 $common_names[$taxon_concept_id][] = array('synonym_id' => $synonym_id, 'language_id' => $language_id, 'name_id' => $name_id, 'hierarchy_entry_id' => $hierarchy_entry_id, 'preferred' => $preferred, 'vetted_id' => $vetted_id, 'is_curator_name' => $curator_name);
             }
         }
         // if there was no preferred name
         foreach ($common_names as $taxon_concept_id => $arr) {
             foreach ($arr as $key => $arr2) {
                 if (@(!$preferred_in_language[$taxon_concept_id][$arr2['language_id']]) && ($arr2['vetted_id'] == Vetted::trusted()->id || $arr2['vetted_id'] == Vetted::unknown()->id)) {
                     $common_names[$taxon_concept_id][$key]['preferred'] = 1;
                     $preferred_in_language[$taxon_concept_id][$arr2['language_id']] = 1;
                 }
             }
         }
         $mysqli->delete("DELETE FROM taxon_concept_names WHERE taxon_concept_id IN (" . implode(",", $batch_ids) . ")");
         $tmp_file_path = temp_filepath();
         if (!($LOAD_DATA_TEMP = fopen($tmp_file_path, "w+"))) {
             debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $tmp_file_path);
             return;
         }
         /* Insert the scientific names */
         foreach ($matching_ids as $taxon_concept_id => $arr) {
             foreach ($arr as $name_id => $arr2) {
                 foreach ($arr2 as $hierarchy_entry_id => $type) {
                     $preferred = 0;
                     if ($hierarchy_entry_id && $type == "preferred") {
                         $preferred = 1;
                     }
                     fwrite($LOAD_DATA_TEMP, "{$taxon_concept_id}\t{$name_id}\t{$hierarchy_entry_id}\t0\t0\t{$preferred}\n");
                 }
             }
         }
         $mysqli->load_data_infile($tmp_file_path, 'taxon_concept_names');
         unlink($tmp_file_path);
         $tmp_file_path = temp_filepath();
         if (!($LOAD_DATA_TEMP = fopen($tmp_file_path, "w+"))) {
             debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $tmp_file_path);
             return;
         }
         /* Insert the common names */
         foreach ($common_names as $taxon_concept_id => $arr) {
             foreach ($arr as $key => $arr2) {
                 $synonym_id = $arr2['synonym_id'];
                 $language_id = $arr2['language_id'];
                 $name_id = $arr2['name_id'];
                 $hierarchy_entry_id = $arr2['hierarchy_entry_id'];
                 $preferred = $arr2['preferred'];
                 $vetted_id = $arr2['vetted_id'];
                 fwrite($LOAD_DATA_TEMP, "{$taxon_concept_id}\t{$name_id}\t{$hierarchy_entry_id}\t{$language_id}\t1\t{$preferred}\t{$synonym_id}\t{$vetted_id}\n");
             }
         }
         $mysqli->load_data_infile($tmp_file_path, 'taxon_concept_names');
         unlink($tmp_file_path);
         unset($matching_ids);
         unset($common_names);
         unset($name_ids);
         unset($preferred_in_language);
         $mysqli->commit();
     }
     if ($started_new_transaction) {
         $mysqli->end_transaction();
     }
 }
示例#27
0
<?php

class Visibility
{
    // dva property-a sa razlicitim visibility parametrom
    public $publicVar = 'PUBLIC';
    private $privateVar = 'PRIVATE';
    // dvije metode sa razlicitim visibility parametrom
    public function publicMethod()
    {
        return 'PUBLIC';
    }
    private function privateMethod()
    {
        return 'PRIVATE';
    }
    public function getPrivateMethod()
    {
        return $this->privateVar;
    }
}
$visibility = new Visibility();
//echo '<br />', $visibility->publicVar;
//echo '<br />', $visibility->publicMethod();
//echo '<br />', $visibility->privateVar;
//echo '<br />', $visibility->privateMethod();
echo '<br />', $visibility->getPrivateMethod();
示例#28
0
文件: address.php 项目: Ekleog/platal
 public function __construct(array $pids, array $types, array $jobids, $visibility, $_where)
 {
     $where = array();
     if (!is_null($_where)) {
         $where[] = $_where;
     }
     if (count($pids) != 0) {
         $where[] = XDB::format('(pa.pid IN {?})', $pids);
     }
     if (count($types) != 0) {
         $where[] = XDB::format('(pa.type IN {?})', $types);
     }
     if (count($jobids) != 0) {
         $where[] = XDB::format('(pa.jobid IN {?})', $jobids);
     }
     if ($visibility == null || !$visibility instanceof Visibility) {
         $visibility = Visibility::defaultForRead();
     }
     $where[] = 'pve.best_display_level+0 <= pa.pub+0';
     $sql = 'SELECT  pa.pid, pa.jobid, pa.groupid, pa.type, pa.id, pa.flags, pa.text, pa.postalText, pa.pub, pa.comment,
                     pa.types, pa.formatted_address, pa.location_type, pa.partial_match, pa.latitude, pa.longitude,
                     pa.southwest_latitude, pa.southwest_longitude, pa.northeast_latitude, pa.northeast_longitude,
                     pa.geocoding_date, pa.geocoding_calls,
                     GROUP_CONCAT(DISTINCT pc.component_id SEPARATOR \',\') AS componentsIds,
                     GROUP_CONCAT(pace1.long_name) AS postalCode, GROUP_CONCAT(pace2.long_name) AS locality,
                     GROUP_CONCAT(pace3.long_name) AS administrativeArea, GROUP_CONCAT(pace4.long_name) AS country
               FROM  profile_addresses                 AS pa
          LEFT JOIN  profile_addresses_components      AS pc    ON (pa.pid = pc.pid AND pa.jobid = pc.jobid AND pa.groupid = pc.groupid
                                                                    AND pa.type = pc.type AND pa.id = pc.id)
          LEFT JOIN  profile_addresses_components_enum AS pace1 ON (FIND_IN_SET(\'postal_code\', pace1.types) AND pace1.id = pc.component_id)
          LEFT JOIN  profile_addresses_components_enum AS pace2 ON (FIND_IN_SET(\'locality\', pace2.types) AND pace2.id = pc.component_id)
          LEFT JOIN  profile_addresses_components_enum AS pace3 ON (FIND_IN_SET(\'administrative_area_level_1\', pace3.types) AND pace3.id = pc.component_id)
          LEFT JOIN  profile_addresses_components_enum AS pace4 ON (FIND_IN_SET(\'country\', pace4.types) AND pace4.id = pc.component_id)
          LEFT JOIN  profile_visibility_enum AS pve ON (pve.access_level = {?})
              WHERE  ' . implode(' AND ', $where) . '
           GROUP BY  pa.pid, pa.jobid, pa.groupid, pa.type, pa.id
           ORDER BY  pa.pid, pa.jobid, pa.id';
     $this->dbiter = XDB::iterator($sql, $visibility->level());
     $this->visibility = $visibility;
 }
示例#29
0
 /**
  * Stores all categories
  */
 public function store_action()
 {
     $request = Request::getInstance();
     $categories = $request['categories'];
     foreach ($categories as $id => $data) {
         if (empty($data['name'])) {
             $this->reportError(_('Kategorien ohne Namen können nicht gespeichert werden!'));
             continue;
         }
         $category = Kategorie::find($id);
         $category->name = $data['name'];
         $category->content = $data['content'];
         if ($category->store()) {
             $this->reportSuccess(_('Kategorien geändert!'));
             Visibility::renamePrivacySetting('kat_' . $category->id, $category->name);
         }
     }
     $this->redirect('settings/categories');
 }
示例#30
0
 /** Retrieve the 'general' edit visibility.
  * This is the maximum level of fields that may be edited by the current user on other profiles.
  *
  * Rules are:
  *  - Only admins can edit the 'hidden' fields
  *  - If someone has 'directory_edit' (which is actually directory_ax_edit): AX level
  *  - Otherwise, nothing.
  */
 public function editVisibility()
 {
     $level = Visibility::VIEW_NONE;
     if ($this->is_admin) {
         $level = Visibility::VIEW_ADMIN;
     } elseif ($this->checkPerms('directory_edit')) {
         $level = Visibility::VIEW_AX;
     }
     return Visibility::get($level);
 }