Ejemplo n.º 1
0
/**
 * Mostramos la lista de editores junto con
 * el formulario para crear nuevos editores
 */
function show_editors()
{
    global $tpl, $xoopsUser, $xoopsSecurity, $xoopsModule;
    MWFunctions::include_required_files();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . __('Editors', 'mywords'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Editors Management', 'mywords'));
    include_once RMCPATH . '/class/form.class.php';
    foreach ($_REQUEST as $k => $v) {
        ${$k} = $v;
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    list($num) = $db->fetchRow($db->query("SELECT COUNT(*) FROM " . $db->prefix("mw_editors")));
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = isset($limit) && $limit > 0 ? $limit : 15;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('editors.php?page={PAGE_NUM}');
    $result = $db->query("SELECT * FROM " . $db->prefix("mw_editors") . " ORDER BY name LIMIT {$start},{$limit}");
    $editores = array();
    while ($row = $db->fetchArray($result)) {
        $ed = new MWEditor();
        $ed->assignVars($row);
        $tpl->append('editors', $ed);
    }
    xoops_cp_header();
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_script('../include/js/scripts.php?file=editors.js');
    include RMTemplate::get()->get_template('admin/mywords_editors.php', 'module', 'mywords');
    xoops_cp_footer();
}
Ejemplo n.º 2
0
/**
* @desc Muestra una lista con los elementos editados esperando aprovación
*/
function showEdits()
{
    global $xoopsModule, $db, $adminTemplate, $tpl, $mc;
    $sql = "SELECT * FROM " . $db->prefix("rd_edits");
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $limit = 15;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('edits.php?page={PAGE_NUM}');
    $sql = "SELECT * FROM " . $db->prefix("rd_edits") . " ORDER BY `modified` DESC LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $sections = array();
    while ($row = $db->fetchArray($result)) {
        $edit = new RDEdit();
        $edit->assignVars($row);
        $sec = new RDSection($edit->getVar('id_sec'));
        $sections[] = array('id' => $edit->id(), 'section' => array('id' => $sec->id(), 'title' => $sec->getVar('title'), 'link' => $sec->permalink()), 'title' => $edit->getVar('title'), 'date' => RMTimeFormatter::get()->format($edit->getVar('modified'), __('%M% %d%, %Y%', 'docs')), 'uname' => $edit->getVar('uname'));
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Waiting Content', 'docs'));
    xoops_cp_header();
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('admin.js', 'docs', 'include');
    RMTemplate::get()->add_style('admin.css', 'docs');
    include RMEvents::get()->run_event("docs.waiting.template", RMTemplate::get()->get_template("admin/rd_waiting.php", 'module', 'docs'));
    xoops_cp_footer();
}
Ejemplo n.º 3
0
function search_resources()
{
    global $xoopsConfig, $xoopsUser, $page, $xoopsTpl;
    $keyword = rmc_server_var($_GET, 'keyword', '');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1";
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = 15;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url(RDFunctions::make_link('search') . '?keyword=' . $keyword . '&amp;page={PAGE_NUM}');
    $sql = "SELECT * FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1 LIMIT {$start}, {$limit}";
    $result = $db->query($sql);
    $resources = array();
    while ($row = $db->fetchArray($result)) {
        $res = new RDResource();
        $res->assignVars($row);
        $resources[] = array('id' => $res->id(), 'title' => $res->getVar('title'), 'desc' => TextCleaner::truncate($res->getVar('description'), 100), 'link' => $res->permalink(), 'created' => $res->getVar('created'), 'owner' => $res->getVar('owner'), 'uname' => $res->getVar('owname'), 'reads' => $res->getVar('reads'));
    }
    RDFunctions::breadcrumb();
    RMBreadCrumb::get()->add_crumb(__('Browsing recent Documents', 'docs'));
    RMTemplate::get()->add_style('docs.css', 'docs');
    include 'header.php';
    $xoopsTpl->assign('xoops_pagetitle', sprintf(__('Search results for "%s"', 'docs'), $keyword));
    include RMEvents::get()->run_event('docs.template.search', RMTemplate::get()->get_template('rd_search.php', 'module', 'docs'));
    include 'footer.php';
}
Ejemplo n.º 4
0
function get_modules_ajax()
{
    XoopsLogger::getInstance()->activated = false;
    XoopsLogger::getInstance()->renderingEnabled = false;
    $db = Database::getInstance();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("modules");
    $page = rmc_server_var($_POST, 'page', 1);
    $limit = RMFunctions::configs('mods_number');
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('javascript:;" onclick="get_mods_page({PAGE_NUM})');
    $sql = 'SELECT * FROM ' . $db->prefix('modules') . " ORDER BY mid, weight LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $installed_mods = array();
    while ($row = $db->fetchArray($result)) {
        $mod = new XoopsModule();
        $mod->assignVars($row);
        $installed_mods[] = $mod;
    }
    include RMTemplate::get()->get_template('rmc_mods_installed.php', 'module', 'rmcommon');
    die;
}
Ejemplo n.º 5
0
/**
* Shows all messages sent by users and stored in database
*/
function cm_show_messages()
{
    global $xoopsDB, $xoopsModuleConfig, $xoopsSecurity;
    // Styles
    RMTemplate::get()->add_style('admin.css', 'contact');
    // Pagination
    $page = rmc_server_var($_GET, 'page', 1);
    $page = $page <= 0 ? 1 : $page;
    $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("contactme"));
    list($num) = $xoopsDB->fetchRow($result);
    $limit = $xoopsModuleConfig['limit'];
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('index.php?page={PAGE_NUM}');
    // Get messages
    $messages = array();
    $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("contactme") . " ORDER BY id_msg DESC LIMIT {$start},{$limit}");
    $time = new RMTimeFormatter(0, __('%M% %d%, %Y%', 'contact'));
    while ($row = $xoopsDB->fetchArray($result)) {
        $msg = new CTMessage();
        $msg->assignVars($row);
        if ($msg->getVar('xuid')) {
            $user = new XoopsUser($msg->getVar('xuid'));
        }
        $messages[] = array('id' => $msg->id(), 'subject' => $msg->getVar('subject'), 'ip' => $msg->getVar('ip'), 'email' => $msg->getVar('email'), 'name' => $msg->getVar('name'), 'company' => $msg->getVar('org'), 'body' => $msg->getVar('body'), 'phone' => $msg->getVar('phone'), 'register' => $msg->getVar('register'), 'xuid' => $msg->getVar('xuid'), 'uname' => $msg->getVar('xuid') > 0 ? $user->uname() : '', 'date' => $time->format($msg->getVar('date')));
    }
    RMTemplate::get()->add_local_script('admin.js', 'contact');
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon');
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/ct_dashboard.php', 'module', 'contact');
    xoops_cp_footer();
}
Ejemplo n.º 6
0
/**
* @desc Visualiza todas los etiquetas existentes
**/
function showTags()
{
    global $xoopsModule, $xoopsSecurity, $xoopsModuleConfig;
    $db = Database::getInstance();
    $mc =& $xoopsModuleConfig;
    $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
    $page = $page < 1 ? 1 : $page;
    $limit = 15;
    $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : '';
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_tags');
    $sql1 = '';
    $words = array();
    if ($search) {
        //Separamos en palabras
        $words = explode(" ", $search);
        foreach ($words as $k) {
            $k = trim($k);
            if (strlen($k) < $mc['min_tag'] || strlen($k) > $mc['max_tag']) {
                continue;
            }
            $sql1 .= $sql1 == '' ? " WHERE (tag LIKE '%{$k}%')" : " OR (tag LIKE '%{$k}%')";
        }
    }
    list($num) = $db->fetchRow($db->query($sql . $sql1));
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $tpages = ceil($num / $limit);
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url("tags.php?search=" . urlencode($search) . "&amp;page={PAGE_NUM}");
    $showmax = $start + $limit;
    $showmax = $showmax > $num ? $num : $showmax;
    //Fin de barra de navegación
    $sql = "SELECT * FROM " . $db->prefix('gs_tags');
    $sql2 = " LIMIT {$start},{$limit}";
    $result = $db->query($sql . $sql1 . $sql2);
    $tags = array();
    while ($rows = $db->fetchArray($result)) {
        foreach ($words as $k) {
            $rows['tag'] = eregi_replace("({$k})", "<span class='searchResalte'>\\1</span>", $rows['tag']);
        }
        $tag = new GSTag();
        $tag->assignVars($rows);
        //Obtenemos todas las imágenes pertenecientes a la etiqueta
        $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_tagsimages') . " WHERE id_tag=" . $tag->id();
        list($pics) = $db->fetchRow($db->query($sql));
        $tags[] = array('id' => $tag->id(), 'name' => $tag->tag(), 'pics' => $pics, 'url' => $tag->url());
    }
    GSFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Tags Management', 'galleries'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Tags Management', 'galleries'));
    $cHead = '<link href="' . XOOPS_URL . '/modules/galleries/styles/admin.css" media="all" rel="stylesheet" type="text/css" />';
    xoops_cp_header($cHead);
    include RMTemplate::get()->get_template("admin/gs_tags.php", 'module', 'galleries');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_script('../include/js/gsscripts.php?file=sets&form=frm-tags');
    RMTemplate::get()->add_script('../include/js/gsscripts.php?file=tags');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar delete_warning='" . __('Do you really wish to delete selected tags?', 'galleries') . "';\n</script>");
    xoops_cp_footer();
}
Ejemplo n.º 7
0
/**
 * Muestra los envíos existentes
 */
