Exemplo n.º 1
0
 function __construct($pagename)
 {
     set_error_handler("debug_handler");
     if (ini_get("magic_quotes_gpc") !== false and get_magic_quotes_gpc()) {
         modify::stripslashes($_REQUEST);
     }
     if (ini_get("register_globals")) {
         modify::dropglobals();
     }
     @ignore_user_abort(0);
     self::$time_start = sys_get_microtime();
     if (!sql_connect(SETUP_DB_HOST, SETUP_DB_USER, sys_decrypt(SETUP_DB_PW, sha1(SETUP_ADMIN_USER)), SETUP_DB_NAME)) {
         $err = sprintf("{t}Cannot connect to database %s on %s.{/t}\n", SETUP_DB_NAME, SETUP_DB_HOST) . sql_error();
         trigger_error($err, E_USER_ERROR);
         sys_die($err);
     }
     session_set_cookie_params(2592000);
     // 1 month
     session_name(SESSION_NAME);
     session_set_save_handler("_login_session_none", "_login_session_none", "_login_session_read", "_login_session_none", "_login_session_destroy", "_login_session_none");
     session_start();
     header("Cache-Control: private, max-age=1, must-revalidate");
     header("Pragma: private");
     $this->template = new template();
     $this->pagename = $pagename;
     class_exists("modify");
     // load class
 }
