Example #1
0
 function __construct()
 {
     global $_configMutex, $_zp_conf_vars;
     $_configMutex->lock();
     $zp_cfg = file_get_contents(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE);
     $i = strpos($zp_cfg, "\$conf['special_pages']");
     $j = strpos($zp_cfg, '//', $i);
     if ($i === false || $j === false) {
         $conf = array('special_pages' => array());
         $this->conf_vars = $conf['special_pages'];
         $i = strpos($zp_cfg, '/** Do not edit below this line. **/');
         if ($i === false) {
             zp_error(gettext('The Zenphoto configuration file is corrupt. You will need to restore it from a backup.'));
         }
         $this->zp_cfg_a = substr($zp_cfg, 0, $i);
         $this->zp_cfg_b = "//\n" . substr($zp_cfg, $i);
     } else {
         $this->zp_cfg_a = substr($zp_cfg, 0, $i);
         $this->zp_cfg_b = substr($zp_cfg, $j);
         eval(substr($zp_cfg, $i, $j - $i));
         $this->conf_vars = $conf['special_pages'];
         foreach ($_zp_conf_vars['special_pages'] as $page => $element) {
             if (isset($element['option'])) {
                 $this->plugin_vars[$page] = $element;
             }
         }
     }
     if (OFFSET_PATH == 2) {
         $old = array_keys($conf['special_pages']);
         $zp_cfg = file_get_contents(SERVERPATH . '/' . ZENFOLDER . '/zenphoto_cfg.txt');
         $i = strpos($zp_cfg, "\$conf['special_pages']");
         $j = strpos($zp_cfg, '//', $i);
         eval(substr($zp_cfg, $i, $j - $i));
         $new = array_keys($conf['special_pages']);
         if ($old != $new) {
             //Things have changed, need to reset to defaults;
             setOption('rewriteTokens_restore', 1);
             $this->handleOptionSave(NULL, NULL);
             setupLog(gettext('rewriteTokens restored to default'), true);
         }
     } else {
         enableExtension('rewriteTokens', 97 | ADMIN_PLUGIN);
         //	plugin must be enabled for saving options
     }
 }
 function __construct()
 {
     global $_zp_authority, $_userAddressFields;
     $firstTime = false;
     $tablecols = db_list_fields('administrators');
     foreach ($tablecols as $key => $datum) {
         if ($datum['Field'] == 'custom_data') {
             $firstTime = true;
             enableExtension('userAddressFields', true);
             break;
         }
     }
     parent::constructor('userAddressFields', self::fields());
     if ($firstTime) {
         //	migrate the custom data user data
         $result = query('SELECT * FROM ' . prefix('administrators') . ' WHERE `valid`!=0');
         if ($result) {
             while ($row = db_fetch_assoc($result)) {
                 $custom = getSerializedArray($row['custom_data']);
                 if (!empty($custom)) {
                     $sql = 'UPDATE ' . prefix('administrators') . ' SET ';
                     foreach ($custom as $field => $val) {
                         $sql .= '`' . $field . '`=' . db_quote($val) . ',';
                     }
                     setupQuery($sql);
                 }
             }
             db_free_result($result);
         }
         setupQuery('ALTER TABLE ' . prefix('administrators') . ' DROP `custom_data`');
     }
     $cloneid = bin2hex(FULLWEBPATH);
     if (OFFSET_PATH == 2 && isset($_SESSION['admin'][$cloneid])) {
         $user = unserialize($_SESSION['admin'][$cloneid]);
         $user2 = $_zp_authority->getAnAdmin(array('`user`=' => $user->getUser(), '`pass`=' => $user->getPass(), '`valid`=' => 1));
         if ($user2) {
             foreach (userAddressFields::fields() as $field) {
                 $user2->set($field['name'], $user->get($field['name']));
             }
             $user2->save();
         }
     }
 }
Example #3
0
/**
 * Pseudo mailing handler for localhost testing
 *
 * A "mail" file named by the <i>subject</i> is created in the <var>%DATA_FOLDER%</var> folder. Multiple mailings with the
 * same <i>subject</i> will overwrite.
 *
 * @package plugins
 * @subpackage mail
 */
