コード例 #1
0
ファイル: seo_cleanup.php プロジェクト: rb26/zenphoto
 function cleanAlbum($obj)
 {
     global $albumcount;
     $subalbum = $obj->name;
     $file = basename($subalbum);
     $seoname = seoFriendly($file);
     $album_cleaned = false;
     if ($seoname != $file) {
         $newname = dirname($subalbum);
         if (empty($newname) || $newname == '.') {
             $newname = $seoname;
         } else {
             $newname .= '/' . $seoname;
         }
         if ($e = $obj->rename($newname)) {
             $error = getE($e, $subalbum, $newname);
             printf(gettext('<em>%1$s</em> rename to <em>%2$s</em> failed: %3$s'), $subalbum, $newname, $error);
             echo "<br />\n";
         } else {
             $obj->save();
             clearstatcache();
             printf(gettext('<em>%1$s</em> renamed to <em>%2$s</em>'), $subalbum, $newname);
             echo "<br />\n";
             $albumcount++;
             $obj = newAlbum($newname);
             zpFunctions::removeDir(SERVERCACHE . '/' . $subalbum);
             if (extensionEnabled('static_html_cache')) {
                 Gallery::clearCache(SERVERPATH . '/' . STATIC_CACHE_FOLDER);
             }
             $album_cleaned = true;
         }
     }
     if (!$obj->isDynamic()) {
         checkFolder($obj, $album_cleaned);
     }
 }
コード例 #2
0
/**
 * @deprecated
 * @since 1.4.5
 */
function printField($context, $field, $convertBR = NULL, $override = false, $label = '')
{
    deprecated_functions::notify(gettext('Front end editing is not supported. Use the property specific methods.'));
    if (is_null($convertBR)) {
        $convertBR = !extensionEnabled('tiny_mce');
    }
    switch ($context) {
        case 'image':
            global $_zp_current_image;
            $object = $_zp_current_image;
            break;
        case 'album':
            global $_zp_current_album;
            $object = $_zp_current_album;
            break;
        case 'pages':
            global $_zp_current_zenpage_page;
            $object = $_zp_current_zenpage_page;
            break;
        case 'news':
            global $_zp_current_zenpage_news;
            $object = $_zp_current_zenpage_news;
            break;
        default:
            trigger_error(sprintf(gettext('printField() invalid function call, context %X.'), $context), E_USER_NOTICE);
            return false;
    }
    if (!$field) {
        trigger_error(sprintf(gettext('printField() invalid function call, field:%s.'), $field), E_USER_NOTICE);
        return false;
    }
    if (!is_object($object)) {
        trigger_error(gettext('printField() invalid function call, not an object.'), E_USER_NOTICE);
        return false;
    }
    if ($override) {
        $text = trim($override);
    } else {
        $text = trim(get_language_string($object->get($field)));
    }
    $text = zpFunctions::unTagURLs($text);
    $text = html_encodeTagged($text);
    if ($convertBR) {
        $text = str_replace("\r\n", "\n", $text);
        $text = str_replace("\n", "<br />", $text);
    }
    if (!empty($text)) {
        echo $label;
    }
    echo $text;
}
コード例 #3
0
ファイル: seo_locale.php プロジェクト: JoniWeiss/JoniWebGirl
 static function localePath($full = false, $loc = NULL)
 {
     if ($full) {
         $path = FULLWEBPATH;
     } else {
         $path = WEBPATH;
     }
     if ($locale = zpFunctions::getLanguageText($loc)) {
         $path .= '/' . $locale;
     }
     return $path;
 }
コード例 #4
0
ファイル: setup.php プロジェクト: ariep/ZenPhoto20-DEV
    }
    ?>
		<body>
			<?php 
    printLogoAndLinks();
    ?>
			<div id="main">
				<div id="content">
					<h1><?php 
    echo gettext('Setup request');
    ?>
</h1>
					<div class="tabbox">
						<p>
							<?php 
    if (zpFunctions::hasPrimaryScripts()) {
        if ($found) {
            echo '<a href="' . WEBPATH . '/' . ZENFOLDER . '/setup.php?xsrfToken=' . getXSRFToken('setup') . '">' . gettext('Click to restore the setup scripts and run setup.') . '</a>';
        } else {
            printf(gettext('You must restore the setup files from the %1$s release.'), ZENPHOTO_VERSION);
        }
    } else {
        echo gettext('You must restore the setup files on your primary installation to run the setup operation.');
    }
    ?>
						</p>
					</div>
				</div>
			</div>
		</body>
	</html>
コード例 #5
0
ファイル: load_objectClasses.php プロジェクト: rb26/zenphoto
        $masks[] = ADMIN_PLUGIN | FEATURE_PLUGIN;
    }
    if (DEBUG_PLUGINS) {
        if (OFFSET_PATH) {
            debugLog('Loading the "class" "feature" and "admin" plugins.');
        } else {
            debugLog('Loading the "class" plugins.');
        }
    }
    foreach ($masks as $mask) {
        foreach (getEnabledPlugins() as $extension => $plugin) {
            $priority = $plugin['priority'];
            if ($priority & $mask) {
                if (DEBUG_PLUGINS) {
                    list($usec, $sec) = explode(" ", microtime());
                    $start = (double) $usec + (double) $sec;
                }
                require_once $plugin['path'];
                $_zp_loaded_plugins[$extension] = $extension;
                if (DEBUG_PLUGINS) {
                    zpFunctions::pluginDebug($extension, $priority, $start);
                }
            }
        }
        require_once dirname(__FILE__) . '/auth_zp.php';
        // loaded after CLASS_PLUGIN and before ADMIN_PLUGIN
    }
} else {
    require_once dirname(__FILE__) . '/auth_zp.php';
    // setup needs this!
}
コード例 #6
0
/**
 * Write output to the debug log
 * Use this for debugging when echo statements would come before headers are sent
 * or would create havoc in the HTML.
 * Creates (or adds to) a file named debug.log which is located in the zenphoto core folder
 *
 * @param string $message the debug information
 * @param bool $reset set to true to reset the log to zero before writing the message
 * @param string $log alternative log file
 */
function debugLog($message, $reset = false, $log = 'debug')
{
    if (defined('SERVERPATH')) {
        global $_zp_mutex;
        $path = SERVERPATH . '/' . DATA_FOLDER . '/' . $log . '.log';
        $me = getmypid();
        if (is_object($_zp_mutex)) {
            $_zp_mutex->lock();
        }
        if ($reset || ($size = @filesize($path)) == 0 || defined('DEBUG_LOG_SIZE') && DEBUG_LOG_SIZE && $size > DEBUG_LOG_SIZE) {
            if (!$reset && $size > 0) {
                switchLog('debug');
            }
            $f = fopen($path, 'w');
            if ($f) {
                if (!class_exists('zpFunctions') || zpFunctions::hasPrimaryScripts()) {
                    $clone = '';
                } else {
                    $clone = ' ' . gettext('clone');
                }
                fwrite($f, '{' . $me . ':' . gmdate('D, d M Y H:i:s') . " GMT} ZenPhoto20 v" . ZENPHOTO_VERSION . $clone . "\n");
            }
        } else {
            $f = fopen($path, 'a');
            if ($f) {
                fwrite($f, '{' . $me . ':' . gmdate('D, d M Y H:i:s') . " GMT}\n");
            }
        }
        if ($f) {
            fwrite($f, "  " . $message . "\n");
            fclose($f);
            clearstatcache();
            if (defined('DATA_MOD')) {
                @chmod($path, DATA_MOD);
            }
        }
        if (is_object($_zp_mutex)) {
            $_zp_mutex->unlock();
        }
    }
}
コード例 #7
0
 static function extracontent($obj, $instance, $field, $type)
 {
     if ($type == 'save') {
         $extracontent = zpFunctions::updateImageProcessorLink(process_language_string_save("extracontent", EDITOR_SANITIZE_LEVEL));
         $obj->setExtracontent($extracontent);
         $obj->save();
         return NULL;
     } else {
         ob_start();
         print_language_string_list($obj->getExtraContent('all'), 'extracontent', true, NULL, 'extracontent', '100%', 'zenpage_language_string_list', 13);
         $item = ob_get_contents();
         ob_end_clean();
         return $item;
     }
 }
