Beispiel #1
0
<h1><?php 
echo $lang['common_projects'];
?>
</h1>

<?php 
$projectInst = new project();
if (!$loginInst->isCustomer()) {
    #######################################################################
    ## perform action
    $status = 1;
    if (tool::securePost('action') == "save" && tool::securePost('id')) {
        # fill project with submitted data
        $projectInst->id = tool::securePost('id');
        $projectInst->fill(tool::securePostAll());
        $status = $projectInst->update();
    } elseif (tool::securePost('action') == "save") {
        $projectInst->fill(tool::securePostAll());
        $status = $projectInst->insert();
    }
    if (tool::securePost('action') == "delete") {
        $projectInst->id = tool::securePost('id');
        $projectInst->delete();
    }
    if (tool::securePost('action') == "edit") {
        $status = 0;
        $projectInst->activate(tool::securePost('id'));
    }
    #######################################################################
    ## make edit / new form
    if (!$status) {
<?php

session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . "/common/class/common.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/common/class/project.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/common/class/user.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/common/class/config.class.php";
$objuser = new user();
$objuser->checkLoginAjax();
if (is_array($_POST)) {
    $objproject = new project();
    $objproject->update($_POST);
    if (isset($_SESSION['tempfilename'])) {
        $fp = fopen($_SESSION['tempfilename'], 'r');
        $content = fread($fp, $_SESSION['filesize']);
        fclose($fp);
        $objproject->addfile($_SESSION['filename'], $_SESSION['filetype'], $_SESSION['filesize'], $content, $_POST['projectid']);
    }
    echo "script: messageBox('Project Updated',function() { window.location='account.php'; });";
}