function modgearmanxi_component_init()
{
    global $modgearmanxi_component_name;
    $args = array(COMPONENT_NAME => $modgearmanxi_component_name, COMPONENT_AUTHOR => "Bryan Heden <*****@*****.**>", COMPONENT_DESCRIPTION => "Manage ModGearman daemon and workers from a central location from within Nagios XI.", COMPONENT_TITLE => "ModGearman XI Manager", COMPONENT_VERSION => "1.0.1", COMPONENT_DATE => "12/12/2016");
    register_component($modgearmanxi_component_name, $args);
    register_callback(CALLBACK_MENUS_INITIALIZED, "modgearmanxi_component_addmenu");
}
 function __construct()
 {
     register_callback(__CLASS__ . '_ignore_status', 'article_ui', 'validate_publish');
     register_callback(__CLASS__ . '_min_title_length', 'article_ui', 'validate_publish');
     register_callback(__CLASS__ . '_ignore_status', 'article_ui', 'validate_save');
     register_callback(__CLASS__ . '_min_title_length', 'article_ui', 'validate_save');
 }
 /**
  * Initialise.
  */
 function __construct()
 {
     // Hook into the system's callbacks.
     register_callback(array(__CLASS__, 'lifecycle'), 'plugin_lifecycle.wet_profile');
     register_callback(array(__CLASS__, 'ui'), 'author_ui', 'extend_detail_form');
     register_callback(array(__CLASS__, 'save'), 'admin', 'author_save');
 }
 /**
  * Hook UI, setup privileges
  */
 function __construct()
 {
     if (txpinterface == 'admin') {
         add_privs('wet_sql2php', '1');
         register_tab('presentation', 'wet_sql2php', gTxt('wet_sql2php'));
         register_callback(array(__CLASS__, 'ui'), 'wet_sql2php');
     }
 }
Exemple #5
0
 /**
  * General constructor for Textfilters.
  *
  * @param string $key   A globally unique, persistable identifier for this particular Textfilter class
  * @param string $title The human-readable title of this filter class
  */
 public function __construct($key, $title)
 {
     global $txpversion;
     $this->key = $key;
     $this->title = $title;
     $this->version = $txpversion;
     $this->options = array('lite' => false, 'restricted' => false, 'rel' => '', 'noimage' => false);
     register_callback(array($this, 'register'), 'textfilter', 'register');
 }
 /**
  * Constructor
  */
 public function __construct()
 {
     if (@txpinterface === 'admin') {
         add_privs(self::$slug, '1,2,3,4,5,6');
         //add_privs('plugin_prefs.'.self::$slug, '1');
         register_callback(array($this, 'handle_request'), self::$slug, '', 1);
         register_callback(array($this, 'inject_assets'), 'admin_side', 'head_end');
         //register_callback(array($this, 'render_prefs'), 'plugin_prefs.'.self::$slug);
         register_callback(array($this, 'install'), 'plugin_lifecycle.' . self::$slug, 'installed');
         //register_callback(array($this, 'uninstall'), 'plugin_lifecycle.'.self::$slug, 'deleted');
     }
     register_callback(array($this, 'handle_public'), 'textpattern');
 }
 /**
  * The constructor merges this plugin with the core system.
  */
 function __construct()
 {
     // In a full-fledged plugin your data would probably come from the database, or other more useful sources
     // but for educational purposes we content ourselves with this constants.
     self::$my_name = 'Donald Swain';
     // Some things just never change...
     self::$greeting = array('Hello', 'Good-bye');
     // Everybody may use this extension
     add_privs(__CLASS__, '1,2,3,4,5,6');
     // Our user interface lives as a separate tab under 'Extensions'
     register_tab('extensions', __CLASS__, gTxt(__CLASS__));
     // This plugin has a single entry point 'dispatch' for its sole event
     register_callback(array(__CLASS__, 'dispatch'), __CLASS__);
 }
