Пример #1
0
 function __construct()
 {
     foreach (getPluginFiles('*.php') as $extension => $plugin) {
         $deprecated = stripSuffix($plugin) . '/deprecated-functions.php';
         if (file_exists($deprecated)) {
             $plugin = basename(dirname($deprecated));
             $content = preg_replace('~#.*function~', '', file_get_contents($deprecated));
             //	remove the comments!
             preg_match_all('~@deprecated\\s+.*since\\s+.*(\\d+\\.\\d+\\.\\d+)~', $content, $versions);
             preg_match_all('/([public static|static]*)\\s*function\\s+(.*)\\s?\\(.*\\)\\s?\\{/', $content, $functions);
             if ($plugin == 'deprecated-functions') {
                 $plugin = 'core';
                 $suffix = '';
             } else {
                 $suffix = ' (' . $plugin . ')';
             }
             foreach ($functions[2] as $key => $function) {
                 if ($functions[1][$key]) {
                     $flag = '_method';
                     $star = '*';
                 } else {
                     $star = $flag = '';
                 }
                 $name = $function . $star . $suffix;
                 $option = 'deprecated_' . $plugin . '_' . $function . $flag;
                 setOptionDefault($option, 1);
                 $this->unique_functions[strtolower($function)] = $this->listed_functions[$name] = array('plugin' => $plugin, 'function' => $function, 'class' => trim($functions[1][$key]), 'since' => @$versions[1][$key], 'option' => $option, 'multiple' => array_key_exists($function, $this->unique_functions));
             }
         }
     }
 }
Пример #2
0
 function getOptionsSupported()
 {
     $buttons = array();
     $icons = getPluginFiles('*.png', 'flag_thumbnail');
     foreach ($icons as $icon) {
         $icon = str_replace(SERVERPATH, WEBPATH, $icon);
         $buttons['  <img src="' . $icon . '" />'] = basename($icon);
     }
     return array('» ' . gettext('Criteria') => array('key' => 'flag_thumbnail_date', 'type' => OPTION_TYPE_SELECTOR, 'order' => 3.6, 'selections' => array(gettext('date') => "date", gettext('mtime') => "mtime"), 'desc' => gettext("Select the basis for considering if an image is new.")), '» ' . gettext('Icon') . chr(0) . '3' => array('key' => 'flag_thumbnail_new_icon', 'type' => OPTION_TYPE_RADIO, 'order' => 3.1, 'buttons' => $buttons, 'behind' => true, 'desc' => gettext('Select the icon that will show for "new" images.')), '» ' . gettext('Icon') . chr(0) . '2' => array('key' => 'flag_thumbnail_unpublished_icon', 'type' => OPTION_TYPE_RADIO, 'order' => 2.1, 'buttons' => $buttons, 'behind' => true, 'desc' => gettext('Select the icon that will show for "un-published" images.')), '» ' . gettext('Icon') . chr(0) . '4' => array('key' => 'flag_thumbnail_locked_icon', 'type' => OPTION_TYPE_RADIO, 'order' => 4.1, 'buttons' => $buttons, 'behind' => true, 'desc' => gettext('Select the icon that will show for "Protected" images.')), '» ' . gettext('Icon') . chr(0) . '5' => array('key' => 'flag_thumbnail_geodata_icon', 'type' => OPTION_TYPE_RADIO, 'order' => 5.1, 'buttons' => $buttons, 'behind' => true, 'desc' => gettext('Select the icon that will show for images tagged with geodata.')), gettext('Un-published') => array('key' => 'flag_thumbnail_flag_unpublished', 'type' => OPTION_TYPE_CHECKBOX, 'order' => 2, 'desc' => gettext('Thumbnails for images which are not <em>published</em> will be marked.')), gettext('Protected') => array('key' => 'flag_thumbnail_flag_locked', 'type' => OPTION_TYPE_CHECKBOX, 'order' => 4, 'desc' => gettext('Thumbnails for images which are password protected or in password protected albums will be marked.')), gettext('New') => array('key' => 'flag_thumbnail_flag_new', 'type' => OPTION_TYPE_CHECKBOX, 'order' => 3, 'desc' => gettext('Thumbnails for images which have recently been added to the gallery will be marked.')), gettext('Geotagged') => array('key' => 'flag_thumbnail_flag_geodata', 'type' => OPTION_TYPE_CHECKBOX, 'order' => 5, 'desc' => gettext('Thumbnails for images which are geodata tagged will be marked.')), '» ' . gettext('Aging') => array('key' => 'flag_thumbnail_range', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 3.7, 'desc' => gettext("The range in days until images are no longer flagged as new.")), '» ' . gettext('Text') . chr(0) . '3' => array('key' => 'flag_thumbnail_new_text', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 3.5, 'desc' => gettext("Text flag for <em>new</em> images.")), '» ' . gettext('Text') . chr(0) . '2' => array('key' => 'flag_thumbnail_unpublished_text', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 2.5, 'desc' => gettext("Text flag for <em>un-published</em> images.")), '» ' . gettext('Text') . chr(0) . '4' => array('key' => 'flag_thumbnail_locked_text', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 4.5, 'desc' => gettext("Text flag for <em>protected</em> images.")), gettext('Use text') => array('key' => 'flag_thumbnail_use_text', 'type' => OPTION_TYPE_CHECKBOX, 'order' => 8, 'desc' => gettext('If checked, the defined <em>text</em> will be used in place of the icon. (Use the class<code>textasnewflag</code> for styling "text" overlays.)')), '» ' . gettext('Text') . chr(0) . '5' => array('key' => 'flag_thumbnail_geodata_text', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 5.5, 'desc' => gettext("Text flag for <em>geodata tagged</em> images.")));
 }
