示例#1
0
文件: libraries.php 项目: jjgod/SDL
<?php

include "../include/login.inc.php";
include "header.inc.php";
define(PROJECTTYPE, 4);
define(PROJECTTYPETEXTPC, "Libraries");
// endings: p = plural / s = singular / c = capitalized
define(PROJECTTYPETEXTP, "libraries");
define(PROJECTTYPETEXTSC, "Library");
define(PROJECTTYPETEXTS, "library");
BeginContent(PROJECTTYPETEXTPC);
include "../include/projects.inc.php";
CloseContent();
include "footer.inc.php";
示例#2
0
文件: users.php 项目: jjgod/SDL
 */
function create_password()
{
    $chars = "abcdefghijkmnopqrstuvwxyz023456789";
    srand((double) microtime() * 1000000);
    $i = 0;
    $pass = '';
    while ($i <= 7) {
        $num = rand() % 33;
        $tmp = substr($chars, $num, 1);
        $pass = $pass . $tmp;
        $i++;
    }
    return $pass;
}
BeginContent("Users");
$fields_def = array('id' => array('type' => 'integer', 'required' => True), 'groupid' => array('type' => 'integer', 'required' => True), 'login' => array('type' => 'char', 'size' => 20, 'required' => True), 'name' => array('type' => 'char', 'size' => 64, 'required' => True), 'email' => array('type' => 'char', 'size' => 64, 'required' => False), 'reset' => array('type' => 'char', 'size' => 64, 'required' => True));
switch ($action) {
    case "createuser":
        echo <<<EOT
<form method="post" action="{$_SERVER['PHP_SELF']}?action=insertuser">
<i>All fields are required</i><br>
<p>Login (case sensitive)<br><input type="text" name="login" value="{$_GET['login']}" size="16" maxlength="20"></p>
<p>Name<br><input type="text" name="name" value="{$_GET['name']}" size="50" maxlength="64"></p>
<p>Email<br><input type="text" name="email" value="{$_GET['email']}" size="50" maxlength="64"></p>
<p><input type="submit" value="Submit"></p>
</form>
<p>Note that the information submitted here is kept completely private.</p>

EOT;
        break;
示例#3
0
文件: faq.php 项目: jjgod/SDL
include "../include/login.inc.php";
if (!$printer_friendly) {
    include "header.inc.php";
}
$title = "Frequently Asked Questions";
$input = validateinput($_GET, array('category' => array('type' => 'integer')), array('category'));
if ($input === False) {
    break;
}
if ($input['category']) {
    $query = "select name from faqcategories where id = {$input['category']}";
    $result = mysql_query($query, $DBconnection) or die("Could not execute query !");
    $name = mysql_result($result, 0, "name");
    $title = "{$title}: {$name}";
}
BeginContent($title);
$faq_categories_fields_def = array('id' => array('type' => 'integer', 'required' => True), 'name' => array('type' => 'char', 'size' => 20, 'required' => True), 'description' => array('type' => 'char', 'size' => 255, 'required' => True), 'sorted' => array('type' => 'float', 'required' => True));
$faq_entries_fields_def = array('id' => array('type' => 'integer', 'required' => True), 'category' => array('type' => 'integer', 'required' => True), 'question' => array('type' => 'char', 'required' => True), 'answer' => array('type' => 'char', 'required' => True, 'allowed_tags' => '<p><br><ul><ol><li><a><pre><code>'), 'sorted' => array('type' => 'float', 'required' => True));
switch ($action) {
    case "addentry":
        if (!$userprivileges['addfaqentry']) {
            print "You are not permitted to access this page !<br>\n";
            break;
        }
        $input = validateinput($_GET, $faq_entries_fields_def, array('category'));
        if (!$input) {
            break;
        }
        echo <<<EOT
<form method="post" action="{$_SERVER['PHP_SELF']}?action=insertentry&amp;category={$input['category']}">
<p>question<br><textarea name="question" cols="60" rows="2" wrap="soft"></textarea></p> 
示例#4
0
文件: groups.php 项目: jjgod/SDL
<?php

include "../include/login.inc.php";
include "header.inc.php";
BeginContent("Groups");
$fields_def = array('id' => array('type' => 'integer', 'required' => True), 'name' => array('type' => 'char', 'size' => 30, 'required' => True));
$id = $_GET['id'];
$privilegelist = array("addproject", "reviewproject", "editproject", "removeproject", "addprojectcategory", "editprojectcategory", "removeprojectcategory", "addnews", "editnews", "removenews", "addarticle", "editarticle", "removearticle", "addfaqentry", "editfaqentry", "removefaqentry", "managefaqcategories", "manageoses", "managegroups", "manageusers");
if (!$userprivileges['managegroups']) {
    print "You are not permitted to access this page !<br>\n";
} else {
    switch ($action) {
        case "addgroup":
            $privilegeboxes = "";
            reset($privilegelist);
            while (list($key, $privilegename) = each($privilegelist)) {
                $privilegeboxes .= "<input type=\"checkbox\" name=\"{$privilegename}\" value=\"yes\">{$privilegename}\n";
            }
            echo <<<EOT
<form method="post" action="{$_SERVER['PHP_SELF']}?action=insertgroup">
<p>name<br><input type="text" name="name" size="50" maxlength="30"></p>
{$privilegeboxes}
<p><input type="submit" value="Submit"></p>
</form>
<a href="{$_SERVER['PHP_SELF']}">back</a>

EOT;
            break;
        case "insertgroup":
            if ($_POST['name'] == "") {
                print "Invalid name !<br>\n";
示例#5
0
文件: oses.php 项目: jjgod/SDL
<?php

include "../include/login.inc.php";
include "header.inc.php";
BeginContent("OS");
if (!$userprivileges['manageoses']) {
    print "You are not permitted to access this page !<br>\n";
    exit;
}
$fields_def = array('id' => array('type' => 'integer'), 'shortname' => array('type' => 'char', 'size' => 10, 'required' => True), 'name' => array('type' => 'char', 'size' => 30, 'required' => True));
$id = $_GET['id'];
switch ($action) {
    case "addos":
        echo <<<EOT
<form method="post" action="{$_SERVER['PHP_SELF']}?action=insertos">
<p>name<br><input type="text" name="name" size="50" maxlength="30"></p>
<p>shortname (will be used in the path of the OS image)<br><input type="text" name="shortname" size="50" maxlength="10"></p>
<p><input type="submit" value="Submit"></p>
</form>
<br>
<a href="{$_SERVER['PHP_SELF']}">back</a>

EOT;
        break;
    case "insertos":
        //--- check everything is valid ---//
        $nbrerrors = 0;
        $required = array("name", "shortname");
        while (list($key, $varname) = each($required)) {
            $nbrerrors += isempty($varname, $_POST[$varname]);
        }