Exemple #8
0
function bpi_component_init()
{
    global $bpi_component_name;
    $versionok = bpi_component_checkversion();
    $desc = "IMPORTANT: Run the 'set_bpi_perms.sh' script after installation.";
    if (!$versionok) {
        $desc = "<b>Error: This component requires Nagios XI 2009R1.2B or later.</b>";
    }
    $args = array(COMPONENT_NAME => $bpi_component_name, COMPONENT_AUTHOR => "Nagios Enterprises, LLC", COMPONENT_DESCRIPTION => "Advanced grouping and dependency tool. Can be used for specialized checks. " . $desc, COMPONENT_TITLE => "Nagios BPI");
    register_component($bpi_component_name, $args);
    // add a menu link
    if ($versionok) {
        register_callback(CALLBACK_MENUS_INITIALIZED, 'bpi_component_addmenu');
    }
}
Exemple #9
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     add_privs('rah_blobin_sync', '1');
     add_privs('prefs.rah_blobin', '1');
     register_callback(array($this, 'install'), 'plugin_lifecycle.rah_blobin', 'installed');
     register_callback(array($this, 'uninstall'), 'plugin_lifecycle.rah_blobin', 'deleted');
     $this->dir = txpath;
     if (!defined('rah_blobin_plugins_dir')) {
         define('rah_blobin_plugins_dir', $this->path(get_pref('rah_blobin_path')));
     }
     if (rah_blobin_plugins_dir) {
         register_callback(array($this, 'endpoint'), 'textpattern');
         $this->sync();
     }
 }
h2. Credits

* Mark Norton for mdn_wikitoday's wicked HTML parser
* "Ruhh" for prompting and testing this plugin

# --- END PLUGIN HELP ---

