Esempio n. 1
0
/**
 * Provides a widget to specify the default image for posts
 */
function mw_widget_image()
{
    global $xoopsSecurity, $xoopsModuleConfig, $xoopsUser, $rm_config;
    $id = rmc_server_var($_REQUEST, 'id', 0);
    $type = rmc_server_var($_REQUEST, 'type', '');
    $op = rmc_server_var($_REQUEST, 'op', '');
    $edit = $op == 'edit' ? 1 : 0;
    $widget = array();
    $widget['title'] = __('Default Image', 'mywords');
    $util = new RMUtilities();
    if ($edit) {
        //Verificamos que el software sea válido
        if ($id <= 0) {
            $params = '';
        }
        $post = new MWPost($id);
        if ($post->isNew()) {
            $params = '';
        } else {
            $params = $post->getVar('image');
        }
    } else {
        $params = '';
    }
    $widget['content'] = '<form name="frmDefimage" id="frm-defimage" method="post">';
    $widget['content'] .= $util->image_manager('image', $params);
    $widget['content'] .= '</form>';
    return $widget;
}
Esempio n. 2
0
/**
 * Función para realizar búsquedas
 */
function qpages_search($qa, $andor, $limit, $offset, $userid)
{
    global $xoopsUser, $mc;
    include_once XOOPS_ROOT_PATH . '/modules/qpages/class/qppage.class.php';
    $mc = RMUtilities::module_config('qpages');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("qpages_pages");
    $adds = '';
    if (is_array($qa) && ($count = count($qa))) {
        $adds = '';
        for ($i = 0; $i < $count; $i++) {
            $adds .= $adds == '' ? "(titulo LIKE '%{$qa[$i]}%' OR titulo_amigo LIKE '%{$qa[$i]}%')" : " {$andor} (titulo LIKE '%{$qa[$i]}%' OR titulo_amigo LIKE '%{$qa[$i]}%')";
        }
    }
    $sql .= $adds != '' ? " WHERE {$adds}" : '';
    if ($userid > 0) {
        $sql .= ($adds != '' ? " AND " : " WHERE ") . "uid='{$userid}'";
    }
    $sql .= " ORDER BY modificado DESC";
    $i = 0;
    $result = $db->query($sql);
    $ret = array();
    while ($row = $db->fetchArray($result)) {
        $page = new QPPage();
        $page->assignVars($row);
        $ret[$i]['image'] = "images/page.png";
        $ret[$i]['link'] = $mc['links'] == 0 ? 'page.php?page=' . $page->getFriendTitle() : $page->getFriendTitle() . '/';
        $ret[$i]['title'] = $page->getTitle();
        $ret[$i]['time'] = $page->getDate();
        $ret[$i]['uid'] = $page->uid();
        $ret[$i]['desc'] = $page->getDescription();
        $i++;
    }
    return $ret;
}
Esempio n. 3
0
/**
 * Mostramos las página existentes
 */
