Exemplo n.º 1
0
function toggleSafeMode($enable = true)
{
    global $SAFEMODE, $dataw;
    $SAFEMODE = $enable;
    backup_datafile(GSDATAOTHERPATH . GSWEBSITEFILE);
    if (!$dataw) {
        if (file_exists(GSDATAOTHERPATH . GSWEBSITEFILE)) {
            $dataw = getXML(GSDATAOTHERPATH . GSWEBSITEFILE, false);
        } else {
            return false;
        }
    }
    $dataw->editAddChild('SAFEMODE', $enable ? 1 : 0);
    return XMLSave($dataw, GSDATAOTHERPATH . GSWEBSITEFILE);
}
Exemplo n.º 2
0
 }
 // create new xml
 $xml = new SimpleXMLElement('<item></item>');
 $xml->addChild('USR', $userid);
 $xml->addChild('NAME', $name);
 $xml->addChild('PWD', $password);
 $xml->addChild('EMAIL', $email);
 $xml->addChild('HTMLEDITOR', $htmleditor);
 $xml->addChild('TIMEZONE', $timezone);
 $xml->addChild('LANG', $lang);
 $data = $xml;
 if (!empty($error) || empty($password)) {
     break;
 }
 # create user xml file
 backup_datafile(GSUSERSPATH . $file);
 // remove pass word reset
 $resetfile = GSUSERSPATH . getPWDresetName(_id($userid), 'xml');
 if (file_exists($resetfile)) {
     delete_file($resetfile);
 }
 exec_action('settings-user');
 // @hook settings-user LEGACY pre-save of a users settings
 exec_action('profile-save');
 // @hook profiel-user pre-save of a users settings
 if (!XMLsave($xml, GSUSERSPATH . $file)) {
     $error = i18n_r('CHMOD_ERROR');
     break;
 }
 # see new language file immediately
 if (!empty($lang)) {
Exemplo n.º 3
0
/**
 * @deprecated 3.4 LEGACY
 */
function createBak($file, $filepath, $bakpath)
{
    return backup_datafile($filepath . $file);
}
Exemplo n.º 4
0
 }
 if (isset($_POST['timezone'])) {
     $SITETIMEZONE = var_in($_POST['timezone']);
 }
 if (isset($_POST['lang'])) {
     $SITELANG = var_in($_POST['lang']);
 }
 if (isset($_POST['about'])) {
     $SITEABOUT = var_in($_POST['about']);
 }
 // check valid lang files
 if (!in_array($LANG . '.php', $lang_array) and !in_array($LANG . '.PHP', $lang_array)) {
     die;
 }
 # create website xml file
 backup_datafile(GSDATAOTHERPATH . GSWEBSITEFILE);
 // new xml
 $xmls = new SimpleXMLExtended('<item></item>');
 $note = $xmls->addChild('SITENAME');
 $note->addCData($SITENAME);
 $note = $xmls->addChild('SITEURL');
 $note->addCData($SITEURLNEW);
 $note = $xmls->addChild('TEMPLATE');
 $note->addCData($TEMPLATE);
 $xmls->addChild('PRETTYURLS', $PRETTYURLS);
 $xmls->addChild('PERMALINK', $PERMALINK);
 $xmls->addChild('EMAIL', $SITEEMAIL);
 $xmls->addChild('TIMEZONE', $SITETIMEZONE);
 $xmls->addChild('LANG', $SITELANG);
 $xmls->addChild('SITEUSR', $SITEUSR);
 $xmls->addChild('SITEABOUT', $SITEABOUT);
Exemplo n.º 5
0
 * @package GetSimple
 * @subpackage Components
 * @link http://get-simple.info/docs/what-are-components
 */
# setup inclusions
$load['plugin'] = true;
include 'inc/common.php';
login_cookie_check();
exec_action('load-components');
# variable settings
$update = $table = $list = '';
# check to see if form was submitted
if (isset($_POST['submitted'])) {
    check_for_csrf("modify_components");
    # create backup file for undo
    backup_datafile(GSDATAOTHERPATH . GSCOMPONENTSFILE);
    # start creation of top of components.xml file
    if (count($_POST['component']) != 0) {
        $status = $error = null;
        $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
        foreach ($_POST['component'] as $component) {
            $id = $component['id'];
            // unused
            $slug = $component['slug'];
            $value = $component['val'];
            $title = $component['title'];
            $active = isset($component['active']) ? 0 : 1;
            // checkbox
            // add corrupt data protection, prevent deleting components if something critical is missing
            if (empty($slug)) {
                $error = 'an error occured, missing slug';
Exemplo n.º 6
0
 * @package GetSimple
 * @subpackage Snippets
 * @link http://get-simple.info/docs/what-are-snippets
 */
# setup inclusions
$load['plugin'] = true;
include 'inc/common.php';
login_cookie_check();
exec_action('load-snippets');
# variable settings
$update = $table = $list = '';
# check to see if form was submitted
if (isset($_POST['submitted'])) {
    check_for_csrf("modify_snippets");
    # create backup file for undo
    backup_datafile(GSDATAOTHERPATH . GSSNIPPETSFILE);
    # start creation of top of components.xml file
    if (count($_POST['component']) != 0) {
        $xml = new SimpleXMLExtended('<?xml version="1.0" encoding="UTF-8"?><channel></channel>');
        foreach ($_POST['component'] as $component) {
            $id = $component['id'];
            // unused
            $slug = $component['slug'];
            $value = $component['val'];
            $title = $component['title'];
            $active = isset($component['active']) ? 0 : 1;
            // checkbox
            $componentXML = addComponentItem($xml, $title, $value, $active, $slug);
        }
        exec_action('snippet-save');
        // @hook component-save before saving components data file
Exemplo n.º 7
0
    if (isset($_POST['pass'])) {
        log_user($config['login'], $_POST['pass']);
    }
}
// logme with the bookmarklet form
$admin = is_ok();
if (isset($_POST['exit'])) {
    inlog('User disconnected');
    log_user("", "");
}
# config change
######################################################################
if ($admin && isset($_POST['app_name'])) {
    inlog('Configuration changed');
    if ($config['data_file'] != $_POST['data_file'] && !is_file($_POST['data_file'])) {
        backup_datafile();
        rename($config['data_file'], $_POST['data_file']);
    }
    // rename if .dat filename has changed
    if ($config['log_filename'] != $_POST['log_filename'] && !is_file($_POST['log_filename'])) {
        rename($config['log_filename'], $_POST['log_filename']);
        file_put_contents('.htaccess', "<Files " . $_POST['log_filename'] . ">\n\tOrder deny,allow\n\tDeny from all\n</Files>");
    }
    // renaming log file
    foreach ($_POST as $key => $value) {
        // change 'true' by true & secure
        if ($key == 'login' || $key == 'password') {
            continue;
        }
        if ($value == 'true') {
            $config[$key] = true;