/**
 * 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;
}
Beispiel #2
0
/**
 * Muestra el formulario para la creación de una nueva página enlazada
 */
function newLinkForm($edit = 0)
{
    global $db, $mc, $xoopsModule, $myts;
    foreach ($_REQUEST as $k => $v) {
        ${$k} = $v;
    }
    $pag = isset($page) ? $page : 1;
    if ($edit) {
        $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
        if ($id <= 0) {
            redirectMsg("pages.php&cat={$cat}&page={$pag}", __('You must provide a page ID to edit', 'qpages'), 1);
            die;
        }
        $page = new QPPage($id);
    }
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . ($edit ? __('Edit linked page', 'qpages') : __('New linked page', 'qpages')));
    RMTemplate::get()->add_script('../include/js/forms_pages.js');
    xoops_cp_header();
    $form = new RMForm($edit ? __('Edit Linked Page', 'qpages') : __('New Linked Page', 'qpages'), 'frmNew', 'pages.php');
    $form->addElement(new RMFormText(__('Page title', 'qpages'), 'titulo', 50, 255, $edit ? $page->getTitle() : ''), true);
    if ($edit) {
        $ele = new RMFormText(__('Friendly title', 'qpages'), 'titulo_amigo', 50, 255, $page->getFriendTitle());
        $ele->setDescription(__('This title will be used in friendly url.', 'qpages'));
        $form->addElement($ele);
        $form->addElement(new RMFormHidden('id', $page->getID()));
    }
    $ele = new RMFormSelect(__('Category', 'qpages'), 'catego', 0);
    $categos = array();
    qpArrayCategos($categos);
    $ele->addOption('0', _SELECT, $edit ? 0 : 1);
    foreach ($categos as $k) {
        $ele->addOption($k['id_cat'], str_repeat("-", $k['saltos']) . " " . $k['nombre'], $edit ? $k['id_cat'] == $page->getCategory() ? 1 : 0 : 0);
    }
    $form->addElement($ele, true, "Select:0");
    $form->addElement(new RMFormTextArea(__('Introduction', 'qpages'), 'desc', 5, 60, $edit ? $page->getDescription() : ''));
    // URL
    $form->addElement(new RMFormText(__('Target URL', 'qpages'), 'url', 50, 255, $edit ? $page->url() : ''), true);
    // Grupos
    $ele = new RMFormGroups(__('Allowed groups', 'qpages'), 'grupos', 1, 1, 3, $edit ? $page->getGroups() : array(0));
    $ele->setDescription(__('Only selected groups can access to this document.', 'qpages'));
    $form->addElement($ele);
    $ele = new RMFormRadio(__('Status', 'qpages'), 'acceso', 1);
    $ele->addOption(__('Public', 'qpages'), '1', $edit ? $page->getAccess() ? 1 : 0 : 0);
    $ele->addOption(__('Draft', 'qpages'), '0', $edit ? $page->getAccess() ? 0 : 1 : 1);
    $form->addElement($ele);
    $page_metas = $edit ? $page->get_meta() : array();
    $available_metas = qp_get_metas();
    include 'metas.php';
    $form->addElement(new RMFormLabel('', $meta_data));
    $ele = new RMFormButtonGroup();
    $ele->addButton('save', $edit ? __('Update Page', 'qpages') : __('Save Page', 'qpages'), 'submit');
    $ele->addButton('cancel', __('Cancel', 'qpages'), 'button', 'onclick="history.go(-1);"');
    $form->addElement($ele);
    $form->addElement(new RMFormHidden('op', $edit ? 'saveedit' : 'save'));
    $form->addElement(new RMFormHidden('type', 1));
    $form->addElement(new RMFormHidden('cat', $cat));
    $form->addElement(new RMFormHidden('page', $pag));
    $form->display();
    xoops_cp_footer();
}
Beispiel #3
0
    $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'));
require 'footer.php';
Beispiel #4
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';
Beispiel #5
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();