public function initaliseAdminPageHead($context)
 {
     if (!extension_loaded('gd')) {
         Administration::instance()->Page->pageAlert(__('You don\'t have the GD library installed. Admin Rainbow Headline will remain disabled until you\'ve installed it.'), Alert::ERROR);
         return;
     }
     $page = Administration::instance()->Page;
     $color = General::Sanitize(Symphony::Configuration()->get('headline_color', 'admin_rainbow_headline'));
     if ($color != "" && $color != "#") {
         $rgb = sscanf($color, '#%2x%2x%2x');
         $luminance = 0.2126 * $rgb[0] + 0.7151999999999999 * $rgb[1] + 0.0722 * $rgb[2];
         $style = "\n\t\t\t\t\t\tbody #header h1 { background-color: " . $color . "; }";
         if ($luminance > 125) {
             $style .= "\n\t\t\t\t\t\tbody #header a { color: #333333; text-shadow: -1px 2px 3px rgba(0,0,0,0.3); }\n\t\t\t\t\t\tbody #header a:hover { color: #000000; }";
         }
         $page->addElementToHead(new XMLElement("style", $style, array("type" => "text/css", "media" => "screen, projection")), 100012);
         $imagehandle = imagecreatetruecolor(16, 16);
         $colorhandle = imagecolorallocate($imagehandle, $rgb[0], $rgb[1], $rgb[2]);
         imagefill($imagehandle, 0, 0, $colorhandle);
         ob_start();
         imagepng($imagehandle);
         $ico64data = base64_encode(ob_get_contents());
         ob_end_clean();
         $page->addElementToHead(new XMLElement("link", NULL, array("rel" => "shortcut icon", "href" => "data:image/png;base64," . $ico64data, "type" => "image/png")), 100013);
         unset($colorhandle);
         unset($ico64data);
         imagedestroy($imagehandle);
     }
 }
 public function Context()
 {
     if (class_exists('Frontend')) {
         return (object) Frontend::instance();
     }
     return (object) Administration::instance();
 }
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 public function __appendAssets($context)
 {
     if (isset(Administration::instance()->Page->_context['section_handle']) && in_array(Administration::instance()->Page->_context['page'], array('new', 'edit'))) {
         Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/multiselect_to_checkboxes/assets/mtoc.css', 'screen', 221);
         Administration::instance()->Page->addScriptToHead(URL . '/extensions/multiselect_to_checkboxes/assets/jquery.symphony.mtoc.js', 222);
     }
 }
 public function initaliseAdminPageHead($context)
 {
     $page = Administration::instance()->Page;
     if ($page instanceof contentPublish) {
         $callback = Administration::instance()->getPageCallback();
         if ($callback['context']['page'] !== 'edit') {
             return;
         }
         $sm = new SectionManager(Administration::instance());
         $current_section = $sm->fetch($sm->fetchIDFromHandle($callback['context']['section_handle']));
         $current_section_hash = $this->serialiseSectionSchema($current_section);
         $duplicate_sections = array();
         foreach ($sm->fetch() as $section) {
             $section_hash = $this->serialiseSectionSchema($section);
             if ($section_hash == $current_section_hash && $section->get('handle')) {
                 $duplicate_sections[$section->get('handle')] = $section->get('name');
             }
         }
         if (count($duplicate_sections) < 2) {
             $duplicate_sections = NULL;
         }
         Administration::instance()->Page->addElementToHead(new XMLElement('script', "Symphony.Context.add('duplicate-entry', " . json_encode(array('current-section' => $callback['context']['section_handle'], 'duplicate-sections' => $duplicate_sections)) . ");", array('type' => 'text/javascript')), time());
         $page->addScriptToHead(URL . '/extensions/duplicate_entry/assets/duplicate_entry.js', 10001);
         // add particular css for SSM
         Administration::instance()->Page->addElementToHead(new XMLElement('style', "body.inline.subsection #duplicate-entry { display: none; visibility: collapse }", array('type' => 'text/css')), time() + 101);
     }
 }
 public function cleanupSections($context)
 {
     $callback = Administration::instance()->getPageCallback();
     if ($callback['driver'] === 'blueprintssections') {
         MigrationManager::cleanup();
     }
 }
 public function __construct($args)
 {
     $this->_Parent =& $args['parent'];
     $this->_callback = Administration::instance()->getPageCallback();
     $this->_section = $this->getSection();
     $this->_static = $this->isStaticSection();
 }
 public function dInitialiseAdminPageHead()
 {
     if (!$this->getValidDependencies()) {
         $message = __('Sections Event depends on Members and EXSL Function Manager extensions. Make sure they are installed.');
         Administration::instance()->Page->pageAlert($message, Alert::NOTICE);
     }
 }
 public function __viewIndex()
 {
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Utilities'))));
     $this->appendSubheading(__('Utilities'), Widget::Anchor(__('Create New'), Administration::instance()->getCurrentPageURL() . '/new/', array('title' => __('Create a new utility'), 'class' => 'create button')));
     $utilities = General::listStructure(UTILITIES, array('xsl'), false, 'asc', UTILITIES);
     $utilities = $utilities['filelist'];
     $uTableHead = array(array(__('Name'), 'col'));
     $uTableBody = array();
     $colspan = count($uTableHead);
     if (!is_array($utilities) or empty($utilities)) {
         $uTableBody = array(Widget::TableRow(array(Widget::TableData(__('None found.'), array('class' => 'inactive', 'colspan' => $colspan))), array('class' => 'odd')));
     } else {
         foreach ($utilities as $util) {
             $uRow = Widget::TableData(Widget::Anchor($util, ADMIN_URL . '/blueprints/utilities/edit/' . str_replace('.xsl', '', $util) . '/'));
             $uRow->appendChild(Widget::Input("items[{$util}]", null, 'checkbox'));
             $uTableBody[] = Widget::TableRow(array($uRow));
         }
     }
     $table = Widget::Table(Widget::TableHead($uTableHead), null, Widget::TableBody($uTableBody), array('id' => 'utilities-list'));
     $this->Form->appendChild($table);
     $tableActions = $this->createElement('div');
     $tableActions->setAttribute('class', 'actions');
     $options = array(array(null, false, __('With Selected...')), array('delete', false, __('Delete')));
     $tableActions->appendChild(Widget::Select('with-selected', $options));
     $tableActions->appendChild(Widget::Input('action[apply]', __('Apply'), 'submit'));
     $this->Form->appendChild($tableActions);
 }
 public static function driver()
 {
     if (class_exists('Administration')) {
         return Administration::instance()->Configuration;
     }
     return Frontend::instance()->Configuration;
 }
 private static function __dbConnectionResource()
 {
     if (class_exists('Frontend')) {
         return Frontend::instance()->Database->getConnectionResource();
     }
     return Administration::instance()->Database->getConnectionResource();
 }
 public static function appendAssets()
 {
     if (class_exists('Administration') && Administration::instance() instanceof Administration && Administration::instance()->Page instanceof HTMLPage) {
         Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/field_metakeys/assets/field_metakeys.publish.css', 'screen', 100, false);
         Administration::instance()->Page->addScriptToHead(URL . '/extensions/field_metakeys/assets/field_metakeys.publish.js', 100, false);
     }
 }
