Esempio n. 1
0
 /**
  * Processes the input of the administration interface for RssAggregator
  *
  * @return void
  */
 public function processAdminUI()
 {
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         /*
          * number_of_display_items
          */
         $name = "rss_aggregator_" . $this->id . "_display_num_items";
         $this->setDisplayNumItems($_REQUEST[$name]);
         /*
          * algorithm_strength
          */
         $name = "rss_aggregator_" . $this->id . "_algorithm_strength";
         $this->setAlgorithmStrength($_REQUEST[$name]);
         /*
          * feed_expansion
          */
         $name = "rss_aggregator_" . $this->id . "_feed_expansion";
         $this->setFeedExpansionMode($_REQUEST[$name]);
         /*
          * feed_ordering
          */
         $name = "rss_aggregator_" . $this->id . "_feed_ordering";
         $this->setFeedOrdering($_REQUEST[$name]);
         /*
          * display_empty_feeds
          */
         $name = "rss_aggregator_" . $this->id . "_display_empty_feeds";
         !empty($_REQUEST[$name]) ? $this->setDisplayEmptyFeed(true) : $this->setDisplayEmptyFeed(false);
         /*
          * max_item_age
          */
         $name = "rss_aggregator_" . $this->id . "_max_item_age";
         $this->setMaxItemAge($_REQUEST[$name]);
         foreach ($this->content_rss_aggregator_feeds_rows as $feed_row) {
             $this->processFeedAdminUI($feed_row);
             /*
              * Delete feeds
              */
             $name = "rss_aggregator_" . $this->id . "_feed_" . md5($feed_row['url']) . "_delete";
             if (isset($_REQUEST[$name])) {
                 $this->removeFeed($feed_row['url']);
             }
         }
         /*
          * Add new feed
          */
         $name = "rss_aggregator_{$this->id}_feed_add";
         if (!empty($_REQUEST[$name])) {
             $this->addFeed($_REQUEST[$name]);
         }
     }
 }
Esempio n. 2
0
 /**
  * Processes the input of the administration interface for Langstring
  *
  * @return void
  */
 public function processAdminUI()
 {
     // Init values.
     $result = null;
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         $generateur_form_select = new FormSelectGenerator();
         $sql = "SELECT * FROM content_langstring_entries WHERE content_langstring_entries.langstrings_id = '{$this->id}'";
         $this->mBd->execSql($sql, $result, false);
         if ($result != null) {
             while (list($key, $value) = each($result)) {
                 $language = $generateur_form_select->getResult("langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_language", null);
                 if (empty($language)) {
                     $language = '';
                     $languageSQL = 'NULL';
                 } else {
                     $languageSQL = "'" . $language . "'";
                 }
                 if (!empty($_REQUEST["langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_erase"]) && $_REQUEST["langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_erase"] == true) {
                     $this->mBd->execSqlUpdate("DELETE FROM content_langstring_entries WHERE langstrings_id = '{$this->id}' AND langstring_entries_id='{$value['langstring_entries_id']}'", FALSE);
                     // Create new cache object.
                     $_cache = new Cache('langstrings_' . $this->id . '_substring_' . $language . '_string', $this->id);
                     // Check if caching has been enabled.
                     if ($_cache->isCachingEnabled) {
                         // Remove old cached data.
                         $_cache->eraseCachedData();
                     }
                 } else {
                     // Strip HTML tags !
                     $string = $_REQUEST["langstrings_" . $this->id . "_substring_{$value['langstring_entries_id']}_string"];
                     $string = $this->mBd->escapeString(strip_tags($string, $this->allowed_html_tags));
                     // If PEAR::HTML_Safe is available strips down all potentially dangerous content
                     $_HtmlSafe = new HtmlSafe();
                     if ($_HtmlSafe->isHtmlSafeEnabled) {
                         // Add "embed" and "object" to the default set of dangerous tags
                         $_HtmlSafe->setDeleteTags(array("embed", "object"), true);
                         // Strip HTML
                         $string = $_HtmlSafe->parseHtml($string);
                     }
                     if ($value['value'] != $string || $language != $value['locales_id']) {
                         $this->mBd->execSqlUpdate("UPDATE content_langstring_entries SET locales_id = {$languageSQL} , value = '{$string}' WHERE langstrings_id = '{$this->id}' AND langstring_entries_id='{$value['langstring_entries_id']}'", FALSE);
                         $this->touch();
                         // Create new cache object.
                         $_cache = new Cache('langstrings_' . $this->id . '_substring_' . $language . '_string', $this->id);
                         // Check if caching has been enabled.
                         if ($_cache->isCachingEnabled) {
                             // Remove old cached data.
                             $_cache->eraseCachedData();
                             // Save data into cache.
                             $_cache->saveCachedData($string);
                         }
                     }
                 }
             }
         }
         //Nouvelles chaîne(s)
         self::processNewUI($this->id, false);
     }
 }
