Esempio n. 1
0
/**
 * Mostramos las página existentes
 */
function qpagesBlockPages($options)
{
    global $xoopsConfig;
    include_once XOOPS_ROOT_PATH . '/modules/qpages/class/qppage.class.php';
    $db =& XoopsDatabaseFactory::getDatabaseConnection();
    $mc =& RMUtilities::module_config('qpages');
    if (!defined('QP_URL')) {
        define('QP_URL', XOOPS_URL . ($mc['links'] ? $mc['basepath'] : '/modules/qpages'));
    }
    $sql = "SELECT * FROM " . $db->prefix("qpages_pages");
    if ($options[0] > 0) {
        $sql .= " WHERE cat='{$options['0']}'";
    }
    $sql .= " ORDER BY fecha DESC LIMIT 0,{$options['1']}";
    $block = array();
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $page = new QPPage();
        $page->assignVars($row);
        $rtn = array();
        $rtn['id'] = $page->getID();
        $rtn['titulo'] = $page->getTitle();
        $rtn['link'] = $page->getPermaLink();
        $block['pages'][] = $rtn;
    }
    return $block;
}
Esempio n. 2
0
/**
 * Función para realizar búsquedas
 */
function qpages_search($qa, $andor, $limit, $offset, $userid)
{
    global $xoopsUser, $mc;
    include_once XOOPS_ROOT_PATH . '/modules/qpages/class/qppage.class.php';
    $mc = RMUtilities::module_config('qpages');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("qpages_pages");
    $adds = '';
    if (is_array($qa) && ($count = count($qa))) {
        $adds = '';
        for ($i = 0; $i < $count; $i++) {
            $adds .= $adds == '' ? "(titulo LIKE '%{$qa[$i]}%' OR titulo_amigo LIKE '%{$qa[$i]}%')" : " {$andor} (titulo LIKE '%{$qa[$i]}%' OR titulo_amigo LIKE '%{$qa[$i]}%')";
        }
    }
    $sql .= $adds != '' ? " WHERE {$adds}" : '';
    if ($userid > 0) {
        $sql .= ($adds != '' ? " AND " : " WHERE ") . "uid='{$userid}'";
    }
    $sql .= " ORDER BY modificado DESC";
    $i = 0;
    $result = $db->query($sql);
    $ret = array();
    while ($row = $db->fetchArray($result)) {
        $page = new QPPage();
        $page->assignVars($row);
        $ret[$i]['image'] = "images/page.png";
        $ret[$i]['link'] = $mc['links'] == 0 ? 'page.php?page=' . $page->getFriendTitle() : $page->getFriendTitle() . '/';
        $ret[$i]['title'] = $page->getTitle();
        $ret[$i]['time'] = $page->getDate();
        $ret[$i]['uid'] = $page->uid();
        $ret[$i]['desc'] = $page->getDescription();
        $i++;
    }
    return $ret;
}
Esempio n. 3
0
 /**
  * This method is designed specially for MyWords
  */
 public function eventQpagesViewPage(QPPage $page)
 {
     $config = RMFunctions::get()->plugin_settings('metaseo', true);
     if (!$config['meta']) {
         $metas = '<meta name="description" content="' . TextCleaner::truncate($page->getText(), $config['len']) . '" />';
         /*$tags = array();
         		foreach($post->tags() as $tag){
         			$tags[] = $tag['tag'];
         		}
         		$tags = implode(',',$tags);
         		$metas .= '<meta name="keywords" content="'.$tags.'" />';*/
     } else {
         $metas = '<meta name="description" content="' . $page->get_meta($config['meta_name'], false) . '" />';
         $metas = '<meta name="description" content="' . $page->get_meta($config['meta_keys'], false) . '" />';
     }
     RMTemplate::get()->add_head($metas);
     return $post_data;
 }