function showPages($acceso = -1)
{
    global $mc, $xoopsModule, $xoopsSecurity;
    $keyw = rmc_server_var($_REQUEST, 'keyw', '');
    $acceso = rmc_server_var($_REQUEST, 'acceso', -1);
    $cat = rmc_server_var($_REQUEST, 'cat', '');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("qpages_pages");
    if ($acceso >= 0) {
        $sql .= " WHERE acceso={$acceso}";
    }
    if (trim($keyw) != '') {
        $sql .= ($acceso >= 0 ? " AND " : " WHERE ") . "titulo LIKE '%{$keyw}%'";
    }
    if (isset($cat) && $cat > 0) {
        $sql .= ($acceso >= 0 || $keyw != '' ? " AND " : " WHERE ") . "cat='{$cat}'";
    }
    /**
     * Paginacion de Resultados
     */
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $page = $page <= 0 ? 1 : $page;
    $limit = 15;
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('pages.php?cat=' . $cat . '&page={PAGE_NUM}');
    $sql .= " ORDER BY id_page DESC LIMIT {$start},{$limit}";
    $sql = str_replace("SELECT COUNT(*)", "SELECT *", $sql);
    $result = $db->query($sql);
    $pages = array();
    while ($row = $db->fetchArray($result)) {
        $p = new QPPage();
        $p->assignVars($row);
        # Enlaces para las categorías
        $catego = new QPCategory($p->getCategory());
        $pages[] = array('id' => $p->getID(), 'titulo' => $p->getTitle(), 'catego' => $catego->getName(), 'fecha' => formatTimeStamp($p->getDate(), 's'), 'link' => $p->getPermaLink(), 'estado' => $p->getAccess(), 'modificada' => $p->getModDate() == 0 ? '--' : formatTimestamp($p->getModDate(), 'c'), 'lecturas' => $p->getReads(), 'order' => $p->order(), 'type' => $p->type(), 'desc' => $p->getDescription());
    }
    /**
     * Cargamos las categorias
     */
    $categos = array();
    qpArrayCategos($categos);
    $categories = array();
    foreach ($categos as $k) {
        $categories[] = array('id' => $k['id_cat'], 'nombre' => $k['nombre'], 'saltos' => $k['saltos']);
    }
    RMTemplate::get()->add_style('admin.css', 'qpages');
    RMTemplate::get()->add_script('../include/js/qpages.js');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->assign('xoops_pagetitle', __('Pages Management', 'qpages'));
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . '</a> &raquo; ' . ($acceso < 0 ? __('All Pages', 'qpages') : ($acceso == 0 ? __('Draft pages', 'qpages') : __('Published pages', 'qpages'))));
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/qp_pages.php", 'module', 'qpages');
    xoops_cp_footer();
}
Ejemplo n.º 8
0
/**
* @desc Visualiza todos los albums
**/
function showAlbums()
{
    global $tpl, $xoopsModule, $mc, $xoopsSecurity;
    define('RMSUBLOCATION', 'sets');
    $db = Database::getInstance();
    $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
    $limit = 15;
    $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'id_set';
    $mode = isset($_REQUEST['mode']) ? $_REQUEST['mode'] : 1;
    $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : '';
    $query = "search={$search}&page={$page}&sort={$sort}&mode={$mode}";
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_sets');
    $sql1 = '';
    $words = array();
    if ($search) {
        //Separamos en palabras
        $words = explode(" ", $search);
        foreach ($words as $k) {
            $k = trim($k);
            if (strlen($k) <= 2) {
                continue;
            }
            $sql1 .= $sql1 == '' ? " WHERE (title LIKE '%{$k}%' OR uname LIKE '%{$k}%')" : " OR (title LIKE '%{$k}%' OR uname LIKE '%{$k}%')";
        }
    }
    list($num) = $db->fetchRow($db->query($sql . $sql1));
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $tpages = ceil($num / $limit);
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url("sets.php?page={PAGE_NUM}&sort={$sort}&mode={$mode}&search={$search}");
    //Fin de barra de navegación
    $sql = str_replace('COUNT(*)', '*', $sql);
    $sql2 = $sort ? " ORDER BY {$sort} " . ($mode ? "DESC" : "ASC ") : '';
    $sql2 .= " LIMIT {$start},{$limit}";
    $result = $db->query($sql . $sql1 . $sql2);
    $sets = array();
    while ($rows = $db->fetchArray($result)) {
        foreach ($words as $k) {
            $rows['title'] = eregi_replace("({$k})", "<span class='searchResalte'>\\1</span>", $rows['title']);
            $rows['uname'] = eregi_replace("({$k})", "<span class='searchResalte'>\\1</span>", $rows['uname']);
        }
        $set = new GSSet();
        $set->assignVars($rows);
        $sets[] = array('id' => $set->id(), 'title' => $set->title(), 'owner' => $set->uname(), 'public' => $set->isPublic(), 'date' => formatTimeStamp($set->date(), 'c'), 'pics' => $set->pics(), 'url' => $set->url());
    }
    GSFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Albums Management', 'galleries'));
    RMTemplate::get()->assign('xoops_pagetitle', 'Albums Management');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_head("<script type='text/javascript'>\n\n    var delete_warning='" . __('Do you really wish to delete selected albums?', 'galleries') . "';\n\n    var delete_formats='" . __('Do you really wish to delete all images formats for this album?\\nOnly deletes formats for albums, search and others, except normal thumbnails.', 'galleries') . "';\n\n    </script>");
    RMTemplate::get()->add_script('../include/js/gsscripts.php?file=sets');
    $cHead = '<link href="' . XOOPS_URL . '/modules/galleries/styles/admin.css" media="all" rel="stylesheet" type="text/css" />';
    xoops_cp_header($cHead);
    include RMTemplate::get()->get_template('admin/gs_albums.php', 'module', 'galleries');
    xoops_cp_footer();
}
Ejemplo n.º 9
0
function m_show_teams()
{
    global $xoopsModule, $xoopsSecurity;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $id = rmc_server_var($_REQUEST, 'id', 0);
    if ($id > 0) {
        MCHFunctions::page_from_item($id, 'team');
    }
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $page = $page <= 0 ? 1 : $page;
    $limit = 15;
    $category = rmc_server_var($_REQUEST, 'category', 0);
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('mch_teams');
    if ($category > 0) {
        $sql .= " WHERE category={$category}";
    }
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('teams.php?page={PAGE_NUM}');
    $teams = array();
    $result = $db->query("SELECT * FROM " . $db->prefix("mch_teams") . ($category > 0 ? " WHERE category={$category}" : '') . " ORDER BY `wins`,active LIMIT {$start},{$limit}");
    $cache_cat = array();
    while ($row = $db->fetchArray($result)) {
        $team = new MCHTeam();
        $team->assignVars($row);
        if (isset($cache_cat[$team->getVar('category')])) {
            $cat = $cache_cat[$team->getVar('category')];
        } else {
            $cache_cat[$team->getVar('category')] = new MCHCategory($team->getVar('category'));
            $cat = $cache_cat[$team->getVar('category')];
        }
        $date = new RMTimeFormatter(0, __('%M% %d%, %Y%', 'match'));
        $teams[] = array('id' => $team->id(), 'link' => $team->permalink(), 'name' => $team->getVar('name'), 'active' => $team->getVar('active'), 'wins' => $team->getVar('wins'), 'nameid' => $team->getVar('nameid'), 'info' => $team->getVar('info'), 'created' => $date->format($team->getVar('created')), 'category' => array('id' => $cat->id(), 'name' => $cat->getVar('name'), 'link' => $cat->permalink()));
    }
    // Categories
    $categories = array();
    MCHFunctions::categories_tree($categories);
    // Event
    $teams = RMEvents::get()->run_event('match.list.teams', $teams);
    MCHFunctions::toolbar();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; " . __('Teams', 'match'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Teams', 'match'));
    RMTemplate::get()->add_style('admin.css', 'match');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_local_script('admin_match.js', 'match');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar mch_message='" . __('Do you really want to delete selected teams?\\nAll players and coaches assigned to this team will be deleted also.\\n\\nIf you no want to lose data, then reassign players and coaches before to delete this team.', 'match') . "';\n\n        var mch_select_message = '" . __('You must select some team before to execute this action!', 'match') . "';</script>");
    xoops_cp_header();
    $match_extra_options = RMEvents::get()->run_event('match.more.options');
    include RMTemplate::get()->get_template("admin/mch_teams.php", 'module', 'match');
    xoops_cp_footer();
}
Ejemplo n.º 10
0
/**
* @desc Visualiza todos los trabajos existentes
**/
function showWorks()
{
    global $xoopsModule, $xoopsSecurity;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $limit = rmc_server_var($_REQUEST, 'limit', 15);
    $show = rmc_server_var($_REQUEST, 'show', '');
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('pw_works');
    if ($show == 'public') {
        $sql .= " WHERE public=1";
    } elseif ($show == 'hidden') {
        $sql .= " WHERE public=0";
    }
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('works.php?page={PAGE_NUM}');
    $sql = "SELECT * FROM " . $db->prefix('pw_works');
    if ($show == 'public') {
        $sql .= " WHERE public=1";
    } elseif ($show == 'hidden') {
        $sql .= " WHERE public=0";
    }
    $sql .= " ORDER BY id_work DESC LIMIT {$start}, {$limit}";
    $result = $db->query($sql);
    $works = array();
    //Container
    while ($row = $db->fetchArray($result)) {
        $work = new PWWork();
        $work->assignVars($row);
        //Obtenemos la categoría
        $cat = new PWCategory($work->category());
        //Obtenemos el cliente
        $user = new PWClient($work->client());
        $works[] = array('id' => $work->id(), 'title' => $work->title(), 'catego' => $cat->name(), 'client' => $user->name(), 'start' => formatTimeStamp($work->start(), 's'), 'mark' => $work->mark(), 'public' => $work->isPublic(), 'description' => $work->descShort());
    }
    PWFunctions::toolbar();
    RMTemplate::get()->add_style('admin.css', 'works');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_script('../include/js/admin_works.js');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar pw_message='" . __('Do you really want to delete selected works?', 'works') . "';\n\n        var pw_select_message = '" . __('You must select some work before to execute this action!', 'works') . "';</script>");
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; " . __('Works', 'works'));
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/pw_works.php", 'module', 'works');
    xoops_cp_footer();
}
Ejemplo n.º 11
0
function showImages()
{
    global $xoopsModule, $db, $xoopsSecurity;
    $work = rmc_server_var($_REQUEST, 'work', 0);
    //Verificamos que el trabajo sea válido
    if ($work <= 0) {
        redirectMsg('./works.php', __('Provided work ID is not valid!', 'works'), 1);
        die;
    }
    //Verificamos que el trabajo exista
    $work = new PWWork($work);
    if ($work->isNew()) {
        redirectMsg('./works.php', __('Specified work does not exists!', 'admin_work'), 1);
        die;
    }
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('pw_images') . " WHERE work='" . $work->id() . "'";
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $page = $page <= 0 ? 1 : $page;
    $limit = 10;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('images.php?page={PAGE_NUM}&amp;work=' . $work->id());
    $sql = "SELECT * FROM " . $db->prefix('pw_images') . " WHERE work='" . $work->id() . "'";
    $sql .= " LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $images = array();
    while ($row = $db->fetchArray($result)) {
        $img = new PWImage();
        $img->assignVars($row);
        $images[] = array('id' => $img->id(), 'title' => $img->title(), 'image' => $img->image(), 'work' => $img->work(), 'desc' => $img->desc());
    }
    $images = RMEvents::get()->run_event('works.list.images', $images, $work);
    $form_fields = '';
    $form_fields = RMEvents::get()->run_event('works.images.form.fields', $form_fields, $work);
    PWFunctions::toolbar();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; " . __('Work Images', 'works'));
    RMTemplate::get()->assign('xoops_pagetitle', $work->title() . ' &raquo; Work Images', 'admin_mywords');
    RMTemplate::get()->add_style('admin.css', 'works');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar pw_message='" . __('Do you really want to delete selected images?', 'works') . "';\n\n        var pw_select_message = '" . __('You must select an image before to execute this action!', 'works') . "';</script>");
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/pw_images.php", 'module', 'works');
    xoops_cp_footer();
}
Ejemplo n.º 12
0
/**
* Show the list of existing products with options to mage them
*/
function shop_show_products()
{
    global $xoopsModuleConfig, $xoopsConfig, $xoopsSecurity;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $limit = 15;
    $bname = rmc_server_var($_REQUEST, 'bname', '');
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('shop_products');
    if ($bname != '') {
        $sql .= " WHERE name LIKE '%{$bname}%'";
    }
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('products.php?page={PAGE_NUM}&amp;bname=' . $bname);
    $sql = str_replace("COUNT(*)", '*', $sql);
    $sql .= " ORDER BY id_product DESC LIMIT {$start}, {$limit}";
    $result = $db->query($sql);
    $products = array();
    //Container
    $tf = new RMTimeFormatter('', '%M%/%d%/%Y% - %h%:%i%');
    while ($row = $db->fetchArray($result)) {
        $product = new ShopProduct();
        $product->assignVars($row);
        $products[] = array('id' => $product->id(), 'name' => $product->getVar('name'), 'image' => $product->getVar('image') != '' ? XOOPS_UPLOAD_URL . '/minishop/ths/' . $product->getVar('image') : '', 'price' => $product->getVar('price'), 'type' => $product->getVar('type') ? __('Digital', 'shop') : __('Normal', 'shop'), 'stock' => $product->getVar('available'), 'created' => $product->getVar('created') ? $tf->format($product->getVar('created')) : '', 'modified' => $product->getVar('modified') > 0 ? $tf->format($product->getVar('modified')) : '');
    }
    $products = RMEvents::get()->run_event("shop.list.products", $products, $start, $limit);
    RMTemplate::get()->add_style('admin.css', 'shop');
    RMTemplate::get()->add_local_script('admin.js', 'shop');
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    RMTemplate::get()->add_head('<script type="text/javascript">
    var shop_select_message = "' . __('Select at least one product in order to run this action!', 'shop') . '";
    var shop_message = "' . __('Do you really wish to delete selected products?', 'shop') . '";
    </script>');
    // Show GUI
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/shop_products.php', 'module', 'shop');
    xoops_cp_footer();
}
Ejemplo n.º 13
0
/**
* @desc Visualiza todos los usuarios existentes
**/
function showUsers()
{
    global $xoopsModule, $db, $tpl, $xoopsSecurity;
    $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
    $limit = 15;
    $search = rmc_server_var($_REQUEST, 'search', '');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_users');
    $sql1 = '';
    $search = trim($search);
    if ($search && strlen($search) > 2) {
        $sql1 .= $sql1 == '' ? " WHERE (uname LIKE '%{$search}%')" : " OR (uname LIKE '%{$search}%')";
    }
    list($num) = $db->fetchRow($db->query($sql . $sql1));
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $tpages = ceil($num / $limit);
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url("users.php?page={PAGE_NUM}&amp;search={$search}");
    $showmax = $start + $limit;
    $showmax = $showmax > $num ? $num : $showmax;
    //Fin de barra de navegación
    $sql = "SELECT * FROM " . $db->prefix('gs_users');
    $sql2 = " LIMIT {$start},{$limit}";
    $result = $db->query($sql . $sql1 . $sql2);
    while ($rows = $db->fetchArray($result)) {
        $uname = eregi_replace("({$search})", "<span class='searchResalte'>\\1</span>", $rows['uname']);
        $user = new GSUser();
        $user->assignVars($rows);
        $users[] = array('id' => $user->id(), 'uid' => $user->uid(), 'uname' => $uname, 'quota' => RMUtilities::formatBytesSize($user->quota()), 'blocked' => $user->blocked(), 'used' => GSFunctions::makeQuota($user), 'pics' => $user->pics(), 'sets' => $user->sets(), 'date' => formatTimeStamp($user->date(), 'custom'), 'url' => $user->userUrl());
    }
    GSFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Users management', 'galleries'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Users management', 'galleries'));
    RMTemplate::get()->add_script('../include/js/gsscripts.php?file=sets&form=frm-users');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar delete_warning='" . __('Do you really wish to delete selected users?', 'galleries') . "';\n</script>");
    xoops_cp_header();
    include RMTemplate::get()->get_template("admin/gs_users.php", 'module', 'galleries');
    xoops_cp_footer();
}
Ejemplo n.º 14
0
/**
* @desc Muestra todas las publicaciones existentes
**/
function show_resources()
{
    global $xoopsModule, $xoopsConfig, $xoopsSecurity;
    $query = rmc_server_var($_REQUEST, 'query', '');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Navegador de páginas
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('rd_resources');
    if ($query) {
        $sql .= " WHERE title LIKE '%query%'";
    }
    list($num) = $db->fetchRow($db->queryF($sql));
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $limit = 15;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('resources.php?page={PAGE_NUM}');
    //Fin navegador de páginas
    $sql = "SELECT * FROM " . $db->prefix('rd_resources') . ($query != '' ? " WHERE title LIKE '%{$query}%'" : '') . " ORDER BY `created` DESC LIMIT {$start},{$limit}";
    $result = $db->queryF($sql);
    $resources = array();
    while ($rows = $db->fetchArray($result)) {
        $res = new RDResource();
        $res->assignVars($rows);
        $resources[] = array('id' => $res->id(), 'title' => $res->getVar('title'), 'created' => formatTimestamp($res->getVar('created'), 'm'), 'public' => $res->getVar('public'), 'quick' => $res->getVar('quick'), 'approvededit' => $res->getVar('editor_approve'), 'featured' => $res->getVar('featured'), 'approved' => $res->getVar('approved'), 'owname' => $res->getVar('owname'), 'owner' => $res->getVar('owner'), 'description' => $res->getVar('description'), 'sections' => $res->sections_count(), 'notes' => $res->notes_count(), 'figures' => $res->figures_count());
    }
    RMTemplate::get()->add_style('admin.css', 'docs');
    RMTemplate::get()->assign('xoops_pagetitle', __('Documents', 'docs'));
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/docs/include/js/admin.js');
    RMTemplate::get()->add_head('<script type="text/javascript">
    var rd_message = "' . __('Do you really wish to delete selected Documents?', 'docs') . '";
    var rd_select_message = "' . __('You must select an element before to do this action!', 'docs') . '";
    </script>');
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('Documents', 'docs'));
    RDFunctions::toolbar();
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/rd_resources.php', 'module', 'docs');
    xoops_cp_footer();
}
Ejemplo n.º 15
0
function m_show_championships()
{
    global $xoopsModule, $xoopsSecurity;
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $page = $page <= 0 ? 1 : $page;
    $limit = 15;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('mch_champs');
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('champ.php?page={PAGE_NUM}');
    $champs = array();
    $sql = str_replace('COUNT(*)', '*', $sql);
    $sql .= ' ORDER BY start DESC,name ASC';
    $result = $db->query($sql);
    $timef = new RMTimeFormatter('', "%M% %d%, %Y%");
    while ($row = $db->fetchArray($result)) {
        $champ = new MCHChampionship();
        $champ->assignVars($row);
        $champs[] = array('id' => $champ->id(), 'link' => $champ->permalink(), 'name' => $champ->getVar('name'), 'nameid' => $champ->getVar('nameid'), 'start' => $timef->format($champ->getVar('start')), 'end' => $timef->format($champ->getVar('end')), 'description' => $champ->getVar('description'), 'current' => $champ->getVar('current'));
    }
    $form = new RMForm('', '', '');
    $editor = new RMFormEditor('', 'description', '98%', '200px', '', 'html');
    $start = new RMFormDate('', 'start', time());
    $end = new RMFormDate('', 'end', time());
    MCHFunctions::toolbar();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; " . __('Championships', 'match'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Championships', 'match'));
    RMTemplate::get()->add_style('admin.css', 'match');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_local_script('admin_match.js', 'match');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar mch_message='" . __('Do you really want to delete selected championships?', 'match') . "';\n\n        var mch_select_message = '" . __('You must select some championships before to execute this action!', 'match') . "';</script>");
    xoops_cp_header();
    $match_extra_options = RMEvents::get()->run_event('match.more.options');
    include RMTemplate::get()->get_template("admin/mch_champs.php", 'module', 'match');
    xoops_cp_footer();
}
Ejemplo n.º 16
0
function show_mw_trackbacks()
{
    global $xoopsModule, $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("mw_trackbacks");
    if ($id > 0) {
        $sql .= "WHERE post={$id}";
    }
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = isset($limit) && $limit > 0 ? $limit : 15;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('trackbacks.php?page={PAGE_NUM}' . ($id > 0 ? '&amp;id=' . $id : ''));
    $sql = str_replace("COUNT(*)", '*', $sql);
    $sql .= " ORDER BY `date` LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $posts = array();
    // posts cache
    $trackbacks = array();
    // Get trackbacks data
    while ($row = $db->fetchArray($result)) {
        $trac = new MWTrackbackObject();
        $trac->assignVars($row);
        $posts[$trac->getVar('post')] = isset($posts[$trac->getVar('post')]) ? $posts[$trac->getVar('post')] : new MWPost($trac->getVar('post'));
        $trackbacks[] = array('tb' => $trac, 'post' => array('title' => $posts[$trac->getVar('post')]->getVar('title'), 'link' => $posts[$trac->getVar('post')]->isNew() ? '' : $posts[$trac->getVar('post')]->permalink()));
    }
    // Event
    $trackbacks = RMEvents::get()->run_event("mywords.trackbacks.list", $trackbacks);
    MWFunctions::include_required_files();
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_script(XOOPS_URL . '/modules/mywords/include/js/scripts.php?file=trackbacks.js');
    xoops_cp_header();
    xoops_cp_location('<a href="' . XOOPS_URL . '/modules/mywords/admin/">' . $xoopsModule->getVar('name') . '</a> &raquo; ' . __('Trackbacks', 'mywords'));
    include RMTemplate::get()->get_template('admin/mywords_trackbacks.php', 'module', 'mywords');
    xoops_cp_footer();
}
Ejemplo n.º 17
0
/**
* Show all existing tags
*/
function show_tags()
{
    global $xoopsModule, $xoopsSecurity;
    MWFunctions::include_required_files();
    RMTemplate::get()->assign('xoops_pagetitle', __('Tags Management', 'mywords'));
    // More used tags
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("mod_mywords_tags") . " ORDER BY posts DESC LIMIT 0,30";
    $result = $db->query($sql);
    $mtags = array();
    $size = 0;
    while ($row = $db->fetchArray($result)) {
        $mtags[$row['tag']] = $row;
        $size = $row['posts'] > $size ? $row['posts'] : $size;
    }
    ksort($mtags);
    // All tags
    list($num) = $db->fetchRow($db->query("SELECT COUNT(*) FROM " . $db->prefix("mod_mywords_tags")));
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = isset($limit) && $limit > 0 ? $limit : 15;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('tags.php?page={PAGE_NUM}');
    $sql = "SELECT * FROM " . $db->prefix("mod_mywords_tags") . " ORDER BY id_tag DESC LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $tags = array();
    while ($row = $db->fetchArray($result)) {
        $tags[] = $row;
    }
    RMBreadCrumb::get()->add_crumb(__('Tags management', 'mywords'));
    xoops_cp_header();
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    RMTemplate::get()->add_script('..//include/js/scripts.php?file=tags-list.js');
    RMTemplate::get()->add_style('jquery.css', 'rmcommon');
    include RMTemplate::get()->get_template('admin/mywords-tags.php', 'module', 'mywords');
    xoops_cp_footer();
}
Ejemplo n.º 18
0
/**
 * Shows existing groups
 */
