/** * Append assets */ public function appendAssets() { $callback = Symphony::Engine()->getPageCallback(); if ($callback['driver'] == 'publish' && $callback['context']['page'] === 'index') { Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/association_field/assets/association_field.publish.css'); } }
public function view() { $section_handle = (string) $this->context[0]; $page = isset($this->context[1]) ? (int) $this->context[1] : 1; if (empty($section_handle)) { die('Invalid section handle'); } $config = (object) Symphony::Configuration()->get('elasticsearch'); ElasticSearch::init(); $type = ElasticSearch::getTypeByHandle($section_handle); if ($page === 1) { // delete all documents in this index $query = new Elastica_Query(array('query' => array('match_all' => array()))); $type->type->deleteByQuery($query); } // get new entries $em = new EntryManager(Symphony::Engine()); $entries = $em->fetchByPage($page, $type->section->get('id'), (int) $config->{'reindex-batch-size'}, NULL, NULL, FALSE, FALSE, TRUE); foreach ($entries['records'] as $entry) { ElasticSearch::indexEntry($entry, $type->section); } $entries['total-entries'] = 0; // last page, count how many entries in the index if ($entries['remaining-pages'] == 0) { // wait a few seconds, allow HTTP requests to complete... sleep(5); $entries['total-entries'] = $type->type->count(); } header('Content-type: application/json'); echo json_encode(array('pagination' => array('total-pages' => (int) $entries['total-pages'], 'total-entries' => (int) $entries['total-entries'], 'remaining-pages' => (int) $entries['remaining-pages'], 'next-page' => $page + 1))); exit; }
public function saveVersion(&$context) { $section = $context['section']; $entry = $context['entry']; $fields = $context['fields']; // if saved from an event, no section is passed, so resolve // section object from the entry if (is_null($section)) { $sm = new SectionManager(Symphony::Engine()); $section = $sm->fetch($entry->get('section_id')); } // if we *still* can't resolve a section then something is // probably quite wrong, so don't try and save version history if (is_null($section)) { return; } // does this section have en Entry Version field, should we store the version? $has_entry_versions_field = FALSE; // is this an update to an existing version, or create a new version? $is_update = $fields['entry-versions'] != 'yes'; // find the Entry Versions field in the section and remove its presence from // the copied POST array, so that its value is not saved against the version foreach ($section->fetchFields() as $field) { if ($field->get('type') == 'entry_versions') { unset($fields[$field->get('element_name')]); $has_entry_versions_field = TRUE; } } if (!$has_entry_versions_field) { return; } $version = EntryVersionsManager::saveVersion($entry, $fields, $is_update, $entry_version_field_name); $context['messages'][] = array('version', 'passed', $version); }
public function getXPath($entry) { $fieldManager = new FieldManager(Symphony::Engine()); $entry_xml = new XMLElement('entry'); $section_id = $entry->get('section_id'); $data = $entry->getData(); $fields = array(); $entry_xml->setAttribute('id', $entry->get('id')); $associated = $entry->fetchAllAssociatedEntryCounts(); if (is_array($associated) and !empty($associated)) { foreach ($associated as $section => $count) { $handle = Symphony::Database()->fetchVar('handle', 0, "\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\ts.handle\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`tbl_sections` AS s\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\ts.id = '{$section}'\n\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t"); $entry_xml->setAttribute($handle, (string) $count); } } // Add fields: foreach ($data as $field_id => $values) { if (empty($field_id)) { continue; } $field = $fieldManager->fetch($field_id); $field->appendFormattedElement($entry_xml, $values, false, null); } $xml = new XMLElement('data'); $xml->appendChild($entry_xml); $dom = new DOMDocument(); $dom->strictErrorChecking = false; $dom->loadXML($xml->generate(true)); $xpath = new DOMXPath($dom); if (version_compare(phpversion(), '5.3', '>=')) { $xpath->registerPhpFunctions(); } return $xpath; }
public function eventPreSaveFilter(array $context) { if (!in_array('xss-fail', $context['event']->eParamFILTERS) && !in_array('validate-xsrf', $context['event']->eParamFILTERS)) { return; } $contains_xss = FALSE; // Loop over the fields to check for XSS, this loop will // break as soon as XSS is detected foreach ($context['fields'] as $field => $value) { if (is_array($value)) { if (self::detectXSSInArray($value) === FALSE) { continue; } $contains_xss = TRUE; break; } else { if (self::detectXSS($value) === FALSE) { continue; } $contains_xss = TRUE; break; } } // Detect XSS filter if (in_array('xss-fail', $context['event']->eParamFILTERS) && $contains_xss === TRUE) { $context['messages'][] = array('xss', FALSE, __("Possible XSS attack detected in submitted data")); } // Validate XSRF token filter if (in_array('validate-xsrf', $context['event']->eParamFILTERS)) { if (Symphony::Engine()->isXSRFEnabled() && is_session_empty() === false && XSRF::validateRequest(true) === false) { $context['messages'][] = array('xsrf', FALSE, __("Request was rejected for having an invalid cross-site request forgery token.")); } } }
protected function __trigger() { $result = null; $actionName = $this->getActionName(); $requestMethod = $this->getRequestMethod(); $requestArray = $this->getRequestArray(); if ($_SERVER['REQUEST_METHOD'] == $requestMethod && isset($requestArray[$actionName])) { $result = new XMLElement($actionName); $r = new XMLElement('result'); $id = intval($_POST['id']); try { $this->validate(); $entry = $this->createEntryFromPost($id); $this->visitEntry($entry); $r->setAttribute('success', 'yes'); $r->setAttribute('id', $entry->get('id')); } catch (Exception $ex) { $xmlEx = new XMLElement('error'); $showMsg = $ex instanceof InsertSectionException || Symphony::Engine()->isLoggedIn(); $errorMessage = $showMsg ? $ex->getMessage() : __('A Fatal error occured'); $xmlEx->setValue($errorMessage); $result->appendChild($xmlEx); $r->setAttribute('success', 'no'); Symphony::Log()->pushExceptionToLog($ex, true); } $result->appendChild($r); } else { throw new FrontendPageNotFoundException(); } return $result; }
private static function __authenticate() { $logged_in = Symphony::Engine()->isLoggedIn(); if (!$logged_in) { self::sendError('API is private. Authentication failed.', 403); } }
/** * The constructor for the `XSLTPage` ensures that an `XSLTProcessor` * is available, and then sets an instance of it to `$this->Proc`, otherwise * it will throw a `SymphonyErrorPage` exception. */ public function __construct() { if (!XsltProcess::isXSLTProcessorAvailable()) { Symphony::Engine()->throwCustomError(__('No suitable XSLT processor was found.')); } $this->Proc = new XsltProcess(); }
public function __construct() { $this->_XSLTProc = new XsltProcess(); $this->_XML = new XMLElement("data"); $this->viewDir = ENVIEWS . '/recipientgroups'; parent::__construct(Symphony::Engine()); }
public function start() { if (!is_object($this->getTemplate())) { $this->setStatus('error-template'); return; } if (!is_object($this->getSender())) { $this->setStatus('error-sender'); return; } if (empty($this->_recipientgroups)) { $this->setStatus('error-recipients'); return; } // Never start if the newsletter is sending or completed if ($this->getStatus() == 'sending' || $this->getStatus() == 'completed') { return; } $this->generatePAuth(); Symphony::Database()->query("CREATE TABLE IF NOT EXISTS `tbl_tmp_email_newsletters_sent_" . $this->getId() . "` (\n `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n `email` varchar(255),\n `result` varchar(255),\n PRIMARY KEY (`id`),\n KEY `email` (`email`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"); Symphony::Database()->query('DELETE FROM `tbl_tmp_email_newsletters_sent_' . $this->getId() . '` WHERE `result` = \'idle\''); $this->setStatus('sending'); $author_id = 0; if (Symphony::Engine() instanceof Administration) { $author_id = Symphony::Author()->get('id'); } elseif (Symphony::Engine() instanceof Frontend && Symphony::ExtensionManager()->fetchStatus('members') == EXTENSION_ENABLED) { $Members = Symphony::ExtensionManager()->create('members'); $author_id = $Members->getMemberDriver()->getMemberID(); } Symphony::Database()->update(array('started_on' => date('Y-m-d H:i:s', time()), 'started_by' => $author_id), 'tbl_email_newsletters', 'id = ' . $this->getId()); EmailBackgroundProcess::spawnProcess($this->getId(), $this->getPAuth()); }
public function entrySaved($context) { require_once MANIFEST . '/jit-recipes.php'; require_once MANIFEST . '/jit-precaching.php'; require_once TOOLKIT . '/class.fieldmanager.php'; $fm = new FieldManager(Symphony::Engine()); $section = $context['section']; if (!$section) { require_once TOOLKIT . '/class.sectionmanager.php'; $sm = new SectionManager(Symphony::Engine()); $section = $sm->fetch($context['entry']->get('section_id')); } // iterate over each field in this entry foreach ($context['entry']->getData() as $field_id => $data) { // get the field meta data $field = $fm->fetch($field_id); // iterate over the field => recipe mapping foreach ($cached_recipes as $cached_recipe) { // check a mapping exists for this section/field combination if ($section->get('handle') != $cached_recipe['section']) { continue; } if ($field->get('element_name') != $cached_recipe['field']) { continue; } // iterate over the recipes mapped for this section/field combination foreach ($cached_recipe['recipes'] as $cached_recipe_name) { // get the file name, includes path relative to workspace $file = $data['file']; if (!isset($file) || is_null($file)) { continue; } // trim the filename from path $uploaded_file_path = explode('/', $file); array_pop($uploaded_file_path); // image path relative to workspace if (is_array($uploaded_file_path)) { $uploaded_file_path = implode('/', $uploaded_file_path); } // iterate over all JIT recipes foreach ($recipes as $recipe) { // only process if the recipe has a URL Parameter (name) if (is_null($recipe['url-parameter'])) { continue; } // if not using wildcard, only process specified recipe names if ($cached_recipe_name != '*' && $cached_recipe_name != $recipe['url-parameter']) { continue; } // process the image using the usual JIT URL and get the result $image_data = file_get_contents(URL . '/image/' . $recipe['url-parameter'] . $file); // create a directory structure that matches the JIT URL structure General::realiseDirectory(WORKSPACE . '/image-cache/' . $recipe['url-parameter'] . $uploaded_file_path); // save the image to disk file_put_contents(WORKSPACE . '/image-cache/' . $recipe['url-parameter'] . $file, $image_data); } } } } }
public function appendStyles($context) { $callback = Administration::instance()->getPageCallback(); if (is_a(Symphony::Engine(), 'Administration')) { Symphony::Engine()->Page->addScriptToHead(URL . '/extensions/email_newsletter_manager/assets/email_newsletter_manager.admin.js', 70); Symphony::Engine()->Page->addStylesheetToHead(URL . '/extensions/email_newsletter_manager/assets/email_newsletter_manager.recipientgroups.preview.css', 'screen', 1000); } }
public function processRawFieldData($data, &$status, $simulate = false, $entry_id = null) { $status = self::__OK__; $author = 'frontend user'; if (Symphony::Engine() instanceof Administration) { $author = Administration::instance()->Author->getFullName(); } return array('value' => '', 'last_modified' => DateTimeObj::get('Y-m-d H:i:s', time()), 'last_modified_author' => $author); }
/** * Append assets to the page head * @param object $context */ public function appendAssets($context) { $callback = Symphony::Engine()->getPageCallback(); if ($callback['context']['page'] == 'edit') { Administration::instance()->Page->addScriptToHead(URL . '/extensions/folio_overrides/assets/folio_overrides.fields.js'); Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/folio_overrides/assets/folio_overrides.fields.css'); } Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/folio_overrides/assets/folio_overrides.css'); }
/** * Append assets */ public function appendAssets() { $callback = Symphony::Engine()->getPageCallback(); if ($callback['driver'] == 'publish') { Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/association_ui_selector/assets/aui.selector.publish.css'); Administration::instance()->Page->addScriptToHead(URL . '/extensions/association_ui_selector/assets/selectize.js'); Administration::instance()->Page->addScriptToHead(URL . '/extensions/association_ui_selector/assets/aui.selector.publish.js'); } }
public static function initialize() { if (is_null(self::$_initialized)) { $engine =& Symphony::Engine(); self::$sectionManager = new SectionManager($engine); self::$fieldManager = new FieldManager($engine); self::$_initialized = true; } }
public function __appendAssets($context) { $callback = Symphony::Engine()->getPageCallback(); // Append styles for publish area if ($callback['driver'] == 'systemextensions') { Administration::instance()->Page->addScriptToHead(URL . '/extensions/extension_status/assets/system.extensions.js', 100, false); Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/extension_status/assets/system.extensions.css', 'screen', 101, false); } }
/** * Only create a Member object on the Frontend of the site. * There is no need to create this in the Administration context * as authenticated users are Authors and are handled by Symphony, * not this extension. */ public function __construct() { if (class_exists('Symphony') && Symphony::Engine() instanceof Frontend) { $this->Member = new SymphonyMember($this); } extension_Members::$entryManager = new EntryManager(Symphony::Engine()); if (!extension_Members::$initialised) { extension_Members::initialise(); } }
/** * append needed css an js files to the document head */ public function __appendAssets($context) { $callback = Symphony::Engine()->getPageCallback(); // Append styles for publish area if ($callback['driver'] == 'publish' && $callback['context']['page'] != 'index') { if (self::hasInstance('enhanced_upload', $callback['context']['section_handle'])) { Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/enhanced_upload_field/assets/style.css', 'screen', 100, false); Administration::instance()->Page->addScriptToHead(URL . '/extensions/enhanced_upload_field/assets/script.enhanced_upload_field.js', 80, false); } } }
public static function updateSections() { $files = General::listStructure(WORKSPACE . '/sections', array(), false); $engine =& Symphony::Engine(); $sectionManager = new SectionManager($engine); $fieldManager = new FieldManager($engine); if (is_array($files['filelist']) && !empty($files['filelist'])) { foreach ($files['filelist'] as $filename) { $data = @file_get_contents(WORKSPACE . "/sections/{$filename}"); // Create DOMDocument instance $xml = new DOMDocument(); $xml->preserveWhiteSpace = false; $xml->formatOutput = true; $xml->loadXML($data); // XPath for querying nodes $xpath = new DOMXPath($xml); $editing = false; $section_guid = $xpath->query('/section/@guid')->item(0)->value; $sections = Symphony::Database()->fetchCol('guid', "SELECT * FROM `tbl_sections`"); if (in_array($section_guid, $sections)) { $editing = true; } // Meta data $meta = array(); $meta_nodes = $xpath->query('/section/meta/*'); foreach ($meta_nodes as $node) { $meta[$node->tagName] = $node->textContent; } if ($editing) { Symphony::Database()->update($meta, 'tbl_sections', "guid = {$section_guid}"); } else { $section_id = $sectionManager->add($meta); } // Fields $fields = array(); $field_nodes = $xpath->query('/section/fields/entry'); foreach ($field_nodes as $node) { $field = array(); foreach ($node->childNodes as $childNode) { $field[$childNode->tagName] = $childNode->textContent; } $fields[] = $field; } self::removeMissingFields($fields, $fieldManager); if (is_array($fields) && !empty($fields)) { foreach ($fields as $data) { $field = $fieldManager->create($data['type']); $field->setFromPOST($data); $field->commit(); } } } } }
public function findAllFields($section_id) { $fieldManager = new FieldManager(Symphony::Engine()); $fields = $fieldManager->fetch(NULL, $section_id, 'ASC', 'sortorder', NULL, NULL, 'AND (type != "fop")'); if (is_array($fields) && !empty($fields)) { foreach ($fields as $field) { $options[] = 'entry/' . $field->get('element_name'); } } return $options; }
/** * Add the script to the header */ public function addScriptToHeader($context) { if (!empty(Symphony::Engine()->Author)) { if (Symphony::Engine()->Author->isDeveloper()) { $context['output'] = str_replace('</head>', ' <link rel="stylesheet" type="text/css" media="screen,tv,projection" href="' . URL . '/extensions/frontend_debug/assets/frontend_debug.css" /> <script type="text/javascript" src="' . URL . '/symphony/assets/jquery.js"></script> <script type="text/javascript" src="' . URL . '/extensions/frontend_debug/assets/frontend_debug.js"></script> </head>', $context['output']); } } }
/** * Add JavaScript */ public function initaliseAdminPageHead($context) { $callback = Symphony::Engine()->getPageCallback(); // Append javascript for publish table if ($callback['driver'] == 'publish' && $callback['context']['page'] == 'index') { $settings = Symphony::Configuration()->get('unpublishedfilter'); Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/unpublishedfilter/assets/unpublishedfilter.publish.css', 'screen', 2000); Administration::instance()->Page->addScriptToHead(URL . '/extensions/unpublishedfilter/assets/unpublishedfilter.publish.js', 2002); if ($settings['filter-by-dates'] === false) { Administration::instance()->Page->addElementToHead(new XMLElement('script', 'Symphony.Context.add(\'filter-by-dates\', false);', array('type' => 'text/javascript'))); } } }
public function addJavaScriptAndCSS() { $callback = Symphony::Engine()->getPageCallback(); if ($callback['driver'] != 'blueprintsdatasources' || !is_array($callback['context'])) { return; } // Find data source handle. $handle = NULL; if ($callback['context'][0] == 'edit' && !empty($callback['context'][1])) { $handle = $callback['context'][1]; } // Find current XPath values. $parametrisator = array('xslt' => false, 'xpaths' => array()); if (isset($_POST['parametrisator'])) { $parametrisator['xslt'] = $_POST['parametrisator']['xslt']; if (isset($_POST['parametrisator']['xpaths']) && isset($_POST['parametrisator']['xpaths']['name'])) { $parametrisator['xpaths'] = array_combine($_POST['parametrisator']['xpaths']['name'], $_POST['parametrisator']['xpaths']['xpath']); } else { $parametrisator['xpaths'] = array(); } } else { if (!empty($handle)) { $datasourceManager = new DatasourceManager(Symphony::Engine()); $existing =& $datasourceManager->create($handle, NULL, false); if (!empty($existing)) { if (is_array($existing->dsParamParametrisator)) { $parametrisator = $existing->dsParamParametrisator; } if (!empty($existing->dsParamROOTELEMENT)) { $handle = $existing->dsParamROOTELEMENT; } } } } // Remove empty values $parametrisator['xpaths'] = array_filter($parametrisator['xpaths']); // Get list of utilities $xsltfile = $parametrisator['xslt']; $parametrisator['xslt'] = '<option value="">' . __('Disabled') . '</option>'; $utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES); if (is_array($utilities) && is_array($utilities['filelist'])) { foreach ($utilities['filelist'] as $utility) { $parametrisator['xslt'] .= '<option value="' . $utility . '"' . ($xsltfile == $utility ? ' selected="selected"' : '') . '>' . $utility . '</option>'; } } // Let our script know sort and order values. Administration::instance()->Page->addElementToHead(new XMLElement('script', "Symphony.Context.add('parametrisator', " . json_encode(array('xslt' => $parametrisator['xslt'], 'xpaths' => $parametrisator['xpaths'], 'handle' => $handle)) . ");", array('type' => 'text/javascript')), 100); // Append scripts and styles for field settings pane Administration::instance()->Page->addScriptToHead(URL . '/extensions/parametrisator/assets/parametrisator.settings.js', 101, false); }
function __switchboard($type = 'view') { $this->_page = $this->_context['0']; $this->_flag = $this->_context['1']; $function = ($type == 'action' ? '__action' : '__view') . (isset($this->_page) ? ucfirst($this->_page) : 'Index'); if (!method_exists($this, $function)) { ## If there is no action function, just return without doing anything if ($type == 'action') { return; } Symphony::Engine()->errorPageNotFound(); } $this->{$function}(); }
public function unserializeEntry($entry_id, $version) { $entry = unserialize(file_get_contents(MANIFEST . '/versions/' . $entry_id . '/' . $version . '.dat')); $entryManager = new EntryManager(Symphony::Engine()); $new_entry = $entryManager->create(); $new_entry->set('id', $entry['id']); $new_entry->set('author_id', $entry['author_id']); $new_entry->set('section_id', $entry['section_id']); $new_entry->set('creation_date', $entry['creation_date']); $new_entry->set('creation_date_gmt', $entry['creation_date_gmt']); foreach ($entry['data'] as $field_id => $value) { $new_entry->setData($field_id, $value); } return $new_entry; }
/** * Append assets to the page head * * @param object $context */ public function __appendAssets($context) { $callback = Symphony::Engine()->getPageCallback(); // Append skripts and styles for field settings pane if ($callback['driver'] == 'blueprintssections' && is_array($callback['context'])) { Administration::instance()->Page->addScriptToHead(URL . '/extensions/subsectionmanager/assets/subsectionmanager.settings.js', 100, false); Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/subsectionmanager/assets/subsectionmanager.settings.css', 'screen', 101, false); } // Append styles for publish area if ($callback['driver'] == 'publish' && $callback['context']['page'] == 'index') { Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/subsectionmanager/assets/subsectionmanager.index.publish.css', 'screen', 100, false); } // Append styles for subsection display if ($callback['driver'] == 'publish' && $callback['context']['page'] != 'index') { Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/subsectionmanager/assets/subsection.publish.css', 'screen', 101, false); } }
public function appendAssets($context) { if($this->getFormatter() == '') return; $page = Administration::instance()->Page; $callback = Symphony::Engine()->getPageCallback(); // Only append Assets if we are viewing an Entry. if($page instanceof contentPublish && $callback['context']['page'] !== 'index') { $textformatter = extension_markitup_editor::getFormatter(); $page->addStylesheetToHead(URL . '/extensions/markitup_editor/assets/skin/markitup.skins.style.css', 'screen', 10000, true); $page->addStylesheetToHead(URL . '/extensions/markitup_editor/assets/sets/'.$textformatter.'/markitup.set.style.css', 'screen', 10001, true); $page->addScriptToHead(URL . '/extensions/markitup_editor/assets/jquery.markitup.js', 10002, false); $page->addScriptToHead(URL . '/extensions/markitup_editor/assets/sets/'.$textformatter.'/markitup.set.js', 10003, false); $page->addScriptToHead(URL . '/extensions/markitup_editor/assets/markitup_editor.publish.js', 10004, false); } }
public function initaliseAdminPageHead($context) { $page = $context['parent']->Page; if ($page instanceof contentExtensionBulkImporterImport) { $page->addStylesheetToHead(URL . '/extensions/bulkimporter/assets/bulkimporter.import.css', 'screen', 100); $page->addScriptToHead(URL . '/extensions/bulkimporter/assets/bulkimporter.import.js', 101); } else { $callback = Symphony::Engine()->getPageCallback(); if (!is_array($callback['context'])) { return; } if ($callback['driver'] == 'publish' && !empty($callback['context']['section_handle']) && !empty($callback['context']['entry_id'])) { $sm = new SectionManager(Symphony::Engine()); $section_id = $sm->fetchIDFromHandle($callback['context']['section_handle']); $values = Symphony::Database()->fetch(' SELECT * FROM tbl_bulkimporter_fields WHERE `section_id` = ' . intval($section_id), 'field_id'); if (!empty($values)) { Administration::instance()->Page->addElementToHead(new XMLElement('script', "Symphony.Context.add('bulkimporter', " . json_encode(array('fields' => $values)) . ");", array('type' => 'text/javascript')), 100); $page->addStylesheetToHead(URL . '/extensions/bulkimporter/assets/bulkimporter.publish.css', 'screen', 200); $page->addScriptToHead(URL . '/extensions/bulkimporter/assets/bulkimporter.publish.js', 201); } } else { if ($callback['driver'] == 'blueprintssections') { if ($callback['context'][0] == 'edit' && is_numeric($callback['context'][1])) { $values = Symphony::Database()->fetch(' SELECT * FROM tbl_bulkimporter_fields WHERE `section_id` = ' . intval($callback['context'][1]), 'field_id'); if (!empty($values)) { Administration::instance()->Page->addElementToHead(new XMLElement('script', "Symphony.Context.add('bulkimporter', " . json_encode(array('fields' => $values)) . ");", array('type' => 'text/javascript')), 100); } } //$page->addStylesheetToHead(URL . '/extensions/bulkimporter/assets/bulkimporter.settings.css','screen', 200); $page->addScriptToHead(URL . '/extensions/bulkimporter/assets/bulkimporter.settings.js', 201); } } } }
function update($previousVersion = false) { $needSave = true; switch ($previousVersion) { case false: case 0: case 2.0: case 2.1: if (!($temp = Symphony::Configuration()->get('qname', 'gcse'))) { $temp = '{$q:$url-q}'; } Symphony::Configuration()->set('qname', '$' . $temp . ':$url-' . $temp, 'gcse'); if (!($temp = Symphony::Configuration()->get('pname', 'gcse'))) { $temp = '{$p:$url-p}'; } Symphony::Configuration()->set('pname', '$' . $temp . ':$url-' . $temp, 'gcse'); default: $needSave = false; break; } return $needSave ? Symphony::Engine()->saveConfig() : true; }