コード例 #1
0
ファイル: index.php プロジェクト: htom78/limonade
 function image_show_jpeg_only()
 {
   $ext = file_extension(params(0));
   $filename = option('public_dir').params(0);
   if(params('size') == 'thumb') $filename .= ".thb";
   $filename .= '.jpg';
 
   if(!file_exists($filename)) halt(NOT_FOUND, "$filename doesn't exists");
   render_file($filename);
 }
コード例 #2
0
function render_docs()
{
    if (isset($_GET['view']) && !empty($_GET['view'])) {
        $filename = $_GET['view'];
        $filename = preg_replace('{[\\/]}', ' ', $filename);
        echo render_file($filename);
    } else {
        echo render_file('home');
        echo "\n<hr>\n<h3>List of Wiki files</h3>\n";
        render_file_list();
    }
}
コード例 #3
0
ファイル: index.php プロジェクト: nsystem1/leaderboard
/**
 * 404 error page.
 */
function not_found($errno, $errstr, $errfile = null, $errline = null)
{
    if (strpos($errstr, '/public/soft_images/') !== false) {
        render_file('public/img/down.png');
        return;
    }
    before();
    set('errno', $errno);
    set('errstr', $errstr);
    set('errfile', $errfile);
    set('errline', $errline);
    layout('layout.php');
    return html('404.php');
}
コード例 #4
0
ファイル: limonade.php プロジェクト: plus3network/PHPHelpers
/**
 * Internal controller that responds to route /_lim_public/**
 *
 * @access private
 * @return void
 */
function render_limonade_file()
{
    $fpath = file_path(option('limonade_public_dir'), params('_lim_public_file'));
    return render_file($fpath, true);
}
コード例 #5
0
ファイル: index.php プロジェクト: BackupTheBerlios/pdeb-svn
<?php

function render_file($file)
{
    $x = file($file);
    foreach ($x as $line) {
        $res .= $line;
    }
    return $res;
}
# header.txt
echo render_file('header.txt');
echo "<h2>Saltar para o processo:</h2>\n";
echo "<ul>\n";
echo "<li><a href=\"ts.php\">d-i e manual</a></li>\n";
echo "<li><a href=\"debconf.php\">debconf</a></li>\n";
echo "</ul>\n";
echo "<p>Para obter todos os ficheiros que concebem este site:</p>\n";
echo "<div><code>shell\$ svn checkout svn://svn.berlios.de/pdeb/trunk<code></div>\n";
echo "<div><code>shell\$ svn checkout http://svn.berlios.de/svnroot/repos/pdeb/trunk<code></div>\n";
# footer.txt
echo render_file('footer.txt');
?>

コード例 #6
0
ファイル: index.php プロジェクト: karupanerura/isucon4
        $user = $cols[1];
        $agent = $cols[2];
        $user_attr = decode_user_key($user);
        $result[$ad_id][] = ['ad_id' => $ad_id, 'user' => $user, 'agent' => $agent, 'age' => $user_attr['age'], 'gender' => $user_attr['gender']];
    }
    fclose($fp);
    return $result;
}
dispatch_get('/', function () {
    return render_file(option('public_dir') . '/index.html');
});
dispatch_get('/index.html', function () {
    return render_file(option('public_dir') . '/index.html');
});
dispatch_get('/view.html', function () {
    return render_file(option('public_dir') . '/view.html');
});
dispatch_post('/slots/:slot/ads', function () {
    $advertiser_id = advertiser_id();
    if (empty($advertiser_id)) {
        return halt(400);
    }
    $slot = params('slot');
    $asset = $_FILES['asset'];
    $dir = get_dir('upload');
    $tmp_path = $dir . sprintf('/upload-%s', sha1_file($asset['tmp_name']));
    if (!move_uploaded_file($asset['tmp_name'], $tmp_path)) {
        throw new RuntimeException('Failed to move uploaded file.');
    }
    $id = next_ad_id();
    $key = ad_key($slot, $id);
コード例 #7
0
            $minifiedPathname = TMP_DIR . 'minify' . substr($filename, strlen($modulePath));
            if (file_exists($minifiedPathname) == false || filemtime($minifiedPathname) < filemtime($filename)) {
                // Is het cache bestand niet up2date?
                require_once $modulePath . '/core/bootstrap.php';
                if ($extension === 'js') {
                    $minified = \JSMinPlus::minify(file_get_contents($filename), $filename);
                } elseif ($extension === 'css') {
                    $minified = \CssMin::minify(file_get_contents($filename));
                } else {
                    $minified = ImageOptimizer::minify(file_get_contents($filename), $filename);
                }
                mkdirs(dirname($minifiedPathname));
                if ($minified === false) {
                    // Minify failed?
                    copy($filename, $minifiedPathname);
                    // Use full version
                } else {
                    file_put_contents($minifiedPathname, $minified);
                }
            }
            render_file($minifiedPathname);
        }
        render_file($filename);
        // Render het gewone bestand.
    }
}
define('Sledgehammer\\WEBPATH', $webpath);
$folderCount = preg_match_all('/[^\\/]+\\//', substr($uriPath, strlen(WEBPATH)), $match);
define('Sledgehammer\\WEBROOT', str_repeat('../', $folderCount));
//unset($urlPath, $publicFile, $fullpath, $folderCount, $math, $folders, $folder, $files, $filename);
return true;
コード例 #8
0
	}).done(function(result) {
		$('#downloads').empty();
		$.each(result.data, function(index, value) {
			$('#downloads').append(
				'<li><a href="' + value.html_url
				+ '">' + value.name 
				+ '</a> - ' + value.description + '</li>');
		});
	});
});
//]]>
</script>

