2011 tél-tavasz
global $user;
// change to the Drupal root directory so everything works normally
#chdir($_SERVER["PWD"]);
// bootstrap Drupal
require_once('includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$GLOBALS['conf']['cache'] = FALSE;
$slideshow = '';
$authparam = '';
//$_SERVER['HTTP_HOST'] == 'budavar.lutheran.hu' &&
//print_r($_SESSION);
//print_r($user);
if( $user->uid == 0 && $_SESSION['auth'] != 'yes' && $albumid != '5268281653246984321' && !preg_match("/alsogod|pecsko/", $_SERVER[REQUEST_URI])){
header("Location: http://".$_SERVER['HTTP_HOST']."/bejelentkezes?url=" . urlencode("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']));
exit;
}
if(!isset($user_me)){
if($_SERVER['HTTP_HOST'] == 'budavar.lutheran.hu'){
$user_me = "lelekhivatal";
}
else{
$user_me = "kriseknet";
}
}
if(isset($authkey)){
$authparam = "/?authkey=$authkey";
}
if(isset($albumname)){
$slideshow= "Slideshow" ;
}
?>
#fetch album content
$server_root = dirname($_SERVER['DOCUMENT_ROOT']);
define('MAGPIE_CACHE_DIR', "/var/www/drupal/sites/".$_SERVER['HTTP_HOST']."/tmp/magpie_cache");
define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
ini_set('user_agent', "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/9\r\nAccept-Language: en-us,en;q=0.5\r\nAccept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7");
require_once("/var/www/drupal//util/magpierss/rss_fetch.inc");
$mon_names = array();
$mon_names['Jan'] = 1;
$mon_names['Feb'] = 2;
$mon_names['Mär'] = 3;
$mon_names['Apr'] = 4;
$mon_names['Mai'] = 5;
$mon_names['Jun'] = 6;
$mon_names['Jul'] = 7;
$mon_names['Aug'] = 8;
$mon_names['Sep'] = 9;
$mon_names['Okt'] = 10;
$mon_names['Nov'] = 11;
$mon_names['Dez'] = 12;
//one feed wired in
$feeds = array();
if(isset($authkey)){
$feeds[0] .= "&authkey=$authkey";
}
$events = array();
$lines = array();
$rss = (object) array('items' => array());
#echo $_SERVER['DOCUMENT_ROOT']."/sites/".$_SERVER['HTTP_HOST']."/albums/${albumid}/index.html";
if(! file_exists($_SERVER['DOCUMENT_ROOT']."/sites/".$_SERVER['HTTP_HOST']."/albums/${albumid}/index.html")){
$rss = fetch_rss("http://picasaweb.google.com/data/feed/base/user/$user_me/albumid/$albumid?alt=rss&kind=photo&hl=en_US&authkey=$authkey");
if(count($rss->items) == 0){
$url = "http://".$_SERVER['HTTP_HOST']."/sites/".$_SERVER['HTTP_HOST']."/albums/${albumid}.rss";
//echo "go for plan b $url ";
$rss = fetch_rss($url);
}
}
else{
$lines = file($_SERVER['DOCUMENT_ROOT']."/sites/".$_SERVER['HTTP_HOST']."/albums/${albumid}/index.html");
foreach($lines as $line){
if(preg_match('/IMG src=\"([^\"]+)/',$line,$matches)){
$thumbURL = $matches[1];
$imageURL = preg_replace('/\.thumb/', '.slide',$thumbURL);
if(preg_match('/title=\"([^\"]+)\"/i',$line,$matches)){
//$title = $matches[1];
}
array_push($rss->items, array('title' => $title, 'title_short' => $title,'thumbURL' => "/sites/".$_SERVER['HTTP_HOST']."/albums/${albumid}/$thumbURL", 'imageURL' => "/sites/".$_SERVER['HTTP_HOST']."/albums/${albumid}/$imageURL"));
}
}
}
?>
foreach ($rss->items as $item) {
//echo "$item read...
"; if($item[thumbURL] == '' && preg_match('/src=\"([^\"]+)\"/', $item[description], $match)){ $imageURL = str_replace('s288','s1024',$match[1]); $thumbURL = str_replace('s288','s144',$match[1]); } else{ $imageURL = $item[imageURL]; $thumbURL = $item[thumbURL]; } ?> } ?>
"; if($item[thumbURL] == '' && preg_match('/src=\"([^\"]+)\"/', $item[description], $match)){ $imageURL = str_replace('s288','s1024',$match[1]); $thumbURL = str_replace('s288','s144',$match[1]); } else{ $imageURL = $item[imageURL]; $thumbURL = $item[thumbURL]; } ?> } ?>