Пример #1
0
 function onSubmit($vals)
 {
     if ($vals['below_page'] == $vals['id']) {
         $this->invalid_field = 'below_page';
         $this->invalid['below_page'] = intl_getf('You cannot set this page to be a child of itself.');
         return $this->show();
     }
     loader_box('sitellite/nav/init');
     if (menu_is_child_of($vals['below_page'], $vals['id'])) {
         $this->invalid_field = 'below_page';
         $this->invalid['below_page'] = intl_getf('You cannot set this page to be a child of one of its own child pages.');
         return $this->show();
     }
     loader_import('cms.Versioning.Rex');
     $collection = $vals['_collection'];
     unset($vals['_collection']);
     if (empty($collection)) {
         $collection = 'sitellite_page';
     }
     $rex = new Rex($collection);
     // default: database, database
     unset($vals['submit_button']);
     unset($vals['tab1']);
     unset($vals['tab2']);
     unset($vals['tab3']);
     unset($vals['tab-end']);
     unset($vals['section1']);
     unset($vals['section3']);
     $key = $vals['_key'];
     unset($vals['_key']);
     $return = $vals['_return'];
     unset($vals['_return']);
     $changelog = $vals['changelog'];
     unset($vals['changelog']);
     $method = $rex->determineAction($key, $vals['sitellite_status']);
     if (!$method) {
         die($rex->error);
     }
     $res = $rex->{$method}($key, $vals, $changelog);
     // remove lock when editing is finished
     lock_remove($collection, $key);
     if ($key != $vals[$rex->key]) {
         if ($return == site_prefix() . '/index/' . $key || $return == site_prefix() . '/' . $key) {
             $return = '';
         }
     }
     if (!$res) {
         if (empty($return)) {
             $return = site_prefix() . '/index/' . $key;
         }
         echo loader_box('cms/error', array('message' => $rex->error, 'collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'return' => $return));
     } else {
         foreach (db_shift_array('select id from sitellite_page where below_page = ?', $key) as $child) {
             $method = $rex->determineAction($key);
             if (!$method) {
                 die($rex->error);
             }
             $rex->{$method}($child, array('below_page' => $vals['id']), 'Updating renamed parent reference');
         }
         loader_import('cms.Workflow');
         echo Workflow::trigger('edit', array('collection' => $collection, 'key' => $key, 'action' => $method, 'data' => $vals, 'changelog' => $changelog, 'message' => 'Collection: ' . $collection . ', Item: ' . $key));
         session_set('sitellite_alert', intl_get('Your item has been saved.'));
         if ($key != $vals[$rex->key]) {
             if ($return == site_prefix() . '/index/' . $key || $return == site_prefix() . '/' . $key) {
                 $return = '';
             }
         }
         if (!empty($return)) {
             header('Location: ' . $return);
             exit;
         }
         header('Location: ' . site_prefix() . '/index/' . $vals[$rex->key]);
         exit;
     }
 }
Пример #2
0
<?php

$info = ini_parse(getcwd() . '/inc/app/' . $parameters['appname'] . '/conf/config.ini.php', false);
if (isset($info['app_name'])) {
    $name = $info['app_name'];
} else {
    $name = ucfirst($file);
}
page_title(intl_get('Application Settings') . ' - ' . $name);
if (!is_writeable(getcwd() . '/inc/app/' . $parameters['appname'] . '/conf/settings.ini.php')) {
    echo '<p class="invalid">' . intl_getf('Warning: The settings file is not writeable. Please verify that the file %s is writeable by the web server user.', 'inc/app/' . $parameters['appname'] . '/conf/settings.ini.php') . '</p>';
    return;
}
global $intl;
$old_intl_path = $intl->directory;
$intl->directory = 'inc/app/' . $parameters['appname'] . '/lang';
$intl->getIndex();
$intl->directory = $old_intl_path;
$settings = ini_parse(getcwd() . '/inc/app/' . $parameters['appname'] . '/conf/settings.ini.php', true);
global $cgi;
loader_import('saf.MailForm');
$form = new MailForm();
$w =& $form->addWidget('hidden', 'appname');
$w->setValue($parameters['appname']);
foreach ($settings as $k => $v) {
    if (!isset($v['type'])) {
        $v['type'] = 'text';
    }
    if (isset($v['value'])) {
        $val = $v['value'];
        unset($v['value']);