<?php 
}
# --- BEGIN PLUGIN CODE ---
//--------------------------
// admin
if (@txpinterface == 'admin') {
    add_privs('jmd_wiki_events_prefs', '1');
    register_tab('extensions', 'jmd_wiki_events_prefs', 'jmd_wiki_events');
    register_callback('jmd_wiki_events_prefs', 'jmd_wiki_events_prefs');
}
function jmd_wiki_events_prefs($event, $step)
{
    ob_start('jmd_wiki_events_prefs_head');
    // event alias
    $eName = 'jmd_wiki_events_prefs';
    pagetop($eName);
    echo '<div id="jmd_wiki_events_prefs">';
    if (!$step) {
        echo fieldset(form(fInput('submit', 'install', 'Install', 'publish') . eInput($eName) . sInput('install')) . form(fInput('submit', 'uninstall', 'Uninstall', 'publish') . eInput($eName) . sInput('uninstall'), '', "verify('Are you sure you want to delete all stored events?');"), 'Setup', 'setup');
    } elseif ($step == 'install') {
        $sql = "CREATE TABLE " . safe_pfx('jmd_wiki_events') . "(\n            title VARCHAR(15) KEY,\n            last_mod DATE,\n            contents LONGTEXT\n        )";
        $create = safe_query($sql);
        if ($create) {
            echo tag('Table created successfully. ' . eLink($eName, '', '', '', 'Back to preferences?'), 'p', ' class="ok"');
<?php

$plugin['name'] = 'sed_plugin_help_viewer';
$plugin['version'] = '0.4';
$plugin['author'] = 'Netcarver';
$plugin['author_uri'] = 'http://txp-plugins.netcarving.com';
$plugin['description'] = 'Quickly check your plugin\'s help section from the plugin cache dirctory.';
$plugin['type'] = 1;
@(include_once '../zem_tpl.php');
# --- BEGIN PLUGIN CODE ---
if (@txpinterface == 'admin') {
    add_privs('sed_plugin_help_viewer', '1,2');
    register_tab('extensions', 'sed_plugin_help_viewer', 'Help Viewer');
    register_callback('sed_plugin_help_viewer', 'sed_plugin_help_viewer');
}
function sed_plugin_help_viewer($event, $step)
{
    if (!$step or !in_array($step, array('view_help'))) {
        _sed_list_plugins_from_cache();
    } else {
        $step();
    }
}
function view_help($message = '')
{
    pagetop(gTxt('edit_plugins'), $message);
    $filename = gps('filename');
    $plugin = array();
    if (!empty($filename)) {
        $content = file($filename);
        $source_lines = count($content);
Exemple #12
0
<?php

//
// Nagios Core Command NRDP Plugin
// Copyright (c) 2010 Nagios Enterprises, LLC.
// License: Nagios Open Software License <http://www.nagios.com/legal/licenses>
//
// $Id: utils.inc.php 12 2010-06-19 04:19:35Z egalstad $
require_once dirname(__FILE__) . '/../../config.inc.php';
require_once dirname(__FILE__) . '/../../includes/utils.inc.php';
register_callback(CALLBACK_PROCESS_REQUEST, 'nagioscorecmd_process_request');
function nagioscorecmd_process_request($cbtype, $args)
{
    $cmd = grab_array_var($args, "cmd");
    //echo "CMD=$cmd<BR>";
    switch ($cmd) {
        // raw nagios external commands
        case "submitrawcmd":
            nagioscorecmd_submit_nagios_command(true);
            break;
            // normal nagios external commands
        // normal nagios external commands
        case "submitcmd":
            nagioscorecmd_submit_nagios_command(false);
            break;
            // something else we don't handle...
        // something else we don't handle...
        default:
            break;
    }
}
  * _cbe_rndc_texts - Admin-side: language strings definitions
  *
  * @return  array
  */
 function _cbe_rndc_texts()
 {
     /* ============== Possible language customisation here ============== */
     return array(CBE_RNDC_LPFX . 'tab_label' => 'Random content', CBE_RNDC_LPFX . 'pop_com' => 'Comments generation', CBE_RNDC_LPFX . 'pop_art' => 'Articles generation', CBE_RNDC_LPFX . 'go_back' => 'Back', CBE_RNDC_LPFX . 'no_comm_allowed' => 'Comments are not allowed', CBE_RNDC_LPFX . 'populate' => 'Populate !', CBE_RNDC_LPFX . 'populate_end' => 'Populating finished', CBE_RNDC_LPFX . 'with_errors' => 'with errors');
     /* =========================== Stop editing =========================== */
 }
 global $textarray;
 $textarray += call_user_func('_' . CBE_RNDC_SPFX . 'texts');
 add_privs(CBE_RNDC_EVENT, '1, 2');
 register_tab('extensions', CBE_RNDC_EVENT, gTxt(CBE_RNDC_LPFX . 'tab_label'));
 register_callback(CBE_RNDC_LPFX . 'lifecycle', 'plugin_lifecycle.' . CBE_RNDC_EVENT);
 register_callback(CBE_RNDC_LPFX . 'router', CBE_RNDC_EVENT);
 /* ============================ Internal ============================ */
 define('DIGITS', 0);
 define('ALPHAMAJUS', 1);
 define('ALPHAMINUS', 2);
 function _cbe_rndc_minimax(&$mini, &$maxi)
 {
     if ($maxi == 0) {
         $maxi = $mini;
     }
     if ($maxi < $mini) {
         $a = $mini;
         $mini = $maxi;
         $maxi = $a;
     }
 }
Exemple #14
0
<?php

function react_to_ping($socket, $input)
{
    $parts = explode(' ', $input);
    irc_send($socket, 'PONG ' . $parts[1]);
}
register_callback(function ($socket, $input) {
    if (string_contains($input, 'PING')) {
        react_to_ping($socket, $input);
    }
});
Exemple #15
0
/**
 * Registers an admin-side extension page.
 *
 * For now this just does the same as register_callback().
 *
 * @param   callback $func  The callback function
 * @param   string   $event The callback event
 * @param   string   $step  The callback step
 * @param   bool     $top   The top or the bottom of the page
 * @access  private
 * @see     register_callback()
 * @package Callback
 */
function register_page_extension($func, $event, $step = '', $top = 0)
{
    register_callback($func, $event, $step, $top);
}
    #	Strings for internationalisation...
    #===========================================================================
    $_sed_si_l18n = array('alter_section_tab' => 'Alter Presentation > Section tab?', 'filter_label' => 'Filter&#8230;', 'filter_limit' => 'Show section index filter after how many sections?');
    $mlp = new sed_lib_mlp('sed_section_index', $_sed_si_l18n, '', 'admin');
    #===========================================================================
    #	Plugin preferences...
    #===========================================================================
    $sed_si_prefs = array('alter_section_tab' => array('type' => 'yesnoradio', 'val' => '0'), 'filter_limit' => array('type' => 'text_input', 'val' => '18'));
    foreach ($sed_si_prefs as $key => $data) {
        _sed_si_install_pref($key, $data['val'], $data['type']);
    }
    #===========================================================================
    #	Textpattern event handlers...
    #===========================================================================
    register_callback('_sed_si_section_post', 'section');
    register_callback('_sed_si_section_pre', 'section', '', 1);
    #===========================================================================
    #	Serve resource requests...
    #===========================================================================
    switch (gps('sed_resources')) {
        case 'sed_si_section_js':
            require_privs('section');
            _sed_si_section_js();
            break;
        default:
            break;
    }
}
#===============================================================================
#	Data access routines...
#===============================================================================
Exemple #17
0
<?php

/*
$HeadURL$
$LastChangedRevision$
*/
register_callback('file_download_send', 'pub_file');
function file_download_send($event, $step)
{
    // just a quick transplant from publish.php, this could stand some refactoring
    global $pretext, $prefs;
    extract($prefs);
    extract($pretext);
    // we are dealing with a download
    #	if (@$s == 'file_download') {
    $file_error = 0;
    $file = safe_row('*', 'txp_file', "id='" . doSlash($pretext['tail'][1]) . "' and status >= 4");
    if (!$file) {
        $file_error = 404;
    }
    if (!$file_error) {
        extract($file);
        $fullpath = build_file_path($file_base_path, $filename);
        if (is_file($fullpath)) {
            // discard any error php messages
            ob_clean();
            $filesize = filesize($fullpath);
            $sent = 0;
            header('Content-Description: File Download');
            header('Content-Type: application/octet-stream');
            header('Content-Disposition: attachment; filename="' . basename($filename) . '"; size = "' . $filesize . '"');
Exemple #18
0
    add_privs('article', '1,2,3,4,5,6');
    add_privs('hak_tinymce_prefs', '1,2');
    add_privs('hak_tinymce_js', '1,2,3,4,5,6');
    add_privs('hak_tinymce_compressor_js', '1,2,3,4,5,6');
    add_privs('hak_txpimage', '1,2,3,4,5,6');
    add_privs('hak_txpcatselect', '1,2,3,4,5,6');
    register_callback(array("hak_tinymce", "js_prep"), "hak_tinymce_js");
    register_callback(array("hak_tinymce", "compressor_js_prep"), "hak_tinymce_compressor_js");
    register_callback("hak_txpimage", "hak_txpimage");
    register_callback("hak_txpcatselect", "hak_txpcatselect");
    register_tab('extensions', 'hak_tinymce_prefs', 'hak_tinymce');
    register_callback(array('hak_tinymce', 'prefs'), 'hak_tinymce_prefs');
    register_callback(array('hak_tinymce', 'inject_toggle'), 'article_ui', 'extend_col_1');
    register_callback(array("hak_tinymce", "inject_js"), "article_ui", "extend_col_1");
    register_callback(array('hak_tinymce', 'override_markup_selects'), 'article_ui', 'markup');
    register_callback(array('hak_tinymce', 'track_markup_selection'), 'article_ui', 'view');
}
class hak_tinymce
{
    function inject_toggle($event, $step, $default, $context_data = '')
    {
        extract(hak_tinymce::getPrefs());
        if (!hak_tinymce::show_toggle($context_data)) {
            return;
        }
        $msg = '';
        if ($enable_body || $enable_excerpt) {
            $msg = '<h3 class="plain lever"><a href="#hak_tinymce">' . hak_tinymce::mce_gTxt('hak_toggle_editor') . '</a></h3>' . '<div id="hak_tinymce" class="toggle" style="display:none">' . '<p>';
            if ($enable_body && hak_tinymce::showCheckbox('body', $context_data)) {
                $msg .= '<input type="checkbox" value="body" id="hakToggle-body" name="hak_tinymceToggle[]" class="checkbox" style="width:auto" ' . hak_tinymce::isToggleChecked('body', $context_data) . ' />' . '<label for="hakToggle-body">' . ucwords(gTxt('article')) . '</label><br />';
            }
#	Define a (hopefully) unique prefix for our strings...
#
if (!defined('ZCRL_PREFIX')) {
    define('ZCRL_PREFIX', 'zem_crl');
}
#
# 	Here are the strings. Note that they all use the single quote format.
# The variable substitutions will be done as the strings are used.
#
global $zem_crl_strings;
$zem_crl_strings = array('checkbox' => 'Checkbox', 'contact' => 'Contact', 'email' => 'Email', 'email_subject' => '$var1 > Inquiry', 'email_thanks' => 'Thank you, your message has been sent.', 'field_missing' => 'Required field, &#8220;<strong>$var1</strong>&#8221;, is missing.', 'form_expired' => 'The form has expired, please try again.', 'form_used' => 'The form was already submitted, please fill out a new form.', 'general_inquiry' => 'General inquiry', 'invalid_email' => '&#8220;<strong>$var1</strong>&#8221; is not a valid email address.', 'invalid_host' => '&#8220;<strong>$var1</strong>&#8221; is not a valid email host.', 'invalid_utf8' => '“<strong>$var1</strong>” contains invalid UTF-8 characters.', 'invalid_value' => 'Invalid value for &#8220;<strong>$var1</strong>&#8221;, &#8220;<strong>$var2</strong>&#8221; is not one of the available options.', 'mail_sorry' => 'Sorry, unable to send email.', 'max_warning' => '“<strong>$var1</strong>” must not contain more than $var2 characters.', 'message' => 'Message', 'min_warning' => '&#8220;<strong>$var1</strong>&#8221; must contain at least $var2 characters.', 'name' => 'Name', 'option' => 'Option', 'radio' => 'Radio', 'receiver' => 'Receiver', 'recipient' => 'Recipient', 'refresh' => 'Follow this link if the page does not refresh automatically.', 'secret' => 'Secret', 'send' => 'Send', 'send_article' => 'Send article', 'spam' => 'We do not accept spam thankyou!', 'text' => 'Text', 'to' => 'No &#8220;<strong>to</strong>&#8221; email address specified.', 'to_missing' => '&#8220;<strong>To</strong>&#8221; email address is missing.', 'version' => '4.0.3.6');
#
#	Register the callback for the enumerate string event.
# If the MLP pack is not present and active this will NOT get called.
#
register_callback('zem_crl_enumerate_strings', 'l10n.enumerate_strings');
#
#	Here's a callback routine used to register the above strings with
# the MLP Pack (if installed).
#
function zem_crl_enumerate_strings($event, $step = '', $pre = 0)
{
    global $zem_crl_strings;
    $r = array('owner' => 'zem_contact_lang-mlp', 'prefix' => ZCRL_PREFIX, 'lang' => 'en-gb', 'event' => 'public', 'strings' => $zem_crl_strings);
    return $r;
}
#
#	Here's the local gTxt routine.
#
#	Need to make this fallback to the local array in case this is not being used with the MLP pack.
#
    $myevent = 'test';
    $mytab = 'testing';
    // Set the privilege levels for our new event
    add_privs($myevent, '1,2');
    // Add a new tab under 'extensions' associated with our event
    register_tab("extensions", $myevent, $mytab);
    // 'zem_admin_test' will be called to handle the new event
    register_callback("zem_admin_test", $myevent);
    // 'zem_admin_test_lifecycle' will be called on plugin installation, activation, deactivation, and deletion
    register_callback("zem_admin_test_lifecycle", "plugin_lifecycle.zem_plugin_example");
    // 'zem_admin_test_prefs' will be called from the Options link on the plugin tab
    register_callback('zem_admin_test_prefs', 'plugin_prefs.zem_plugin_example');
    // Set the privilege levels for our plugin's prefs event
    add_privs('plugin_prefs.zem_plugin_example', '1');
    // Emit additional CSS rules for the admin side
    register_callback('zem_admin_test_style', 'admin_side', 'head_end');
}
function zem_admin_test($event, $step)
{
    // ps() returns the contents of POST vars, if any
    $something = ps("something");
    pagetop("Testing", ps("do_something") ? "you typed: {$something}" : "");
    // The eInput/sInput part of the form is important, setting the event and step respectively
    echo "<div align=\"center\" style=\"margin-top:3em\">";
    echo form(tag("Test Form", "h3") . graf(gTxt('zem_type_something') . fInput("text", "something", $something, "edit", "", "", "20", "1") . fInput("submit", "do_something", "Go", "smallerbox") . eInput("test") . sInput("step_a"), " style=\"text-align:center\""));
    echo "</div>";
}
// Act upon activation/deactivation, installation/deletion.
// $event will be "plugin_lifecycle.zem_plugin_example"
// $step will be one of "installed", "enabled", disabled", and "deleted"
function zem_admin_test_lifecycle($event, $step)
#===============================================================================
register_callback('_jmd_sitemap_enumerate_strings', 'l10n.enumerate_strings');
function _jmd_sitemap_enumerate_strings()
{
    global $_jmd_sitemap_l18n;
    $r = array('owner' => 'jmd_sitemap', 'prefix' => JMD_SITEMAP_PREFIX, 'lang' => 'en-gb', 'event' => 'admin', 'strings' => $_jmd_sitemap_l18n);
    return $r;
}
#===============================================================================
#	Admin interface features...
#===============================================================================
if (txpinterface == 'admin') {
    add_privs('jmd_sitemap', 1);
    register_tab('extensions', 'jmd_sitemap', _jmd_sitemap_gtxt('extension_tab'));
    register_callback('jmd_sitemap', 'jmd_sitemap');
    register_callback('jmd_sitemap', 'article', 'create' || 'edit');
    if (empty($GLOBALS['prefs']['jmd_sitemap_exclude'])) {
        $tmp = serialize(array('default'));
        $GLOBALS['prefs']['jmd_sitemap_exclude'] = $tmp;
        safe_insert("txp_prefs", "prefs_id = 1,\n            name = 'jmd_sitemap_exclude',\n            val = '{$tmp}',\n            type = 2,\n            event = 'admin',\n            html = 'text_input',\n            position = 0\n        ");
    }
}
function jmd_sitemap($event, $step)
{
    global $prefs;
    $sitemap = new JMD_Sitemap();
    // Generate sitemap
    if ($step == ('create' || 'edit' || 'update')) {
        $excluded = gps('exclude');
        if ($excluded) {
            $excluded = serialize($excluded);
Exemple #22
0
 * Licensed under GNU Genral Public License version 2
 * http://www.gnu.org/licenses/gpl-2.0.html
 */
if (@txpinterface == 'admin') {
    rah_bitly::install();
    add_privs('plugin_prefs.rah_bitly', '1,2');
    register_callback(array('rah_bitly', 'prefs'), 'plugin_prefs.rah_bitly');
    register_callback(array('rah_bitly', 'install'), 'plugin_lifecycle.rah_bitly');
    register_callback(array('rah_bitly', 'update'), 'article', 'edit', 1);
    register_callback(array('rah_bitly', 'update'), 'article', 'publish', 1);
    register_callback(array('rah_bitly', 'update'), 'article', 'create', 1);
    register_callback(array('rah_bitly', 'update'), 'article', 'save', 1);
    register_callback(array('rah_bitly', 'update'), 'article', 'edit', 0);
    register_callback(array('rah_bitly', 'update'), 'article', 'publish', 0);
    register_callback(array('rah_bitly', 'update'), 'article', 'create', 0);
    register_callback(array('rah_bitly', 'update'), 'article', 'save', 0);
}
class rah_bitly
{
    public static $version = '0.3';
    /**
     * Installer
     * @param string $event Admin-side event.
     * @param string $step Admin-side, plugin-lifecycle step.
     */
    public static function install($event = '', $step = '')
    {
        global $prefs;
        if ($step == 'deleted') {
            safe_delete('txp_prefs', "name like 'rah\\_bitly\\_%'");
            return;
 function sed_lib_mlp($plugin_name, $strarray, $prefix = '', $ev = 'common', $lng = 'en-gb')
 {
     $this->owner = $plugin_name;
     $this->prefix = empty($prefix) ? strtolower(strtr($plugin_name, array('-' => '_'))) : $prefix;
     $this->strings = $strarray;
     $this->lang = $lng;
     $this->event = $ev;
     # valid events are 'public' , 'admin' and 'common'
     register_callback(array(&$this, 'callback'), 'l10n.enumerate_strings');
 }
Exemple #24
0
 * @author          Jon-Michael Deldin
 * @author_uri      http://jmdeldin.com
 * @version         1.0b2
 * @type            3
 * @order           5
 */
if (txpinterface === 'admin') {
    global $event, $jmdImgSel, $prefs;
    $jmdImgSel_privs = '1,2,3,4,5';
    add_privs('jmd_img_selector', $jmdImgSel_privs);
    register_tab('extensions', 'jmd_img_selector', 'jmd_img_selector');
    register_callback('jmd_img_selector', 'jmd_img_selector');
    add_privs('jmd_img_selector_js', $jmdImgSel_privs);
    register_callback('jmd_img_selector_js', 'jmd_img_selector_js');
    add_privs('jmd_img_selector_thickbox', $jmdImgSel_privs);
    register_callback('jmd_img_selector_thickbox', 'jmd_img_selector_thickbox');
    $jmdImgSel_view = gps('view');
    if ($event === 'article' && $jmdImgSel_view !== 'preview' && $jmdImgSel_view !== 'html') {
        ob_start('jmd_img_selector_head');
    }
    $jmdImgSel = new JMD_ImgSelector();
    if (empty($prefs[$jmdImgSel->prefix('tbWidth')])) {
        $jmdImgSel->upsertPref('tbWidth', 600, 1);
    }
    if (empty($prefs[$jmdImgSel->prefix('tbHeight')])) {
        $jmdImgSel->upsertPref('tbHeight', 600, 1);
    }
    if (empty($prefs[$jmdImgSel->prefix('imgWidth')])) {
        $jmdImgSel->upsertPref('imgWidth', 80, 1);
    }
    if (empty($prefs[$jmdImgSel->prefix('imgHeight')])) {
        ign_pp_install();
    }
    //assign privs for interfaces
    add_privs('ign_user_mgmt', '1,2,3,4');
    //create tabs, register callback functions for those tabs
    register_tab('admin', 'ign_user_mgmt', ign_gtxt('manage_users'));
    register_callback('ign_manageUsers', 'ign_user_mgmt');
    register_callback('ign_file_tab', 'file', 'file_edit');
}
if (txpinterface == 'public') {
    // disable caching for all pages
    // FIXME: find more selective method for disabling caching
    header("Cache-Control: must-revalidate");
    $prefs['send_lastmod'] = false;
    //register file_download callback to filter download requests
    register_callback('ign_filter_downloads', 'file_download');
    //fire off validation routine, since most functionality is dependent on it:
    $ign_err = ign_doTxpValidate();
}
//---------------------public tags--------------------------
//-----------------------------------------------
/**
 * Wrap content to protect, deprecated, use ign_login_form and ign_if_logged_in constructs instead if possible
 *
 *
 **/
function ign_password_protect($atts, $thing = '')
{
    if (empty($thing)) {
        $atts['login_type'] = 'page';
    }
function register_controller($classname, $event)
{
    global $txp_controllers;
    $func = 'txp_' . $classname . '_controller';
    $code = 'function ' . $func . '($event, $step) {
			$o = new ' . $classname . '();
			$o->event_handler($event, $step);
		}';
    eval($code);
    // register an event handler and tab
    register_callback($func, $event);
    @$txp_controllers[$event] == $classname;
}
    register_callback("asy_flush_event", "article", "create");
    register_callback("asy_flush_event", "link");
    register_callback("asy_flush_event", "page", "page_save");
    register_callback("asy_flush_event", "form", "form_save");
    register_callback("asy_flush_event", "list", "list_multi_edit");
    register_callback("asy_flush_event", "discuss");
    // We do not have a callback when comments are posted on the front_end
    // but that's ok, I hacked some magic into jpcache-main.php
    register_callback('asy_public_flush', 'zemcontact.submit');
    # Thanks Adam Messinger
}
// Add a new tab to the Content area.
if (@txpinterface == 'admin') {
    add_privs('asy_jpcache', '1,2');
    register_tab("extensions", "asy_jpcache", "jpcache-cleaner");
    register_callback("asy_jpcachecleaner", "asy_jpcache");
}
// This is the callback-function when something in the Admin-Panel gets changed. (Wrapper)
function asy_flush_event($event, $step)
{
    if ($event === 'article' && ($step === 'create' || $step === 'edit') && (count($_POST) == 0 || isset($_REQUEST['view']) && $_REQUEST['view'] != '')) {
        return;
    } elseif (count($_POST) == 0) {
        return;
    }
    $count = asy_flushdir(true);
}
// Thanks Adam Messinger
function asy_public_flush()
{
    asy_flushdir(true);
The MIT License (MIT)

Copyright (c) 2016 Andy Carter

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# --- END PLUGIN HELP ---
<?php 
}
# --- BEGIN PLUGIN CODE ---
if (@txpinterface == 'admin') {
    register_callback('arc_admin_comment_preview', 'discuss', 'discuss_edit');
}
/**
 * Add a comment preview to the discuss_edit step using JavaScript.
 *
 * @return void
 */
function arc_admin_comment_preview()
{
    $js = '<script language="javascript" type="text/javascript">';
    $js .= '$(document).ready(function(){
        $("textarea").after("<div style=\\"width:100%;clear:both;\\">"+$("textarea").val()+"</div>")});';
    $js .= '</script>';
    echo $js;
    return;
}
Exemple #29
0
function register_page_extension($func, $event, $step = '', $top = 0)
{
    # For now this just does the same as register_callback
    register_callback($func, $event, $step, $top);
}
    }
    //valuto ed inserisco le polyline
    if ($poly != "") {
        list($pline, $plevel) = split(",", $poly, 2);
        $polyscript = "\n   var encodedPolyline = new GPolyline.fromEncoded({\n    color: \"#FF0000\",\n    weight: 10,\n    points: \"{$pline}\",\n    levels: \"{$plevel}\",\n    zoomFactor: 32,\n    numLevels: 4\n   });\n   map.addOverlay(encodedPolyline);\n";
    }
    //preparo il codice da scrivere nella pagina
    $script = "\n<div id=\"{$idmap}\" style=\"width:" . $width . "px; height:" . $height . "px;\"></div>\n";
    $script .= "<script type=\"text/javascript\">\n\n    \t\t\t//<![CDATA[\n\n         window.onload = show{$idmap};\n            function show{$idmap}() {\n\n\n    \t      if (GBrowserIsCompatible()) {\n\n      \t\tvar map = new GMap(document.getElementById(\"{$idmap}\"));\n\n{$ctrlscript}\n{$typescript}\n                var center = new GLatLng({$center});\n                map.setCenter(center, {$zoom});\n\n              }\n\n{$polyscript}\n{$scriptmarker}\n       }\n\n    //]]>\n\n    </script>\n";
    return $script;
}
//////////////////////////////////////////////////////////////////////////////
//   Sezione di amministrazione
//////////////////////////////////////////////////////////////////////////////
if (@txpinterface == 'admin') {
    register_callback('mck_google_admin', 'article');
}
function mck_google_admin()
{
    $js = <<<EOF

<script language="javascript" type="text/javascript">
<!--
var side = document.getElementById('textile_help');
var ps = side.getElementsByTagName('p');
var p = document.createElement('p');
p.className="small";
p.innerHTML = '<a target="_blank" href="http://www.kreatore.it/textpattern/polylines.html" onclick="popWin(this.href, 500, 500); return false;">&#60;txp:google_map /></a>';
//side.appendChild(p);
side.insertBefore(p,ps[2]);
// -->