protected function viewSuccess() { $this->Form->setAttribute('action', SYMPHONY_URL); $h2 = new XMLElement('h2', __('Updating Complete')); $this->Form->appendChild($h2); if (!empty($this->_params['post-notes'])) { $dl = new XMLElement('dl'); foreach ($this->_params['post-notes'] as $version => $notes) { if ($notes) { $dl->appendChild(new XMLElement('dt', $version)); foreach ($notes as $note) { $dl->appendChild(new XMLElement('dd', $note)); } } } $this->Form->appendChild($dl); } $this->Form->appendChild(new XMLElement('p', __('And the crowd goes wild! A victory dance is in order; and look, your mum is watching. She\'s proud.', array(Symphony::Configuration()->get('sitename', 'general'))))); $this->Form->appendChild(new XMLElement('p', __('Your mum is also nagging you about removing that %s directory before you log in.', array('<code>' . basename(INSTALL_URL) . '</code>')))); $submit = new XMLElement('div', null, array('class' => 'submit')); $submit->appendChild(Widget::input('submit', __('Complete'), 'submit')); $this->Form->appendChild($submit); }
function index(&$Page, &$Contents, $fields) { global $warnings; global $notices; global $languages; $Form = new XMLElement('form'); $Form->setAttribute('action', kINSTALL_FILENAME . ($_GET['lang'] ? '?lang=' . $_GET['lang'] : '')); $Form->setAttribute('method', 'post'); /** * * START ENVIRONMENT SETTINGS * **/ $Environment = new XMLElement('fieldset'); $Environment->appendChild(new XMLElement('legend', __('Environment Settings'))); $Environment->appendChild(new XMLElement('p', __('Symphony is ready to be installed at the following location.'))); $class = NULL; if (defined('kENVIRONMENT_WARNING') && kENVIRONMENT_WARNING == true) { $class = 'warning'; } $Environment->appendChild(Widget::label(__('Root Path'), Widget::input('fields[docroot]', $fields['docroot']), $class)); if (defined('ERROR') && defined('kENVIRONMENT_WARNING')) { $Environment->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning'))); } $Form->appendChild($Environment); /** END ENVIRONMENT SETTINGS **/ /** * * START LOCALE SETTINGS * **/ $Environment = new XMLElement('fieldset'); $Environment->appendChild(new XMLElement('legend', __('Website Preferences'))); // $Environment->appendChild(new XMLElement('p', '.')); $Environment->appendChild(Widget::label(__('Name'), Widget::input('fields[general][sitename]', $fields['general']['sitename']))); $Fieldset = new XMLElement('fieldset'); $Fieldset->appendChild(new XMLElement('legend', __('Date and Time'))); $Fieldset->appendChild(new XMLElement('p', __('Customise how Date and Time values are displayed throughout the Administration interface.'))); $options = array(); $groups = array(); $system_tz = isset($fields['region']['timezone']) ? $fields['region']['timezone'] : date_default_timezone_get(); foreach (timezone_identifiers_list() as $tz) { if (preg_match('/\\//', $tz)) { $parts = preg_split('/\\//', $tz, 2, PREG_SPLIT_NO_EMPTY); $groups[$parts[0]][] = $parts[1]; } else { $groups[$tz] = $tz; } } foreach ($groups as $key => $val) { if (is_array($val)) { $tmp = array('label' => $key, 'options' => array()); foreach ($val as $zone) { $tmp['options'][] = array("{$key}/{$zone}", "{$key}/{$zone}" == $system_tz, str_replace('_', ' ', $zone)); } $options[] = $tmp; } else { $options[] = array($key, $key == $system_tz, str_replace('_', ' ', $key)); } } $Fieldset->appendChild(Widget::label(__('Region'), Widget::Select('fields[region][timezone]', $options))); //$Div->appendChild(Widget::label('Date Format', Widget::input('fields[general][sitename]', $fields['general']['sitename']))); //$Div->appendChild(Widget::label('Time Format', Widget::input('fields[general][sitename]', $fields['general']['sitename']))); $dateformat = $fields['region']['date_format']; $label = Widget::Label(__('Date Format')); $dateFormats = array(array('Y/m/d', $dateformat == 'Y/m/d', DateTimeObj::get('Y/m/d')), array('m/d/Y', $dateformat == 'm/d/Y', DateTimeObj::get('m/d/Y')), array('m/d/y', $dateformat == 'm/d/y', DateTimeObj::get('m/d/y')), array('d F Y', $dateformat == 'd F Y', DateTimeObj::get('d F Y'))); $label->appendChild(Widget::Select('fields[region][date_format]', $dateFormats)); $Fieldset->appendChild($label); $timeformat = $fields['region']['time_format']; $label = Widget::Label(__('Time Format')); //$label->setAttribute('title', __('Local') . (date('I') == 1 ? ' daylight savings' : '') . ' time for ' . date_default_timezone_get()); //if(date('I') == 1) $label->appendChild(new XMLElement('i', __('Daylight savings time'))); $timeformats = array(array('H:i:s', $timeformat == 'H:i:s', DateTimeObj::get('H:i:s')), array('H:i', $timeformat == 'H:i', DateTimeObj::get('H:i')), array('g:i:s a', $timeformat == 'g:i:s a', DateTimeObj::get('g:i:s a')), array('g:i a', $timeformat == 'g:i a', DateTimeObj::get('g:i a'))); $label->appendChild(Widget::Select('fields[region][time_format]', $timeformats)); $Fieldset->appendChild($label); $Environment->appendChild($Fieldset); $Form->appendChild($Environment); /** END LOCALE SETTINGS **/ /** * * START DATABASE SETTINGS * **/ $Database = new XMLElement('fieldset'); $Database->appendChild(new XMLElement('legend', __('Database Connection'))); $Database->appendChild(new XMLElement('p', __('Please provide Symphony with access to a database.'))); $class = NULL; if (defined('kDATABASE_VERSION_WARNING') && kDATABASE_VERSION_WARNING == true) { $class = ' warning'; } ## fields[database][name] $label = Widget::label(__('Database'), Widget::input('fields[database][name]', $fields['database']['name']), $class); $Database->appendChild($label); if (defined('ERROR') && defined('kDATABASE_VERSION_WARNING')) { $Database->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning'))); } $class = NULL; if (defined('kDATABASE_CONNECTION_WARNING') && kDATABASE_CONNECTION_WARNING == true) { $class = ' warning'; } $Div = new XMLElement('div'); $Div->setAttribute('class', 'group' . $class); ## fields[database][username] $Div->appendChild(Widget::label(__('Username'), Widget::input('fields[database][username]', $fields['database']['username']))); ## fields[database][password] $Div->appendChild(Widget::label(__('Password'), Widget::input('fields[database][password]', $fields['database']['password'], 'password'))); $Database->appendChild($Div); if (defined('ERROR') && defined('kDATABASE_CONNECTION_WARNING')) { $Database->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning'))); } $Fieldset = new XMLElement('fieldset'); $Fieldset->appendChild(new XMLElement('legend', __('Advanced Configuration'))); $Fieldset->appendChild(new XMLElement('p', __('Leave these fields unless you are sure they need to be changed.'))); $Div = new XMLElement('div'); $Div->setAttribute('class', 'group'); ## fields[database][host] $Div->appendChild(Widget::label(__('Host'), Widget::input('fields[database][host]', $fields['database']['host']))); ## fields[database][port] $Div->appendChild(Widget::label(__('Port'), Widget::input('fields[database][port]', $fields['database']['port']))); $Fieldset->appendChild($Div); $class = NULL; if (defined('kDATABASE_PREFIX_WARNING') && kDATABASE_PREFIX_WARNING == true) { $class = 'warning'; } ## fields[database][prefix] $Fieldset->appendChild(Widget::label(__('Table Prefix'), Widget::input('fields[database][prefix]', $fields['database']['prefix']), $class)); if (defined('ERROR') && defined('kDATABASE_PREFIX_WARNING')) { $Fieldset->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning'))); } $Page->setTemplateVar('TABLE-PREFIX', $fields['database']['prefix']); ## fields[database][high-compatibility] $Fieldset->appendChild(Widget::label(__('Use compatibility mode'), Widget::input('fields[database][high-compatibility]', 'yes', 'checkbox'), 'option')); $Fieldset->appendChild(new XMLElement('p', __('Symphony normally specifies UTF-8 character encoding for database entries. With compatibility mode enabled, Symphony will instead use the default character encoding of your database.'))); $Database->appendChild($Fieldset); $Form->appendChild($Database); /** END DATABASE SETTINGS **/ /** * * START PERMISSION SETTINGS * **/ $Permissions = new XMLElement('fieldset'); $Permissions->appendChild(new XMLElement('legend', __('Permission Settings'))); $Permissions->appendChild(new XMLElement('p', __('Symphony needs permission to read and write both files and directories.'))); $Div = new XMLElement('div'); $Div->setAttribute('class', 'group'); $Div->appendChild(Widget::label(__('Files'), Widget::input('fields[permission][file]', $fields['permission']['file']))); $Div->appendChild(Widget::label(__('Directories'), Widget::input('fields[permission][directory]', $fields['permission']['directory']))); $Permissions->appendChild($Div); $Form->appendChild($Permissions); /** END PERMISSION SETTINGS **/ /** * * START USER SETTINGS * **/ $User = new XMLElement('fieldset'); $User->appendChild(new XMLElement('legend', __('User Information'))); $User->appendChild(new XMLElement('p', __('Once installed, you will be able to login to the Symphony admin with these user details.'))); $class = NULL; if (defined('kUSER_USERNAME_WARNING') && kUSER_PASSWORD_WARNING == true) { $class = 'warning'; } ## fields[user][username] $User->appendChild(Widget::label(__('Username'), Widget::input('fields[user][username]', $fields['user']['username']), $class)); if (defined('ERROR') && defined('kUSER_USERNAME_WARNING')) { $User->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning'))); } $class = NULL; if (defined('kUSER_PASSWORD_WARNING') && kUSER_PASSWORD_WARNING == true) { $class = ' warning'; } $Div = new XMLElement('div'); $Div->setAttribute('class', 'group' . $class); ## fields[user][password] $Div->appendChild(Widget::label(__('Password'), Widget::input('fields[user][password]', $fields['user']['password'], 'password'))); ## fields[user][confirm-password] $Div->appendChild(Widget::label(__('Confirm Password'), Widget::input('fields[user][confirm-password]', $fields['user']['confirm-password'], 'password'))); $User->appendChild($Div); if (defined('ERROR') && defined('kUSER_PASSWORD_WARNING')) { $User->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning'))); } $Fieldset = new XMLElement('fieldset'); $Fieldset->appendChild(new XMLElement('legend', __('Personal Information'))); $Fieldset->appendChild(new XMLElement('p', __('Please add the following personal details for this user.'))); $class = NULL; if (defined('kUSER_NAME_WARNING') && kUSER_EMAIL_WARNING == true) { $class = ' warning'; } $Div = new XMLElement('div'); $Div->setAttribute('class', 'group' . $class); ## fields[database][host] $Div->appendChild(Widget::label(__('First Name'), Widget::input('fields[user][firstname]', $fields['user']['firstname']))); ## fields[database][port] $Div->appendChild(Widget::label(__('Last Name'), Widget::input('fields[user][lastname]', $fields['user']['lastname']))); $Fieldset->appendChild($Div); if (defined('ERROR') && defined('kUSER_NAME_WARNING')) { $Fieldset->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning'))); } $class = NULL; if (defined('kUSER_EMAIL_WARNING') && kUSER_EMAIL_WARNING == true) { $class = 'warning'; } ## fields[user][email] $Fieldset->appendChild(Widget::label(__('Email Address'), Widget::input('fields[user][email]', $fields['user']['email']), $class)); if (defined('ERROR') && defined('kUSER_EMAIL_WARNING')) { $Fieldset->appendChild(new XMLElement('p', $warnings[ERROR], array('class' => 'warning'))); } $User->appendChild($Fieldset); $Form->appendChild($User); /** END USER SETTINGS **/ /** * * START FORM SUBMIT AREA * **/ $Form->appendChild(new XMLElement('h2', __('Install Symphony'))); $Form->appendChild(new XMLElement('p', __('Make sure that you delete <code>' . kINSTALL_FILENAME . '</code> file after Symphony has installed successfully.'))); $Submit = new XMLElement('div'); $Submit->setAttribute('class', 'submit'); ### submit $Submit->appendChild(Widget::input('submit', __('Install Symphony'), 'submit')); ### action[install] $Submit->appendChild(Widget::input('action[install]', 'true', 'hidden')); $Form->appendChild($Submit); $Contents->appendChild($Form); /** END FORM SUBMIT AREA **/ $Page->setTemplateVar('title', __('Install Symphony')); $Page->setTemplateVar('tagline', __('Version %s', array(kVERSION))); $Page->setTemplateVar('languages', $languages); }
protected function appendCondition(Duplicator $duplicator, $condition = array()) { $document = $duplicator->ownerDocument; if (empty($condition)) { $item = $duplicator->createTemplate(__('Don\'t Execute When')); } else { $item = $duplicator->createInstance(__('Don\'t Execute When')); } if (!isset($condition['parameter'])) { $condition['parameter'] = null; } if (!isset($condition['logic'])) { $condition['logic'] = 'empty'; } $group = $document->createElement('div'); $group->setAttribute('class', 'group double'); // Parameter $label = $document->createElement('label', __('Parameter')); $label->appendChild(Widget::input('fields[conditions][parameter][]', $condition['parameter'])); $group->appendChild($label); // Logic $label = $document->createElement('label', __('Logic')); $label->appendChild(Widget::select('fields[conditions][logic][]', array(array('empty', $condition['logic'] == 'empty', __('is empty')), array('set', $condition['logic'] == 'set', __('is set'))), array('class' => 'filtered'))); $group->appendChild($label); $group->appendChild($label); $item->appendChild($group); }
function update(&$Page, &$Contents) { /* <form action="" method="post"> <h2>Update Symphony</h2> <p>Symphony is ready to update from version 1.6.2 to version 1.6.3.</p> <div class="submit"> <input name="action[update]" type="submit" value="Update Symphony" /> <input name="action[update]" type="hidden" value="true" /> </div> </form> */ $Form = new XMLElement('form'); $Form->setAttribute('action', 'install.php'); $Form->setAttribute('method', 'post'); $Form->addChild(new XMLElement('h2', 'Update Symphony')); $Form->addChild(new XMLElement('p', 'Symphony is ready to update from version ' . kCURRENT_VERSION . ' to version ' . kVERSION)); $Submit = new XMLElement('div'); $Submit->setAttribute('class', 'submit'); ### submit $Submit->addChild(Widget::input('submit', 'Update Symphony', NULL, 'submit')); ### action[update] $Submit->addChild(Widget::input('action[update' . kCURRENT_BUILD . ']', 'true', NULL, 'hidden')); $Form->addChild($Submit); $Contents->addChild($Form); $Page->setTemplateVar('title', 'Update Symphony'); $Page->setTemplateVar('tagline', 'Version ' . kVERSION); }