<?php class module_updates_global { } global $mod; $mod->modules[$MODULE_NAME] = new module_updates_global(); if (defined('IN_UPDATES_GLOBAL') && IN_UPDATES_GLOBAL) { if (isset($_GET['function'])) { switch ($_GET['function']) { case 'check_for_updates': if (isset($_POST['XML'])) { include './app/lib/simplexmlextended.class.php'; $xml = new SimpleXMLElementExtended(html_entity_decode(stripslashes($_POST['XML']))); $modules = $xml->xpath('//module'); $count = count($modules); if ($count > 0) { $sql = new MySQLObject(); $query = "\r\nSELECT `code`,`type`,`date`,`name`,`modules`\r\nFROM " . $sql->table('updates_global') . "\r\nWHERE\r\n("; $i = 0; foreach ($modules as $module) { $query .= "\r\n\t`modules` LIKE '%" . $module . "%'"; if ($i < $count - 1) { $query .= " OR "; } $i++; } $query .= "\r\n)\r\nORDER BY `date` ASC"; if (!$sql->query($query)) { echo 'ERROR'; } else {
function export_item($id) { $item = $this->getItem($id); $xml = new SimpleXMLElementExtended('<dates_item></dates_item>'); $xml->addChildWithCDATA('item_id', $item->getItemID()); $xml->addChildWithCDATA('context_id', $item->getContextID()); $xml->addChildWithCDATA('creator_id', $item->getCreatorID()); $xml->addChildWithCDATA('modifier_id', $item->getModificatorID()); $xml->addChildWithCDATA('deleter_id', $item->getDeleterID()); $xml->addChildWithCDATA('creation_date', $item->getCreationDate()); $xml->addChildWithCDATA('modification_date', $item->getModificationDate()); $xml->addChildWithCDATA('deletion_date', $item->getDeleterID()); $xml->addChildWithCDATA('title', $item->getTitle()); $xml->addChildWithCDATA('description', $item->getDescription()); $xml->addChildWithCDATA('start_time', $item->getStartingTime()); $xml->addChildWithCDATA('end_time', $item->getEndingTime()); $xml->addChildWithCDATA('start_day', $item->getStartingDay()); $xml->addChildWithCDATA('end_day', $item->getEndingDay()); $xml->addChildWithCDATA('place', $item->getPlace()); $xml->addChildWithCDATA('datetime_start', $item->getDateTime_start()); $xml->addChildWithCDATA('datetime_end', $item->getDateTime_end()); $xml->addChildWithCDATA('public', $item->isPublic()); $xml->addChildWithCDATA('date_mode', $item->getDateMode()); $xml->addChildWithCDATA('color', $item->getColor()); $xml->addChildWithCDATA('recurrence_id', $item->getRecurrenceId()); $recurrence_array = $item->getRecurrencePattern(); $xmlRecurrence = $this->getArrayAsXML($xml, $recurrence_array, true, 'recurrence'); $this->simplexml_import_simplexml($xml, $xmlRecurrence); $extras_array = $item->getExtraInformation(); $xmlExtras = $this->getArrayAsXML($xml, $extras_array, true, 'extras'); $this->simplexml_import_simplexml($xml, $xmlExtras); $xmlFiles = $this->getFilesAsXML($item->getItemID()); $this->simplexml_import_simplexml($xml, $xmlFiles); $xmlAnnotations = $this->getAnnotationsAsXML($item->getItemID()); $this->simplexml_import_simplexml($xml, $xmlAnnotations); return $xml; }
function export_item($id) { $item = $this->getItem($id); $xml = new SimpleXMLElementExtended('<material_item></material_item>'); $xml->addChildWithCDATA('item_id', $item->getItemID()); $xml->addChildWithCDATA('version_id', $item->getVersionID()); $xml->addChildWithCDATA('context_id', $item->getContextID()); $xml->addChildWithCDATA('creator_id', $item->getCreatorID()); $xml->addChildWithCDATA('deleter_id', $item->getDeleterID()); $xml->addChildWithCDATA('creation_date', $item->getCreationDate()); $xml->addChildWithCDATA('modifier_id', $item->getModificatorID()); $xml->addChildWithCDATA('modification_date', $item->getModificationDate()); $xml->addChildWithCDATA('deletion_date', $item->getDeletionDate()); $xml->addChildWithCDATA('title', $item->getTitle()); $xml->addChildWithCDATA('description', $item->getDescription()); $xml->addChildWithCDATA('author', $item->getAuthor()); $xml->addChildWithCDATA('publishing_date', $item->getPublishingDate()); $xml->addChildWithCDATA('public', $item->isPublic()); $xml->addChildWithCDATA('world_public', $item->isWorldPublic()); $extras_array = $item->getExtraInformation(); $xmlExtras = $this->getArrayAsXML($xml, $extras_array, true, 'extras'); $this->simplexml_import_simplexml($xml, $xmlExtras); //$xml->addChild('new_hack', $item->getItemID()); $copy_item = $item->getCopyItem(); if ($copy_item != null) { $xml->addChildWithCDATA('copy_of', $copy_item->getItemID()); } else { $xml->addChildWithCDATA('copy_of', ''); } //$xml->addChild('workflow_status', $item->getWorkflowStatus()); $xml->addChildWithCDATA('workflow_resubmission_date', $item->getWorkflowResubmissionDate()); $xml->addChildWithCDATA('workflow_validity_date', $item->getWorkflowValidityDate()); $xmlFiles = $this->getFilesAsXML($item->getItemID()); $this->simplexml_import_simplexml($xml, $xmlFiles); $xmlAnnotations = $this->getAnnotationsAsXML($item->getItemID()); $this->simplexml_import_simplexml($xml, $xmlAnnotations); $xml = $this->export_sub_items($xml, $item); return $xml; }
function export_item($id) { $item = $this->getItem($id); $xml = new SimpleXMLElementExtended('<file_item></file_item>'); $xml->addChildWithCDATA('files_id', $item->getFileID()); $xml->addChildWithCDATA('context_id', $item->getContextID()); $xml->addChildWithCDATA('creator_id', $item->getCreatorID()); $xml->addChildWithCDATA('deleter_id', $item->getDeleterID()); $xml->addChildWithCDATA('creation_date', $item->getCreationDate()); $xml->addChildWithCDATA('modification_date', $item->getModificationDate()); $xml->addChildWithCDATA('deletion_date', $item->getDeletionDate()); $xml->addChildWithCDATA('filename', $item->getFileName()); $xml->addChildWithCDATA('size', $item->getFileSize()); $xml->addChildWithCDATA('has_html', $item->getHasHTML()); $xml->addChildWithCDATA('scan', $item->isScanned()); $extras_array = $item->getExtraInformation(); $xmlExtras = $this->getArrayAsXML($xml, $extras_array, true, 'extras'); $this->simplexml_import_simplexml($xml, $xmlExtras); $xml->addChildWithCDATA('temp_upload_session_id', $item->getTempUploadFromEditorSessionID()); return $xml; }
function export_item($id) { $item = $this->getItem($id); $xml = new SimpleXMLElementExtended('<link_item></link_item>'); $xml->addChildWithCDATA('item_id', $item->getItemID()); $xml->addChildWithCDATA('context_id', $item->getContextID()); $xml->addChildWithCDATA('creator_id', $item->getCreatorID()); $xml->addChildWithCDATA('deleter_id', $item->getDeleterID()); $xml->addChildWithCDATA('creation_date', $item->getCreationDate()); $xml->addChildWithCDATA('deletion_date', $item->getDeletionDate()); $xml->addChildWithCDATA('modification_date', $item->getModificationDate()); $xml->addChildWithCDATA('first_item_id', $item->getFirstLinkedItemID()); $xml->addChildWithCDATA('first_item_type', $item->getFirstLinkedItemType()); $xml->addChildWithCDATA('second_item_id', $item->getSecondLinkedItemID()); $xml->addChildWithCDATA('second_item_type', $item->getSecondLinkedItemType()); $xml->addChildWithCDATA('sorting_place', $item->getSortingPlace()); $extras_array = $item->getExtraInformation(); $xmlExtras = $this->getArrayAsXML($xml, $extras_array, true, 'extras'); $this->simplexml_import_simplexml($xml, $xmlExtras); return $xml; }
function export_item($id) { $item = $this->getItem($id); $xml = new SimpleXMLElementExtended('<step_item></step_item>'); $xml->addChildWithCDATA('item_id', $item->getItemID()); $xml->addChildWithCDATA('context_id', $item->getContextID()); $xml->addChildWithCDATA('creator_id', $item->getCreatorID()); $xml->addChildWithCDATA('modifier_id', $item->getModificatorID()); $xml->addChildWithCDATA('creation_date', $item->getCreationDate()); $xml->addChildWithCDATA('deleter_id', $item->getDeleterID()); $xml->addChildWithCDATA('deletion_date', $item->getDeleterID()); $xml->addChildWithCDATA('modification_date', $item->getModificationDate()); $xml->addChildWithCDATA('title', $item->getTitle()); $xml->addChildWithCDATA('description', $item->getDescription()); $xml->addChildWithCDATA('minutes', $item->getMinutes()); $xml->addChildWithCDATA('time_type', $item->getTimeType()); $xml->addChildWithCDATA('todo_item_id', $item->getTodoID()); $extras_array = $item->getExtraInformation(); $xmlExtras = $this->getArrayAsXML($xml, $extras_array, true, 'extras'); $this->simplexml_import_simplexml($xml, $xmlExtras); $xml->addChildWithCDATA('public', $item->isPublic()); $xmlFiles = $this->getFilesAsXML($item->getItemID()); $this->simplexml_import_simplexml($xml, $xmlFiles); return $xml; }
function export_item($id) { $item = $this->getItem($id); $xml = new SimpleXMLElementExtended('<tag_item></tag_item>'); $xml->addChildWithCDATA('item_id', $item->getItemID()); $xml->addChildWithCDATA('context_id', $item->getContextID()); $xml->addChildWithCDATA('creator_id', $item->getCreatorID()); $xml->addChildWithCDATA('modifier_id', $item->getModificatorID()); $xml->addChildWithCDATA('deleter_id', $item->getDeleterID()); $xml->addChildWithCDATA('creation_date', $item->getCreationDate()); $xml->addChildWithCDATA('modification_date', $item->getModificationDate()); $xml->addChildWithCDATA('deletion_date', $item->getDeleterID()); $xml->addChildWithCDATA('title', $item->getTitle()); $tag2TagManager = $this->_environment->getTag2TagManager(); $tag2TagManager->resetCachedFatherIdArray(); $tag2TagManager->setContextLimit($item->getContextId()); $tag2Tag_father_id = $tag2TagManager->getFatherItemID($item->getItemId()); if ($tag2Tag_father_id) { $tag2Tag_item = $tag2TagManager->getItem($tag2Tag_father_id, $item->getItemId()); $xml->addChildWithCDATA('sorting_place', $tag2Tag_item->getSortingPlace()); } else { $xml->addChildWithCDATA('sorting_place', '1'); } return $xml; }
function export_item($id) { $item = $this->getItem($id); $xml = new SimpleXMLElementExtended('<labels_item></labels_item>'); $xml->addChildWithCDATA('item_id', $item->getItemID()); $xml->addChildWithCDATA('context_id', $item->getContextID()); $xml->addChildWithCDATA('creator_id', $item->getCreatorID()); $xml->addChildWithCDATA('modifier_id', $item->getModificatorID()); $xml->addChildWithCDATA('deleter_id', $item->getDeleterID()); $xml->addChildWithCDATA('creation_date', $item->getCreationDate()); $xml->addChildWithCDATA('modification_date', $item->getModificationDate()); $xml->addChildWithCDATA('deletion_date', $item->getDeleterID()); $xml->addChildWithCDATA('name', $item->getName()); $xml->addChildWithCDATA('description', $item->getDescription()); $xml->addChildWithCDATA('type', $item->getLabelType()); $extras_array = $item->getExtraInformation(); $xmlExtras = $this->getArrayAsXML($xml, $extras_array, true, 'extras'); $this->simplexml_import_simplexml($xml, $xmlExtras); $xml->addChildWithCDATA('public', $item->isPublic()); return $xml; }
function export_item($id) { $item = $this->getItem($id); $xml = new SimpleXMLElementExtended('<discussions_item></discussions_item>'); $xml->addChildWithCDATA('item_id', $item->getItemID()); $xml->addChildWithCDATA('context_id', $item->getContextID()); $xml->addChildWithCDATA('creator_id', $item->getCreatorID()); $xml->addChildWithCDATA('modifier_id', $item->getModificatorID()); $xml->addChildWithCDATA('deleter_id', $item->getDeleterID()); $xml->addChildWithCDATA('creation_date', $item->getCreationDate()); $xml->addChildWithCDATA('modification_date', $item->getModificationDate()); $xml->addChildWithCDATA('deletion_date', $item->getDeleterID()); $xml->addChildWithCDATA('title', $item->getTitle()); $xml->addChildWithCDATA('latest_article_item_id', $item->getLatestArticleID()); $xml->addChildWithCDATA('latest_article_modification_date', $item->getLatestArticleModificationDate()); $xml->addChildWithCDATA('status', $item->getDiscussionStatus()); $xml->addChildWithCDATA('discussion_type', $item->getDiscussionType()); $xml->addChildWithCDATA('public', $item->isPublic()); $extras_array = $item->getExtraInformation(); $xmlExtras = $this->getArrayAsXML($xml, $extras_array, true, 'extras'); $this->simplexml_import_simplexml($xml, $xmlExtras); $xml = $this->export_sub_items($xml, $item); return $xml; }
function export_item($id) { $item = $this->getItem($id); $xml = new SimpleXMLElementExtended('<section_item></section_item>'); $xml->addChildWithCDATA('item_id', $item->getItemID()); $xml->addChildWithCDATA('version_id', $item->getVersionID()); $xml->addChildWithCDATA('context_id', $item->getContextID()); $xml->addChildWithCDATA('creator_id', $item->getCreatorID()); $xml->addChildWithCDATA('modifier_id', $item->getModificatorID()); $xml->addChildWithCDATA('creation_date', $item->getCreationDate()); $xml->addChildWithCDATA('deleter_id', $item->getDeleterID()); $xml->addChildWithCDATA('deletion_date', $item->getDeleterID()); $xml->addChildWithCDATA('modification_date', $item->getModificationDate()); $xml->addChildWithCDATA('title', $item->getTitle()); $xml->addChildWithCDATA('description', $item->getDescription()); $xml->addChildWithCDATA('number', $item->getNumber()); $xml->addChildWithCDATA('material_item_id', $item->getLinkedItemID()); $extras_array = $item->getExtraInformation(); $xmlExtras = $this->getArrayAsXML($xml, $extras_array, true, 'extras'); $this->simplexml_import_simplexml($xml, $xmlExtras); $xml->addChildWithCDATA('public', $item->isPublic()); $xmlFiles = $this->getFilesAsXML($item->getItemID()); $this->simplexml_import_simplexml($xml, $xmlFiles); return $xml; }
function export_sub_items($xml, $top_item) { $sub_items = array('annotation_portfolio', 'tag_portfolio', 'template_portfolio', 'user_portfolio'); foreach ($sub_items as $sub_item) { $query = "SELECT * FROM " . $this->addDatabasePrefix($sub_item) . " WHERE p_id = " . $top_item->getItemID(); $results = $this->_db_connector->performQuery($query); if (!isset($results)) { include_once 'functions/error_functions.php'; trigger_error('Problems getting ' . $sub_item . '.', E_USER_WARNING); } $sub_items_xml = new SimpleXMLElementExtended('<' . $sub_item . '></' . $sub_item . '>'); foreach ($results as $result) { $sub_item_xml = new SimpleXMLElementExtended('<' . $sub_item . '_entry></' . $sub_item . '_entry>'); foreach ($result as $key => $value) { $sub_item_xml->addChildWithCDATA($key, $value); } $this->simplexml_import_simplexml($sub_items_xml, $sub_item_xml); } $this->simplexml_import_simplexml($xml, $sub_items_xml); } return $xml; }
function getArrayAsXML($xml, $array, $create_top_element = false, $top_element_name = '') { if ($create_top_element) { if ($top_element_name != '') { $xml = new SimpleXMLElementExtended('<' . $top_element_name . '></' . $top_element_name . '>'); } } if ($array != null) { foreach ($array as $key => $value) { // Tag names must not start with a number. if (is_numeric($key)) { $key = 'COMMSY_' . $key; } if (!is_array($value)) { $xml->addChildWithCDATA($key, $value); } else { $tempXml = new SimpleXMLElementExtended('<' . $key . '></' . $key . '>'); $temp = $this->getArrayAsXML($tempXml, $value); $this->simplexml_import_simplexml($xml, $temp); } } } return $xml; }
function export_items() { $links_array = $this->_performQuery(); $links_xml = new SimpleXMLElementExtended('<links></links>'); foreach ($links_array as $link) { $link_xml = new SimpleXMLElementExtended('<link></link>'); $link_xml->addChildWithCDATA('from_item_id', $link['from_item_id']); $link_xml->addChildWithCDATA('from_version_id', $link['from_version_id']); $link_xml->addChildWithCDATA('to_item_id', $link['to_item_id']); $link_xml->addChildWithCDATA('to_version_id', $link['to_version_id']); $link_xml->addChildWithCDATA('link_type', $link['link_type']); $link_xml->addChildWithCDATA('context_id', $link['context_id']); $link_xml->addChildWithCDATA('deleter_id', $link['deleter_id']); $link_xml->addChildWithCDATA('deletion_date', $link['deletion_date']); $link_xml->addChildWithCDATA('x', $link['x']); $link_xml->addChildWithCDATA('y', $link['y']); $this->simplexml_import_simplexml($links_xml, $link_xml); } return $links_xml; }
function export_item($id) { $item = $this->getItem($id); $xml = new SimpleXMLElementExtended('<discarticle_item></discarticle_item>'); $xml->addChildWithCDATA('item_id', $item->getItemID()); $xml->addChildWithCDATA('context_id', $item->getContextID()); $xml->addChildWithCDATA('discussion_id', $item->getDiscussionID()); $xml->addChildWithCDATA('creator_id', $item->getCreatorID()); $xml->addChildWithCDATA('modifier_id', $item->getModificatorID()); $xml->addChildWithCDATA('deleter_id', $item->getDeleterID()); $xml->addChildWithCDATA('creation_date', $item->getCreationDate()); $xml->addChildWithCDATA('modification_date', $item->getModificationDate()); $xml->addChildWithCDATA('deletion_date', $item->getDeleterID()); $xml->addChildWithCDATA('subject', $item->getSubject()); $xml->addChildWithCDATA('description', $item->getDescription()); $xml->addChildWithCDATA('position', $item->getPosition()); $extras_array = $item->getExtraInformation(); $xmlExtras = $this->getArrayAsXML($xml, $extras_array, true, 'extras'); $this->simplexml_import_simplexml($xml, $xmlExtras); $xml->addChildWithCDATA('public', $item->isPublic()); $xmlFiles = $this->getFilesAsXML($item->getItemID()); $this->simplexml_import_simplexml($xml, $xmlFiles); return $xml; }
}); Route::post('/', 'HomeController@user'); Route::resource('topics', 'TopicController'); Route::group(array('before' => 'auth'), function () { Route::resource('topics', 'TopicController', array('as' => 'topics')); }); //Route::get('topics', 'TopicController'); Route::group(array('prefix' => 'api/v1'), function () { Route::resource('getTopics', 'TopicAPIController'); }); Response::macro('xml', function ($vars, $status = 200, array $header = array(), $rootElement = 'response', $xml = null) { if (is_object($vars) && $vars instanceof Illuminate\Support\Contracts\ArrayableInterface) { $vars = $vars->toArray(); } if (is_null($xml)) { $xml = new SimpleXMLElementExtended('<' . $rootElement . '/>'); } foreach ($vars as $key => $value) { if (is_array($value)) { if (is_numeric($key)) { Response::xml($value, $status, $header, $rootElement, $xml->addChild(str_singular($xml->getName()))); } else { Response::xml($value, $status, $header, $rootElement, $xml->addChild($key)); } } else { $xml->addChildWithCDATA($key, $value); } } if (empty($header)) { $header['Content-Type'] = 'application/xml'; }
function export_item($id) { $item_manager = $this->_environment->getItemManager(); $item = $item_manager->getItem($id); if ($item != null) { if ($item->getItemType() == 'community') { $community_manager = $this->_environment->getCommunityManager(); $context_item = $community_manager->getItem($id); } else { if ($item->getItemType() == 'project') { $project_manager = $this->_environment->getProjectManager(); $context_item = $project_manager->getItem($id); } else { if ($item->getItemType() == 'grouproom') { $grouproom_manager = $this->_environment->getGrouproomManager(); $context_item = $grouproom_manager->getItem($id); } else { if ($item->getItemType() == 'privateroom') { $privateroom_manager = $this->_environment->getPrivateRoomManager(); $context_item = $privateroom_manager->getItem($id); } } } } $xml = new SimpleXMLElementExtended('<context_item></context_item>'); $xml->addChildWithCDATA('item_id', $context_item->getItemID()); $xml->addChildWithCDATA('context_id', $context_item->getContextID()); $xml->addChildWithCDATA('creator_id', $context_item->getCreatorID()); $xml->addChildWithCDATA('modifier_id', $context_item->getModificatorID()); $xml->addChildWithCDATA('deleter_id', $context_item->getDeleterID()); $xml->addChildWithCDATA('creation_date', $context_item->getCreationDate()); $xml->addChildWithCDATA('modification_date', $context_item->getModificationDate()); $xml->addChildWithCDATA('deletion_date', $context_item->getDeletionDate()); $xml->addChildWithCDATA('title', $context_item->getTitle()); $extras_array = $context_item->getExtraInformation(); $xmlExtras = $this->getArrayAsXML($xml, $extras_array, true, 'extras'); $this->simplexml_import_simplexml($xml, $xmlExtras); $xml->addChildWithCDATA('status', $context_item->getStatus()); $xml->addChildWithCDATA('activity', $context_item->getActivityPoints()); $xml->addChildWithCDATA('type', $context_item->getType()); $xml->addChildWithCDATA('public', $context_item->getPublic()); $xml->addChildWithCDATA('is_open_for_guests', $context_item->isOpenForGuests()); $xml->addChildWithCDATA('continuous', $context_item->isContinuous()); $xml->addChildWithCDATA('template', $context_item->isTemplate()); $xml->addChildWithCDATA('contact_persons', $context_item->getContactPersonString()); $description_array = $context_item->getDescriptionArray(); $xmlDescription = $this->getArrayAsXML($xml, $description_array, true, 'description'); $this->simplexml_import_simplexml($xml, $xmlDescription); $xml->addChildWithCDATA('room_description', $context_item->getDescription()); $xml->addChildWithCDATA('lastlogin', $context_item->getLastLogin()); if ($item->getItemType() == 'privateroom') { $user_manager = $this->_environment->getUserManager(); $private_room_user = $user_manager->getItem($context_item->getCreatorID()); $xml->addChildWithCDATA('user_id', $private_room_user->getUserID()); } $xml = $this->export_sub_items($xml, $context_item); return $xml; } }