예제 #1
0
/**
* @desc Visualiza las caracteríticas existentes de un elemento especificado
**/
function dt_show_features()
{
    global $xoopsModule, $tpl, $functions;
    define('RMCSUBLOCATION', 'showfeatures');
    $item = rmc_server_var($_REQUEST, 'item', 0);
    $sw = new DTSoftware($item);
    if ($sw->isNew() && $item > 0) {
        redirectMsg('items.php', __('Specified download item does not exists!', 'dtransport'), RMMSG_WARN);
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix('dtrans_features') . " WHERE id_soft={$item}";
    $result = $db->query($sql);
    $features = array();
    $tf = new RMTimeFormatter(0, "%T%-%d%-%Y%  %h%:%i%");
    while ($rows = $db->fetchArray($result)) {
        $ft = new DTFeature();
        $ft->assignVars($rows);
        $features[] = array('id' => $ft->id(), 'title' => $ft->title(), 'created' => $tf->format($ft->created()), 'modified' => $tf->format($ft->modified()), 'software' => $sw->getVar('name'));
    }
    $functions->toolbar();
    $tpl->assign('xoops_pagetitle', sprintf(__('Features of "%s"', 'dtransport'), $sw->getVar('name')));
    // Styles
    $tpl->add_style('admin.css', 'dtransport');
    // scripts
    $tpl->add_local_script('admin.js', 'dtransport');
    $tpl->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='./items.php'>" . __('Downloads', 'dtransport') . "</a> &raquo; " . __('Features', 'dtransport'));
    xoops_cp_header();
    include $tpl->get_template('admin/dtrans_features.php', 'module', 'dtransport');
    xoops_cp_footer();
}
예제 #2
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();
}
예제 #3
0
/**
* @desc Visualiza todos los logs existentes para un determinado software
**/
function showLogs()
{
    global $tpl, $xoopsConfig, $xoopsModule, $functions, $xoopsSecurity;
    define('RMCSUBLOCATION', 'itemlogs');
    $item = isset($_REQUEST['item']) ? intval($_REQUEST['item']) : 0;
    $sw = new DTSoftware($item);
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $tc = TextCleaner::getInstance();
    $tf = new RMTimeFormatter(0, __('%m%-%d%-%Y%', 'dtransport'));
    $sql = "SELECT * FROM " . $db->prefix('dtrans_logs') . " WHERE id_soft={$item}";
    $result = $db->queryF($sql);
    while ($rows = $db->fetchArray($result)) {
        $log = new DTLog();
        $log->assignVars($rows);
        $logs[] = array('id' => $log->id(), 'title' => $log->title(), 'log' => $tc->truncate($tc->clean_disabled_tags($log->log()), 80), 'date' => $tf->format($log->date()));
    }
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; <a href='./items.php'>" . sprintf(_AS_DT_SW, $sw->getVar('name')) . "</a> &raquo; " . _AS_DT_LOGS);
    $functions->toolbar();
    $tpl->add_style('admin.css', 'dtransport');
    $tpl->add_local_script('admin.js', 'dtransport');
    $tpl->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    include DT_PATH . '/include/js_strings.php';
    xoops_cp_header();
    include $tpl->get_template('admin/dtrans_logs.php', 'module', 'dtransport');
    xoops_cp_footer();
}
예제 #4
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();
}
예제 #5
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();
}
예제 #6
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();
}
예제 #7
0
function bxpress_recents_show($options)
{
    $util = RMUtilities::get();
    $tc = TextCleaner::getInstance();
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $xoopsModuleConfig = $util->module_config('exmbb');
    $mc = RMUtilities::module_config('bxpress');
    $tbl1 = $db->prefix('bxpress_posts');
    $tbl2 = $db->prefix('bxpress_topics');
    $tbl3 = $db->prefix('bxpress_posts_text');
    $tbl4 = $db->prefix('bxpress_forums');
    $sql = "SELECT MAX(id_post) AS id FROM {$tbl1} WHERE approved=1 GROUP BY id_topic ORDER BY MAX(id_post) DESC LIMIT 0,{$options['0']}";
    $result = $db->queryF($sql);
    $topics = array();
    $block = array();
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxpost.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxtopic.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php';
    $post = new bXPost();
    $forum = new bXForum();
    $tf = new RMTimeFormatter(0, '%T%-%d%-%Y% at %h%:%i%');
    while ($row = $db->fetchArray($result)) {
        $post = new bXPost($row['id']);
        $topic = new bXTopic($post->topic());
        $forum = new bXForum($post->forum());
        $ret = array();
        $ret['id'] = $topic->id();
        $ret['post'] = $post->id();
        $ret['link'] = $post->permalink();
        if ($options[2]) {
            $ret['date'] = $tf->format($post->date());
        }
        if ($options[3]) {
            $ret['poster'] = sprintf(__('Posted by: %s', 'bxpress'), "<a href='" . $post->permalink() . "'>" . $post->uname() . "</a>");
        }
        $ret['title'] = $topic->title();
        if ($options[4]) {
            $ret['text'] = $tc->clean_disabled_tags($post->text());
        }
        $ret['forum'] = array('id' => $forum->id(), 'name' => $forum->name(), 'link' => $forum->permalink());
        $topics[] = $ret;
    }
    // Opciones
    $block['showdates'] = $options[2];
    $block['showuname'] = $options[3];
    $block['showtext'] = $options[4];
    $block['topics'] = $topics;
    $block['lang_topic'] = __('Topic', 'bxpress');
    $block['lang_date'] = __('Date', 'bxpress');
    $block['lang_poster'] = __('Poster', 'bxpress');
    return $block;
}
예제 #8
0
/**
* Muestra las características existentes de una descarga
*/
function dt_show_logs($edit = 0)
{
    global $xoopsOption, $db, $tpl, $xoopsTpl, $xoopsUser, $mc, $dtfunc, $page, $item, $xoopsConfig, $xoopsModuleConfig, $log;
    include 'header.php';
    $dtfunc->cpHeader($item, sprintf(__('%s Logs', 'dtransport'), $item->getVar('name')));
    if ($log > 0 && $edit) {
        $log = new DTLog($log);
        if ($log->isNew() || $log->software() != $item->id()) {
            redirect_header(DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->id() . '/' : '/?p=cpanel&amp;action=logs&amp;id=' . $item->id()), 1, __('Specified log does not exists!', 'dtransport'));
        }
    }
    $tc = TextCleaner::getInstance();
    $tf = new RMTimeFormatter('', "%M% %d%, %Y%");
    $sql = "SELECT * FROM " . $db->prefix('dtrans_logs') . " WHERE id_soft=" . $item->id();
    $result = $db->queryF($sql);
    while ($rows = $db->fetchArray($result)) {
        $lg = new DTLog();
        $lg->assignVars($rows);
        $xoopsTpl->append('logs', array('id' => $lg->id(), 'title' => $lg->title(), 'date' => $tf->format($lg->date()), 'software' => $item->getVar('name'), 'links' => array('edit' => DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->getVar('nameid') . '/edit/' . $lg->id() . '/' : '/?p=cpanel&amp;id=' . $item->id() . '&amp;action=logs&amp;log=' . $lg->id()), 'delete' => DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->getVar('nameid') . '/delete/' . $lg->id() . '/' : '/?p=cpanel&amp;id=' . $item->id() . '&amp;action=delete&amp;log=' . $lg->id()))));
    }
    $formurl = DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->id() . '/save/' . ($edit ? $log->id() : '0') . '/' : '/p=cpanel');
    // logs Form
    $form = new RMForm($edit ? sprintf(__('Editing log of "%s"', 'dtransport'), $item->getVar('name')) : sprintf(__('New log for "%s"', 'dtransport'), $item->getVar('name')), 'frmLog', $formurl);
    $form->addElement(new RMFormLabel(__('Download item', 'dtransport'), $item->getVar('name')));
    $form->addElement(new RMFormText(__('Log title', 'dtransport'), 'title', 50, 200, $edit ? $log->title() : ''), true);
    $form->addElement(new RMFormEditor(__('Log content', 'dtransport'), 'content', 'auto', '350px', $edit ? $log->log('e') : ''), true);
    $form->addElement(new RMFormHidden('action', 'save'));
    $form->addElement(new RMFormHidden('id', $item->id()));
    $form->addElement(new RMFormHidden('log', $edit ? $log->id() : 0));
    $form->addElement(new RMFormHidden('op', 'save'));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', _SUBMIT, 'submit');
    $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="window.location=\'' . (DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->id() . '/' : '/?p=cpanel&amp;action=logs&amp;id=' . $item->id())) . '\';"');
    $form->addElement($buttons);
    $xoopsTpl->assign('log_form', $form->render());
    $tpl->add_xoops_style('cpanel.css', 'dtransport');
    $tpl->add_head_script('$(document).ready(function(){
        
        $("a.delete").click(function(){
            if(!confirm("' . __('Do you really want to delete selected log?', 'dtransport') . '")) return false;
        });
        
    });');
    $xoopsTpl->assign('lang_id', __('ID', 'dtransport'));
    $xoopsTpl->assign('lang_title', __('Title', 'dtransport'));
    $xoopsTpl->assign('lang_created', __('Date', 'dtransport'));
    $xoopsTpl->assign('lang_options', __('Options', 'dtransport'));
    $xoopsTpl->assign('lang_edit', __('Edit', 'dtransport'));
    $xoopsTpl->assign('lang_delete', __('Delete', 'dtransport'));
    $xoopsTpl->assign('lang_addlog', __('Add Log', 'dtransport'));
    $xoopsTpl->assign('edit', $edit);
    include 'footer.php';
}
예제 #9
0
function showReports()
{
    global $xoopsModule, $xoopsConfig, $xoopsSecurity;
    //Indica la lista a mostrar
    $show = isset($_REQUEST['show']) ? intval($_REQUEST['show']) : '0';
    //$show = 0 Muestra todos los reportes
    //$show = 1 Muestra los reportes revisados
    //$show = 2 Muestra los reportes no revisados
    define('RMCSUBLOCATION', $show == 0 ? 'allreps' : ($show == 1 ? 'reviews' : 'noreviewd'));
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    //Lista de Todos los reportes
    $sql = "SELECT * FROM " . $db->prefix('mod_bxpress_report') . ($show ? $show == 1 ? " WHERE zapped=1" : " WHERE zapped=0 " : '') . " ORDER BY report_time DESC";
    $result = $db->queryF($sql);
    $reports = array();
    $tf = new RMTimeFormatter(0, '%T% %d%, %Y% %h%:%i%:%s%');
    while ($rows = $db->fetchArray($result)) {
        $report = new bXReport();
        $report->assignVars($rows);
        $user = new XoopsUser($report->user());
        $post = new bXPost($report->post());
        $topic = new bXTopic($post->topic());
        $forum = new bXForum($post->forum());
        if ($report->zappedBy() > 0) {
            $zuser = new XoopsUser($report->zappedBy());
        }
        $reports[] = array('id' => $report->id(), 'post' => array('link' => $post->permalink(), 'id' => $report->post()), 'user' => $user->uname(), 'uid' => $user->uid(), 'date' => $tf->format($report->time()), 'report' => $report->report(), 'forum' => array('link' => $forum->permalink(), 'name' => $forum->name()), 'topic' => array('link' => $topic->permalink(), 'title' => $topic->title()), 'zapped' => $report->zapped(), 'zappedby' => $report->zappedby() > 0 ? array('uid' => $zuser->uid(), 'name' => $zuser->uname()) : '', 'zappedtime' => $report->zappedtime() > 0 ? $tf->format($report->zappedtime()) : '');
    }
    RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    RMTemplate::get()->add_local_script('admin.js', 'bxpress');
    RMTemplate::get()->set_help('http://www.redmexico.com.mx/docs/bxpress-forums/introduccion/standalone/1/');
    RMTemplate::get()->assign('xoops_pagetitle', __('Reports Management', 'bxpress'));
    $bc = RMBreadCrumb::get();
    $bc->add_crumb(__('Reports management', 'bxpress'));
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/forums-reports.php', 'module', 'bxpress');
    xoops_cp_footer();
}
예제 #10
0
 /**
  * Da formato a fechas MySQL
  * @param string $date
  * @param string $format
  * @param bool $local Utilizar formato de localización
  * @return string
  */
 static function date($date, $format = '', $local = false)
 {
     if ($date == '') {
         return null;
     }
     $time = strtotime($date);
     if ($time <= 0) {
         return '<code>?</code>';
     }
     if ($local) {
         $tf = new RMTimeFormatter($time, $format);
         return $tf->format();
     }
     return date($format != '' ? $format : 'd/m/Y H:i:s', $time);
 }
