Example #1
0
function mycomments_plugin_execute($dirname, $items, $func = 'useritems')
{
    global $xoopsUser, $xoopsConfig, $xoopsDB;
    $ret = array();
    $plugins_path = XOOPS_ROOT_PATH . "/modules/mycomments/plugins";
    $plugin_info = mycomments_get_plugin_info($dirname, $func);
    if (empty($plugin_info) || empty($plugin_info['plugin_path'])) {
        return false;
    }
    include_once $plugin_info['plugin_path'];
    // call the plugin
    if (function_exists(@$plugin_info['func'])) {
        // get the list of items
        $ret = $plugin_info['func']($items, $limit = 0, $offset = 0);
    }
    return $ret;
}
Example #2
0
$groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
$xoopsTpl->assign('xoops_iscommentadmin', $gperm_handler->checkRight('system_admin', 14, $groups));
$count_string = $com_count != 1 ? _MA_MYCOM_NCOMMENTS : _MA_MYCOM_NCOMMENT;
$xoopsTpl->assign('com_count', sprintf($count_string, $com_count));
$com_order = $com_mode = $link_extra = '';
// assign some lang variables
$xoopsTpl->assign(array('lang_from' => _MA_MYCOM_FROM, 'lang_joined' => _MA_MYCOM_JOINED, 'lang_posts' => _MA_MYCOM_POSTS, 'lang_poster' => _MA_MYCOM_POSTER, 'lang_thread' => _MA_MYCOM_THREAD, 'lang_edit' => _EDIT, 'lang_delete' => _DELETE, 'lang_reply' => _REPLY, 'lang_subject' => _MA_MYCOM_REPLIES, 'lang_posted' => _MA_MYCOM_POSTED, 'lang_updated' => _MA_MYCOM_UPDATED, 'lang_notice' => _MA_MYCOM_NOTICE));
//For the navbar, get all modules that have plugins
$mod_array = array();
//Lets save a query, if no $mid is set then we already have $modules correctly populated
if ($mid > 0) {
    $modules =& $module_handler->getObjects(new Criteria('hascomments', 1), true);
}
foreach ($modules as $moduleid => $module) {
    $items = array();
    $items = mycomments_get_plugin_info($module->getVar('dirname'), 'useritems');
    if (is_array($items) && count($items) > 0) {
        $mod_array[$module->getVar('mid')] = $module->getVar('name');
    }
    unset($items);
}
//Now lets create the form fields
$sel = '';
if ("0" == $mid) {
    $sel = ' selected="selected"';
}
$mod_options = '<option value="0"' . $sel . '>' . _MA_MYCOM_ALL . '</option>';
foreach ($mod_array as $key => $value) {
    $sel = '';
    if ($key == $mid) {
        $sel = ' selected="selected"';