Esempio n. 3
0
 /**
  * Processes the input of the administration interface for IFrame
  *
  * @return void
  */
 public function processAdminUI()
 {
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         // If the URL is not empty
         $name = "iframe_" . $this->id . "_url";
         if (!empty($_REQUEST[$name])) {
             $this->setUrl($_REQUEST[$name]);
         } else {
             $this->setUrl("");
         }
         $name = "iframe_" . $this->id . "_width";
         $this->setWidth(intval($_REQUEST[$name]));
         $name = "iframe_" . $this->id . "_height";
         $this->setHeight(intval($_REQUEST[$name]));
     }
 }
 /**
  * Processes the input of the administration interface for ContentGroupElement
  *
  * @return void
  */
 public function processAdminUI()
 {
     $db = AbstractDb::getObject();
     // Init values
     $allowed_node_rows = null;
     $errmsg = null;
     parent::processAdminUI();
     /* display_order */
     $name = "content_group_element_" . $this->id . "_display_order";
     $this->setDisplayOrder($_REQUEST[$name]);
     // valid_from_timestamp
     $name = "content_group_element_" . $this->id . "_valid_from";
     $this->setValidFromDate(DateTimeWD::processSelectDateTimeUI($name, DateTimeWD::INTERFACE_DATETIME_FIELD)->getIso8601FormattedString());
     // valid_until_timestamp
     $name = "content_group_element_" . $this->id . "_valid_until";
     $this->setValidUntilDate(DateTimeWD::processSelectDateTimeUI($name, DateTimeWD::INTERFACE_DATETIME_FIELD)->getIso8601FormattedString());
     /* content_group_element_has_allowed_nodes */
     $sql = "SELECT * FROM content_group_element_has_allowed_nodes WHERE content_group_element_id='{$this->id}'";
     $db->execSql($sql, $allowed_node_rows, false);
     if ($allowed_node_rows != null) {
         foreach ($allowed_node_rows as $allowed_node_row) {
             $node = Node::getObject($allowed_node_row['node_id']);
             $name = "content_group_element_" . $this->id . "_allowed_node_" . $node->GetId() . "_remove";
             if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == true) {
                 $sql = "DELETE FROM content_group_element_has_allowed_nodes WHERE content_group_element_id='{$this->id}' AND node_id='" . $node->GetId() . "'";
                 $db->execSqlUpdate($sql, false);
             }
         }
     }
     $name = "content_group_element_{$this->id}_new_allowed_node_submit";
     if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == true) {
         $name = "content_group_element_{$this->id}_new_allowed_node";
         $node = Node::processSelectUI($name);
         $node_id = $node->GetId();
         $db->execSqlUpdate("INSERT INTO content_group_element_has_allowed_nodes (content_group_element_id, node_id) VALUES ('{$this->id}', '{$node_id}')", FALSE);
     }
     /* displayed_content_id */
     if (empty($this->content_group_element_row['displayed_content_id'])) {
         // Could be either a new content or existing content ( try both successively )
         $displayed_content = Content::processNewContentUI("content_group_element_{$this->id}_new_displayed_content");
         if ($displayed_content == null) {
             $displayed_content = Content::processSelectExistingContentUI("content_group_element_{$this->id}_new_displayed_existing_element");
         }
         if ($displayed_content != null) {
             $displayed_content_id = $displayed_content->GetId();
             $db->execSqlUpdate("UPDATE content_group_element SET displayed_content_id = '{$displayed_content_id}' WHERE content_group_element_id = '{$this->id}'", FALSE);
         }
     } else {
         $displayed_content = self::getObject($this->content_group_element_row['displayed_content_id']);
         $name = "content_group_element_{$this->id}_erase_displayed_content";
         if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == true) {
             if ($displayed_content->delete($errmsg) != false) {
                 $db->execSqlUpdate("UPDATE content_group_element SET displayed_content_id = NULL WHERE content_group_element_id = '{$this->id}'", FALSE);
             } else {
                 echo $errmsg;
             }
         } else {
             $displayed_content->processAdminUI();
         }
     }
 }