Пример #3
0
function getTinyMCEConfigFiles()
{
    $files = getPluginFiles('*.js.php', 'tiny_mce/config/');
    $array = array();
    foreach ($files as $file) {
        $filename = strrchr($file, '/');
        $filename = substr($filename, 1);
        $array[ucfirst(substr($filename, 0, strpos($filename, '.js.php')))] = $filename;
    }
    return $array;
}
Пример #4
0
 /**
  * Returns array of supported options for the admin-options handler
  *
  * @return unknown
  */
 function getOptionsSupported()
 {
     $themes = array(gettext('Red') => 'red', gettext('White') => 'white', gettext('Black Glass') => 'blackglass', gettext('Clean') => 'clean');
     $custom = getPluginFiles('*', 'reCaptcha', false);
     foreach ($custom as $theme => $path) {
         if (is_dir($path)) {
             $themes[$theme = basename($theme)] = $theme;
         }
     }
     return array(gettext('Public key') => array('key' => 'reCaptcha_public_key', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 1, 'desc' => gettext('Enter your <em>reCaptcha</em> public key. You can obtain this key from the Google <a href="http://www.google.com/recaptcha">reCaptcha</a> site')), gettext('Private key') => array('key' => 'reCaptcha_private_key', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 2, 'desc' => gettext('Enter your <em>reCaptcha</em> private key.')), gettext('Theme') => array('key' => 'reCaptcha_theme', 'type' => OPTION_TYPE_SELECTOR, 'order' => 3, 'selections' => $themes, 'desc' => gettext('Select the <em>reCaptcha</em> theme.')), '' => array('key' => 'reCcaptcha_image', 'type' => OPTION_TYPE_CUSTOM, 'order' => 4, 'desc' => gettext('Sample CAPTCHA image')));
 }