コード例 #8
0
ファイル: functions.php プロジェクト: JoniWeiss/JoniWebGirl
 /**
  *
  * Recursively clears and removes a folder
  * @param string $path
  * @return boolean
  */
 static function removeDir($path, $within = false)
 {
     if (($dir = @opendir($path)) !== false) {
         while (($file = readdir($dir)) !== false) {
             if ($file != '.' && $file != '..') {
                 if (is_dir($path . '/' . $file)) {
                     if (!zpFunctions::removeDir($path . '/' . $file)) {
                         return false;
                     }
                 } else {
                     @chmod($path . $file, 0777);
                     if (!@unlink($path . '/' . $file)) {
                         return false;
                     }
                 }
             }
         }
         closedir($dir);
         if (!$within) {
             @chmod($path, 0777);
             if (!@rmdir($path)) {
                 return false;
             }
         }
         return true;
     }
     return false;
 }
コード例 #9
0
                                $title = getTitle($table, $row) . ' ' . gettext('image processor reference');
                                ?>
										<a href="<?php 
                                echo $uri;
                                ?>
&amp;debug" title="<?php 
                                echo $title;
                                ?>
">
											<?php 
                                echo $url . "\n";
                                ?>
										</a>
										<?php 
                            }
                            $text = zpFunctions::updateImageProcessorLink($row[$field]);
                            if ($text != $row[$field]) {
                                $sql = 'UPDATE ' . prefix($table) . ' SET `' . $field . '`=' . db_quote($text) . ' WHERE `id`=' . $row['id'];
                                query($sql);
                            } else {
                                $refresh++;
                            }
                        }
                    }
                }
            }
        }
        $sql = 'SELECT * FROM ' . prefix($table) . ' WHERE `' . $field . '` REGEXP "<img.*src\\s*=\\s*\\".*' . CACHEFOLDER . '((\\.|[^\\"])*)"';
        $result = query($sql);
        if ($result) {
            while ($row = db_fetch_assoc($result)) {
コード例 #10
0
ファイル: static_html_cache.php プロジェクト: rb26/zenphoto
 /**
  * Cleans out the cache folder. (Adpated from the zenphoto image cache)
  *
  * @param string $cachefolder the sub-folder to clean
  */
 static function clearHTMLCache($folder = NULL)
 {
     if (is_null($folder)) {
         $cachesubfolders = array("index", "albums", "images", "pages");
         foreach ($cachesubfolders as $cachesubfolder) {
             zpFunctions::removeDir(SERVERPATH . '/' . STATIC_CACHE_FOLDER . "/" . $cachesubfolder, true);
         }
     } else {
         zpFunctions::removeDir(SERVERPATH . '/' . STATIC_CACHE_FOLDER . "/" . $folder);
     }
 }
コード例 #11
0
 /**
  * Prints html meta data to be used in the <head> section of a page
  *
  */
 static function getHTMLMetaData()
 {
     global $_zp_gallery, $_zp_page, $_zp_current_album, $_zp_current_image, $_zp_current_search, $_zp_current_article, $_zp_current_page, $_zp_gallery_page, $_zp_current_category, $_zp_authority, $_zp_conf_vars, $_myFavorites;
     $host = sanitize("http://" . $_SERVER['HTTP_HOST']);
     $url = $host . getRequestURI();
     // Convert locale shorttag to allowed html meta format
     $locale_ = getUserLocale();
     $locale = zpFunctions::getLanguageText($locale_, '-');
     $canonicalurl = '';
     // generate page title, get date
     $pagetitle = "";
     // for gallery index setup below switch
     $date = strftime(DATE_FORMAT);
     // if we don't have a item date use current date
     $desc = getBareGalleryDesc();
     $thumb = '';
     if (getOption('htmlmeta_sitelogo')) {
         $thumb = getOption('htmlmeta_sitelogo');
     }
     if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
         $ogimage_width = getOption('htmlmeta_ogimage_width');
         $ogimage_height = getOption('htmlmeta_ogimage_height');
         if (empty($ogimage_width)) {
             $ogimage_width = 1280;
         }
         if (empty($ogimage_height)) {
             $ogimage_height = 900;
         }
         $twittercard_type = 'summary';
     }
     $type = 'article';
     switch ($_zp_gallery_page) {
         case 'index.php':
             $desc = getBareGalleryDesc();
             $canonicalurl = $host . $_zp_gallery->getLink($_zp_page);
             $type = 'website';
             break;
         case 'album.php':
         case 'favorites.php':
             $pagetitle = getBareAlbumTitle() . " - ";
             $date = getAlbumDate();
             $desc = getBareAlbumDesc();
             $canonicalurl = $host . $_zp_current_album->getLink($_zp_page);
             if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
                 $thumbimg = $_zp_current_album->getAlbumThumbImage();
                 getMaxSpaceContainer($ogimage_width, $ogimage_height, $thumbimg, false);
                 $thumb = $host . html_encode(pathurlencode($thumbimg->getCustomImage(NULL, $ogimage_width, $ogimage_height, NULL, NULL, NULL, NULL, false, NULL)));
                 $twittercard_type = 'summary_large_image';
             }
             break;
         case 'image.php':
             $pagetitle = getBareImageTitle() . " (" . getBareAlbumTitle() . ") - ";
             $date = getImageDate();
             $desc = getBareImageDesc();
             $canonicalurl = $host . $_zp_current_image->getLink();
             if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
                 $thumb = $host . html_encode(pathurlencode(getCustomSizedImageMaxSpace($ogimage_width, $ogimage_height)));
                 $twittercard_type = 'summary_large_image';
             }
             break;
         case 'news.php':
             if (function_exists("is_NewsArticle")) {
                 if (is_NewsArticle()) {
                     $pagetitle = getBareNewsTitle() . " - ";
                     $date = getNewsDate();
                     $desc = trim(getBare(getNewsContent()));
                     $canonicalurl = $host . $_zp_current_article->getLink();
                 } else {
                     if (is_NewsCategory()) {
                         $pagetitle = $_zp_current_category->getTitlelink() . " - ";
                         $date = strftime(DATE_FORMAT);
                         $desc = trim(getBare($_zp_current_category->getDesc()));
                         $canonicalurl = $host . $_zp_current_category->getLink($_zp_page);
                         $type = 'category';
                     } else {
                         $pagetitle = gettext('News') . " - ";
                         $desc = '';
                         $canonicalurl = $host . getNewsPathNav($_zp_page);
                         $type = 'website';
                     }
                 }
             }
             break;
         case 'pages.php':
             $pagetitle = getBarePageTitle() . " - ";
             $date = getPageDate();
             $desc = trim(getBare(getPageContent()));
             $canonicalurl = $host . $_zp_current_page->getLink();
             break;
         default:
             // for all other possible static custom pages
             $custompage = stripSuffix($_zp_gallery_page);
             $standard = array('contact' => gettext('Contact'), 'register' => gettext('Register'), 'search' => gettext('Search'), 'archive' => gettext('Archive view'), 'password' => gettext('Password required'));
             if (is_object($_myFavorites)) {
                 $standard['favorites'] = gettext('My favorites');
             }
             if (array_key_exists($custompage, $standard)) {
                 $pagetitle = $standard[$custompage] . " - ";
             } else {
                 $pagetitle = $custompage . " - ";
             }
             $desc = '';
             $canonicalurl = $host . getCustomPageURL($custompage);
             break;
     }
     // shorten desc to the allowed 200 characters if necesssary.
     $desc = html_encode(trim(substr(getBare($desc), 0, 160)));
     $pagetitle = $pagetitle . getBareGalleryTitle();
     // get master admin
     $admin = $_zp_authority->getMasterUser();
     $author = $admin->getName();
     $meta = '';
     if (getOption('htmlmeta_http-equiv-cache-control')) {
         $meta .= '<meta http-equiv="Cache-control" content="' . getOption("htmlmeta_cache_control") . '">' . "\n";
     }
     if (getOption('htmlmeta_http-equiv-pragma')) {
         $meta .= '<meta http-equiv="pragma" content="' . getOption("htmlmeta_pragma") . '">' . "\n";
     }
     if (getOption('htmlmeta_name-keywords')) {
         $meta .= '<meta name="keywords" content="' . htmlmetatags::getMetaKeywords() . '">' . "\n";
     }
     if (getOption('htmlmeta_name-description')) {
         $meta .= '<meta name="description" content="' . $desc . '">' . "\n";
     }
     if (getOption('htmlmeta_name-page-topic')) {
         $meta .= '<meta name="page-topic" content="' . $desc . '">' . "\n";
     }
     if (getOption('htmlmeta_name-robots')) {
         $meta .= '<meta name="robots" content="' . getOption("htmlmeta_robots") . '">' . "\n";
     }
     if (getOption('htmlmeta_name-publisher')) {
         $meta .= '<meta name="publisher" content="' . FULLWEBPATH . '">' . "\n";
     }
     if (getOption('htmlmeta_name-creator')) {
         $meta .= '<meta name="creator" content="' . FULLWEBPATH . '">' . "\n";
     }
     if (getOption('htmlmeta_name-author')) {
         $meta .= '<meta name="author" content="' . $author . '">' . "\n";
     }
     if (getOption('htmlmeta_name-copyright')) {
         $meta .= '<meta name="copyright" content=" (c) ' . FULLWEBPATH . ' - ' . $author . '">' . "\n";
     }
     if (getOption('htmlmeta_name-rights')) {
         $meta .= '<meta name="rights" content="' . $author . '">' . "\n";
     }
     if (getOption('htmlmeta_name-generator')) {
         $meta .= '<meta name="generator" content="ZenPhoto20 ' . ZENPHOTO_VERSION . '">' . "\n";
     }
     if (getOption('htmlmeta_name-revisit-after')) {
         $meta .= '<meta name="revisit-after" content="' . getOption("htmlmeta_revisit_after") . ' days">' . "\n";
     }
     if (getOption('htmlmeta_name-expires')) {
         $expires = getOption("htmlmeta_expires");
         if ($expires == (int) $expires) {
             $expires = preg_replace('|\\s\\-\\d+|', '', date('r', time() + $expires)) . ' GMT';
         }
         $meta .= '<meta name="expires" content="' . $expires . '">' . "\n";
     }
     // OpenGraph meta
     if (getOption('htmlmeta_opengraph')) {
         $meta .= '<meta property="og:title" content="' . $pagetitle . '">' . "\n";
         if (!empty($thumb)) {
             $meta .= '<meta property="og:image" content="' . $thumb . '">' . "\n";
         }
         $meta .= '<meta property="og:description" content="' . $desc . '">' . "\n";
         $meta .= '<meta property="og:url" content="' . html_encode($url) . '">' . "\n";
         $meta .= '<meta property="og:type" content="' . $type . '">' . "\n";
     }
     // Social network extras
     if (getOption('htmlmeta_name-pinterest')) {
         $meta .= '<meta name="pinterest" content="nopin">' . "\n";
     }
     // dissalow users to pin images on Pinterest
     // Twitter card
     $twittername = getOption('htmlmeta_twittername');
     if (getOption('htmlmeta_twittercard') || !empty($twittername)) {
         $meta .= '<meta name="twitter:creator" content="' . $twittername . '">' . "\n";
         $meta .= '<meta name="twitter:site" content="' . $twittername . '">' . "\n";
         $meta .= '<meta name="twitter:card" content="' . $twittercard_type . '">' . "\n";
         $meta .= '<meta name="twitter:title" content="' . $pagetitle . '">' . "\n";
         $meta .= '<meta name="twitter:description" content="' . $desc . '">' . "\n";
         if (!empty($thumb)) {
             $meta .= '<meta name="twitter:image" content="' . $thumb . '">' . "\n";
         }
     }
     // Canonical url
     if (getOption('htmlmeta_canonical-url')) {
         $meta .= '<link rel="canonical" href="' . $canonicalurl . '">' . "\n";
         if (METATAG_LOCALE_TYPE) {
             $langs = generateLanguageList();
             if (count($langs) != 1) {
                 if (METATAG_LOCALE_TYPE == 1) {
                     $locallink = seo_locale::localePath(false, $locale_);
                 } else {
                     $locallink = '';
                 }
                 foreach ($langs as $text => $lang) {
                     $langcheck = zpFunctions::getLanguageText($lang, '-');
                     //	for hreflang we need en-US
                     if ($langcheck != $locale) {
                         if (METATAG_LOCALE_TYPE == 1) {
                             $altlink = seo_locale::localePath(true, $lang);
                         } else {
                             $altlink = dynamic_locale::fullHostPath($lang);
                         }
                         switch ($_zp_gallery_page) {
                             case 'index.php':
                                 $altlink .= str_replace($locallink, '', $_zp_gallery->getLink($_zp_page));
                                 break;
                             case 'album.php':
                             case 'favorites.php':
                                 $altlink .= str_replace($locallink, '', $_zp_current_album->getLink($_zp_page));
                                 break;
                             case 'image.php':
                                 $altlink .= str_replace($locallink, '', $_zp_current_image->getLink());
                                 break;
                             case 'news.php':
                                 if (function_exists("is_NewsArticle")) {
                                     if (is_NewsArticle()) {
                                         $altlink .= str_replace($locallink, '', $_zp_current_article->getLink());
                                     } else {
                                         if (is_NewsCategory()) {
                                             $altlink .= str_replace($locallink, '', $_zp_current_category->getLink($_zp_page));
                                         } else {
                                             $altlink .= getNewsPathNav($_zp_page);
                                         }
                                     }
                                 }
                                 break;
                             case 'pages.php':
                                 $altlink .= str_replace($locallink, '', $_zp_current_page->getLink());
                                 break;
                             case 'archive.php':
                                 $altlink .= getCustomPageURL('archive');
                                 break;
                             case 'search.php':
                                 $searchwords = $_zp_current_search->codifySearchString();
                                 $searchdate = $_zp_current_search->getSearchDate();
                                 $searchfields = $_zp_current_search->getSearchFields(true);
                                 $searchpagepath = getSearchURL($searchwords, $searchdate, $searchfields, $_zp_page, array('albums' => $_zp_current_search->getAlbumList()));
                                 $altlink .= $searchpagepath;
                                 break;
                             case 'contact.php':
                                 $altlink .= getCustomPageURL('contact');
                                 break;
                             default:
                                 // for all other possible none standard custom pages
                                 $altlink .= getCustomPageURL($pagetitle);
                                 break;
                         }
                         // switch
                         $meta .= '<link rel="alternate" hreflang="' . $langcheck . '" href="' . html_encode($altlink) . '">' . "\n";
                     }
                     // if lang
                 }
                 // foreach
             }
             // if count
         }
         // if option
     }
     // if canonical
     echo $meta;
 }
