Пример #1
0
 function onSubmit($vals)
 {
     $file = $this->_file;
     $info = ini_parse($file);
     $code = $vals['code'];
     if (!empty($vals['locale'])) {
         $code .= '-' . $vals['locale'];
     }
     $info[$code] = array('name' => $vals['name'], 'code' => $vals['code'], 'locale' => $vals['locale'], 'charset' => $vals['charset'], 'fallback' => $vals['fallback'], 'default' => $vals['default']);
     $fp = fopen($file, 'w');
     if (!$fp) {
         echo 'Error: Failed to open languages.php file!';
         return;
     }
     fwrite($fp, ini_write($info));
     fclose($fp);
     /*header (
     			sprintf (
     				'Location: %s/index/appdoc-translation-strings-action?appname=%s&lang=%s&charset=%s',
     				site_prefix (),
     				$vals['appname'],
     				$code,
     				$vals['charset']
     			)
     		);*/
     header('Location: ' . site_prefix() . '/index/multilingual-languages-action');
     exit;
 }
Пример #2
0
 function onSubmit($vals)
 {
     unset($vals['submit_button']);
     loader_import('saf.File');
     file_overwrite('inc/app/sitewiki/conf/settings.php', ini_write($vals));
     echo '<p>Settings saved.  <a href="' . site_prefix() . '/index/sitewiki-app">Continue</a></p>';
 }
