Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
92 changed files
with
21,760 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<?php | ||
/** | ||
* Flogr config settings | ||
* | ||
* @author Mike Carruth <mikecarruth@gmail.com> | ||
* @version 2.5.7 | ||
* @package Flogr | ||
* @link http://flogr.googlecode.com | ||
*/ | ||
|
||
/** | ||
* Your Flickr user id and/or group id | ||
* | ||
* Note: A flickr id (not name) is needed. You can lookup your id at | ||
* http://idgettr.com/. | ||
* | ||
* User id only - | ||
* Provide only your flickr user id and flogr will use the user photostream | ||
* | ||
* Group id only - | ||
* Provide only your flickr group id and flogr will use the group photostream | ||
* | ||
* User and Group id - | ||
* Provide both your user and group ids and flogr will show only the photos | ||
* you have posted to the given group. | ||
*/ | ||
OPTIONAL_SETTING('FLICKR_USER_ID', '95137114@N00'); | ||
OPTIONAL_SETTING('FLICKR_GROUP_ID', ''); | ||
//OPTIONAL_SETTING('FLICKR_USER_ID', ''); | ||
//OPTIONAL_SETTING('FLICKR_GROUP_ID', '82648219@N00'); | ||
|
||
/** | ||
* Site settings | ||
*/ | ||
REQUIRED_SETTING('SITE_TITLE', 'Flogr'); | ||
REQUIRED_SETTING('SITE_DESCRIPTION', 'A photoblog application built on Flickr'); | ||
REQUIRED_SETTING('SITE_THEME', 'blackstripe'); | ||
REQUIRED_SETTING('SITE_THEME_PATH', 'themes/' . SITE_THEME . '/'); | ||
$url = "http://". $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI']; | ||
REQUIRED_SETTING('SITE_URL', substr($url, 0, strrpos($url, "/"))); | ||
|
||
/************************************************************************ | ||
* Flogr settings | ||
************************************************************************/ | ||
|
||
/* EXIF tags to include */ | ||
REQUIRED_SETTING('FLOGR_EXIF', 'Make,Model,Software,Exposure,Aperture,Shutter Speed,ISO Speed,Flash'); | ||
|
||
/* | ||
* Quality (resolution) of the photo on the main photo page. Can me: | ||
* | ||
* Square: Small square 75x75 | ||
* Thumbnail: 100 on longest side | ||
* Small: 240 on longest side | ||
* Medium: 500 on longest side | ||
* Medium640: 640 on longest side | ||
* Large: 1024 on longest side | ||
* Original: Original size | ||
* | ||
* Note: Before May 25th 2010 large photos only exist for very large original | ||
* images. Also I highly recommend against setting this to "Original" since | ||
* it can take considerably longer to download high resolution original photos | ||
* and it is unecessary since the photos will be scaled down to | ||
* FLOGR_MAIN_PHOTO_SIZE anyway. | ||
*/ | ||
REQUIRED_SETTING('FLOGR_PHOTO_QUALITY', 'Medium640'); | ||
|
||
/* Desired width of main photo */ | ||
REQUIRED_SETTING('FLOGR_MAIN_PHOTO_SIZE', 750); | ||
|
||
/* | ||
* Quality (resolution) of the photo in the slideshow. Can me: | ||
* | ||
* Square: Small square 75x75 | ||
* Thumbnail: 100 on longest side | ||
* Small: 240 on longest side | ||
* Medium: 500 on longest side | ||
* Medium640: 640 on longest side | ||
* Large: 1024 on longest side | ||
* Original: Original size | ||
* | ||
* Note: Before May 25th 2010 large photos only exist for very large original | ||
* images. Also I highly recommend against setting this to "Original" since | ||
* it can take considerably longer to download high resolution original photos. | ||
*/ | ||
REQUIRED_SETTING('FLOGR_SLIDESHOW_PHOTO_QUALITY', 'Medium640'); | ||
|
||
/* Photosets to include - separate multiple sets with commas. */ | ||
OPTIONAL_SETTING('FLOGR_PHOTOSETS_INCLUDE', ''); | ||
|
||
/* Number of tags to include in the tag cloud */ | ||
REQUIRED_SETTING('FLOGR_TAGS_COUNT', 200); | ||
|
||
/* Tags to include - separate multiple tags with commas */ | ||
OPTIONAL_SETTING('FLOGR_TAGS_INCLUDE', ''); | ||
|
||
/* Hide FLOGR_TAGS_INCLUDE from tag cloud */ | ||
OPTIONAL_SETTING('FLOGR_TAGS_INCLUDE_HIDE', ''); | ||
|
||
/* PHP date format - http://us2.php.net/date */ | ||
REQUIRED_SETTING('FLOGR_DATE_FORMAT', 'F j, Y'); | ||
|
||
/* Set to true to use date taken - false to use date uploaded */ | ||
REQUIRED_SETTING('FLOGR_SHOW_DATE_TAKEN', true); | ||
|
||
/* Number of thumbnails to show on the 'recent' page */ | ||
REQUIRED_SETTING('FLOGR_THUMBNAILS_PER_PAGE', 48); | ||
|
||
/** | ||
* The order in which to sort returned photos. Deafults to date-posted-desc | ||
* (unless you are doing a radial geo query, in which case the default sorting | ||
* is by ascending distance from the point specified). The possible values are: | ||
* date-posted-asc, date-posted-desc, date-taken-asc, date-taken-desc, | ||
* interestingness-desc, interestingness-asc, and relevance. | ||
*/ | ||
OPTIONAL_SETTING('FLOGR_SORT', ''); | ||
|
||
/* Log level */ | ||
|
||
/** | ||
* Constants | ||
*/ | ||
define('FLOGR_LOG_NONE', 0); | ||
define('FLOGR_LOG_ERR', 1); | ||
define('FLOGR_LOG_WARNING', 2); | ||
define('FLOGR_LOG_DEBUG', 3); | ||
REQUIRED_SETTING('FLOGR_LOG_LEVEL', FLOGR_LOG_ERR); | ||
|
||
/** | ||
* Cache Settings | ||
* | ||
* To improve performance flogr can be configured to cache photos to a MySql database | ||
* or to the web server. | ||
*/ | ||
OPTIONAL_SETTING('CACHE_SQL_USER', ''); | ||
OPTIONAL_SETTING('CACHE_SQL_PASSWORD', ''); | ||
OPTIONAL_SETTING('CACHE_SQL_SERVER', ''); | ||
OPTIONAL_SETTING('CACHE_SQL_DATABASE', ''); | ||
OPTIONAL_SETTING('CACHE_PATH', ''); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
<?php | ||
|
||
/** | ||
* @author Mike Carruth <mikecarruth@gmail.com> | ||
* @version 2.5.7 | ||
* @package Flogr | ||
* @link http://flogr.googlecode.com | ||
*/ | ||
|
||
/** | ||
* Defines a required constant - quits if value not set. | ||
* | ||
* @param string name Name of constant | ||
* @param string value Value for constant | ||
*/ | ||
function REQUIRED_SETTING($name, $value) { | ||
if (!isset($value) || $value == '') { | ||
die("<p>You need to set <b>'{$name}'</b> in <code>admin\config.php</code> before you can being using flogr.</p>"); | ||
} | ||
define($name, $value, true); | ||
} | ||
|
||
/** | ||
* Defines an optional constant - wrapper for define(). | ||
* | ||
* @param string name Name of constant | ||
* @param string value Value for constant | ||
*/ | ||
function OPTIONAL_SETTING($name, $value) { | ||
define($name, $value, true); | ||
} | ||
|
||
/** | ||
* Decides which include path delimiter to use. Windows should be using a semi-colon | ||
* and everything else should be using a colon. If this isn't working on your system, | ||
* comment out this if statement and manually set the correct value into $path_delimiter. | ||
*/ | ||
if (strpos(__FILE__, ':') !== false) { | ||
$path_delimiter = ';'; | ||
} else { | ||
$path_delimiter = ':'; | ||
} | ||
|
||
ini_set('include_path', | ||
dirname(__FILE__) . '/../include/PEAR' . $path_delimiter . | ||
dirname(__FILE__) . '/../include/phpFlickr-2.1.0' . $path_delimiter . | ||
dirname(__FILE__) . '/../admin' . $path_delimiter . | ||
dirname(__FILE__) . '/../pages' . $path_delimiter . | ||
ini_get('include_path')); | ||
|
||
/** | ||
* Hide PHP warnings...nobody's perfect :) | ||
*/ | ||
error_reporting(E_ERROR); | ||
|
||
/** | ||
* Includes | ||
*/ | ||
require_once('phpFlickr.php'); | ||
require_once('Log.php'); | ||
require_once('config.php'); | ||
|
||
/** | ||
* Create the flogr instance and let's get going | ||
*/ | ||
if (!isset($flogr)) | ||
$flogr = new Flogr(); | ||
$flogr->run(); | ||
|
||
/** | ||
* The Flogr:: class is responsible for mapping requests to the appropriate | ||
* handler page based on the type request parameter (ex 'index.php?type=photo') | ||
* and setting up logging. | ||
* | ||
* @author Mike Carruth <mikecarruth@gmail.com> | ||
* @package Flogr | ||
*/ | ||
class Flogr { | ||
/* | ||
* Maps request type to template page. | ||
* | ||
* @var array | ||
*/ | ||
|
||
var $_pageMap = array( | ||
'' => 'photo.php', | ||
'photo' => 'photo.php', | ||
'recent' => 'recent.php', | ||
'sets' => 'sets.php', | ||
'tags' => 'tags.php', | ||
'map' => 'map.php', | ||
'map_data' => 'map_data.php', | ||
'favorites' => 'favorites.php', | ||
'about' => 'about.php', | ||
'rss' => 'rss.php' | ||
); | ||
|
||
/* | ||
* Maps flogr log levels to PEAR::LOG | ||
*/ | ||
var $_logLevels = array( | ||
FLOGR_LOG_NONE => PEAR_LOG_NONE, | ||
FLOGR_LOG_ERR => PEAR_LOG_ERR, | ||
FLOGR_LOG_WARNING => PEAR_LOG_WARNING, | ||
FLOGR_LOG_DEBUG => PEAR_LOG_DEBUG | ||
); | ||
var $_logMask = PEAR_LOG_ALL; | ||
var $_logger = null; | ||
var $_logHandlers = array( | ||
'firebug' => null, | ||
); | ||
|
||
function __construct() { | ||
|
||
$this->_logger = &Log::singleton('composite', '', '', null, $this->_logLevels[FLOGR_LOG_LEVEL]); | ||
$keys = array_keys($this->_logHandlers); | ||
foreach ($keys as $key) { | ||
$handler = &Log::singleton($key, '', '', null, $this->_logLevels[FLOGR_LOG_LEVEL]); | ||
$this->_logHandlers[$key] = $handler; | ||
$this->_logger->addChild($handler); | ||
} | ||
} | ||
|
||
function logInfo($string) { | ||
$this->_logger->info($string); | ||
} | ||
|
||
function logWarning($string) { | ||
$this->_logger->warning($string); | ||
} | ||
|
||
function logErr($string) { | ||
$this->_logger->err($string); | ||
} | ||
|
||
function logDebug($string) { | ||
$this->_logger->debug($string); | ||
} | ||
|
||
function run() { | ||
if (defined('FLICKR_USER_ID') || defined('FLICKR_GROUP_ID')) { | ||
if ($_GET['type'] != 'rss' && $_GET['type'] != 'map_data') { | ||
include('header.php'); | ||
include(SITE_THEME_PATH . 'header.php'); | ||
} | ||
|
||
include($this->_pageMap[$_GET['type']]); | ||
include(SITE_THEME_PATH . $this->_pageMap[$_GET['type']]); | ||
|
||
if ($_GET['type'] != 'rss' && $_GET['type'] != 'map_data') { | ||
include(SITE_THEME_PATH . 'footer.php'); | ||
include('footer.php'); | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div id="footer"> | ||
<?php | ||
if ($photo && $photo->get_userId() == FLICKR_USER_ID) { | ||
echo "Photo © "; | ||
$photo->userlink(); | ||
echo " | "; | ||
} | ||
?>Site powered by <a href="http://flogr.googlecode.com">Flogr v2.5.7</a> & <a href="http://flickr.com"><span style="color: rgb(0, 102, 204);">Flick</span><span style="color: rgb(255, 0, 153);">r</span></a> | ||
</div> | ||
</body> | ||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?> | ||
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> | ||
<html xmlns='http://www.w3.org/1999/xhtml'> | ||
<head> | ||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> | ||
<title><?php echo SITE_TITLE; ?></title> | ||
<link href='<?php echo SITE_URL;?>/<?php echo SITE_THEME_PATH;?>css/<?php echo SITE_THEME; ?>.css' rel='stylesheet' type='text/css' /> | ||
<link rel='alternate' type='application/rss+xml' title='<?php echo SITE_TITLE; ?>' href='<?php echo SITE_URL; ?>/index.php?type=rss' /> | ||
</head> | ||
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
require_once('flogr.php'); | ||
|
||
class Profiler { | ||
|
||
var $_startTime; | ||
var $_scopeText; | ||
var $_warnTime; | ||
var $_errTime; | ||
|
||
function __construct($scopeText = '', $warnTime = 0.01, $errTime = 2) { | ||
$this->_scopeText = $scopeText; | ||
$this->_startTime = microtime(true); | ||
$this->_warnTime = $warnTime; | ||
$this->_errTime = $errTime; | ||
|
||
if ($this->_scopeText == '') { | ||
$debug_backtrace = debug_backtrace(); | ||
$class_name = $debug_backtrace[1]["class"]; | ||
$function_name = $debug_backtrace[1]["function"]; | ||
$line_number = $debug_backtrace[1]["line"]; | ||
$this->_scopeText = $class_name . "::" . $function_name . "(" . $line_number . "):"; | ||
} | ||
} | ||
|
||
function __destruct() { | ||
global $flogr; | ||
|
||
$endTime = microtime(true); | ||
$elapsedTime = round($endTime - $this->_startTime, 2); | ||
|
||
$message = $this->_scopeText . " completed in {$elapsedTime}s"; | ||
|
||
if ($elapsedTime < $this->_warnTime) { | ||
$flogr->logInfo($message); | ||
} else if ($elapsedTime < $this->_errTime) { | ||
$flogr->logWarning($message); | ||
} else { | ||
$flogr->logErr($message); | ||
} | ||
} | ||
} | ||
?> |
Oops, something went wrong.