function show_groups_list()
{
    global $xoopsDB;
    define('RMCSUBLOCATION', 'allgroups');
    list($total) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("groups_users_link")));
    $navigation = new RMPageNav($total, 20, RMHttpRequest::get('page', 'integer', 1));
    $navigation->target_url(RMCURL . '/users.php?action=groups&amp;page={PAGE_NUM}');
    $sql = "SELECT g.*, (SELECT COUNT(*) FROM " . $xoopsDB->prefix("groups_users_link") . "\n            WHERE groupid = g.groupid) as total_users FROM " . $xoopsDB->prefix("groups") . " as g ORDER BY g.name\n            LIMIT " . $navigation->start() . ", 20";
    $result = $xoopsDB->query($sql);
    $groups = array();
    while ($row = $xoopsDB->fetchArray($result)) {
        $groups[] = (object) $row;
    }
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Users Management', 'rmcommon'), RMCURL . '/users.php');
    $bc->add_crumb(__('Groups', 'rmcommon'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Groups Management', 'rmcommon'));
    RMFunctions::get()->create_toolbar();
    RMTemplate::get()->add_script('cu-groups.js', 'rmcommon', array('footer' => 1));
    include RMCPATH . '/js/cu-js-language.php';
    RMTemplate::get()->header();
    include RMTemplate::get()->get_template('rmc-groups.php', 'module', 'rmcommon');
    RMTemplate::get()->footer();
}
Ejemplo n.º 19
0
/**
* @desc Visualiza todas las postales existentes
**/
function showPostCards()
{
    global $xoopsModule, $tpl, $xoopsModuleConfig, $xoopsSecurity;
    $mc =& $xoopsModuleConfig;
    $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1;
    $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 15;
    $limit = $limit <= 0 ? 15 : $limit;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_postcards');
    list($num) = $db->fetchRow($db->query($sql));
    list($num) = $db->fetchRow($db->query($sql));
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $tpages = ceil($num / $limit);
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url("postcards.php?page={PAGE_NUM}&limit={$limit}");
    //Fin de barra de navegación
    $sql = "SELECT * FROM " . $db->prefix('gs_postcards');
    $sql .= " LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $posts = array();
    $tf = new RMTimeFormatter(0, __('%M% %d%, %Y% - %h%:%i%:%s%', 'galleries'));
    while ($rows = $db->fetchArray($result)) {
        $post = new GSPostcard();
        $post->assignVars($rows);
        $link = GSFunctions::get_url() . ($mc['urlmode'] ? 'postcard/view/id/' . $post->code() . '/' : '?postcard=view&amp;id=' . $post->code());
        $posts[] = array('id' => $post->id(), 'title' => $post->title(), 'date' => $tf->format($post->date()), 'toname' => $post->toName(), 'name' => $post->email(), 'view' => $post->viewed(), 'link' => $link);
    }
    GSFunctions::toolbar();
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . __('E-cards', 'galleries'));
    xoops_cp_header();
    RMTemplate::get()->add_local_script('gsscripts.php?file=sets&form=frm-postcards&', 'galleries');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar delete_warning='" . __('Do you really wish to delete selected e-cards?', 'galleries') . "';\n</script>");
    include RMTemplate::get()->get_template('admin/gs_postcards.php', 'module', 'galleries');
    xoops_cp_footer();
}
Ejemplo n.º 20
0
/**
* @desc Visualiza todos los clientes
**/
function showClients()
{
    global $xoopsModule, $xoopsSecurity;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('pw_clients');
    list($num) = $db->fetchRow($db->query($sql));
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = 15;
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('clients.php?page={PAGE_NUM}');
    $sql = "SELECT * FROM " . $db->prefix('pw_clients') . " ORDER BY id_client";
    $sql .= " LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $customers = array();
    while ($rows = $db->fetchArray($result)) {
        $client = new PWClient();
        $client->assignVars($rows);
        $type = new PWType($client->type());
        $customers[] = array('id' => $client->id(), 'name' => $client->name(), 'business' => $client->businessName(), 'type' => $type->type(), 'description' => $client->desc());
    }
    // Event
    $customers = RMEvents::get()->run_event('works.list.customers', $customers);
    PWFunctions::toolbar();
    RMTemplate::get()->add_style('admin.css', 'works');
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; " . __('Customers', 'works'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Customers', 'works'));
    RMTemplate::get()->add_script('../include/js/admin_works.js');
    RMTemplate::get()->add_head("<script type='text/javascript'>\nvar pw_message='" . __('Do you really want to delete selected customers?', 'works') . "';\n\n        var pw_select_message = '" . __('You must select some customer before to execute this action!', 'works') . "';</script>");
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/pw_clients.php', 'module', 'works');
    xoops_cp_footer();
}
Ejemplo n.º 21
0
function rmc_available_mods()
{
    global $available_mods, $xoopsSecurity;
    $ret['title'] = __('Available Modules', 'rmcommon');
    $ret['icon'] = RMCURL . '/images/modules.png';
    $limit = 10;
    $tpages = ceil(count($available_mods) / $limit);
    $nav = new RMPageNav(count($available_mods), $limit, 1, 3);
    $nav->target_url('javascript:;" onclick="load_page({PAGE_NUM});');
    ob_start();
    $i = 0;
    ?>
	<div class="rmc_widget_content_reduced rmc_modules_widget">
        <img id="img-load" src="images/loading.gif" style="display: none; margin: 15px auto;" />
        <div id="mods-widget-container">
		<?php 
    foreach ($available_mods as $mod) {
        ?>
        <?php 
        if ($i == $limit) {
            break;
        }
        ?>
		<div class="<?php 
        echo tpl_cycle("even,odd");
        ?>
">
			<a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
" class="rmc_mod_img" style="background: url(<?php 
        echo XOOPS_URL;
        ?>
/modules/<?php 
        echo $mod->getInfo('dirname');
        ?>
/<?php 
        echo $mod->getInfo('image');
        ?>
) no-repeat center;"><span>&nbsp;</span></a>
			<strong><a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
"><?php 
        echo $mod->getInfo('name');
        ?>
</a></strong>
			<span class="rmc_available_options">
				<a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
"><?php 
        _e('Install', 'rmcommon');
        ?>
</a> |
				<a href="javascript:;" onclick="show_module_info('<?php 
        echo $mod->getInfo('dirname');
        ?>
');"><?php 
        _e('More info', 'rmcommon');
        ?>
</a>
			</span>
			<span class="rmc_mod_info" id="mod-<?php 
        echo $mod->getInfo('dirname');
        ?>
">
				<?php 
        _e('Version:', 'rmcommon');
        ?>
 
				<?php 
        if ($mod->getInfo('rmnative')) {
            ?>
					<?php 
            echo RMUtilities::format_version($mod->getInfo('rmversion'));
            ?>
				<?php 
        } else {
            ?>
					<?php 
            echo $mod->getInfo('version');
            ?>
				<?php 
        }
        ?>
<br />
				<?php 
        _e('Author:', 'rmcommon');
        ?>
 <?php 
        echo substr(strip_tags($mod->getInfo('author')), 0, 12);
        ?>
			</span>
		</div>
		<?php 
        $i++;
    }
    ?>
        <?php 
    $nav->display(false);
    ?>
        </div>
	</div>
    <input type="hidden" id="token" value="<?php 
    echo $xoopsSecurity->createToken();
    ?>
" />
<?php 
    $ret['content'] = ob_get_clean();
    return $ret;
    //print_r($available_mods);
}
Ejemplo n.º 22
0
 * Paginamos los resultados
 */
