Exemple #1
0
$xoopsOption['module_subpage'] = 'author';
include 'header.php';
if (!is_numeric($editor)) {
    $sql = "SELECT id_editor FROM " . $db->prefix("mod_mywords_editors") . " WHERE shortname='{$editor}'";
    list($editor) = $db->fetchRow($db->query($sql));
    if ($editor == '') {
        $editor = 0;
    }
}
$ed = new MWEditor($editor);
if ($ed->isNew()) {
    $params = array('page' => 'author');
    RMFunctions::error_404(__('Sorry, we don\'t know this editor', 'admin_mywords'), 'mywords', $params);
    die;
}
$xoopsTpl->assign('editor', array('id' => $ed->id(), 'uid' => $ed->uid, 'name' => $ed->name, 'email' => $ed->data('email'), 'uname' => $ed->uname));
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 0;
if ($page <= 0) {
    $path = explode("/", $request);
    $srh = array_search('page', $path);
    if (isset($path[$srh]) && $path[$srh] == 'page') {
        if (!isset($path[$srh])) {
            $page = 0;
        } else {
            $page = $path[$srh + 1];
        }
    }
}
$request = substr($request, 0, strpos($request, 'page') > 0 ? strpos($request, 'page') - 1 : strlen($request));
/**
 * Paginamos los resultados
Exemple #2
0
}
$xoopsTpl->assign('shownav', $xoopsModuleConfig['shownav']);
if ($xoopsUser && ($xoopsUser->isAdmin() || $editor->getVar('uid') == $xoopsUser->uid())) {
    $editLink = XOOPS_URL . '/modules/mywords/admin/posts.php?op=edit&amp;id=' . $post->id();
    $xoopsTpl->assign('can_edit', true);
    $xoopsTpl->assign('edit_link', $editLink);
    unset($editLink);
}
$xoopsTpl->assign('lang_reads', sprintf(__('%u views', 'mywords'), $post->getVar('reads')));
// Post pages
$total_pages = $post->total_pages();
$nav = new RMPageNav($total_pages, 1, $page, 5);
$nav->target_url($post->permalink() . ($mc['permalinks'] > 1 ? 'page/{PAGE_NUM}/' : '&amp;page={PAGE_NUM}'));
$xoopsTpl->assign('post_navbar', $nav->render(true));
// Post data
$post_arr = array('id' => $post->id(), 'title' => $post->getVar('title'), 'published' => sprintf(__('%s by %s', 'mywords'), MWFunctions::format_time($post->getVar('pubdate')) . ' ' . date('H:i', $post->getVar('pubdate')), '<a href="' . $editor->permalink() . '">' . (isset($editor) ? $editor->getVar('name') : __('Anonymous', 'mywords')) . "</a>"), 'text' => $post->content(false, $page), 'cats' => $post->get_categos('data'), 'tags' => $post->tags(false), 'trackback' => $post->getVar('pingstatus') ? MWFunctions::get_url(true) . $post->id() : '', 'meta' => $post->get_meta('', false), 'time' => $post->getVar('pubdate'), 'image' => $post->image(), 'video' => $post->video, 'player' => $post->video != '' ? $post->video_player() : '', 'author' => array('name' => $editor->getVar('name') != '' ? $editor->name : $editor->shortname, 'id' => $editor->id(), 'link' => $editor->permalink(), 'bio' => $editor->getVar('bio'), 'email' => $editor->data('email'), 'uid' => $editor->uid, 'url' => $editor->data('url')), 'alink' => $editor->permalink(), 'format' => $post->format, 'comments' => $post->comments, 'comments_enabled' => $post->comstatus);
$xoopsTpl->assign('full_post', 1);
$xoopsTpl->assign('lang_editpost', __('Edit Post', 'mywords'));
$xoopsTpl->assign('lang_postedin', __('Posted in:', 'mywords'));
$xoopsTpl->assign('lang_taggedas', __('Tagged as:', 'mywords'));
$xoopsTpl->assign('enable_images', $xoopsModuleConfig['list_post_imgs']);
// Plugins?
$post_arr = RMEvents::get()->run_event('mywords.view.post', $post_arr, $post);
$xoopsTpl->assign('post', $post_arr);
// Related posts
if ($xoopsModuleConfig['related']) {
    $rtags = $post->tags();
    $tt = array();
    foreach ($rtags as $tag) {
        $tt[] = $tag['id_tag'];
    }