示例#1
0
    die;
}
$post = new MWPost($post);
// Comprobamos que exista el post
if ($post->isNew()) {
    redirect_header(mw_get_url(), 2, __('Document not found', 'mywords'));
    die;
}
// Comprobamos permisos de acceso al post
if (!$post->user_allowed()) {
    redirect_header(MWFunctions::get_url(), 2, __('Sorry, you are not allowed to view this post', 'mywords'));
    die;
}
// Check if post belong to some category
if (count($post->get_categos()) <= 0) {
    $post->update();
}
# Generamos los vínculos
$day = date('d', $post->getVar('pubdate'));
$month = date('m', $post->getVar('pubdate'));
$year = date('Y', $post->getVar('pubdate'));
//
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 0;
# Generamos el vínculo para el autor
$editor = new MWEditor($post->getVar('author'));
# Texto de continuar leyendo
$xoopsTpl->assign('xoops_pagetitle', $post->getVar('title'));
# Cargamos los comentarios del Artículo
if ($page <= 0) {
    $path = explode("/", $request);
    $srh = array_search('page', $path);
示例#2
0
$post = new MWPost($id);
if ($post->isNew()) {
    die;
}
$editor = new MWEditor($post->getVar('author'));
if ($editor->isNew()) {
    $user = new XoopsUser($post->getVar('author'));
}
$tracks = $post->getVar('toping');
if (empty($tracks)) {
    die;
}
$pinged = $post->getVar('pinged');
$toping = $post->getVar('toping');
$tp = array();
$tback = new MWTrackback($xoopsModuleConfig['blogname'], $editor->isNew() ? $user->getVar('uname') : $editor->getVar('name'));
foreach ($tracks as $t) {
    if (!empty($pinged) && in_array($t, $pinged)) {
        continue;
    }
    $ret = $tback->ping($t, $post->permalink(), $post->getVar('title'), TextCleaner::getInstance()->truncate($post->content(true), 240));
    if ($ret) {
        $pinged[] = $t;
    } else {
        $tp[] = $t;
    }
}
$post->setVar('toping', empty($tp) ? '' : $tp);
$post->setVar('pinged', $pinged);
$post->update(true);
die;