Exemplo n.º 1
0
/**
 * updates the site status
 * @param string $state
 */
function setSiteState($state)
{
    global $_configMutex;
    $_configMutex->lock();
    $zp_cfg = @file_get_contents(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE);
    $zp_cfg = updateConfigItem('site_upgrade_state', $state, $zp_cfg);
    storeConfig($zp_cfg);
    $_configMutex->unlock();
}
Exemplo n.º 2
0
/**
 * updates the site status
 * @param string $state
 */
function setSiteState($state, $folder = NULL)
{
    if (is_null($folder)) {
        $folder = SERVERPATH . '/';
    }
    $_configMutex = new zpMutex('cF', NULL, $folder);
    $_configMutex->lock();
    $zp_cfg = @file_get_contents($folder . DATA_FOLDER . '/' . CONFIGFILE);
    $zp_cfg = updateConfigItem('site_upgrade_state', $state, $zp_cfg);
    storeConfig($zp_cfg, $folder);
    $_configMutex->unlock();
}
Exemplo n.º 3
0
     } else {
         $notify = '?post_error';
     }
 }
 /*		 * * Security Options ** */
 if (isset($_POST['savesecurityoptions'])) {
     $protocol = sanitize($_POST['server_protocol'], 3);
     if ($protocol != SERVER_PROTOCOL) {
         // force https if required to be sure it works, otherwise the "save" will be the last thing we do
         httpsRedirect();
     }
     if (getOption('server_protocol') != $protocol) {
         setOption('server_protocol', $protocol);
         $_configMutex->lock();
         $zp_cfg = @file_get_contents(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE);
         $zp_cfg = updateConfigItem('server_protocol', $protocol, $zp_cfg);
         storeConfig($zp_cfg);
         $_configMutex->unlock();
     }
     $_zp_gallery->setUserLogonField(isset($_POST['login_user_field']));
     if ($protocol == 'http') {
         zp_clearCookie("zenphoto_ssl");
     }
     setOption('IP_tied_cookies', (int) isset($_POST['IP_tied_cookies']));
     setOption('obfuscate_cache', (int) isset($_POST['obfuscate_cache']));
     setOption('image_processor_flooding_protection', (int) isset($_POST['image_processor_flooding_protection']));
     $_zp_gallery->save();
     $returntab = "&tab=security";
 }
 /*		 * * custom options ** */
 if (!$themeswitch) {
Exemplo n.º 4
0
            if (empty($_POST) && empty($_GET) && ($confDB === 'MySQL' || $preferred != 'MySQL')) {
                $confDB = NULL;
            }
            if (extension_loaded(strtolower($confDB)) && file_exists(dirname(dirname(__FILE__)) . '/functions-db-' . $confDB . '.php')) {
                $selected_database = $_zp_conf_vars['db_software'];
            } else {
                $selected_database = $preferred;
                if ($preferred) {
                    $_zp_conf_vars['db_software'] = $preferred;
                    $zp_cfg = updateConfigItem('db_software', $preferred, $zp_cfg);
                    $updatezp_config = true;
                }
            }
        } else {
            $_zp_conf_vars['db_software'] = $selected_database = $preferred;
            $zp_cfg = updateConfigItem('db_software', $zp_cfg, $preferred);
            $updatezp_config = true;
            $confDB = NULL;
        }
        if ($selected_database) {
            require_once dirname(dirname(__FILE__)) . '/functions-db-' . $selected_database . '.php';
        } else {
            require_once dirname(dirname(__FILE__)) . '/functions-db_NULL.php';
        }
    } else {
        // There is a problem with the configuration file
        ?>
		<div style="background-color: red;font-size: xx-large;">
			<p>
				<?php 
        echo gettext('A corrupt configuration file was detected. You should remove or repair the file and re-run setup.');
Exemplo n.º 5
0
         }
         break;
 }
 $msg2 = '<p>' . sprintf(gettext('If your server filesystem character set is different from <code>%s</code> and you create album or image filenames names containing characters with diacritical marks you may have problems with these objects.'), $charset_defined) . '</p>' . '<form action="#"><input type="hidden" name="xsrfToken" value="' . setupXSRFToken() . '" /><input type="hidden" name="charset_attempts" value="' . $tries . '" /><p>' . gettext('Change the filesystem character set define to %1$s') . '</p></form><br class="clearall" />';
 if (isset($_zp_conf_vars['FILESYSTEM_CHARSET'])) {
     $selectedset = $_zp_conf_vars['FILESYSTEM_CHARSET'];
 } else {
     $selectedset = 'unknown';
 }
 $msg = '';
 if ($test) {
     //	fount the test file
     if (file_exists(internalToFilesystem($test_internal))) {
         //	and the active character set define worked
         if (!isset($_zp_conf_vars['FILESYSTEM_CHARSET'])) {
             $zp_cfg = updateConfigItem('FILESYSTEM_CHARSET', FILESYSTEM_CHARSET, $zp_cfg);
             storeConfig($zp_cfg);
         }
         $notice = 1;
         $msg = sprintf(gettext('The filesystem character define is %1$s [confirmed]'), $charset_defined);
         $msg1 = '';
     } else {
         if ($selectedset == 'unknown') {
             $notice = 1;
             $msg = gettext('The filesystem character define is UTF-8 [assumed]');
             $msg1 = '';
         } else {
             //	active character set is not correct
             $notice = 0;
             $msg1 = sprintf(gettext('The filesystem character define is %1$s [which seems wrong]'), $charset_defined);
         }
Exemplo n.º 6
0
 }
 foreach (array(internalToFilesystem('charset_tést'), internalToFilesystem('charset.tést')) as $charset) {
     if (file_exists(SERVERPATH . '/' . DATA_FOLDER . '/' . $charset)) {
         $targets[DATA_FOLDER . '/' . $charset] = 'file';
     }
 }
 if (!is_dir($folder . DATA_FOLDER)) {
     @mkdir($folder . DATA_FOLDER);
 }
 if (!is_dir($folder . THEMEFOLDER)) {
     @mkdir($folder . THEMEFOLDER);
 }
 if (!file_exists($folder . '/' . DATA_FOLDER . '/' . CONFIGFILE)) {
     $path = str_replace(array(' ', '/'), '_', trim(str_replace(str_replace(WEBPATH, '/', SERVERPATH), '', $folder), '/')) . '_';
     $zp_cfg = file_get_contents(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE);
     $zp_cfg = updateConfigItem('mysql_prefix', $path, $zp_cfg);
     file_put_contents($folder . '/' . DATA_FOLDER . '/' . CONFIGFILE, $zp_cfg);
 }
 foreach ($targets as $target => $type) {
     if (file_exists($folder . $target)) {
         $link = str_replace('\\', '/', @readlink($folder . $target));
         switch ($type) {
             case 'dir':
                 if (empty($link) || $link == $folder . $target) {
                     // an actual folder
                     if (zpFunctions::removeDir($folder . $target)) {
                         if (SYMLINK && @symlink(SERVERPATH . '/' . $target, $folder . $target)) {
                             $msg[] = sprintf(gettext('The existing folder <code>%s</code> was replaced.'), $folder . filesystemToInternal($target)) . "<br />\n";
                         } else {
                             $msg[] = sprintf(gettext('The existing folder <code>%1$s</code> was removed but Link creation failed.'), $target) . "<br />\n";
                             $success = false;
Exemplo n.º 7
0
        updateConfigItem('db_software', setup_sanitize($_POST['db_software']));
    }
    if (isset($_POST['db_user'])) {
        updateConfigItem('mysql_user', setup_sanitize($_POST['db_user']));
    }
    if (isset($_POST['db_pass'])) {
        updateConfigItem('mysql_pass', setup_sanitize($_POST['db_pass']));
    }
    if (isset($_POST['db_host'])) {
        updateConfigItem('mysql_host', setup_sanitize($_POST['db_host']));
    }
    if (isset($_POST['db_database'])) {
        updateConfigItem('mysql_database', setup_sanitize($_POST['db_database']));
    }
    if (isset($_POST['db_prefix'])) {
        updateConfigItem('mysql_prefix', setup_sanitize($_POST['db_prefix']));
    }
}
$permissions = array(0750, 0755, 0775, 0777);
// NOTE: also $permission_names array below
if ($updatechmod = isset($_REQUEST['chmod_permissions'])) {
    setupXSRFDefender();
    $selected = round($_REQUEST['chmod_permissions']);
    if ($selected >= 0 && $selected < count($permissions)) {
        $chmod = $permissions[$selected];
    } else {
        $updatechmod = false;
    }
}
if ($updatechmod || $newconfig) {
    if ($updatechmod || isset($_zp_conf_vars['CHMOD'])) {