コード例 #12
0
/**
 * Loads a zenpage news article
 * Sets up $_zp_current_zenpage_news and returns it as the function result.
 *
 * @param array $request an array with one member: the key is "date", "category", or "title" and specifies
 * what you want loaded. The value is the date or title of the article wanted
 *
 * @return object
 */
function load_zenpage_news($request)
{
    global $_zp_current_zenpage_news, $_zp_current_category, $_zp_post_date;
    if (isset($request['date'])) {
        add_context(ZP_ZENPAGE_NEWS_DATE);
        $_zp_post_date = zpFunctions::removeTrailingSlash(sanitize($request['date']));
    }
    if (isset($request['category'])) {
        $titlelink = sanitize(rtrim($request['category'], '/'));
        $_zp_current_category = new ZenpageCategory($titlelink);
        if ($_zp_current_category->loaded) {
            add_context(ZP_ZENPAGE_NEWS_CATEGORY);
        } else {
            $_GET['p'] = 'CATEGORY:' . $titlelink;
            unset($_GET['category']);
            return false;
        }
    }
    if (isset($request['title'])) {
        $titlelink = sanitize(rtrim($request['title'], '/'));
        $sql = 'SELECT `id` FROM ' . prefix('news') . ' WHERE `titlelink`=' . db_quote($titlelink);
        $result = query_single_row($sql);
        if (is_array($result)) {
            add_context(ZP_ZENPAGE_NEWS_ARTICLE | ZP_ZENPAGE_SINGLE);
            $_zp_current_zenpage_news = new ZenpageNews($titlelink);
        } else {
            $_GET['p'] = 'NEWS:' . $titlelink;
        }
        return $_zp_current_zenpage_news;
    }
    return true;
}
コード例 #13
0
setOptionDefault('RSS_pages', 1);
setOptionDefault('RSS_article_comments', 1);
setOptionDefault('AlbumThumbSelect', 1);
setOptionDefault('site_email', "zenphoto@" . $_SERVER['SERVER_NAME']);
setOptionDefault('site_email_name', 'ZenPhoto20');
//effervescence_plus migration
if (file_exists(SERVERPATH . '/' . THEMEFOLDER . '/effervescence_plus')) {
    if ($_zp_gallery->getCurrentTheme() == 'effervescence_plus') {
        $_zp_gallery->setCurrentTheme('effervescence+');
        $_zp_gallery->save();
    }
    $options = query_full_array('SELECT LCASE(`name`) as name, `value` FROM ' . prefix('options') . ' WHERE `theme`="effervescence_plus"');
    foreach ($options as $option) {
        setThemeOption($option['name'], $option['value'], NULL, 'effervescence+', true);
    }
    zpFunctions::removeDir(SERVERPATH . '/' . THEMEFOLDER . '/effervescence_plus');
}
?>
<p>
	<?php 