Exemple #13
0
 public function initializeAdmin($context)
 {
     $page = Administration::instance()->Page;
     $context = $page->getContext();
     $callback = Administration::instance()->getPageCallback();
     // only proceed on New or Edit publish pages
     if ($page instanceof contentPublish and in_array($context['page'], array('new', 'edit'))) {
         $page->addStylesheetToHead(URL . '/extensions/publish_tabs/assets/publish_tabs.publish.css', 'screen', 9001);
         $page->addScriptToHead(URL . '/extensions/publish_tabs/assets/publish_tabs.publish.js', 9002);
         include_once TOOLKIT . '/class.sectionmanager.php';
         $section_id = SectionManager::fetchIDFromHandle($callback['context']['section_handle']);
         $section = SectionManager::fetch($section_id);
         if (!$section instanceof Section) {
             return;
         }
         $tabs = array();
         $current_tab = '';
         $index = -1;
         foreach ($section->fetchFieldsSchema() as $i => $field) {
             if ($i == 0 && $field['type'] != 'publish_tabs') {
                 $current_tab = 'untitled-tab';
                 $tabs[++$index]['tab_id'] = $current_tab;
             }
             if ($field['type'] == 'publish_tabs') {
                 $current_tab = $field['id'];
                 $tabs[++$index]['tab_id'] = $current_tab;
             } else {
                 $tabs[$index][$field['location']][] = 'field-' . $field['id'];
             }
         }
         $page->addElementToHead(new XMLElement('script', "Symphony.Context.add('publish-tabs', " . json_encode($tabs) . ")", array('type' => 'text/javascript')), 9003);
     }
 }
 /**
  * Append notice that the site is currently in maintenance mode offering a link
  * to switch to live mode if no other alert is set.
  *
  * @param array $context
  *  delegate context
  */
 public function __appendAlert($context)
 {
     // Site in maintenance mode
     if (Symphony::Configuration()->get('enabled', 'maintenance_mode') == 'yes') {
         Administration::instance()->Page->pageAlert(__('This site is currently in maintenance mode.') . ' <a href="' . SYMPHONY_URL . '/system/preferences/?action=toggle-maintenance-mode&amp;redirect=' . getCurrentPage() . '">' . __('Restore?') . '</a>', Alert::NOTICE);
     }
 }
 public static function start($lifetime = 0, $path = '/', $domain = NULL)
 {
     if (!self::$_initialized) {
         ## Crude method of determining if we're in the admin or frontend
         if (class_exists('Frontend')) {
             self::$_db =& Frontend::instance()->Database;
         } elseif (class_exists('Administration')) {
             self::$_db =& Administration::instance()->Database;
         } else {
             return false;
         }
         if (!is_object(self::$_db) || !self::$_db->isConnected()) {
             return false;
         }
         self::$_cache = new Cacheable(self::$_db);
         $installed = self::$_cache->check('_session_config');
         if (!$installed) {
             if (!self::createTable()) {
                 return false;
             }
             self::$_cache->write('_session_config', true);
         }
         ini_set('session.save_handler', 'user');
         session_set_save_handler(array('Session', 'open'), array('Session', 'close'), array('Session', 'read'), array('Session', 'write'), array('Session', 'destroy'), array('Session', 'gc'));
         session_set_cookie_params($lifetime, $path, $domain ? $domain : self::getDomain(), false, false);
         self::$_initialized = true;
         if (session_id() == '') {
             session_start();
         }
     }
     return session_id();
 }
 /**
  * Set up configuration defaults and database tables
  */
 public function install()
 {
     // number of entries per page when rebuilding index
     Symphony::Configuration()->set('re-index-per-page', 20, 'search_index');
     // refresh frequency when rebuilding index
     Symphony::Configuration()->set('re-index-refresh-rate', 0.5, 'search_index');
     // append wildcard * to the end of search phrases (reduces performance, increases matches)
     Symphony::Configuration()->set('append-wildcard', 'yes', 'search_index');
     // names of GET parameters used for custom search DS
     Symphony::Configuration()->set('get-param-prefix', '', 'search_index');
     Symphony::Configuration()->set('get-param-keywords', 'keywords', 'search_index');
     Symphony::Configuration()->set('get-param-per-page', 'per-page', 'search_index');
     Symphony::Configuration()->set('get-param-sort', 'sort', 'search_index');
     Symphony::Configuration()->set('get-param-direction', 'direction', 'search_index');
     Symphony::Configuration()->set('get-param-sections', 'sections', 'search_index');
     Symphony::Configuration()->set('get-param-page', 'page', 'search_index');
     Administration::instance()->saveConfig();
     try {
         Symphony::Database()->query("CREATE TABLE IF NOT EXISTS `tbl_fields_search_index` (\n\t\t\t\t\t  `id` int(11) unsigned NOT NULL auto_increment,\n\t\t\t\t\t  `field_id` int(11) unsigned NOT NULL,\n\t\t\t\t  PRIMARY KEY  (`id`),\n\t\t\t\t  KEY `field_id` (`field_id`))");
         Symphony::Database()->query("CREATE TABLE `tbl_search_index` (\n\t\t\t\t\t  `id` int(11) NOT NULL auto_increment,\n\t\t\t\t\t  `entry_id` int(11) NOT NULL,\n\t\t\t\t\t  `section_id` int(11) NOT NULL,\n\t\t\t\t\t  `language` varchar(2) NOT NULL,\n\t\t\t\t\t  `data` text,\n\t\t\t\t\t  PRIMARY KEY (`id`),\n\t\t\t\t\t  FULLTEXT KEY `data` (`data`)\n\t\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8");
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
 public function build($context)
 {
     parent::build($context);
     if (isset($_POST['filter']['keyword']) != '') {
         redirect(Administration::instance()->getCurrentPageURL() . '?keywords=' . $_POST['keywords']);
     }
 }
 public static function buildEditor(XMLElement $wrapper, array &$errors = array(), array $settings = null, $handle = null)
 {
     Administration::instance()->Page->addScriptToHead(URL . '/extensions/section_schemas/assets/section_schemas.datasource.js', 100);
     if (is_null($settings[self::getClass()]['fields'])) {
         $settings[self::getClass()]['fields'] = array();
     }
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings contextual ' . __CLASS__);
     $fieldset->setAttribute('data-context', General::createHandle(self::getName()));
     $fieldset->appendChild(new XMLElement('legend', self::getName()));
     $group = new XMLElement('div');
     $group->setAttribute('class', 'two columns');
     $options = array();
     $sections = SectionManager::fetch();
     foreach ($sections as $section) {
         $options[] = array($section->get('handle'), $settings[self::getClass()]['section'] == $section->get('handle'), $section->get('name'));
     }
     $label = Widget::Label(__('Section'));
     $label->setAttribute('class', 'column');
     $label->appendChild(Widget::Select('fields[' . self::getClass() . '][section]', $options));
     $group->appendChild($label);
     foreach ($sections as $section) {
         $fields = $section->fetchFields();
         $options = array();
         foreach ($fields as $field) {
             $options[] = array($field->get('element_name'), in_array($field->get('element_name'), $settings[self::getClass()]['fields']), $field->get('label') . ' (' . $field->get('type') . ')');
         }
         $label = Widget::Label(__('Fields'));
         $label->setAttribute('class', 'column fields fields-for-' . $section->get('handle'));
         $label->appendChild(Widget::Select('fields[' . self::getClass() . '][fields][]', $options, array('multiple' => 'multiple')));
         $group->appendChild($label);
     }
     $fieldset->appendChild($group);
     $wrapper->appendChild($fieldset);
 }
 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\t\t  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n\t\t  `email` varchar(255),\n\t\t  `result` varchar(255),\n\t\t  PRIMARY KEY (`id`),\n\t\t  KEY `email` (`email`)\n\t\t) 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 = Administration::instance()->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());
 }
 function generate($items, $subsection_field, $subsection_id, $entry_id = NULL, $full = false)
 {
     if (!is_array($items)) {
         $items = array($items);
     }
     $this->_Items = $items;
     // Fetch subsection meta data
     $meta = Administration::instance()->Database->fetch("SELECT filter_tags, caption, show_preview\n\t\t\t\tFROM tbl_fields_subsectionmanager\n\t\t\t\tWHERE field_id = '{$subsection_field}'\n\t\t\t\tLIMIT 1");
     // Get display mode
     if ($meta[0]['show_preview'] == 'yes') {
         $mode = 'preview';
     } else {
         $mode = 'plain';
     }
     // Fetch entry data
     $sectionManager = new SectionManager($this->_Parent);
     $subsection = $sectionManager->fetch($subsection_id, 'ASC', 'name');
     $fields = $subsection->fetchFields();
     $entries = $this->__filterEntries($subsection_id, $fields, $meta[0]['filter_tags'], $entry_id);
     // Check caption
     $caption = $meta[0]['caption'];
     if ($caption == '') {
         // Fetch name of primary field in subsection
         $primary = Administration::instance()->Database->fetch("SELECT element_name\n\t\t\t\t\tFROM tbl_fields\n\t\t\t\t\tWHERE parent_section = '{$subsection_id}'\n\t\t\t\t\tAND sortorder = '0'\n\t\t\t\t\tLIMIT 1");
         $caption = '{$' . $primary[0]['element_name'] . '}';
     }
     // Layout subsection data
     $data = $this->__layoutSubsection($entries, $fields, $caption, $mode, $full);
     return $data;
 }
 public function __appendJavaScript($context)
 {
     if (isset(Administration::instance()->Page->_context['section_handle']) && in_array(Administration::instance()->Page->_context['page'], array('new', 'edit'))) {
         Administration::instance()->Page->addStylesheetToHead(URL . '/extensions/vimeo_videos/assets/vimeo_video.css', 'screen', 190);
         Administration::instance()->Page->addScriptToHead(URL . '/extensions/vimeo_videos/assets/vimeo_video.js', 195);
     }
 }
 public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
 {
     $value = isset($data['author_id']) ? $data['author_id'] : NULL;
     $callback = Administration::instance()->getPageCallback();
     if ($this->get('default_to_current_user') == 'yes' && empty($data) && empty($_POST)) {
         $value = array(Administration::instance()->Author->get('id'));
     }
     if (!is_array($value)) {
         $value = array($value);
     }
     $authors = AuthorManager::fetch();
     $options = array();
     foreach ($authors as $a) {
         $options[] = array($a->get('id'), in_array($a->get('id'), $value), $a->get('first_name') . ' ' . $a->get('last_name'));
     }
     $fieldname = 'fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix;
     if ($this->get('allow_multiple_selection') == 'yes') {
         $fieldname .= '[]';
     }
     $attr = array();
     if ($this->get('allow_multiple_selection') == 'yes') {
         $attr['multiple'] = 'multiple';
     }
     $label = Widget::Label($this->get('label'));
     $label->appendChild(Widget::Select($fieldname, $options, $attr));
     if ($flagWithError != NULL) {
         $wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
     } else {
         $wrapper->appendChild($label);
     }
 }
 public static function Database()
 {
     if (class_exists('Frontend')) {
         return Frontend::instance()->Database;
     }
     return Administration::instance()->Database;
 }
 public function AddElementToFooter($context)
 {
     $ul =& $context['wrapper'];
     $li = new XMLElement('li');
     $li->setValue("<a href=\"http://symphony-cms.com/\">Symphony CMS Version <strong>" . Administration::instance()->Configuration->get('version', 'symphony') . "</strong></a>");
     $ul->prependChild($li);
 }
 /**
  * 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(SymphonyDOMElement $wrapper, MessageStack $errors)
 {
     $page = Administration::instance()->Page;
     $page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/bbcww_api_client/assets/view.js'));
     $layout = new Layout();
     $left = $layout->createColumn(Layout::SMALL);
     $right = $layout->createColumn(Layout::LARGE);
     $fieldset = Widget::Fieldset(__('Essentials'));
     $label = Widget::Label(__('Name'));
     $label->appendChild(Widget::Input('fields[name]', General::sanitize($this->about()->name)));
     if (isset($errors->{'about::name'})) {
         $fieldset->appendChild(Widget::wrapFormElementWithError($label, $errors->{'about::name'}));
     } else {
         $fieldset->appendChild($label);
     }
     $field_groups = $options = array();
     foreach ($this->driver->getMemberSections() as $section) {
         $source = $section->{'api-source'};
         $field_groups[$section->handle] = array('fields' => $section->fields, 'section' => $section);
         if (!isset($options[$source])) {
             $options[$source] = array('label' => ucwords(strtr($source, '-', ' ')), 'options' => array());
         }
         $options[$source]['options'][] = array($section->handle, $this->parameters()->section == $section->handle, $section->name);
     }
     $label = Widget::Label(__('Section'));
     $label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context')));
     $fieldset->appendChild($label);
     $left->appendChild($fieldset);
     $fieldset = Widget::Fieldset(__('Overrides & Defaults'), '{$param}');
     foreach ($this->driver->getMemberSections() as $section) {
         $this->appendDuplicator($fieldset, $section, $this->parameters()->section == $section->handle ? array('overrides' => $this->parameters()->overrides, 'defaults' => $this->parameters()->defaults) : NULL);
     }
     $right->appendChild($fieldset);
     $layout->appendTo($wrapper);
 }
Exemple #27
0
 public function view()
 {
     // Ensure we have been set $_POST data from Members events
     if (!array_key_exists('members', $_POST)) {
         $this->_status = AjaxPage::STATUS_BAD;
         return;
     } else {
         if (!is_writable(CONFIG)) {
             $this->_status = AjaxPage::STATUS_BAD;
             $this->_Result->appendChild(new XMLElement('message', __('The Symphony configuration file, <code>/manifest/config.php</code>, is not writable. You will not be able to save changes to preferences.')));
             return;
         }
     }
     $settings = $_POST['members'];
     // Generate Recovery Code
     if (isset($settings['generate-recovery-code-template'])) {
         Symphony::Configuration()->set('generate-recovery-code-template', implode(',', array_filter($settings['generate-recovery-code-template'])), 'members');
     } else {
         if ($settings['event'] == 'generate-recovery-code') {
             Symphony::Configuration()->remove('generate-recovery-code-template', 'members');
         }
     }
     // Reset Password
     if (isset($settings['reset-password-template'])) {
         Symphony::Configuration()->set('reset-password-template', implode(',', array_filter($settings['reset-password-template'])), 'members');
     } else {
         if ($settings['event'] == 'reset-password') {
             Symphony::Configuration()->remove('reset-password-template', 'members');
         }
     }
     if ($settings['event'] == 'reset-password') {
         Symphony::Configuration()->set('reset-password-auto-login', $settings['auto-login'], 'members');
     }
     // Regenerate Activation Code
     if (isset($settings['regenerate-activation-code-template'])) {
         Symphony::Configuration()->set('regenerate-activation-code-template', implode(',', array_filter($settings['regenerate-activation-code-template'])), 'members');
     } else {
         if ($settings['event'] == 'regenerate-activation-code') {
             Symphony::Configuration()->remove('regenerate-activation-code-template', 'members');
         }
     }
     // Activate Account
     if (isset($settings['activate-account-template'])) {
         Symphony::Configuration()->set('activate-account-template', implode(',', array_filter($settings['activate-account-template'])), 'members');
     } else {
         if ($settings['event'] == 'activate-account') {
             Symphony::Configuration()->remove('activate-account-template', 'members');
         }
     }
     if ($settings['event'] == 'activate-account') {
         Symphony::Configuration()->set('activate-account-auto-login', $settings['auto-login'], 'members');
     }
     // Return successful
     if (Administration::instance()->saveConfig()) {
         $this->_status = AjaxPage::STATUS_OK;
         $this->_Result->appendChild(new XMLElement('message', __('Preferences saved.')));
         $this->_Result->appendChild(new XMLElement('timestamp', '<![CDATA[' . DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__) . ']]>'));
     }
 }
 public function __appendResources($context)
 {
     $page = Administration::instance()->Page;
     if (isset($page->_context['section_handle']) && in_array($page->_context['page'], array('new', 'edit'))) {
         $page->addStylesheetToHead(URL . '/extensions/youtube_videos/assets/youtube_video.css', 'screen', 190);
         $page->addScriptToHead(URL . '/extensions/youtube_videos/assets/youtube_video.js', 195);
     }
 }
Exemple #29
0
function renderer($mode = 'frontend')
{
    if (!in_array($mode, array('frontend', 'administration'))) {
        throw new Exception('Invalid Symphony Renderer mode specified. Must be either "frontend" or "administration".');
    }
    require_once CORE . "/class.{$mode}.php";
    return $mode == 'administration' ? Administration::instance() : Frontend::instance();
}
Exemple #30
0
 public function initaliseAdminPageHead($context)
 {
     $page = Administration::instance()->Page;
     if ($page instanceof ContentPublish and ($page->_context['page'] == 'edit' or $page->_context['page'] == 'new')) {
         $page->addStylesheetToHead(URL . '/extensions/publishnotesfield/assets/publishnotesfield.publish.css', 'screen', 3220001);
         $page->addScriptToHead(URL . '/extensions/publishnotesfield/assets/publishnotesfield.publish.js', 3220003);
     }
 }