Code

Removed getkiosk.php.
[gosa.git] / gosa-core / include / functions.inc
index b1123007da4c49a16803f2ff4fc2a7910b41ea16..80552801c241c7b3c38f267c17194c73c0cbc725 100644 (file)
@@ -93,10 +93,16 @@ $REWRITE= array( "รค" => "ae",
 /* Class autoloader */
 function __autoload($class_name) {
     global $class_mapping, $BASE_DIR;
+
+    if ($class_mapping === NULL){
+           echo sprintf(_("Fatal error: no class locations defined - please run '%s' to fix this"), "<b>update-gosa rescan-classes</b>");
+           exit;
+    }
+
     if (isset($class_mapping[$class_name])){
       require_once($BASE_DIR."/".$class_mapping[$class_name]);
     } else {
-      echo sprintf(_("Fatal error: cannot load class '%s' - execution aborted"), $class_name);
+      echo sprintf(_("Fatal error: cannot instantiate class '%s' - execution aborted"), $class_name);
       print_a(debug_backtrace());
       exit;
     }
@@ -111,7 +117,7 @@ function plugin_available($plugin)
        if (!isset($class_mapping[$plugin])){
                return false;
        } else {
-               return file_exists($BASE_DIR."/".$class_mapping[$plugin]);
+               return is_readable($BASE_DIR."/".$class_mapping[$plugin]);
        }
 }
 
@@ -2608,6 +2614,24 @@ function remove_objectClass($classes, &$attrs)
   }
 }
 
+/*! \brief  Initialize a file download with given content, name and data type. 
+ *  @param  data  String The content to send.
+ *  @param  name  String The name of the file.
+ *  @param  type  String The content identifier, default value is "application/octet-stream";
+ */
+function send_binary_content($data,$name,$type = "application/octet-stream")
+{
+  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+  header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+  header("Cache-Control: no-cache");
+  header("Pragma: no-cache");
+  header("Cache-Control: post-check=0, pre-check=0");
+  header("Content-type: ".$type."");
+  header("Content-Disposition: attachment; filename=".$name);
+  echo $data;
+  exit();
+}
+
 
 function display_error_page()
 {