public function view() { $this->setPageType('table'); $this->appendSubheading(__('Templated Text Formatters'), Widget::Anchor(__('Create New'), URL . '/symphony/extension/templatedtextformatters/edit/', __('Create new formatter'), 'create button')); $aTableHead = array(array(__('Title'), 'col'), array(__('Type'), 'col'), array(__('Description'), 'col')); $aTableBody = array(); $formatters = $this->_driver->listAll(); if (!is_array($formatters) || empty($formatters)) { $aTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), 'inactive', NULL, count($aTableHead))))); } else { $tfm = new TextformatterManager($this->_Parent); foreach ($formatters as $id => $data) { $formatter = $tfm->create($id); $about = $formatter->about(); $td1 = Widget::TableData(Widget::Anchor($about['name'], URL . "/symphony/extension/templatedtextformatters/edit/{$id}/", $about['name'])); $td2 = Widget::TableData($about['templatedtextformatters-type']); $td3 = Widget::TableData(General::sanitize($about['description'])); $td1->appendChild(Widget::Input('items[' . $id . ']', NULL, 'checkbox')); // Add a row to the body array, assigning each cell to the row $aTableBody[] = Widget::TableRow(array($td1, $td2, $td3)); } } $table = Widget::Table(Widget::TableHead($aTableHead), NULL, Widget::TableBody($aTableBody), 'selectable'); $this->Form->appendChild($table); $div = new XMLElement('div'); $div->setAttribute('class', 'actions'); $options = array(array(NULL, false, __('With Selected...')), array('delete', false, __('Delete'))); $div->appendChild(Widget::Select('with-selected', $options)); $div->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit')); $this->Form->appendChild($div); }
public static function render($e) { if (is_null($e->getTemplatePath())) { header('HTTP/1.0 500 Server Error'); echo '<h1>Symphony Fatal Error</h1><p>' . $e->getMessage() . '</p>'; exit; } $xml = new DOMDocument('1.0', 'utf-8'); $xml->formatOutput = true; $root = $xml->createElement('data'); $xml->appendChild($root); $root->appendChild($xml->createElement('heading', General::sanitize($e->getHeading()))); $root->appendChild($xml->createElement('message', General::sanitize($e->getMessageObject() instanceof SymphonyDOMElement ? (string) $e->getMessageObject() : trim($e->getMessage())))); if (!is_null($e->getDescription())) { $root->appendChild($xml->createElement('description', General::sanitize($e->getDescription()))); } header('HTTP/1.0 500 Server Error'); header('Content-Type: text/html; charset=UTF-8'); header('Symphony-Error-Type: ' . $e->getErrorType()); foreach ($e->getHeaders() as $header) { header($header); } $output = parent::__transform($xml, basename($e->getTemplatePath())); header(sprintf('Content-Length: %d', strlen($output))); echo $output; exit; }
public function view() { $params = array(); $filter = $_GET['filter']; if ($_GET['template']) { $this->template = General::sanitize($_GET['template']); } // Environment parameters if ($filter == 'env') { $params = array_merge($params, $this->__getEnvParams()); // Page parameters } elseif ($filter == 'page') { $params = array_merge($params, $this->__getPageParams()); // Data source parameters } elseif ($filter == 'ds') { $params = array_merge($params, $this->__getDSParams()); // All parameters } else { $params = array_merge($params, $this->__getEnvParams()); $params = array_merge($params, $this->__getPageParams()); $params = array_merge($params, $this->__getDSParams()); } sort($params); $this->_Result = $params; }
public function grab(&$param_pool) { $result = new XMLElement($this->dsParamROOTELEMENT); foreach ($this->_env as $key => $value) { switch ($key) { case 'param': //$group = new XMLElement('params'); foreach ($this->_env[$key] as $key => $value) { $param = new XMLElement($key, General::sanitize($value)); $result->appendChild($param); } //$result->appendChild($group); break; case 'env': //$group = new XMLElement('pool'); foreach ($this->_env[$key]['pool'] as $key => $value) { $param = new XMLElement($key); if (is_array($value)) { $param->setAttribute('count', count($value)); foreach ($value as $key => $value) { $item = new XMLElement('item', General::sanitize($value)); $item->setAttribute('handle', Lang::createHandle($value)); $param->appendChild($item); } } else { $param->setValue(General::sanitize($value)); } $result->appendChild($param); } //$result->appendChild($group); break; } } return $result; }
public function __viewShow() { $this->setPageType('form'); $title = DateTimeObj::get(__SYM_DATETIME_FORMAT__, $this->_log->request_time); $this->setTitle("Redirection Manager – {$title}"); $this->appendSubheading("<a href=\"{$this->_uri}/logs/\">Redirection Logs</a> — {$title}"); $values = unserialize($this->_log->request_args); foreach ($values as $type => $array) { if (!empty($array)) { $type = strtoupper($type); $fieldset = new XMLElement('fieldset'); $fieldset->setAttribute('class', 'settings'); $fieldset->appendChild(new XMLElement('legend', "{$type} Values")); $pre = new XMLElement('pre'); $code = new XMLElement('code'); ob_start(); print_r($array); $code->setValue(General::sanitize(ob_get_clean())); $pre->appendChild($code); $fieldset->appendChild($pre); $this->Form->appendChild($fieldset); } } }
private function parseInput() { $query = General::sanitize($_REQUEST['q']); $this->forceOverwrite = isset($_REQUEST['force']) && General::sanitize($_REQUEST['force']) == 'true'; if (empty($query)) { throw new Exception(__('Query cannot be empty')); } else { if (strpos($query, 'zipball') !== FALSE || strpos($query, '.zip') !== FALSE) { // full url $this->downloadUrl = $query; $this->extensionHandle = self::handleFromPath($query); } else { if (strpos($query, '/') !== FALSE) { $this->extensionHandle = self::handleFromPath($query); $this->downloadUrl = "https://github.com/{$query}/zipball/master"; } else { // do a search for this handle $this->searchExtension($query); } } } // check if directory exists $this->alreadyExists = file_exists($this->getDestinationDirectory()); if (!$this->forceOverwrite && $this->alreadyExists) { throw new Exception(__('Extension %s already exists', array($this->extensionHandle))); } }
function action() { if (@array_key_exists('save', $_POST['action'])) { $this->_errors = array(); // Polish up some field content $fields = $_POST['fields']; if (isset($fields['pages'])) { $fields['pages'] = implode(',', $fields['pages']); } $fields['content_formatted'] = DocumentationForm::applyFormatting($fields['content'], true, $this->_errors); if ($fields['content_formatted'] === false) { $fields['content_formatted'] = General::sanitize(DocumentationForm::applyFormatting($fields['content'])); } if (!isset($fields['title']) || trim($fields['title']) == '') { $this->_errors['title'] = __('Title is a required field'); } if (!isset($fields['pages']) || trim($fields['pages']) == '') { $this->_errors['pages'] = __('Page is a required field'); } if (!isset($fields['content']) || trim($fields['content']) == '') { $this->_errors['content'] = __('Content is a required field'); } if (empty($this->_errors)) { if (!Symphony::Database()->insert($fields, 'tbl_documentation')) { $this->pageAlert(__('Unknown errors occurred while attempting to save. Please check your <a href="%s">activity log</a>.', array(URL . '/symphony/system/log/')), Alert::ERROR); } else { $doc_id = Symphony::Database()->getInsertID(); redirect(URL . "/symphony/extension/documenter/edit/{$doc_id}/created/"); } } } if (is_array($this->_errors) && !empty($this->_errors)) { $this->pageAlert(__('An error occurred while processing this form. <a href="#error">See below for details.</a>'), Alert::ERROR); } }
public function view() { $name = General::sanitize($_REQUEST['name']); $section = General::sanitize($_REQUEST['section']); $filters = self::processFilters($_REQUEST['filters']); $rootelement = Lang::createHandle($name); $doc_parts = array(); // Add Documentation (Success/Failure) $this->addEntrySuccessDoc($doc_parts, $rootelement, $filters); $this->addEntryFailureDoc($doc_parts, $rootelement, $filters); // Filters $this->addDefaultFiltersDoc($doc_parts, $rootelement, $filters); // Frontend Markup $this->addFrontendMarkupDoc($doc_parts, $rootelement, $section, $filters); $this->addSendMailFilterDoc($doc_parts, $filters); /** * Allows adding documentation for new filters. A reference to the $documentation * array is provided, along with selected filters * * @delegate AppendEventFilterDocumentation * @param string $context * '/blueprints/events/(edit|new|info)/' * @param array $selected * An array of all the selected filters for this Event * @param array $documentation * An array of all the documentation XMLElements, passed by reference * @param string $rootelment * The name of this event, as a handle. */ Symphony::ExtensionManager()->notifyMembers('AppendEventFilterDocumentation', '/blueprints/events/', array('selected' => $filters, 'documentation' => &$doc_parts, 'rootelement' => $rootelement)); $documentation = join(PHP_EOL, array_map(create_function('$x', 'return rtrim($x->generate(true, 4));'), $doc_parts)); $documentation = str_replace('\'', '\\\'', $documentation); $documentation = '<fieldset id="event-documentation" class="settings"><legend>' . __('Documentation') . '</legend>' . $documentation . '</fieldset>'; $this->_Result = $documentation; }
public function __buildPageXML($page, $page_types, $qf) { $lang_code = FLang::getLangCode(); $oPage = new XMLElement('page'); $oPage->setAttribute('handle', $page['handle']); $oPage->setAttribute('id', $page['id']); // keep current first $oPage->appendChild(new XMLElement('item', General::sanitize($page['plh_t-' . $lang_code]), array('lang' => $lang_code, 'handle' => $page['plh_h-' . $lang_code]))); // add others foreach (FLang::getLangs() as $lc) { if ($lang_code != $lc) { $oPage->appendChild(new XMLElement('item', General::sanitize($page['plh_t-' . $lc]), array('lang' => $lc, 'handle' => $page['plh_h-' . $lc]))); } } if (in_array($page['id'], array_keys($page_types))) { $xTypes = new XMLElement('types'); foreach ($page_types[$page['id']] as $type) { $xTypes->appendChild(new XMLElement('type', $type)); } $oPage->appendChild($xTypes); } if ($page['children'] != '0') { if ($children = PageManager::fetch(false, array($qf . 'id, handle, title'), array(sprintf('`parent` = %d', $page['id'])))) { foreach ($children as $c) { $oPage->appendChild($this->__buildPageXML($c, $page_types, $qf)); } } } return $oPage; }
public function appendFormattedElement(&$wrapper, $data, $encode = false, $mode = NULL, $entry_id = NULL) { if (is_null($data) || !is_array($data) || is_null($data['value'])) { return; } $wrapper->appendChild(new XMLElement($this->get('element_name'), $encode ? General::sanitize($data['value']) : $data['value'], array('handle' => $data['handle']))); }
public function grab(&$param_pool) { self::__init(); $result = new XMLElement($this->dsParamROOTELEMENT); $rows = Symphony::Database()->fetch("SELECT *\n\t\t\t\tFROM `tbl_sessions` \n\t\t\t\tWHERE `session_data` != 'sym-|a:0:{}sym-members|a:0:{}' \n\t\t\t\tAND `session_data` REGEXP 'sym-members'\n\t\t\t\tAND `session_expires` > (UNIX_TIMESTAMP() - " . self::AGE . ") \n\t\t\t\tORDER BY `session_expires` DESC"); $added = array(); if (count($rows) > 0) { foreach ($rows as $r) { $raw = $r['session_data']; $data = self::session_real_decode($raw); if (!isset($data['sym-members'])) { continue; } $record = ASDCLoader::instance()->query(sprintf("SELECT\n\t\t\t\t\t\t\t\temail.value AS `email`,\n\t\t\t\t\t\t\t\tMD5(email.value) AS `hash`,\n\t\t\t\t\t\t\t\tcreated_by.username AS `username`\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tFROM `tbl_entries_data_%d` AS `created_by`\n\t\t\t\t\t\t\tLEFT JOIN `tbl_entries_data_%d` AS `email` ON created_by.member_id = email.entry_id\n\t\t\t\t\t\t\tWHERE `created_by`.username = '******'\n\t\t\t\t\t\t\tLIMIT 1", self::findFieldID('created-by', 'comments'), self::findFieldID('email-address', 'members'), ASDCLoader::instance()->escape($data['sym-members']['username']))); if ($record->length() == 0) { continue; } $member = $record->current(); // This is so we dont end up with accidental duplicates. No way to select // distinct via the SQL since we grab raw session data if (in_array($member->username, $added)) { continue; } $added[] = $member->username; $result->appendChild(new XMLElement('member', General::sanitize($member->username), array('email-hash' => $member->hash))); } } else { $result->setValue('No Records Found.'); //This should never happen! } return $result; }
function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null) { $note = isset($data['value']) ? $data['value'] : $this->get('note'); $editable = $this->get('editable'); # Add <div> $div = new XMLElement("div", $note, array("id" => Lang::createHandle($this->get('label')), "class" => "publishnotes-note")); $wrapper->appendChild($div); # Editable if (isset($editable) && $editable) { $wrapper->setAttribute('class', $wrapper->getAttribute('class') . " editable"); $edit = new XMLElement("a", __("Edit note"), array("class" => "publishnotes-edit", "href" => "#edit")); $wrapper->appendChild($edit); # Add <textarea> $label = Widget::Label("Edit: " . $this->get('label'), NULL, Lang::createHandle($this->get('label'))); $textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, 8, 50, strlen($note) != 0 ? General::sanitize($note) : NULL); $label->appendChild($textarea); $control = new XMLElement("div", '<input type="submit" value="Change note"/> or <a href="#">cancel</a>', array("class" => "control")); $label->appendChild($control); if ($flagWithError != NULL) { $wrapper->appendChild(Widget::Error($label, $flagWithError)); } else { $wrapper->appendChild($label); } } }
public static function get() { $response = new XMLElement('response'); foreach (self::$_sections as $section) { $section_xml = new XMLElement('section'); $meta = $section->get(); foreach ($meta as $key => $value) { $section_xml->setAttribute(Lang::createHandle($key), $value); } $fields = $section->fetchFields(); foreach ($fields as $field) { $meta = $field->get(); unset($meta['field_id']); $field_xml = new XMLElement($meta['element_name'], null); foreach (self::$_field_attributes as $attr) { $field_xml->setAttribute(Lang::createHandle($attr), $meta[$attr]); } foreach ($meta as $key => $value) { if (in_array($key, self::$_field_attributes)) { continue; } $value = General::sanitize($value); if ($value != '') { $field_xml->appendChild(new XMLElement(Lang::createHandle($key), General::sanitize($value))); } } $section_xml->appendChild($field_xml); } $response->appendChild($section_xml); } REST_API::sendOutput($response); }
/** * This method is invoked from the `Sortable` class and it contains the * logic for sorting (or unsorting) the resource index. It provides a basic * wrapper to the `ResourceManager`'s `fetch()` method. * * @see toolkit.ResourceManager#getSortingField * @see toolkit.ResourceManager#getSortingOrder * @see toolkit.ResourceManager#fetch * @param string $sort * The field to sort on which should match one of the table's column names. * If this is not provided the default will be determined by * `ResourceManager::getSortingField` * @param string $order * The direction to sort in, either 'asc' or 'desc'. If this is not provided * the value will be determined by `ResourceManager::getSortingOrder`. * @param array $params * An associative array of params (usually populated from the URL) that this * function uses. The current implementation will use `type` and `unsort` keys * @throws Exception * @throws SymphonyErrorPage * @return array * An associative of the resource as determined by `ResourceManager::fetch` */ public function sort(&$sort, &$order, array $params) { $type = $params['type']; if (!is_null($sort)) { General::sanitize($sort); } // If `?unsort` is appended to the URL, then sorting information are reverted // to their defaults if (isset($params['unsort'])) { ResourceManager::setSortingField($type, 'name', false); ResourceManager::setSortingOrder($type, 'asc'); redirect(Administration::instance()->getCurrentPageURL()); } // By default, sorting information are retrieved from // the filesystem and stored inside the `Configuration` object if (is_null($sort) && is_null($order)) { $sort = ResourceManager::getSortingField($type); $order = ResourceManager::getSortingOrder($type); // If the sorting field or order differs from what is saved, // update the config file and reload the page } elseif ($sort !== ResourceManager::getSortingField($type) || $order !== ResourceManager::getSortingOrder($type)) { ResourceManager::setSortingField($type, $sort, false); ResourceManager::setSortingOrder($type, $order); redirect(Administration::instance()->getCurrentPageURL()); } return ResourceManager::fetch($params['type'], array(), array(), $sort . ' ' . $order); }
public function view() { $params = array(); $filter = $_GET['query']; if ($_GET['template']) { $this->template = General::sanitize($_GET['template']); } // Environment parameters if ($filter == 'env') { $params = array_merge($params, $this->__getEnvParams()); // Page parameters } elseif ($filter == 'page') { $params = array_merge($params, $this->__getPageParams()); // Data source parameters } elseif ($filter == 'ds') { $params = array_merge($params, $this->__getDSParams()); // All parameters } else { $params = array_merge($params, $this->__getEnvParams()); $params = array_merge($params, $this->__getPageParams()); $params = array_merge($params, $this->__getDSParams()); } foreach ($params as $param) { if (empty($filter) || strripos($param, $filter) !== false) { $this->_Result[] = $param; } } sort($this->_Result); }
/** * * Overrides the view method */ public function view() { // if this is the unban request if (isset($this->_context) && is_array($this->_context) && count($this->_context) > 0) { // check if we have a hash present $hash = $this->_context[0]; if (strlen($hash) == 36) { // Sanatize user inputed values... ALWAYS $hash = General::sanitize($hash); $this->__unban($hash); } // redirect not matter what // evil users won't be able to detect anything from the response // they *should* still be blocked since guessing a hash is // practically infeasible redirect(SYMPHONY_URL); die; } else { // not banned ? do not show this page! if (!ABF::instance()->isCurrentlyBanned()) { redirect(SYMPHONY_URL); die; } $this->setTitle(sprintf('%1$s – %2$s', __('Unban via email'), __('Symphony'))); $this->Form = Widget::Form('', 'post'); $this->Form->setAttribute('class', 'frame'); $this->Form->appendChild(new XMLElement('h1', __('Symphony'))); $this->__buildFormContent(); $this->Body->appendChild($this->Form); } }
private function checkTemplates($pageId, $prefix = '') { // Link templates: $templates = Symphony::Database()->fetch(sprintf('SELECT * FROM `tbl_ckeditor_link_templates` WHERE `page_id` = %d;', $pageId)); $entryTree = array(); foreach ($templates as $template) { $section = SectionManager::fetch($template['section_id']); $entries = EntryManager::fetch(null, $template['section_id']); $fields = $section->fetchFields(); foreach ($entries as $entry) { $link = $template['link']; // Replace the ID: $link = str_replace('{$id}', $entry->get('id'), $link); $data = $entry->getData(); foreach ($fields as $field) { // Replace the placeholders with the value: // Check if the field has a 'handle': $testData = $field->processRawFieldData('test', $field->__OK__); if (isset($testData['handle'])) { $link = str_replace('{$' . $field->get('element_name') . '}', $data[$field->get('id')]['handle'], $link); } } $entryTree[] = array('handle' => $data[$field->get('id')]['handle'], 'path' => '', 'url' => $link, 'title' => $prefix . ' › ' . General::sanitize($data[$template['field_id']]['value'])); } } return $entryTree; }
public function displayDatasourceFilterPanel(&$wrapper, $data = NULL, $errors = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL) { $wrapper->appendChild(new XMLElement('h4', $this->get('label') . ' <i>' . $this->Name() . '</i>')); $label = Widget::Label('Value'); $label->appendChild(Widget::Input('fields[filter]' . ($fieldnamePrefix ? '[' . $fieldnamePrefix . ']' : '') . '[' . $this->get('id') . ']' . ($fieldnamePostfix ? '[' . $fieldnamePostfix . ']' : ''), $data ? General::sanitize($data) : NULL)); $wrapper->appendChild($label); $wrapper->appendChild(new XMLElement('p', 'Accepts either a 32 character hash, or plain text value. If plain text, it will be hashed before comparing.', array('class' => 'help'))); }
function __construct() { parent::__construct(); $this->_query_string = parent::__buildQueryString(array('debug')); if (!empty($this->_query_string)) { $this->_query_string = '&' . General::sanitize($this->_query_string); } }
public function displayDatasourceFilterPanel(&$wrapper, $data = NULL, $errors = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL) { $wrapper->appendChild(new XMLElement('h4', $this->get('label') . ' <i>' . $this->Name() . '</i>')); $label = Widget::Label('Value'); $label->appendChild(Widget::Input('fields[filter]' . ($fieldnamePrefix ? '[' . $fieldnamePrefix . ']' : '') . '[' . $this->get('id') . ']' . ($fieldnamePostfix ? '[' . $fieldnamePostfix . ']' : ''), $data ? General::sanitize($data) : NULL)); $wrapper->appendChild($label); $wrapper->appendChild(new XMLElement('p', 'To filter by ranges, add <code>mysql:</code> to the beginning of the filter input. Use <code>value</code> for field name. E.G. <code>mysql: value >= 1.01 AND value <= {$price}</code>', array('class' => 'help'))); }
private function __construct() { $this->_language = General::sanitize($_REQUEST['language']); $this->_region = General::sanitize($_REQUEST['region']); $this->_language_code = $this->_region ? $this->_language . '-' . $this->_region : $this->_language; $supported_language_codes = explode(',', General::sanitize(Symphony::Configuration()->get('language_codes', 'language_redirect'))); $this->_supported_language_codes = $this->cleanLanguageCodes($supported_language_codes); }
public function truncateValue($value) { $max_length = $this->_Parent->Configuration->get('cell_truncation_length', 'symphony'); $max_length = $max_length ? $max_length : 75; $value = General::sanitize($value); $value = strlen($value) <= $max_length ? $value : substr($value, 0, $max_length) . '...'; return $value; }
public function view() { $this->_driver = $this->_Parent->ExtensionManager->create('export_entry'); $this->target = $_GET['section']; $this->fieldID = $_GET['field']; if (!$this->validate()) { $this->_status = self::STATUS_BAD; $this->generate(); return false; } $sectionManager = new SectionManager($this->_Parent); $entryManager = new EntryManager($this->_Parent); $section = $sectionManager->fetch($this->target); $fields = $section->fetchFields(); /* Get all the fields from the target section ** Loop them for the section Link field */ foreach ($fields as $field) { if ($field->get("id") == $this->fieldID) { if ($field->get('type') == "bilink") { $linked_section_id = $field->get("linked_section_id"); $linked_field_id = $field->get("linked_field_id"); } else { if ($field->get('type') == "selectbox_link") { $linked_section_id = Symphony::Database()->fetchVar("parent_section_id", 0, "SELECT parent_section_id \n\t\t\t\t\t\t\tFROM `tbl_sections_association` \n\t\t\t\t\t\t\tWHERE `child_section_field_id` = {$field->get("id")}\n\t\t\t\t\t\t\tLIMIT 1"); $linked_field_id = $field->get("related_field_id"); } else { if ($field->get('type') == "checkbox") { $linked_section_id = false; $el = new XMLElement("entry", 'Yes'); $el->setAttribute('id', 'yes'); $this->_Result->appendChild($el); $el = new XMLElement("entry", 'No'); $el->setAttribute('id', 'no'); $this->_Result->appendChild($el); } } } } } if ($linked_section_id) { /* Got the linked field, now get the other end of the ** link. Use the first Visible column as the output handle */ $linked_field_id = $this->_driver->fetchVisibleFieldID($linked_section_id); /* Foreach entry in the linked section, display the first ** column to be selected */ $entries = $entryManager->fetch(null, $linked_section_id); foreach ($entries as $entry) { $data = current($entryManager->fetch($entry->get('id'), $linked_section_id)); $values = $data->getData($linked_field_id); $el = new XMLElement("entry", General::sanitize($values['value'])); $el->setAttribute('id', $entry->get('id')); $this->_Result->appendChild($el); } } }
/** * Generates an XMLElement document representation of the data stored * in the model. * @return XMLElement The XML representation of this model */ public function toXml() { $classname = array_pop(explode('\\', get_called_class())); $xml = new XMLElement($classname, NULL, ['id' => $this->id]); foreach (static::getData() as $key => $value) { $xml->appendChild(new XMLElement($key, \General::sanitize($value))); } return $xml; }
public function __construct() { parent::__construct(); $this->_title = __('Profile'); $this->_query_string = parent::__buildQueryString(array('profile')); if (!empty($this->_query_string)) { $this->_query_string = '&' . General::sanitize($this->_query_string); } }
public function __construct() { parent::__construct(); $this->_title = __('Debug'); $this->_query_string = parent::__buildQueryString(array('symphony-page', 'debug')); if (!empty($this->_query_string)) { $this->_query_string = '&' . General::sanitize($this->_query_string); } }
private static function __buildAuthorXML($author) { $author_xml = new XMLElement('author'); foreach ($author->get() as $key => $value) { $value = General::sanitize($value); if ($value != '') { $author_xml->appendChild(new XMLElement(Lang::createHandle($key), General::sanitize($value))); } } return $author_xml; }
public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null) { $label = Widget::Label($this->get('label')); $name = $this->get('element_name'); $input = Widget::Input("fields{$prefix}[{$name}]{$postfix}", strlen($data['value']) != 0 ? General::sanitize($data['value']) : null); $label->appendChild($input); if ($error != null) { $label = Widget::wrapFormElementWithError($label, $error); } $wrapper->appendChild($label); }
public function view() { $sectionManager = new SectionManager(Administration::instance()); $fieldManager = new FieldManager(Administration::instance()); // Fetch sections & populate a dropdown with the available upload fields $section = $sectionManager->fetch($_GET['section']); foreach ($section->fetchFields() as $field) { if (!preg_match(Extension_BulkImporter::$supported_fields['upload'], $field->get('type'))) { continue; } $element = new XMLElement("field", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type'))); $this->_Result->appendChild($element); } // Check to see if any Sections link to this using the Section Associations table $associations = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\t`child_section_field_id`\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`tbl_sections_association`\n\t\t\t\t\tWHERE\n\t\t\t\t\t\t`parent_section_id` = %d\n\t\t\t\t", Symphony::Database()->cleanValue($_GET['section']))); if (is_array($associations) && !empty($associations)) { foreach ($associations as $related_field) { $field = $fieldManager->fetch($related_field['child_section_field_id']); if (!preg_match(Extension_BulkImporter::$supported_fields['section'], $field->get('type'))) { continue; } $element = new XMLElement("section", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type'), 'section' => $sectionManager->fetch($field->get('parent_section'))->get('name'))); $this->_Result->appendChild($element); } } // Check for Subsection Manager if (Symphony::ExtensionManager()->fetchStatus('subsectionmanager') == EXTENSION_ENABLED) { $associations = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t`field_id`\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`tbl_fields_subsectionmanager`\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`subsection_id` = %d\n\t\t\t\t\t", Symphony::Database()->cleanValue($_GET['section']))); if (is_array($associations) && !empty($associations)) { foreach ($associations as $related_field) { $field = $fieldManager->fetch($related_field['field_id']); if (!preg_match(Extension_BulkImporter::$supported_fields['section'], $field->get('type'))) { continue; } $element = new XMLElement("section", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type'), 'section' => $sectionManager->fetch($field->get('parent_section'))->get('name'))); $this->_Result->appendChild($element); } } } // Check for BiLink if (Symphony::ExtensionManager()->fetchStatus('bilinkfield') == EXTENSION_ENABLED) { $associations = Symphony::Database()->fetch(sprintf("\n\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t`field_id`\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t`tbl_fields_bilink`\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t`linked_section_id` = %d\n\t\t\t\t\t", Symphony::Database()->cleanValue($_GET['section']))); if (is_array($associations) && !empty($associations)) { foreach ($associations as $related_field) { $field = $fieldManager->fetch($related_field['field_id']); if (!preg_match(Extension_BulkImporter::$supported_fields['section'], $field->get('type'))) { continue; } $element = new XMLElement("section", General::sanitize($field->get('label')), array('id' => $field->get('id'), 'type' => $field->get('type'), 'section' => $sectionManager->fetch($field->get('parent_section'))->get('name'))); $this->_Result->appendChild($element); } } } }
private function parseInput() { $this->extensionHandle = General::sanitize($_REQUEST['handle']); $this->baseVersion = General::sanitize($_REQUEST['version']); if (empty($this->extensionHandle)) { throw new Exception(__('Handle cannot be empty')); } else { if (empty($this->baseVersion)) { throw new Exception(__('Version cannot be empty')); } } }