예제 #11
0
function bxpress_block_topics_show($options)
{
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $mc = RMSettings::module_settings('bxpress');
    $tbl1 = $db->prefix('mod_bxpress_posts');
    $tbl2 = $db->prefix('mod_bxpress_topics');
    $tbl3 = $db->prefix('mod_bxpress_likes');
    $tbl4 = $db->prefix('mod_bxpress_forums');
    // Calculate period of time
    if (0 < $options['days']) {
        $period = time() - $options['days'] * 86400;
    }
    $order = 'DESC' == $options['order'] ? 'DESC' : 'ASC';
    $sql = "SELECT topics.*, forums.name,\n                (SELECT SUM(likes) FROM {$tbl1} WHERE id_topic=topics.id_topic) as likes,\n                (SELECT post_time FROm {$tbl1} WHERE id_topic=topics.id_topic ORDER BY post_time DESC LIMIT 0, 1) as updated\n                FROM {$tbl2} as topics, {$tbl4} as forums WHERE ";
    if (0 < $options['days']) {
        $sql .= " topics.date > {$period} AND ";
    }
    $sql .= "forums.id_forum=topics.id_forum";
    if ('recent' == $options['type']) {
        $sql .= " ORDER BY topics.id_topic {$order} LIMIT 0, {$options['limit']}";
    } elseif ('hot' == $options['type']) {
        $sql .= " ORDER BY topics.replies {$order} LIMIT 0, {$options['limit']}";
    } elseif ('hits' == $options['type']) {
        $sql .= " ORDER BY topics.views {$order} LIMIT 0, {$options['limit']}";
    }
    $result = $db->queryF($sql);
    $topics = array();
    $block = array();
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxforum.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxpost.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxtopic.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/bxpress/class/bxfunctions.class.php';
    $topic = new bXTopic();
    $forum = new bXForum();
    $tf = new RMTimeFormatter(0, '%T% %d%, %Y%');
    while ($row = $db->fetchArray($result)) {
        $topic->assignVars($row);
        $forum->assignVars(array('id_forum' => $topic->forum()));
        $ret = array('id' => $topic->id(), 'title' => $topic->title, 'link' => $topic->permalink(), 'likes' => $topic->likes, 'replies' => $topic->replies, 'hits' => $topic->views, 'forum' => array('name' => $row['name'], 'id' => $row['id_forum'], 'link' => $forum->permalink()), 'time' => $topic->date, 'date' => $tf->ago($topic->date), 'likes' => $row['likes'], 'updated' => 'full' == $options['format'] ? sprintf(__('Updated on %s', 'bxpress'), $tf->format($row['updated'])) : $tf->ago($row['updated']));
        $topics[] = $ret;
    }
    $block['topics'] = $topics;
    $block['format'] = $options['format'];
    // Add css styles
    RMTemplate::get()->add_style('bxpress-blocks.min.css', 'bxpress');
    return $block;
}
 /**
  * Create field code
  */
 public function render()
 {
     if ($this->selected > 0) {
         $team = new MCHTeam($this->selected);
     }
     $rtn = '<div class="mch_teams_field" id="teams-container-' . $this->getName() . '" title="' . __('Click to select a new team', 'match') . '">';
     if ($this->selected > 0 && !$team->isNew()) {
         $tf = new RMTimeFormatter(0, __('%M% %d%, %Y%', 'match'));
         $rtn .= '<img src="' . MCH_UP_URL . '/' . $team->getVar('logo') . '" class="logo" alt="' . $team->getVar('name') . '" />';
         $rtn .= '<strong>' . $team->getVar('name') . '</strong>';
         $rtn .= '<span>' . $tf->format($team->getVar('created')) . '</span>';
     } else {
         $rtn .= '<img src="' . MCH_URL . '/images/add.png" alt="' . __('Add team', 'match') . '" /><span class="noselected">' . __('Select one team...', 'match') . '</span>';
     }
     $rtn .= '</div><div id="mch-teams-loader-' . $this->getName() . '" class="mch_teams_pop"></div>';
     $rtn .= '<input type="hidden" name="' . $this->getName() . '" id="mch-tf-value-' . $this->getName() . '" value="' . ($this->selected > 0 && !$team->isNew() ? $this->selected : '') . '" />';
     return $rtn;
 }
