Exemplo n.º 1
0
 /**
  * Executes a specific Eventhook
  *
  * If you want to temporarily block any event plugins, you can set $serendipity['no_events'] before
  * this method call.
  *
  * @access public
  * @param   string      The name of the event to hook on to
  * @param   mixed       May contain any type of variables that are passed by reference to an event plugin
  * @param   mixed       May contain any type of variables that are passed to an event plugin
  * @return true
  */
 function hook_event($event_name, &$eventData, $addData = null)
 {
     global $serendipity;
     // Can be bypassed globally by setting $serendipity['no_events'] = TRUE;
     if (isset($serendipity['no_events']) && $serendipity['no_events'] == true) {
         return false;
     }
     if ($serendipity['enablePluginACL'] && !serendipity_hasPluginPermissions($event_name)) {
         return false;
     }
     // We can NOT use a "return by reference" here, because then when
     // a plugin executes another event_hook, the referenced variable within
     // that call will overwrite the previous original plugin listing and
     // skip the execution of any follow-up plugins.
     $plugins = serendipity_plugin_api::get_event_plugins();
     if (function_exists('serendipity_plugin_api_pre_event_hook')) {
         $apifunc = 'serendipity_plugin_api_pre_event_hook';
         $apifunc($event_name, $bag, $eventData, $addData);
     }
     if (is_array($plugins)) {
         // foreach() operates on copies of values, but we want to operate on references, so we use while()
         @reset($plugins);
         while (list($plugin, $plugin_data) = each($plugins)) {
             $bag =& $plugin_data['b'];
             $phooks =& $bag->get('event_hooks');
             if (isset($phooks[$event_name])) {
                 // Check for cachable events.
                 if (isset($eventData['is_cached']) && $eventData['is_cached']) {
                     $chooks =& $bag->get('cachable_events');
                     if (is_array($chooks) && isset($chooks[$event_name])) {
                         continue;
                     }
                 }
                 if ($serendipity['enablePluginACL'] && !serendipity_hasPluginPermissions($plugin)) {
                     continue;
                 }
                 $plugin_data['p']->event_hook($event_name, $bag, $eventData, $addData);
             }
         }
         if (function_exists('serendipity_plugin_api_event_hook')) {
             $apifunc = 'serendipity_plugin_api_event_hook';
             $apifunc($event_name, $bag, $eventData, $addData);
         }
     }
     return true;
 }
Exemplo n.º 2
0
        </td>
    </tr>

    <tr>
        <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
        <td valign="top"><?php 
        echo PERMISSION_FORBIDDEN_HOOKS;
        ?>
</td>
        <td>
            <select name="serendipity[forbidden_hooks][]" multiple="multiple" size="5">
            <?php 
        foreach ($allhooks as $hook => $set) {
            echo '<option value="' . urlencode($hook) . '" ' . (serendipity_hasPluginPermissions($hook, $from['id']) ? '' : 'selected="selected"') . '>' . htmlspecialchars($hook) . '</option>' . "\n";
        }
        ?>
            </select>
        </td>
    </tr>
