コード例 #1
0
ファイル: import.php プロジェクト: drognisep/Simple-Groupware
    static function form($folder, $required_fields)
    {
        setup::out_exit('
	Folder: ' . q(modify::getpathfull($folder)) . '<br>
	<br>
	<a href="index.php?export=calc&limit=1&hide_fields=id&folder=' . q($folder) . '&view=details">{t}Download example file{/t} (.xls)</a>
	<br>
	{t}Required fields{/t}: ' . q(implode(", ", $required_fields)) . '
	<br><br>
	{t}File{/t} (.xls):<br>
	<form method="post" action="import.php?" enctype="multipart/form-data">
	<input type="hidden" name="token" value="' . modify::get_form_token() . '">
	<input type="hidden" name="folder" value="' . q($folder) . '">
	<input type="File" name="file[]" value="" multiple="true" required="true">
	<input type="submit" value="{t}I m p o r t{/t}" class="submit">
	<input type="submit" name="validate_only" value="{t}V a l i d a t e{/t}" class="submit">
	</form>
	<br>
	<b>{t}Note{/t}:</b> {t}Assets can be imported into multiple folders by adding the "Folder" column.{/t}<br>
	<b>{t}Note{/t}:</b> {t}Assets can be overwritten by adding the "Id" column.{/t}<br>
	<br>
	<div style="border-top: 1px solid black;">Powered by Simple Groupware, Copyright (C) 2002-2012 by Thomas Bley.</div></div>
	</body>
	</html>
  ');
    }
コード例 #2
0
	  <a href="?console=sql" <?php 
echo $this->console == "sql" ? "class='bold'" : "";
?>
>SQL</a> - 
	  <a href="?console=php" <?php 
echo $this->console == "php" ? "class='bold'" : "";
?>
>PHP</a> - 
	  <a href="?console=sys" <?php 
echo $this->console == "sys" ? "class='bold'" : "";
?>
>SYS</a>
	</div>
	<form method="post" action="console.php">
	<input type="hidden" name="token" value="<?php 
echo modify::get_form_token();
?>
">
	<?php 
if ($this->console == "sql" and $this->auto_complete) {
    ?>
	  <input type="hidden" id="database" value="<?php 
    echo SETUP_DB_NAME;
    ?>
" />
	  <textarea name="code" id="codebox" class="codebox" spellcheck="false"><?php 
    q($this->code);
    ?>
</textarea><br>
	  <select size="2" id="selectbox" ondblclick="select_insert(obj('codebox'),obj(this.id));"></select>
	<?php 
コード例 #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>
  ';
    }
コード例 #4
0
 static function show_list($mirror_id)
 {
     setup::out("\n\t<div style='color:#ff0000;'>\n\t<b>{t}Warning{/t}</b>:<br>\n\t- Please make a complete backup of your database (e.g. using phpMyAdmin)<br>\n\t- Please make a complete backup of your sgs folder (e.g. /var/www/htdocs/sgs/)<br>\n\t- Make sure both backups are complete!\n    </div>\n\t<br>\n\t{t}Downloading update list{/t} ...<br>\n  ");
     $mirror = self::$mirrors[$mirror_id];
     $ctx = stream_context_create(array("http" => array("timeout" => 5)));
     $data = @file_get_contents($mirror["url"], 0, $ctx);
     $match = array();
     preg_match_all($mirror["pattern"], $data, $match);
     if (!empty($match[1]) and $data != "") {
         $found = false;
         foreach ($match[1] as $key => $item) {
             if ($key > 4) {
                 break;
             }
             if (strpos("@" . $item, CORE_VERSION_STRING) and !DEBUG) {
                 break;
             }
             if (!empty($match[3][$key]) and strtotime($match[3][$key]) + 3600 > time()) {
                 continue;
             }
             $found = true;
             $check = true;
             if (!empty($match[2][$key])) {
                 $match_version = array();
                 preg_match("/php (\\d+\\.\\d+\\.\\d+)/i", $match[2][$key], $match_version);
                 if (!empty($match_version[1]) and version_compare(PHP_VERSION, $match_version[1], "<")) {
                     setup::out(sprintf("{t}Setup needs php with at least version %s !{/t}", $match_version[1]));
                     $check = false;
                 }
                 preg_match("/" . SETUP_DB_TYPE . " (\\d+\\.\\d+\\.\\d+)/i", $match[2][$key], $match_version);
                 if (!empty($match_version[1])) {
                     $db_version = str_replace(".", "", $match_version[1]);
                     $curr_version = sgsml_parser::sql_version();
                     if ($curr_version < $db_version) {
                         setup::out(sprintf("{t}Wrong database-version (%s). Please use at least %s !{/t}", $curr_version, $match_version[1]));
                         $check = false;
                     }
                 }
             }
             if ($check) {
                 setup::out("<a href='updater.php?mirror=" . $mirror_id . "&token=" . modify::get_form_token() . "&release=" . $item . "'>{t}I n s t a l l{/t}</a>&nbsp; Simple Groupware ", false);
                 setup::out($item . " (<a target='_blank' href='http://www.simple-groupware.de/cms/Release-" . str_replace(".", "-", $item) . "'>Changelog</a>)<br>");
             }
         }
         if (!$found) {
             setup::out("{t}Already running latest release.{/t}<br>");
         }
     } else {
         setup::out(sprintf("{t}Connection error: %s [%s]{/t}", $mirror["url"], "HTTP") . "<br>" . strip_tags($data, "<br><p><h1><center>"));
     }
     setup::out("{t}Server{/t}: <b>" . $mirror["name"] . "</b>, {t}use mirror from{/t}: ", false);
     foreach (self::$mirrors as $key => $sel_mirror) {
         if ($key == $mirror_id) {
             continue;
         }
         setup::out("<a href='updater.php?mirror=" . $key . "'>" . $sel_mirror["name"] . "</a> ");
     }
     setup::out("<br/>{t}Package from local file system (.tar.gz){/t}:<br/>{t}current path{/t}: " . str_replace("\\", "/", getcwd()) . "/<br/>");
     foreach (scandir("./") as $file) {
         if ($file[0] == "." or !preg_match("|^SimpleGroupware\\_.*?.tar\\.gz\$|i", $file)) {
             continue;
         }
         setup::out("<a href='updater.php?token=" . modify::get_form_token() . "&cfile=" . $file . "'>{t}I n s t a l l{/t}</a>&nbsp; " . $file . "<br/>");
     }
     setup::out("<form method='POST'><input type='hidden' name='token' value='" . modify::get_form_token() . "'><input type='text' name='cfile' value='/tmp/SimpleGroupware_0.xyz.tar.gz' style='width:300px;'>&nbsp;<input type='submit' class='submit' value='{t}I n s t a l l{/t}'><br>");
     setup::out("<input type='checkbox' name='nobackup' value='1' onchange='change_links(this.checked);'/> " . sprintf("{t}Don't move old files to '%s'{/t}", SIMPLE_STORE . "/old/") . "</form>");
     setup::out_exit('<div style="border-top: 1px solid black;">Powered by Simple Groupware, Copyright (C) 2002-2012 by Thomas Bley.</div></div></body></html>');
 }
コード例 #5
0
 static function showlist()
 {
     setup::out("\n\t<div style='color:#ff0000;'>\n\t<b>{t}Warning{/t}</b>:<br>\n\t- Please make a complete backup of your database (e.g. using phpMyAdmin)<br>\n\t- Please make a complete backup of your sgs folder (e.g. /var/www/htdocs/sgs/)<br>\n\t- Make sure both backups are complete!\n    </div>\n  ");
     setup::out("{t}Downloading extension list{/t} ...<br>");
     $url = "http://sourceforge.net/projects/simplgroup/files/simplegroupware_modules/modules.xml";
     if (!($data = sys_cache_get("modules.xml"))) {
         $data = @file_get_contents($url);
         sys_cache_set("modules.xml", $data, 3600);
     }
     if ($xml = @simplexml_load_string($data)) {
         foreach ($xml as $package) {
             $php_version = (string) $package->php_version;
             $sgs_version = (string) $package->require_version;
             $target = SIMPLE_EXT . substr(basename($package->filename), 0, -3);
             if (file_exists($target)) {
                 continue;
             }
             $id = md5($package->filename);
             if (version_compare(PHP_VERSION, $php_version, "<")) {
                 setup::out(sprintf("{t}Setup needs php with at least version %s !{/t} ", $php_version), false);
             } else {
                 if (version_compare(CORE_VERSION_STRING, $sgs_version, "<")) {
                     setup::out(sprintf("{t}Setup needs Simple Groupware with at least version %s !{/t} ", $sgs_version), false);
                 } else {
                     setup::out("<a href='extensions.php?token=" . modify::get_form_token() . "&extension=" . $package->name . "&filename=" . $package->filename . "'>{t}I n s t a l l{/t}</a> ", false);
                 }
             }
             setup::out($package->title . " <a href='#' onclick='return showhide(\"" . $id . "\")'>{t}Info{/t}</a>", false);
             setup::out("<br><div class='description' style='display:none;' id='" . $id . "'>" . nl2br(trim($package->description)) . "</div>");
         }
     } else {
         setup::out(sprintf("{t}Connection error: %s [%s]{/t}", $url, "HTTP") . "<br>" . strip_tags($data, "<br><p><h1><center>"));
     }
     setup::out("{t}Package from local file system (.tar.gz){/t}:<br/>{t}current path{/t}: " . str_replace("\\", "/", getcwd()) . "/<br/>");
     $dir = opendir("./");
     while ($file = readdir($dir)) {
         if ($file != "." and $file != ".." and preg_match("|^SimpleGroupware\\_.*?.tar\\.gz\$|i", $file)) {
             setup::out("<a href='extensions.php?token=" . modify::get_form_token() . "&cfile=" . $file . "'>{t}I n s t a l l{/t}</a>&nbsp; " . $file . "<br/>");
         }
     }
     closedir($dir);
     setup::out("<form method='POST'><input type='hidden' name='token' value='" . modify::get_form_token() . "'><input type='text' name='cfile' value='/tmp/SimpleGroupware_SomeExtension_0.x.tar.gz' style='width:300px;'>&nbsp;<input type='submit' class='submit' value='{t}I n s t a l l{/t}'><br>");
     $can_uninstall = false;
     foreach (scandir(SIMPLE_EXT) as $file) {
         if ($file[0] == "." or !is_dir(SIMPLE_EXT . $file) or !file_exists(SIMPLE_EXT . $file . "/package.xml")) {
             continue;
         }
         $package = simplexml_load_file(SIMPLE_EXT . $file . "/package.xml");
         $id = md5($package->filename);
         setup::out("<a onclick='if (!confirm(\"{t}Really uninstall the module ?{/t}\")) return false;' href='extensions.php?token=" . modify::get_form_token() . "&uninstall=" . $package->filename . "'>{t}U n i n s t a l l{/t}</a> " . $package->title, false);
         setup::out(" <a href='#' onclick='return showhide(\"" . $id . "\")'>{t}Info{/t}</a>", false);
         setup::out(" ({t}installed{/t} " . sys_date("{t}m/d/Y{/t}", filemtime(SIMPLE_EXT . $file)) . ")");
         setup::out("<div class='description' style='display:none;' id='" . $id . "'>" . nl2br(trim($package->description)) . "</div>");
         $can_uninstall = true;
     }
     if ($can_uninstall) {
         setup::out("<b>{t}Note{/t}:</b> {t}Uninstall does not delete any data in the database.{/t}<br>");
     }
     setup::out_exit('<div style="border-top: 1px solid black;">Powered by Simple Groupware, Copyright (C) 2002-2012 by Thomas Bley.</div></div></body></html>');
 }