Exemplo n.º 1
0
 /**
  * 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');
     }
 }
 /**
  * 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__);
 }
Exemplo n.º 3
0
 */
// TODO:
//  * Stop preview CSS affecting Stage 2 UI layout (mobi)
//  * Allow preview CSS to be loaded (epub)
global $smd_ebook_prefs;
smd_ebook_get_prefs();
if (@txpinterface === 'admin') {
    // Silence warnings because, although the plugin requires smd_crunchers for
    // ePub creation, it'll function in a reduced capacity without it
    @require_plugin('smd_crunchers');
    global $smd_ebook_event;
    $smd_ebook_event = 'smd_ebook';
    $pub_prv = get_pref('smd_ebook_privs', $smd_ebook_prefs['smd_ebook_privs']['default']);
    add_privs($smd_ebook_event, '1' . ($pub_prv ? ',' . $pub_prv : ''));
    add_privs('plugin_prefs.' . $smd_ebook_event, '1');
    register_tab('content', $smd_ebook_event, gTxt('smd_ebook_tab_name'));
    register_callback('smd_ebook_dispatcher', $smd_ebook_event);
    register_callback('smd_ebook_inject_css', 'admin_side', 'head_end');
    register_callback('smd_ebook_dispatcher', 'plugin_prefs.' . $smd_ebook_event);
    register_callback('smd_ebook_welcome', 'plugin_lifecycle.' . $smd_ebook_event);
}
// ********************
// ADMIN SIDE INTERFACE
// ********************
// -------------------------------------------------------------
// CSS definitions: hopefully kind to themers
function smd_ebook_get_style_rules()
{
    $smd_ebook_styles = array('cpanel' => '
.smd_hidden { display:none; }
.smd_active { font-weight:bold; }
Exemplo n.º 4
0
    register_callback("asy_flush_event", "article", "edit");
    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()
{
<?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);
Exemplo n.º 6
0
function register_element_tabs()
{
    global $elements;
    if (is_array($elements)) {
        foreach ($elements as $e) {
            if (!empty($e['tabarea'])) {
                register_tab($e['tabarea'], $e['event'], 'tab_' . $e['event']);
            }
        }
    }
}
Exemplo n.º 7
0
if (!defined('txpinterface')) {
    @(include_once 'zem_tpl.php');
}
# --- BEGIN PLUGIN CODE ---
if (@txpinterface == 'admin') {
    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 = '';
Exemplo n.º 8
0
				- enhancement: adi_menu admin now displays summary of configured section hierarchy
				- modification: adi_breadcrumb tag attribute 'sep' deprecated for 'separator'
		0.2		- fix: adi_menu_breadcrumb error when visiting pages that are excluded in adi_menu admin
				- fix: adi_menu_breadcrumb now copes with section loops, error message output
				- fix: adi_menu tag can now be used more than once on a page
				- enhancement: adi_menu admin section loop warning message
				- enhancement: adi_menu admin now displays sections in alphabetical order
		0.1		- initial release
*/
if (@txpinterface == 'admin') {
    $myevent = 'adi_menu_admin';
    $mytab = 'adi_menu';
    // set the privilege levels
    add_privs($myevent, '1,2,3,6');
    // add new tab under 'Presentation'
    register_tab("presentation", $myevent, $mytab);
    register_callback("adi_menu_admin", $myevent);
    //register_callback('adi_menu', 'adi_menu');
}
function adi_menu_admin($event, $step)
{
    $debug = 0;
    // display debug info
    // tooltip help information
    $h['se'] = "The TXP section name, set in Sections tab";
    $h['ti'] = "The TXP section title, set in Sections tab";
    $h['ex'] = "Tick if the section should be excluded by default from the menu";
    $h['pa'] = "The section's parent";
    $h['so'] = "The section's sort order number";
    $h['ch'] = "Tick if the section should be cloned in its own submenu";
    $h['ct'] = "Used as the section's title if it's cloned";
            global $levels;
            return selectInput($item, $levels, $var);
        }
    }
}
global $mem_self, $prefs;
$mem_self = array('admin_email' => '', 'admin_name' => '', 'new_user_priv' => '0', 'status' => false, 'status_message' => 'You are already registered.', 'email_message' => '');
$mem_self['admin_email'] = isset($prefs['mem_self_admin_email']) ? $prefs['mem_self_admin_email'] : '';
$mem_self['admin_name'] = isset($prefs['mem_self_admin_name']) ? $prefs['mem_self_admin_name'] : '';
$mem_self['new_user_priv'] = isset($prefs['mem_self_new_user_priv']) ? $prefs['mem_self_new_user_priv'] : '0';
if (@txpinterface == 'admin') {
    add_privs('self-reg', '1');
    register_callback('mem_self_register', 'self-reg', '', 1);
    if ($event == 'self-reg') {
        // fake tabs when using them. Silences warnings from pageTop()
        register_tab('admin', 'self-reg', 'self-reg');
        include_once txpath . '/publish/taghandlers.php';
    }
    function mem_self_register($event, $step)
    {
        global $prefs;
        extract($prefs);
        if ($event != 'self-reg') {
            return;
        }
        pageTop('Self Registration', '');
        if ($step == 'install') {
            echo mem_self_register_install();
        } else {
            if ($step == 'preinstall') {
                $mem_xtra_columns = mem_get_extra_user_columns();
Exemplo n.º 10
0
// 2 = library; loaded only when include_plugin() or require_plugin() is called
$plugin['type'] = '1';
@(include_once 'zem_tpl.php');
# --- BEGIN PLUGIN CODE ---
global $CNK_VER_OUTPUT_PATH, $CNK_VER_EXT, $CNK_VER_EXT_CSS;
$CNK_VER_OUTPUT_PATH = 'textpattern/_templates/versioning/';
//e.g. 'textpattern/_templates/versioning/'
$CNK_VER_EXT = 'txp';
$CNK_VER_EXT_CSS = 'css';
/*
	DO NOT EDIT BELOW THIS LINE!
*/
$CNK_VER_OUTPUT_PATH = trim($CNK_VER_OUTPUT_PATH, '/') . ($CNK_VER_OUTPUT_PATH ? '/' : '');
if (@txpinterface == 'admin') {
    add_privs('cnk_versioning', '1,2');
    register_tab('presentation', 'cnk_versioning', "Versioning");
    register_callback('cnk_ver_handler', 'cnk_versioning');
    register_callback('cnk_ver_disable_online_editing', 'page');
    register_callback('cnk_ver_disable_online_editing', 'form');
    register_callback('cnk_ver_disable_online_editing', 'css');
} else {
    if (@txpinterface == 'public') {
        register_callback('cnk_ver_textpattern', 'textpattern');
    }
}
function cnk_ver_textpattern()
{
    global $production_status, $CNK_VER_OUTPUT_PATH, $CNK_VER_EXT, $CNK_VER_EXT_CSS;
    if ($production_status != 'live') {
        $error = false;
        // read all files
Exemplo n.º 11
0
$plugin['flags'] = '3';
if (!defined('txpinterface')) {
    @(include_once 'zem_tpl.php');
}
# --- BEGIN PLUGIN CODE ---
if (@txpinterface == 'admin') {
    global $yab_shop_admin_lang;
    $yab_shop_admin_lang = array();
    if (yab_shop_table_exist('yab_shop_lang')) {
        $yab_shop_admin_lang = yab_shop_get_lang('lang_prefs_admin');
    }
    add_privs('yab_shop_prefs', '1');
    register_tab('extensions', 'yab_shop_prefs', yab_shop_admin_lang('shop_prefs'));
    register_callback('yab_shop_prefs', 'yab_shop_prefs');
    add_privs('yab_shop_language', '1');
    register_tab('extensions', 'yab_shop_language', yab_shop_admin_lang('shop_lang'));
    register_callback('yab_shop_language', 'yab_shop_language');
    add_privs('plugin_prefs.yab_shop_admin', '1');
    register_callback('yab_shop_prefs', 'plugin_prefs.yab_shop_admin');
    register_callback('yab_shop_uninstall', 'plugin_lifecycle.yab_shop_admin', 'deleted');
}
// define some prefs and language as globals
global $yab_shop_prefs, $yab_shop_public_lang;
if (yab_shop_table_exist('yab_shop_prefs')) {
    $yab_shop_prefs = yab_shop_get_prefs();
}
if (yab_shop_table_exist('yab_shop_lang')) {
    $yab_shop_public_lang = yab_shop_get_lang('lang_public');
}
/**
 * On plugin update, compare previously installed version
Exemplo n.º 12
0
    ?>

# --- BEGIN PLUGIN HELP ---

//inc <README>

# --- END PLUGIN HELP ---

<?php 
}
# --- BEGIN PLUGIN CODE ---
if (txpinterface === 'admin') {
    global $textarray;
    add_privs('jmd_csv', 1);
    register_callback('jmd_csv', 'jmd_csv');
    register_tab('extensions', 'jmd_csv', 'jmd_csv');
    // i18n
    $textarray = array_merge($textarray, array('jmd_csv_file' => 'CSV file:', 'jmd_csv_file_error' => 'Error reading CSV', 'jmd_csv_import' => 'Import', 'jmd_csv_import_csv' => 'Import CSV', 'jmd_csv_imported' => 'CSV imported successfully.'));
}
/**
 * Interface for the CSV import.
 *
 * @param string $event
 * @param string $step
 */
function jmd_csv($event, $step)
{
    global $jmd_csv, $file_base_path;
    ob_start('jmd_csv_head');
    $jmd_csv = new JMD_CSV();
    if ($step === 'import') {
Exemplo n.º 13
0
$plugin['description'] = 'Section Tree';
$plugin['type'] = '1';
@(include_once 'zem_tpl.php');
# --- BEGIN PLUGIN CODE ---
if (@txpinterface == 'admin') {
    /*
    1 => gTxt('publisher'),
    2 => gTxt('managing_editor'),
    3 => gTxt('copy_editor'),
    4 => gTxt('staff_writer'),
    5 => gTxt('freelancer'),
    6 => gTxt('designer'),
    0 => gTxt('none')
    */
    add_privs('cnk_section_tree', '1,2');
    register_tab('extensions', 'cnk_section_tree', "section tree");
    register_callback('cnk_section_tree', 'cnk_section_tree');
    register_callback('cnk_section_list', 'section', '', 1);
    register_callback('cnk_article_view', 'article', '', 1);
    register_callback('cnk_section_create', 'section', 'section_create');
    register_callback('cnk_section_delete', 'section', 'section_delete', 1);
    register_callback('cnk_section_save', 'section', 'section_save');
    $cnk_tree = NULL;
    $cnk_tree_id = 0;
} else {
    if (@txpinterface == 'public') {
        register_callback('cnk_pretext', 'pretext');
        register_callback('cnk_textpattern', 'textpattern');
        define('CNK_FRIENDLY_URLS', false);
    }
}
Exemplo n.º 14
0
<?php

/**
 * @name            jmd_rate
 * @description     CSS star rater
 * @author          Jon-Michael Deldin
 * @author_uri      http://jmdeldin.com
 * @version         0.4-DEV
 * @type            1
 * @order           5
 */
//--------------------------------------
// admin
if (@txpinterface == 'admin') {
    add_privs('jmd_rate_prefs', '1');
    register_tab('extensions', 'jmd_rate_prefs', 'jmd_rate');
    register_callback('jmd_rate_prefs', 'jmd_rate_prefs');
}
function jmd_rate_prefs($event, $step)
{
    ob_start('jmd_rate_prefs_head');
    pagetop('jmd_rate_prefs');
    echo '<div id="jmd_rate_prefs">';
    if (!$step) {
        echo fieldset(form(fInput('submit', 'install', 'Install', 'publish') . eInput('jmd_rate_prefs') . sInput('install')) . form(fInput('submit', 'uninstall', 'Uninstall', 'publish') . eInput('jmd_rate_prefs') . sInput('uninstall'), '', "verify('Are you sure you want to delete all ratings?');"), 'Setup', 'setup');
        echo fieldset(form('<label>Quantity ' . fInput('text', 'qty', 4) . '</label><br/>
				<label>Path and filename of star image ' . fInput('text', 'path', '/stars.png') . '</label><br/>
				<label>Star width' . fInput('text', 'width', 19) . '</label><br/>
				<label>Star height' . fInput('text', 'height', 18) . '</label><br/>
				<label>Container class name' . fInput('text', 'class', 'rating') . '</label><br/>' . fInput('submit', 'generate', 'Generate CSS', 'publish') . eInput('jmd_rate_prefs') . sInput('builder')), 'CSS builder');
    } elseif ($step == 'install') {
Exemplo n.º 15
0
 function GBPPlugin($title = '', $event = '', $parent_tab = '')
 {
     global $txp_current_plugin;
     // Store a reference to this class so we can get PHP 4 to work
     if (version_compare(phpversion(), '5.0.0', '<')) {
         global $gbp_admin_lib_refs;
     }
     $gbp_admin_lib_refs[$txp_current_plugin] =& $this;
     // Get the plugin_name from the global txp_current_plugin variable
     $this->plugin_name = $txp_current_plugin;
     // When making a GBPAdminView there must be event attributes
     $this->event = $event;
     // Add privs for this event
     global $txp_permissions;
     $perms = @$txp_permissions[$this->permissions];
     add_privs($this->event, $perms ? $perms : $this->permissions);
     if (@txpinterface == 'admin') {
         // We are admin-side.
         // There must be title and event attributes
         $this->title = $title;
         // The parent_tab can only be one of four things, make sure it is
         if ($event and $title and $parent_tab and array_search($parent_tab, array('content', 'presentation', 'admin', 'extensions')) === false) {
             $parent_tab = 'extensions';
         }
         // Set up the get-post array
         $this->gp = array_merge(array('event', gbp_tab), $this->gp);
         // Check if our event is active, if so call preload()
         if (gps('event') == $event) {
             $this->load_preferences();
             $this->preload();
             // Tabs should be loaded by now
             if ($parent_tab && $this->use_tabs) {
                 foreach (array_keys($this->tabs) as $key) {
                     $tab =& $this->tabs[$key];
                     $tab->php_4_fix();
                     if (is_a($tab, 'GBPWizardTabView')) {
                         $this->wizard_key = $key;
                         $this->wizard_installed = $tab->installed();
                     }
                 }
                 if (!$this->wizard_installed && $this->wizard_key) {
                     $this->active_tab = $this->wizard_key;
                 }
                 // Let the active_tab know it's active and call it's preload()
                 $tab =& $this->tabs[$this->active_tab];
                 $tab->is_active = 1;
                 $tab->preload();
             }
         }
         // Call txp functions to register this plugin
         if ($parent_tab) {
             register_tab($parent_tab, $event, $title);
             register_callback(array(&$this, 'render'), $event, null, 0);
         }
     }
     if (@txpinterface == 'public') {
         $this->load_preferences();
     }
 }
<?php

# --- BEGIN PLUGIN CODE ---
// Plugin code goes here.  No need to escape quotes.
// Global textpattern variables + textile for use throughout
global $txp_user, $vars, $txpcfg, $textile;
// Textile construct
include_once $txpcfg['txpath'] . '/lib/classTextile.php';
$textile = new Textile();
// Add the jmc_event_manager tab to the Content area.
if (@txpinterface === 'admin') {
    // Check for existence of tables - if none, install
    jmc_check_installation();
    // Add new tabs under "Gig Guide" for "Gigs", "Add a Gig", "Venue" and "Add a Venue"
    add_privs('jmc_event_manager', '1,2,3,4,5,6');
    register_tab("content", "jmc_event_manager", "Event Manager");
    // Register Callbacks to the plugin
    register_callback("jmc_event_manager", "jmc_event_manager");
    register_callback("jmc_event_manager", "jmc_event_categories");
    register_callback("jmc_event_manager", "jmc_event_manager_venue");
    //
    //		add_privs('tab.jmc_event_manager_prefs','1,2');
    //		register_tab("extensions", "jmc_event_manager_prefs", "jmc_e_m prefs");
    register_callback("jmc_event_manager_prefs", "jmc_event_manager_prefs");
}
// Events
class JmcEvents
{
    var $events = null;
    // Limits
    var $category_id = null;
Exemplo n.º 17
0
            echo upload_form('Install Pattern Pack', '', 'upload', self::EVENT, '');
        }
        /**
         *	Public entry point for rendering the default (home) page
         */
        public static function home($event, $step)
        {
            if ($step && in_array($step, array('upload'))) {
                self::$step($event, $step);
            } else {
                self::show();
            }
        }
    }
    add_privs(sed_patterns::EVENT, sed_patterns::PRIVS);
    register_tab('extensions', sed_patterns::EVENT, gTxt(sed_patterns::TAB));
    register_callback('sed_patterns::home', sed_patterns::EVENT);
    # TODO add an installation+enable handler that will take care of keeping the plugin disabled if gzinflate is not installed.
}
# --- END PLUGIN CODE ---
/*
# --- BEGIN PLUGIN CSS ---
	<style type="text/css">
	div#sed_patterns_help td { vertical-align:top; }
	div#sed_patterns_help code { font-weight:bold; font: 105%/130% "Courier New", courier, monospace; background-color: #FFFFCC;}
	div#sed_patterns_help code.sed_code_tag { font-weight:normal; border:1px dotted #999; background-color: #f0e68c; display:block; margin:10px 10px 20px; padding:10px; }
	div#sed_patterns_help a:link, div#sed_patterns_help a:visited { color: blue; text-decoration: none; border-bottom: 1px solid blue; padding-bottom:1px;}
	div#sed_patterns_help a:hover, div#sed_patterns_help a:active { color: blue; text-decoration: none; border-bottom: 2px solid blue; padding-bottom:1px;}
	div#sed_patterns_help h1 { color: #369; font: 20px Georgia, sans-serif; margin: 0; text-align: center; }
	div#sed_patterns_help h2 { border-bottom: 1px solid black; padding:10px 0 0; color: #369; font: 17px Georgia, sans-serif; }
	div#sed_patterns_help h3 { color: #693; font: bold 12px Arial, sans-serif; letter-spacing: 1px; margin: 10px 0 0;text-transform: uppercase;}
Exemplo n.º 18
0
<?php

/*
$HeadURL$
$LastChangedRevision$
*/
// we can't call register_tab in the element itself, since that's not always
// loaded.  txp_tab is loaded for all events though, so we can register tabs
// here until there's a better solution.
if (element_active('txp_element')) {
    register_tab('admin', 'element', gTxt('tab_element'));
}
if (@txpinterface == 'admin') {
    /**
     * _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;
// Plugin types:
// 0 = regular plugin; loaded on the public web side only
// 1 = admin plugin; loaded on both the public and admin side
// 2 = library; loaded only when include_plugin() or require_plugin() is called
$plugin['type'] = '1';
@(include_once 'zem_tpl.php');
# --- BEGIN PLUGIN CODE ---
if (@txpinterface == 'admin') {
    add_privs('rss_db_man', '1');
    register_tab("extensions", "rss_db_man", "DB Manager");
    register_callback("rss_db_man", "rss_db_man");
    add_privs('rss_sql_run', '1');
    register_tab("extensions", "rss_sql_run", "Run SQL");
    register_callback("rss_sql_run", "rss_sql_run");
    add_privs('rss_db_bk', '1');
    register_tab("extensions", "rss_db_bk", "DB Backup");
    register_callback("rss_db_bk", "rss_db_bk");
}
function rss_db_bk($event, $step)
{
    global $prefs, $rss_dbbk_path, $rss_dbbk_dump, $rss_dbbk_mysql, $rss_dbbk_lock, $rss_dbbk_txplog, $rss_dbbk_debug, $DB, $file_base_path;
    if (!isset($rss_dbbk_lock)) {
        $rss_dbbk_lock = "1";
        $rs = safe_insert('txp_prefs', "name='rss_dbbk_lock', val='{$rss_dbbk_lock}', prefs_id='1'");
    }
    if (!isset($rss_dbbk_txplog)) {
        $rss_dbbk_txplog = "1";
        $rs = safe_insert('txp_prefs', "name='rss_dbbk_txplog', val='{$rss_dbbk_txplog}', prefs_id='1'");
    }
    if (!isset($rss_dbbk_debug)) {
        $rss_dbbk_debug = "0";
Exemplo n.º 21
0
function zem_if_alice($atts, $thing)
{
    extract(lAtts(array('name' => 'Bob'), $atts));
    return parse(EvalElse($thing, $name == 'Alice'));
}
// ----------------------------------------------------
// Example admin side plugin
// Add a new tab to the Content area.
// "test" is the name of the associated event; "testing" is the displayed title
if (@txpinterface == 'admin') {
    $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");
    define('PLUGIN_HAS_PREFS', 0x1);
}
// This plugin wants to receive "plugin_prefs.{$plugin['name']}" events
if (!defined('PLUGIN_LIFECYCLE_NOTIFY')) {
    define('PLUGIN_LIFECYCLE_NOTIFY', 0x2);
}
// This plugin wants to receive "plugin_lifecycle.{$plugin['name']}" events
$plugin['flags'] = '0';
if (!defined('txpinterface')) {
    @(include_once 'zem_tpl.php');
}
# --- BEGIN PLUGIN CODE ---
//<?php
if (@txpinterface == 'admin') {
    add_privs('bot_admin_tooltips_tab', '1,2');
    register_tab('extensions', 'bot_admin_tooltips_tab', 'bot_admin_tooltips');
    register_callback('bot_admin_tooltips_tab', 'bot_admin_tooltips_tab');
    register_callback('bot_admin_tooltips', 'article');
    register_callback('bot_admin_tooltips', 'category');
    register_callback('bot_admin_tooltips', 'list');
    register_callback('bot_admin_tooltips', 'image');
    register_callback('bot_admin_tooltips', 'file');
    register_callback('bot_admin_tooltips', 'link');
    register_callback('bot_admin_tooltips', 'discuss');
    register_callback('bot_admin_tooltips', 'admin');
}
global $bot_admin_tooltips, $bot_admin_tooltips_main_array;
//set globals
if (getThings("Show tables like '" . PFX . "bot_admin_tooltips'")) {
    // if plugin is installed loads items and tips from db
    $r = safe_rows_start('item, tip', 'bot_admin_tooltips', '1=1');
Exemplo n.º 23
0
<?php

/**
 * @name            jmd_img_selector
 * @description     Thickbox-style image selector
 * @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);
Exemplo n.º 24
0
<?php

# --- BEGIN PLUGIN META ---
$plugin = array('name' => 'rss_article_edit', 'version' => '0.1', 'author' => 'Rob Sable', 'author_uri' => 'http://www.wilshireone.com/', 'description' => 'Add edit article links to your public site.', 'type' => '1');
# --- END PLUGIN META ---
# --- BEGIN PLUGIN CODE ---
if ('admin' === @txpinterface) {
    add_privs('editlink', '1,2,3,4,5,6');
    // Add a new tab under 'extensions' called 'edit link', for the 'editlink' event
    register_tab("extensions", "editlink", "edit link");
    // 'rss_admin_editlink' will be called to handle the 'editlink' event
    register_callback("rss_admin_editlink", "editlink");
}
function rss_admin_editlink($event, $step)
{
    global $rss_ae_cookie;
    include txpath . '/include/txp_prefs.php';
    if (!isset($rss_ae_cookie)) {
        $rss_ae_cookie = "rss_article_edit";
        $rs = safe_insert('txp_prefs', "name='rss_ae_cookie', val='{$rss_ae_cookie}', prefs_id='1'");
    }
    if (gps("add")) {
        safe_update("txp_prefs", "val = '" . addslashes(ps('rss_ae_cookie')) . "'", "name = 'rss_ae_cookie' and prefs_id ='1'");
        setcookie($rss_ae_cookie, $rss_ae_cookie, time() + 31536000, "/");
        header("Location: index.php?event=editlink");
    } else {
        if (gps("rem")) {
            safe_update("txp_prefs", "val = '" . addslashes(ps('rss_ae_cookie')) . "'", "name = 'rss_ae_cookie' and prefs_id ='1'");
            setcookie($rss_ae_cookie, $rss_ae_cookie, time() - 3600, "/");
            header("Location: index.php?event=editlink");
        }
Exemplo n.º 25
0
#===============================================================================
#	MLP Registration...
#===============================================================================
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');
Exemplo n.º 26
0
                register_callback("settings_edit", $settings_event);
                break;
            case "edit":
                register_callback("settings_edit", $settings_event);
                break;
            case "update":
                register_callback("settings_update", $settings_event);
                break;
        }
    }
    // 'zem_admin_test' will be called to handle the new event
    register_tab("store", $customers_event, $customers_name);
    register_callback("customers_switch", $customers_event);
    register_tab("store", $settings_event, $settings_name);
    // Add a new tab under 'extensions' associated with our event
    register_tab("store", $dashboard_event, $dashboard_name);
    // 'zem_admin_test' will be called to handle the new event
    register_callback("show_dashboard", $dashboard_event);
    //Special Multipule Categories Support
    /*if(is_callable("rss_admin_catlist")){
    			register_callback('rss_admin_catlist_save', 'product', 'product_post');
    			register_callback('rss_admin_catlist_save', 'product', 'product_save');
    		}*/
}
function settings_update($event, $step)
{
    global $txp_user, $vars, $txpcfg, $prefs;
    extract(doSlash($_REQUEST));
    if ($settings_update == "general") {
        if (!isset($inventory_management_on)) {
            $inventory_management_on = 0;
    return $lang[$what];
}
//--------------do not edit below this line------------------
//generate admin interface
if (txpinterface == 'admin') {
    if (!isset($prefs['ign_pp_version']) || $prefs['ign_pp_version'] != $plugins_ver['ign_password_protect']) {
        //TODO: Update Prefs, run forms check and install forms if necessary.
        //TODO: add form pref for designating an alternate form
    }
    if (empty($prefs['ign_user_db'])) {
        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--------------------------
//-----------------------------------------------
    define('PLUGIN_HAS_PREFS', 0x1);
}
// This plugin wants to receive "plugin_prefs.{$plugin['name']}" events
if (!defined('PLUGIN_LIFECYCLE_NOTIFY')) {
    define('PLUGIN_LIFECYCLE_NOTIFY', 0x2);
}
// This plugin wants to receive "plugin_lifecycle.{$plugin['name']}" events
$plugin['flags'] = '0';
if (!defined('txpinterface')) {
    @(include_once 'zem_tpl.php');
}
# --- BEGIN PLUGIN CODE ---
//<?
if (@txpinterface == 'admin') {
    add_privs('bot_wtc_tab', '1,2');
    register_tab('extensions', 'bot_wtc_tab', 'bot_wtc');
    register_callback('bot_wtc_tab', 'bot_wtc_tab');
    register_callback('bot_wtc', 'article');
    register_callback('bot_hide_per_section', 'article');
    register_callback('bot_hidden_sections', 'article');
}
//===========================================
global $bot_items;
// TIP
// I would store these in a named array and then pass them to the function by looping
bot_wtc_insert_in_main_array('textile_help!bot! (!bot!label!bot!)', '$("h3:has(a[href=#textile_help])")');
bot_wtc_insert_in_main_array('textile_help', '$("#textile_help")');
bot_wtc_insert_in_main_array('advanced_options!bot! (!bot!label!bot!)', '$("h3:has(a[href=#advanced])")');
bot_wtc_insert_in_main_array('advanced_options', '$("#advanced")');
bot_wtc_insert_in_main_array('article_markup', '$("p:has(select[id*=markup-body])")');
bot_wtc_insert_in_main_array('excerpt_markup', '$("p:has(select[id*=markup-excerpt])")');
Exemplo n.º 29
0
            
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) {
Exemplo n.º 30
0
}
function zem_file_img($name)
{
    return '<img src="' . zem_file_url($name) . '" />';
}
if (txpinterface === 'admin') {
    zem_event_install();
    register_callback('zem_event_handler', 'article');
    if (zem_txp_ver('4.1.0')) {
        # 4.1.x category type
        include_element('include/txp_category');
        register_category_type('event');
    } else {
        # 4.0.x category tab code
        add_privs('zem_event_cats', '1,2,3,4,5');
        register_tab('content', 'zem_event_cats', zem_event_gTxt('event_categories'));
        register_callback('zem_event_cat_tab', 'zem_event_cats');
    }
}
if (txpinterface === 'public') {
    register_callback('zem_event_feed_entry', 'atom_entry');
    register_callback('zem_event_feed_entry', 'rss_entry');
    if (gps('zf') === 'zem_event_cal.gif') {
        $cal_gif = <<<EOF
R0lGODlhEAAQAMQfAJe66f+ZWNji8PT3+2mW0Xei2O3y+P+yZf+iYlOFxLXN6qvG6V2MybzQ6/+6
c7HJ6f+IRf+pV+Lq9Iau4Y6z5X+o3V2Lxq7I6aPC7/9+PP///7rS88DT656/7P+SUP///yH5BAEA
AB8ALAAAAAAQABAAAAWL4CeOZCluWNcBLEVNUyWL2GDfuF2I3YD8iEDAA4FkBgSez8F0HA6RyDH5
AfiAQaHHgxRZNZpFePzQGBgiymDBvlweirhCYEkPLppyWaHhCxIiEwZwcoUXfyIVBnyMGg19GgJo
H4oNDXKXcnQiBQYcGp+fYGCbH50GEqkCq6ylBQSwDAwJtLW0JrgkIQA7
EOF;
        zem_file_serve(base64_decode($cal_gif));