Esempio n. 5
0
 /**
  * Processes the input of the administration interface for Picture
  *
  * @return void
  */
 public function processAdminUI()
 {
     $db = AbstractDb::getObject();
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         /*display_num_items*/
         $name = "shoutbox_{this->getId()}_display_num_items";
         $this->setDisplayNumItems($_REQUEST[$name]);
         /*max_shout_chars*/
         $name = "shoutbox_{this->getId()}_max_num_chars";
         $this->setMaxShoutChars($_REQUEST[$name]);
         /*shout_field_size*/
         $name = "shoutbox_{this->getId()}_shout_field_size";
         $this->setShoutFieldSize($_REQUEST[$name]);
         /* OnclickContent */
         $content = $this->getOnClickContent();
         if (!$content) {
             $name = "shoutbox_" . $this->id . "_onclick_content_new";
             $content = self::processNewContentUI($name);
             $this->setOnClickContent($content);
         } else {
             $name = "shoutbox_" . $this->id . "_onclick_content_erase";
             if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == true) {
                 $this->setOnClickContent(null);
                 $content->delete($errmsg);
             } else {
                 $content->processAdminUI();
             }
         }
     }
 }
Esempio n. 6
0
 /**
  * Processes the input of the administration interface for RssAggregator
  *
  * @return void
  */
 public function processAdminUI()
 {
     //echo "File::processAdminUI()<br/>\n";
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         // If no file was uploaded, update filename and mime type
         if (!empty($_REQUEST["file_mode" . $this->getId()])) {
             if ($this->configEnableEditFilename && !empty($_REQUEST["file_file_name" . $this->getId()])) {
                 $this->setFilename($_REQUEST["file_file_name" . $this->getId()]);
             }
             $file_mode = $_REQUEST["file_mode" . $this->getId()];
             if ($file_mode == "by_upload") {
                 if ($this->configEnableEditMimeType && isset($_REQUEST["file_mime_type" . $this->getId()])) {
                     $this->setMimeType($_REQUEST["file_mime_type" . $this->getId()]);
                 }
                 $this->setBinaryDataFromPostVar("file_file_upload" . $this->getId());
                 $this->setURL(null);
                 // Reset the remote file size ( not used )
                 $this->setRemoteFileSize(0);
             } else {
                 if ($file_mode == "remote") {
                     $this->setURL($_REQUEST["file_url" . $this->getId()]);
                     $this->setBinaryDataOid(null);
                     // When switching from local to remote, this field does not exist yet
                     if (isset($_REQUEST["file_old_remote_size" . $this->getId()])) {
                         if ($_REQUEST["file_remote_size" . $this->getId()] != $_REQUEST["file_old_remote_size" . $this->getId()]) {
                             $this->setRemoteFileSize($_REQUEST["file_remote_size" . $this->getId()]);
                         }
                     } else {
                         $this->setRemoteFileSize(0);
                     }
                 }
             }
         }
     }
 }
