예제 #1
0
파일: get.php 프로젝트: neurolit/jappix
 // Read the text file(s) (CSS & JS)
 if ($type == 'stylesheets' || $type == 'javascripts') {
     // Storage vars
     $last_modified = $output_data = null;
     // If there's a cache file, read it
     if (hasCache($cache_lang) && !$is_developer) {
         $last_modified = filemtime(pathCache($cache_lang));
         $cache_read = readCache($cache_lang);
         if ($deflate_support || !$has_compression) {
             $output_data = $cache_read;
         } else {
             $output_data = gzinflate($cache_read);
         }
     } else {
         // First try to read the cache reference
         if (hasCache($cache_hash) && !$is_developer) {
             // Read the reference
             $last_modified = filemtime(pathCache($cache_hash));
             $cache_reference = readCache($cache_hash);
             // Filter the cache reference
             if ($has_compression) {
                 $output = gzinflate($cache_reference);
             } else {
                 $output = $cache_reference;
             }
         } else {
             // Last modified date is now
             $last_modified = time();
             // Initialize the loop
             $looped = '';
             // Add the content of the current file
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
*/
chdir("..");
require_once "include/xrai.inc";
set_time_limit(360);
$file = $_REQUEST["file"];
$phpfilename = "{$xml_cache}/{$file}-treeview.php";
$xmlfilename = "{$xml_documents}/{$file}.xml";
$xslfilename = "xsl/treeview.xsl";
// $do_debug = true;
$tmpfile = "";
if ($dodebug || !hasCache($xmlfilename, $xslfilename, $phpfilename) || filesize($phpfilename) == 0) {
    @unlink($phpfilename);
    //print nl2br(htmlentities("$xmlcontent"));
    if (!file_exists($xmlfilename)) {
        fatal_error("File {$xmlfilename} does not exist");
    }
    $tmpfilename = "{$phpfilename}.tmp";
    $xslp = array("baseurl" => "{$base_url}/");
    if (!@xslt_process($xslt, "{$xmlfilename}", "{$xslfilename}", "{$tmpfilename}", $params, $xslp)) {
        @unlink("{$phpfilename}.tmp");
        fatal_error("XSLT error (1): " . xslt_error($xslt));
    }
    $phpfilename_cache = $phpfilename;
    $phpfilename = $tmpfilename;
}
if (!is_file("{$phpfilename}")) {
예제 #3
0
<?php

/**
 * $file : file full path 
 * $dir :  root directory 
 * $id : repository id 
 * $cache_file : cache file path 
 * $url_root : url based root path 
 * $relative_path : relative path of file 
 * 
 */
header('Content-Type: text/html');
if (!hasCache($file) || $is_new) {
    generateCache($file, HtmlPreprocessor(file_get_contents($file), 'markdown'));
}
outputCache($file);
예제 #4
0
파일: ts.php 프로젝트: juijs/store.jui.io
<?php

header('Content-Type: text/javascript');
if (!hasCache($file)) {
    $cache_file = getCache($file);
    system("tsc --outFile {$cache_file} {$file}");
    touchCache($file);
}
outputCache($file);
예제 #5
0
 if (!is_file($xmlfilename)) print "<div>$xmlfilename is not a valid file ?</div>\n";
if (!is_dir("$xml_cache/$path")) {

  $result = xslt_process($xslt,$xmlfilename,"$xslfilename")  ;
   if ($result) {
//     print "<div class='warning'>No cache directory was found</div>\n";
      eval("?>" . $result . "<?");
   } else {
      exit("xslt error: " . xslt_error($xslt));
   }
}

// We do have cache
else {
$phpfilename = "$xml_cache/$path/index.php";
if (!hasCache($xmlfilename,$xslfilename,$phpfilename) || filesize($phpfilename) == 0) {
  print "<div style='color: #888888;'>Processing (and caching) file with stylesheet</div>";
  @unlink($phpfilename);
  flush();
  //print nl2br(htmlentities("$xmlcontent"));

  $tmpfile = "$phpfilename.tmp";
//  print "\n($xmlfilename to $tmpfile)";
  if (!@xslt_process($xslt,$xmlfilename,"$xslfilename",$tmpfile,null,$xsl_params)) {
      @unlink($phpfilename);
      fatal_error("xslt error: " . xslt_error($xslt) . "</div>");
    }

  //  chdir($cwd);
  rename($tmpfile,$phpfilename) || $phpfilename = $tmpfile;
}
예제 #6
0
파일: logic.php 프로젝트: rynet/akstv
        }
    }
    return false;
}
function updateCache(&$broadcaster)
{
    file_put_contents("./cache/{$broadcaster['twitch']}", serialize($broadcaster));
}
$broadcastersOnline = array();
$broadcastersOffline = array();
$broadcasters = array(array('twitch' => 'aureusknightstv', 'twitter' => 'aureusknights', 'name' => 'Aureus Knights TV'), array('twitch' => 'okaria', 'twitter' => 'okaria', 'name' => 'Okaria Dragon'), array('twitch' => 'gagtech', 'twitter' => 'Gagtech', 'name' => 'Gagtech'), array('twitch' => 'chux81', 'twitter' => '', 'name' => 'Chux'), array('twitch' => 'ryath', 'twitter' => '', 'name' => 'Ryath'));
foreach ($broadcasters as &$broadcaster) {
    if (!$broadcaster) {
        continue;
    }
    if (!hasCache($broadcaster)) {
        if (!getTwitchStream($broadcaster)) {
            getTwitchChannel($broadcaster);
        }
        updateCache($broadcaster);
    }
    if ($broadcaster['online']) {
        $broadcastersOnline[] = $broadcaster;
        if ($startupChannel == null) {
            $startupChannel = (object) $broadcaster;
        }
    } else {
        $broadcastersOffline[] = $broadcaster;
    }
    if (is_string($startupChannel) && $startupChannel == $broadcaster['twitch']) {
        $startupChannel = (object) $broadcaster;