$limit = $mc['posts_limit'];
$table_tags = $db->prefix("mw_tagspost");
$table_posts = $db->prefix("mw_posts");
$sql = "SELECT COUNT(*) FROM {$table_posts} as a, {$table_tags} as b WHERE b.tag='" . $tag->id() . "' AND \n        a.id_post=b.post AND status='publish' AND \n\t\t((visibility='public' OR visibility='password') OR (visibility='private' AND\n\t\tauthor=" . ($xoopsUser ? $xoopsUser->uid() : -1) . "))";
list($num) = $db->fetchRow($db->query($sql));
if ($page > 0) {
    $page -= 1;
}
$start = $page * $mc['posts_limit'];
$tpages = (int) ($num / $mc['posts_limit']);
if ($num % $mc['posts_limit'] > 0) {
    $tpages++;
}
$pactual = $page + 1;
if ($pactual > $tpages) {
    $rest = $pactual - $tpages;
    $pactual = $pactual - $rest + 1;
    $start = ($pactual - 1) * $limit;
}
$nav = new RMPageNav($num, $limit, $pactual, 6);
$nav->target_url($tag->permalink() . ($mc['permalinks'] > 1 ? 'page/{PAGE_NUM}/' : '&page={PAGE_NUM}'));
$xoopsTpl->assign("nav_pages", $nav->render(false, 0));
$xoopsTpl->assign('pactual', $pactual);
$xoopsTpl->assign('lang_taggedtitle', sprintf(__('Posts tagged as "%s"', 'mywords'), $tag->getVar('tag')));
$sql = "SELECT a.* FROM {$table_posts} as a, {$table_tags} as b WHERE b.tag='" . $tag->id() . "' AND\n        a.id_post=b.post AND status='publish' AND \n\t\t((visibility='public' OR visibility='password') OR (visibility='private' AND\n\t\tauthor=" . ($xoopsUser ? $xoopsUser->uid() : -1) . ")) ORDER BY pubdate DESC LIMIT {$start},{$limit}";
$result = $db->query($sql);
require 'post_data.php';
$xoopsTpl->assign('xoops_pagetitle', sprintf(__('Posts tagged as "%s"', 'mywords'), $tag->getVar('tag')));
include 'footer.php';
Ejemplo n.º 23
0
$xoopsTpl->assign('shownav', $xoopsModuleConfig['shownav']);
if ($xoopsUser && ($xoopsUser->isAdmin() || $editor->getVar('uid') == $xoopsUser->uid())) {
    $edit = '<a href="' . XOOPS_URL . '/modules/mywords/admin/posts.php?op=edit&amp;id=' . $post->id() . '">' . __('Edit Post', 'mywords') . '</a>';
    $xoopsTpl->assign('edit_link', $edit);
    unset($edit);
}
$xoopsTpl->assign('lang_reads', sprintf(__('%u views', 'mywords'), $post->getVar('reads')));
// Tags
$tags = $post->tags(true);
$tags_list = '';
foreach ($tags as $i => $tag) {
    $tags_list .= ($tags_list == '' ? '' : ', ') . '<a href="' . $tag->permalink() . '">' . $tag->getVar('tag') . '</a>';
}
// 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_categories_names(), 'tags' => $tags_list, 'trackback' => $post->getVar('pingstatus') ? MWFunctions::get_url(true) . $post->id() : '', 'meta' => $post->get_meta('', false), 'time' => $post->getVar('pubdate'), 'image' => $post->getImage($xoopsModuleConfig['post_imgs_size']), 'author' => $editor->getVar('name'), 'alink' => $editor->permalink());
// Plugins?
$post_arr = RMEvents::get()->run_event('mywords.view.post', $post_arr, $post);
$xoopsTpl->assign('post', $post_arr);
// Social sites
if ($xoopsModuleConfig['showbookmarks']) {
    foreach ($socials as $site) {
        $xoopsTpl->append('socials', array('title' => $site->getVar('title'), 'icon' => $site->getVar('icon'), 'url' => $site->link($post->getVar('title'), $post->permalink(), TextCleaner::truncate($post->content(true), 60)), 'alt' => $site->getVar('alt')));
    }
}
unset($tags_list);
// Comments
Ejemplo n.º 24
0
// Check if there are posts for this date
if ($num <= 0) {
    redirect_header(MWFunctions::get_url(), 1, __("There are not posts published on this date", 'mywords'));
    die;
}
$page = rmc_server_var($_GET, '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];
        }
    }
}
$limit = $xoopsModuleConfig['posts_limit'];
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$p = $page > 0 ? $page - 1 : $page;
$start = $num <= 0 ? 0 : $p * $limit;
$nav = new RMPageNav($num, $limit, $page, 5);
$date_prefix = date("d/m/Y", $time);
$nav->target_url(MW_URL . ($mc['permalinks'] > 1 ? $date_prefix . '/page/{PAGE_NUM}/' : '?date=' . $date_prefix . '&amp;page={PAGE_NUM}'));
$xoopsTpl->assign('pagenav', $nav->render(false));
$sql = "SELECT * FROM " . $db->prefix("mw_posts") . " WHERE pubdate BETWEEN {$time} and {$time2} AND ((visibility='public' OR visibility='password') OR (visibility='private' AND author=" . ($xoopsUser ? $xoopsUser->uid() : -1) . ")) ORDER BY pubdate DESC LIMIT {$start},{$limit}";
$result = $db->query($sql);
include 'post_data.php';
$xoopsTpl->assign('xoops_pagetitle', sprintf(__('Posts published on %s', 'mywords'), formatTimestamp($time, 's')));
include 'footer.php';
Ejemplo n.º 25
0
}
include 'header.php';
$lic = new DTLicense($lic);
// Descargas en esta etiqueta
$sql = "SELECT COUNT(*) FROM " . $db->prefix('dtrans_licsoft') . " AS a INNER JOIN " . $db->prefix('dtrans_software') . " b ON (a.id_lic=" . $lic->id() . " AND a.id_soft=b.id_soft) WHERE b.approved='1' ANd b.delete=0";
list($num) = $db->fetchRow($db->query($sql));
$limit = $mc['xpage'];
$limit = $limit <= 0 ? 10 : $limit;
$tpages = ceil($num / $limit);
if ($tpages < $page && $tpages > 0) {
    header('location: ' . DT_URL . ($mc['permalinks'] ? '/license/' . $lic->nameId() : '/?p=license&lic=' . $lic->id()));
    die;
}
$p = $page > 0 ? $page - 1 : $page;
$start = $num <= 0 ? 0 : $p * $limit;
$nav = new RMPageNav($num, $limit, $page);
$nav->target_url(DT_URL . ($mc['permalinks'] ? '/license/' . $lic->nameId() . '/page/{PAGE_NUM}/' : '/?p=license&amp;lic=' . $lic->id() . '&amp;page={PAGE_NUM}'));
$xoopsTpl->assign('pagenav', $nav->render(true));
// Seleccionamos los registros
$sql = str_replace('COUNT(*)', 'b.*', $sql);
$sql .= " ORDER BY created DESC";
$sql .= " LIMIT {$start}, {$limit}";
$result = $db->query($sql);
while ($row = $db->fetchArray($result)) {
    $item = new DTSoftware();
    $item->assignVars($row);
    $xoopsTpl->append('download_items', $dtfunc->createItemData($item));
}
// Datos de la etiqueta
$xoopsTpl->assign('license', array('id' => $lic->id(), 'name' => $lic->name(), 'link' => $lic->permalink()));
$tpl->add_xoops_style('main.css', 'dtransport');
Ejemplo n.º 26
0
/**
* @desc Mostramos el contenido de un Álbum
*/
function showSetContent()
{
    global $usr, $db, $xoopsModule, $mc, $xoopsModuleConfig, $xoopsConfig, $xoopsUser, $xoopsOption, $tpl, $page;
    global $pag, $set;
    $mc =& $xoopsModuleConfig;
    $user = new GSUser($usr);
    if ($user->isNew()) {
        redirect_header(GSFunctions::get_url(), 0, __('Specified users does not exists!', 'galleries'));
        die;
    }
    $set = new GSSet($set);
    if ($set->isNew()) {
        redirect_header(GSFunctions::get_url(), 0, __('Specified album does not exists!', 'galleries'));
        die;
    }
    //Verificamos la privacidad del album
    if (!$set->ispublic()) {
        if (!$xoopsUser || $xoopsUser->uid() != $set->owner()) {
            redirect_header(GSFunctions::get_url(), 1, __('You can not view this private album!', 'galleries'));
            die;
        }
    } else {
        if (!$xoopsUser && $set->isPublic() == 1 && !$user->isFriend($xoopsUser->uid())) {
            redirect_header(GSFunctions::get_url(), 1, sprintf(__('You must be a friend of %s in order to see this album!', 'galleries'), $user->uname()));
            die;
        }
    }
    //Incrementamos el número de hits del album
    if (!isset($_SESSION['vsets'])) {
        $set->addHit();
        $_SESSION['vsets'] = array($set->id());
    } elseif (!in_array($set->id(), $_SESSION['vsets'])) {
        $set->addHit();
        $_SESSION['vsets'][] = $set->id();
    }
    $xoopsOption['template_main'] = $mc['set_format_mode'] ? 'gs_setpics.html' : 'gs_userpics.html';
    $xoopsOption['module_subpage'] = 'userset';
    include 'header.php';
    GSFunctions::makeHeader();
    // Información del Usuario
    $tpl->assign('lang_picsof', sprintf(__('Pictures in %s'), $set->title()));
    $tpl->assign('user', array('id' => $user->uid(), 'uname' => $user->uname(), 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $user->userVar('email'), 0, $user->userVar('user_avatar')), 'link' => $user->userURL()));
    $tpl->assign('set', array('title' => $set->title(), 'description' => $set->getVar('description', 's')));
    // Lenguaje
    $tpl->assign('lang_bmark', __('Favorites', 'galleries'));
    $tpl->assign('lang_pics', __('Pictures', 'galleries'));
    $tpl->assign('sets_link', GSFunctions::get_url() . ($mc['urlmode'] ? "explore/sets/usr/" . $user->uname() . '/' : "?explore=sets&amp;usr="******"explore/tags/usr/" . $user->uname() . '/' : "?explore=tags&amp;usr="******"cp/bookmarks/" : "?cp=bookmarks"));
    $tpl->assign('xoops_pagetitle', sprintf(__('Pictures in %s'), $set->title()) . ' &raquo; ' . $mc['section_title']);
    $tpl->assign('lang_numpics', sprintf(__('Pictures: %s', 'galleries'), $set->pics()));
    $tpl->assign('lang_numviews', sprintf(__('Hits: %s'), $set->hits()));
    global $xoTheme;
    if ($set->getVar('description') != '') {
        $xoTheme->addMeta('meta', 'description', TextCleaner::clean_disabled_tags($set->getVar('description')));
    }
    //Verificamos la privacidad de las imágenes
    if ($xoopsUser && $xoopsUser->uid() == $user->uid()) {
        $public = '';
    } else {
        if ($xoopsUser && $user->isFriend($xoopsUser->uid())) {
            $public = " AND public<>0";
        } else {
            $public = "AND public='2'";
        }
    }
    $tbl1 = $db->prefix("gs_images");
    $tbl2 = $db->prefix("gs_setsimages");
    $sql = "SELECT COUNT(*) FROM {$tbl1} a, {$tbl2} b WHERE b.id_set='" . $set->id() . "' AND a.id_image=b.id_image {$public} AND owner='" . $user->uid() . "'";
    $page = $page > 0 ? $page : 1;
    /**
     * @desc Formato para el manejo de las imágenes
     */
    if ($mc['set_format_mode']) {
        $format = $mc['set_format_values'];
        $crop = $format[0];
        // 0 = Redimensionar, 1 = Cortar
        $width = $format[1];
        $height = $format[2];
        $limit = $format[3];
        $cols = $format[4];
        @($showdesc = $format[5]);
        // Imágenes Grandes
        $format = $mc['setbig_format_values'];
        $bcrop = $format[0];
        $bwidth = $format[1];
        $bheight = $format[2];
        $blimit = $format[3];
        $bcols = $format[4];
        @($bshowdesc = $format[5]);
        // Medidas
        $tpl->assign('big_width', $bwidth + 15);
    } else {
        $limit = $mc['limit_pics'];
        $cols = $mc['cols_pics'];
        $showdesc = 0;
    }
    list($num) = $db->fetchRow($db->query($sql));
    if ($page > 0) {
        $page -= 1;
    }
    $start = $page * $limit;
    $tpages = (int) ($num / $limit);
    if ($num % $limit > 0) {
        $tpages++;
    }
    $pactual = $page + 1;
    if ($pactual > $tpages) {
        $pactual = $tpages;
        $start = ($tpages - 1) * $limit;
    }
    $urlnav = '';
    if ($tpages > 1) {
        $urlnav .= $mc['urlmode'] ? 'usr/' . $user->uname() . '/set/' . $set->id() : '?usr='******'&amp;set=' . $set->id();
        $nav = new RMPageNav($num, $limit, $pactual, 5);
        $nav->target_url(GSFunctions::get_url() . $urlnav . ($mc['urlmode'] ? '/pag/{PAGE_NUM}/' : '&amp;pag={PAGE_NUM}'));
        $tpl->assign('upNavPage', $nav->render(false));
    }
    $showmax = $start + $limit;
    $showmax = $showmax > $num ? $num : $showmax;
    $tpl->assign('lang_showing', sprintf(__('Showing pictures %u to %u out of %u.', 'galleries'), $start + 1, $showmax, $num));
    $tpl->assign('limit', $limit);
    $tpl->assign('pag', $pactual);
    //Fin de barra de navegación
    $sql = str_replace("COUNT(*)", '*', $sql);
    $sql .= " ORDER BY a.id_image ASC, a.modified DESC LIMIT {$start}, {$limit}";
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $img = new GSImage();
        $img->assignVars($row);
        $imglink = $user->userURL() . ($mc['urlmode'] ? 'img/' . $img->id() . '/set/' . $set->id() . '/' : '&amp;img=' . $img->id() . '&amp;set=' . $set->id());
        $imgfile = $user->filesURL() . '/' . ($mc['set_format_mode'] ? 'formats/set_' : 'ths/') . $img->image();
        // Conversion de los formatos
        if (!$img->setFormat() && $mc['set_format_mode']) {
            GSFunctions::resizeImage($crop, $user->filesPath() . '/' . $img->image(), $user->filesPath() . '/formats/set_' . $img->image(), $width, $height);
            $img->setSetFormat(1, 1);
        }
        $tpl->append('images', array('id' => $img->id(), 'title' => $img->title(), 'thumbnail' => $imgfile, 'link' => $imglink, 'bigimage' => $user->filesURL() . '/' . $img->image()));
    }
    // Imagen grande del album
    $sql = "SELECT * FROM {$tbl1} a, {$tbl2} b WHERE b.id_set='" . $set->id() . "' AND a.id_image=b.id_image {$public} AND owner='" . $user->uid() . "' \n\t\t\tORDER BY a.id_image DESC LIMIT 0,{$blimit}";
    $result = $db->query($sql);
    $bi = 0;
    $tf = new RMTimeFormatter(0, __('%m%/%d%/%Y% %h%:%i%', 'galleries'));
    // cremos la imagen grande para los albumes
    while ($row = $db->fetchArray($result)) {
        $img = new GSImage();
        $img->assignVars($row);
        if ($mc['set_format_mode'] && !$img->bigSetFormat()) {
            GSFunctions::resizeImage($bcrop, $user->filesPath() . '/' . $img->image(), $user->filesPath() . '/formats/bigset_' . $img->image(), $bwidth, $bheight);
            $img->setBigSetFormat(1, 1);
        }
        if ($mc['set_format_mode']) {
            list($ancho, $altura, $tipo, $atr) = getimagesize($user->filesPath() . '/formats/bigset_' . $img->image());
            $tpl->assign('big_width', $ancho);
        }
        $imglink = $user->userURL() . 'img/' . $img->id() . '/set/' . $set->id() . '/';
        // ASignamos las imagenes grandes para los albumes
        $imgfile = $user->filesURL() . '/' . ($mc['set_format_mode'] ? 'formats/bigset_' : 'ths/') . $img->image();
        if ($bi == 0) {
            $tpl->assign('lang_updated', sprintf(__('Updated on %s', 'galleries'), $tf->format($img->created())));
        }
        $tpl->append('bigs', array('id' => $img->id(), 'title' => $img->title(), 'image' => $imgfile, 'link' => $imglink));
    }
    RMFunctions::get_comments('galleries', 'set=' . $set->id());
    // Comments form
    RMFunctions::comments_form('galleries', 'set=' . $set->id(), 'module', GS_PATH . '/class/galleriescontroller.php');
    // Datos para el formato
    $tpl->assign('max_cols', $cols);
    include 'footer.php';
}
Ejemplo n.º 27
0
function load_modules_page()
{
    global $xoopsLogger, $xoopsSecurity;
    error_reporting(0);
    $xoopsLogger->activated = false;
    if (!$xoopsSecurity->check(true, rmc_server_var($_POST, 'token', ''))) {
        echo __("Sorry, you don't have access to this page", 'rmcommon');
        echo "<br /><a href='javascript:;' onclick='location.reload();'>" . __('Click here to refresh', 'rmcommon') . "</a>";
        die;
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("modules") . " ORDER BY `name`";
    $result = $db->query($sql);
    $installed_dirs = array();
    while ($row = $db->fetchArray($result)) {
        $installed_dirs[] = $row['dirname'];
    }
    require_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
    $dirlist = XoopsLists::getModulesList();
    $available_mods = array();
    $module_handler = xoops_gethandler('module');
    foreach ($dirlist as $file) {
        clearstatcache();
        $file = trim($file);
        if (!in_array($file, $installed_dirs)) {
            $module =& $module_handler->create();
            if (!$module->loadInfo($file, false)) {
                continue;
            }
            $available_mods[] = $module;
            unset($module);
        }
    }
    unset($dirlist);
    unset($module_handler);
    $limit = 10;
    $tpages = ceil(count($available_mods) / $limit);
    $page = rmc_server_var($_POST, 'page', 1);
    if ($page > $tpages) {
        $page = 1;
    }
    $start = ($page <= 0 ? 0 : $page - 1) * $limit;
    $nav = new RMPageNav(count($available_mods), $limit, $page, 3);
    $nav->target_url('javascript:;" onclick="load_page({PAGE_NUM});');
    // Event for available modules
    $available_mods = RMEvents::get()->run_event('rmcommon.available.modules', $available_mods);
    $end = $page * $limit;
    if ($end > count($available_mods)) {
        $end = count($available_mods);
    }
    ob_start();
    ?>
    <div class="rmc_widget_content_reduced rmc_modules_widget">
        <img id="img-load" src="images/loading.gif" style="display: none; margin: 15px auto;" />
        <div id="mods-widget-container">
        <?php 
    for ($i = $start; $i < $end; $i++) {
        ?>
        <?php 
        $mod = $available_mods[$i];
        ?>
        <div class="<?php 
        echo tpl_cycle("even,odd");
        ?>
">
            <a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
" class="rmc_mod_img" style="background: url(<?php 
        echo XOOPS_URL;
        ?>
/modules/<?php 
        echo $mod->getInfo('dirname');
        ?>
/<?php 
        echo $mod->getInfo('image');
        ?>
) no-repeat center;"><span>&nbsp;</span></a>
            <strong><a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
"><?php 
        echo $mod->getInfo('name');
        ?>
</a></strong>
            <span class="rmc_available_options">
                <a href="modules.php?action=install&amp;dir=<?php 
        echo $mod->getInfo('dirname');
        ?>
"><?php 
        _e('Install', 'rmcommon');
        ?>
</a> |
                <a href="javascript:;" onclick="show_module_info('<?php 
        echo $mod->getInfo('dirname');
        ?>
');"><?php 
        _e('More info', 'rmcommon');
        ?>
</a>
            </span>
            <span class="rmc_mod_info" id="mod-<?php 
        echo $mod->getInfo('dirname');
        ?>
">
                <?php 
        _e('Version:', 'rmcommon');
        ?>
 
                <?php 
        if ($mod->getInfo('rmnative')) {
            ?>
                    <?php 
            echo RMUtilities::format_version($mod->getInfo('rmversion'));
            ?>
                <?php 
        } else {
            ?>
                    <?php 
            echo $mod->getInfo('version');
            ?>
                <?php 
        }
        ?>
<br />
                <?php 
        _e('Author:', 'rmcommon');
        ?>
 <?php 
        echo substr(strip_tags($mod->getInfo('author')), 0, 12);
        ?>
            </span>
        </div>
        <input type="hidden" id="token" value="<?php 
        echo $xoopsSecurity->createToken();
        ?>
" />
        <?php 
    }
    ?>
        <?php 
    $nav->display(false);
    ?>
        </div>
    </div>
<?php 
    $ret = ob_get_clean();
    echo $ret;
}
Ejemplo n.º 28
0
/**
* Shows the figures for a Document
*/
function rd_widget_figures()
{
    global $res, $rmc_config;
    $ret['title'] = __('Document Figures', 'docs');
    $count = 0;
    $figures = RDFunctions::figures($res->id(), &$count, '', 0, 6);
    $nav = new RMPageNav($count, 6, 1, 3);
    $nav->target_url('javascript:;" onclick="docsAjax.getFigures(' . $res->id() . ',6,{PAGE_NUM},\'rd-wd-figures\')');
    RMTemplate::get()->add_script('../include/js/scripts.php?file=ajax.js');
    ob_start();
    ?>
<div id="rd-wd-figures">
    <ul>
    <?php 
    if (count($figures) <= 0) {
        _e('There are not exists figures for this Document yet!', 'docs');
    }
    foreach ($figures as $fig) {
        ?>
        <li><a href="javascript:;" onclick="docsAjax.insertIntoEditor('[figure:<?php 
        echo $fig['id'];
        ?>
]','<?php 
        echo $rmc_config['editor_type'];
        ?>
');"><?php 
        echo $fig['title'];
        ?>
</a></li>
    <?php 
    }
    ?>
    </ul>
    <?php 
    $nav->display(false);
    ?>
</div>
<?php 
    $ret['content'] = ob_get_clean();
    return $ret;
}
Ejemplo n.º 29
0
/**
 * Muestra los envíos existentes
 */