Esempio n. 7
0
 /**
  * Processes the input of the administration interface for embedded content
  *
  * @return void
  */
 public function processAdminUI()
 {
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         $db = AbstractDb::getObject();
         // Init values
         $errmsg = null;
         parent::processAdminUI();
         if (empty($this->embedded_content_row['embedded_file_id'])) {
             $embedded_content_file = self::processNewContentUI("embedded_file_{$this->id}_new");
             if ($embedded_content_file != null) {
                 $embedded_content_file_id = $embedded_content_file->GetId();
                 $db->execSqlUpdate("UPDATE content_embedded_content SET embedded_file_id = '{$embedded_content_file_id}' WHERE embedded_content_id = '{$this->id}'", FALSE);
             } else {
                 echo _("You MUST choose a File object or any of its siblings.");
                 $embedded_content_file->delete($errmsg);
             }
         } else {
             $embedded_content_file = self::getObject($this->embedded_content_row['embedded_file_id']);
             $name = "embeddedcontent_" . $this->id . "_embedded_file_erase";
             if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == true) {
                 $db->execSqlUpdate("UPDATE content_embedded_content SET embedded_file_id = NULL WHERE embedded_content_id = '{$this->id}'", FALSE);
                 $embedded_content_file->delete($errmsg);
             } else {
                 $embedded_content_file->processAdminUI();
                 $name = "embedded_content_attributes" . $this->getId();
                 $this->setAttributes($_REQUEST[$name]);
                 $name = "embedded_content_parameters" . $this->getId();
                 $this->setParameters($_REQUEST[$name]);
             }
         }
         if (empty($this->embedded_content_row['fallback_content_id'])) {
             $fallback_content = self::processNewContentUI("fallback_content_{$this->id}_new");
             if ($fallback_content != null) {
                 $fallback_content_id = $fallback_content->GetId();
                 $db->execSqlUpdate("UPDATE content_embedded_content SET fallback_content_id = '{$fallback_content_id}' WHERE embedded_content_id = '{$this->id}'", FALSE);
             }
         } else {
             $fallback_content = self::getObject($this->embedded_content_row['fallback_content_id']);
             $name = "fallback_content_" . $this->id . "_fallback_content_erase";
             if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == true) {
                 $db->execSqlUpdate("UPDATE content_embedded_content SET fallback_content_id = NULL WHERE embedded_content_id = '{$this->id}'", FALSE);
                 $fallback_content->delete($errmsg);
             } else {
                 $fallback_content->processAdminUI();
             }
         }
         $this->refresh();
     }
 }
Esempio n. 8
0
 function processAdminUI()
 {
     // Init values
     $errmsg = null;
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         /* content_ordering_mode */
         $name = "content_group_" . $this->id . "_content_ordering_mode";
         $this->setContentOrderingMode(FormSelectGenerator::getResult($name, null));
         /*content_changes_on_mode */
         $name = "content_group_" . $this->id . "_content_changes_on_mode";
         $this->setContentChangesOnMode(FormSelectGenerator::getResult($name, null));
         /* allow_repeat*/
         $name = "content_group_" . $this->id . "_allow_repeat";
         $this->setAllowRepeat(FormSelectGenerator::getResult($name, null));
         /*display_num_elements*/
         $name = "content_group_" . $this->id . "_display_num_elements";
         $this->setDisplayNumElements($_REQUEST[$name]);
         /* content_group_element */
         $name = "content_group_" . $this->id . "_expired_elements_shown";
         if (empty($_REQUEST[$name])) {
             $additionalWhere = "AND (valid_until_timestamp IS NULL OR valid_until_timestamp >= CURRENT_TIMESTAMP) \n";
         } else {
             $additionalWhere = null;
         }
         foreach ($this->getElements($additionalWhere) as $element) {
             $name = "content_group_" . $this->id . "_element_" . $element->GetId() . "_erase";
             if (!empty($_REQUEST[$name]) && $_REQUEST[$name] == true) {
                 $element->delete($errmsg);
             } else {
                 $element->processAdminUI();
             }
         }
         // The two following calls will either add a new element or add an existing one ( depending on what button the user clicked
         /* We explicitely call the ContentGroupElement version of processNewContentUI */
         ContentGroupElement::processNewContentUI("content_group_{$this->id}_new_element", $this);
         // Last parameters allows for existing content ( if any was selected )
         ContentGroupElement::processNewContentUI("content_group_{$this->id}_existing_element", $this, true);
     }
 }
