Beispiel #1
0
    static function header()
    {
        setup::out('
	<html><head>
	<title>Simple Groupware {t}Import{/t}</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<style>
	  body, h2, img, div, table.data, a {
		background-color: #FFFFFF; color: #666666; font-size: 13px; font-family: Arial, Helvetica, Verdana, sans-serif;
	  }
	  a,input { color: #0000FF; }
	  input {
		font-size: 11px; background-color: #F5F5F5; border: 1px solid #AAAAAA; height: 18px;
		vertical-align: middle; padding-left: 5px; padding-right: 5px; border-radius: 10px;
	  }
	  .checkbox, .radio { border: 0px; background-color: transparent; }
	  .submit { color: #0000FF; background-color: #FFFFFF; width: 125px; font-weight: bold; }
	  .border {	border-bottom: 1px solid black; }
	  .headline {
		letter-spacing: 2px;
		font-size: 18px;
		font-weight: bold;
	  }
	</style>
	</head>
	<body>
	<div class="border headline">Simple Groupware {t}Import{/t}</div><br>
	<a href="index.php">{t}Back{/t}</a> &nbsp;| &nbsp;<a href="http://www.simple-groupware.de/cms/DataHandlers" target="_blank">{t}Help{/t}</a><br>
  ');
    }
Beispiel #2
0
function install()
{
    setup::out('
    <html>
    <head>
	<title>Simple Groupware & CMS</title>
	<style>
	  body { width:526px; margin:10px auto; }
	  body, a { color: #666666; font-size: 13px; font-family: Arial, Helvetica, Verdana, sans-serif; }
	  a { color: #0000FF; }
	</style>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <body>
	<div style="border-bottom: 1px solid #666666; letter-spacing: 2px; font-size: 18px; font-weight: bold;">Simple Groupware ' . CORE_VERSION_STRING . '</div>
  ');
    $_SESSION["groups"] = array();
    $_SESSION["username"] = "******";
    $_SESSION["password"] = "";
    $_SESSION["permission_sql"] = "1=1";
    $_SESSION["permission_sql_read"] = "1=1";
    $_SESSION["permission_sql_write"] = "1=1";
    define("SETUP_DB_TYPE", $_REQUEST["db_type"]);
    $update = sgsml_parser::table_column_exists("simple_sys_tree", "id");
    setup::out('<img src="http://www.simple-groupware.de/cms/logo.php/' . CORE_VERSION . '/' . SETUP_DB_TYPE . '/' . PHP_VERSION . '/' . (int) $update . '" style="width:1px; height:1px;">', false);
    setup::out(t("{t}Processing %s ...{/t}", "schema updates"));
    setup_update::change_database_pre();
    if (SETUP_DB_TYPE == "sqlite") {
        sql_query("begin");
        admin::rebuild_schema(false);
        sql_query("commit");
    } else {
        admin::rebuild_schema(false);
    }
    setup_update::change_database_post();
    setup::out(t("{t}Processing %s ...{/t}", "sessions"));
    db_delete("simple_sys_session", array(), array());
    setup::out(t("{t}Processing %s ...{/t}", "default groups"));
    $groups = array("admin_calendar", "admin_news", "admin_projects", "admin_bookmarks", "admin_contacts", "admin_inventory", "admin_helpdesk", "admin_organisation", "admin_files", "admin_payroll", "admin_surveys", "admin_hr", "admin_intranet", "users_self_registration");
    foreach ($groups as $group) {
        trigger::creategroup($group);
    }
    setup_update::database_triggers();
    setup::out(t("{t}Processing %s ...{/t}", "folder structure"));
    $count = db_select_value("simple_sys_tree", "id", array());
    if (empty($count)) {
        $folders = "modules/core/folders.xml";
        if (!empty($_REQUEST["folders"]) and file_exists(sys_custom($_REQUEST["folders"]))) {
            $folders = $_REQUEST["folders"];
        }
        if (SETUP_DB_TYPE == "sqlite") {
            sql_query("begin");
            folders::create_default_folders($folders, 0, true);
            sql_query("commit");
        } else {
            folders::create_default_folders($folders, 0, true);
        }
    }
    setup_update::database_folders();
    setup::out(t("{t}Processing %s ...{/t}", "css"));
    admin::build_css();
    setup::out(t("{t}Processing %s ...{/t}", "js"));
    admin::build_js();
    setup::out(t("{t}Processing %s ...{/t}", "icons"));
    admin::build_icons();
    setup::out(t("{t}Processing %s ...{/t}", "config.php"));
    $vars = array("SETUP_DB_TYPE" => "'" . $_REQUEST["db_type"] . "'", "SETUP_DB_HOST" => "'" . $_REQUEST["db_host"] . "'", "SETUP_DB_NAME" => "'" . $_REQUEST["db_name"] . "'", "SETUP_DB_USER" => "'" . $_REQUEST["db_user"] . "'", "SETUP_DB_PW" => "'" . sys_encrypt($_REQUEST["db_pw"], sha1($_REQUEST["admin_user"])) . "'", "SETUP_ADMIN_USER" => "'" . $_REQUEST["admin_user"] . "'", "SETUP_ADMIN_PW" => "'" . (isset($_REQUEST["auto_update"]) ? $_REQUEST["admin_pw"] : sha1($_REQUEST["admin_pw"])) . "'");
    setup::save_config($vars);
    setup::install_footer();
    db_optimize_tables();
}
Beispiel #3
0
 static function footer()
 {
     setup::out("<br><a href='index.php'>{t}C O N T I N U E{/t}</a><finished>");
     setup::out('<br><div style="border-top: 1px solid black;">Powered by Simple Groupware, Copyright (C) 2002-2012 by Thomas Bley.</div></div></body></html>');
 }
Beispiel #4
0
    static function show_lang()
    {
        setup::out('
    <html>
    <head>
	<title>Simple Groupware & CMS</title>
	<style>
	  body { width:526px; margin:10px auto; }
	  body, a { color: #666666; font-size: 13px; font-family: Arial, Helvetica, Verdana, sans-serif; }
	  a { color: #0000FF; }
	  #logo_table {
		color:#FFFFFF; background-image:url(ext/images/sgs_logo_bg.jpg); width:512px; height:208px; border-radius:4px;
		-moz-transition:opacity 3s; -webkit-transition:opacity 3s; opacity:0;
	  }
	  .logo { border-radius:8px; border:1px solid #AAAAAA; width:526px; height:222px; margin-bottom:10px; }
	  .tab { width:84%; margin:auto; }
	  .font { text-shadow: -1px -1px 0px #101010, 1px 1px 0px #505050; font-family: Coustard, serif; }
	  @font-face { font-family:"Coustard"; src:local("Coustard"), url("ext/images/coustard.woff") format("woff"); }
	</style>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <body onload="document.getElementById(\'logo_table\').style.opacity=1;">

	<table class="logo">
	<tr><td align="center" valign="middle">
	  <table id="logo_table">
		<tr style="height:45px;"><td align="center" valign="top" class="font" style="font-size:80%"><b>Simple Groupware Solutions</b></td></tr>
		<tr><td align="center" class="font" style="font-size:170%;"><b>Simple Groupware<br>' . CORE_VERSION_STRING . '</b></td></tr>
		<tr style="height:50px;"><td valign="bottom" style="font-size:70%">Photo from<br>Axel Kristinsson</td></tr>
	  </table>
	</td></tr>
	</table>
  ', false);
        self::out("<table class='tab'><tr><td>", false);
        $i = 0;
        $langs = select::languages();
        foreach ($langs as $lang => $lang_str) {
            $i++;
            self::out("<a href='index.php?lang=" . $lang . "'>" . $lang_str . "</a><br>");
            if ($i == ceil(count($langs) / 2)) {
                self::out("</td><td valign='top' align='right'>", false);
            }
        }
        self::out("</td></tr></table>", false);
        self::out('<div style="border-top: 1px solid #666666;">Powered by Simple Groupware, Copyright (C) 2002-2012 by Thomas Bley.</div></body></html>', true, true);
    }
Beispiel #5
0
}
$folder = $_REQUEST["folder"];
sys_check_auth();
import::header();
if (isset($_FILES["file"]) and is_array($_FILES["file"])) {
    $files = import::process_files();
    if (!empty($files)) {
        if (!sys_validate_token()) {
            sys_die(t("{t}Invalid security token{/t}"));
        }
        $folder = folder_from_path($folder);
        $validate_only = isset($_REQUEST["validate_only"]);
        foreach ($files as $file) {
            $message = $validate_only ? t("{t}Validating %s ...{/t}") : t("{t}Processing %s ...{/t}");
            setup::out(sprintf("<b>" . $message . "</b>", q(modify::basename($file))));
            ajax::file_import($folder, $file, array("setup", "out"), $validate_only);
            setup::out("<hr>");
        }
    }
}
$sgsml = new sgsml($folder, "new");
$view = $sgsml->view;
$required_fields = array();
foreach ($sgsml->current_fields as $name => $field) {
    if (empty($field["REQUIRED"])) {
        continue;
    }
    $required_fields[$name] = !empty($field["DISPLAYNAME"]) ? $field["DISPLAYNAME"] : $name;
}
import::form($folder, $required_fields);
// TODO use URL for upload
 static function database_triggers()
 {
     // 0.664
     if (!file_exists(SIMPLE_STORE . "/setup_emails")) {
         setup::out(sprintf("{t}Processing %s ...{/t}", "emails message"));
         $rows = db_select("simple_emails", "*", array("message_html='' and message!=''"), "", "");
         if (is_array($rows) and count($rows) > 0) {
             foreach ($rows as $row) {
                 trigger::createemail($row["id"], $row);
             }
         }
         touch(SIMPLE_STORE . "/setup_emails");
     }
     // 0.704
     if (!file_exists(SIMPLE_STORE . "/setup_notify")) {
         $notifications = array("simple_tasks" => "closed='0'", "simple_contacts" => "birthday!=''", "simple_contactactivities" => "finished='0'", "simple_sys_users" => "activated='1'");
         foreach ($notifications as $table => $where) {
             setup::out(sprintf("{t}Processing %s ...{/t}", $table));
             $rows = db_select($table, "*", array($where, "notification!=''"), "", "");
             if (!is_array($rows) or count($rows) == 0) {
                 continue;
             }
             foreach ($rows as $row) {
                 trigger::notify($row["id"], $row, array(), $table);
             }
         }
         touch(SIMPLE_STORE . "/setup_notify");
     }
     if (!file_exists(SIMPLE_STORE . "/setup_duration")) {
         setup::out(sprintf("{t}Processing %s ...{/t}", "tasks duration"));
         $rows = db_select("simple_tasks", "*", array(), "", "");
         if (is_array($rows) and count($rows) > 0) {
             foreach ($rows as $row) {
                 trigger::duration($row["id"], $row, false, "simple_tasks");
             }
         }
         setup::out(sprintf("{t}Processing %s ...{/t}", "projects duration"));
         $rows = db_select("simple_projects", "*", array(), "", "");
         if (is_array($rows) and count($rows) > 0) {
             foreach ($rows as $row) {
                 trigger::createeditproject($row["id"], $row);
             }
         }
         touch(SIMPLE_STORE . "/setup_duration");
     }
     setup::out(sprintf("{t}Processing %s ...{/t}", "appointments"));
     $rows = db_select("simple_calendar", "*", array(), "", "");
     if (is_array($rows) and count($rows) > 0) {
         foreach ($rows as $row) {
             trigger::calcappointment($row["id"], $row, null, "simple_calendar");
         }
     }
 }