Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding a config to set the pad url

  • Loading branch information...
commit 713c287bc71923ae0153509197047cc1fc775afa 1 parent 43e3de7
joel hansson qzio authored
Showing with 11 additions and 3 deletions.
  1. +1 −0  .gitignore
  2. +9 −3 cached_programme.php
  3. +1 −0  config.template.php
1  .gitignore
View
@@ -0,0 +1 @@
+config.php
12 cached_programme.php
View
@@ -1,5 +1,10 @@
<?php
+if (is_readable('config.php')) {
+ require 'config.php';
+} else {
+ die('unable to read config file');
+}
require_once 'Cache/Lite.php';
$options = array(
'cacheDir' => sys_get_temp_dir().'/',
@@ -14,7 +19,9 @@ function getcached( $url )
$id = base64_encode($url);
if ( ! ($data = $Cache_Lite->get($id)) ) {
//shell_exec("echo 'cacheing {$url}' >> /tmp/pad.log");
- $data = file_get_contents($url);
+ if ( ! $data = @file_get_contents($url) ) {
+ die('unable to cache the programe...');
+ }
$extra_head = <<<EOFSTR
<head>
<title>PADDAN</title>
@@ -38,8 +45,7 @@ function getcached( $url )
function on_get( $params = array() )
{
//@todo fix this as a config variable or something!
- $url = 'http://a.pad.url';
-}
+ $url = PAD_URL;
$content = getcached($url);
1  config.template.php
View
@@ -0,0 +1 @@
+<?php define('PAD_URL','http://padurl');
Please sign in to comment.
Something went wrong with that request. Please try again.