Esempio n. 9
0
 function processAdminUI()
 {
     if ($this->DEPRECATEDisOwner(User::getCurrentUser()) || User::getCurrentUser()->DEPRECATEDisSuperAdmin()) {
         parent::processAdminUI();
         $generator = new FormSelectGenerator();
         $name = "flickr_photostream_" . $this->id . "_api_key";
         !empty($_REQUEST[$name]) ? $this->setApiKey($_REQUEST[$name]) : $this->setApiKey(null);
         $name = "flickr_photostream_" . $this->id . "_api_shared_secret";
         !empty($_REQUEST[$name]) ? $this->setApiSharedSecret($_REQUEST[$name]) : $this->setApiSharedSecret(null);
         $name = "flickr_photostream_" . $this->id . "_photo_batch_size";
         !empty($_REQUEST[$name]) ? $this->setPhotoBatchSize($_REQUEST[$name]) : $this->setPhotoBatchSize(null);
         if ($generator->isPresent("DisplayMode" . $this->getID(), "FlickrPhotostream")) {
             $this->setDisplayMode($generator->getResult("DisplayMode" . $this->getID(), "FlickrPhotostream"));
         }
         if ($generator->isPresent("SelectionMode" . $this->getID(), "FlickrPhotostream")) {
             $this->setSelectionMode($generator->getResult("SelectionMode" . $this->getID(), "FlickrPhotostream"));
         }
         // Check for existing API key
         if ($this->getAPIKey() && $this->getSelectionMode()) {
             try {
                 switch ($this->getSelectionMode()) {
                     // Process common data for groups and users
                     case self::SELECT_BY_GROUP:
                         if ($generator->isPresent("GroupPhotoPool" . $this->getID(), "FlickrPhotostream")) {
                             $this->setGroupId($generator->getResult("GroupPhotoPool" . $this->getID(), "FlickrPhotostream"));
                         }
                     case self::SELECT_BY_USER:
                         $name = "flickr_photostream_" . $this->id . "_reset_user_id";
                         if (!empty($_REQUEST[$name]) || !$this->getFlickrUserId()) {
                             $this->setUserId(null);
                             $name = "flickr_photostream_" . $this->id . "_email";
                             if (!empty($_REQUEST[$name]) && ($flickr_user = $this->getUserByEmail($_REQUEST[$name])) != null) {
                                 $this->setUserId($flickr_user->getId());
                                 $this->setUserName($flickr_user->getName());
                             } else {
                                 echo _("Could not find a Flickr user with this e-mail.");
                             }
                         }
                         break;
                     case self::SELECT_BY_TAGS:
                         $name = "flickr_photostream_" . $this->id . "_tags";
                         if (!empty($_REQUEST[$name])) {
                             $this->setTags($_REQUEST[$name]);
                         } else {
                             $this->setTags(null);
                         }
                         if ($generator->isPresent("TagMode" . $this->getID(), "FlickrPhotostream")) {
                             $this->setTagMode($generator->getResult("TagMode" . $this->getID(), "FlickrPhotostream"));
                         }
                         break;
                 }
             } catch (Exception $e) {
                 echo _("Could not complete successfully the saving procedure.");
             }
             $name = "flickr_photostream_" . $this->id . "_display_title";
             !empty($_REQUEST[$name]) ? $this->setDisplayTitle(true) : $this->setDisplayTitle(false);
             $name = "flickr_photostream_" . $this->id . "_display_tags";
             !empty($_REQUEST[$name]) ? $this->setDisplayTags(true) : $this->setDisplayTags(false);
             $name = "flickr_photostream_" . $this->id . "_display_description";
             !empty($_REQUEST[$name]) ? $this->setDisplayDescription(true) : $this->setDisplayDescription(false);
             if ($generator->isPresent("PreferredSize" . $this->getID(), "FlickrPhotostream")) {
                 $this->setPreferredSize($generator->getResult("PreferredSize" . $this->getID(), "FlickrPhotostream"));
             }
         }
     }
 }