Esempio n. 4
0
function clonePage()
{
    $id = rmc_server_var($_GET, 'id', 0);
    $page = new QPPage($id);
    if ($page->isNew()) {
        redirectMsg('pages.php', __('Specified page does not exists!', 'qpages'), 1);
        die;
    }
    $page->setNew();
    $page->setTitle($page->getTitle() . ' [cloned]');
    $page->setFriendTitle(TextCleaner::sweetstring($page->getTitle()));
    if (!$page->save()) {
        redirectMsg('pages.php', __('Page could not be cloned!', 'qpages'), 1);
        die;
    }
    redirectMsg('pages.php?op=edit&id=' . $page->getID(), __('Page cloned successfully!', 'qpages'), 0);
}
Esempio n. 5
0
    $rp = new QPPage();
    $rp->assignVars($p);
    $tpl->append('pages', array('id' => $rp->getID(), 'link' => $rp->getPermaLink(), 'title' => $rp->getTitle(), 'modified' => formatTimestamp($rp->getModDate(), 'l'), 'hits' => $rp->getReads(), 'desc' => $rp->getDescription()));
}
$tpl->assign('page_count', count($lpages));
unset($pages);
// Subcategorias
$result = $db->query("SELECT * FROM " . $db->prefix("qpages_categos") . " WHERE parent = " . $catego->getID());
$tpl->assign('subcats_count', $db->getRowsNum($result));
while ($k = $db->fetchArray($result)) {
    $cat = new QPCategory();
    $cat->assignVars($k);
    $lpages = $cat->loadPages();
    $pages = array();
    foreach ($lpages as $p) {
        $page = new QPPage();
        $page->assignVars($p);
        $ret = array();
        $ret['titulo'] = $page->getTitle();
        $ret['desc'] = $page->getDescription();
        $ret['link'] = $page->getPermaLink();
        $pages[] = $ret;
    }
    $link = $cat->getLink();
    $subcats = $cat->getSubcategos();
    $tpl->append('categos', array('id' => $cat->getID(), 'nombre' => $cat->getName(), 'desc' => $cat->getDescription(), 'pages_count' => sprintf(__('%u pages', 'qpages'), count($lpages)), 'link' => $link, 'subcats' => count($subcats) > 0 ? $subcats : '', 'subcats_count' => count($subcats)));
}
$tpl->assign('lang_subcats', __('Subcategories', 'qpages'));
$tpl->assign('lang_page', __('Page', 'qpages'));
$tpl->assign('lang_modified', __('Last update', 'qpages'));
$tpl->assign('lang_hits', __('Reads', 'qpages'));
Esempio n. 6
0
    $location .= '&raquo; <a href="' . $k->getLink() . '">' . $k->getName() . '</a> ';
    $pt[] = $k->getName();
}
$location .= '&raquo; ' . $page->getTitle();
$pt[] = $page->getTitle();
$pagetitle = '';
for ($i = count($pt) - 1; $i >= 0; $i--) {
    $pagetitle .= $pagetitle == '' ? $pt[$i] : " &laquo; {$pt[$i]}";
}
$tpl->assign('page_location', $location);
$tpl->assign('xoops_pagetitle', $pagetitle);
$page->addRead();
$tpl->assign('page', array('title' => $page->getTitle(), 'text' => $page->getText(), 'id' => $page->getID(), 'name' => $page->getFriendTitle(), 'mod_date' => sprintf(__('Last update: %s', 'qpages'), formatTimestamp($page->getModDate(), 'c')), 'reads' => sprintf(__('Read %u times', 'qpages'), $page->getReads()), 'metas' => $page->get_meta()));
// Páginas relacionadas
if ($mc['related']) {
    $sql = "SELECT * FROM " . $db->prefix("qpages_pages") . " WHERE cat='" . $catego->getID() . "' AND id_page<>'" . $page->getID() . "' ORDER BY RAND() DESC LIMIT 0,{$mc['related_num']}";
    $result = $db->query($sql);
    $tpl->assign('related_num', $db->getRowsNum($result));
    while ($row = $db->fetchArray($result)) {
        $rp = new QPPage();
        $rp->assignVars($row);
        $tpl->append('related', array('id' => $rp->getID(), 'link' => $rp->getPermaLink(), 'title' => $rp->getTitle(), 'modified' => formatTimestamp($rp->getModDate(), 'c'), 'hits' => $rp->getReads(), 'desc' => $rp->getDescription()));
    }
}
$tpl->assign('show_related', $mc['related']);
$tpl->assign('lang_related', __('Related Pages', 'qpages'));
$tpl->assign('lang_page', __('Page', 'qpages'));
$tpl->assign('lang_modified', __('Last modification', 'qpages'));
$tpl->assign('lang_hits', __('Hits', 'qpages'));
RMEvents::get()->run_event('qpages.view.page', $page);
require 'footer.php';
Esempio n. 7
0
    $leg .= urlencode($page->getTitle() . ' (' . $page->getReads() . ' times)') . "|";
    $values .= $page->getReads() . ',';
}
$values = rtrim($values, ',');
$leg = rtrim($leg, "|");
if ($max > 0) {
    $chart = "http://chart.apis.google.com/chart?";
    $chart .= "cht=bvs&chco=99CC00|FFCC00|0099FF|FF6600|6666FF";
    $chart .= "&" . $labels . '&' . $values . "&" . $leg;
    $chart .= "&chbh=a,20&chs=330x300&chxr=1,0," . $max . "&chds=0," . ($max + 1);
    $chart .= "&chtt=" . urlencode(__('Most viewed pages', 'qpages'));
} else {
    $chart = '';
}
// Recent pages
$sql = "SELECT * FROM " . $db->prefix("qpages_pages") . " ORDER BY fecha DESC LIMIT 0, 5";
$result = $db->query($sql);
$pages = array();
while ($row = $db->fetchArray($result)) {
    $page = new QPPage();
    $page->assignVars($row);
    $pages[] = array('id' => $page->getID(), 'title' => $page->getTitle(), 'link' => $page->getPermaLink(), 'desc' => $page->getDescription(), 'public' => $page->getAccess());
}
RMTemplate::get()->set_help('http://redmexico.com.mx/docs/quickpages');
// Left widgets and right widgets
$left_widgets = array();
$left_widgets = RMEvents::get()->run_event('qpages.left.widgets', $left_widgets);
$right_widgets = array();
$right_widgets = RMEvents::get()->run_event('qpages.right.widgets', $right_widgets);
include RMTemplate::get()->get_template('admin/qp_index.php', 'module', 'qpages');
xoops_cp_footer();