Пример #5
0
function getTinyMCE4ConfigFiles($mode)
{
    // get only those that work!
    $files = getPluginFiles($mode . '-*.js.php', 'tinymce4/config/');
    $array = array();
    foreach ($files as $file) {
        $filename = strrchr($file, '/');
        $filename = substr($filename, 1);
        $option = preg_replace('/^' . $mode . '-/', '', $filename);
        $option = ucfirst(preg_replace('/.js.php$/', '', $option));
        $array[$option] = $filename;
    }
    return $array;
}
Пример #6
0
function getTinyMCEConfigFiles()
{
    $array = array();
    $files = getPluginFiles('*.js.php', 'tiny_mce/config/');
    $default = array(gettext('TinyMCE disabled') => '');
    $array = array_merge($array, $default);
    foreach ($files as $file) {
        $filename = strrchr($file, '/');
        $filename = substr($filename, 1);
        $filearray = array($filename => $filename);
        //print_r($filearray);
        $array = array_merge($array, $filearray);
    }
    return $array;
}
Пример #7
0
 function getOptionsSupported()
 {
     global $_zp_gallery;
     $themes = getPluginFiles('colorbox_js/themes/*.*');
     $list = array('Custom (theme based)' => 'custom');
     foreach ($themes as $theme) {
         $theme = stripSuffix(basename($theme));
         $list[ucfirst($theme)] = $theme;
     }
     $opts = array(gettext('Colorbox theme') => array('key' => 'colorbox_theme', 'type' => OPTION_TYPE_SELECTOR, 'order' => 0, 'selections' => $list, 'desc' => gettext("The Colorbox script comes with 5 example themes you can select here. If you select <em>custom (within theme)</em> you need to place a folder <em>colorbox_js</em> containing a <em>colorbox.css</em> file and a folder <em>images</em> within the current theme to override to use a custom Colorbox theme.")));
     $c = 1;
     foreach (getThemeFiles(array('404.php', 'themeoptions.php', 'theme_description.php')) as $theme => $scripts) {
         $list = array();
         foreach ($scripts as $script) {
             $list[$script] = 'colorbox_' . $theme . '_' . stripSuffix($script);
         }
         $opts[$theme] = array('key' => 'colorbox_' . $theme . '_scripts', 'type' => OPTION_TYPE_CHECKBOX_ARRAY, 'order' => $c++, 'checkboxes' => $list, 'desc' => gettext('The scripts for which Colorbox is enabled. {Should have been set by the themes!}'));
     }
     return $opts;
 }
Пример #8
0
</p>
						<p class="notebox"><?php 
    echo gettext("<strong>Note:</strong>" . "<br /><br />Login from the front-end user login form is secure only if <em>https</em> is selected." . "<br /><br />If you select <em>https</em> or <em>secure admin</em> your server <strong>MUST</strong> support <em>https</em>.  " . "If you set either of these on a server which does not support <em>https</em> you will not be able to access the <code>admin</code> pages to reset the option! " . "Your only possibility then is to change the option in the database.");
    ?>
						</p>
					</td>
				</tr>
				<tr>
					<td width="175"><?php 
    echo gettext('CAPTCHA generator:');
    ?>
</td>
					<td width="350">
						<select id="captcha" name="captcha">
						<?php 
    $captchas = getPluginFiles('*.php', 'captcha');
    generateListFromArray(array(getOption('captcha')), array_keys($captchas), false, false);
    ?>
						</select>
					</td>
					<td><?php 
    echo gettext('Select the <em>CAPTCHA</em> generator to be used by Zenphoto.');
    ?>
</td>
				</tr>
				<tr>
					<td width="175"><?php 
    echo gettext('Obscure cache filenames');
    ?>
</td>
					<td width="350">
Пример #9
0
    static function headJS()
    {
        $skin = @array_shift(getPluginFiles('*.css', 'jplayer/skin/' . getOption('jplayer_skin')));
        if (file_exists($skin)) {
            $skin = str_replace(SERVERPATH, WEBPATH, $skin);
            //replace SERVERPATH as that does not work as a CSS link
        } else {
            $skin = WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/jplayer/skin/zenphotolight/jplayer.zenphotolight.css';
        }
        ?>
		<link href="<?php 
        echo $skin;
        ?>
" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="<?php 
        echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
        ?>
/jplayer/js/jquery.jplayer.min.js"></script>
		<?php 
    }
Пример #10
0
 /**
  * Provides a list of alternate handlers for logon
  * @param $handler_list
  */
 static function alt_login_handler($handler_list)
 {
     $files = getPluginFiles('*_logon.php', 'federated_logon');
     foreach ($files as $key => $link) {
         $option = getOption('federated_logon_handler' . $key);
         if ($option || is_null($option)) {
             $link = str_replace(SERVERPATH, WEBPATH, str_replace('\\', '/', $link));
             $name = str_replace('_', ' ', substr(basename($link), 0, -10));
             $handler_list[$name] = array('script' => $link, 'params' => array());
         }
     }
     return $handler_list;
 }
