Beispiel #1
0
/**
 * Adds the css class necessary for toggling of Zenpage items search results
 *
 * @param string $option "news" or "pages"
 * @param string $c After which result item the toggling should begin. Here to be passed from the results loop.
 */
function printZDToggleClass($option, $c, $number_to_show)
{
    $option = strtolower($option);
    $c = sanitize_numeric($c);
    if ($c > $number_to_show) {
        echo ' class="' . $option . '_extrashow" style="display:none;"';
    }
}
function getArguments($request)
{
    // Override if request arguments are not proper
    $arguments = array();
    // Defaults for below
    $arguments['limit'] = 50;
    if (array_key_exists('limit', $request)) {
        $limit = sanitize_numeric($request['limit']);
        // Ignore if it doesn't seem numeric
        if (is_numeric($limit)) {
            $arguments['limit'] = max(min($limit, 50), 1);
        }
    }
    $arguments['maxdistance'] = 10000;
    if (array_key_exists('maxdistance', $request)) {
        $maxdistance = sanitize_numeric($request['maxdistance']);
        if (is_numeric($maxdistance)) {
            // We expect miles from user, convert to meters here for API
            $arguments['maxdistance'] = max(min($maxdistance * 1609.344, 50000), 1000);
        }
    }
    $arguments['minprice'] = null;
    if (array_key_exists('minprice', $request)) {
        $minprice = sanitize_numeric($request['minprice']);
        if (is_numeric($minprice)) {
            $arguments['minprice'] = max(min($minprice, 4), 0);
        }
    }
    $arguments['maxprice'] = null;
    if (array_key_exists('maxprice', $request)) {
        $maxprice = sanitize_numeric($request['maxprice']);
        if (is_numeric($maxprice)) {
            $arguments['maxprice'] = max(min($maxprice, 4), 0);
        }
    }
    // No defaults for below
    if (array_key_exists('zip', $request)) {
        $zip = sanitize_numeric($request['zip']);
        if (is_numeric($zip)) {
            // Remove leading zeros
            $arguments['zip'] = ltrim($zip, "0");
        }
    }
    if (array_key_exists('latitude', $request) && array_key_exists('longitude', $_REQUEST)) {
        $latitude = sanitize_numeric($request['latitude']);
        $longitude = sanitize_numeric($request['longitude']);
        if (is_numeric($latitude) && is_numeric($longitude)) {
            $arguments['latitude'] = $latitude;
            $arguments['longitude'] = $longitude;
        }
    }
    if (array_key_exists('pagetoken', $request)) {
        $pagetoken = sanitize_string($request['pagetoken']);
        $arguments['pagetoken'] = $pagetoken;
    }
    return $arguments;
}
/**
 * Saves admin custom data
 * Called when an admin is saved
 *
 * @param string $updated true if data has changed
 * @param object $userobj admin user object
 * @param string $i prefix for the admin
 * @param bool $alter will be true if critical admin data may be altered
 * @return bool
 */
function quota_save_admin($updated, $userobj, $i, $alter)
{
    if (isset($_POST[$i . 'quota']) && $alter) {
        $oldquota = $userobj->getQuota();
        $userobj->setQuota(sanitize_numeric($_POST[$i . 'quota']));
        $updated = $oldquota == $userobj->getQuota();
    }
    return $updated;
}
Beispiel #4
0
 function __construct()
 {
     setOptionDefault('magick_max_height', self::$ignore_size);
     setOptionDefault('magick_max_width', self::$ignore_size);
     if (!sanitize_numeric(getOption('magick_max_height'))) {
         setOption('magick_max_height', self::$ignore_size);
     }
     if (!sanitize_numeric(getOption('magick_max_width'))) {
         setOption('magick_max_width', self::$ignore_size);
     }
 }
 function __construct()
 {
     global $_zp_imagick_present;
     if ($_zp_imagick_present) {
         $this->defaultFilter = 'FILTER_LANCZOS';
         $this->defaultFontSize = 18;
         // setOptionDefault('use_imagick', $_zp_imagick_present);
         setOptionDefault('imagick_filter', $this->defaultFilter);
         setOptionDefault('magick_font_size', $this->defaultFontSize);
         if (!sanitize_numeric(getOption('magick_font_size'))) {
             setOption('magick_font_size', $this->defaultFontSize);
         }
         $mem_lim = getOption('magick_mem_lim');
         if (!is_numeric($mem_lim) || $mem_lim < 0) {
             setOption('magick_mem_lim', 0);
         }
     }
 }