$deprecate = false;
$themes = array_keys($_zp_gallery->getThemes());
natcasesort($themes);
echo gettext('Theme setup:') . '<br />';
foreach ($themes as $key => $theme) {
    if (protectedTheme($theme)) {
        unset($themes[$key]);
    } else {
        $deprecate = true;
    }
    ?>
コード例 #14
0
/**
 * Updates or adds a news article and returns the object of that article
 *
 * @param array $reports display
 * @param bool $newarticle true if a new article
 *
 * @return object
 */
function updateArticle(&$reports, $newarticle = false)
{
    $date = date('Y-m-d_H-i-s');
    $title = process_language_string_save("title", 2);
    $author = sanitize($_POST['author']);
    $content = zpFunctions::updateImageProcessorLink(process_language_string_save("content", EDITOR_SANITIZE_LEVEL));
    $extracontent = zpFunctions::updateImageProcessorLink(process_language_string_save("extracontent", EDITOR_SANITIZE_LEVEL));
    $custom = process_language_string_save("custom_data", 1);
    $show = getcheckboxState('show');
    $date = sanitize($_POST['date']);
    $expiredate = getExpiryDatePost();
    $permalink = getcheckboxState('permalink');
    $lastchange = sanitize($_POST['lastchange']);
    $lastchangeauthor = sanitize($_POST['lastchangeauthor']);
    $commentson = getcheckboxState('commentson');
    if (zp_loggedin(CODEBLOCK_RIGHTS)) {
        $codeblock = processCodeblockSave(0);
    }
    $locked = getcheckboxState('locked');
    if ($newarticle) {
        $titlelink = seoFriendly(get_language_string($title));
        if (empty($titlelink)) {
            $titlelink = seoFriendly($date);
        }
        $sql = 'SELECT `id` FROM ' . prefix('news') . ' WHERE `titlelink`=' . db_quote($titlelink);
        $rslt = query_single_row($sql, false);
        if ($rslt) {
            //already exists
            $time = explode(' ', microtime());
            $titlelink = $titlelink . '_' . ($time[1] + $time[0]);
            $reports[] = "<p class='warningbox fade-message'>" . gettext('Duplicate article title') . '</p>';
        }
        $oldtitlelink = $titlelink;
        $id = 0;
    } else {
        $titlelink = $oldtitlelink = sanitize($_POST['titlelink-old'], 3);
        $id = sanitize($_POST['id']);
    }
    if (getcheckboxState('edittitlelink')) {
        $titlelink = sanitize($_POST['titlelink'], 3);
        if (empty($titlelink)) {
            $titlelink = seoFriendly(get_language_string($title));
            if (empty($titlelink)) {
                $titlelink = seoFriendly($date);
            }
        }
    } else {
        if (!$permalink) {
            //	allow the title link to change.
            $link = seoFriendly(get_language_string($title));
            if (!empty($link)) {
                $titlelink = $link;
            }
        }
    }
    $rslt = true;
    if ($titlelink != $oldtitlelink) {
        // title link change must be reflected in DB before any other updates
        $rslt = query('UPDATE ' . prefix('news') . ' SET `titlelink`=' . db_quote($titlelink) . ' WHERE `id`=' . $id, false);
        if (!$rslt) {
            $titlelink = $oldtitlelink;
            // force old link so data gets saved
        } else {
            SearchEngine::clearSearchCache();
        }
    }
    // update article
    $article = new ZenpageNews($titlelink, true);
    $article->setTitle($title);
    $article->setContent($content);
    $article->setExtracontent($extracontent);
    $article->setCustomData(zp_apply_filter('save_article_custom_data', $custom, $article));
    $article->setShow($show);
    $article->setDateTime($date);
    $article->setCommentsAllowed($commentson);
    if (zp_loggedin(CODEBLOCK_RIGHTS)) {
        $article->setCodeblock($codeblock);
    }
    $article->setAuthor($author);
    $article->setLastchange($lastchange);
    $article->setLastchangeauthor($lastchangeauthor);
    $article->setPermalink($permalink);
    $article->setLocked($locked);
    $article->setExpiredate($expiredate);
    $article->setSticky(sanitize_numeric($_POST['sticky']));
    if (getcheckboxState('resethitcounter')) {
        $article->set('hitcounter', 0);
    }
    if (getcheckboxState('reset_rating')) {
        $article->set('total_value', 0);
        $article->set('total_votes', 0);
        $article->set('used_ips', 0);
    }
    $article->setTruncation(getcheckboxState('truncation'));
    processTags($article);
    $categories = array();
    $result2 = query_full_array("SELECT * FROM " . prefix('news_categories') . " ORDER BY titlelink");
    foreach ($result2 as $cat) {
        if (isset($_POST["cat" . $cat['id']])) {
            $categories[] = $cat['titlelink'];
        }
    }
    $article->setCategories($categories);
    if ($newarticle) {
        $msg = zp_apply_filter('new_article', '', $article);
        if (empty($title)) {
            $reports[] = "<p class='errorbox fade-message'>" . sprintf(gettext("Article <em>%s</em> added but you need to give it a <strong>title</strong> before publishing!"), get_language_string($titlelink)) . '</p>';
        } else {
            $reports[] = "<p class='messagebox fade-message'>" . sprintf(gettext("Article <em>%s</em> added"), $titlelink) . '</p>';
        }
    } else {
        $msg = zp_apply_filter('update_article', '', $article, $oldtitlelink);
        if (!$rslt) {
            $reports[] = "<p class='errorbox fade-message'>" . sprintf(gettext("An article with the title/titlelink <em>%s</em> already exists!"), $titlelink) . '</p>';
        } else {
            if (empty($title)) {
                $reports[] = "<p class='errorbox fade-message'>" . sprintf(gettext("Article <em>%s</em> updated but you need to give it a <strong>title</strong> before publishing!"), get_language_string($titlelink)) . '</p>';
            } else {
                $reports[] = "<p class='messagebox fade-message'>" . sprintf(gettext("Article <em>%s</em> updated"), $titlelink) . '</p>';
            }
        }
    }
    $article->save();
    if ($msg) {
        $reports[] = $msg;
    }
    return $article;
}
コード例 #15
0
 /**
  * set the codeblocks as an serialized array
  *
  */
 function setCodeblock($cb)
 {
     $this->set('codeblock', zpFunctions::tagURLs($cb));
 }
コード例 #16
0
 static function localePath($full = false, $loc = NULL)
 {
     global $_zp_page, $_zp_gallery_page, $_zp_current_locale;
     if ($full) {
         $path = FULLWEBPATH;
     } else {
         $path = WEBPATH;
     }
     if (is_null($loc)) {
         $loc = zp_getCookie('dynamic_locale');
     }
     if ($loc != $_zp_current_locale) {
         if ($locale = zpFunctions::getLanguageText($loc)) {
             $path .= '/' . $locale;
         }
     }
     return $path;
 }
コード例 #17
0
/**
 * Generates an editable list of language strings
 *
 * @param string $dbstring either a serialized languag string array or a single string
 * @param string $name the prefix for the label, id, and name tags
 * @param bool $textbox set to true for a textbox rather than a text field
 * @param string $locale optional locale of the translation desired
 * @param string $edit optional class
 * @param int $wide column size. true or false for the standard or short sizes. Or pass a column size
 * @param string $ulclass set to the class for the UL element
 * @param int $rows set to the number of rows to show.
 */
function print_language_string_list($dbstring, $name, $textbox = false, $locale = NULL, $edit = '', $wide = TEXT_INPUT_SIZE, $ulclass = 'language_string_list', $rows = 6)
{
    global $_zp_active_languages, $_zp_current_locale, $_lsInstance;
    $dbstring = zpFunctions::unTagURLs($dbstring);
    if (!empty($edit)) {
        $edit = ' class="' . $edit . '"';
    }
    if (is_null($locale)) {
        $locale = getUserLocale();
    }
    $strings = getSerializedArray($dbstring);
    if (count($strings) == 1) {
        $keys = array_keys($strings);
        $lang = array_shift($keys);
        if (!is_string($lang)) {
            $strings = array($locale => array_shift($strings));
        }
    }
    $activelang = generateLanguageList();
    $allLang = array_flip(generateLanguageList('all'));
    foreach ($strings as $lang => $v) {
        if (!array_key_exists($lang, $activelang)) {
            $activelang[$allLang[$lang]] = $lang;
        }
    }
    echo '<div id="ls_' . ++$_lsInstance . '">' . "\n";
    if ($multi = getOption('multi_lingual') && !empty($activelang)) {
        if ($textbox) {
            if (strpos($wide, '%') === false) {
                $width = ' cols="' . $wide . '"';
            } else {
                $width = ' style="width:' . ((int) $wide - 1) . '%;"';
            }
        } else {
            if (strpos($wide, '%') === false) {
                $width = ' size="' . $wide . '"';
            } else {
                $width = ' style="width:' . ((int) $wide - 2) . '%;"';
            }
        }
        // put the language list in perferred order
        $preferred = array();
        if ($_zp_current_locale) {
            $preferred[] = $_zp_current_locale;
        }
        foreach (parseHttpAcceptLanguage() as $lang) {
            $preferred[] = str_replace('-', '_', $lang['fullcode']);
        }
        $preferred = array_unique($preferred);
        $emptylang = array();
        foreach ($preferred as $lang) {
            foreach ($activelang as $key => $active) {
                if ($active == $lang) {
                    $emptylang[$active] = $key;
                    unset($activelang[$key]);
                    continue 2;
                }
            }
            if (strlen($lang) == 2) {
                //	"wild card language"
                foreach ($activelang as $key => $active) {
                    if (substr($active, 0, 2) == $lang) {
                        $emptylang[$active] = $key;
                    }
                }
            }
        }
        foreach ($activelang as $key => $active) {
            $emptylang[$active] = $key;
        }
        if ($textbox) {
            $class = 'box';
        } else {
            $class = '';
        }
        echo '<ul id="ul_' . $_lsInstance . '" class="' . $ulclass . $class . '"' . ">\n";
        $empty = true;
        foreach ($emptylang as $key => $lang) {
            if (isset($strings[$key])) {
                $string = $strings[$key];
                if (!empty($string)) {
                    unset($emptylang[$key]);
                    $empty = false;
                    ?>
						<li>
							<label for="<?php 
                    echo $name . '_' . $key;
                    ?>
"><?php 
                    echo $lang;
                    ?>
</label>
							<?php 
                    if ($textbox) {
                        echo "\n" . '<textarea name="' . $name . '_' . $key . '"' . $edit . $width . '	rows="' . $rows . '">' . html_encode($string) . '</textarea>';
                    } else {
                        echo '<br /><input id="' . $name . '_' . $key . '" name="' . $name . '_' . $key . '"' . $edit . ' type="text" value="' . html_encode($string) . '"' . $width . ' />';
                    }
                    ?>
						</li>
						<?php 
                }
            }
        }
        foreach ($emptylang as $key => $lang) {
            ?>
				<li>
					<label for="<?php 
            echo $name . '_' . $key;
            ?>
"><?php 
            echo $lang;
            ?>
</label>
					<?php 
            if ($textbox) {
                echo "\n" . '<textarea name="' . $name . '_' . $key . '"' . $edit . $width . '	rows="' . $rows . '"></textarea>';
            } else {
                echo '<br /><input id="' . $name . '_' . $key . '" name="' . $name . '_' . $key . '"' . $edit . ' type="text" value=""' . $width . ' />';
            }
            ?>
				</li>
				<?php 
        }
        echo "</ul>\n";
    } else {
        if ($textbox) {
            if (strpos($wide, '%') === false) {
                $width = ' cols="' . $wide . '"';
            } else {
                $width = ' style="width:' . $wide . ';"';
            }
        } else {
            if (strpos($wide, '%') === false) {
                $width = ' size="' . $wide . '"';
            } else {
                $width = ' style="width:' . $wide . ';"';
            }
        }
        if (empty($locale)) {
            $locale = 'en_US';
        }
        if (isset($strings[$locale])) {
            $dbstring = $strings[$locale];
            unset($strings[$locale]);
        } else {
            $dbstring = array_shift($strings);
        }
        if ($textbox) {
            echo '<textarea name="' . $name . '_' . $locale . '"' . $edit . $width . '	rows="' . $rows . '">' . html_encode($dbstring) . '</textarea>';
        } else {
            echo '<input name="' . $name . '_' . $locale . '"' . $edit . ' type="text" value="' . html_encode($dbstring) . '"' . $width . ' />';
        }
        foreach ($strings as $key => $dbstring) {
            if (!empty($dbstring)) {
                ?>
					<input type="hidden" name="<?php 
                echo $name . '_' . $key;
                ?>
" value="<?php 
                echo html_encode($dbstring);
                ?>
" />
					<?php 
            }
        }
    }
    echo "</div>\n";
    if ($multi) {
        ?>
			<script type="text/javascript">
				$(function () {
					$('#ls_<?php 
        echo $_lsInstance;
        ?>
').resizable({
						minHeight: 60,
						resize: function (event, ui) {
							$(this).css("width", '');
							$('#ul_<?php 
        echo $_lsInstance;
        ?>
').height($('#ls_<?php 
        echo $_lsInstance;
        ?>
').height());
						}
					});
				});</script>
			<?php 
    }
}
コード例 #18
0
ファイル: rss.php プロジェクト: JoniWeiss/JoniWebGirl
/**
 * Prints an RSS link
 *
 * @param string $option type of RSS: See getRSSLink for details
 * @param string $prev text to before before the link
 * @param string $linktext title of the link
 * @param string $next text to appear after the link
 * @param bool $printIcon print an RSS icon beside it? if true, the icon is zp-core/images/rss.png
 * @param string $class css class
 * @param string $lang optional to display a feed link for a specific language. Enter the locale like "de_DE" (the locale must be installed on your Zenphoto to work of course). If empty the locale set in the admin option or the language selector (getOption('locale') is used.
 * @param string $addl provided additional data for feeds (e.g. album object for album feeds, $categorylink for zenpage categories
 */
function printRSSLink($option, $prev, $linktext, $next, $printIcon = true, $class = null, $lang = '', $addl = NULL)
{
    if ($printIcon) {
        $icon = ' <img src="' . FULLWEBPATH . '/' . ZENFOLDER . '/images/rss.png" alt="RSS Feed" />';
    } else {
        $icon = '';
    }
    if (!is_null($class)) {
        $class = 'class="' . $class . '"';
    }
    if (empty($lang)) {
        $lang = zpFunctions::getLanguageText(getOption("locale"));
    }
    echo $prev . "<a {$class} href=\"" . html_encode(getRSSLink($option, $lang, $addl)) . "\" title=\"" . html_encode($linktext) . "\" rel=\"nofollow\">" . $linktext . "{$icon}</a>" . $next;
}
コード例 #19
0
ファイル: reconfigure.php プロジェクト: ariep/ZenPhoto20-DEV
/**
 * control when and how setup scripts are turned back into PHP files
 * @param int reason
 * 						 1	No prior install signature
 * 						 2	restore setup files button
 * 						 4	Clone request
 * 						 5	Setup run with proper XSRF token
 * 						 6	checkSignature and no prior signature
 * 						11	No config file
 * 						12	No database specified
 * 						13	No DB connection
 * 						14	checkInstall Version has changed
 */
function restoreSetupScrpts($reason)
{
    //log setup file restore no matter what!
    require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/security-logger.php';
    switch ($reason) {
        default:
            $addl = sprintf(gettext('to run setup [%s]'), $reason);
            break;
        case 2:
            $addl = gettext('by Admin request');
            break;
        case 4:
            $addl = gettext('by cloning');
            break;
    }
    $allowed = defined('ADMIN_RIGHTS') && zp_loggedin(ADMIN_RIGHTS) && zpFunctions::hasPrimaryScripts();
    security_logger::log_setup($allowed, 'restore', $addl);
    if ($allowed) {
        if (!defined('FILE_MOD')) {
            define('FILE_MOD', 0666);
        }
        chdir(dirname(__FILE__) . '/setup/');
        $found = safe_glob('*.xxx');
        foreach ($found as $script) {
            chmod($script, 0777);
            if (@rename($script, stripSuffix($script) . '.php')) {
                chmod(stripSuffix($script) . '.php', FILE_MOD);
            } else {
                chmod($script, FILE_MOD);
            }
        }
    }
}
コード例 #20
0
 /**
  * set the codeblocks as an serialized array
  *
  */
 function setCodeblock($cb)
 {
     $this->codeblocks = zpFunctions::tagURLs($cb);
     $sql = 'UPDATE ' . prefix('plugin_storage') . ' SET `data`=' . db_quote($this->codeblocks) . ' WHERE `type`="defaultCodeblocks"';
     query($sql);
 }
コード例 #21
0
ファイル: class-feed.php プロジェクト: ariep/ZenPhoto20-DEV
 /**
  * Cleans out the cache folder
  *
  * @param string $cachefolder the sub-folder to clean
  */
 function clearCache($cachefolder = NULL)
 {
     zpFunctions::removeDir(SERVERPATH . '/' . STATIC_CACHE_FOLDER . '/' . strtolower($this->feed) . '/' . $cachefolder, true);
 }
コード例 #22
0
 * <b>Note:</b> If the destination already has a installation these files and folders will be removed by the cloning
 * process!
 *
 * The <i>Delete setup scripts</i> button will remove the <var>setup</var> files from the current installation. This is
 * the same function provided by <i>Setup</i> after a successful install. It is provided here because you will likely not want to
 * remove the setup scripts until you have cloned and installed all desired destinations.
 *
 * @author Stephen Billard (sbillard)
 *
 * @package plugins
 * @subpackage admin
 */
$plugin_is_filter = 5 | ADMIN_PLUGIN;
$plugin_description = gettext('Allows multiple installations to share a single set of script files.');
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = SYMLINK ? zpFunctions::hasPrimaryScripts() ? false : gettext('Only the primary installation may clone offspring installations.') : gettext('Your server does not support symbolic linking.');
require_once SERVERPATH . '/' . ZENFOLDER . '/reconfigure.php';
if ($plugin_disable) {
    enableExtension('cloneZenphoto', 0);
} else {
    zp_register_filter('admin_tabs', 'cloneZenphoto::tabs');
    class cloneZenphoto
    {
        static function tabs($tabs)
        {
            if (zp_loggedin(ADMIN_RIGHTS)) {
                $oldtabs = $tabs;
                $tabs = array();
                foreach ($oldtabs as $tab => $data) {
                    if ($tab == 'logs') {
                        $tabs['clone'] = array('text' => gettext("clone"), 'link' => WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . '/cloneZenphoto/cloneTab.php', 'rights' => ADMIN_RIGHTS, 'subtabs' => NULL);
コード例 #23
0
ファイル: html_meta_tags.php プロジェクト: rb26/zenphoto
    /**
     * Prints html meta data to be used in the <head> section of a page
     *
     */
    static function getHTMLMetaData()
    {
        global $_zp_gallery, $_zp_galley_page, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_gallery_page, $_zp_current_category, $_zp_authority, $_zp_conf_vars, $_myFavorites, $htmlmetatags_need_cache, $_zp_page;
        zp_register_filter('image_processor_uri', 'htmlmetatags::ipURI');
        $host = sanitize("http://" . $_SERVER['HTTP_HOST']);
        $url = $host . getRequestURI();
        // Convert locale shorttag to allowed html meta format
        $locale = str_replace("_", "-", getUserLocale());
        $canonicalurl = '';
        // generate page title, get date
        $pagetitle = "";
        // for gallery index setup below switch
        $date = strftime(DATE_FORMAT);
        // if we don't have a item date use current date
        $desc = getBareGalleryDesc();
        $thumb = '';
        if (getOption('htmlmeta_sitelogo')) {
            $thumb = getOption('htmlmeta_sitelogo');
        }
        if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
            $ogimage_width = getOption('htmlmeta_ogimage_width');
            $ogimage_height = getOption('htmlmeta_ogimage_height');
            if (empty($ogimage_width)) {
                $ogimage_width = 1280;
            }
            if (empty($ogimage_height)) {
                $ogimage_height = 900;
            }
        }
        $type = 'article';
        switch ($_zp_gallery_page) {
            case 'index.php':
                $desc = getBareGalleryDesc();
                //$canonicalurl = $host . getGalleryIndexURL();
                $canonicalurl = $host . getPageNumURL($_zp_page);
                $type = 'website';
                break;
            case 'album.php':
                $pagetitle = getBareAlbumTitle() . " - ";
                $date = getAlbumDate();
                $desc = getBareAlbumDesc();
                $canonicalurl = $host . getPageNumURL($_zp_page);
                if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
                    $thumbimg = $_zp_current_album->getAlbumThumbImage();
                    getMaxSpaceContainer($ogimage_width, $ogimage_height, $thumbimg, false);
                    $thumb = $host . html_encode(pathurlencode($thumbimg->getCustomImage(NULL, $ogimage_width, $ogimage_height, NULL, NULL, NULL, NULL, false, NULL)));
                }
                break;
            case 'image.php':
                $pagetitle = getBareImageTitle() . " (" . getBareAlbumTitle() . ") - ";
                $date = getImageDate();
                $desc = getBareImageDesc();
                $canonicalurl = $host . getImageURL();
                if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
                    $thumb = $host . html_encode(pathurlencode(getCustomSizedImageMaxSpace($ogimage_width, $ogimage_height)));
                }
                break;
            case 'news.php':
                if (function_exists("is_NewsArticle")) {
                    if (is_NewsArticle()) {
                        $pagetitle = getBareNewsTitle() . " - ";
                        $date = getNewsDate();
                        $desc = trim(getBare(getNewsContent()));
                        $canonicalurl = $host . $_zp_current_zenpage_news->getLink();
                    } else {
                        if (is_NewsCategory()) {
                            $pagetitle = $_zp_current_category->getTitlelink() . " - ";
                            $date = strftime(DATE_FORMAT);
                            $desc = trim(getBare($_zp_current_category->getDesc()));
                            $canonicalurl = $host . $_zp_current_category->getLink();
                            $type = 'category';
                        } else {
                            $pagetitle = gettext('News') . " - ";
                            $desc = '';
                            $canonicalurl = $host . getNewsIndexURL();
                            $type = 'website';
                        }
                    }
                    if ($_zp_page != 1) {
                        $canonicalurl .= '/' . $_zp_page;
                    }
                }
                break;
            case 'pages.php':
                $pagetitle = getBarePageTitle() . " - ";
                $date = getPageDate();
                $desc = trim(getBare(getPageContent()));
                $canonicalurl = $host . $_zp_current_zenpage_page->getLink();
                break;
            default:
                // for all other possible static custom pages
                $custompage = stripSuffix($_zp_gallery_page);
                $standard = array('contact' => gettext('Contact'), 'register' => gettext('Register'), 'search' => gettext('Search'), 'archive' => gettext('Archive view'), 'password' => gettext('Password required'));
                if (is_object($_myFavorites)) {
                    $standard['favorites'] = gettext('My favorites');
                }
                if (array_key_exists($custompage, $standard)) {
                    $pagetitle = $standard[$custompage] . " - ";
                } else {
                    $pagetitle = $custompage . " - ";
                }
                $desc = '';
                $canonicalurl = $host . getCustomPageURL($custompage);
                if ($_zp_page != 1) {
                    $canonicalurl .= '/' . $_zp_page;
                }
                break;
        }
        // shorten desc to the allowed 200 characters if necesssary.
        $desc = html_encode(trim(substr(getBare($desc), 0, 160)));
        $pagetitle = $pagetitle . getBareGalleryTitle();
        // get master admin
        $admin = $_zp_authority->getMasterUser();
        $author = $admin->getName();
        $meta = '';
        if (getOption('htmlmeta_http-equiv-cache-control')) {
            $meta .= '<meta http-equiv="Cache-control" content="' . getOption("htmlmeta_cache_control") . '">' . "\n";
        }
        if (getOption('htmlmeta_http-equiv-pragma')) {
            $meta .= '<meta http-equiv="pragma" content="' . getOption("htmlmeta_pragma") . '">' . "\n";
        }
        if (getOption('htmlmeta_name-keywords')) {
            $meta .= '<meta name="keywords" content="' . htmlmetatags::getMetaKeywords() . '">' . "\n";
        }
        if (getOption('htmlmeta_name-description')) {
            $meta .= '<meta name="description" content="' . $desc . '">' . "\n";
        }
        if (getOption('htmlmeta_name-page-topic')) {
            $meta .= '<meta name="page-topic" content="' . $desc . '">' . "\n";
        }
        if (getOption('htmlmeta_name-robots')) {
            $meta .= '<meta name="robots" content="' . getOption("htmlmeta_robots") . '">' . "\n";
        }
        if (getOption('htmlmeta_name-publisher')) {
            $meta .= '<meta name="publisher" content="' . FULLWEBPATH . '">' . "\n";
        }
        if (getOption('htmlmeta_name-creator')) {
            $meta .= '<meta name="creator" content="' . FULLWEBPATH . '">' . "\n";
        }
        if (getOption('htmlmeta_name-author')) {
            $meta .= '<meta name="author" content="' . $author . '">' . "\n";
        }
        if (getOption('htmlmeta_name-copyright')) {
            $meta .= '<meta name="copyright" content=" (c) ' . FULLWEBPATH . ' - ' . $author . '">' . "\n";
        }
        if (getOption('htmlmeta_name-rights')) {
            $meta .= '<meta name="rights" content="' . $author . '">' . "\n";
        }
        if (getOption('htmlmeta_name-generator')) {
            $meta .= '<meta name="generator" content="Zenphoto ' . ZENPHOTO_VERSION . '">' . "\n";
        }
        if (getOption('htmlmeta_name-revisit-after')) {
            $meta .= '<meta name="revisit-after" content="' . getOption("htmlmeta_revisit_after") . '">' . "\n";
        }
        if (getOption('htmlmeta_name-expires')) {
            $expires = getOption("htmlmeta_expires");
            if ($expires == (int) $expires) {
                $expires = preg_replace('|\\s\\-\\d+|', '', date('r', time() + $expires)) . ' GMT';
            }
            $meta .= '<meta name="expires" content="' . $expires . '">' . "\n";
        }
        // OpenGraph meta
        if (getOption('htmlmeta_og-title')) {
            $meta .= '<meta property="og:title" content="' . $pagetitle . '">' . "\n";
        }
        if (getOption('htmlmeta_og-image') && !empty($thumb)) {
            $meta .= '<meta property="og:image" content="' . $thumb . '">' . "\n";
        }
        if (getOption('htmlmeta_og-description')) {
            $meta .= '<meta property="og:description" content="' . $desc . '">' . "\n";
        }
        if (getOption('htmlmeta_og-url')) {
            $meta .= '<meta property="og:url" content="' . html_encode($url) . '">' . "\n";
        }
        if (getOption('htmlmeta_og-type')) {
            $meta .= '<meta property="og:type" content="' . $type . '">' . "\n";
        }
        // Social network extras
        if (getOption('htmlmeta_name-pinterest')) {
            $meta .= '<meta name="pinterest" content="nopin">' . "\n";
        }
        // dissalow users to pin images on Pinterest
        // Twitter card
        $twittername = getOption('htmlmeta_twittername');
        if (getOption('htmlmeta_twittercard') || !empty($twittername)) {
            $meta .= '<meta property="twitter:creator" content="' . $twittername . '">' . "\n";
            $meta .= '<meta property="twitter:site" content="' . $twittername . '">' . "\n";
            $meta .= '<meta property="twitter:card" content="summary">' . "\n";
            $meta .= '<meta property="twitter:title" content="' . $pagetitle . '">' . "\n";
            $meta .= '<meta property="twitter:description" content="' . $desc . '">' . "\n";
            if (!empty($thumb)) {
                $meta .= '<meta property="twitter:image" content="' . $thumb . '">' . "\n";
            }
        }
        // Canonical url
        if (getOption('htmlmeta_canonical-url')) {
            $meta .= '<link rel="canonical" href="' . $canonicalurl . '">' . "\n";
            if (METATAG_LOCALE_TYPE) {
                $langs = generateLanguageList();
                if (count($langs) != 1) {
                    foreach ($langs as $text => $lang) {
                        $langcheck = zpFunctions::getLanguageText($lang, '-');
                        //	for hreflang we need en-US
                        if ($langcheck != $locale) {
                            switch (METATAG_LOCALE_TYPE) {
                                case 1:
                                    $altlink = seo_locale::localePath(true, $lang);
                                    break;
                                case 2:
                                    $altlink = dynamic_locale::fullHostPath($lang);
                                    break;
                            }
                            switch ($_zp_gallery_page) {
                                case 'index.php':
                                    $altlink .= '/';
                                    break;
                                case 'gallery.php':
                                    $altlink .= '/' . _PAGE_ . '/gallery';
                                    break;
                                case 'album.php':
                                    $altlink .= '/' . html_encode($_zp_current_album->name) . '/';
                                    break;
                                case 'image.php':
                                    $altlink .= '/' . html_encode($_zp_current_album->name) . '/' . html_encode($_zp_current_image->filename) . IM_SUFFIX;
                                    break;
                                case 'news.php':
                                    if (function_exists("is_NewsArticle")) {
                                        if (is_NewsArticle()) {
                                            $altlink .= '/' . _NEWS_ . '/' . html_encode($_zp_current_zenpage_news->getTitlelink());
                                        } else {
                                            if (is_NewsCategory()) {
                                                $altlink .= '/' . _NEWS_ . '/' . html_encode($_zp_current_category->getTitlelink());
                                            } else {
                                                $altlink .= '/' . _NEWS_;
                                            }
                                        }
                                    }
                                    break;
                                case 'pages.php':
                                    $altlink .= '/' . _PAGES_ . '/' . html_encode($_zp_current_zenpage_page->getTitlelink());
                                    break;
                                case 'archive.php':
                                    $altlink .= '/' . _ARCHIVE_;
                                    break;
                                case 'search.php':
                                    $altlink .= '/' . _SEARCH_ . '/';
                                    break;
                                case 'contact.php':
                                    $altlink .= '/' . _CONTACT_ . '/';
                                    break;
                                default:
                                    // for all other possible none standard custom pages
                                    $altlink .= '/' . _PAGE_ . '/' . html_encode($pagetitle);
                                    break;
                            }
                            // switch
                            //append page number if needed
                            switch ($_zp_gallery_page) {
                                case 'index.php':
                                case 'album.php':
                                    if ($_zp_page != 1) {
                                        $altlink .= _PAGE_ . '/' . $_zp_page . '/';
                                    }
                                    break;
                                case 'gallery.php':
                                case 'news.php':
                                    if ($_zp_page != 1) {
                                        $altlink .= '/' . $_zp_page;
                                    }
                                    break;
                            }
                            $meta .= '<link rel="alternate" hreflang="' . $langcheck . '" href="' . $altlink . '">' . "\n";
                        }
                        // if lang
                    }
                    // foreach
                }
                // if count
            }
            // if option
        }
        // if canonical
        if (!empty($htmlmetatags_need_cache)) {
            $meta .= '<script type="text/javascript">' . "\n";
            $meta .= 'var caches = ["' . implode('","', $htmlmetatags_need_cache) . '"];' . "\n";
            $meta .= '
					window.onload = function() {
						var index,value;
						for (index in caches) {
								value = caches[index];
								$.ajax({
									cache: false,
									type: "GET",
									url: value
								});
						}
					}
					';
            $meta .= '</script>' . "\n";
        }
        zp_remove_filter('image_processor_uri', 'htmlmetatags::ipURI');
        echo $meta;
    }
コード例 #24
0
ファイル: clone.php プロジェクト: rb26/zenphoto
     }
 }
 if (!is_dir($folder . DATA_FOLDER)) {
     @mkdir($folder . DATA_FOLDER);
 }
 if (!is_dir($folder . THEMEFOLDER)) {
     @mkdir($folder . THEMEFOLDER);
 }
 foreach ($targets as $target => $type) {
     if (file_exists($folder . $target)) {
         $link = str_replace('\\', '/', @readlink($folder . $target));
         switch ($type) {
             case 'dir':
                 if (empty($link) || $link == $folder . $target) {
                     // an actual folder
                     if (zpFunctions::removeDir($folder . $target)) {
                         if (SYMLINK && @symlink(SERVERPATH . '/' . $target, $folder . $target)) {
                             $msg[] = sprintf(gettext('The existing folder <code>%s</code> was replaced.'), $folder . filesystemToInternal($target)) . "<br />\n";
                         } else {
                             $msg[] = sprintf(gettext('The existing folder <code>%1$s</code> was removed but Link creation failed.'), $target) . "<br />\n";
                             $success = false;
                         }
                     } else {
                         $msg[] = sprintf(gettext('The existing folder <code>%s</code> could not be removed.'), $folder . filesystemToInternal($target)) . "<br />\n";
                         $success = false;
                     }
                 } else {
                     // is a symlink
                     @chmod($folder . $target, 0777);
                     $success = @rmdir($folder . $target);
                     if (!$success) {
コード例 #25
0
ファイル: jplayer.php プロジェクト: ariep/ZenPhoto20-DEV
 *
 * If you are using more than one player on a page you need to pass a 3rd parameter with for example an unique number:<br>
 * [MEDIAPLAYER album1 video1.mp4 <var>1</var>]<br>
 * [MEDIAPLAYER album2 video2.mp4 <var>2</var>]
 *
 * <b>NOTE:</b> This player does not support external albums!
 *
 * @author Malte Müller (acrylian)
 * @package plugins
 * @subpackage media
 */
$plugin_is_filter = defaultExtension(5 | CLASS_PLUGIN);
$plugin_description = gettext("This plugin handles <code>flv</code>, <code>fla</code>, <code>mp3</code>, <code>mp4</code>, <code>m4v</code>, and <code>m4a</code> multi-media files.");
gettext("Please see <a href='http://jplayer.org'>jplayer.org</a> for more info about the player and its license.");
$plugin_author = "Malte Müller (acrylian)";
$plugin_disable = zpFunctions::pluginDisable(array(array(!extensionEnabled('class-video'), gettext('This plugin requires the <em>class-video</em> plugin')), array(!extensionEnabled('jplayer') && class_exists('Video') && Video::multimediaExtension() != 'pseudoPlayer', sprintf(gettext('jPlayer not enabled, %s is already instantiated.'), class_exists('Video') ? Video::multimediaExtension() : false)), array(getOption('album_folder_class') === 'external', gettext('This player does not support <em>External Albums</em>.'))));
$option_interface = 'jplayer_options';
if ($plugin_disable) {
    enableExtension('jplayer', 0);
} else {
    Gallery::addImageHandler('flv', 'Video');
    Gallery::addImageHandler('fla', 'Video');
    Gallery::addImageHandler('mp3', 'Video');
    Gallery::addImageHandler('mp4', 'Video');
    Gallery::addImageHandler('m4v', 'Video');
    Gallery::addImageHandler('m4a', 'Video');
    zp_register_filter('content_macro', 'jPlayer::macro');
}
class jplayer_options
{
    public $name = 'jPlayer';
コード例 #26
0
ファイル: classes.php プロジェクト: rb26/zenphoto
 /**
  * Sets the password hint
  *
  * @param string $hint the hint text
  */
 function setPasswordHint($hint)
 {
     $this->set('password_hint', zpFunctions::tagURLs($hint));
 }
コード例 #27
0
ファイル: zenpage-class.php プロジェクト: rb26/zenphoto
 /**
  * sets the extra content
  *
  */
 function setExtraContent($ec)
 {
     $this->set("extracontent", zpFunctions::tagURLs($ec));
 }
コード例 #28
0
 /**
  * Does the log handling
  *
  * @param int $success
  * @param string $user
  * @param string $name
  * @param string $ip
  * @param string $type
  * @param string $authority kind of login
  * @param string $addl more info
  */
 private static function Logger($success, $user, $name, $action, $authority, $addl = NULL)
 {
     global $_zp_authority, $_zp_mutex;
     $pattern = '~^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$~';
     $forwardedIP = NULL;
     $ip = sanitize($_SERVER['REMOTE_ADDR']);
     if (!preg_match($pattern, $ip)) {
         $ip = NULL;
     }
     if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         $forwardedIP = sanitize($_SERVER['HTTP_X_FORWARDED_FOR']);
         if (preg_match($pattern, $forwardedIP)) {
             $ip .= ' {' . $forwardedIP . '}';
         }
     }
     $admin = $_zp_authority->getMasterUser();
     $locale = $admin->getLanguage();
     if (empty($locale)) {
         $locale = 'en_US';
     }
     $cur_locale = getUserLocale();
     setupCurrentLocale($locale);
     //	the log will be in the language of the master user.
     switch ($action) {
         case 'clear_log':
             $type = gettext('Log reset');
             break;
         case 'delete_log':
             $type = gettext('Log deleted');
             break;
         case 'download_log':
             $type = gettext('Log downloaded');
             break;
         case 'setup_install':
             $type = gettext('Install');
             $addl = gettext('version') . ' ' . ZENPHOTO_VERSION . '[' . ZENPHOTO_RELEASE . "]";
             if (!zpFunctions::hasPrimaryScripts()) {
                 $addl .= ' ' . gettext('clone');
             }
             break;
         case 'setup_proptect':
             $type = gettext('Protect setup scripts');
             break;
         case 'user_new':
             $type = gettext('Request add user');
             break;
         case 'user_update':
             $type = gettext('Request update user');
             break;
         case 'user_delete':
             $type = gettext('Request delete user');
             break;
         case 'XSRF_blocked':
             $type = gettext('Cross Site Reference');
             break;
         case 'blocked_album':
             $type = gettext('Album access');
             break;
         case 'blocked_access':
             $type = gettext('Admin access');
             break;
         case 'Front-end':
             $type = gettext('Guest login');
             break;
         case 'Back-end':
             $type = gettext('Admin login');
             break;
         case 'auth_cookie':
             $type = gettext('Authorization cookie check');
             break;
         default:
             $type = $action;
             break;
     }
     $file = SERVERPATH . '/' . DATA_FOLDER . '/security.log';
     $max = getOption('security_log_size');
     $_zp_mutex->lock();
     if ($max && @filesize($file) > $max) {
         switchLog('security');
     }
     $preexists = file_exists($file) && filesize($file) > 0;
     $f = fopen($file, 'a');
     if ($f) {
         if (!$preexists) {
             // add a header
             fwrite($f, gettext('date' . "\t" . 'requestor’s IP' . "\t" . 'type' . "\t" . 'user ID' . "\t" . 'user name' . "\t" . 'outcome' . "\t" . 'authority' . "\tadditional information\n"));
         }
         $message = date('Y-m-d H:i:s') . "\t";
         $message .= $ip . "\t";
         $message .= $type . "\t";
         $message .= $user . "\t";
         $message .= $name . "\t";
         switch ($success) {
             case 0:
                 $message .= gettext("Failed") . "\t";
                 break;
             case 1:
                 $message .= gettext("Success") . "\t";
                 $message .= substr($authority, 0, strrpos($authority, '_auth'));
                 break;
             case 2:
                 $message .= gettext("Blocked") . "\t";
                 break;
             default:
                 $message .= $success . "\t";
         }
         if ($addl) {
             $message .= "\t" . $addl;
         }
         fwrite($f, $message . "\n");
         fclose($f);
         clearstatcache();
         if (!$preexists) {
             @chmod($file, 0660 & CHMOD_VALUE);
             if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
                 $permission = fileperms($file) & 0700;
                 //	on Windows owner==group==public
                 $check = $permission != 0600 & CHMOD_VALUE;
             } else {
                 $permission = fileperms($file) & 0777;
                 $check = $permission != 0660 & CHMOD_VALUE;
             }
             if ($check) {
                 $f = fopen($file, 'a');
                 fwrite($f, "\t\t" . gettext('Set Security log permissions') . "\t\t\t" . gettext('Failed') . "\t\t" . sprintf(gettext('File permissions of Security log are %04o'), $permission) . "\n");
                 fclose($f);
                 clearstatcache();
             }
         }
     }
     $_zp_mutex->unlock();
     setupCurrentLocale($cur_locale);
     //	restore to whatever was in effect.
 }
コード例 #29
0
ファイル: class-album.php プロジェクト: JoniWeiss/JoniWebGirl
 /**
  * Stores the album place
  *
  * @param string $place text for the place field
  */
 function setLocation($place)
 {
     $this->set('location', zpFunctions::tagURLs($place));
 }
コード例 #30
0
ファイル: index.php プロジェクト: rauldobrota/zenphoto
         case 'plugins':
             $plugin_subfolders[] = implode('/', $folders);
             unset($installed_files[$key]);
             // this will be taken care of later
             break;
         case STATIC_CACHE_FOLDER:
             $Cache_html_subfolders[] = implode('/', $folders);
             unset($installed_files[$key]);
             break;
     }
 }
 $filelist = '';
 foreach ($installed_files as $extra) {
     $filelist .= filesystemToInternal(str_replace($base, '', $extra) . '<br />');
 }
 if (class_exists('zpFunctions') && zpFunctions::hasPrimaryScripts() && count($installed_files) > 0) {
     if (defined('TEST_RELEASE') && TEST_RELEASE) {
         $msg1 = gettext("Zenphoto core files [This is a <em>debug</em> build. Some files are missing or seem wrong]");
     } else {
         $msg1 = gettext("Zenphoto core files [Some files are missing or seem wrong]");
     }
     $msg2 = gettext('Perhaps there was a problem with the upload. You should check the following files: ') . '<br /><code>' . substr($filelist, 0, -6) . '</code>';
     $mark = -1;
 } else {
     if (defined('TEST_RELEASE') && TEST_RELEASE) {
         $mark = -1;
         $msg1 = gettext("Zenphoto core files [This is a <em>debug</em> build]");
     } else {
         $msg1 = '';
         $mark = 1;
     }