Ejemplo n.º 1
0
 * @copyright Simple Groupware Solutions Thomas Bley 2002-2012
 * @license GPLv2
 */
define("NOCONTENT", true);
define("NOSESSION", true);
require "index.php";
if (empty($_REQUEST["item"]) or empty($_REQUEST["action"]) or empty($_REQUEST["folder"]) or !isset($_REQUEST["subitem"])) {
    sys_error("Missing parameters.", "403 Forbidden");
}
sys_check_auth();
if (empty($_REQUEST["field"])) {
    $field = "filedata";
} else {
    $field = ltrim($_REQUEST["field"], "_");
}
$folder = folder_from_path($_REQUEST["folder"]);
if (strtolower($_REQUEST["action"]) == "lock") {
    ajax::file_lock($folder, $_REQUEST["item"], $field, $_REQUEST["subitem"]);
    header("Cache-Control: private, max-age=1, must-revalidate");
    header("Expires: " . gmdate("D, d M Y H:i:s", NOW) . " GMT");
    header("Content-Type: text/xml; charset=utf-8");
    header("Lock-Token: <opaquelocktoken:1>");
    echo '<?xml version="1.0" encoding="utf-8"?>
<D:prop xmlns:D="DAV:">
<D:lockdiscovery><D:activelock>
<D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype>
<D:depth>0</D:depth><D:timeout>Second-7200</D:timeout>
<ns0:owner xmlns:ns0="DAV:">' . q($_SESSION["username"]) . '</ns0:owner>
<D:locktoken><D:href>opaquelocktoken:1</D:href></D:locktoken>
</D:activelock></D:lockdiscovery>
</D:prop>';
Ejemplo n.º 2
0
 /**
  * Check required access rights for folder and view
  * - exit when access is denied
  *
  * @param int|string $folder Folder ID or String (/Workspace/.../)
  * @param string $right Right (read, write, admin)
  * @param string $view View name (e.g. display, details), optional
  */
 protected static function _require_access(&$folder, $right = "read", $view = "")
 {
     // /Workspace/ => 101
     $folder = folder_from_path($folder);
     if (!db_get_right($folder, $right, $view)) {
         if ($right == "read") {
             $right = "{t}read access{/t}";
         }
         if ($right == "write") {
             $right = "{t}write access{/t}";
         }
         if ($right == "admin") {
             $right = "{t}admin access{/t}";
         }
         exit("{t}Access denied.{/t} " . sprintf("{t}missing right: %s{/t}", $right . " (" . $folder . ")"));
     }
 }
Ejemplo n.º 3
0
 private static function _createlocation($name)
 {
     $row_id = db_select_value("simple_locations", "id", "locationname=@name@", array("name" => $name));
     $folder = folder_from_path("^locations");
     if (empty($row_id) and !empty($folder)) {
         $id = sql_genID("simple_locations") * 100;
         $data = array("id" => $id, "locationname" => $name, "folder" => $folder);
         $error_sql = db_insert("simple_locations", $data);
         if ($error_sql == "") {
             db_update_treesize("simple_locations", $folder);
             db_search_update("simple_locations", $id, array(), array("locationname" => "text"));
             sys_log_stat("new_records", 1);
         } else {
             return $error_sql;
         }
     }
     return "";
 }
Ejemplo n.º 4
0
require "index.php";
require "lib/spreadsheet/Reader.php";
@set_time_limit(1800);
if (empty($_REQUEST["folder"])) {
    sys_error("Missing parameters.", "403 Forbidden");
}
$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;
Ejemplo n.º 5
0
 static function database_folders()
 {
     $parent = folder_from_path("^system");
     if (!empty($parent)) {
         $row_id = folder_from_path("!sys_nodb_backups");
         if (empty($row_id)) {
             folders::create("{t}Backups{/t}", "sys_nodb_backups", "", $parent, false);
         }
         $row_id = folder_from_path("^trash");
         if (empty($row_id)) {
             folders::create("{t}Trash{/t}", "blank", "", $parent, false, array("anchor" => "trash"));
         }
         $row_id = folder_from_path("!sys_notifications");
         if (empty($row_id)) {
             folders::create("{t}Notifications{/t}", "sys_notifications", "{t}Delivery{/t}: cron.php", $parent, false);
         }
         $row_id = folder_from_path("^customize");
         if (empty($row_id)) {
             folders::create("{t}Customize{/t}", "blank", "", $parent, false, array("anchor" => "customize"));
         }
         $row_id = folder_from_path("!sys_console");
         if (empty($row_id)) {
             $id = folders::create("{t}Console{/t}", "sys_console", "", $parent, false, array());
             folders::import_data("modules/core/data_console.xml", $id);
         }
     }
     $parent = folder_from_path("^customize");
     $row_id = folder_from_path("!sys_custom_fields");
     if (empty($row_id) and !empty($parent)) {
         folders::create("{t}Fields{/t}", "sys_custom_fields", "{t}Customization rules\nfor modules based on sgsML{/t}", $parent, false);
     }
     $parent = folder_from_path("^workspace");
     $row_id = folder_from_path("^extensions");
     if (!empty($parent) and empty($row_id)) {
         folders::create("{t}Extensions{/t}", "blank", "", $parent, false, array("anchor" => "extensions"));
     }
 }