Пример #11
0
 static function effectsJS()
 {
     global $_image_effects_random;
     $effectlist = array_keys(getPluginFiles('*.txt', 'image_effects'));
     shuffle($effectlist);
     $common = array();
     do {
         $_image_effects_random = array_shift($effectlist);
         if (getOption('image_effects_random_' . $_image_effects_random)) {
             $effectdata = image_effects::getEffect($_image_effects_random);
             $invalid_effect = $effectdata && array_key_exists('error', $effectdata);
         } else {
             $invalid_effect = true;
         }
     } while ($_image_effects_random && $invalid_effect);
     if (!$_image_effects_random) {
         echo "<br />random effect empty!";
     }
     $selected_effects = array_unique(array(getOption('image_std_images'), getOption('image_custom_images'), getOption('image_std_album_thumbs'), getOption('image_std_image_thumbs'), getOption('image_custom_album_thumbs'), $_image_effects_random));
     if (false !== ($key = array_search('!', $selected_effects))) {
         unset($selected_effects[$key]);
     }
     if (count($selected_effects) > 0) {
         foreach ($selected_effects as $effect) {
             $effectdata = image_effects::getEffect($effect);
             if (array_key_exists('head', $effectdata)) {
                 $common_data = trim($effectdata['head']);
                 while ($common_data) {
                     $i = strcspn($common_data, '= >');
                     if ($i === false) {
                         $common_data = '';
                     } else {
                         $tag = '</' . trim(substr($common_data, 1, $i)) . '>';
                         $k = strpos($common_data, '>');
                         $j = strpos($common_data, $tag, $k + 1);
                         if ($j === false) {
                             $j = strpos($common_data, '/>');
                             if ($j === false) {
                                 $common_data = '';
                             } else {
                                 $j = $j + 2;
                             }
                         } else {
                             $j = $j + strlen($tag);
                         }
                         if ($j === false) {
                             $common_data = '';
                         } else {
                             $common_element = substr($common_data, 0, $j);
                             $common_data = trim(substr($common_data, strlen($common_element)));
                             $common_element = trim($common_element);
                             if (!in_array($common_element, $common)) {
                                 $common[] = $common_element;
                             }
                         }
                     }
                 }
             }
         }
         if (!empty($common)) {
             echo implode("\n", $common);
         }
     }
 }
Пример #12
0
                $version = (int) $vers[0] . '.' . (int) $vers[1] . '.' . (int) $vers[2];
            }
        }
        if (is_null(getOption('disallow_' . $dirname)) && $version < $zpversion) {
            setOptionDefault('disallow_' . $dirname, 1);
        }
        if (setupLocale($dirname)) {
            purgeOption('unsupported_' . $dirname);
        } else {
            setOption('unsupported_' . $dirname, 1);
        }
    }
}
//The following should be done LAST so it catches anything done above
//set plugin default options by instantiating the options interface
$plugins = getPluginFiles('*.php');
?>
<p>
	<?php 
