Permalink
Browse files

adding a config to set the pad url

  • Loading branch information...
1 parent 43e3de7 commit 713c287bc71923ae0153509197047cc1fc775afa @qzio qzio committed Aug 5, 2011
Showing with 11 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +9 −3 cached_programme.php
  3. +1 −0 config.template.php
View
@@ -0,0 +1 @@
+config.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);
View
@@ -0,0 +1 @@
+<?php define('PAD_URL','http://padurl');

0 comments on commit 713c287

Please sign in to comment.