function externalLinkBox($prior, $image, $prefix, $subpage, $tagsort)
{
    if ($prior) {
        $prior .= '<br /><hr>';
    }
    if (isset($_SESSION['externalLinksize_' . $prefix])) {
        $size = sanitize_numeric($_SESSION['externalLinksize_' . $prefix]);
        unset($_SESSION['externalLinksize_' . $prefix]);
    } else {
        $size = false;
    }
    $output = $img = '';
    if ($size) {
        $link = $image->getCustomImage($size, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
        $img = ' <img src="' . html_encode(pathurlencode($link)) . '" height="15" width="15" />';
        $output .= '<input type="text" style="width:100%" value="' . html_encode($link) . '" />';
    }
    $output .= gettext('link for image of size:') . ' <input type="text" name="externalLinksize_' . $prefix . '" size="3" value="' . $size . '" />' . $img;
    return $prior . $output;
}
Beispiel #7
0
 /**
  * Option save handler for the filter
  *
  * @param object $object object being rated
  * @param string $prefix indicator if admin is processing multiple objects
  */
 static function optionVoteStatusSave($object, $prefix)
 {
     if (isset($_POST['rating_status' . $prefix])) {
         $object->set('rating_status', sanitize_numeric($_POST['rating_status' . $prefix]) - 1);
     }
     return $object;
 }
Beispiel #8
0
    $cache_file = $album . "/" . stripSuffix($image) . '_FULL.' . $suffix;
    $cache_path = NULL;
}
$process = $rotate = false;
if (zp_imageCanRotate()) {
    $rotate = getImageRotation($imageobj);
    $process = $rotate;
}
$watermark_use_image = getWatermarkParam($imageobj, WATERMARK_FULL);
if ($watermark_use_image == NO_WATERMARK) {
    $watermark_use_image = '';
} else {
    $process = 2;
}
if (isset($_GET['q'])) {
    $quality = sanitize_numeric($_GET['q']);
} else {
    $quality = getOption('full_image_quality');
}
if (!($process || $force_cache)) {
    // no processing needed
    if (getOption('album_folder_class') != 'external' && $disposal != 'Download') {
        // local album system, return the image directly
        header('Content-Type: image/' . $suffix);
        if (UTF8_IMAGE_URI) {
            header("Location: " . getAlbumFolder(FULLWEBPATH) . pathurlencode($album8) . "/" . rawurlencode($image8));
        } else {
            header("Location: " . getAlbumFolder(FULLWEBPATH) . pathurlencode($album) . "/" . rawurlencode($image));
        }
        exitZP();
    } else {
    if ($plugin['priority'] & CLASS_PLUGIN) {
        require_once $plugin['path'];
    }
}
require_once dirname(__FILE__) . '/template-functions.php';
if (isset($_REQUEST['album'])) {
    $localrights = ALBUM_RIGHTS;
} else {
    $localrights = NULL;
}
admin_securityChecks($localrights, $return = currentRelativeURL());
XSRFdefender('refresh');
$imageid = '';
if (isset($_GET['refresh'])) {
    if (isset($_GET['id'])) {
        $imageid = sanitize_numeric($_GET['id']);
    }
    $imageid = $_zp_gallery->garbageCollect(true, true, $imageid);
}
if (isset($_GET['prune'])) {
    $type = 'prune&amp;';
    $title = gettext('Refresh Database');
    $finished = gettext('Finished refreshing the database');
    $incomplete = gettext('Database refresh is incomplete');
    $allset = gettext("We are all set to refresh the database");
    $continue = gettext('Continue refreshing the database.');
} else {
    $type = '';
    $title = gettext('Refresh Metadata');
    $finished = gettext('Finished refreshing the metadata');
    $incomplete = gettext('Metadata refresh is incomplete');
/**
 * Returns the size of the images to be used in the feed.
 *
 * @return int
 */
function getRSSImageSize()
{
    $rssmode = getRSSAlbumsmode();
    if (isset($_GET['size'])) {
        $size = sanitize_numeric($_GET['size']);
    } else {
        $size = NULL;
    }
    if (is_numeric($size) && !is_null($size) && $size < getOption('feed_imagesize')) {
        $size = $size;
    } else {
        if ($rssmode == "albums") {
            $size = getOption('feed_imagesize_albums');
            // un-cropped image size
        } else {
            $size = getOption('feed_imagesize');
            // un-cropped image size
        }
    }
    return $size;
}
Beispiel #11
0
    static function printSlideShow($heading = true, $speedctl = false, $albumobj = "", $imageobj = "", $width = "", $height = "")
    {
        if (!isset($_POST['albumid']) and !is_object($albumobj)) {
            echo "<div class=\"errorbox\" id=\"message\"><h2>" . gettext("Invalid linking to the slideshow page.") . "</h2></div>";
            echo "</div></body></html>";
            exit;
        }
        global $_zp_flash_player, $_zp_current_image, $_zp_current_album, $_zp_gallery;
        //getting the image to start with
        if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
            $imagenumber = $_POST['imagenumber'] - 1;
            // slideshows starts with 0, but zp with 1.
        } elseif (is_object($imageobj)) {
            makeImageCurrent($imageobj);
            $imagenumber = imageNumber() - 1;
        } else {
            $imagenumber = 0;
        }
        // set pagenumber to 0 if not called via POST link
        if (isset($_POST['pagenr'])) {
            $pagenumber = sanitize_numeric($_POST['pagenr']);
        } else {
            $pagenumber = 0;
        }
        // getting the number of images
        if (!empty($_POST['numberofimages'])) {
            $numberofimages = sanitize_numeric($_POST['numberofimages']);
        } elseif (is_object($albumobj)) {
            $numberofimages = $albumobj->getNumImages();
        }
        //getting the album to show
        if (!empty($_POST['albumid']) and !is_object($albumobj)) {
            $albumid = sanitize_numeric($_POST['albumid']);
        } elseif (is_object($albumobj)) {
            $albumid = $albumobj->id;
        } else {
            $albumid = -1;
        }
        // setting the image size
        if (!empty($width) and !empty($height)) {
            $width = sanitize_numeric($width);
            $height = sanitize_numeric($height);
        } else {
            $width = getOption("slideshow_width");
            $height = getOption("slideshow_height");
        }
        $option = getOption("slideshow_mode");
        // jQuery Cycle slideshow config
        // get slideshow data
        $gallery = new Gallery();
        if ($albumid <= 0) {
            // search page
            $dynamic = 2;
            $search = new SearchEngine();
            $params = $_POST['preserve_search_params'];
            $search->setSearchParams($params);
            $images = $search->getImages(0);
            $searchwords = $search->words;
            $searchdate = $search->dates;
            $searchfields = $search->fields;
            $page = $search->page;
            if (empty($_POST['imagenumber'])) {
                $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . abs($albumid));
                $album = new Album($gallery, $albumq['folder']);
                $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
                //$returnpath = rewrite_path('/'.pathurlencode($album->name).'/page/'.$pagenumber,'/index.php?album='.urlencode($album->name).'&page='.$pagenumber);
            } else {
                $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
            }
            $albumtitle = gettext('Search');
        } else {
            $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
            $album = new Album($gallery, $albumq['folder']);
            $albumtitle = $album->getTitle();
            if (!checkAlbumPassword($albumq['folder'], $hint)) {
                echo gettext("This album is password protected!");
                exit;
            }
            $dynamic = $album->isDynamic();
            $images = $album->getImages(0);
            // return path to get back to the page we called the slideshow from
            if (empty($_POST['imagenumber'])) {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/page/' . $pagenumber, '/index.php?album=' . urlencode($album->name) . '&page=' . $pagenumber);
            } else {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/' . rawurlencode($_POST['imagefile']) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
            }
        }
        // slideshow display section
        switch ($option) {
            case "jQuery":
                $validtypes = array('jpg', 'jpeg', 'gif', 'png', 'mov', '3gp');
                ?>
					<script type="text/javascript">
						$(document).ready(function(){
							$(function() {
								var ThisGallery = '<?php 
                echo html_encode($albumtitle);
                ?>
';
								var ImageList = new Array();
								var TitleList = new Array();
								var DescList = new Array();
								var ImageNameList = new Array();
								var DynTime=(<?php 
                echo getOption("slideshow_timeout");
                ?>
) * 1.0;	// force numeric
								<?php 
                for ($imgnr = 0, $cntr = 0, $idx = $imagenumber; $imgnr < $numberofimages; $imgnr++, $idx++) {
                    if ($dynamic) {
                        $filename = $images[$idx]['filename'];
                        $album = new Album($gallery, $images[$idx]['folder']);
                        $image = newImage($album, $filename);
                    } else {
                        $filename = $images[$idx];
                        $image = newImage($album, $filename);
                    }
                    $ext = is_valid($filename, $validtypes);
                    if ($ext) {
                        makeImageCurrent($image);
                        $img = getCustomSizedImageMaxSpace($width, $height);
                        //$img = WEBPATH . '/' . ZENFOLDER . '/i.php?a=' . pathurlencode($image->album->name) . '&i=' . urlencode($filename) . '&s=' . $imagesize;
                        echo 'ImageList[' . $cntr . '] = "' . $img . '";' . "\n";
                        echo 'TitleList[' . $cntr . '] = "' . js_encode($image->getTitle()) . '";' . "\n";
                        if (getOption("slideshow_showdesc")) {
                            $desc = $image->getDesc();
                            $desc = str_replace("\r\n", '<br />', $desc);
                            $desc = str_replace("\r", '<br />', $desc);
                            echo 'DescList[' . $cntr . '] = "' . js_encode($desc) . '";' . "\n";
                        } else {
                            echo 'DescList[' . $cntr . '] = "";' . "\n";
                        }
                        if ($idx == $numberofimages - 1) {
                            $idx = -1;
                        }
                        echo 'ImageNameList[' . $cntr . '] = "' . urlencode($filename) . '";' . "\n";
                        $cntr++;
                    }
                }
                echo "\n";
                $numberofimages = $cntr;
                ?>
								var countOffset = <?php 
                echo $imagenumber;
                ?>
;
								var totalSlideCount = <?php 
                echo $numberofimages;
                ?>
;
								var currentslide = 2;
			
								function onBefore(curr, next, opts) {
									//$(next).parent().animate({opacity: 0});

									if (opts.timeout != DynTime) {
										opts.timeout = DynTime;
									}
									if (!opts.addSlide)
										return;
							
									var currentImageNum = currentslide;
									currentslide++;
									if (currentImageNum == totalSlideCount) {
										opts.addSlide = null;
										return;
									}
									var relativeSlot = (currentslide + countOffset) % totalSlideCount;
									if (relativeSlot == 0) {relativeSlot = totalSlideCount;}
									var htmlblock = "<span class='slideimage'><h4><strong>" + ThisGallery + ":</strong> ";
									htmlblock += TitleList[currentImageNum]  + " (" + relativeSlot + "/" + totalSlideCount + ")</h4>";
									htmlblock += "<img src='" + ImageList[currentImageNum] + "'/>";
									htmlblock += "<p class='imgdesc'>" + DescList[currentImageNum] + "</p></span>";
									opts.addSlide(htmlblock);

								}
			
								function onAfter(curr, next, opts){
									<?php 
                if (!isMyALbum($album->name, ALL_RIGHTS)) {
                    ?>
									//Only register at hit count the first time the image is viewed.
									if ($(next).attr( 'viewed') != 1) {
										$.get("<?php 
                    echo FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
                    ?>
/slideshow/slideshow-counter.php?album=<?php 
                    echo pathurlencode($album->name);
                    ?>
&img="+ImageNameList[opts.currSlide]);
										$(next).attr( 'viewed', 1 );
									}
									<?php 
                }
                ?>

									//THE MISSING LINE
									$(next).parent().height(
										$(next).find('img').height() + $(next).find('p').height() + $(next).find('h4').height() + 40
									); //.animate({opacity: 1}, 'normal', 'linear');
									//getOption('slideshow_onafter'); //make it generic
									//END MISSING LINE
								}
			
								$('#slides').cycle({
										fx:     '<?php 
                echo getOption("slideshow_effect");
                ?>
',
										speed:   <?php 
                echo getOption("slideshow_speed");
                ?>
,
										timeout: DynTime,
										next:   '#next',
										prev:   '#prev',
										cleartype: 1,
										before: onBefore,
										after: onAfter
								});
			
								$('#speed').change(function () {
									DynTime = this.value;
									return false;
								});
			
								$('#pause').click(function() { $('#slides').cycle('pause'); return false; });
								$('#play').click(function() { $('#slides').cycle('resume'); return false; });
							});
			
						});	// Documentready()
			
						</script>
						<div id="slideshow" align="center">
						<?php 
                // 7/21/08dp
                if ($speedctl) {
                    echo '<div id="speedcontrol">';
                    // just to keep it away from controls for sake of this demo
                    $minto = getOption("slideshow_speed");
                    while ($minto % 500 != 0) {
                        $minto += 100;
                        if ($minto > 10000) {
                            break;
                        }
                        // emergency bailout!
                    }
                    $dflttimeout = getOption("slideshow_timeout");
                    /* don't let min timeout = speed */
                    $thistimeout = $minto == getOption("slideshow_speed") ? $minto + 250 : $minto;
                    echo 'Select Speed: <select id="speed" name="speed">';
                    while ($thistimeout <= 60000) {
                        // "around" 1 minute :)
                        echo "<option value={$thistimeout} " . ($thistimeout == $dflttimeout ? " selected='selected'>" : ">") . round($thistimeout / 1000, 1) . " sec</option>";
                        /* put back timeout to even increments of .5 */
                        if ($thistimeout % 500 != 0) {
                            $thistimeout -= 250;
                        }
                        $thistimeout += $thistimeout < 1000 ? 500 : ($thistimeout < 10000 ? 1000 : 5000);
                    }
                    echo "</select> </div>";
                }
                if (!is_object($albumobj)) {
                    // disable controls if calling the slideshow directly on homepage for example
                    ?>
						<div id="controls">
						<div><span><a href="#" id="prev"
							title="<?php 
                    echo gettext("Previous");
                    ?>
"></a></span> <a
							href="<?php 
                    echo $returnpath;
                    ?>
" id="stop"
							title="<?php 
                    echo gettext("Stop and return to album or image page");
                    ?>
"></a>
						<a href="#" id="pause"
							title="<?php 
                    echo gettext("Pause (to stop the slideshow without returning)");
                    ?>
"></a>
						<a href="#" id="play" title="<?php 
                    echo gettext("Play");
                    ?>
"></a> <a
							href="#" id="next" title="<?php 
                    echo gettext("Next");
                    ?>
"></a>
						</div>
						</div>
						<?php 
                }
                ?>
						<div id="slides" class="pics">
						<?php 
                if ($cntr > 1) {
                    $cntr = 1;
                }
                for ($imgnr = 0, $idx = $imagenumber; $imgnr <= $cntr; $idx++) {
                    if ($idx >= $numberofimages) {
                        $idx = 0;
                    }
                    if ($dynamic) {
                        $folder = $images[$idx]['folder'];
                        $dalbum = new Album($gallery, $folder);
                        $filename = $images[$idx]['filename'];
                        $image = newImage($dalbum, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . urlencode($filename);
                    } else {
                        $folder = $album->name;
                        $filename = $images[$idx];
                        //$filename = $animage;
                        $image = newImage($album, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . urlencode($filename);
                    }
                    $ext = is_valid($filename, $validtypes);
                    if ($ext) {
                        $imgnr++;
                        echo "<span class='slideimage'><h4><strong>" . $albumtitle . gettext(":") . "</strong> " . $image->getTitle() . " (" . ($idx + 1) . "/" . $numberofimages . ")</h4>";
                        if ($ext == "3gp") {
                            echo '</a>
												<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="352" height="304" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
												<param name="src" value="' . $imagepath . '"/>
												<param name="autoplay" value="false" />
												<param name="type" value="video/quicktime" />
												<param name="controller" value="true" />
												<embed src="' . $imagepath . '" width="352" height="304" autoplay="false" controller"true" type="video/quicktime"
												pluginspage="http://www.apple.com/quicktime/download/" cache="true"></embed>
												</object>
												<a>';
                        } elseif ($ext == "mov") {
                            echo '</a>
									 			<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="640" height="496" codebase="http://www.apple.com/qtactivex/qtplugin.cab">
										 		<param name="src" value="' . $imagepath . '"/>
										 		<param name="autoplay" value="false" />
										 		<param name="type" value="video/quicktime" />
										 		<param name="controller" value="true" />
										 		<embed src="' . $imagepath . '" width="640" height="496" autoplay="false" controller"true" type="video/quicktime"
										 		pluginspage="http://www.apple.com/quicktime/download/" cache="true"></embed>
												</object>
												<a>';
                        } else {
                            makeImageCurrent($image);
                            printCustomSizedImageMaxSpace($alt = '', $width, $height, NULL, NULL, false);
                            //echo "<img src='".WEBPATH."/".ZENFOLDER."/i.php?a=".urlencode($folder)."&i=".urlencode($filename)."&s=".$imagesize."' alt='".html_encode($image->getTitle())."' title='".html_encode($image->getTitle())."' />\n";
                        }
                        if (getOption("slideshow_showdesc")) {
                            $desc = $image->getDesc();
                            $desc = str_replace("\r\n", '<br />', $desc);
                            $desc = str_replace("\r", '<br />', $desc);
                            echo "<p class='imgdesc'>" . $desc . "</p>";
                        }
                        echo "</span>";
                    }
                }
                break;
            case "flash":
                if ($heading) {
                    echo "<span class='slideimage'><h4><strong>" . $albumtitle . "</strong> (" . $numberofimages . " images) | <a style='color: white' href='" . $returnpath . "' title='" . gettext("back") . "'>" . gettext("back") . "</a></h4>";
                }
                echo "<span id='slideshow'></span>";
                ?>
 
					<script type="text/javascript">
					$("#slideshow").flashembed({
						  src:'<?php 
                echo FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
                ?>
/flowplayer/FlowPlayerLight.swf',
						  width:<?php 
                echo getOption("slideshow_flow_player_width");
                ?>
,
						  height:<?php 
                echo getOption("slideshow_flow_player_height");
                ?>
						},
						{config: {
						  autoPlay: true,
						  useNativeFullScreen: true,
						  playList: [
													<?php 
                echo "\n";
                $count = 0;
                foreach ($images as $animage) {
                    if ($dynamic) {
                        $folder = $animage['folder'];
                        $filename = $animage['filename'];
                        $salbum = new Album($_zp_gallery, $folder);
                        $image = newImage($salbum, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($salbum->name) . "/" . urlencode($filename);
                    } else {
                        $folder = $album->name;
                        $filename = $animage;
                        $image = newImage($album, $filename);
                        $imagepath = FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . pathurlencode($filename);
                    }
                    $ext = is_valid($filename, array('jpg', 'jpeg', 'gif', 'png', 'flv', 'mp3', 'mp4'));
                    if ($ext) {
                        if ($ext == "flv" || $ext == "mp3" || $ext == "mp4") {
                            $duration = "";
                        } else {
                            $duration = ", duration: " . getOption("slideshow_speed") / 10;
                        }
                        if ($count > 0) {
                            echo ",\n";
                        }
                        echo "{ url: '" . FULLWEBPATH . getAlbumFolder('') . pathurlencode($folder) . "/" . urlencode($filename) . "'" . $duration . " }";
                        $count++;
                    }
                }
                echo "\n";
                ?>
												],
						  showPlayListButtons: true,
						  showStopButton: true,
						  controlBarBackgroundColor: 0,
						 	showPlayListButtons: true,
						 	controlsOverVideo: 'ease',
						 	controlBarBackgroundColor: '<?php 
                echo getOption('flow_player_controlbarbackgroundcolor');
                ?>
',
						  controlsAreaBorderColor: '<?php 
                echo getOption('flow_player_controlsareabordercolor');
                ?>
'
						}}
				  );
					</script> 
					<?php 
                echo "</span>";
                echo "<p>";
                printf(gettext("Click on %s on the right in the player control bar to view full size."), "<img style='position: relative; top: 4px; border: 1px solid gray' src='" . WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . "/slideshow/flowplayerfullsizeicon.png' />");
                echo "</p>";
                break;
        }
        ?>
			</div>
		</div>
			<?php 
    }
Beispiel #12
0
?>
</head>
<body>
	<?php 
printLogoAndLinks();
?>
	<div id="main">
		<?php 
printTabs();
?>
		<div id="content">
			<?php 
if (empty($_GET['subpage'])) {
    $page = "";
} else {
    $page = '&amp;subpage=' . sanitize_numeric($_GET['subpage']);
}
$saveitem = $updateitem = gettext('Apply');
if (is_AdminEditPage('newsarticle')) {
    if (!empty($page)) {
        $zenphoto_tabs['news']['subtabs'][gettext('articles')] .= $page;
    }
    $subtab = printSubtabs();
    ?>
				<div id="tab_articles" class="tabbox">
					<?php 
    $admintype = 'newsarticle';
    $additem = gettext('New Article');
    $deleteitem = gettext('Article');
    $themepage = 'news';
    $locked = !checkIfLocked($result);
/**
 * Get current news page for admin news pagination
 * Addition needed because $_GET['page'] conflict with zenphoto
 * could probably removed now...
 *
 * @return int
 */
function getCurrentAdminNewsPage()
{
    deprecated_function_notify(gettext('Use the Zenpage class method instead.'));
    if (isset($_GET['pagenr'])) {
        $page = sanitize_numeric($_GET['pagenr']);
    } else {
        $page = 1;
    }
    return $page;
}
</h1>
				<?php 
    $images = $album->getImages();
    $subtab = printSubtabs();
    $parent = dirname($album->name);
    if ($parent == '/' || $parent == '.' || empty($parent)) {
        $parent = '';
    } else {
        $parent = '&amp;album=' . $parent . '&amp;tab=subalbuminfo';
    }
    ?>

				<div class="tabbox">
					<?php 
    if (isset($_GET['saved'])) {
        if (sanitize_numeric($_GET['saved'])) {
            ?>
							<div class="messagebox fade-message">
								<h2><?php 
            echo gettext("Image order saved");
            ?>
</h2>
							</div>
							<?php 
        } else {
            if (isset($_GET['bulkmessage'])) {
                $action = sanitize($_GET['bulkmessage']);
                switch ($action) {
                    case 'deleteall':
                        $messagebox = gettext('Selected items deleted');
                        break;
        $from_number_display = 1;
    } else {
        $from_number = sanitize_numeric($_GET['from_number']) - 1;
        $from_number_display = sanitize_numeric($_GET['from_number']);
    }
    if (!isset($_GET['to_number'])) {
        $to_number = 50;
        if ($_GET['type'] === "images" and $to_number > $imagecount) {
            $to_number = $imagecount;
        }
        if ($_GET['type'] === "albums" and $to_number > $albumcount) {
            $to_number = $albumcount;
        }
        $to_number_display = $to_number;
    } else {
        $to_number = sanitize_numeric($_GET['to_number']);
        $to_number_display = $to_number;
        if ($from_number < $to_number) {
            $to_number_display = $to_number;
            $to_number = $to_number - $from_number;
        }
    }
    ?>
		<form name="limit" id="limit" action="gallery_statistics.php">
		<label for="from_number"><?php 
    echo gettext("From ");
    ?>
</label>
		<input type ="text" size="10" id="from_number" name="from_number" value="<?php 
    echo $from_number_display;
    ?>
Beispiel #16
0
/**
 * Extract the image parameters from the input variables
 * @param array $set
 * @return array
 */
function getImageArgs($set)
{
    $args = array(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
    if (isset($set['s'])) {
        //0
        if (is_numeric($s = $set['s'])) {
            if ($s) {
                $args[0] = (int) min(abs($s), MAX_SIZE);
            }
        } else {
            $args[0] = sanitize($set['s']);
        }
    } else {
        if (!isset($set['w']) && !isset($set['h'])) {
            $args[0] = MAX_SIZE;
        }
    }
    if (isset($set['w'])) {
        //1
        $args[1] = (int) min(abs(sanitize_numeric($set['w'])), MAX_SIZE);
    }
    if (isset($set['h'])) {
        //2
        $args[2] = (int) min(abs(sanitize_numeric($set['h'])), MAX_SIZE);
    }
    if (isset($set['cw'])) {
        //3
        $args[3] = (int) sanitize_numeric($set['cw']);
    }
    if (isset($set['ch'])) {
        //4
        $args[4] = (int) sanitize_numeric($set['ch']);
    }
    if (isset($set['cx'])) {
        //5
        $args[5] = (int) sanitize_numeric($set['cx']);
    }
    if (isset($set['cy'])) {
        //6
        $args[6] = (int) sanitize_numeric($set['cy']);
    }
    if (isset($set['q'])) {
        //7
        $args[7] = (int) sanitize_numeric($set['q']);
    }
    if (isset($set['c'])) {
        // 9
        $args[9] = (int) sanitize($set['c']);
    }
    if (isset($set['t'])) {
        //10
        $args[10] = (int) sanitize($set['t']);
    }
    if (isset($set['wmk']) && !isset($_GET['admin'])) {
        //11
        $args[11] = sanitize($set['wmk']);
    }
    $args[12] = (bool) isset($_GET['admin']);
    //12
    if (isset($set['effects'])) {
        //13
        $args[13] = sanitize($set['effects']);
    }
    if (isset($set['z'])) {
        //	14
        $args[14] = sanitize($set['z']);
    }
    return $args;
}
Beispiel #17
0
<?php

/**
 * xspf playlist for flv player
 * 
 * @author Malte Müller (acrylian), Stephen Billard (sbillard)
 * @version 1.0.5
 * @package plugins 
 */
header("content-type:text/xml;charset=utf-8");
require_once "../../zp-core/template-functions.php";
$albumid = sanitize_numeric($_GET["albumid"]);
$albumresult = query_single_row("SELECT folder from " . prefix('albums') . " WHERE id = " . $albumid);
$album = new Album(new Gallery(), $albumresult['folder']);
$playlist = $album->getImages();
echo "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
echo "<title>Sample XSPF Playlist</title>";
echo "<info>http://www.what.de</info>";
echo "<annotation>An example of a playlist with commercial</annotation>";
echo "<trackList>\n";
$imgextensions = array(".jpg", ".jpeg", ".gif", ".png");
foreach ($playlist as $item) {
    $image = newImage($album, $item);
    $ext = strtolower(strrchr($item, "."));
    if ($ext == ".flv" || $ext == ".mp3" || $ext == ".mp4") {
        $videoThumb = $image->objectsThumb;
        if (!empty($videoThumb)) {
            $videoThumb = '../../' . getAlbumFolder('') . $album->name . "/" . $videoThumb;
        }
        echo "\t<track>\n";
        echo "\t\t<title>" . $image->getTitle() . " (" . $ext . ")</title>\n";
Beispiel #18
0
/**
 * Prints the Galleria slideshow for albums or search results.
 *
 * Two ways to use (see readme/documentation):
 * a) Used on the included theme slideshow.php page and called via printSlideShowLink() from the core slideshow plugin:
 * b) Calling directly via printGslideshow() function in a template file or codeblock.
 *
 * @param obj $albumobj The object of the album to show the slideshow of. Not needed if calling slideshow from album, image, or search.
 * @param obj $imageobj The object of the image to start the slideshow with. If not set the slideshow starts with the first image of the album, or current image if called from image.php. Not needed if calling slideshow from album, image, or search.
 * @param bool $linkslides Set to true if you want the slides to be linked to their image pages
 * @param mixed $autoplay true to autoplay slideshow with interval set in options, false to start with slideshow stopped.  Set integer in milliseconds to autoplay at that interval (Ex. 4000), overriding plugin option set.
 * @param bool $shuffle Set to true if you want random (shuffled) order of the slides
 *
 * */
function printGslideshow($albumobj = null, $imageobj = null, $linkslides = true, $autoplay = true, $forceheight = false, $shuffle = false)
{
    $data = 'data';
    // no POST data from slidehow link and $albumobj provided is not valid, exit
    if (!isset($_POST['albumid']) and !is_object($albumobj)) {
        echo "<div class=\"errorbox\" id=\"message\"><h2>" . gettext("Invalid linking to the slideshow page.") . "</h2></div>";
        echo "</div></body></html>";
        exitZP();
    }
    global $_zp_current_image, $_zp_current_album, $_zp_gallery, $_myFavorites, $_zp_conf_vars;
    $imagenumber = 0;
    //getting the image to start with
    if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
        $imagenumber = sanitize_numeric($_POST['imagenumber']) - 1;
        // slideshows starts with 0, but zp with 1.
    } elseif (is_object($imageobj)) {
        makeImageCurrent($imageobj);
        $imagenumber = imageNumber() - 1;
    }
    // set pagenumber to 0 if not called via POST link
    if (isset($_POST['pagenr'])) {
        $pagenumber = sanitize_numeric($_POST['pagenr']);
    } else {
        $pagenumber = 1;
    }
    // getting the number of images
    if (!empty($_POST['numberofimages'])) {
        $numberofimages = sanitize_numeric($_POST['numberofimages']);
    } elseif (is_object($albumobj)) {
        $numberofimages = $albumobj->getNumImages();
    } else {
        $numberofimages = 0;
    }
    if ($imagenumber < 2 || $imagenumber > $numberofimages) {
        $imagenumber = 0;
    }
    //getting the album to show
    if (!empty($_POST['albumid']) && !is_object($albumobj)) {
        $albumid = sanitize_numeric($_POST['albumid']);
        $embedded = false;
    } elseif (is_object($albumobj)) {
        $albumid = $albumobj->getID();
        $embedded = true;
    } else {
        $albumid = 0;
        $embedded = false;
    }
    if ($numberofimages == 0) {
        return NULL;
    }
    // get slideshow data
    if (isset($_POST['preserve_search_params'])) {
        // search page
        $search = new SearchEngine();
        $params = sanitize($_POST['preserve_search_params']);
        $search->setSearchParams($params);
        $images = $search->getImages(0);
        $searchwords = $search->getSearchWords();
        $searchdate = $search->getSearchDate();
        $searchfields = $search->getSearchFields(true);
        $page = $search->page;
        $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
        $albumtitle = gettext('Search');
    } else {
        if (isset($_POST['favorites_page'])) {
            $album = $_myFavorites;
            $albumtitle = gettext('My Favorites');
            $images = $album->getImages(0);
            $returnpath = rewrite_path(favorites::getFavorites_link() . '/' . $pagenumber, FULLWEBPATH . '/index.php?p=favorites' . '&page=' . $pagenumber);
        } else {
            $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
            $album = newAlbum($albumq['folder']);
            $albumtitle = $album->getTitle();
            if (!$album->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumq['folder'])) {
                echo gettext("This album is password protected!");
                exitZP();
            }
            $dynamic = $album->isDynamic();
            $images = $album->getImages(0);
            // return path to get back to the page we called the slideshow from
            if (empty($_POST['imagenumber'])) {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/page/' . $pagenumber, '/index.php?album=' . urlencode($album->name) . '&page=' . $pagenumber);
            } else {
                $returnpath = rewrite_path('/' . pathurlencode($album->name) . '/' . rawurlencode(sanitize($_POST['imagefile'])) . getOption('mod_rewrite_image_suffix'), '/index.php?album=' . urlencode($album->name) . '&image=' . urlencode($_POST['imagefile']));
            }
        }
    }
    if ($shuffle) {
        shuffle($images);
    }
    // slideshow display section
    ?>

			<script>
				var data = [
				<?php 
    for ($imgnr = 0, $cntr = 0, $idx = 0; $imgnr < $numberofimages; $imgnr++, $idx++) {
        if (is_array($images[$idx])) {
            $filename = $images[$idx]['filename'];
            $album = newAlbum($images[$idx]['folder']);
            $image = newImage($album, $filename);
        } else {
            $filename = $images[$idx];
            $image = newImage($album, $filename);
        }
        $ext = isImagePhoto($image);
        if ($ext) {
            makeImageCurrent($image);
            echo '{' . "\n";
            echo 'thumb: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_thumbsize'), getOption('gslideshow_thumbsize')) . '\',' . "\n";
            echo 'image: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_mediumsize'), getOption('gslideshow_mediumsize')) . '\',' . "\n";
            echo 'big: \'' . getCustomSizedImageMaxSpace(getOption('gslideshow_bigsize'), getOption('gslideshow_bigsize')) . '\',' . "\n";
            echo 'title: \'' . js_encode($image->getTitle()) . '\',' . "\n";
            $desc = $image->getDesc();
            $desc = str_replace("\r\n", '<br />', $desc);
            $desc = str_replace("\r", '<br />', $desc);
            echo 'description: \'' . js_encode($desc) . '\',' . "\n";
            if ($linkslides) {
                echo 'link: \'' . html_encode($image->getLink()) . '\'' . "\n";
            }
            if ($imgnr == $numberofimages - 1) {
                echo '}' . "\n";
            } else {
                echo '},' . "\n";
            }
        }
    }
    echo "\n";
    ?>
				];
			</script>
			<?php 
    printGalleriaRun($data, $linkslides, $autoplay, $embedded, $forceheight, $imagenumber, $albumtitle, $returnpath);
    //restore_context(); // needed if the slideshow is for example called directly via album object before the next_album loop on index.php
}
Beispiel #19
0
 unset($_POST['publish']);
 XSRFdefender('publishContent');
 switch ($action) {
     case 'albums':
         unset($_POST['checkAllAuto']);
         foreach ($_POST as $key => $albumid) {
             $album = newAlbum(postIndexDecode($key));
             $album->setShow(1);
             $album->save();
         }
         $report = 'albums';
         break;
     case 'images':
         foreach ($_POST as $action) {
             $i = strrpos($action, '_');
             $imageid = sanitize_numeric(substr($action, $i + 1));
             $rowi = query_single_row('SELECT * FROM ' . prefix('images') . ' WHERE `id`=' . $imageid);
             $rowa = query_single_row('SELECT * FROM ' . prefix('albums') . ' WHERE `id`=' . $rowi['albumid']);
             $album = newAlbum($rowa['folder']);
             $image = newImage($album, $rowi['filename']);
             switch (substr($action, 0, $i)) {
                 case 'pub':
                     $image->setShow(1);
                     $image->save();
                     break;
                 case 'del':
                     $image->remove();
                     break;
             }
         }
         $report = 'images';
Beispiel #20
0
 if (empty($charset)) {
     $charset = 'UTF-8';
 }
 $test = '';
 if (($dir = opendir($serverpath . '/' . DATA_FOLDER . '/')) !== false) {
     $testfiles = array();
     while (($file = readdir($dir)) !== false) {
         if (preg_match('/^charset[\\._]t(.*)$/', $file, $matches)) {
             $test = stripSuffix($matches[1]);
             break;
         }
     }
     closedir($dir);
 }
 if (isset($_REQUEST['charset_attempts'])) {
     $tries = sanitize_numeric($_REQUEST['charset_attempts']);
 } else {
     $tries = 0;
 }
 switch (FILESYSTEM_CHARSET) {
     case 'ISO-8859-1':
         if ($tries & 2) {
             $trialset = 'unknown';
         } else {
             $trialset = 'UTF-8';
             $tries = $tries | 1;
         }
         break;
     default:
         if ($tries & 1) {
             $trialset = 'unknown';
Beispiel #21
0
     exitZP();
     break;
 case 'saveoptions':
     XSRFdefender('saveadmin');
     $notify = $returntab = $msg = '';
     if (isset($_POST['saveadminoptions'])) {
         if (isset($_POST['checkForPostTruncation'])) {
             if (isset($_POST['alter_enabled']) || sanitize_numeric($_POST['totaladmins']) > 1 || trim(sanitize($_POST['adminuser0'])) != $_zp_current_admin_obj->getUser() || isset($_POST['0-newuser'])) {
                 if (!$_zp_current_admin_obj->reset) {
                     admin_securityChecks(ADMIN_RIGHTS, currentRelativeURL());
                 }
             }
             $alter = isset($_POST['alter_enabled']);
             $nouser = true;
             $returntab = $newuser = false;
             for ($i = 0; $i < sanitize_numeric($_POST['totaladmins']); $i++) {
                 $updated = false;
                 $error = false;
                 $userobj = NULL;
                 $pass = trim(sanitize($_POST['pass' . $i]));
                 $user = trim(sanitize($_POST['adminuser' . $i]));
                 if (empty($user) && !empty($pass)) {
                     $notify = '?mismatch=nothing';
                 }
                 if (!empty($user)) {
                     $nouser = false;
                     if (isset($_POST[$i . '-newuser'])) {
                         $newuser = $user;
                         $userobj = Zenphoto_Authority::getAnAdmin(array('`user`=' => $user, '`valid`>' => 0));
                         if (is_object($userobj)) {
                             $notify = '?exists';
function consolidatedEditMessages($subtab)
{
    zp_apply_filter('admin_note', 'albums', $subtab);
    global $messagebox, $errorbox, $notebox;
    if (isset($_GET['ndeleted'])) {
        $ntdel = sanitize_numeric($_GET['ndeleted']);
        if ($ntdel <= 2) {
            $msg = gettext("Image");
        } else {
            $msg = gettext("Album");
            $ntdel = $ntdel - 2;
        }
        if ($ntdel == 2) {
            $errorbox[] = sprintf(gettext("%s failed to delete."), $msg);
        } else {
            $messagebox[] = sprintf(gettext("%s deleted successfully."), $msg);
        }
    }
    if (isset($_GET['mismatch'])) {
        if ($_GET['mismatch'] == 'user') {
            $errorbox[] = gettext("You must supply a password.");
        } else {
            $errorbox[] = gettext("Your passwords did not match.");
        }
    }
    if (isset($_GET['edit_error'])) {
        $errorbox[] = html_encode(sanitize($_GET['edit_error']));
    }
    if (isset($_GET['post_error'])) {
        $messagebox[] = gettext('The image edit form submission has been truncated. Try displaying fewer images on a page.');
    }
    if (isset($_GET['counters_reset'])) {
        $messagebox[] = gettext("Hit counters have been reset.");
    }
    if (isset($_GET['cleared']) || isset($_GET['action']) && $_GET['action'] == 'clear_cache') {
        $messagebox[] = gettext("Cache has been purged.");
    }
    if (isset($_GET['uploaded'])) {
        $messagebox[] = gettext('Your files have been uploaded.');
    }
    if (isset($_GET['exists'])) {
        $errorbox[] = sprintf(gettext("<em>%s</em> already exists."), sanitize($_GET['exists']));
    }
    if (isset($_GET['saved'])) {
        $messagebox[] = gettext("Changes applied");
    }
    if (isset($_GET['noaction'])) {
        $notebox[] = gettext("Nothing changed");
    }
    if (isset($_GET['bulkmessage'])) {
        $action = sanitize($_GET['bulkmessage']);
        switch ($action) {
            case 'deleteallalbum':
            case 'deleteall':
                $messagebox[] = gettext('Selected items deleted');
                break;
            case 'showall':
                $messagebox[] = gettext('Selected items published');
                break;
            case 'hideall':
                $messagebox[] = gettext('Selected items unpublished');
                break;
            case 'commentson':
                $messagebox[] = gettext('Comments enabled for selected items');
                break;
            case 'commentsoff':
                $messagebox[] = gettext('Comments disabled for selected items');
                break;
            case 'resethitcounter':
                $messagebox[] = gettext('Hitcounter for selected items');
                break;
            case 'addtags':
                $messagebox[] = gettext('Tags added for selected items');
                break;
            case 'cleartags':
                $messagebox[] = gettext('Tags cleared for selected items');
                break;
            case 'alltags':
                $messagebox[] = gettext('Tags added for images of selected items');
                break;
            case 'clearalltags':
                $messagebox[] = gettext('Tags cleared for images of selected items');
                break;
            default:
                $messagebox[] = $action;
                break;
        }
    }
    if (isset($_GET['mcrerr'])) {
        switch (sanitize_numeric($_GET['mcrerr'])) {
            case 2:
                $errorbox[] = gettext("Image already exists.");
                break;
            case 3:
                $errorbox[] = gettext("Album already exists.");
                break;
            case 4:
                $errorbox[] = gettext("Cannot move, copy, or rename to a subalbum of this album.");
                break;
            case 5:
                $errorbox[] = gettext("Cannot move, copy, or rename to a dynamic album.");
                break;
            case 6:
                $errorbox[] = gettext('Cannot rename an image to a different suffix');
                break;
            case 7:
                $errorbox[] = gettext('Album delete failed');
                break;
            default:
                $errorbox[] = sprintf(gettext("There was an error #%d with a move, copy, or rename operation."), sanitize_numeric($_GET['mcrerr']));
                break;
        }
    }
    if (!empty($errorbox)) {
        ?>
		<div class="errorbox fade-message">
			<?php 
        echo implode('<br />', $errorbox);
        ?>
		</div>
		<?php 
    }
    if (!empty($notebox)) {
        ?>
		<div class="notebox fade-message">
			<?php 
        echo implode('<br />', $notebox);
        ?>
		</div>
		<?php 
    }
    if (!empty($messagebox)) {
        ?>
		<div class="messagebox fade-message">
			<?php 
        echo implode('<br />', $messagebox);
        ?>
		</div>
		<?php 
    }
}
Beispiel #23
0
 * Bulk enable/disable of plugins
 * @package core
 */
// force UTF-8 Ø
define('OFFSET_PATH', 3);
require_once dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) . "/zp-core/admin-globals.php";
admin_securityChecks(ADMIN_RIGHTS, $return = currentRelativeURL());
XSRFdefender('pluginEnabler');
if (isset($_GET['pluginsRemember'])) {
    setOption('pluginEnabler_currentset', serialize(array_keys(getEnabledPlugins())));
    $report = gettext('Current enabled plugins remembered');
}
if (isset($_GET['pluginsEnable'])) {
    $paths = getPluginFiles('*.php');
    $pluginlist = array_keys($paths);
    switch ($setting = sanitize_numeric($_GET['pluginsEnable'])) {
        case 0:
            $report = gettext('Plugins disabled');
            break;
        case 1:
            $report = gettext('Zenphoto plugins enabled');
            break;
        case 2:
            $report = gettext('Remembered plugins enabled');
            $savedlist = getSerializedArray(getOption('pluginEnabler_currentset'));
            break;
        case 3:
            $report = gettext('All plugins enabled');
            break;
    }
    foreach ($pluginlist as $extension) {
if (!zp_loggedin(OVERVIEW_RIGHTS)) {
    // prevent nefarious access to this page.
    header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin.php?from=' . currentRelativeURL());
    exitZP();
}
if (isset($_GET['clearsitemapcache'])) {
    clearSitemapCache();
    header('location:' . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/sitemap-extended/sitemap-extended-admin.php');
    exitZP();
}
$webpath = WEBPATH . '/' . ZENFOLDER . '/';
$zenphoto_tabs['overview']['subtabs'] = array(gettext('Sitemap') => '');
printAdminHeader('overview', 'sitemap');
if (isset($_GET['generatesitemaps'])) {
    $_zp_loggedin = NULL;
    $sitemap_number = sanitize_numeric($_GET['number']);
    $sitemap_index = getSitemapIndexLinks();
    $sitemap_albums = getSitemapAlbums();
    $sitemap_images = getSitemapImages();
    if (extensionEnabled('zenpage')) {
        $sitemap_newsindex = getSitemapZenpageNewsIndex();
        $sitemap_articles = getSitemapZenpageNewsArticles();
        $sitemap_categories = getSitemapZenpageNewsCategories();
        $sitemap_pages = getSitemapZenpagePages();
    }
    $numberAppend = '';
    if (isset($_GET['generatesitemaps']) && (!empty($sitemap_index) || !empty($sitemap_albums) || !empty($sitemap_images) || !empty($sitemap_newsindex) || !empty($sitemap_articles) || !empty($sitemap_categories) || !empty($sitemap_pages))) {
        $numberAppend = '-' . $sitemap_number;
        $metaURL = 'sitemap-extended-admin.php?generatesitemaps&amp;number=' . ($sitemap_number + SITEMAP_CHUNK);
    } else {
        $metaURL = '';
Beispiel #25
0
 if (isset($_POST['albums_per_page']) && isset($_POST['albums_per_row'])) {
     $albums_per_page = sanitize_numeric($_POST['albums_per_page']);
     $albums_per_row = max(1, sanitize_numeric($_POST['albums_per_row']));
     $albums_per_page = ceil($albums_per_page / $albums_per_row) * $albums_per_row;
     setThemeOption('albums_per_page', $albums_per_page, $table, $themename);
     setThemeOption('albums_per_row', $albums_per_row, $table, $themename);
 }
 if (isset($_POST['images_per_page']) && isset($_POST['images_per_row'])) {
     $images_per_page = sanitize_numeric($_POST['images_per_page']);
     $images_per_row = max(1, sanitize_numeric($_POST['images_per_row']));
     $images_per_page = ceil($images_per_page / $images_per_row) * $images_per_row;
     setThemeOption('images_per_page', $images_per_page, $table, $themename);
     setThemeOption('images_per_row', $images_per_row, $table, $themename);
 }
 if (isset($_POST['thumb_transition'])) {
     setThemeOption('thumb_transition', (int) (sanitize_numeric($_POST['thumb_transition']) - 1 && true), $table, $themename);
 }
 if (isset($_POST['custom_index_page'])) {
     setThemeOption('custom_index_page', sanitize($_POST['custom_index_page'], 3), $table, $themename);
 }
 $otg = getThemeOption('thumb_gray', $table, $themename);
 setThemeOption('thumb_gray', (int) isset($_POST['thumb_gray']), $table, $themename);
 if ($otg = getThemeOption('thumb_gray', $table, $themename)) {
     $wmo = 99;
 }
 // force cache clear
 $oig = getThemeOption('image_gray', $table, $themename);
 setThemeOption('image_gray', (int) isset($_POST['image_gray']), $table, $themename);
 if ($oig = getThemeOption('image_gray', $table, $themename)) {
     $wmo = 99;
 }
    /** Prints the jQuery bxslider HTML setup to be replaced by JS
     *
     * @param int $minitems The minimum number of thumbs to be visible always if resized regarding responsiveness.
     * @param int $maxitems The maximum number of thumbs to be visible always if resized regarding responsiveness.
     * @param int $width Width Set to NULL if you want to use the backend plugin options.
     * @param int $height Height Set to NULL if you want to use the backend plugin options.
     * @param int $cropw Crop width Set to NULL if you want to use the backend plugin options.
     * @param int $croph Crop heigth Set to NULL if you want to use the backend plugin options.
     * @param bool $crop TRUE for cropped thumbs, FALSE for un-cropped thumbs. $width and $height then will be used as maxspace. Set to NULL if you want to use the backend plugin options.
     * @param bool $fullimagelink Set to TRUE if you want the thumb link to link to the full image instead of the image page. Set to NULL if you want to use the backend plugin options.
     * @param string $mode 'horizontal','vertical', 'fade'
     * @param int $speed The speed in miliseconds the slides advance when clicked
     */
    function printThumbNav($minitems = NULL, $maxitems = NULL, $width = NULL, $height = NULL, $cropw = NULL, $croph = NULL, $fullimagelink = NULL, $mode = NULL, $speed = NULL)
    {
        global $_zp_gallery, $_zp_current_album, $_zp_current_image, $_zp_current_search, $_zp_gallery_page;
        //	Just incase the theme has not set the option, at least second try will work!
        setOptionDefault('bxslider_' . $_zp_gallery->getCurrentTheme() . '_' . stripSuffix($_zp_gallery_page), 1);
        $items = "";
        if (is_object($_zp_current_album) && $_zp_current_album->getNumImages() >= 2) {
            if (is_null($minitems)) {
                $minitems = getOption('bxslider_minitems');
            } else {
                $minitems = sanitize_numeric($minitems);
            }
            $minitems = max(1, (int) $minitems);
            if (is_null($maxitems)) {
                $maxitems = getOption('bxslider_maxitems');
            } else {
                $maxitems = sanitize_numeric($maxitems);
            }
            $maxitems = max(1, (int) $maxitems);
            if (is_null($width)) {
                $width = getOption('bxslider_width');
            } else {
                $width = sanitize_numeric($width);
            }
            if (is_null($height)) {
                $height = getOption('bxslider_height');
            } else {
                $height = sanitize_numeric($height);
            }
            if (is_null($cropw)) {
                $cropw = getOption('bxslider_cropw');
            } else {
                $cropw = sanitize_numeric($cropw);
            }
            if (is_null($croph)) {
                $croph = getOption('bxslider_croph');
            } else {
                $croph = sanitize_numeric($croph);
            }
            if (is_null($fullimagelink)) {
                $fullimagelink = getOption('bxslider_fullimagelink');
            } else {
                $fullimagelink = sanitize($fullimagelink);
            }
            if (is_null($mode)) {
                $mode = getOption('bxslider_mode');
            } else {
                $mode = sanitize($mode);
            }
            if (is_null($speed)) {
                $speed = getOption('bxslider_speed');
            } else {
                $speed = sanitize_numeric($speed);
            }
            if (in_context(ZP_SEARCH_LINKED)) {
                if ($_zp_current_search->getNumImages() === 0) {
                    $searchimages = false;
                } else {
                    $searchimages = true;
                }
            } else {
                $searchimages = false;
            }
            if (in_context(ZP_SEARCH_LINKED) && $searchimages) {
                $bxslider_items = $_zp_current_search->getImages();
            } else {
                $bxslider_items = $_zp_current_album->getImages();
            }
            if (count($bxslider_items) >= 2) {
                foreach ($bxslider_items as $item) {
                    if (is_array($item)) {
                        $imgobj = newImage(newAlbum($item['folder']), $item['filename']);
                    } else {
                        $imgobj = newImage($_zp_current_album, $item);
                    }
                    if ($fullimagelink) {
                        $link = $imgobj->getFullImageURL();
                    } else {
                        $link = $imgobj->getLink();
                    }
                    if (!is_null($_zp_current_image)) {
                        if ($_zp_current_album->isDynamic()) {
                            if ($_zp_current_image->filename == $imgobj->filename && $_zp_current_image->getAlbum()->name == $imgobj->getAlbum()->name) {
                                $active = ' class="activeimg" ';
                            } else {
                                $active = '';
                            }
                        } else {
                            if ($_zp_current_image->filename == $imgobj->filename) {
                                $active = ' class="activeimg" ';
                            } else {
                                $active = '';
                            }
                        }
                    } else {
                        $active = '';
                    }
                    $imageurl = $imgobj->getCustomImage(NULL, $width, $height, $cropw, $croph, NULL, NULL, true);
                    $items[] = '<li' . $active . '><a href="' . $link . '"><img src="' . html_encode($imageurl) . '" alt="' . html_encode($imgobj->getTitle()) . '"></a></li>';
                }
            }
            $albumid = $_zp_current_album->get('id');
            //$items = substr($items, 0, -2);
            $numimages = getNumImages();
            if (!is_null($_zp_current_image)) {
                $imgnumber = imageNumber() - 1;
            } else {
                $imgnumber = 0;
            }
            ?>
			<ul class="bxslider<?php 
            echo $albumid;
            ?>
">
				<?php 
            $count = '';
            foreach ($items as $item) {
                echo $item;
            }
            ?>
			</ul>
			<script type="text/javascript">
				$(document).ready(function() {
					var index = $('.bxslider<?php 
            echo $albumid;
            ?>
 li.activeimg').index();
					index = ++index;
					currentPager = parseInt(index / <?php 
            echo $maxitems;
            ?>
)
					$('.bxslider<?php 
            echo $albumid;
            ?>
').bxSlider({
						mode: '<?php 
            echo $mode;
            ?>
',
						minSlides: <?php 
            echo $minitems;
            ?>
,
						maxSlides: <?php 
            echo $maxitems;
            ?>
,
						speed: <?php 
            echo $speed;
            ?>
,
						slideWidth: <?php 
            echo $width;
            ?>
,
						slideMargin: 5,
						moveSlides: <?php 
            echo $maxitems;
            ?>
 - 1,
						pager: false,
						adaptiveHeight: true,
						useCSS: false,
						startSlide: currentPager
					});
				});
			</script>
			<?php 
        }
    }
Beispiel #27
0
 /**
  * Prints the slideshow using the {@link http://http://www.malsup.com/jquery/cycle/  jQuery plugin Cycle}
  *
  * Two ways to use:
  * a) Use on your theme's slideshow.php page and called via printSlideShowLink():
  * If called from image.php it starts with that image, called from album.php it starts with the first image (jQuery only)
  * To be used on slideshow.php only and called from album.php or image.php.
  *
  * b) Calling directly via printSlideShow() function (jQuery mode)
  * Place the printSlideShow() function where you want the slideshow to appear and set create an album object for $albumobj and if needed an image object for $imageobj.
  * The controls are disabled automatically.
  *
  * NOTE: The jQuery mode does not support movie and audio files anymore. If you need to show them please use the Flash mode.
  * Also note that this function is not used for the Colorbox mode!
  *
  * @param bool $heading set to true (default) to emit the slideshow breadcrumbs in flash mode
  * @param bool $speedctl controls whether an option box for controlling transition speed is displayed
  * @param obj $albumobj The object of the album to show the slideshow of. If set this overrides the POST data of the printSlideShowLink()
  * @param obj $imageobj The object of the image to start the slideshow with. If set this overrides the POST data of the printSlideShowLink(). If not set the slideshow starts with the first image of the album.
  * @param int $width The width of the images (jQuery mode). If set this overrides the size the slideshow_width plugin option that otherwise is used.
  * @param int $height The heigth of the images (jQuery mode). If set this overrides the size the slideshow_height plugin option that otherwise is used.
  * @param bool $crop Set to true if you want images cropped width x height (jQuery mode only)
  * @param bool $shuffle Set to true if you want random (shuffled) order
  * @param bool $linkslides Set to true if you want the slides to be linked to their image pages (jQuery mode only)
  * @param bool $controls Set to true (default) if you want the slideshow controls to be shown (might require theme CSS changes if calling outside the slideshow.php page) (jQuery mode only)
  *
  */
 function printSlideShow($heading = true, $speedctl = false, $albumobj = NULL, $imageobj = NULL, $width = NULL, $height = NULL, $crop = false, $shuffle = false, $linkslides = false, $controls = true)
 {
     global $_myFavorites, $_zp_conf_vars;
     if (!isset($_POST['albumid']) and !is_object($albumobj)) {
         return '<div class="errorbox" id="message"><h2>' . gettext('Invalid linking to the slideshow page.') . '</h2></div>';
     }
     //getting the image to start with
     if (!empty($_POST['imagenumber']) and !is_object($imageobj)) {
         $imagenumber = sanitize_numeric($_POST['imagenumber']) - 1;
         // slideshows starts with 0, but zp with 1.
     } elseif (is_object($imageobj)) {
         $imagenumber = $imageobj->getIndex();
     } else {
         $imagenumber = 0;
     }
     // set pagenumber to 0 if not called via POST link
     if (isset($_POST['pagenr'])) {
         $pagenumber = sanitize_numeric($_POST['pagenr']);
     } else {
         $pagenumber = 1;
     }
     // getting the number of images
     if (!empty($_POST['numberofimages'])) {
         $numberofimages = sanitize_numeric($_POST['numberofimages']);
     } elseif (is_object($albumobj)) {
         $numberofimages = $albumobj->getNumImages();
     } else {
         $numberofimages = 0;
     }
     if ($imagenumber < 2 || $imagenumber > $numberofimages) {
         $imagenumber = 0;
     }
     //getting the album to show
     if (!empty($_POST['albumid']) && !is_object($albumobj)) {
         $albumid = sanitize_numeric($_POST['albumid']);
     } elseif (is_object($albumobj)) {
         $albumid = $albumobj->getID();
     } else {
         $albumid = 0;
     }
     if (isset($_POST['preserve_search_params'])) {
         // search page
         $search = new SearchEngine();
         $params = sanitize($_POST['preserve_search_params']);
         $search->setSearchParams($params);
         $searchwords = $search->getSearchWords();
         $searchdate = $search->getSearchDate();
         $searchfields = $search->getSearchFields(true);
         $page = $search->page;
         $returnpath = getSearchURL($searchwords, $searchdate, $searchfields, $page);
         $albumobj = new AlbumBase(NULL, false);
         $albumobj->setTitle(gettext('Search'));
         $albumobj->images = $search->getImages(0);
     } else {
         if (isset($_POST['favorites_page'])) {
             $albumobj = $_myFavorites;
             $returnpath = $_myFavorites->getLink($pagenumber);
         } else {
             $albumq = query_single_row("SELECT title, folder FROM " . prefix('albums') . " WHERE id = " . $albumid);
             $albumobj = newAlbum($albumq['folder']);
             if (empty($_POST['imagenumber'])) {
                 $returnpath = $albumobj->getLink($pagenumber);
             } else {
                 $image = newImage($albumobj, sanitize($_POST['imagefile']));
                 $returnpath = $image->getLink();
             }
         }
     }
     echo slideshow::getShow($heading, $speedctl, $albumobj, $imageobj, $width, $height, $crop, $shuffle, $linkslides, $controls, $returnpath, $imagenumber);
 }
 }
 $comments = wp_query_full_array("\n\t\t\t\t\t\t\tSELECT comment_post_ID, comment_author, comment_author_email, comment_author_url,comment_date, comment_content, comment_approved\n\t\t\t\t\t\t\tFROM " . wp_prefix('comments', $wp_prefix) . "\n\t\t\t\t\t\t\tWHERE comment_approved = 1 AND comment_post_ID = " . $post['id'], $wpdbconnection);
 $commentcount = '';
 $commentexists_count = '';
 if ($comments) {
     $postinfo .= '<ul>';
     foreach ($comments as $comment) {
         $comment['comment_author'] = $_zp_UTF8->convert($comment['comment_author']);
         $comment['comment_author_email'] = $comment['comment_author_email'];
         $comment['comment_author_url'] = $comment['comment_author_url'];
         $comment['comment_date'] = $comment['comment_date'];
         $comment['comment_content'] = nl2br($_zp_UTF8->convert($comment['comment_content']));
         if (getcheckboxState('convertlinefeeds')) {
             $comment['comment_content'] = nl2br($comment['comment_content']);
         }
         $comment_approved = sanitize_numeric($comment['comment_approved']);
         if ($comment_approved == 1) {
             // in WP 1 means approved, with ZP the opposite!
             $comment_approved = 0;
         } else {
             $comment_approved = 1;
         }
         //echo "commentstatus:".$comment['comment_approved'];
         if (query_single_row("SELECT * from " . prefix('comments') . " WHERE ownerid =" . $newarticleid . " AND name=" . db_quote($comment['comment_author']) . " AND email =" . db_quote($comment['comment_author_email']) . " AND website =" . db_quote($comment['comment_author_url']) . " AND date =" . db_quote($comment['comment_date']) . " AND comment =" . db_quote($comment['comment_content']) . " AND inmoderation =" . $comment_approved . " AND type='" . $ctype . "'", false)) {
             $commentexists_count++;
         } else {
             if (query("INSERT INTO " . prefix('comments') . " (ownerid,name,email,website,date,comment,inmoderation,type) VALUES (" . $newarticleid . "," . db_quote($comment['comment_author']) . "," . db_quote($comment['comment_author_email']) . "," . db_quote($comment['comment_author_url']) . "," . db_quote($comment['comment_date']) . "," . db_quote($comment['comment_content']) . "," . $comment_approved . ",'" . $ctype . "')", true)) {
                 $commentcount++;
             } else {
                 $postinfo .= '<li class="import-error">' . gettext('Comment could not be assigned!') . '</li>';
             }
/**
 * Gets latest comments for news articles and pages
 *
 * @param int $number how many comments you want.
 * @param string $type 	"all" for all latest comments for all news articles and all pages
 * 											"news" for the lastest comments of one specific news article
 * 											"page" for the lastest comments of one specific page
 * @param int $itemID the ID of the element to get the comments for if $type != "all"
 */
function getLatestZenpageComments($number, $type = "all", $itemID = "")
{
    $itemID = sanitize_numeric($itemID);
    $number = sanitize_numeric($number);
    $checkauth = zp_loggedin();
    if ($type == 'all' || $type == 'news') {
        $newspasswordcheck = "";
        if (zp_loggedin(MANAGE_ALL_NEWS_RIGHTS)) {
            $newsshow = '';
        } else {
            $newsshow = 'news.show=1 AND';
            $newscheck = query_full_array("SELECT * FROM " . prefix('news') . " ORDER BY date");
            foreach ($newscheck as $articlecheck) {
                $obj = new ZenpageNews($articlecheck['titlelink']);
                if ($obj->inProtectedCategory()) {
                    if ($checkauth && $obj->isMyItem(LIST_RIGHTS)) {
                        $newsshow = '';
                    } else {
                        $excludenews = " AND id != " . $articlecheck['id'];
                        $newspasswordcheck = $newspasswordcheck . $excludenews;
                    }
                }
            }
        }
    }
    if ($type == 'all' || $type == 'page') {
        $pagepasswordcheck = "";
        if (zp_loggedin(MANAGE_ALL_PAGES_RIGHTS)) {
            $pagesshow = '';
        } else {
            $pagesshow = 'pages.show=1 AND';
            $pagescheck = query_full_array("SELECT * FROM " . prefix('pages') . " ORDER BY date");
            foreach ($pagescheck as $pagecheck) {
                $obj = new ZenpagePage($pagecheck['titlelink']);
                if ($obj->isProtected()) {
                    if ($checkauth && $obj->isMyItem(LIST_RIGHTS)) {
                        $pagesshow = '';
                    } else {
                        $excludepages = " AND pages.id != " . $pagecheck['id'];
                        $pagepasswordcheck = $pagepasswordcheck . $excludepages;
                    }
                }
            }
        }
    }
    switch ($type) {
        case "news":
            $whereNews = " WHERE {$newsshow} news.id = " . $itemID . " AND c.ownerid = news.id AND c.type = 'news' AND c.private = 0 AND c.inmoderation = 0" . $newspasswordcheck;
            break;
        case "page":
            $wherePages = " WHERE {$pagesshow} pages.id = " . $itemID . " AND c.ownerid = pages.id AND c.type = 'pages' AND c.private = 0 AND c.inmoderation = 0" . $pagepasswordcheck;
            break;
        case "all":
            $whereNews = " WHERE {$newsshow} c.ownerid = news.id AND c.type = 'news' AND c.private = 0 AND c.inmoderation = 0" . $newspasswordcheck;
            $wherePages = " WHERE {$pagesshow} c.ownerid = pages.id AND c.type = 'pages' AND c.private = 0 AND c.inmoderation = 0" . $pagepasswordcheck;
            break;
    }
    $comments_news = array();
    $comments_pages = array();
    if ($type == "all" or $type == "news") {
        $comments_news = query_full_array("SELECT c.id, c.name, c.type, c.website," . " c.date, c.anon, c.comment, news.title, news.titlelink FROM " . prefix('comments') . " AS c, " . prefix('news') . " AS news " . $whereNews . " ORDER BY c.id DESC LIMIT {$number}");
    }
    if ($type == "all" or $type == "page") {
        $comments_pages = query_full_array($sql = "SELECT c.id, c.name, c.type, c.website," . " c.date, c.anon, c.comment, pages.title, pages.titlelink FROM " . prefix('comments') . " AS c, " . prefix('pages') . " AS pages " . $wherePages . " ORDER BY c.id DESC LIMIT {$number}");
    }
    $comments = array();
    foreach ($comments_news as $comment) {
        $comments[$comment['id']] = $comment;
    }
    foreach ($comments_pages as $comment) {
        $comments[$comment['id']] = $comment;
    }
    krsort($comments);
    return array_slice($comments, 0, $number);
}
    $obj = new ZenpageCategory($x['titlelink']);
    $obj->set('hitcounter', 0);
    $obj->save();
}
if (isset($_GET['publish'])) {
    XSRFdefender('update');
    $obj = new ZenpageCategory(sanitize($_GET['titlelink']));
    $obj->setShow(sanitize_numeric($_GET['publish']));
    $obj->save();
}
if (isset($_GET['save'])) {
    XSRFdefender('save_categories');
    addCategory($reports);
}
if (isset($_GET['id'])) {
    $x = $_zp_zenpage->getCategory(sanitize_numeric($_GET['id']));
    $result = new ZenpageCategory($x['titlelink']);
} else {
    if (isset($_GET['update'])) {
        XSRFdefender('update_categories');
        $result = updateCategory($reports);
    } else {
        $result = new ZenpageCategory('');
    }
}
printAdminHeader('news', 'categories');
zp_apply_filter('texteditor_config', '', 'zenpage');
printSortableHead();
zenpageJSCSS();
?>
<script type="text/javascript">