$plugins = array_keys($plugins);
natcasesort($plugins);
echo gettext('Plugin setup:') . '<br />';
foreach ($plugins as $extension) {
    ?>
		<span>
			<img src="<?php 
    echo FULLWEBPATH . '/' . ZENFOLDER . '/setup/setup_pluginOptions.php?plugin=' . $extension;
    ?>
" title="<?php 
    echo $extension;
    ?>
Пример #13
0
/**
 * Returns an array of the currently enabled plugins
 *
 * @return array
 */
function getEnabledPlugins()
{
    global $_EnabledPlugins;
    if (is_array($_EnabledPlugins)) {
        return $_EnabledPlugins;
    }
    $_EnabledPlugins = array();
    $sortlist = getPluginFiles('*.php');
    foreach ($sortlist as $extension => $path) {
        $opt = 'zp_plugin_' . $extension;
        if ($option = getOption($opt)) {
            $_EnabledPlugins[$extension] = array('priority' => $option, 'path' => $path);
        }
    }
    $_EnabledPlugins = sortMultiArray($_EnabledPlugins, 'priority', true);
    return $_EnabledPlugins;
}
Пример #14
0
/**
 * Bulk enable/disable of plugins
 * @package core
 */
// force UTF-8 Ø
define('OFFSET_PATH', 3);
require_once dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) . "/zp-core/admin-globals.php";
admin_securityChecks(ADMIN_RIGHTS, $return = currentRelativeURL());
XSRFdefender('pluginEnabler');
if (isset($_GET['pluginsRemember'])) {
    setOption('pluginEnabler_currentset', serialize(array_keys(getEnabledPlugins())));
    $report = gettext('Current enabled plugins remembered');
}
if (isset($_GET['pluginsEnable'])) {
    $paths = getPluginFiles('*.php');
    $pluginlist = array_keys($paths);
    switch ($setting = sanitize_numeric($_GET['pluginsEnable'])) {
        case 0:
            $report = gettext('Plugins disabled');
            break;
        case 1:
            $report = gettext('Zenphoto plugins enabled');
            break;
        case 2:
            $report = gettext('Remembered plugins enabled');
            $savedlist = getSerializedArray(getOption('pluginEnabler_currentset'));
            break;
        case 3:
            $report = gettext('All plugins enabled');
            break;
Пример #15
0
/**
 * Figures out which plugin tabs to display
 */
function getPluginTabs()
{
    if (isset($_GET['tab'])) {
        $default = sanitize($_GET['tab']);
    } else {
        $default = 'all';
    }
    $paths = getPluginFiles('*.php');
    $classXlate = array('all' => gettext('all'), 'thirdparty' => gettext('3rd party'), 'enabled' => gettext('enabled'), 'admin' => gettext('admin'), 'demo' => gettext('demo'), 'development' => gettext('development'), 'feed' => gettext('feed'), 'mail' => gettext('mail'), 'media' => gettext('media'), 'misc' => gettext('misc'), 'spam' => gettext('spam'), 'seo' => gettext('seo'), 'uploader' => gettext('uploader'), 'users' => gettext('users'));
    zp_apply_filter('plugin_tabs', $classXlate);
    $classes = $member = $thirdparty = array();
    foreach ($paths as $plugin => $path) {
        $p = file_get_contents($path);
        $key = 'misc';
        if ($str = isolate('@subpackage', $p)) {
            preg_match('|@subpackage\\s+(.*)\\s|', $str, $matches);
            if (isset($matches[1])) {
                $key = strtolower(trim($matches[1]));
            }
        }
        $classes[$key][] = $plugin;
        if (extensionEnabled($plugin)) {
            $active[$plugin] = $path;
        }
        if (strpos($path, SERVERPATH . '/' . USER_PLUGIN_FOLDER) === 0) {
            if ($str = isolate('@category', $p)) {
                preg_match('|@category\\s+(.*)\\s|', $str, $matches);
                $deprecate = !isset($matches[1]) || $matches[1] != 'package';
            } else {
                $deprecate = true;
            }
            if ($deprecate) {
                $thirdparty[$plugin] = $path;
            }
        }
        if (array_key_exists($key, $classXlate)) {
            $local = $classXlate[$key];
        } else {
            $local = $classXlate[$key] = $key;
        }
        $member[$plugin] = $local;
    }
    ksort($classes);
    $tabs[$classXlate['all']] = 'admin-plugins.php?page=plugins&tab=all';
    if (!empty($thirdparty)) {
        $tabs[$classXlate['thirdparty']] = 'admin-plugins.php?page=plugins&tab=thirdparty';
    }
    if (!empty($active)) {
        $tabs[$classXlate['enabled']] = 'admin-plugins.php?page=plugins&tab=active';
    }
    switch ($default) {
        case 'all':
            $currentlist = array_keys($paths);
            break;
        case 'active':
            $currentlist = array_keys($active);
            break;
        case 'thirdparty':
            $currentlist = array_keys($thirdparty);
            break;
        default:
            $currentlist = array();
            break;
    }
    foreach ($classes as $class => $list) {
        $tabs[$classXlate[$class]] = 'admin-plugins.php?page=plugins&tab=' . $class;
        if ($class == $default) {
            $currentlist = $list;
        }
    }
    return array($tabs, $default, $currentlist, $paths, $member);
}
Пример #16
0
 * document processor will substitute the actual value for these tags when it renders the document.
 * Image URIs are also processed. Use the appropriate Zenphoto definition tokens to cause the URI to point
 * to the actual image. E.g. <var><img src="%WEBPATH%/%ZENFOLDER%/images/action.png" /></var>
 *
 * @package admin
 * @subpackage development
 */
// force UTF-8 Ø
if (!defined('OFFSET_PATH')) {
    define('OFFSET_PATH', 2);
    require_once dirname(__FILE__) . '/admin-globals.php';
    require_once SERVERPATH . '/' . ZENFOLDER . '/template-functions.php';
    header('Last-Modified: ' . ZP_LAST_MODIFIED);
    header('Content-Type: text/html; charset=' . LOCAL_CHARSET);
    $real_locale = getUserLocale();
    $extensions = getPluginFiles('*.php');
    $extensions = array_keys($extensions);
    $extension = sanitize($_GET['extension']);
    if (!in_array($extension, $extensions)) {
        exit;
    }
    $thirdparty = isset($_GET['thirdparty']);
    if ($thirdparty) {
        $pluginToBeDocPath = SERVERPATH . '/' . USER_PLUGIN_FOLDER . '/' . $extension . '.php';
    } else {
        $pluginToBeDocPath = SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/' . $extension . '.php';
    }
    $plugin_description = '';
    $plugin_notice = '';
    $plugin_disable = '';
    $plugin_author = '';
Пример #17
0
 /**
  * Class instantiation function
  *
  * @return effenberger
  */
 function image_effects()
 {
     $effect = getPluginFiles('*.txt', 'image_effects');
     foreach ($this->effects = array_keys($effect) as $suffix) {
         setOptionDefault('image_effects_random_' . $suffix, 1);
     }
 }
Пример #18
0
/**
 * Returns an array of the currently enabled plugins
 *
 * @return array
 */
function getEnabledPlugins()
{
    global $_EnabledPlugins;
    if (is_array($_EnabledPlugins)) {
        return $_EnabledPlugins;
    }
    $_EnabledPlugins = array();
    $sortlist = getPluginFiles('*.php');
    foreach ($sortlist as $extension => $path) {
        $opt = 'zp_plugin_' . $extension;
        if ($option = getOption($opt)) {
            $_EnabledPlugins[$extension] = $option;
        }
    }
    arsort($_EnabledPlugins);
    return $_EnabledPlugins;
}
Пример #19
0
 * document processor will substitute the actual value for these tags when it renders the document.
 * Image URIs are also processed. Use the appropriate definition tokens to cause the URI to point
 * to the actual image. E.g. <var><img src="%WEBPATH%/%ZENFOLDER%/images/action.png" /></var>
 *
 * @author Stephen Billard (sbillard)
 *
 * @package admin
 * @subpackage development
 */
// force UTF-8 Ø
if (!defined('OFFSET_PATH')) {
    define('OFFSET_PATH', 2);
    require_once dirname(__FILE__) . '/admin-globals.php';
    require_once SERVERPATH . '/' . ZENFOLDER . '/template-functions.php';
    $extension = sanitize($_GET['extension']);
    if (!in_array($extension, array_keys(getPluginFiles('*.php')))) {
        exit;
    }
    header('Last-Modified: ' . ZP_LAST_MODIFIED);
    header('Content-Type: text/html; charset=' . LOCAL_CHARSET);
    $real_locale = getUserLocale();
    $pluginType = @$_GET['type'];
    if ($pluginType) {
        $pluginToBeDocPath = SERVERPATH . '/' . USER_PLUGIN_FOLDER . '/' . $extension . '.php';
    } else {
        $pluginToBeDocPath = SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/' . $extension . '.php';
    }
    $plugin_description = '';
    $plugin_notice = '';
    $plugin_disable = '';
    $plugin_author = '';
Пример #20
0
 /**
  * Provides option list
  */
 function getOptionsSupported()
 {
     global $_zp_authority;
     $admins = $_zp_authority->getAdministrators('groups');
     $ordered = array();
     foreach ($admins as $key => $admin) {
         if ($admin['rights'] && !($admin['rights'] & ADMIN_RIGHTS)) {
             $ordered[$admin['user']] = $admin['user'];
         }
     }
     if (getOption('zp_plugin_register_user')) {
         $disable = gettext('* The option may be set via the <a href="javascript:gotoName(\'register_user\');"><em>register_user</em></a> plugin options..');
     } else {
         $disable = false;
     }
     $files = getPluginFiles('*_logon.php', 'federated_logon');
     foreach ($files as $key => $link) {
         $list[str_replace('_logon', '', $key)] = 'federated_logon_handler' . $key;
     }
     $options = array(gettext('Assign user to') => array('key' => 'federated_login_group', 'type' => OPTION_TYPE_SELECTOR, 'order' => 0, 'selections' => $ordered, 'desc' => gettext('The user group to which to map the federated login.')), gettext('Handlers') => array('key' => 'federated_logon_handler', 'type' => OPTION_TYPE_CHECKBOX_ARRAY, 'checkboxes' => $list, 'order' => 1, 'desc' => gettext('Un-check any handler you do not want to support.')), sprintf(gettext('Notify%s'), $disable ? '*' : '') => array('key' => 'register_user_notify', 'type' => OPTION_TYPE_CHECKBOX, 'disabled' => $disable, 'order' => 7, 'desc' => gettext('If checked, an e-mail will be sent to the gallery admin when a new user has verified his registration. (Verification is required only if the Federated Logon provider does not supply an e-mail address.)')));
     $files = getPluginFiles('*_logon.php', 'federated_logon');
     if ($disable) {
         $options['note'] = array('key' => 'federated_logon_truncate_note', 'type' => OPTION_TYPE_NOTE, 'order' => 8, 'desc' => '<p class="notebox">' . $disable . '</p>');
     } else {
         if (getOption('zp_plugin_zenpage')) {
             $options['note'] = array('key' => 'federated_logon_truncate_note', 'type' => OPTION_TYPE_NOTE, 'order' => 8, 'desc' => gettext('<p class="notebox">*<strong>Note:</strong> The setting of these options are shared with other the <em>register_user</em> plugin.</p>'));
         }
     }
     return $options;
 }
Пример #21
0
/**
 * Figures out which plugin tabs to display
 */
function getPluginTabs()
{
    if (isset($_GET['tab'])) {
        $default = sanitize($_GET['tab']);
    } else {
        $default = 'all';
    }
    $paths = getPluginFiles('*.php');
    $classXlate = array('all' => gettext('all'), 'admin' => gettext('admin'), 'demo' => gettext('demo'), 'development' => gettext('development'), 'feed' => gettext('feed'), 'mail' => gettext('mail'), 'media' => gettext('media'), 'misc' => gettext('misc'), 'spam' => gettext('spam'), 'seo' => gettext('seo'), 'uploader' => gettext('uploader'), 'users' => gettext('users'));
    zp_apply_filter('plugin_tabs', $classXlate);
    $currentlist = $classes = $member = array();
    foreach ($paths as $plugin => $path) {
        $p = file_get_contents($path);
        $i = strpos($p, '* @subpackage');
        if (($key = $i) !== false) {
            $key = strtolower(trim(substr($p, $i + 13, strpos($p, "\n", $i) - $i - 13)));
        }
        if (empty($key)) {
            $key = 'misc';
        }
        $classes[$key]['list'][] = $plugin;
        if (array_key_exists($key, $classXlate)) {
            $local = $classXlate[$key];
        } else {
            $local = $classXlate[$key] = $key;
        }
        $member[$plugin] = $local;
    }
    ksort($classes);
    $tabs[$classXlate['all']] = 'admin-plugins.php?page=plugins&tab=all';
    $currentlist = array_keys($paths);
    foreach ($classes as $class => $list) {
        $tabs[$classXlate[$class]] = 'admin-plugins.php?page=plugins&tab=' . $class;
        if ($class == $default) {
            $currentlist = $list['list'];
        }
    }
    return array($tabs, $default, $currentlist, $paths, $member);
}