Пример #3
0
 function onSubmit($vals)
 {
     loader_import('saf.File');
     loader_import('saf.File.Directory');
     loader_import('saf.Misc.Ini');
     $info = help_get_langs($vals['appname']);
     $info[$vals['lang_code']] = $vals['lang_name'];
     if (!@mkdir(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang_code'], 0777)) {
         echo '<p>Error: Unable to create language folder.  Please verify your folder permissions.</p>';
         return;
     }
     if (!file_overwrite(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/languages.php', ini_write($info))) {
         echo '<p>Error: Unable to write to the file.  Please verify your folder permissions.</p>';
         return;
     }
     if (!empty($vals['copy_from'])) {
         // copy help files from specified lang to new dir
         $pages = help_get_pages($vals['appname'], $vals['lang']);
         foreach ($pages as $page) {
             $id = help_get_id($page);
             $res = copy(site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang'] . '/' . $id . '.html', site_docroot() . '/inc/app/' . $vals['appname'] . '/docs/' . $vals['lang_code'] . '/' . $id . '.html');
             if (!$res) {
                 echo '<p>Error: Unable to duplicate help files.  Please verify your folder permissions.</p>';
                 return;
             }
         }
     }
     // go to new language
     header('Location: ' . site_prefix() . '/index/appdoc-helpdoc-action?appname=' . $vals['appname'] . '&lang=' . $vals['lang_code']);
     exit;
 }
Пример #4
0
 function onSubmit($vals)
 {
     $set = $vals['set'];
     unset($vals['set']);
     file_overwrite('inc/html/' . $set . '/modes.php', $vals['modes']);
     unset($vals['submit_button']);
     unset($vals['modes']);
     $r = ini_write($vals);
     file_overwrite('inc/html/' . $set . '/config.ini.php', $r);
     header('Location: ' . site_prefix() . '/index/sitetemplate-templateselect-action?set_name=' . $set);
     exit;
 }
Пример #5
0
 function onSubmit($vals)
 {
     // overwrite file
     $cache = array('Cache' => array(), 'Cacheable' => array());
     $cacheable = $vals['cacheable'];
     unset($vals['cacheable']);
     unset($vals['submit_button']);
     foreach ($vals as $k => $v) {
         $cache['Cache'][$k] = $v;
     }
     $cacheable = ini_parse($cacheable, false);
     foreach ($this->ignore as $i) {
         $cacheable[$i] = false;
     }
     $cache['Cacheable'] = $cacheable;
     loader_import('saf.File');
     if (!file_overwrite('inc/conf/cache.php', ini_write($cache))) {
         die('Error writing to file: inc/conf/cache.php');
     }
     echo '<p>' . intl_get('Cache settings saved.') . '  <a href="' . site_prefix() . '/index/cms-cpanel-action">' . intl_get('Continue') . '</a></p>';
 }
Пример #6
0
 function onSubmit($vals)
 {
     unset($vals['Database']);
     unset($vals['Site']);
     unset($vals['Server']);
     unset($vals['I18n']);
     unset($vals['Messaging']);
     unset($vals['submit_button']);
     $config = array();
     foreach ($vals as $k => $v) {
         list($cname, $key) = explode('_', $k, 2);
         if (!isset($config[$cname])) {
             $config[$cname] = array($key => $v);
         } else {
             $config[$cname][$key] = $v;
         }
     }
     loader_import('saf.File');
     if (!file_overwrite('inc/conf/config.ini.php', ini_write($config))) {
         die('Error writing to file: inc/conf/config.ini.php');
     }
     echo '<p>' . intl_get('Site settings saved.') . '  <a href="' . site_prefix() . '/index/cms-cpanel-action">' . intl_get('Continue') . '</a></p>';
 }
Пример #7
0
function ini_change($filename, $data)
{
    $ini = ini_read($filename);
    return ini_write($filename, array_merge($ini, $data));
}
Пример #8
0
}
if (!@is_dir($read)) {
    die('No app folder found.');
}
if (!@is_dir($langs)) {
    $r = mkdir($langs, 0777);
    if (!$r) {
        die('No lang folder found.  Attempt to create failed.');
    }
}
if (!@is_writeable($langs)) {
    die('Cannot write to langs folder.  Please change your filesystem permissions.');
}
if (!@file_exists($list)) {
    loader_import('saf.File');
    $r = file_overwrite($list, ini_write(array()));
    if (!$r) {
        die('No lang/languages.php file found.  Attempt to create failed.');
    }
}
if (!@file_exists($write)) {
    $info = pathinfo($write);
    if (!@is_writeable($info['dirname'])) {
        die('Cannot write to lang folder.  Please change your filesystem permissions.');
    }
} else {
    if (!@is_writeable($write)) {
        die('Cannot write to lang/en.php file.  Please change your filesystem permissions.');
    }
}
$fullname = $info['app_name'];
Пример #9
0
<?php

exit;
global $cgi;
if ($cgi->appname == 'GLOBAL') {
    $file = 'inc/lang/languages.php';
    $path = 'inc/lang';
} else {
    $file = 'inc/app/' . $cgi->appname . '/lang/languages.php';
    $path = 'inc/app/' . $cgi->appname . '/lang';
}
$info = ini_parse($file);
foreach ($cgi->_key as $k) {
    unset($info[$k]);
}
$fp = fopen($file, 'w');
if (!$fp) {
    page_title('An Error Occurred');
    echo 'Error: Failed to open languages.php file!';
    return;
}
fwrite($fp, ini_write($info));
fclose($fp);
foreach ($cgi->_key as $k) {
    if (@file_exists($path . '/' . $k . '.php')) {
        unlink($path . '/' . $k . '.php');
    }
}
header('Location: ' . site_prefix() . '/index/appdoc-translation-action?appname=' . $cgi->appname);
exit;
Пример #10
0
 function WriteIni($filename, $data)
 {
     ini_write($filename, $data);
     return true;
 }
Пример #11
0
<?php

$info = parse_ini_file('inc/conf/auth/applications/index.php');
if (!empty($parameters['appname']) && isset($info[$parameters['appname']]) && $info[$parameters['appname']] != 'core') {
    $info[$parameters['appname']] = true;
    loader_import('saf.File');
    loader_import('saf.Misc.Ini');
    file_overwrite('inc/conf/auth/applications/index.php', ini_write($info));
}
header('Location: ' . site_prefix() . '/index/usradm-applications-action');
exit;
Пример #12
0
 /**
  * Deletes an item from $data and rewrites the INI file.
  *
  * @param string
  * @return boolean
  */
 function delete($name)
 {
     unset($this->data[$name]);
     $r = file_overwrite($this->file, ini_write($this->data));
     if (!$r) {
         $this->error = 'Failed to write INI file!';
     }
     return $r;
 }
Пример #13
0
        $val = false;
    }
    $w =& $form->createWidget($k, $v);
    if ($val) {
        $w->setValue($val);
    }
}
$sub =& $form->addWidget('msubmit', 'submit_button');
$b1 =& $sub->getButton();
$b1->setValues(intl_get('Save'));
$b2 =& $sub->addbutton('submit_button', intl_get('Cancel'));
$b2->extra = 'onclick="window.location.href = \'' . site_prefix() . '/index/usradm-applications-action\'; return false"';
if ($form->invalid($cgi)) {
    $form->setValues($cgi);
    echo $form->show();
} else {
    $vals = $form->getValues();
    foreach ($vals as $k => $v) {
        if ($k == 'appname' || $k == 'submit_button') {
            continue;
        }
        if (isset($v)) {
            $settings[$k]['value'] = $v;
        }
    }
    loader_import('saf.File');
    if (!file_overwrite(getcwd() . '/inc/app/' . $parameters['appname'] . '/conf/settings.ini.php', ini_write($settings))) {
        die('Error writing to file: inc/app/' . $parameters['appname'] . '/conf/settings.ini.php');
    }
    echo '<p>' . intl_get('Application settings saved.') . ' <a href="' . site_prefix() . '/index/usradm-applications-action">' . intl_get('Continue') . '</a></p>';
}
Пример #14
0
<?php