function showPosts($aprovado = -1)
{
    global $db, $xoopsSecurity, $xoopsModule, $xoopsModuleConfig;
    $mc =& $xoopsModuleConfig;
    $keyw = '';
    $op = '';
    $cat = 0;
    $status = '';
    foreach ($_REQUEST as $k => $v) {
        ${$k} = $v;
    }
    $tbl1 = $db->prefix("mod_mywords_posts");
    $tbl2 = $db->prefix("mod_mywords_catpost");
    $and = false;
    if ($cat > 0) {
        $sql = "SELECT COUNT(*) FROM {$tbl1} a, {$tbl2} b WHERE b.cat='{$cat}' AND a.id_post=b.post";
        $and = true;
    } else {
        $sql = "SELECT COUNT(*) FROM " . $db->prefix("mod_mywords_posts");
    }
    if (isset($status) && $status != '') {
        define('RMCSUBLOCATION', $status);
        $sql .= $and ? " AND a.status='{$status}'" : " WHERE status='{$status}'";
        $and = true;
    }
    if (isset($author) && $author > 0) {
        $sql .= $and ? " AND a.author={$author}" : " WHERE author={$author}";
        $and = true;
    }
    if (trim($keyw) != '') {
        $sql .= $and ? " AND title LIKE '%{$keyw}%'" : " WHERE title LIKE '%{$keyw}%'";
    }
    /**
     * Paginacion de Resultados
     */
    $page = rmc_server_var($_GET, 'page', 1);
    $limit = isset($limit) && $limit > 0 ? $limit : 15;
    list($num) = $db->fetchRow($db->query($sql));
    $tpages = ceil($num / $limit);
    $page = $page > $tpages ? $tpages : $page;
    $start = $num <= 0 ? 0 : ($page - 1) * $limit;
    $nav = new RMPageNav($num, $limit, $page, 5);
    $nav->target_url('posts.php?limit=' . $limit . '&page={PAGE_NUM}');
    $sql .= " ORDER BY id_post DESC LIMIT {$start},{$limit}";
    $sql = str_replace("SELECT COUNT(*)", "SELECT *", $sql);
    $result = $db->query($sql);
    $posts = array();
    while ($row = $db->fetchArray($result)) {
        $post = new MWPost();
        $post->assignVars($row);
        # Enlace para el artículo
        $day = date('d', $post->getVar('pubdate'));
        $month = date('m', $post->getVar('pubdate'));
        $year = date('Y', $post->getVar('pubdate'));
        $postlink = MWFunctions::get_url();
        $postlink .= $mc['permalinks'] == 1 ? '?post=' . $post->id() : ($mc['permalinks'] == 2 ? "{$day}/{$month}/{$year}/" . $post->getVar('shortname') . "/" : "post/" . $post->id());
        $posts[] = array('id' => $post->id(), 'title' => $post->getVar('title'), 'date' => $post->getVar('pubdate') > 0 ? formatTimeStamp($post->getVar('pubdate')) : '<em>' . __('Not published', 'mywords') . '</em>', 'created' => formatTimeStamp($post->getVar('created')), 'comments' => $post->getVar('comments'), 'uid' => $post->getVar('author'), 'uname' => $post->getVar('authorname'), 'link' => $postlink, 'status' => $post->getVar('status'), 'categories' => $post->get_categories_names(true, ',', true, 'admin'), 'tags' => $post->tags(false), 'reads' => $post->getVar('reads'));
    }
    // Published count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("mod_mywords_posts") . " WHERE status='publish'";
    list($pub_count) = $db->fetchRow($db->query($sql));
    // Drafts count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("mod_mywords_posts") . " WHERE status='draft'";
    list($draft_count) = $db->fetchRow($db->query($sql));
    // Pending count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("mod_mywords_posts") . " WHERE status='pending'";
    list($pending_count) = $db->fetchRow($db->query($sql));
    // Confirm message
    RMTemplate::get()->add_head('<script type="text/javascript">
	 	function post_del_confirm(post, id){
	 		var string = "' . __('Do you really want to delete \\"%s\\"', 'mywords') . '";
	 		string = string.replace("%s", post);
	 		var ret = confirm(string);
	 		
	 		if (ret){
	 			$("#form-posts input[type=checkbox]").removeAttr("checked");
	 			$("#post-"+id).attr("checked","checked");
	 			$("#posts-op").val("delete");
	 			$("#form-posts").submit();
	 		}
	 	}
	 </script>');
    RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js');
    MWFunctions::include_required_files();
    $title_by_status = '';
    switch ($status) {
        case 'publish':
            $title_by_status = __('Published Posts', 'mywords');
            break;
        case 'draft':
            $title_by_status = __('Drafts', 'mywords');
            break;
        case 'waiting':
            $title_by_status = __('Pending of Review', 'dtransport');
            break;
    }
    if ($title_by_status != '') {
        RMBreadCrumb::get()->add_crumb(__('Posts management', 'mywords'), 'posts.php');
        RMBreadCrumb::get()->add_crumb($title_by_status);
        RMTemplate::get()->assign('xoops_pagetitle', sprintf(__('Posts Management: %s', 'mywords'), $title_by_status));
    } else {
        RMBreadCrumb::get()->add_crumb(__('Posts management', 'mywords'));
        RMTemplate::get()->assign('xoops_pagetitle', __('Posts Management', 'mywords'));
    }
    xoops_cp_header();
    include_once '../templates/admin/mywords-posts.php';
    xoops_cp_footer();
}
Ejemplo n.º 30
0
$limit = $mc['perpage'];
$limit = $limit <= 0 ? 15 : $limit;
$page = isset($page) ? $page : 0;
if ($page > 0) {
    $page -= 1;
}
$start = $page * $limit;
$tpages = ceil($num / $limit);
$pactual = $page + 1;
if ($pactual > $tpages) {
    $rest = $pactual - $tpages;
    $pactual = $pactual - $rest + 1;
    $start = ($pactual - 1) * $limit;
}
if ($tpages > 1) {
    $nav = new RMPageNav($num, $limit, $pactual);
    $nav->target_url('topic.php?id=' . $topic->id() . '&amp;pag={PAGE_NUM}');
    $tpl->assign('postsNavPage', $nav->render(false));
}
$groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
// Permisos
$edit = $forum->isAllowed($groups, 'edit');
$delete = $forum->isAllowed($groups, 'delete');
$report = $forum->isAllowed($groups, 'reply');
$moderator = $xoopsUser ? $forum->isModerator($xoopsUser->uid()) : false;
$admin = $xoopsUser ? $xoopsUser->isAdmin() : false;
$tbl1 = $db->prefix("mod_bxpress_posts");
$tbl2 = $db->prefix("mod_bxpress_posts_text");
$tbl3 = $db->prefix("mod_bxpress_likes");
$sql = "SELECT\n          posts.*,\n          texts.*,\n          (SELECT COUNT(*) FROM {$tbl1} WHERE parent=posts.id_post) as replies,\n          GROUP_CONCAT(tlikes.uid ORDER BY " . ($xoopsUser ? "tlikes.uid=" . $xoopsUser->uid() . ' DESC' : 'tlikes.uid') . ") as liked\n        FROM\n          {$tbl1} posts\n        LEFT JOIN {$tbl3} tlikes ON tlikes.post=posts.id_post\n        INNER JOIN {$tbl2} texts ON texts.post_id=posts.id_post\n        WHERE\n            posts.id_topic='" . $topic->id() . "'\n        AND\n            texts.post_id=posts.id_post\n        GROUP BY\n            posts.id_post\n        ORDER BY\n            posts.post_time ASC,\n            posts.parent ASC\n        LIMIT\n            {$start},{$limit}";
$result = $db->query($sql);