<?php 
    } else {
        ?>
    <tr>
        <td colspan="2">&nbsp;</td>
    </tr>

    <tr>
        <td colspan="2"><?php 
        echo PERMISSION_FORBIDDEN_ENABLE_DESC;
Exemplo n.º 3
0
 /**
  * Executes a specific Eventhook
  *
  * If you want to temporarily block any event plugins, you can set $serendipity['no_events'] before
  * this method call.
  *
  * @access public
  * @param   string      The name of the event to hook on to
  * @param   mixed       May contain any type of variables that are passed by reference to an event plugin
  * @param   mixed       May contain any type of variables that are passed to an event plugin
  * @return true
  */
 static function hook_event($event_name, &$eventData, $addData = null)
 {
     global $serendipity;
     // Can be bypassed globally by setting $serendipity['no_events'] = TRUE;
     if (isset($serendipity['no_events']) && $serendipity['no_events'] == true) {
         return false;
     }
     if ($serendipity['enablePluginACL'] && !serendipity_hasPluginPermissions($event_name)) {
         return false;
     }
     // We can NOT use a "return by reference" here, because then when
     // a plugin executes another event_hook, the referenced variable within
     // that call will overwrite the previous original plugin listing and
     // skip the execution of any follow-up plugins.
     $plugins = serendipity_plugin_api::get_event_plugins();
     if ($serendipity['core_events'][$event_name]) {
         foreach ($serendipity['core_events'][$event_name] as $apifunc_key => $apifunc) {
             $apifunc($event_name, $bag, $eventData, $addData);
         }
     }
     // execute backend needed core hooks
     serendipity_plugin_api_core_event_hook($event_name, $bag, $eventData, $addData);
     if (function_exists('serendipity_plugin_api_pre_event_hook')) {
         $apifunc = 'serendipity_plugin_api_pre_event_hook';
         $apifunc($event_name, $bag, $eventData, $addData);
     }
     // Function names cannot contain ":" etc, so if we ever have event looks like "backend:js" this
     // needs to be replaced to "backend_js". The real event name is passed as a function argument
     // These specific per-hook functions are utilized for theme's config.inc.php files
     // that act as an engine for other themes.
     $safe_event_name = preg_replace('@[^a-z0-9_]+@i', '_', $event_name);
     if (function_exists('serendipity_plugin_api_pre_event_hook_' . $safe_event_name)) {
         $apifunc = 'serendipity_plugin_api_pre_event_hook_' . $safe_event_name;
         $apifunc($event_name, $bag, $eventData, $addData);
     }
     if (is_array($plugins)) {
         // foreach() operates on copies of values, but we want to operate on references, so we use while()
         @reset($plugins);
         while (list($plugin, $plugin_data) = each($plugins)) {
             $bag =& $plugin_data['b'];
             $phooks =& $bag->get('event_hooks');
             if (isset($phooks[$event_name])) {
                 // Check for cachable events.
                 if (isset($eventData['is_cached']) && $eventData['is_cached']) {
                     $chooks =& $bag->get('cachable_events');
                     if (is_array($chooks) && isset($chooks[$event_name])) {
                         continue;
                     }
                 }
                 if ($serendipity['enablePluginACL'] && !serendipity_hasPluginPermissions($plugin)) {
                     continue;
                 }
                 $plugin_data['p']->event_hook($event_name, $bag, $eventData, $addData);
             }
         }
         if (function_exists('serendipity_plugin_api_event_hook')) {
             $apifunc = 'serendipity_plugin_api_event_hook';
             $apifunc($event_name, $bag, $eventData, $addData);
         }
         if (function_exists('serendipity_plugin_api_event_hook_' . $safe_event_name)) {
             $apifunc = 'serendipity_plugin_api_event_hook_' . $safe_event_name;
             $apifunc($event_name, $bag, $eventData, $addData);
         }
     }
     return true;
 }
Exemplo n.º 4
0
            $data['perms'][$perm]['permission'] = false;
        } else {
            $data['perms'][$perm]['permission'] = true;
        }
    }
    if ($serendipity['enablePluginACL']) {
        $data['enablePluginACL'] = true;
        $allplugins =& serendipity_plugin_api::get_event_plugins();
        $allhooks = array();
        $data['allplugins'] = $allplugins;
        foreach ($allplugins as $plugid => $currentplugin) {
            foreach ($currentplugin['b']->properties['event_hooks'] as $hook => $set) {
                $allhooks[$hook] = array();
            }
            $data['allplugins'][$plugid]['has_permission'] = serendipity_hasPluginPermissions($plugid, $from['id']);
        }
        ksort($allhooks);
        $data['allhooks'] = $allhooks;
        foreach ($allhooks as $hook => $set) {
            $data['allhooks'][$hook]['has_permission'] = serendipity_hasPluginPermissions($hook, $from['id']);
        }
    }
} elseif ($serendipity['GET']['adminAction'] == 'delete') {
    $data['delete'] = true;
    $group = serendipity_fetchGroup($serendipity['GET']['group']);
    $data['group_id'] = $serendipity['GET']['group'];
    $data['group'] = $group;
    $data['formToken'] = serendipity_setFormToken();
}
echo serendipity_smarty_show('admin/groups.inc.tpl', $data);
/* vim: set sts=4 ts=4 expandtab : */