loader_import('saf.MailForm');
loader_import('saf.File.Directory');
loader_import('saf.HTML.CSS_Parser');
global $cgi;
if ($cgi->tag == 'xt:box') {
    $attrs = array((object) array('name' => 'name', 'typedef' => "type=text\nalt=Name"), (object) array('name' => 'title', 'typedef' => 'type=hidden'), (object) array('name' => 'style', 'typedef' => 'type=hidden'));
    // parse box settings for custom attributes
    list($app, $name) = explode('/', $cgi->name, 2);
    $settings = loader_box_get_settings($name, $app);
    foreach ($settings as $k => $v) {
        if ($k == 'Meta') {
            continue;
        }
        $attrs[] = (object) array('name' => $k, 'typedef' => ini_write($v));
    }
    //info ($settings);
} else {
    $attrs = db_fetch_array('select * from xed_attributes where element = ? order by id asc', $cgi->tag);
    $defaults = db_fetch_array('select * from xed_attributes where element = ? order by id asc', 'default');
    $attrs = array_merge($attrs, $defaults);
}
$css = new CSS_Parser();
$classes = array();
$ids = array();
foreach (Dir::find('*.css', 'inc/html/' . conf('Server', 'default_template_set')) as $file) {
    $css->parse(@join('', @file($file)));
    $classes = array_merge($classes, $css->getClasses($cgi->tag));
    $ids = array_merge($ids, $css->getIDs($cgi->tag));
}
Пример #15
0
    $apps[$apps[$k]] = Workflow::getServices($k);
    unset($apps[$k]);
}
if (empty($cgi->submit_button)) {
    echo template_simple('workflow.spt', $apps);
} else {
    $services = array();
    foreach ($apps as $app) {
        foreach ($app as $service) {
            if ($parameters[$service['name']]) {
                foreach ($service['actions'] as $action) {
                    if (!is_array($services[$action])) {
                        $services[$action] = array();
                    }
                    $services[$action]['service:' . $service['name']] = array('name' => $service['title'], 'handler' => $service['handler']);
                }
            }
        }
    }
    loader_import('saf.File');
    loader_import('saf.File.Directory');
    foreach ($services as $action => $servs) {
        file_overwrite('inc/app/cms/conf/services/' . $action . '.php', ini_write($servs));
    }
    foreach (Dir::find('*.php', 'inc/app/cms/conf/services') as $file) {
        if (!isset($services[str_replace('.php', '', basename($file))])) {
            file_overwrite($file, ini_write(array()));
        }
    }
    echo '<p>' . intl_get('Workflow settings saved.') . '  <a href="' . site_prefix() . '/index/cms-cpanel-action">' . intl_get('Continue') . '</a></p>';
}