Exemplo n.º 2
0
    date_default_timezone_set(@date_default_timezone_get());
}
require "core/functions.php";
require "lib/smarty/Smarty.class.php";
$databases = setup::validate_system();
$old_file = "simple_store/config_old.php";
if (file_exists($old_file) and filemtime($old_file) > time() - 86400) {
    $_REQUEST["auto_update"] = true;
    $_REQUEST["accept_gpl"] = "yes";
    $_REQUEST["admin_user"] = setup_update::get_config_old("SETUP_ADMIN_USER");
    $_REQUEST["admin_pw"] = setup_update::get_config_old("SETUP_ADMIN_PW");
    $_REQUEST["db_type"] = setup_update::get_config_old("SETUP_DB_TYPE");
    $_REQUEST["db_host"] = setup_update::get_config_old("SETUP_DB_HOST");
    $_REQUEST["db_name"] = setup_update::get_config_old("SETUP_DB_NAME");
    $_REQUEST["db_user"] = setup_update::get_config_old("SETUP_DB_USER");
    $_REQUEST["db_pw"] = sys_decrypt(setup_update::get_config_old("SETUP_DB_PW"), sha1(setup_update::get_config_old("SETUP_ADMIN_USER")));
}
define("USE_DEBIAN_BINARIES", setup_update::get_config_old("USE_DEBIAN_BINARIES", false, 0));
define("SMTP_REMINDER", setup_update::get_config_old("SMTP_REMINDER", false, ""));
if (empty($_SERVER["SERVER_ADDR"])) {
    $_SERVER["SERVER_ADDR"] = "127.0.0.1";
}
// TODO change
// setup::build_customizing(SIMPLE_CUSTOM."customize.php");
setup::dirs_create_default_folders();
if (isset($_REQUEST["install"]) and isset($_REQUEST["accept_gpl"]) and $_REQUEST["accept_gpl"] == "yes") {
    install();
} else {
    if (!empty($_REQUEST["lang"])) {
        setup::show_form($databases, !empty($_REQUEST["install"]), !empty($_REQUEST["accept_gpl"]));
    } else {
Exemplo n.º 3
0
    static function show_form()
    {
        echo '
	<form action="sysconfig.php" method="post">
	<input type="hidden" value="' . modify::get_form_token() . '" name="token">
	<table class="data">
  ';
        foreach (self::$inputs as $key => $input) {
            if ($input == "---") {
                echo '
		<tr>
		<td><div style="border-top:1px solid #cccccc; width:100%; margin:10px 0px;"></div></td>
		<td><div style="border-top:1px solid #cccccc; width:450px; margin:10px 0px;"></div></td>
		</tr>
	  ';
                continue;
            }
            echo '
	  <tr>
		<td>' . $input[0] . ' ' . (isset($input[1]) ? '<a href="#" onclick="alert(\'' . str_replace("\n", "\\n", $input[1]) . '\'); return false;">?</a>' : '') . '</td>
		<td>
	';
            if ($key == "setup_db_pw") {
                echo '<input type="password" size="60" maxlength="255" id="' . $key . '" name="' . $key . '" value="' . self::quote(sys_decrypt(SETUP_DB_PW, sha1(SETUP_ADMIN_USER))) . '"><br/>';
                echo '<input id="' . $key . '_check" type="checkbox" onclick="document.getElementById(\'' . $key . '\').type = this.checked ? \'text\':\'password\';"><label for="' . $key . '_check">{t}Show password{/t}</label>';
            } else {
                if ($key == "setup_admin_pw" or $key == "setup_admin_pw2") {
                    echo '<input type="password" size="60" maxlength="255" id="' . $key . '" name="' . $key . '" value=""><br/>';
                    echo '<input id="' . $key . '_check" type="checkbox" onclick="document.getElementById(\'' . $key . '\').type = this.checked ? \'text\':\'password\';"><label for="' . $key . '_check">{t}Show password{/t}</label>';
                } else {
                    echo '<input type="text" size="60" maxlength="255" name="' . $key . '" value="' . self::quote(constant(strtoupper($key))) . '">';
                }
            }
            echo '
		</td>
	  </tr>
	';
        }
        echo '
	<tr>
	  <td>{t}Database{/t}</td>
	  <td>' . self::quote(SETUP_DB_TYPE) . '</td>
	</tr>
	<tr>
	  <td><div style="border-top:1px solid #cccccc; width:100%; margin:10px 0px;"></div></td>
	  <td><div style="border-top:1px solid #cccccc; width:450px; margin:10px 0px;"></div></td>
	</tr>
	<tr>
	  <td nowrap valign="top">{t}Authentication Mode{/t}</td>
	  <td>
		<table class="data" style="background-color: #FFFFFF; border: 0px; margin: 0px;">
  ';
        foreach (self::$auths as $key => $auth) {
            echo '
	<tr>
	<td><input type="Radio" class="radio" name="setup_auth" value="' . $key . '" ' . (SETUP_AUTH == $key ? "checked" : "") . '></td>
	';
            if (!$auth[1]) {
                echo '<td colspan="2">' . $auth[0] . '</td>';
                echo '</tr>';
            } else {
                if ($key == "gdata") {
                    echo '
		  <td>' . $auth[0] . '</td>
		  <td>{t}Domain{/t}</td><td><input type="Text" name="setup_auth_domain_gdata" value="' . self::quote(SETUP_AUTH_DOMAIN_GDATA) . '"></td><td></td>
		  </tr>';
                } else {
                    echo '
		  <td>' . $auth[0] . '</td>
		  <td>{t}Host{/t}</td><td><input type="Text" name="setup_auth_hostname_' . $key . '" value="' . self::quote(constant("SETUP_AUTH_HOSTNAME_" . strtoupper($key))) . '"></td><td>' . $auth[2] . '</td>
		  </tr>';
                }
                if ($key == "imap") {
                    echo '
		  <tr><td colspan="2"></td>
		  <td>{t}Domain{/t}</td><td><input type="Text" name="setup_auth_domain_imap" value="' . self::quote(SETUP_AUTH_DOMAIN_IMAP) . '"></td><td></td>
		  </tr>';
                }
                if ($key == "ldap") {
                    echo '<tr><td colspan="2"></td><td>{t}Domain{/t}</td><td><input type="Text" name="setup_auth_domain" value="' . self::quote(SETUP_AUTH_DOMAIN) . '"></td><td>(Active Directory)</td></tr>';
                    echo '<tr><td colspan="2"></td><td>Base DN</td><td><input type="Text" name="setup_auth_base_dn" value="' . self::quote(SETUP_AUTH_BASE_DN) . '"></td><td>({t}if not autodetected with namingContexts{/t})</td></tr>';
                    echo '<tr><td colspan="2"></td><td>User DN</td><td><input type="Text" name="setup_auth_ldap_user" value="' . self::quote(SETUP_AUTH_LDAP_USER) . '"></td><td>({t}LDAP without anonymous access{/t})</td></tr>';
                    echo '<tr><td colspan="2"></td><td>{t}Password{/t}</td><td><input type="Text" name="setup_auth_ldap_pw" value="' . self::quote(SETUP_AUTH_LDAP_PW) . '"></td><td>({t}LDAP without anonymous access{/t})</td></tr>';
                    echo '<tr><td colspan="2"></td><td>UID</td><td><input type="Text" name="setup_auth_ldap_uid" value="' . self::quote(SETUP_AUTH_LDAP_UID) . '"></td><td>({t}LDAP attribute for usernames{/t}, {t}e.g.{/t} uid,cn)</td></tr>';
                    echo '<tr><td colspan="2"></td><td>{t}Rooms{/t}</td><td><input type="Text" name="setup_auth_ldap_room" value="' . self::quote(SETUP_AUTH_LDAP_ROOM) . '"></td><td>({t}LDAP attribute for rooms{/t})</td></tr>';
                    echo '<tr><td colspan="2"></td><td>MemberOf</td><td><input type="Text" name="setup_auth_ldap_memberof" value="' . self::quote(SETUP_AUTH_LDAP_MEMBEROF) . '"></td><td>({t}LDAP attribute for group memberships{/t})</td></tr>';
                    echo '<tr><td colspan="2"></td><td>{t}Use LDAP Groups{/t}</td><td><input type="Checkbox" name="setup_auth_ldap_groups" class="checkbox" value="1" ' . (SETUP_AUTH_LDAP_GROUPS ? "checked" : "") . '></td></tr>';
                }
                if ($key == "ntlm") {
                    echo '<tr><td colspan="2"></td><td>{t}Share{/t}</td><td><input type="Text" name="setup_auth_ntlm_share" value="' . self::quote(SETUP_AUTH_NTLM_SHARE) . '"></td><td>(smb://server/share/)</td></tr>';
                }
            }
        }
        echo '
		</table>
	  </td>
	</tr>
	<tr>
	  <td><div style="border-top:1px solid #cccccc; width:100%; margin:10px 0px;"></div></td>
	  <td><div style="border-top:1px solid #cccccc; width:450px; margin:10px 0px;"></div></td>
	</tr>
  ';
        foreach (self::$selects as $key => $val) {
            echo '
	  <tr>
		<td>' . $val[0] . '</td>
		<td><select name="' . $key . '">
	';
            foreach ($val[1] as $key2 => $val2) {
                echo '<option value="' . $key2 . '" ' . (constant(strtoupper($key)) == $key2 ? "selected" : "") . '> ' . $val2;
            }
            echo '	  
		</select>
	  </tr>
	';
        }
        foreach (self::$multi_selects as $key => $val) {
            echo '
	  <tr>
		<td>' . $val[0] . '</td>
		<td>
		  <table class="data"><tr><td>
		  <input type="hidden" name="' . $key . '[]" value=""/>
	';
            $i = 0;
            foreach ($val[1] as $key2 => $val2) {
                if ($val2[0] == " ") {
                    continue;
                }
                $checked = in_array($key2, explode("|", constant(strtoupper($key)))) ? "checked" : "";
                echo '<input type="checkbox" name="' . $key . '[]" value="' . $key2 . '" ' . $checked . '> ' . $val2 . '<br>';
                $i++;
                if ($i % 13 == 0) {
                    echo '</td><td>&nbsp; &nbsp;</td><td valign="top">';
                }
            }
            echo '
		  </td></tr></table>
		</td>
	  </tr>
	';
        }
        foreach (self::$textareas as $key => $input) {
            echo '
	  <tr>
		<td>' . $input[0] . '</td>
		<td><textarea name="' . $key . '" style="width:450px; height:100px;">' . self::quote(constant(strtoupper($key))) . '</textarea></td>
	  </tr>
	';
        }
        echo '
	<tr>
	  <td><div style="border-top:1px solid #cccccc; width:100%; margin:10px 0px;"></div></td>
	  <td><div style="border-top:1px solid #cccccc; width:450px; margin:10px 0px;"></div></td>
	</tr>
  ';
        foreach (self::$bools as $key => $val) {
            echo '
	<input type="hidden" name="' . strtolower($key) . '" value="">
	<tr>
	  <td style="width:26%;">' . ($val ? $val : $key) . '</td>
	  <td><input type="Checkbox" class="checkbox" name="' . strtolower($key) . '" value="1" ' . (constant($key) ? "checked" : "") . '></td>
	</tr>
	';
        }
        echo '
	<tr>
	  <td><div style="border-top:1px solid #cccccc; width:100%; margin:10px 0px;"></div></td>
	  <td><div style="border-top:1px solid #cccccc; width:450px; margin:10px 0px;"></div></td>
	</tr>
  ';
        foreach (self::$caches as $key => $val) {
            echo '
	<tr>
	  <td>' . ($val ? $val : $key) . '</td>
	  <td><input type="Text" size="15" maxlength="50" name="' . strtolower($key) . '" value="' . self::quote(constant($key)) . '"></td>
	</tr>
	';
        }
        echo '
	</table>
	<div style="border-bottom: 1px solid black;">&nbsp;</div>
	<br>
	<input type="submit" value="   {t}S a v e{/t}   " class="submit"><br>
	</form>
  ';
    }
Exemplo n.º 4
0
 static function init()
 {
     self::$time_start = sys_get_microtime();
     // clean request vars
     if (ini_get("magic_quotes_gpc") !== false and get_magic_quotes_gpc()) {
         modify::stripslashes($_REQUEST);
     }
     foreach ($_REQUEST as $key => $val) {
         if (is_array($val) and count($val) > 0) {
             $_REQUEST[$key] = array();
             foreach ($val as $val2) {
                 if (!is_array($val2)) {
                     $_REQUEST[$key][$val2] = $val2;
                 }
             }
         }
     }
     // set up smarty
     self::$smarty = new Smarty();
     self::$smarty->register_prefilter(array("modify", "urladdon_quote"));
     if (isset($_REQUEST["print"])) {
         self::$smarty->register_outputfilter(array("modify", "striplinksforms"));
     }
     if (isset($_REQUEST["print"])) {
         self::$smarty->assign("print", $_REQUEST["print"]);
     }
     self::$smarty->compile_dir = SIMPLE_CACHE . "/smarty";
     self::$smarty->template_dir = "templates";
     self::$smarty->config_dir = "templates/css";
     self::$smarty->compile_check = false;
     // refresh smarty cache
     if (DEBUG) {
         debug_check_tpl();
     }
     // set up database
     if (!sql_connect(SETUP_DB_HOST, SETUP_DB_USER, sys_decrypt(SETUP_DB_PW, sha1(SETUP_ADMIN_USER)), SETUP_DB_NAME)) {
         $err = sprintf("{t}Cannot connect to database %s on %s.{/t}\n", SETUP_DB_NAME, SETUP_DB_HOST) . sql_error();
         trigger_error($err, E_USER_ERROR);
         sys_die($err);
     }
     // verify credentials
     login_handle_login();
 }
Exemplo n.º 5
0
 * @license GPLv2
 */
define("MAIN_SCRIPT", basename(__FILE__));
error_reporting(E_ALL);
@(include "simple_store/config.php");
if (!defined("SETUP_DB_HOST")) {
    exit;
}
require "core/functions.php";
set_error_handler("debug_handler");
if (ini_get("register_globals")) {
    modify::dropglobals();
}
@ignore_user_abort(1);
header("Content-Type: text/plain; charset=utf-8");
if (!defined("SETUP_DB_HOST") or !sql_connect(SETUP_DB_HOST, SETUP_DB_USER, sys_decrypt(SETUP_DB_PW, sha1(SETUP_ADMIN_USER)), SETUP_DB_NAME)) {
    exit(sql_error());
}
@set_time_limit(180);
$lock_file = SIMPLE_STORE . "/cron/lock_cron";
$_SESSION["username"] = "******";
$_SESSION["password"] = "";
$_SESSION["groups"] = array();
$_SESSION["permission_sql"] = "1=1";
$cron_conf = trigger::sendmail_getconn("cron", "");
if (empty($cron_conf["smtp"])) {
    $message = t("{t}Mail identities{/t}") . ": " . t("{t}SMTP not configured for %s{/t}", "cron");
    sys_log_message_log("php-fail", $message);
    exit($message);
}
if (!DEBUG and file_exists($lock_file) and filemtime($lock_file) + 150 > time() and !isset($_REQUEST["debug"])) {