function qpagesBlockPages($options)
{
    global $xoopsConfig;
    include_once XOOPS_ROOT_PATH . '/modules/qpages/class/qppage.class.php';
    $db =& XoopsDatabaseFactory::getDatabaseConnection();
    $mc =& RMUtilities::module_config('qpages');
    if (!defined('QP_URL')) {
        define('QP_URL', XOOPS_URL . ($mc['links'] ? $mc['basepath'] : '/modules/qpages'));
    }
    $sql = "SELECT * FROM " . $db->prefix("qpages_pages");
    if ($options[0] > 0) {
        $sql .= " WHERE cat='{$options['0']}'";
    }
    $sql .= " ORDER BY fecha DESC LIMIT 0,{$options['1']}";
    $block = array();
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $page = new QPPage();
        $page->assignVars($row);
        $rtn = array();
        $rtn['id'] = $page->getID();
        $rtn['titulo'] = $page->getTitle();
        $rtn['link'] = $page->getPermaLink();
        $block['pages'][] = $rtn;
    }
    return $block;
}
Esempio n. 4
0
/**
* @desc Realiza una búsqueda en el módulo desde EXM
*/
function pwSearch($queryarray, $andor, $limit, $offset, $userid)
{
    global $myts;
    include_once XOOPS_ROOT_PATH . "/modules/works/class/pwwork.class.php";
    $mc = RMUtilities::module_config('works');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT a.* FROM " . $db->prefix('pw_works') . " a INNER JOIN " . $db->prefix('pw_clients') . " b ON (a.public=1 AND a.client=b.id_client AND (";
    $sql1 = '';
    if (is_array($queryarray)) {
        foreach ($queryarray as $k) {
            $sql1 .= ($sql1 == '' ? "" : "{$andor}") . " (a.title LIKE '%{$k}%' OR a.short LIKE '%{$k}%' OR b.name LIKE '%{$k}%' OR b.business_name LIKE '%{$k}%') ";
        }
    }
    $sql1 .= "))";
    $sql1 .= " GROUP BY a.id_work ORDER BY a.created DESC LIMIT {$offset}, {$limit}";
    $result = $db->queryF($sql . $sql1);
    $ret = array();
    while ($row = $db->fetchArray($result)) {
        $work = new PWWork();
        $work->assignVars($row);
        $rtn = array();
        $rtn['image'] = 'images/works.png';
        $rtn['title'] = $work->title();
        $rtn['time'] = $work->created();
        $rtn['uid'] = '';
        $rtn['desc'] = $work->descShort();
        $rtn['link'] = $work->link();
        $ret[] = $rtn;
    }
    return $ret;
}
Esempio n. 5
0
/**
* Este archivo permite controlar el bloque o los bloques
* Bloques Existentes:
* 
* 1. Publicaciones Recientes
* 2. Publicaciones Populares (Mas Leídas)
* 3. Publicaciones Mejor Votadas
*/
function rd_block_resources($options)
{
    global $xoopsModule;
    include_once XOOPS_ROOT_PATH . '/modules/docs/class/rdresource.class.php';
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $mc = RMUtilities::module_config('docs');
    $sql = "SELECT * FROM " . $db->prefix("rd_resources") . ' WHERE public=1 AND approved=1';
    switch ($options[0]) {
        case 'recents':
            $sql .= " ORDER BY created DESC";
            break;
        case 'popular':
            $sql .= " ORDER BY `reads` DESC";
            break;
    }
    $sql .= " LIMIT 0, " . ($options[1] > 0 ? $options[1] : 5);
    $result = $db->query($sql);
    $block = array();
    while ($row = $db->fetchArray($result)) {
        $res = new RDResource();
        $res->assignVars($row);
        $ret = array();
        $ret['id'] = $res->id();
        $ret['title'] = $res->getVar('title');
        if ($options[2]) {
            $ret['desc'] = $options[3] == 0 ? $res->getVar('description') : TextCleaner::truncate($res->getVar('description'), $options[3]);
        }
        $ret['link'] = $res->permalink();
        $ret['author'] = sprintf(__('Created by %s', 'docs'), '<strong>' . $res->getVar('owname') . '</strong>');
        $ret['reads'] = sprintf(__('Viewed %s times', 'docs'), '<strong>' . $res->getVar('reads') . '</strong>');
        $block['resources'][] = $ret;
    }
    RMTemplate::get()->add_style('blocks.css', 'docs');
    return $block;
}
 /**
  * Obtiene el enlace a la categor?a
  */
 public function permalink()
 {
     $mc = RMUtilities::get()->module_config('mywords');
     $link = MWFunctions::get_url();
     $link .= $mc['permalinks'] == 1 ? '?cat=' . $this->id() : ($mc['permalinks'] == 2 ? 'category/' . $this->path() : 'category/' . $this->id());
     return $link;
 }
Esempio n. 7
0
function pw_comments_show($options)
{
    global $xoopsModule, $xoopsModuleConfig;
    include_once XOOPS_ROOT_PATH . '/modules/works/class/pwwork.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/works/class/pwclient.class.php';
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    if (isset($xoopsModule) && $xoopsModule->dirname() == 'works') {
        $mc =& $xoopsModuleConfig;
    } else {
        $mc =& RMUtilities::module_config('works');
    }
    $sql = "SELECT * FROM " . $db->prefix('pw_works') . " WHERE comment<>'' ORDER BY " . ($options[1] ? " created DESC " : " RAND() ");
    $sql .= " LIMIT 0," . $options[0];
    $result = $db->query($sql);
    $clients = array();
    while ($row = $db->fetchArray($result)) {
        $work = new PWWork();
        $work->assignVars($row);
        if (!isset($clients[$work->client()])) {
            $clients[$work->client()] = new PWClient($work->client(), 1);
        }
        $client =& $clients[$work->client()];
        $rtn = array();
        $rtn['client'] = $client->businessName();
        $rtn['link'] = $work->link();
        $rtn['comment'] = $work->comment();
        $block['works'][] = $rtn;
    }
    return $block;
}
 public function permalink()
 {
     $mc = RMUtilities::module_config('shop');
     $rtn = ShopFunctions::get_url();
     $rtn .= $mc['urlmode'] == 0 ? 'product.php?id=' . $this->id() : $this->getVar('nameid') . '/';
     return $rtn;
 }
 /**
  * Obtiene el enlace a la categor?a
  */
 public function permalink()
 {
     $mc = RMUtilities::module_config('shop');
     $link = ShopFunctions::get_url();
     $link .= $mc['urlmode'] == 0 ? '?cat=' . $this->id() : 'category/' . $this->path();
     return $link;
 }
Esempio n. 10
0
function pw_categories_show($options)
{
    global $xoopsModule, $xoopsModuleConfig;
    include_once XOOPS_ROOT_PATH . '/modules/works/class/pwwork.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/works/class/pwclient.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/works/class/pwcategory.class.php';
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    if (isset($xoopsModule) && $xoopsModule->dirname() == 'works') {
        $mc =& $xoopsModuleConfig;
    } else {
        $mc =& RMUtilities::module_config('works');
    }
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $result = $db->query("SELECT * FROM " . $db->prefix("pw_categos") . " ORDER BY name");
    $block = array();
    while ($row = $db->fetchArray($result)) {
        $cat = new PWCategory();
        $cat->assignVars($row);
        $ret = array();
        $ret['name'] = $row['name'];
        $ret['link'] = $cat->link();
        $block['categos'][] = $ret;
    }
    return $block;
}
Esempio n. 11
0
function showForm()
{
    global $db, $xoopsOption, $xoopsUser, $mc, $tpl, $xoopsConfig, $xoopsModuleConfig, $user, $xoopsSecurity;
    $xoopsOption['template_main'] = "gs_submit.html";
    $xoopsOption['module_subpage'] = 'submit';
    include 'header.php';
    GSFunctions::makeHeader();
    $mc =& $xoopsModuleConfig;
    $tpl->assign('lang_uploadyour', __('Upload your Pictures', 'galleries'));
    $tpl->assign('lang_step1', __('Step 1:', 'galleries'));
    $tpl->assign('lang_step2', __('Step 2:', 'galleries'));
    $tpl->assign('lang_step3', __('Step 3:', 'galleries'));
    $tpl->assign('lang_step4', __('Step 4:', 'galleries'));
    $tpl->assign('lang_choose', __('Select Files', 'galleries'));
    $tpl->assign('lang_privacy', __('Set Privacy', 'galleries'));
    $tpl->assign('lang_privateme', __('Private (<em>Only you will seee these pictures</em>)', 'galleries'));
    $tpl->assign('lang_privatef', __('For Friends (<em>Only you and your friends will see these pictures</em>)', 'galleries'));
    $tpl->assign('lang_public', __('Public (<em>Pictures will visible for all</em>)'));
    $tpl->assign('lang_upload', __('Upload Files', 'galleries'));
    $tpl->assign('lang_clicktou', __('Click to Upload', 'galleries'));
    $tpl->assign('lang_tagsesp', __('Specify tags to use', 'galleries'));
    $tpl->assign('lang_tagsdesc', __('Separate each tag with a comma (,).', 'galleries'));
    $tpl->assign('lang_maxsize', sprintf(__('The maximum file size allowed is <strong>%s</strong>.', 'galleries'), RMUtilities::formatBytesSize($mc['size_image'] * 1024)));
    $tpl->assign('used_graph', GSFunctions::makeQuota($user, false));
    $tpl->assign('form_action', GSFunctions::get_url() . ($mc['urlmode'] ? 'submit/' : '?submit=submit'));
    $tpl->assign('token', $xoopsSecurity->getTokenHTML());
    $used = round($user->usedQuota() / $user->quota() * 100) . '%';
    $tpl->assign('lang_used', sprintf(__('You have used <strong>%s</strong> of <strong>%s</strong> available. You left <strong>%s</strong>', 'galleries'), $used, RMUtilities::formatBytesSize($user->quota()), RMUtilities::formatBytesSize($user->usedQuota() >= $user->quota() ? 0 : $user->quota() - $user->usedQuota())));
    RMTemplate::get()->add_xoops_style('submit.css', 'galleries');
    include 'footer.php';
}
Esempio n. 12
0
 public function permalink()
 {
     $mc = RMSettings::module_settings('mywords');
     $rtn = MWFunctions::get_url();
     $rtn .= $mc->permalinks == 1 ? '?author=' . $this->id() : ($mc->permalinks == 2 ? "author/" . $this->getVar('shortname', 'n') . "/" : "author/" . RMUtilities::add_slash($this->id()));
     return $rtn;
 }
Esempio n. 13
0
 public function permalink()
 {
     $mc = RMUtilities::get()->module_config('mywords');
     $rtn = MWFunctions::get_url();
     $rtn .= $mc['permalinks'] == 1 ? '?author=' . $this->id() : ($mc['permalinks'] == 2 ? "author/" . $this->getVar('shortname', 'n') . "/" : "author/" . RMUtilities::add_slash($this->id()));
     return $rtn;
 }
Esempio n. 14
0
function xoops_module_pre_uninstall_galleries($mod)
{
    $dir = RMUtilities::module_config('galleries', 'storedir');
    if (is_dir($dir)) {
        RMUtilities::delete_directory($dir);
    }
    return true;
}
function dt_block_categories($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/dtransport/class/dtcategory.class.php';
    $rmu = RMUtilities::get();
    $rmf = RMFunctions::get();
    $mc = $rmu->module_config('dtransport');
    $url = $rmf->current_url();
    $rpath = parse_url($url);
    $xpath = parse_url(XOOPS_URL);
    if ($mc['permalinks']) {
        $params = trim(str_replace($xpath['path'] . '/' . trim($mc['htbase'], '/'), '', rtrim($rpath['path'], "/")), '/');
        $search = array('category', 'publisher', 'recents', 'popular', 'rated', 'updated');
        if ($params == '') {
            $params = array();
        } else {
            $params = explode("/", trim($params));
        }
        if (!empty($params) && $params[0] == 'category') {
            $db = XoopsDatabaseFactory::getDatabaseConnection();
            $params = explode("page", implode("/", array_slice($params, 1)));
            $path = explode("/", $params[0]);
            foreach ($path as $k) {
                if ($k == '') {
                    continue;
                }
                $category = new DTCategory();
                $sql = "SELECT * FROM " . $db->prefix("dtrans_categos") . " WHERE nameid='{$k}' AND parent='{$idp}'";
                $result = $db->query($sql);
                if ($db->getRowsNum($result) > 0) {
                    $row = $db->fetchArray($result);
                    $idp = $row['id_cat'];
                    $category->assignVars($row);
                } else {
                    $dtfunc->error_404();
                }
            }
        } else {
            $category = new DTCategory();
        }
    }
    $tpl = RMTemplate::get();
    $tpl->add_xoops_style('blocks.css', 'dtransport');
    include_once XOOPS_ROOT_PATH . '/modules/dtransport/class/dtfunctions.class.php';
    $categories = array();
    $dtfunc = new DTFunctions();
    $dtfunc->getCategos($categories, 0, $category->id(), array(), false, 1);
    $block = array();
    foreach ($categories as $cat) {
        if ($cat['jumps'] > $options[0] - 1 && $options[0] > 0) {
            continue;
        }
        $block['categories'][] = $cat;
    }
    if (!$category->isNew()) {
        $block['parent'] = array('name' => $category->name(), 'link' => $category->permalink());
    }
    return $block;
}
Esempio n. 16
0
 public function get_main_link()
 {
     $mc = RMUtilities::module_config('works');
     if ($mc['urlmode']) {
         return XOOPS_URL . $mc['htbase'];
     } else {
         return XOOPS_URL . '/modules/works';
     }
 }
Esempio n. 17
0
 public function get_main_link()
 {
     $mc = RMUtilities::module_config('qpages');
     if ($mc['links']) {
         return XOOPS_URL . $mc['basepath'];
     } else {
         return XOOPS_URL . '/modules/qpages';
     }
 }
 public function get_main_link()
 {
     $mc = RMUtilities::module_config('mywords');
     if ($mc['permalinks'] > 1) {
         return XOOPS_URL . $mc['basepath'];
     } else {
         return XOOPS_URL . '/modules/mywords';
     }
 }
Esempio n. 19
0
 public function permalink()
 {
     $rmu = RMUtilities::get();
     $mc = $rmu->module_config('dtransport');
     if ($mc['permalinks']) {
         return XOOPS_URL . '/' . trim($mc['htbase'], '/') . '/platform/' . $this->nameId() . '/';
     } else {
         return XOOPS_URL . '/modules/dtransport/index.php?p=platform&amp;id=' . $this->id();
     }
 }
Esempio n. 20
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;
}
Esempio n. 21
0
/**
 * Provides a widget to specify the default image for posts
 */
function mywords_widget_image($post = null)
{
    global $xoopsSecurity, $xoopsModuleConfig, $xoopsUser, $rm_config;
    $type = RMHttpRequest::request('type', 'string', '');
    $widget = array();
    $widget['title'] = __('Default Image', 'mywords');
    $util = new RMUtilities();
    if (isset($post) && is_a($post, 'MWPost')) {
        if ($post->isNew()) {
            $params = '';
        } else {
            $params = $post->getVar('image', 'e');
        }
    } else {
        $params = '';
    }
    $widget['content'] = '<form name="frmDefimage" id="frm-defimage" method="post">';
    $widget['content'] .= $util->image_manager('image', 'image', $params, array('accept' => 'thumbnail', 'multiple' => 'no'));
    $widget['content'] .= '</form>';
    return $widget;
}
Esempio n. 22
0
 public function eventRmcommonGetFeedsList($feeds)
 {
     load_mod_locale('galleries');
     include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsfunctions.class.php';
     $module = RMFunctions::load_module('galleries');
     $config = RMUtilities::module_config('galleries');
     $data = array('title' => $module->name(), 'url' => GSFunctions::get_url(), 'module' => 'galleries');
     $options[] = array('title' => __('All Recent Pictures', 'galleries'), 'params' => 'show=pictures', 'description' => __('Show all recent pictures', 'galleries'));
     $options[] = array('title' => __('All Recent Albums', 'galleries'), 'params' => 'show=albums', 'description' => __('Show all recent albums', 'galleries'));
     $feed = array('data' => $data, 'options' => $options);
     $feeds[] = $feed;
     return $feeds;
 }
 /**
  * Get the category link formated
  */
 public function permalink()
 {
     global $xoopsModule, $xoopsModuleConfig;
     if (isset($xoopsModule) && $xoopsModule->dirname() == 'match') {
         $mc =& $xoopsModuleConfig;
     } else {
         $mc = RMUtilities::module_config('match');
     }
     $link = XOOPS_URL . '/';
     if ($mc['urlmode']) {
         $link .= trim($mc['htbase'], '/') . '/?category=' . $this->id();
     } else {
         $link .= 'modules/match/index.php?cat=' . $this->id();
     }
     return $link;
 }
Esempio n. 24
0
 /**
  * Get the team link formated
  */
 public function permalink()
 {
     global $xoopsModule, $xoopsModuleConfig;
     if (isset($xoopsModule) && $xoopsModule->dirname() == 'match') {
         $mc =& $xoopsModuleConfig;
     } else {
         $mc = RMUtilities::module_config('match');
     }
     $link = XOOPS_URL . '/';
     if ($mc['urlmode']) {
         $link .= trim($mc['htbase'], '/') . '/player/' . $this->getVar('nameid') . '/';
     } else {
         $link .= 'modules/match/index.php?p=player&amp;id=' . $this->getVar('nameid');
     }
     return $link;
 }
Esempio n. 25
0
 /**
  * Constructor
  * @param <string> $caption
  * @param <string> $name Nombre identificador del campo
  * @param <string> $date Fecha en formato 'yyyy-mm-14'
  */
 function __construct($caption, $name, $date = '', $showtime = 0)
 {
     $this->setCaption($caption);
     $this->setName($name);
     $this->_date = $date;
     $this->_showtime = $showtime;
     if (!defined('RM_FRAME_DATETIME_CREATED')) {
         define('RM_FRAME_DATETIME_CREATED', 1);
     }
     // Necesario para incluir el script de fechas
     if (!defined('SCRIPT_PROTOTYPE_INCLUDED')) {
         $util =& RMUtilities::get();
     }
     if (defined('EXM_IS_CP') && EXM_IS_CP == true) {
         // This class must be instantiated before that the method ExmGUI::cp_head();
         RMTemplate::get()->add_script(RMCURL . '/include/js/dates.js');
     }
 }
Esempio n. 26
0
function mywordsBlockRecent($options)
{
    global $xoopsModuleConfig, $xoopsModule, $xoopsUser;
    $mc = $xoopsModule && $xoopsModule->getVar('dirname') == 'mywords' ? $xoopsModuleConfig : RMUtilities::module_config('mywords');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $by = '';
    switch ($options[1]) {
        case 'recent':
            $by = 'pubdate';
            break;
        case 'popular':
            $by = "`reads`";
            break;
        case 'comm':
            $by = "`comments`";
            break;
    }
    $posts = MWFunctions::get_posts_by_cat($options[5], 0, $options[0], $by, 'DESC');
    $block = array();
    foreach ($posts as $post) {
        $ret = array();
        $ret['id'] = $post->id();
        $ret['title'] = $post->getVar('title');
        $ret['link'] = $post->permalink();
        // Content
        if ($options[2]) {
            $ret['content'] = TextCleaner::getInstance()->truncate($post->content(true), $options[3]);
        }
        // Pubdate
        if ($options[4]) {
            $ret['date'] = formatTimestamp($post->getVar('pubdate'), 'c');
        }
        // Show reads
        if ($options[1] == 'popular') {
            $ret['hits'] = sprintf(__('%u Reads', 'mywords'), $post->getVar('reads'));
        } elseif ($options[1] == 'comm') {
            $ret['comments'] = sprintf(__('%u Comments', 'mywords'), $post->getVar('comments'));
        }
        $ret['time'] = $post->getVar('pubdate');
        $block['posts'][] = $ret;
    }
    RMTemplate::get()->add_xoops_style('mwblocks.css', 'mywords');
    return $block;
}
Esempio n. 27
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();
}
Esempio n. 28
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();
}
Esempio n. 29
0
function mch_role_bkshow($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/match/class/mchfunctions.php';
    RMTemplate::get()->add_xoops_style('blocks.css', 'match');
    $ch = rmc_server_var($_GET, 'champ', $options[0]);
    $champ = $ch <= 0 ? MCHFunctions::current_championship() : new MCHChampionship($ch);
    if (!is_object($champ)) {
        $champ = MCHFunctions::last_championship();
    }
    $ch = rmc_server_var($_GET, 'cat', $options[1]);
    $category = $ch <= 0 ? MCHFunctions::first_category() : new MCHCategory($ch);
    // Role
    $data = MCHFunctions::next_matches($category->id(), $champ->id(), $options[2]);
    $block = array();
    $block['role'] = $data;
    $mc = RMUtilities::module_config('match');
    $block['link'] = $mc['urlmode'] ? XOOPS_URL . '/' . $mc['htbase'] : XOOPS_URL . '/modules/match';
    $block['lang_viewrol'] = __('View full roleplay &raquo;');
    $block['category'] = $category->id();
    return $block;
}
Esempio n. 30
0
function shop_bk_products_show($options)
{
    include_once XOOPS_ROOT_PATH . '/modules/shop/class/shopproduct.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/shop/class/shopfunctions.php';
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $limit = $options[2] > 0 ? $options[2] : 5;
    $ord = $options[0] <= 0 ? ' `created` DESC' : 'RAND()';
    $mc = RMUtilities::module_config('shop', 'format');
    if ($options[1] != '') {
        $tp = $db->prefix("shop_products");
        $tc = $db->prefix("shop_categories");
        $tcp = $db->prefix("shop_catprods");
        $sql = "SELECT p.* FROM {$tp} as p, {$tcp} as r WHERE r.cat={$options['1']} AND p.id_product=r.product GROUP BY r.product";
    } else {
        $sql = "SELECT * FROM " . $db->prefix("shop_products");
    }
    $sql .= " ORDER BY {$ord} LIMIT 0,{$limit}";
    $result = $db->query($sql);
    $products = array();
    while ($row = $db->fetchArray($result)) {
        $prod = new ShopProduct();
        $prod->assignVars($row);
        $products[] = array('id' => $prod->id(), 'name' => $prod->getVar('name'), 'link' => $prod->permalink(), 'price' => sprintf($mc, number_format($prod->getVar('price'), 2)), 'type' => $prod->getVar('type') ? __('Digital', 'shop') : 'Product', 'stock' => $prod->getVar('available'), 'image' => $prod->getVar('image'));
    }
    $block['products'] = $products;
    unset($prod, $products, $sql, $result, $row, $ord, $limit, $db);
    $block['show_image'] = $options[3];
    $block['width'] = $options[4];
    $block['height'] = $options[5];
    $block['display'] = $options[6];
    $block['name'] = in_array("name", $options);
    $block['price'] = in_array("price", $options);
    $block['type'] = in_array("type", $options);
    $block['stock'] = in_array("stock", $options);
    $block['lang_stock'] = __('In stock', 'shop');
    $block['lang_nostock'] = __('Out of stock', 'shop');
    // Add styles
    RMTemplate::get()->add_style('blocks.css', 'shop');
    return $block;
}