<div id="changelog">
<?php 
echo render_file('Changelog', '<h2><a href="/docs/changelog">$title</a></h2>');
?>
</div>

<h3>Source Packages</h3>

<p>The most recent source package is in the master branch of the 
<a href="<?php 
echo $GIT_REPO_PREFIX;
?>
/arden2bytecode">Git repository</a>.<br>Clone with:</p>
<pre><code>$ git clone <?php 
echo $GIT_REPO_PREFIX;
?>
/arden2bytecode.git
</code></pre>
コード例 #9
0
ファイル: 02-outputs.php プロジェクト: sniemela/limonade
function jpeg_file()
{
    return render_file(dirname(dirname(__FILE__)) . '/data/deer.jpg');
}
コード例 #10
0
ファイル: Home.php プロジェクト: DigiTechs/Fetch
									<div class="card-image">
										<img ng-src="{{project.image}}?cache={{project.id}}">
									</div>
									<div class="card-content">
										<span class="card-title truncate"><a ng-href="<?php 
echo URL('Project');
?>
?id={{project.id}}" ng-bind-template="{{project.name}}">Unknown Project</a></span>
										<span class="by-line">By <a ng-href="<?php 
echo URL('User');
?>
?id={{project.creator.id}}" ng-bind-template="{{project.creator.name}}">Unknown User</a></span>
									</div>
								</div>
							</div>
						</div>
					</div>
				</section>
			</div>
		</main>
		<?php 
require_once __DIR__ . '/Shared/Partials/Footer.php';
?>
		<?php 
require_once __DIR__ . '/Shared/Partials/Scripts.php';
?>
		<?php 
echo render_file('Scripts/Home.js');
?>
	</body>
</html>
コード例 #11
0
ファイル: captured.php プロジェクト: csexton/captured-php
    if ($_POST['test'] == "true") {
        http_response_code(202);
        jecho(['status' => "202 Accepted"]);
        exit;
    }
}
function process_file_upload()
{
    global $UPLOAD_DIR;
    if (!is_dir($UPLOAD_DIR)) {
        mkdir($UPLOAD_DIR);
    }
    header('Content-Type: application/json');
    $protocol = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
    $ext = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
    $upload_name = randomish() . '.' . $ext;
    $upload_file = join_paths($UPLOAD_DIR, $upload_name);
    $public_url = $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . "/?i=" . $upload_name;
    if (move_uploaded_file($_FILES['file']['tmp_name'], $upload_file)) {
        jecho(["public_url" => $public_url]);
    } else {
        jecho(['error' => "Unable to process file upload"]);
    }
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    enforce_token();
    process_test_connection();
    process_file_upload();
} else {
    render_file();
}
コード例 #12
0
function _render_file_with_http_cache($path)
{
    if (file_exists($path)) {
        if (option('http_cache')) {
            $modified_timestamp = filemtime($path);
            if ($modified_timestamp) {
                http_cache($modified_timestamp);
            }
        }
        render_file($path);
    } else {
        halt(NOT_FOUND);
    }
}