예제 #13
0
function show_dashboard()
{
    global $xoopsModuleConfig;
    $db = Database::getInstance();
    // Sets count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_sets");
    list($set_count) = $db->fetchRow($db->query($sql));
    // Pictures count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_images");
    list($pic_count) = $db->fetchRow($db->query($sql));
    // Users count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_users");
    list($user_count) = $db->fetchRow($db->query($sql));
    // Tags count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_tags");
    list($tag_count) = $db->fetchRow($db->query($sql));
    // E-Cards count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_postcards");
    list($post_count) = $db->fetchRow($db->query($sql));
    // Used space
    $space = RMUtilities::formatBytesSize(GSFunctions::folderSize($xoopsModuleConfig['storedir']));
    // Number of files
    $file_count = count_files(rtrim($xoopsModuleConfig['storedir'], '/'));
    // First picture
    $sql = "SELECT * FROM " . $db->prefix("gs_images") . " ORDER BY `created` ASC LIMIT 0,1";
    $result = $db->query($sql);
    if ($db->getRowsNum($result) > 0) {
        $img = new GSImage();
        $img->assignVars($db->fetchArray($result));
        $user = new GSUser($img->owner(), 1);
        $tf = new RMTimeFormatter(0, '%M% %d%, %Y%');
        $first_pic['date'] = $tf->format($img->created());
        $first_pic['link'] = $user->userURL() . ($xoopsModuleConfig['urlmode'] ? 'img/' . $img->id() . '/set/' : '&amp;img=' . $img->id());
    }
    xoops_cp_header();
    GSFunctions::toolbar();
    RMTemplate::get()->add_style('dashboard.css', 'galleries');
    RMTemplate::get()->add_style('admin.css', 'galleries');
    RMTemplate::get()->add_head('<script type="text/javascript">var xurl = "' . XOOPS_URL . '";</script>');
    RMTemplate::get()->add_local_script('dashboard.js', 'galleries');
    include RMTemplate::get()->get_template('admin/gs_dashboard.php', 'module', 'galleries');
    xoops_cp_footer();
}
예제 #14
0
function gs_photos_show($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsfunctions.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsuser.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsimage.class.php';
    $options[0] <= 0 ? 4 : $options[0];
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("gs_images");
    $order = $options[1] == '0' ? "created DESC" : ($options[1] == '1' ? 'RAND()' : 'views DESC');
    $sql .= " ORDER BY {$order} LIMIT 0,{$options['0']}";
    $result = $db->query($sql);
    $mc =& RMUtilities::module_config('galleries');
    $block = array();
    $tf = new RMTimeFormatter(0, '%T% %d%, %Y%');
    while ($row = $db->fetchArray($result)) {
        $pic = new GSImage();
        $pic->assignVars($row);
        if (!isset($users[$pic->owner()])) {
            $users[$pic->owner()] = new GSUser($pic->owner(), 1);
        }
        $user =& $users[$pic->owner()];
        $rtn = array();
        if ($options[3]) {
            $rtn['title'] = $pic->title();
        }
        $rtn['created'] = $tf->format($pic->created());
        $rtn['views'] = $pic->views();
        $rtn['by'] = sprintf(__('by %s', 'galleries'), '<a href="' . $user->userURL() . '">' . $user->uname() . '</a>');
        $rtn['link'] = $user->userURL() . ($mc['urlmode'] ? 'img/' . $pic->id() . '/' : '&amp;img=' . $pic->id());
        $rtn['file'] = $user->filesURL() . '/ths/' . $pic->image();
        $block['pics'][] = $rtn;
    }
    RMTemplate::get()->add_xoops_style('blocks.css', 'galleries');
    RMTemplate::get()->add_local_script('blocks.js', 'galleries');
    $block['item_width'] = $options[2];
    return $block;
}
예제 #15
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();
}
예제 #16
0
    if ($team['logo'] != '') {
        ?>
<img src="<?php 
        echo MCH_UP_URL;
        ?>
/<?php 
        echo $team['logo'];
        ?>
" alt="<?php 
        echo $team['name'];
        ?>
" /><?php 
    }
    ?>
    <strong><?php 
    echo $team['name'];
    ?>
</strong>
    <span class="category"><?php 
    echo $team['category_object']['name'];
    ?>
</span>
    <span class="date"><?php 
    echo $tf->format($team['created']);
    ?>
</span>
</div>
<?php 
}
?>
</div>
예제 #17
0
        $class = ucfirst($item->element . '_Notifications');
        if (!class_exists($class)) {
            // Include controller file
            if ('plugin' == $event->type) {
                $file = XOOPS_ROOT_PATH . '/modules/rmcommon/plugins/' . $item->element . '/class/' . strtolower($item->element) . '.notifications.class.php';
            } elseif ('theme' == $event->type) {
                $file = XOOPS_ROOT_PATH . '/themes/' . $item->element . '/class/' . strtolower($item->element) . '.notifications.class.php';
            } else {
                $file = XOOPS_ROOT_PATH . '/modules/' . $item->element . '/class/' . strtolower($item->element) . '.notifications.class.php';
            }
            include_once $file;
            if (!class_exists($class)) {
                continue;
            }
        }
        $notifications = $class::get();
        if (!$notifications->is_valid($item->event)) {
            continue;
        }
        $event = $notifications->event($item->event);
        if (!array_key_exists($item->type . '_' . $item->element, $elements)) {
            $elements[$item->type . '_' . $item->element] = $notifications->element_data();
        }
        $items[$item->type . '_' . $item->element][] = array('caption' => $event->caption, 'element' => $elements[$item->type . '_' . $item->element], 'params' => $item->params, 'type' => $item->type, 'event' => $item->event, 'object' => $notifications->object_data($item), 'date' => $tf->format($item->date), 'hash' => $crypt->encrypt(json_encode(array('event' => $item->event, 'element' => $item->element, 'type' => $item->type, 'params' => $item->params))));
    }
    RMTemplate::get()->add_script('cu-handler.js', 'rmcommon', array('footer' => 1, 'id' => 'cuhandler'));
    RMTemplate::get()->header();
    include RMTemplate::get()->get_template('rmc-notifications-list.php', 'module', 'rmcommon');
    RMTemplate::get()->footer();
    exit;
}
예제 #18
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';
}
예제 #19
0
<?php

