direct($_)); exit; } $extra_keywords[] = cleanname($_['ofilename']); }else{ $alburl = $mlPictureURL->album($albumId); $error_message="Image can't be found. Go to the containing album"; $noindex=true; } } if($mode=="recent"){ $is_public = true; }else if($albumId){ $album = getAlbumInfo($albumId); if($album){ if($album["Access_type"] == "Public"){ $is_public = true; } $alname = $album["albumname"]; $UserId = $album["clientId"]; if(($albumId==1 && getRequestVar('viewall')!=1)&&!$_SESSION['IsAdmin']){ die("No album selected"); } if($code = getRequestVar('albumcode')){ if($album['password'] && $code == md5('album'.$album['Id'].'-'.$album['password'])){ $k = "granted_albumids"; if(!is_array($_SESSION[$k])){ $_SESSION[$k] = array(); } $_SESSION[$k] []= $album['Id']; go($mlPictureURL->album($album)); } } $title = $alname." ".ml_translate('photo album'); $extra_keywords[] = $alname; }else{ header("HTTP/1.0 404 File Not Found"); $error_message="Can't show this album. It either does not exist anymore or you do not have access to it."; $noindex=true; } }else if($catId!==null){ $category['Id'] = $catId; $category['name'] = $CATEGORIES[$catId]; $title = $category['name']; $extra_keywords[] = $title; }else if($tagName && $UserId){ $mode = "tag"; if(get_magic_quotes_gpc()) $tagName = stripslashes($tagName); $tag = array('tagname' => $tagName, 'userid' => $UserId); $is_public = true; }else if($tagName){ $mode = "tagname"; $is_public = true; if(get_magic_quotes_gpc()) $tagName = stripslashes($tagName); $tag = array('tagname' => $tagName); $title = $tagName." ".ml_translate('photos'); $description = ucfirst(ml_translate('all')).' '.$title.' '.ml_translate('tagged_by_members_of').' '.SITE_NAME; $extra_keywords[] = $tagName; $extra_keywords[] = $title; }else if($date){ $mode = "date"; $title = ml_translate("all_photos_taken_on")." ".format_date($date); $description = ucfirst($title).' '.ml_translate('on').' '.SITE_NAME; $extra_keywords[] = ml_translate("taken"); $extra_keywords[] = format_date($date); }else if($q){ $mode = "search"; $is_public = true; $title = $q; $search = search(); # do search allready here, because later session is closed :S } loggedin(); # make sure PermLogin is checked before session is closed session_write_close(); $t3 = microtime(true); $user_no_ads = false; if($UserId){ $AccountUser = getUser($UserId); }else if(!is_system_subdomain($subdomain)){ $AccountUser = get_subdomain_user($subdomain); }else if($imgId){ $_ = getImageInfo($imgId); if($_){ $_ = getUser($_['userid']); if($_['Id']!=1){ $AccountUser = $_; } } } if($AccountUser){ $_REQUEST["clid"] = $AccountUser['Id']; $_GET["clid"] = $AccountUser['Id']; $skin = $AccountUser['pref_skin']; $title = ($title?($title.' '.ml_translate('owned_by').' '):'').ucfirst($AccountUser['username']); if($description){ $description .= ' '.ml_translate('owned_by').' '.ucfirst($AccountUser['username']); } $extra_keywords[] = $AccountUser['username']; $user_no_ads = $AccountUser['no_ads']; } /////////////////////////////////////////////////////////////// if($page_path=="/tag"){ // redirect to properly formatted url for SEO purposes if($tagName!= ucwords(strtolower($tagName)) ){ header("HTTP/1.1 301 Moved Permanently"); $p=""; $_ = getRequestVar('page',1); if($_>1){ $p= "?page=".$_; } go($mlPictureURL->tag($tagName).$p); die(); } } if(!DEBUG && (is_system_subdomain($subdomain) || !$AccountUser)){ if($subdomain!="nl" && $subdomain !="en" && $subdomain !="fr"&& $subdomain && $subdomain != "sq"){ header("HTTP/1.1 301 Moved Permanently"); header("Location: ".site_root().$_SERVER["REQUEST_URI"]); die(); } } if($page_path=="/" && $AccountUser){ $page_path = "/account_index"; } $pages = array( "/" => array("redirect" => "/home"), "/weblog" => array("template" => "weblog/weblog", "key" => "weblog"), "/home" => array("template" => "index", "key" => "explore.home"), "/explore" => array("template" => "explore", "key" => "explore.all"), "/category" => array("template" => "category", "key" => "explore.categories"), "/tags" => array("template" => "tags", "key" => "explore.tags"), "/members" => array("template" => "members", "key" => "explore.members"), "/tools" => array("template" => "tools", "key" => "tools.main"), "/updated" => array("template" => "updated", "key" => "explore.updated"), "/account_index" => array("template" => "account_index", "key" => "album".$AccountUser['Id']), "/all_albums" => array("template" => "all_albums", "key" => "album".$AccountUser['Id']), "/album" => array("template" => "album", "key" => "album".$AccountUser['Id']), "/tag" => array("template" => "tag", "key" => ($AccountUser['Id']? "tag".$AccountUser['Id']:"explore.tags" )), "/all" => array("template" => "all", "key" => "all".$AccountUser['Id']), "/upload" => array("template" => "upload", "key" => "up.multiple"), "/taken" => array("template"=>"taken", "key" => ($AccountUser['Id']? "taken.".$AccountUser['Id']:"explore.calendar.date")), "/calendar" => array("template"=>"calendar", "key" => ($AccountUser['Id']? "taken.".$AccountUser['Id']:"explore.calendar")), "/profile" => array("template" => "profile", "key" => "profile".$AccountUser['Id']), "/editprofile" => array("template" => "editprofile", "key" => "editprofile".$AccountUser['Id']), "/favorites" => array("template" => "favorites", "key" => "favorites".$AccountUser['Id']), "/comments" => array("template" => "comments", "key" => "comments".$AccountUser['Id']), "/friends" => array("template" => "friends", "key" => "friends".$AccountUser['Id']), "/tour" => array("template" => "tour", "key" => "tour"), "/upa" => array("template" => "upa", "key" => "up.anonymous"), "/up" => array("template" => "up", "key" => "up.album"), "/recent_video" => array("template" => "blocks/recent_video"), "/recent_images" => array("template" => "blocks/recent_images"), "/recent_friend_images" => array("template" => "blocks/recent_friend_images"), "/help" => array("template" => "help", "key" => "support.help"), "/accessedit" => array("template" => "dialogs/accessedit"), "/dialog.move" => array("template" => "dialogs/move") , "/dialog.crop" => array("template" => "dialogs/crop") , "/dialog.resize" => array("template" => "dialogs/resize"), "/dialog.albumorder" => array("template" => "dialogs/albumorder") ); do{ $page = $pages[$page_path]; if($page['redirect']){ $page_path = $page['redirect']; } }while($page['redirect']); if(!$page){ $page = array("template" => $page_path, "key" => substr($page_path,1)); } /////////////////////////////////////////////////////////////// $menus = array( 'utils' => array( array('href' => $mlPictureURL->explore(), 'label' => ml_translate('Explore'), 'key' => 'explore'), // more, see below ), 'standard' => array( // array('href' => $mlPictureURL->tools(), 'label' => "Tools", 'key' => 'tools'), array('href' => $mlPictureURL->help(), 'label' => "Help", 'key' => 'support'), // array('href' => $mlPictureURL->forum(), 'label' => "Forum", 'key' => 'support.forum') ), 'explore' => array( array('href' => $mlPictureURL->root_page(), 'label' => ml_translate("Home"), 'key' => 'explore.home'), array('href' => $mlPictureURL->explore(), 'label' => ml_translate('Explore'), 'key' => 'explore.all'), /*array('href' => $mlPictureURL->explore_photo(), 'label' => STR_PHOTOS, 'key' => 'explore.photo'), array('href' => $mlPictureURL->explore_video(), 'label' => STR_VIDEOS, 'key' => 'explore.video'),*/ array('href' => $mlPictureURL->updated(), 'label' => ml_translate('Updated'), 'key' => 'explore.updated'), /* array('href' => $mlPictureURL->categories(), 'label' => ml_translate('Categories'), 'key' => 'explore.categories'), */ /* array('href' => $mlPictureURL->tags(), 'label' => ml_translate('Tags'), 'key' => 'explore.tags'), */ array('href' => $mlPictureURL->calendar(), 'label' => ml_translate('Calendar'), 'key' => 'explore.calendar'), array('href' => $mlPictureURL->explore_comments(), 'label' => ml_translate('Comments'), 'key' => 'explore.comments'), array('href' => $mlPictureURL->members(), 'label' => ml_translate('Members'), 'key' => 'explore.members'), ), /* 'members' => array( array('href' => $mlPictureURL->members(), 'label' => STR_MEMBERS, 'key' => 'members.list') ), */ /* 'tools' => array( array('href' => $mlPictureURL->tools(), 'label' => "Tools", 'key' => 'tools.main') ), */ 'support' => array(), 'user' => array(), 'personal' => array(), 'upload' => array( array('href' => $mlPictureURL->upload(), 'label' => ml_translate('to_my_album'), 'key' => 'up.album'), array('href' => $mlPictureURL->upa(), 'label' => ml_translate('anonymous'), 'key' => 'up.anonymous'), ) ); if($AccountUser){ $u = $AccountUser; $menus['user'] = array( array('href' => $mlPictureURL->account_page($u), 'label' => ml_translate('Albums'), 'key' => 'album'.$u['Id']), array('href' => $mlPictureURL->all($u), 'label' => ml_translate('All'), 'key' => 'all'.$u['Id']), array('href' => $mlPictureURL->calendar($u), 'label' => ml_translate('Calendar'), 'key' => 'taken.'.$u['Id']), array('href' => $mlPictureURL->profile($u), 'label' => ml_translate('Profile'), 'key' => 'profile'.$u['Id']), array('href' => $mlPictureURL->favorites($u), 'label' => ml_translate('Favorites'), 'key' => 'favorites'.$u['Id']) ); } if(loggedin()){ $u2 = $_SESSION["User"]; $menus['personal'] = array( array('href' => $mlPictureURL->account($u2), 'label' => ml_translate('Albums'), 'key' => 'album'.$u2['Id']), /*array('href' => $mlPictureURL->upload($u2), 'label' => STR_UPLOAD, 'key' => 'up'),*/ array('href' => $mlPictureURL->editprofile($u2), 'label' => ml_translate('Profile'), 'key' => 'editprofile'.$u2['Id']), array('href' => $mlPictureURL->friends($u2), 'label' => ml_translate('Friends'), 'key' => 'friends'.$u2['Id']), array('href' => $mlPictureURL->favorites($u2), 'label' => ml_translate('Favorites'), 'key' => 'favorites'.$u2['Id']), array('href' => $mlPictureURL->comments($u2), 'label' => ml_translate('Comments'), 'key' => 'comments'.$u2['Id']) ); if($u2['usertype']!='p'){ $menus['standard'][] = array('href' => $mlPictureURL->upgrade(), 'label' => "Upgrade", 'key' => 'upgrade'); } }else{ $menus['utils'][] = array('href' => $mlPictureURL->signup(), 'label' => ml_translate('Signup'), 'key' => 'signup'); $menus['standard'][] = array('href' => $mlPictureURL->tour(), 'label' => ml_translate('Learn_more'), 'key' => 'tour'); } $menus['utils'][] = array('href' => $mlPictureURL->upload(), 'label' => ml_translate('Upload'), 'key' => 'up'); // down here to keep order correct /* array('href' => SITE_ROOT.'tools.php', 'label' => STR_TOOLS, 'key' => 'tools'), */ $mtitles = array(); foreach($menus as $key => $val){ $parts = explode('.', $page['key']); foreach($val as $k => $v){ $menus[$key][$k]['active'] = isActive($menus[$key][$k]['key'], $parts); if($menus[$key][$k]['active'] && (sizeof($mtitles)==0 || $menus[$key][$k]['label'] != $mtitles[sizeof($mtitles)-1])){ $mtitles[] = $menus[$key][$k]['label']; } } } $mtitles = implode(" - ", array_reverse($mtitles)); $pageind = ''; if(($_ = getRequestVar('page'))>1){ $pageind=' - '.ml_translate('Page').' '.$_; } $mtitles .= $pageind; if (isset($seo[$lang][$page['key']]) && !$title) { $seo_meta = $seo[$lang][$page['key']]; $slogan=$seo_meta['title']; $keywords=$seo_meta['keywords']; $description=$seo_meta['description']; $slogan.=$pageind; $description .= $pageind; }else if(!isset($seo[$lang][$page['key']]) && !$title){ $keywords = META_KEYWORDS; $description = META_DESCRIPTION; $description .= $pageind; }else{ $keywords = META_KEYWORDS; $title.=$pageind; } if($extra_keywords){ $keywords = implode(', ',$extra_keywords).', '.$keywords; } function isActive($key, $parts=null){ global $page; if(!$parts)$parts = explode('.',$page['key']); // return ($page['key']==$key) || in_array($key, $parts); return ($page['key']==$key) || (substr($page['key'],0,strlen($key))==$key && strlen($key)<=strlen($page['key']) ); } function getMenu($key){ global $menus; return create_dataset($menus[$key]); } /////////////////////////////////////////////////////////////// $ad_formats = array("120x240" => array('width' => 120, 'height'=>240,'format' => "120x240_as"), "728x90" => array('width' => 728, 'height' => 90, 'format' => "728x90_as")); $f = $ad_formats["120x240"]; if($ADD_FORMAT) $f = $ad_formats[$ADD_FORMAT]; $catData = array(); foreach($CATEGORIES as $key => $val){ $catData[] = array('Id' => $key, 'name' => $val); } $a = ml_translate("Ascending"); $d=ml_translate("Descending"); $s_u=ml_translate("updated date"); $s_cd=ml_translate("creation date"); $s_n=ml_translate("name"); $s_ud=ml_translate("Upload date"); $s_dt=ml_translate("Date taken"); $albumOrders = create_assoc_dataset( array( 'updated desc' => $s_u.', '.$d, 'updated asc' => $s_u.', '.$a, 'creationdate desc' => $s_cd.', '.$d, 'creationdate asc' => $s_cd.', '.$a, 'albumname desc' => $s_n.', '.$d, 'albumname asc' => $s_n.', '.$a ) ); $imageOrders = create_assoc_dataset( array( 'uploaddate DESC' => $s_ud.', '.$d, 'uploaddate ASC' => $s_ud.', '.$a, 'ofilename DESC' => $s_n.', '.$d, 'ofilename ASC' => $s_n.', '.$a, 'takendate DESC' => $s_dt.', '.$d, 'takendate ASC' => $s_dt.', '.$a ) ); $formatData = create_assoc_dataset( array( '32c' => '32x32', '64c' => '64x64', '100c' => '100x100', '220' => '220', 'oimg' => 'small', '480' => '480', '640' => '640', '800' => '800', '1024' => '1024', 'img' => 'full', ) ); if(empty($_REQUEST['offset'])){ $_REQUEST['offset'] = $_REQUEST['imgpage']; } $data = array( 'globals'=>$GLOBALS, 'no_ads' => (defined('NO_ADS') && NO_ADS) || $user_no_ads, 'error' => $error_message, 'meta_noindex'=> $noindex, 'warning' => $warning, 'page' => array( 'slogan' => $slogan, 'title' => $title, 'keywords'=>$keywords, 'description'=>$description, 'titlepath' => $mtitles, 'lang' => $lang, 'domain' => $domain, 'User' => $AccountUser, 'path' => $page_path, 'skin' => $skin, 'album' => $album, 'tag' => $tag, 'date' => $date, 'category' => $category, 'ad' => $f, 'public' => $is_public ), 'config' => array( 'IMAGE_EXT' => $IMAGE_EXT, 'MOVIE_EXT' => $MOVIE_EXT, 'COUNTRIES' => create_assoc_dataset($COUNTRIES), 'LANGUAGES' => create_assoc_dataset($LANGUAGES), 'SKINS' => create_assoc_dataset($SKINS), 'FORMATS' => $formatData, 'CATEGORIES' => $catData, 'ALBUM_ORDERS' => $albumOrders, 'IMAGE_ORDERS' => $imageOrders ), 'urls' => $mlPictureURL, 'api' => $mlPictureAPI, 'show' => $mlPictureRender, 'session' => $_SESSION, 'get' => $_GET, 'post' => $_POST, 'request' => $_REQUEST ); $t4 = microtime(true); echo $mlTemplateManager->render($page['template'], $data); $t5 = microtime(true); $td = $t5-$t0; /* //this is too much mail if($td<30 && $td>1){ mail("errors@movinglabs.com","PicturePush Debug Slow Page serve",number_format($td,3)." = ".number_format($t1-$t0,3)." ".number_format($t2-$t1,3)." ".number_format($t3-$t2,3)." ".number_format($t4-$t3,3)." ".number_format($t5-$t4,3) . "\n\n ".$query_count." queries in ". number_format($query_time,3). " connected after ".number_format($db_conn_time,3) . "\n\n ".implode("\n",$query_log) . "\n\n ".print_r($times_log,true) ."\n\n URL: ".$_SERVER["REQUEST_URI"] ."\n\n User id: ".$_SESSION["UserId"].", ip: ".$_SERVER["REMOTE_ADDR"]); } */ ?>