function reView($path, &$tree)
{
    $tree->name = $path;
    $tree->value = $path . ' ' . setHeader('Set Header', 'setDirHeader("' . $path . '",this);') . selectPermissions('Set Permission', 'setDirPermission("' . $path . '",this);') . selectPermissions('Remove Permission', 'removeDirPermission("' . $path . '",this);');
    $tree->contracted = true;
    foreach (glob($path . '*', GLOB_MARK) as $file) {
        if (is_dir($file)) {
            reView($file, $tree->addChild($file, $file));
        } elseif (substr($file, -4, 4) === '.php') {
            $nodeFile =& $tree->addChild($file, $file . ' ' . selectPermissions('Set Permission', 'setPermission("' . $file . '",this);') . selectPermissions('Remove Permission', 'removePermission("' . $file . '",this);'));
            $nodeFile->addChild("View Permissions", '<div style="cursor:hand;" onclick="loadFile(&quot;' . htmlentities($file, ENT_QUOTES, 'UTF-8') . '&quot;,this.nextSibling);">View Permissions</div><div id="divPerms[' . htmlentities($file, ENT_QUOTES, 'UTF-8') . ']"></div>');
            $nodeFile->addChild("Add Line", '<a href="#" onclick="addPermission(&quot;' . htmlentities($file, ENT_QUOTES, 'UTF-8') . '&quot;,this.nextSibling.nextSibling);return false;">Add Permission</a><br/><input style="width:100%;"/>');
            $nodeFile->contracted = true;
        }
    }
}
Exemple #2
0
if (isset($_SESSION["TFU_IMAGE_MAGIC_PATH"])) {
    $image_magic_path = $_SESSION["TFU_IMAGE_MAGIC_PATH"];
} else {
    $image_magic_path = "convert";
}
if (isset($_SESSION["TFU_USE_IMAGE_MAGIC"])) {
    $use_image_magic = $_SESSION["TFU_USE_IMAGE_MAGIC"];
} else {
    $use_image_magic = false;
}
// default settings you should normally not change.
$bg_color_preview_R = 255;
$bg_color_preview_G = 255;
$bg_color_preview_B = 255;
$input_invalid = false;
setHeader();
@ob_start();
/**
 * * Needed for Https and IE!
 */
function setHeader()
{
    header("Pragma: I-hate-internet-explorer");
}
/*
function:debug()
*/
function debug($data)
{
    global $timezone;
    if (function_exists("date_default_timezone_set")) {
            $last_modify_by = $result_row->modified_by != "" ? $result_row->modified_by : "N/A";
            $last_modify_date = $result_row->maintain_date;
            $table .= '<tr>
                             <td align="center">' . $i . '</td>
                                 
                                
                                <td>' . $date . '</td>
                                <td>' . $user . '</td>
                                <td>' . $team . '</td>
                                <td>' . $task . '</td>
                                <td>' . $sub_task . '</td>
                                <td>' . $task_desc . '</td>
                                <td>' . $count . '</td>
                                <td>' . $time . '</td>
                                <td>' . $cmds . '</td>
                                
                                <td>' . $last_modify_by . '</td>
                                <td>' . $last_modify_date . '</td>';
            $table .= '</tr>';
            //<td>'.$ontime.'</td>
            $i++;
        }
        $table .= '</table>';
        //echo $table;
        //die();
        setHeader($file_name);
        echo $table;
    } else {
        echo "<div class='error'>No entries available!</div>";
    }
}
function setContentType($contentType)
{
    setHeader("Content-Type: {$contentType}");
}
Exemple #5
0
/**
 * resizeimage
 * 缩放图片,节省资源
 */
function resizeimage($filename, $w, $h = 0, $format = "jpg")
{
    if ($w <= 0 && $h <= 0) {
        notFound();
    }
    //    session_start();//读取session
    //    $etag = substr( md5($filename),0,8);
    //    if($_SERVER['HTTP_IF_NONE_MATCH'] == $etag){
    //        header('HTTP/1.1 304 Not Modified'); //返回304,告诉浏览器调用缓存
    //        exit();
    //    }else{
    //        header('Etag:'.$etag);
    //    };
    $etag = 'W/' . substr(md5($filename), 0, 8);
    header('Etag:' . $etag);
    $modified_time = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
    $time = 315360000;
    //10年缓存时间
    if (strtotime($modified_time) + $time > time()) {
        header('HTTP/1.1 304 Not Modified');
        //返回304,告诉浏览器调用缓存
        setHeader(strtotime($modified_time));
        //设置缓存
        exit;
    }
    $path = "/data/www/pic1{$filename}";
    if (!file_exists($path)) {
        notFound();
    }
    list($o_w, $o_h, $type) = getimagesize($path);
    if ($h <= 0) {
        $w = $o_w > $w ? $w : $o_w;
        $h = ceil($o_h * $w / $o_w);
    }
    if ($w <= 0) {
        $h = $o_h > $h ? $h : $o_h;
        $w = ceil($o_w * $h / $o_h);
    }
    switch ($type) {
        case 1:
            $src = imagecreatefromgif($path);
            break;
        case 2:
            $src = imagecreatefromjpeg($path);
            break;
        case 3:
            $src = imagecreatefrompng($path);
            break;
    }
    if (!$src) {
        notFound();
    }
    setHeader(time());
    //设置缓存
    $image = imagecreatetruecolor($w, $h);
    imagecopyresampled($image, $src, 0, 0, 0, 0, $w, $h, $o_w, $o_h);
    switch ($type) {
        case 1:
            header('Content-type: image/gif');
            imagegif($image);
            break;
        case 2:
            header('Content-type: image/jpg');
            imagejpeg($image, null, 100);
            break;
        case 3:
            header('Content-type: image/png');
            imagepng($image, null, 9);
            break;
    }
    imagedestroy($image);
    exit;
}
Exemple #6
0
 function response($template = null, $code = 200, $type = "text/html")
 {
     global $response;
     if (is_null($template)) {
         return $response;
     }
     setHeader("Content-Type", $type);
     statuscode($code);
     query_response("send", $template);
     return $response;
 }