// $Id$
// --------------------------------------------------------------
// MiniShop 3
// Module for catalogs
// Author: Eduardo Cortés <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
$tf = new RMTimeFormatter(0, '%d%/%M%/%Y%');
$var = isset($var) ? $var : 'products';
while ($row = $db->fetchArray($result)) {
    $product = new ShopProduct();
    $product->assignVars($row);
    $sf = new ShopFunctions();
    $xoopsTpl->append($var, array('id' => $product->id(), 'name' => $product->getVar('name'), 'nameid' => $product->getVar('nameid'), 'price' => $product->getVar('price') > 0 ? sprintf(__('Price: <strong>%s</strong>', 'shop'), sprintf($xoopsModuleConfig['format'], number_format($product->getVar('price'), 2))) : '', 'buy' => $sf->get_buy_link($product), 'type' => $product->getVar('type'), 'stock' => $product->getVar('available'), 'image' => SHOP_UPURL . '/ths/' . $product->getVar('image'), 'created' => sprintf(__('Since: <strong>%s</strong>', 'shop'), $tf->format($product->getVar('created'))), 'updated' => $product->getVar('modified') > 0 ? sprintf(__("Updated: <strong>%s</strong>", 'shop'), $tf->format($product->getVar('modified'))) : '', 'link' => $product->permalink(), 'metas' => $product->get_meta()));
}
예제 #20
0
/**
* @desc Muestra todos lo elementos registrados
**/
function dt_show_items()
{
    define('RMCSUBLOCATION', 'downitems');
    global $xoopsModule, $xoopsSecurity;
    $search = rmc_server_var($_REQUEST, 'search', '');
    $sort = rmc_server_var($_REQUEST, 'sort', 'id_soft');
    $mode = rmc_server_var($_REQUEST, 'mode', 1);
    $sort = $sort == '' ? 'id_soft' : $sort;
    $catid = rmc_server_var($_REQUEST, 'cat', 0);
    $type = rmc_server_var($_REQUEST, 'type', '');
    //Barra de Navegación
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT COUNT(*) FROM " . ($type == 'edit' ? $db->prefix('dtrans_software_edited') : $db->prefix('dtrans_software'));
    $sql .= $catid ? " WHERE id_cat='{$catid}'" : '';
    $sql .= $type == 'wait' ? $catid ? " AND approved=0" : " WHERE approved=0" : "";
    $sql1 = '';
    if ($search) {
        $words = explode(" ", $search);
        foreach ($words as $k) {
            //Verificamos si la palabra proporcionada es mayor a 2 caracteres
            if (strlen($k) <= 2) {
                continue;
            }
            $sql1 .= ($sql1 == '' ? $catid || $type == 'wait' ? " AND " : " WHERE " : " OR ") . " (name LIKE '%{$k}%' OR uname LIKE '%{$k}%') ";
        }
    }
    $sql2 = " ORDER BY {$sort} " . ($mode ? "DESC" : "ASC");
    list($num) = $db->fetchRow($db->queryF($sql . $sql1 . $sql2));
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $limit = 15;
    $nav = new RMPageNav($num, $limit, $page);
    $nav->target_url("items.php?search={$search}&amp;sort={$sort}&amp;mode={$mode}&amp;cat={$catid}&amp;type={$type}&page={PAGE_NUM}");
    $navpage = $nav->render(false, true);
    $start = $nav->start();
    //Fin de barra de navegación
    $catego = new DTCategory($catid);
    $sql = "SELECT * FROM " . ($type == 'edit' ? $db->prefix('dtrans_software_edited') : $db->prefix('dtrans_software'));
    $sql .= $catid ? " WHERE id_cat={$catid}" : '';
    $sql .= $type == 'wait' ? $catid ? " AND approved=0" : " WHERE approved=0" : "";
    $sql2 .= " LIMIT {$start},{$limit}";
    $result = $db->queryF($sql . $sql1 . $sql2);
    $items = array();
    $timeFormat = new RMTimeFormatter(0, '%m%-%d%-%Y%');
    while ($rows = $db->fetchArray($result)) {
        if ($type == 'edit') {
            $sw = new DTSoftwareEdited();
        } else {
            $sw = new DTSoftware();
        }
        $sw->assignVars($rows);
        $img = new RMImage($sw->getVar('image'));
        $user = new XoopsUser($sw->getVar('uid'));
        $items[] = array('id' => $type == 'edit' ? $sw->software() : $sw->id(), 'name' => $sw->getVar('name'), 'screens' => $sw->getVar('screens'), 'image' => $img->get_smallest(), 'secure' => $sw->getVar('secure'), 'approved' => $sw->getVar('approved'), 'uname' => $user->getVar('uname'), 'created' => $timeFormat->format($sw->getVar('created')), 'modified' => $timeFormat->format($sw->getVar('modified')), 'link' => $sw->permalink(), 'featured' => $sw->getVar('featured'), 'daily' => $sw->getVar('daily'), 'password' => $sw->getVar('password') != '', 'deletion' => $sw->getVar('delete'));
    }
    //Lista de categorías
    $categories = array();
    DTFunctions::getCategos($categos, 0, 0, array(), true);
    foreach ($categos as $k) {
        $cat = $k['object'];
        $categories[] = array('id' => $cat->id(), 'name' => str_repeat('--', $k['jumps']) . ' ' . $cat->name());
    }
    switch ($type) {
        case 'wait':
            $loc = __('Pending Downloads', 'dtransport');
            break;
        case 'edit':
            $loc = __('Edited Downloads', 'dtransport');
            break;
        default:
            $loc = __('Downloads Management', 'dtransport');
            break;
    }
    DTFunctions::toolbar();
    $tpl = RMTemplate::get();
    $tpl->add_style('admin.css', 'dtransport');
    $tpl->add_local_script('admin.js', 'dtransport');
    $tpl->add_local_script('items.js', 'dtransport');
    $tpl->add_local_script('jquery.checkboxes.js', 'rmcommon', 'include');
    include DT_PATH . '/include/js_strings.php';
    xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> &raquo; " . $loc);
    xoops_cp_header();
    include RMTemplate::get()->get_template('admin/dtrans_items.php', 'module', 'dtransport');
    xoops_cp_footer();
}
예제 #21
0
 if ($tpages < $page && $tpages > 0) {
     header('location: ' . DT_URL . ($mc['permalinks'] ? '/cp/' : '/?p=cpanel'));
     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'] ? '/cp/page/{PAGE_NUM}/' : '/?p=cpanel&amp;page={PAGE_NUM}'));
 $xoopsTpl->assign('pagenav', $nav->render(true));
 $sql = str_replace("COUNT(*)", '*', $sql) . " LIMIT {$start}, {$limit}";
 $result = $db->query($sql);
 $tf = new RMTimeFormatter('', "%M%-%d%-%Y%");
 while ($row = $db->fetchArray($result)) {
     $item = new DTSoftware();
     $item->assignVars($row);
     $xoopsTpl->append('items', array('id' => $item->id(), 'name' => $item->getVar('name'), 'links' => array('permalink' => $item->permalink(), 'edit' => $mc['permalinks'] ? DT_URL . '/submit/edit/' . $item->id() : '/?p=submit&amp;action=edit&amp;id=' . $item->id(), 'delete' => $mc['permalinks'] ? DT_URL . '/cp/delete/' . $item->id() : '/?p=cpanel&amp;action=delete&amp;id=' . $item->id(), 'files' => $mc['permalinks'] ? DT_URL . '/cp/files/' . $item->id() : '/?p=cpanel&amp;action=files&amp;id=' . $item->id(), 'features' => $mc['permalinks'] ? DT_URL . '/cp/features/' . $item->id() : '/?p=cpanel&amp;action=features&amp;id=' . $item->id(), 'logs' => $mc['permalinks'] ? DT_URL . '/cp/logs/' . $item->id() : '/?p=cpanel&amp;action=logs&amp;id=' . $item->id(), 'screens' => $mc['permalinks'] ? DT_URL . '/cp/screens/' . $item->id() : '/?p=cpanel&amp;action=screens&amp;id=' . $item->id(), 'canceldel' => $mc['permalinks'] ? DT_URL . '/cp/canceldel/' . $item->id() : '/?p=cpanel&amp;action=canceldel&amp;id=' . $item->id()), 'secure' => $item->getVar('secure'), 'approved' => $item->getVar('approved'), 'created' => array('time' => $item->getVar('created'), 'formated' => $tf->format($item->getVar('created'))), 'modified' => array('time' => $item->getVar('modified'), 'formated' => $tf->format($item->getVar('modified'))), 'hits' => $item->getVar('hits'), 'deletion' => $item->getVar('delete')));
 }
 // Idioma
 $xoopsTpl->assign('lang_id', __('ID', 'dtransport'));
 $xoopsTpl->assign('lang_name', __('Name', 'dtransport'));
 $xoopsTpl->assign('lang_protected', __('Protected', 'dtransport'));
 $xoopsTpl->assign('lang_approved', __('Approved', 'dtransport'));
 $xoopsTpl->assign('lang_created', __('Created', 'dtransport'));
 $xoopsTpl->assign('lang_modified', __('Modified', 'dtransport'));
 $xoopsTpl->assign('lang_hits', __('Hits', 'dtransport'));
 $xoopsTpl->assign('lang_edit', __('Edit', 'dtransport'));
 $xoopsTpl->assign('lang_delete', __('Delete', 'dtransport'));
 $xoopsTpl->assign('lang_todelete', __('Waiting Deletion', 'dtransport'));
 $xoopsTpl->assign('lang_files', __('Files', 'dtransport'));
 $xoopsTpl->assign('lang_features', __('Features', 'dtransport'));
 $xoopsTpl->assign('lang_logs', __('Logs', 'dtransport'));
예제 #22
0
$data['thumbnail'] = $img->get_smallest();
$data['rating'] = @number_format($item->getVar('rating') / $item->getVar('votes'), 1);
$data['votes'] = $item->getVar('votes');
// Licencias
$data['licenses'] = array();
foreach ($item->licences(true) as $lic) {
    $data['licenses'][] = array('url' => $lic->link(), 'name' => $lic->name(), 'link' => $lic->permalink());
}
//  Plataformas
$data['platforms'] = array();
foreach ($item->platforms(true) as $os) {
    $data['platforms'][] = array('name' => $os->name(), 'link' => $os->permalink());
}
$tf = new RMTimeFormatter(0, '%T% %d%, %Y%');
// Time formatter
$data['created'] = $tf->format($item->getVar('created'));
$data['update'] = $item->getVar('created') > 0 ? $tf->format($item->getVar('modified')) : '';
$data['author'] = array('name' => $item->getVar('author_name'), 'url' => $item->getVar('author_url'), 'email' => $item->getVar('author_email'), 'contact' => $item->getVar('author_contact'));
$data['langs'] = $item->getVar('langs');
$data['downs'] = $item->getVar('hits');
$data['version'] = $item->getVar('version');
$data['updated'] = $item->getVar('modified') > $item->getVar('created') && $item->getVar('modified') > time() - $mc['update'] * 86400;
$data['new'] = !$data['updated'] && $item->getVar('created') > time() - $mc['new'] * 86400;
$data['description'] = $item->getVar('desc');
$data['shortdesc'] = $item->getVar('shortdesc');
$data['siterate'] = $dtfunc->ratingStars($item->getVar('siterate'));
$fg = $item->fileGroups(true);
$data['filegroups'] = array();
foreach ($fg as $g) {
    $files = $g->files(true);
    $data['filegroups'][$g->id()]['name'] = $g->name();
예제 #23
0
/**
* @desc Visualiza todos los albumes existentes
**/
function sets()
{
    global $tpl, $xoopsOption, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $db, $pag, $usr;
    $mc =& $xoopsModuleConfig;
    $xoopsOption['template_main'] = 'gs_sets.html';
    $xoopsOption['module_subpage'] = 'exploresets';
    include 'header.php';
    //Verificamos si el usuario proporcionado existe
    if ($usr) {
        $owner = new GSUser($usr);
        if ($owner->isNew()) {
            redirect_header(GSFunctions::get_url(), 1, __('Specified user does not exists!', 'galleries'));
            die;
        }
    }
    GSFunctions::makeHeader();
    //Verificamos si el usuario es dueño o amigo
    if ($usr && $xoopsUser) {
        if ($owner->uid() == $xoopsUser->uid()) {
            $public = '';
        } else {
            if ($owner->isFriend($xoopsUser->uid())) {
                $public = " WHERE public<>'0'";
            } else {
                $public = " WHERE public='2'";
            }
        }
    } else {
        $public = " WHERE public='2'";
    }
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_sets') . " {$public} ";
    $sql .= isset($usr) ? ($public ? " AND " : " WHERE ") . " uname='" . $usr . "'" : '';
    $page = isset($pag) ? $pag : '';
    $limit = $mc['limit_sets'];
    /**
     * @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 = $mc['limit_sets'];
        $cols = $format[4];
        $showdesc = @$format[5];
    } else {
        $limit = $mc['limit_sets'];
        $cols = $mc['cols_sets'];
        $showdesc = 0;
        $width = $mc['image_ths'][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) {
        $rest = $pactual - $tpages;
        $pactual = $pactual - $rest + 1;
        $start = ($pactual - 1) * $limit;
    }
    if ($tpages > 1) {
        if ($mc['urlmode']) {
            $urlnav = 'explore/sets/';
            $urlnav .= isset($usr) ? 'usr/' . $usr . '/' : '';
        } else {
            $urlnav = '?explore=sets';
            $urlnav .= isset($usr) ? '&amp;usr='******'';
        }
        $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('setsNavPage', $nav->render(false));
    }
    $showmax = $start + $limit;
    $showmax = $showmax > $num ? $num : $showmax;
    $tpl->assign('lang_showing', sprintf(__('Albums %u to %u from %u', 'galleries'), $start + 1, $showmax, $num));
    $tpl->assign('limit', $limit);
    $tpl->assign('pag', $pactual);
    //Fin de barra de navegación
    $sql = "SELECT * FROM " . $db->prefix('gs_sets') . " {$public}";
    $sql .= isset($usr) ? ($public ? " AND " : " WHERE ") . "uname='" . $usr . "'" : '';
    $sql .= " ORDER BY date desc";
    $sql .= " LIMIT {$start},{$limit}";
    $result = $db->query($sql);
    $users = array();
    $tf = new RMTimeFormatter(0, __("%M% %d%, %Y%", 'galleries'));
    while ($rows = $db->fetchArray($result)) {
        $set = new GSSet();
        $set->assignVars($rows);
        //Obtenemos una imagen del album
        $sql = "SELECT b.* FROM " . $db->prefix('gs_setsimages') . " a, " . $db->prefix('gs_images') . " b WHERE";
        $sql .= " a.id_set='" . $set->id() . "' AND b.id_image=a.id_image AND b.public=2 AND b.owner='" . $set->owner() . "' ORDER BY b.created DESC LIMIT 0,1";
        $resimg = $db->query($sql);
        if (!isset($users[$set->owner()])) {
            $users[$set->owner()] = new GSUser($set->owner(), 1);
        }
        if ($db->getRowsNum($resimg) > 0) {
            $rowimg = $db->fetchArray($resimg);
            $img = new GSImage();
            $img->assignVars($rowimg);
            $urlimg = $users[$set->owner()]->filesURL() . '/' . ($mc['set_format_mode'] ? 'formats/set_' : 'ths/') . $img->image();
            // Conversion de los formatos
            if (!$img->setFormat() && $mc['set_format_mode']) {
                GSFunctions::resizeImage($crop, $users[$set->owner()]->filesPath() . '/' . $img->image(), $users[$set->owner()]->filesPath() . '/formats/set_' . $img->image(), $width, $height);
                $img->setSetFormat(1, 1);
            }
        } else {
            $urlimg = '';
        }
        $tpl->append('sets', array('id' => $set->id(), 'title' => $set->title(), 'date' => $tf->format($set->date()), 'owner' => $set->owner(), 'uname' => $set->uname(), 'pics' => $set->pics(), 'img' => $urlimg, 'link' => $users[$set->owner()]->userURL() . ($mc['urlmode'] ? 'set/' . $set->id() . '/' : '&amp;set=' . $set->id()), 'linkuser' => $users[$set->owner()]->userURL()));
    }
    $tpl->assign('lang_date', __('Created on:', 'galleries'));
    $tpl->assign('lang_by', __('Owned by:', 'galleries'));
    $tpl->assign('margin', $width + 20);
    $tpl->assign('lang_imgs', __('Images:', 'galleries'));
    $tpl->assign('usr', isset($owner) ? 1 : 0);
    $tpl->assign('lang_setsexist', __('Existing Albums', 'galleries'));
    if (isset($owner)) {
        $tpl->assign('user', array('id' => $owner->uid(), 'uname' => $owner->uname(), 'avatar' => RMEvents::get()->run_event('rmcommon.get.avatar', $owner->userVar('email'), 0, $owner->userVar('user_avatar'))));
        $tpl->assign('lang_setsof', sprintf(__('Sets of %s', 'galleries'), $owner->uname()));
        $tpl->assign('pics_link', GSFunctions::get_url() . ($mc['urlmode'] ? "usr/" . $owner->uname() . '/' : "?usr="******"explore/sets/usr/" . $owner->uname() . '/' : "?explore=sets&amp;usr="******"explore/tags/usr/" . $owner->uname() . '/' : "?explore=tags&amp;usr="******"cp/booksmarks/" : "?cp=bookmarks"));
    }
    include 'footer.php';
}
예제 #24
0
function m_show_roster()
{
    global $xoopsModule, $xoopsSecurity;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $id = rmc_server_var($_REQUEST, 'id', 0);
    if ($id > 0) {
        MCHFunctions::page_from_item($id, 'player');
    }
    $page = rmc_server_var($_REQUEST, 'page', 1);
    $page = $page <= 0 ? 1 : $page;
    $limit = 15;
    $team = rmc_server_var($_REQUEST, 'team', 0);
    $search = rmc_server_var($_REQUEST, 'search', '');
    $filters = false;
    //Barra de Navegación
    $sql = "SELECT COUNT(*) FROM " . $db->prefix('mch_coaches');
    if ($team > 0 || $search != '') {
        $sql .= " WHERE ";
        $filters = true;
    }
    $and = false;
    if ($team > 0) {
        $sql .= " team={$team}";
        $and = true;
        $t = new MCHTeam($team);
        if (!$t->isNew()) {
            $team_data = array('name' => $t->getVar('name'));
        }
        unset($t);
    }
    if ($search != '') {
        $sql .= $and ? ' AND ' : '';
        $sql .= "(name LIKE '%{$search}%' OR lastname LIKE '%{$search}%' OR surname LIKE '%{$search}%')";
    }
    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('coaches.php?page={PAGE_NUM}&amp;team=' . $team);
    $coaches = array();
    $sql = str_replace('COUNT(*)', '*', $sql);
    $sql .= ' ORDER BY ' . ($team > 0 ? 'charge,lastname,surname,name' : 'lastname,surname,name');
    $result = $db->query($sql);
    $cache_team = array();
    $timef = new RMTimeFormatter('', "%M% %d%, %Y%");
    while ($row = $db->fetchArray($result)) {
        $coach = new MCHCoach();
        $coach->assignVars($row);
        if (isset($cache_team[$coach->getVar('team')])) {
            $t = $cache_team[$coach->getVar('team')];
        } else {
            $cache_team[$coach->getVar('team')] = new MCHTeam($coach->getVar('team'));
            $t = $cache_team[$coach->getVar('team')];
        }
        $coaches[] = array('id' => $coach->id(), 'link' => $coach->permalink(), 'name' => $coach->getVar('name'), 'lastname' => $coach->getVar('lastname'), 'surname' => $coach->getVar('surname'), 'nameid' => $coach->getVar('nameid'), 'created' => $timef->format($coach->getVar('created')), 'charge' => MCHFunctions::charge_name($coach->getVar('charge')), 'team' => array('id' => $t->id(), 'name' => $t->getVar('name'), 'link' => $t->permalink()));
    }
    // Categories
    $teams = MCHFunctions::all_teams(false);
    // Event
    $coaches = RMEvents::get()->run_event('match.list.coaches', $coaches);
    MCHFunctions::toolbar();
    xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> &raquo; " . __('Coaches', 'match'));
    RMTemplate::get()->assign('xoops_pagetitle', __('Coaches', '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 coaches?', 'match') . "';\n\n        var mch_select_message = '" . __('You must select some coach 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_coaches.php", 'module', 'match');
    xoops_cp_footer();
}
예제 #25
0
 /**
  * Get image data
  */
 public function process_image_data($result)
 {
     $mc = RMUtilities::module_config('galleries');
     $users = array();
     $ret = array();
     $tf = new RMTimeFormatter(0, "%M%/%d%/%Y%");
     $db = Database::getInstance();
     $i = 0;
     while ($row = $db->fetchArray($result)) {
         $img = new GSImage();
         $img->assignVars($row);
         if (!isset($users[$img->owner()])) {
             $users[$img->owner()] = new GSUser($img->owner(), 1);
         }
         $imglink = $users[$img->owner()]->userURL() . ($mc['urlmode'] ? 'img/' . $img->id() . '/' : '&amp;img=' . $img->id());
         $ret[$i] = array('id' => $img->id(), 'title' => $img->title(), 'thumbnail' => $users[$img->owner()]->filesURL() . '/ths/' . $img->image(), 'thumbuser' => $users[$img->owner()]->filesURL() . '/' . ($mc['user_format_mode'] ? 'formats/user_' : 'ths/') . $img->image(), 'thumbsrh' => $users[$img->owner()]->filesURL() . '/' . ($mc['search_format_mode'] ? 'formats/srh_' : 'ths/') . $img->image(), 'image' => $users[$img->owner()]->filesURL() . '/' . $img->image(), 'by' => sprintf(__('by %s', 'galleries'), '<a href="' . $users[$img->owner()]->userUrl() . '">' . $users[$img->owner()]->uname() . '</a>'), 'link' => $imglink, 'created' => $tf->format($img->created()), 'public' => $img->isPublic(), 'desc' => $img->desc());
         // Format resize
         if (!$img->userFormat() && $mc['user_format_mode']) {
             $format = $mc['user_format_values'];
             GSFunctions::resizeImage($format[0], $users[$img->owner()]->filesPath() . '/' . $img->image(), $users[$img->owner()]->filesPath() . '/formats/user_' . $img->image(), $format[1], $format[2]);
             $img->setUserFormat(1, 1);
         }
         if (!$img->searchFormat() && $mc['search_format_mode']) {
             $format = $mc['search_format_values'];
             GSFunctions::resizeImage($format[0], $users[$img->owner()]->filesPath() . '/' . $img->image(), $users[$img->owner()]->filesPath() . '/formats/srh_' . $img->image(), $format[1], $format[2]);
             $img->setSearchFormat(1, 1);
         }
         if ($mc['search_format_mode']) {
             $ret[$i]['viewmore'] = sprintf(__('Ver <a href="%s">más fotos</a>.', 'galleries'), $users[$img->owner()]->userURL());
             $ret[$i]['avatar'] = RMEvents::get()->run_event('rmcommon.get.avatar', $users[$img->owner()]->userVar('email'), 0, $users[$img->owner()]->userVar('user_avatar'));
             $tags = $img->tags(true);
             $tagurl = self::get_url() . ($mc['urlmode'] ? 'explore/tags/tag/' : '?explore=tags&amp;tag=');
             $strtag = '';
             foreach ($tags as $tag) {
                 $strtag .= $strtag == '' ? "<a href=\"{$tagurl}" . $tag->getVar('nameid') . "\">" . $tag->tag() . "</a>" : ", <a href=\"{$tagurl}" . $tag->getVar('nameid') . "\">" . $tag->tag() . "</a>";
             }
             $ret[$i]['tags'] = $strtag;
         }
         $i++;
     }
     RMTemplate::get()->add_local_script('photos.js', 'galleries');
     if (!$mc['quickview']) {
         return $ret;
     }
     if (RMFunctions::plugin_installed('lightbox')) {
         RMLightbox::get()->add_element('.pic_qview a');
         RMLightbox::get()->render();
     }
     return $ret;
 }
예제 #26
0
// MiniShop 3
// Module for catalogs
// Author: Eduardo Cortés <*****@*****.**>
// Email: i.bitcero@gmail.com
// License: GPL 2.0
// --------------------------------------------------------------
$product = new ShopProduct($id);
if ($product->isNew()) {
    ShopFunctions::error404();
}
$xoopsOption['template_main'] = 'shop_product.html';
include 'header.php';
$tf = new RMTimeFormatter(0, '%d%/%T%/%Y%');
$sf = new ShopFunctions();
// Product data
$xoopsTpl->assign('product', array('name' => $product->getVar('name'), 'description' => $product->getVar('description'), 'price' => $product->getVar('price') > 0 ? sprintf(__('Price: <strong>%s</strong>', 'shop'), sprintf($xoopsModuleConfig['format'], number_format($product->getVar('price'), 2))) : '', 'buy' => $sf->get_buy_link($product), 'type' => $product->getVar('type'), 'stock' => $product->getVar('available'), 'image' => $product->getVar('image'), 'created' => sprintf(__('Since: <strong>%s</strong>', 'shop'), $tf->format($product->getVar('created'))), 'updated' => $product->getVar('modified') > 0 ? sprintf(__("Updated: <strong>%s</strong>", 'shop'), $tf->format($product->getVar('modified'))) : '', 'link' => $product->permalink(), 'metas' => $product->get_meta(), 'images' => $product->get_images()));
$product->setVar('hits', $product->getVar('hits') + 1);
$product->save();
$options = array('<a href="' . ShopFunctions::get_url() . ($xoopsModuleConfig['urlmode'] ? 'contact/' . $product->getVar('nameid') . '/' : '?contact=' . $product->id()) . '">' . __('Request Information', 'shop') . '</a>');
$options = RMEvents::get()->run_event('shop.product.options', $options);
$xoopsTpl->assign('options', $options);
$xoopsTpl->assign('product_details', 1);
$xoopsTpl->assign('xoops_pagetitle', $product->getVar('name') . ' &raquo; ' . $xoopsModuleConfig['modtitle']);
$xoopsTpl->assign('lang_instock', __('In stock', 'shop'));
$xoopsTpl->assign('lang_outstock', __('Out of stock', 'shop'));
$xoopsTpl->assign('lang_buy', __('Buy Now!', 'shop'));
RMTemplate::get()->add_style('main.css', 'shop');
// Now minishop will use lightbox plugin for Common Utilities
if (RMFunctions::plugin_installed('lightbox')) {
    RMLightbox::get()->add_element('.prod_thumbs a');
    RMLightbox::get()->render();
예제 #27
0
 /**
  * Get results
  */
 public function latest_results($cat = 0, $c = 0, $limit = 0)
 {
     if ($c <= 0) {
         $champ = self::current_championship();
     } else {
         $champ = new MCHChampionship($c);
     }
     if (!is_object($champ)) {
         $champ = self::last_championship();
     }
     $db = XoopsDatabaseFactory::getDatabaseConnection();
     $tbr = $db->prefix("mch_role");
     $tbs = $db->prefix("mch_score");
     $sql = "SELECT a.*, s.item, s.local as loc, s.visitor as vis, s.win, s.champ FROM {$tbr} as a, {$tbs} as s WHERE a.champ='" . $champ->id() . "' AND a.time<" . time();
     if ($cat > 0) {
         $sql .= " AND a.category='" . $cat . "'";
     }
     $sql .= " AND s.item=a.id_role ORDER BY a.time DESC LIMIT 0, {$limit}";
     $result = $db->query($sql);
     $tf = new RMTimeFormatter();
     while ($row = $db->fetchArray($result)) {
         $local = new MCHTeam($row['local']);
         $visitor = new MCHTeam($row['visitor']);
         $category = new MCHCategory($row['category']);
         $field = new MCHField($row['field']);
         $data[] = array('local' => array('id' => $local->id(), 'name' => $local->getVar('name'), 'logo' => XOOPS_UPLOAD_URL . '/teams/' . $local->getVar('logo'), 'score' => $row['loc']), 'visitor' => array('id' => $visitor->id(), 'name' => $visitor->getVar('name'), 'logo' => XOOPS_UPLOAD_URL . '/teams/' . $visitor->getVar('logo'), 'score' => $row['vis']), 'day' => $tf->format($row['time'], __('%M% %d%', 'match')), 'hour' => $tf->format($row['time'], __('%h%:%i%', 'match')), 'category' => array('name' => $category->getVar('name'), 'link' => $category->permalink()), 'field' => $field->getVar('name'), 'win' => $row['win']);
     }
     return $data;
 }
예제 #28
0
/**
* Muestra las características existentes de una descarga
*/
function dt_show_files($edit = 0)
{
    global $xoopsOption, $db, $tpl, $xoopsTpl, $xoopsUser, $mc, $dtfunc, $page, $item, $xoopsConfig, $xoopsModuleConfig, $file;
    include 'header.php';
    $dtfunc->cpHeader($item, sprintf(__('%s files', 'dtransport'), $item->getVar('name')));
    if ($file > 0 && $edit) {
        $file = new DTFile($file);
        if ($file->isNew() || $file->software() != $item->id()) {
            redirect_header(DT_URL . ($mc['permalinks'] ? '/cp/files/' . $item->id() . '/' : '/?p=cpanel&amp;action=files&amp;id=' . $item->id()), 1, __('Specified feature does not exists!', 'dtransport'));
        }
    }
    $tc = TextCleaner::getInstance();
    $tf = new RMTimeFormatter('', "%m%/%d%/%Y% %h%:%i%");
    $rmu = RMUtilities::get();
    $tfiles = $db->prefix('dtrans_files');
    $tgroup = $db->prefix('dtrans_groups');
    $sql = "SELECT * FROM {$tfiles} WHERE id_soft=" . $item->id();
    $gcache = array();
    $result = $db->queryF($sql);
    while ($rows = $db->fetchArray($result)) {
        $fl = new DTFile();
        $fl->assignVars($rows);
        if (!isset($gcache[$fl->group()])) {
            $gcache[$fl->group()] = new DTFileGroup($fl->group());
        }
        $group = $gcache[$fl->group()];
        $xoopsTpl->append('files', array('id' => $fl->id(), 'title' => $fl->title(), 'date' => $tf->format($fl->date()), 'software' => $item->getVar('name'), 'remote' => $fl->remote(), 'size' => $rmu->formatBytesSize($fl->size()), 'hits' => $fl->hits(), 'date' => $tf->format($fl->date()), 'group' => $group->isNew() ? '' : $group->name(), 'links' => array('edit' => DT_URL . ($mc['permalinks'] ? '/cp/files/' . $item->getVar('nameid') . '/edit/' . $fl->id() . '/' : '/?p=cpanel&amp;id=' . $item->id() . '&amp;action=files&amp;feature=' . $fl->id()), 'delete' => DT_URL . ($mc['permalinks'] ? '/cp/files/' . $item->getVar('nameid') . '/delete/' . $fl->id() . '/' : '/?p=cpanel&amp;id=' . $item->id() . '&amp;action=delete&amp;feature=' . $fl->id()))));
    }
    $formurl = DT_URL . ($mc['permalinks'] ? '/cp/files/' . $item->id() . '/save/' . ($edit ? $file->id() : '0') . '/' : '/p=cpanel');
    // files Form
    $form = new RMForm($edit ? sprintf(__('Editing file of "%s"', 'dtransport'), $item->getVar('name')) : sprintf(__('New file for "%s"', 'dtransport'), $item->getVar('name')), 'frmFile', $formurl);
    $form->setExtra('enctype="multipart/form-data"');
    $form->addElement(new RMFormLabel(__('Download item', 'dtransport'), $item->getVar('name')));
    $form->addElement(new RMFormText(__('File title', 'dtransport'), 'title', 50, 200, $edit ? $file->title() : ''), true);
    //Lista de grupos
    $sql = "SELECT * FROM " . $db->prefix('dtrans_groups') . " WHERE id_soft=" . $item->id();
    $result = $db->query($sql);
    $groups = array();
    while ($rows = $db->fetchArray($result)) {
        $group = new DTFileGroup();
        $group->assignVars($rows);
        $groups[] = array('id' => $group->id(), 'name' => $group->name());
    }
    $ele = new RMFormSelect(__('Group', 'dtransport'), 'group', 0, $edit ? $file->group() : '');
    $ele->addOption('', __('Select group...', 'dtransport'));
    foreach ($groups as $group) {
        $ele->addOption($group['id'], $group['name']);
    }
    $form->addElement($ele);
    $form->addElement(new RMFormYesNo(__('Default file', 'dtransport'), 'default', $edit ? $file->isDefault() : 0));
    $form->addElement(new RMFormYesNo(__('Remote file', 'dtransport'), 'remote', $edit ? $file->remote() : 0));
    $form->addElement(new RMFormFile(__('File', 'dtransport'), 'thefile', 50, $xoopsModuleConfig['size_file'] * 1024 * 1024));
    if ($edit) {
        $form->addElement(new RMFormLabel(__('Current file', 'dtransport'), $file->file()));
    }
    $form->addElement(new RMFormText(__('File URL', 'dtransport'), 'url', 50, 200, $edit ? $file->title() : ''))->setDescription(__('Used only when remote file is activated.', 'dtransport'));
    $form->addElement(new RMFormHidden('action', 'save'));
    $form->addElement(new RMFormHidden('id', $item->id()));
    $form->addElement(new RMFormHidden('file', $edit ? $file->id() : 0));
    $form->addElement(new RMFormHidden('op', 'save'));
    $buttons = new RMFormButtonGroup();
    $buttons->addButton('sbt', $edit ? __('Save Changes', 'dtransport') : __('Save File', 'dtransport'), 'submit');
    $buttons->addButton('cancel', __('Cancel', 'dtransport'), 'button', 'onclick="window.location=\'' . (DT_URL . ($mc['permalinks'] ? '/cp/files/' . $item->id() . '/' : '/?p=cpanel&amp;action=files&amp;id=' . $item->id())) . '\';"');
    $form->addElement($buttons);
    $xoopsTpl->assign('file_form', $form->render());
    $tpl->add_xoops_style('cpanel.css', 'dtransport');
    $tpl->add_head_script('$(document).ready(function(){
        
        $("a.delete").click(function(){
            if(!confirm("' . __('Do you really want to delete selected file?', 'dtransport') . '")) return false;
        });
        
    });');
    $xoopsTpl->assign('lang_id', __('ID', 'dtransport'));
    $xoopsTpl->assign('lang_title', __('Title', 'dtransport'));
    $xoopsTpl->assign('lang_group', __('Group', 'dtransport'));
    $xoopsTpl->assign('lang_remote', __('Remote', 'dtransport'));
    $xoopsTpl->assign('lang_size', __('Size', 'dtransport'));
    $xoopsTpl->assign('lang_hits', __('Hits', 'dtransport'));
    $xoopsTpl->assign('lang_date', __('Date', 'dtransport'));
    $xoopsTpl->assign('lang_edit', __('Edit', 'dtransport'));
    $xoopsTpl->assign('lang_delete', __('Delete', 'dtransport'));
    $xoopsTpl->assign('lang_addfile', __('Add File', 'dtransport'));
    $xoopsTpl->assign('edit', $edit);
    include 'footer.php';
}
예제 #29
0
function gs_sets_show($options)
{
    global $xoopsUser, $xoopsModuleConfig;
    $db = Database::getInstance();
    $wo = '';
    $tsets = $db->prefix("gs_sets");
    $tfriends = $db->prefix("gs_friends");
    $mc = RMUtilities::module_config('galleries');
    $format = $mc['set_format_values'];
    $crop = $format[0];
    // 0 = Redimensionar, 1 = Cortar
    $width = $format[1];
    $height = $format[2];
    if ($xoopsUser) {
        $wo = "{$tsets}.owner='" . $xoopsUser->uid() . "' OR";
    }
    $sql = "SELECT * FROM {$tsets} WHERE owner='1' OR public='2' ORDER BY `date` DESC LIMIT 0,{$options['0']}";
    $result = $db->query($sql);
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsset.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsuser.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsimage.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsfunctions.class.php';
    $block = array();
    $users = array();
    $tf = new RMTimeFormatter(0, '%T% %d%, %Y%');
    while ($row = $db->fetchArray($result)) {
        $rtn = array();
        $set = new GSSet();
        $set->assignVars($row);
        if (!isset($users[$set->owner()])) {
            $users[$set->owner()] = new GSUser($set->owner(), 1);
        }
        // Si se ha seleccionado la opción para mostrar imágenes entonces...
        if ($options[1]) {
            //Obtenemos una imagen del album
            $sql = "SELECT b.* FROM " . $db->prefix('gs_setsimages') . " a, " . $db->prefix('gs_images') . " b WHERE";
            $sql .= " a.id_set='" . $set->id() . "' AND b.id_image=a.id_image AND b.public=2 AND b.owner='" . $set->owner() . "' ORDER BY b.created DESC LIMIT 0,1";
            $resimg = $db->query($sql);
            if ($db->getRowsNum($resimg) > 0) {
                $rowimg = $db->fetchArray($resimg);
                $img = new GSImage();
                $img->assignVars($rowimg);
                $urlimg = $users[$set->owner()]->filesURL() . '/' . ($mc['set_format_mode'] ? 'formats/set_' : 'ths/') . $img->image();
                // Conversion de los formatos
                if (!$img->setFormat() && $mc['set_format_mode']) {
                    GSFunctions::resizeImage($crop, $users[$set->owner()]->filesPath() . '/' . $img->image(), $users[$set->owner()]->filesPath() . '/formats/set_' . $img->image(), $width, $height);
                    $img->setSetFormat(1, 1);
                }
            } else {
                $urlimg = '';
            }
            $rtn['img'] = $urlimg;
        }
        $rtn['id'] = $set->id();
        $rtn['title'] = $set->title();
        $rtn['owner'] = $set->owner();
        $rtn['link'] = $users[$set->owner()]->userURL() . ($mc['urlmode'] ? 'set/' . $set->id() . '/' : '&amp;set=' . $set->id());
        if ($options[2]) {
            $rtn['date'] = $tf->format($set->date());
            $rtn['pics'] = $set->pics();
            $rtn['uname'] = $set->uname();
            $rtn['linkuser'] = $users[$set->owner()]->userURL();
        }
        $block['sets'][] = $rtn;
    }
    $block['showimg'] = $options[1];
    $block['showinfo'] = $options[2];
    $block['item_width'] = $options[3];
    RMTemplate::get()->add_xoops_style('blocks.css', 'galleries');
    RMTemplate::get()->add_local_script('blocks.js', 'galleries');
    return $block;
}
예제 #30
0
$xoopsOption['template_main'] = "mch_index.html";
$xoopsOption['module_subpage'] = 'index';
include XOOPS_ROOT_PATH . '/header.php';
// Get current match
$id_champ = rmc_server_var($_REQUEST, 'ch', 0);
if ($id_champ <= 0) {
    $champ = MCHFunctions::current_championship();
} else {
    $champ = new MCHChampionship($id_champ);
}
if (!is_object($champ)) {
    $champ = MCHFunctions::last_championship();
}
// Time Formatter
$tf = new RMTimeFormatter(0, __('%M% %d%, %Y%', 'match'));
$xoopsTpl->assign('champ', array('id' => $champ->id(), 'name' => $champ->getVar('name'), 'start' => $tf->format($champ->getVar('start')), 'end' => $tf->format($champ->getVar('end'))));
// Get category
$id_cat = rmc_server_var($_REQUEST, 'cat', 0);
if ($id_cat > 0) {
    $category = new MCHCategory($id_cat);
} else {
    $category = MCHFunctions::first_category();
}
$xoopsTpl->assign('category', array('id' => $category->id(), 'name' => $category->getVar('name'), 'desc' => $category->getVar('description')));
// Results
$data = MCHFunctions::latest_results($category->id(), $champ->id(), 20);
$xoopsTpl->assign('results', $data);
$categories = array();
MCHFunctions::categories_tree($categories);
foreach ($categories as $k => $cat) {
    $categories[$k]['guion'] = str_repeat("&#151;", $cat['indent']);