$plugin_is_filter = 5 | CLASS_PLUGIN;
$plugin_description = gettext("Pseudo mailing handler for localhost testing.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_version = '1.4.3';
$plugin_disable = zp_has_filter('sendmail') && !extensionEnabled('pseudomail') ? sprintf(gettext('Only one Email handler plugin may be enabled. <a href="#%1$s"><code>%1$s</code></a> is already enabled.'), stripSuffix(get_filterScript('sendmail'))) : '';
if ($plugin_disable) {
    enableExtension('pseudomail', 0);
} else {
    zp_register_filter('sendmail', 'pseudo_sendmail');
}
function pseudo_sendmail($msg, $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses, $replyTo)
{
    $filename = str_replace(array('<', '>', ':', '"' . '/' . '\\', '|', '?', '*'), '_', $subject);
    $path = SERVERPATH . '/' . DATA_FOLDER . '/' . $filename . '.txt';
    $f = fopen($path, 'w');
    fwrite($f, str_pad('*', 49, '-') . "\n");
    $tolist = '';
    foreach ($email_list as $to) {
        $tolist .= ',' . $to;
    }
    fwrite($f, sprintf(gettext('To: %s'), substr($tolist, 1)) . "\n");
    fwrite($f, sprintf('From: %1$s <%2$s>', $from_name, $from_mail) . "\n");
Example #4
0
        $publicKey = getOption('reCaptcha_public_key');
        $lang = strtolower(substr(ZENPHOTO_LOCALE, 0, 2));
        if (!getOption('reCaptcha_public_key')) {
            return array('input' => '', 'html' => '<p class="errorbox">' . gettext('reCAPTCHA is not properly configured.') . '</p>', 'hidden' => '');
        } else {
            $source = getPlugin('reCaptcha/' . $theme . '/reCaptcha.html');
            if ($source) {
                $webpath = dirname(getplugin('reCaptcha/' . $theme . '/reCaptcha.html', false, true));
                $tr = array('__GETHELP__' => gettext("Help"), '__GETIMAGE__' => gettext("Get a visual challenge"), '__GETAUDIO__' => gettext("Get an audio challenge"), '__RELOAD__' => gettext("Get another challenge"), '__WORDS__' => gettext("Type the two words"), '__NUMBERS__' => gettext("Type what you hear"), '__ERROR__' => gettext("Incorrect please try again"), '__SOURCEWEBPATH__' => $webpath);
                $html = strtr(file_get_contents($source), $tr);
                $theme = 'custom';
                //	to tell google to use the above
            } else {
                $html = '';
            }
            $themejs = '<script type="text/javascript">' . "\n" . "  var RecaptchaOptions = {\n";
            if (!in_array($lang, array('de', 'en', 'es', 'fr', 'nl', 'ru', 'pt', 'tr'))) {
                // google's list as of June 2013
                $themejs .= "      custom_translations : {\n" . "               instructions_visual : 'Type the two words',\n" . "               instructions_audio : 'Type what you hear',\n" . "               play_again : 'Play sound again',\n" . "               cant_hear_this : 'Download the sound as MP3',\n" . "               visual_challenge : 'Get a visual challenge',\n" . "               audio_challenge : 'Get an audio challenge',\n" . "               refresh_btn : 'Get another challenge',\n" . "               help_btn : 'Help',\n" . "               incorrect_try_again : 'Incorrect please try again',\n" . "      },\n";
            }
            $themejs .= "       lang : '{$lang}',\n" . "\t\t\t\ttheme : '{$theme}'\n" . "\t\t\t\t};\n" . "</script>\n";
            $html .= recaptcha_get_html($publicKey, NULL, secureServer());
            return array('html' => '<label class="captcha_label">' . $prompt . '</label>', 'input' => $themejs . $html);
        }
    }
}
if ($plugin_disable) {
    enableExtension('reCaptcha', 0);
} else {
    $_zp_captcha = new reCaptcha();
}
Example #5
0
 * [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';
    function __construct()
    {
        if (OFFSET_PATH == 2) {
<?php

/**
 * PHP sendmail mailing handler
 *
 * @author Stephen Billard (sbillard)
 *
 * @package plugins
 * @subpackage mail
 */
$plugin_is_filter = defaultExtension(5 | CLASS_PLUGIN);
$plugin_description = gettext("Outgoing mail handler based on the PHP <em>mail</em> facility.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = zp_has_filter('sendmail') && !extensionEnabled('zenphoto_sendmail') ? sprintf(gettext('Only one Email handler plugin may be enabled. <a href="#%1$s"><code>%1$s</code></a> is already enabled.'), stripSuffix(get_filterScript('sendmail'))) : '';
if ($plugin_disable) {
    enableExtension('zenphoto_sendmail', 0);
} else {
    zp_register_filter('sendmail', 'zenphoto_sendmail');
}
function zenphoto_sendmail($msg, $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses, $replyTo, $html = false)
{
    $headers = sprintf('From: %1$s <%2$s>', $from_name, $from_mail) . "\n";
    if (count($cc_addresses) > 0) {
        $cclist = '';
        foreach ($cc_addresses as $cc_name => $cc_mail) {
            $cclist .= ',' . $cc_mail;
        }
        $headers .= 'Cc: ' . substr($cclist, 1) . "\n";
    }
    if ($replyTo) {
        $headers .= 'Reply-To: ' . array_shift($replyTo) . "\n";
Example #7
0
<?php

class Combi extends Zenpage
{
    function getOldCombiNews()
    {
        return $this->getCombiNews(NULL, NULL, 'published');
    }
}
global $plugin_is_filter;
enableExtension('galleryArticles', $plugin_is_filter);
$obj = new Combi();
$combi = $obj->getOldCombiNews();
$cat = new ZenpageCategory('combiNews', true);
$cat->setTitle(gettext('combiNews'));
$cat->setDesc(gettext('Auto category for ported combi-news articles.'));
$cat->save();
foreach ($combi as $article) {
    switch ($article['type']) {
        case 'images':
            $obj = newImage(NULL, array('folder' => $article['albumname'], 'filename' => $article['titlelink']), false);
            if ($obj->exists) {
                $obj->setPublishDate($article['date']);
                self::publishArticle($obj, 'combiNews');
            }
            break;
        case 'albums':
            $obj = newAlbum($article['albumname'], false);
            if ($obj->exists) {
                $obj->setPublishDate($article['date']);
                self::publishArticle($obj, 'combiNews');
Example #8
0
        $personality = getOption('themeSwitcher_effervescence_personality');
        if (isset($_GET['themePersonality'])) {
            $new = $_GET['themePersonality'];
            if (in_array($new, $personalities)) {
                setOption('themeSwitcher_effervescence_personality', $new);
                $personality = $new;
            }
        }
        if ($personality) {
            setOption('effervescence_personality', $personality, false);
        } else {
            $personality = strtolower(getOption('effervescence_personality'));
        }
    }
    if (($_ef_menu = getOption('effervescence_menu')) == 'effervescence' || $_ef_menu == 'zenpage') {
        enableExtension('print_album_menu', 1 | THEME_PLUGIN, false);
    }
    require_once SERVERPATH . '/' . THEMEFOLDER . '/effervescence_plus/' . $personality . '/functions.php';
    $_oneImagePage = $handler->onePage();
    $_zp_page_check = 'my_checkPageValidity';
}
function EF_head($ignore)
{
    global $themeColor;
    if (!$themeColor) {
        $themeColor = getThemeOption('Theme_colors');
    }
    if (!file_exists(SERVERPATH . '/' . DATA_FOLDER . '/effervescence_plus/styles/' . $themeColor . '.css') || filemtime(SERVERPATH . '/' . DATA_FOLDER . '/effervescence_plus/styles/' . $themeColor . '.css') < filemtime(SERVERPATH . '/' . THEMEFOLDER . '/effervescence_plus/styles/' . $themeColor . '.txt')) {
        eval(file_get_contents(SERVERPATH . '/' . THEMEFOLDER . '/effervescence_plus/styles/' . $themeColor . '.txt'));
        $css = file_get_contents(SERVERPATH . '/' . THEMEFOLDER . '/effervescence_plus/base.css');
        $css = strtr($css, $tr);
Example #9
0
    //	update the enabled priority
    $priority = $plugin_is_filter & PLUGIN_PRIORITY;
    if ($plugin_is_filter & CLASS_PLUGIN) {
        $priority .= ' | CLASS_PLUGIN';
    }
    if ($plugin_is_filter & ADMIN_PLUGIN) {
        $priority .= ' | ADMIN_PLUGIN';
    }
    if ($plugin_is_filter & FEATURE_PLUGIN) {
        $priority .= ' | FEATURE_PLUGIN';
    }
    if ($plugin_is_filter & THEME_PLUGIN) {
        $priority .= ' | THEME_PLUGIN';
    }
    setupLog(sprintf(gettext('Plugin:%s enabled (%2$s)'), $extension, $priority), true);
    enableExtension($extension, $plugin_is_filter);
}
if ($option_interface) {
    //	prime the default options
    setupLog(sprintf(gettext('Plugin:%1$s option interface instantiated (%2$s)'), $extension, $option_interface), true);
    $option_interface = new $option_interface();
}
setupLog(sprintf(gettext('Plugin:%s setup completed'), $extension), true);
$iMutex->unlock();
$fp = fopen(SERVERPATH . '/' . ZENFOLDER . '/images/pass.png', 'rb');
// send the right headers
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header("Content-Type: image/png");
header("Content-Length: " . filesize(SERVERPATH . '/' . ZENFOLDER . '/images/pass.png'));
// dump the picture and stop the script
fpassthru($fp);
Example #10
0
/**
 * Use to tweet new objects as they are published.
 *
 * @author Stephen Billard (sbillard)
 *
 * @package plugins
 * @subpackage admin
 */
$plugin_is_filter = 9 | FEATURE_PLUGIN;
$plugin_description = gettext('Tweet news articles when published.');
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = function_exists('curl_init') ? false : gettext('The <em>php_curl</em> extension is required');
$plugin_notice = extensionEnabled('TinyURL') ? '' : gettext('Enable the tinyURL plugin to shorten URLs in your tweets.');
$option_interface = 'tweet';
if ($plugin_disable) {
    enableExtension('tweet_news', 0);
} else {
    zp_register_filter('show_change', 'tweet::published');
    if (getOption('tweet_news_albums')) {
        zp_register_filter('new_album', 'tweet::published');
    }
    if (getOption('tweet_news_images')) {
        zp_register_filter('new_image', 'tweet::published');
    }
    if (getOption('tweet_news_news')) {
        zp_register_filter('new_article', 'tweet::newZenpageObject');
    }
    if (getOption('tweet_news_pages')) {
        zp_register_filter('new_page', 'tweet::newZenpageObject');
    }
    zp_register_filter('admin_overview', 'tweet::errorsOnOverview');
Example #11
0
/**
 * @deprecated
 * @since 1.4.3
 */
function printAlbumZip()
{
    deprecated_functions::notify(gettext('Use downloadList plugin <code>printDownloadAlbumZipURL()</code>.'));
    global $_zp_current_album;
    enableExtension('downloadList', 20 | ADMIN_PLUGIN | THEME_PLUGIN, false);
    require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/downloadList.php';
    printDownloadAlbumZipURL(gettext('Download a zip file of this album'), $_zp_current_album);
}
Example #12
0
 * message can be disabled to allow your scripts to continue to run. Visit the <i>deprecated-functions</i>
 * plugin options. Find the function and uncheck the box by the function.
 *
 * A utility button is provided that allows you to search themes and plugins for uses of functions which have been deprecated.
 * Use it to be proactive in replacing or changing these items.
 *
 * @author Stephen Billard (sbillard)
 * @package plugins
 * @subpackage development
 */
$plugin_description = gettext("Provides deprecated Zenphoto functions.");
$plugin_notice = gettext("This plugin is <strong>NOT</strong> required for the Zenphoto distributed functions.");
$option_interface = 'deprecated_functions';
$plugin_is_filter = 900 | CLASS_PLUGIN;
if (OFFSET_PATH == 2) {
    enableExtension('deprecated-functions', $plugin_is_filter);
}
//	Yes, I know some people will be annoyed that this keeps coming back,
//	but each release may deprecated new functions which would then just give
//	(perhaps unseen) errors. Better the user should disable this once he knows
//	his site is working.
zp_register_filter('admin_utilities_buttons', 'deprecated_functions::button');
zp_register_filter('admin_tabs', 'deprecated_functions::tabs');
class deprecated_functions
{
    var $listed_functions = array();
    var $unique_functions = array();
    function __construct()
    {
        global $_internalFunctions;
        foreach (getPluginFiles('*.php') as $extension => $plugin) {
Example #13
0
 * Since uploads via the <var>files</var> tab are like FTP uploads and are not assigned to the user, you should not assign <var>files</var> rights
 * to users with upload limits.
 *
 * @author Stephen Billard (sbillard)
 *
 * @package plugins
 * @subpackage users
 */
$plugin_is_filter = 5 | ADMIN_PLUGIN;
$plugin_description = gettext("Provides a quota management system to limit the sum of sizes of images a user uploads.");
$plugin_notice = gettext("<strong>Note:</strong> if FTP is used to upload images, manual user assignment is necessary. ZIP file upload is disabled by default as quotas are not applied to the files contained therein.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = zp_has_filter('get_upload_header_text') && !extensionEnabled('quota_manager') ? sprintf(gettext('<a href="#%1$s"><code>%1$s</code></a> is already enabled.'), stripSuffix(get_filterScript('get_upload_header_text'))) : '';
$option_interface = 'quota_manager';
if ($plugin_disable) {
    enableExtension('quota_manager', 0);
} else {
    zp_register_filter('save_admin_custom_data', 'quota_manager::save_admin');
    zp_register_filter('edit_admin_custom_data', 'quota_manager::edit_admin');
    zp_register_filter('new_image', 'quota_manager::new_image');
    zp_register_filter('image_refresh', 'quota_manager::image_refresh');
    zp_register_filter('check_upload_quota', 'quota_manager::checkQuota');
    zp_register_filter('get_upload_limit', 'quota_manager::getUploadLimit');
    zp_register_filter('get_upload_header_text', 'quota_manager::get_header');
    zp_register_filter('upload_filetypes', 'quota_manager::upload_filetypes');
    zp_register_filter('upload_helper_js', 'quota_manager::upload_helper_js');
}
/**
 * Option handler class
 *
 */
Example #14
0
<?php

/**
 * Translates characters with diacritical marks to simple equivalents
 * @package plugins
 * @subpackage seo
 */
$plugin_is_filter = 5 | ADMIN_PLUGIN;
$plugin_description = gettext("SEO filter to translate extended characters into their basic alpha-numeric equivalents.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = zp_has_filter('seoFriendly') && !extensionEnabled('seo_zenphoto') ? sprintf(gettext('Only one SEO filter plugin may be enabled. <a href="#%1$s"><code>%1$s</code></a> is already enabled.'), stripSuffix(get_filterScript('seoFriendly'))) : '';
$option_interface = 'zenphoto_seo';
if ($plugin_disable) {
    enableExtension('zenphoto_seo', 0);
} else {
    zp_register_filter('seoFriendly', 'zenphoto_seo::filter');
    zp_register_filter('seoFriendly_js', 'zenphoto_seo::js');
}
/**
 * Option handler class
 *
 */
class zenphoto_seo
{
    /**
     * class instantiation function
     *
     * @return zenphoto_seo
     */
    function __construct()
    {
Example #15
0
 *
 * This plugin provides an image upload handler for the <i>upload/images</i> admin tab
 * based on the {@link https://github.com/blueimp/jQuery-File-Upload <i>jQuery File Upload Plugin</i>}
 * by Sebastian Tschan.
 *
 * PHP 5.3 or greater is required by the encorporated software.
 *
 * @package plugins
 * @subpackage uploader
 */
$plugin_is_filter = 5 | ADMIN_PLUGIN;
$plugin_description = gettext('<em>jQuery</em> image upload handler.');
$plugin_author = 'Stephen Billard (sbillard)';
$plugin_disable = version_compare(PHP_VERSION, '5.3') >= 0 ? false : gettext('jQuery uploader requires PHP 5.3 or greater.');
if ($plugin_disable) {
    enableExtension('uploader_jQuery', 0);
} else {
    if (OFFSET_PATH == 2) {
        setoptiondefault('zp_plugin_uploader_jQuery', $plugin_is_filter);
    }
    if (zp_loggedin(UPLOAD_RIGHTS)) {
        zp_register_filter('upload_handlers', 'jQueryUploadHandler');
        zp_register_filter('admin_tabs', 'jQueryUploadHandler_admin_tabs', 5);
    }
}
function jQueryUploadHandler($uploadHandlers)
{
    $uploadHandlers['jQuery'] = SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/uploader_jQuery';
    return $uploadHandlers;
}
function jQueryUploadHandler_admin_tabs($tabs)
Example #16
0
<?php

zp_register_filter('themeSwitcher_head', 'switcher_head');
zp_register_filter('themeSwitcher_Controllink', 'switcher_controllink');
zp_register_filter('theme_head', 'css_head', 500);
enableExtension('zenpage', 0, false);
//	we do not support it
$curdir = getcwd();
chdir(SERVERPATH . "/themes/" . basename(dirname(__FILE__)) . "/styles");
$filelist = safe_glob('*.css');
$themecolors = array();
foreach ($filelist as $file) {
    $themecolors[] = stripSuffix(filesystemToInternal($file));
}
chdir($curdir);
function css_head($ignore)
{
    global $themecolors, $zenCSS, $themeColor, $_zp_themeroot;
    if (!$themeColor) {
        $themeColor = getThemeOption('Theme_colors');
    }
    if ($editorConfig = getOption('tinymce4_comments')) {
        if (strpos($themeColor, 'dark') !== false) {
            setOption('tinymce4_comments', 'dark_' . $editorConfig, false);
        }
    }
    $zenCSS = $_zp_themeroot . '/styles/' . $themeColor . '.css';
    $unzenCSS = str_replace(WEBPATH, '', $zenCSS);
    if (!file_exists(SERVERPATH . internalToFilesystem($unzenCSS))) {
        $zenCSS = $_zp_themeroot . "/styles/light.css";
    }
Example #17
0
 static function switcher_setup($ignore)
 {
     global $_zp_CMS;
     if (class_exists('themeSwitcher') && themeSwitcher::active()) {
         if (isset($_GET['cmsSwitch'])) {
             setOption('themeSwitcher_zenpage_switch', $cmsSwitch = (int) ($_GET['cmsSwitch'] == 'true'));
             if (!$cmsSwitch) {
                 enableExtension('zenpage', 0, false);
             }
         }
     }
     if (extensionEnabled('zenpage')) {
         require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/template-functions.php';
     } else {
         $_zp_CMS = NULL;
     }
     return $ignore;
 }
Example #18
0
 * 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);
                    }
                    $tabs[$tab] = $data;
                }
Example #19
0
 * Mailing using {@link http://sourceforge.net/projects/phpmailer/ Sourceforge PHPMailer} classes
 *
 * Configure the plugin options as necessary for your e-mail server.
 *
 * @author Stephen Billard (sbillard)
 *
 * @package plugins
 * @subpackage mail
 */
$plugin_is_filter = 800 | CLASS_PLUGIN;
$plugin_description = gettext("Outgoing mail handler based on the <em>PHPMailer</em> class mailing facility.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = zp_has_filter('sendmail') && !extensionEnabled('PHPMailer') ? sprintf(gettext('Only one Email handler plugin may be enabled. <a href="#%1$s"><code>%1$s</code></a> is already enabled.'), stripSuffix(get_filterScript('sendmail'))) : '';
$option_interface = 'zp_PHPMailer';
if ($plugin_disable) {
    enableExtension('PHPMailer', 0);
} else {
    zp_register_filter('sendmail', 'zenphoto_PHPMailer');
}
/**
 * Option handler class
 *
 */
class zp_PHPMailer
{
    /**
     * class instantiation function
     *
     * @return zp_PHPMailer
     */
    function __construct()
Example #20
0
     *
     * @return array;
     */
    function getCaptcha($prompt = NULL)
    {
        global $_zp_HTML_cache;
        $_zp_HTML_cache->disable();
        $captcha_len = getOption('zenphoto_captcha_length');
        $key = $this->getCaptchaKey();
        $lettre = getOption('zenphoto_captcha_string');
        $numlettre = strlen($lettre) - 1;
        $string = '';
        for ($i = 0; $i < $captcha_len; $i++) {
            $string .= $lettre[rand(0, $numlettre)];
        }
        $cypher = bin2hex(rc4($key, $string));
        $code = sha1($cypher);
        query('DELETE FROM ' . prefix('captcha') . ' WHERE `ptime`<' . (time() - 3600), false);
        // expired tickets
        query("INSERT INTO " . prefix('captcha') . " (ptime, hash) VALUES (" . db_quote(time()) . "," . db_quote($code) . ")", false);
        $html = '<label for="code" class="captcha_label">' . $prompt . '</label><img id="captcha" src="' . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zpCaptcha/c.php?i=' . $cypher . '" alt="Code" />';
        $input = '<input type="text" id="code" name="code" class="captchainputbox" />';
        $hidden = '<input type="hidden" name="code_h" value="' . $code . '" />';
        return array('input' => $input, 'html' => $html, 'hidden' => $hidden);
    }
}
if ($plugin_disable) {
    enableExtension('zpCaptcha', 0);
} else {
    $_zp_captcha = new zpCaptcha();
}
        $response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . $secretKey . '&response=' . $captcha . '&remoteip=' . $_SERVER['REMOTE_ADDR']);
        // Changes response value into expected format (for return)
        if (strpos($response, 'true') == true) {
            $valid = true;
        } else {
            $valid = false;
        }
        return $valid;
    }
    // Called by form (wherever reCaptcha is enabled) to add reCaptcha widget
    function getCaptcha($prompt)
    {
        $publicKey = getOption('ncrc_public_key');
        $theme = getOption('ncrc_theme');
        $type = getOption('ncrc_type');
        $size = getOption('ncrc_size');
        // Check for proper configuration of options
        if (!getOption('ncrc_public_key') || !getOption('ncrc_private_key')) {
            return array('input' => '', 'html' => '<div class="errorbox"><p>' . gettext('reCAPTCHA keys are not configured properly. Visit <a href="https://www.google.com/recaptcha/intro/index.html">this link</a> to retrieve your reCaptcha keys then enter them in noCapture reCaptcha\'s options (found in Zenphoto Control Panel > Options > Plugins).') . '</p></div>', 'hidden' => '');
        } else {
            $html = $this->captchaHtml($publicKey, $theme, $type, $size);
            return array('html' => '<label class="captcha-label">' . $prompt . '</label>', 'input' => $html);
        }
    }
}
// Required for script to be considered a reCaptcha handler
if ($plugin_disable) {
    enableExtension('nocaptcha_recaptcha', 0);
} else {
    $_zp_captcha = new nocaptcha_recaptcha(getOption('ncrc_private_key'));
}
Example #22
0
/**
 * This is a "simple" SPAM filter.
 * It uses a word black list and checks for excessive URLs
 *
 * @author Stephen Billard (sbillard)
 *
 * @package plugins
 * @subpackage admin
 */
$plugin_is_filter = 5 | CLASS_PLUGIN;
$plugin_description = gettext("Simple SPAM filter.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = isset($_zp_spamFilter) && !extensionEnabled('simpleSpam') ? sprintf(gettext('Only one SPAM handler plugin may be enabled. <a href="#%1$s"><code>%1$s</code></a> is already enabled.'), $_zp_spamFilter->name) : '';
$option_interface = 'zpSimpleSpam';
if ($plugin_disable) {
    enableExtension('simpleSpam', 0);
} else {
    $_zp_spamFilter = new zpSimpleSpam();
}
/**
 * This implements the standard SpamFilter class for the Simple spam filter.
 *
 */
class zpSimpleSpam
{
    var $name = 'simpleSpam';
    var $wordsToDieOn = array('cialis', 'ebony', 'nude', 'p**n', 'porno', 'pussy', 'upskirt', 'ringtones', 'phentermine', 'viagra', 'levitra');
    /* the word black list */
    var $patternsToDieOn = array('\\[url=.*\\]');
    var $excessiveURLCount = 5;
    /**
Example #23
0
/**
 * This is a shell plugin for SPAM filtering. It does almost nothing, but serves as the template
 * for more robust SPAM filters.
 *
 * @author Stephen Billard (sbillard)
 * 
 * @package plugins
 * @subpackage admin
 */
$plugin_is_filter = 5 | CLASS_PLUGIN;
$plugin_description = gettext("Trivial SPAM filter.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = isset($_zp_spamFilter) && !extensionEnabled('trivialSpam') ? sprintf(gettext('Only one SPAM handler plugin may be enabled. <a href="#%1$s"><code>%1$s</code></a> is already enabled.'), $_zp_spamFilter->name) : '';
$option_interface = 'zpTrivialSpam';
if ($plugin_disable) {
    enableExtension('trivialSpam', 0);
} else {
    $_zp_spamFilter = new zpTrivialSpam();
}
/**
 * This implements the standard SpamFilter class for the none spam filter.
 *
 * Note that this filter will always pass comments from users with "manage" rights
 * on the commented object.
 *
 */
class zpTrivialSpam
{
    var $name = 'trivialSpam';
    /**
     * The SpamFilter class instantiation function.
Example #24
0
     * @return string;
     */
    static function is_valid($image, $valid_types)
    {
        if (is_object($image)) {
            $image = $image->filename;
        }
        $ext = getSuffix($image);
        if (in_array($ext, $valid_types)) {
            return $ext;
        }
        return false;
    }
}
if ($plugin_disable) {
    enableExtension('slideshow', 0);
}
if (extensionEnabled('slideshow')) {
    $slideshow_instance = 0;
    /**
     * Prints a link to call the slideshow (not shown if there are no images in the album)
     * To be used on album.php and image.php
     * A CSS id names 'slideshowlink' is attached to the link so it can be directly styled.
     *
     * If the mode is set to "jQuery Colorbox" and the Colorbox plugin is enabled this link starts a Colorbox slideshow
     * from a hidden HTML list of all images in the album. On album.php it starts with the first always, on image.php with the current image.
     *
     * @param string $linktext Text for the link
     * @param string $linkstyle Style of Text for the link
     */
    function printSlideShowLink($linktext = NULL, $linkstyle = Null)
Example #25
0
 * (The counterpart videos must follow the same paths.)
 *
 * <b>NOTE:</b> This player does not support external albums!<br>
 * <b>NOTE:</b> This plugin does not support playlists!
 *
 * @author Jim Brown
 * @package plugins
 * @subpackage media
 */
$plugin_is_filter = 5 | CLASS_PLUGIN;
$plugin_description = gettext("Enable <strong>VideoJS</strong> to handle multimedia files.");
$plugin_notice = gettext("<strong>IMPORTANT</strong>: Only one multimedia extension plugin can be enabled at the time and the class-video plugin must be enabled, too.") . '<br /><br />' . gettext("Please see <a href='http://videojs.com'>VideoJS.com</a> for more info about the player and its license.");
$plugin_author = "Jim Brown";
$plugin_disable = zpFunctions::pluginDisable(array(array(!extensionEnabled('class-video'), gettext('This plugin requires the <em>class-video</em> plugin')), array(!extensionEnabled('VideoJS') && class_exists('Video') && Video::multimediaExtension() != 'pseudoPlayer', sprintf(gettext('VideoJS 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>.'))));
if ($plugin_disable) {
    enableExtension('VideoJS', 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');
}
$option_interface = 'VideoJS_options';
class VideoJS_options
{
    public $name = 'VideoJS';
    function VideoJS_options()
    {
        setOptionDefault('VideoJS_autoplay', '');
Example #26
0
 * <i>user ID</i>, <i>e-mail</i> and <i>name</i> (if you have them) and the redirection link you saved above.
 * For an example, the former is done at the beginning of the <var>OpenID_logon.php</var> script. The
 * latter is done in the "run()" function of OpenID_finish_auth.php
 *
 *
 * @author Stephen Billard (sbillard)
 * @package plugins
 * @subpackage users
 */
$plugin_is_filter = 900 | CLASS_PLUGIN;
$plugin_description = gettext('Handles logon from <em>OpenID</em> credential providers.');
$plugin_notice = sprintf(gettext('Run the <a href="%s">OpenID detect</a> script to check compatibility of your server configuration.'), FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/federated_logon/Auth/OpenID_detect.php?test_query=a%26b');
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = getOption('federated_logon_detect') ? false : sprintf(gettext('The <a href="%s">OpenID detect</a> script has not been run.'), FULLWEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/federated_logon/Auth/OpenID_detect.php?test_query=a%26b');
if ($plugin_disable) {
    enableExtension('federated_logon', 0);
} else {
    $option_interface = 'federated_logon';
    zp_register_filter('theme_head', 'federated_logon::css');
    zp_register_filter('alt_login_handler', 'federated_logon::alt_login_handler');
    zp_register_filter('save_admin_custom_data', 'federated_logon::save_custom');
    zp_register_filter('edit_admin_custom_data', 'federated_logon::edit_admin');
    zp_register_filter('load_theme_script', 'federated_logon::verify');
}
/**
 * Option class
 *
 */
class federated_logon
{
    /**
    ?>
" alt="<?php 
    echo $extension;
    ?>
" height="16px" width="16px" />
		</span>
		<?php 
    if (!$deprecate) {
        unset($plugins[$key]);
    }
}
?>
</p>

<?php 
if ($deprecate) {
    require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/deprecated-functions.php';
    $deprecated = new deprecated_functions();
    $listed = sha1(serialize($deprecated->listed_functions));
    if ($listed != getOption('deprecated_functions_signature')) {
        setOption('deprecated_functions_signature', $listed);
        enableExtension('deprecated-functions', 900 | CLASS_PLUGIN);
        setupLog(gettext('There has been a change in function deprecation. The deprecated-functions plugin has been enabled.'), true);
    }
    $compatibility = sha1(serialize($themes)) . sha1(serialize($plugins));
    if ($compatibility != getOption('zenphotoCompatibilityPack_signature')) {
        setOption('zenphotoCompatibilityPack_signature', $compatibility);
        enableExtension('zenphotoCompatibilityPack', 1 | CLASS_PLUGIN);
        setupLog(gettext('There has been a change of themes or plugins. The zenphotoCompatibilityPack plugin has been enabled.'), true);
    }
}
Example #28
0
 * redirect for <b>EACH</b> page request!
 *
 * If your site will support it, we suggest you use the dynamic_locales plugin <i>subdomain locales</i> option
 * instead for better performance.
 *
 * @author Stephen Billard (sbillard)
 * @package plugins
 * @subpackage seo
 */
$plugin_is_filter = 5 | CLASS_PLUGIN;
$plugin_description = gettext("Allows setting language locale through the URI.");
$plugin_notice = gettext('<strong>Note:</strong> This plugin is not activated for <em>back&#8209;end</em> (administrative) URLs. However, once activated, the language is remembered, even for the <em>back&#8209;end</em>.');
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = !MOD_REWRITE ? gettext('<em>mod_rewrite</em> must be enabled for this plugin to function.') : getOption('dynamic_locale_subdomain') && extensionEnabled('dynamic-locale') ? gettext('This plugin is not compatible with the <code>dynamic locale</code> <em>Use subdomains</em> option') : false;
if ($plugin_disable) {
    enableExtension('seo_locale', 0);
} else {
    zp_register_filter('load_request', 'seo_locale::load_request');
    if (!defined('SEO_WEBPATH')) {
        define('SEO_WEBPATH', seo_locale::localePath());
        define('SEO_FULLWEBPATH', seo_locale::localePath(true));
    }
}
class seo_locale
{
    static function load_request($allow)
    {
        $uri = getRequestURI();
        $parts = explode('?', $uri);
        $uri = $parts[0];
        $path = ltrim(substr($uri, strlen(WEBPATH) + 1), '/');
Example #29
0
/**
 * Provides a check for more recent Zenphoto Versions.
 *
 * @author Stephen Billard (sbillard)
 * @package plugins
 * @subpackage admin
 */
$plugin_is_filter = 5 | ADMIN_PLUGIN;
$plugin_description = gettext("Checks if there is a Zenphoto versions that is newer than the installed version.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = !class_exists('DOMDocument') ? gettext('PHP <em>DOM Object Model</em> is required.') : false;
if (!$plugin_disable) {
    if (OFFSET_PATH == 2) {
        if (TEST_RELEASE) {
            enableExtension('check_for_release', $plugin_is_filter);
        }
    } else {
        $me = explode('?', getRequestURI());
        if (basename(array_shift($me)) == 'admin.php') {
            $v = getOption('last_update_version');
            $last = getOption('last_update_check');
            if (empty($last) || is_numeric($last)) {
                if (time() > $last + 1728000) {
                    //	check each 20 days
                    $v = checkForUpdate();
                    setOption('last_update_check', time());
                    setOption('last_update_version', $v);
                    if ($v) {
                        setOption('last_update_msg', '<a href="http://www.zenphoto.org" alt="' . gettext('Zenphoto download page') . '">' . gettext("A new version of Zenphoto version is available.") . '</a>');
                    }