Ejemplo n.º 1
0
function dt_block_items($options)
{
    global $db, $xoopsModule;
    include_once XOOPS_ROOT_PATH . '/modules/dtransport/class/dtsoftware.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/dtransport/class/dtfunctions.class.php';
    $tpl = RMTemplate::get();
    $tpl->add_xoops_style('blocks.css', 'dtransport');
    $dtfunc = new DTFunctions();
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $tbls = $db->prefix("dtrans_software");
    $tblc = $db->prefix("dtrans_catsoft");
    if ($options[1] > 0) {
        $sql = "SELECT s.* FROM {$tbls} as s, {$tblc} as c WHERE c.cat='" . $options[1] . "' AND s.id_soft=c.soft AND s.approved=1 AND s.`delete`=0";
    } else {
        $sql = "SELECT s.* FROM {$tbls} as s WHERE s.`approved`=1 AND s.`delete`=0 ";
    }
    if (trim($options[10]) > 0) {
        $user = new RMUser(trim($options[10]));
        if ($user->isNew()) {
            return;
        }
        $sql .= " AND s.uid='" . $user->id() . "' ";
    }
    if ($options[11] > 0) {
        $sql .= "AND id_cat='{$options['11']}'";
    }
    switch ($options[0]) {
        case 'all':
            $sql .= ' ORDER BY RAND() ';
            break;
        case 'recent':
            $sql .= " ORDER BY s.modified DESC, created DESC ";
            break;
        case 'popular':
            $sql .= " ORDER BY s.hits DESC ";
            break;
        case 'rated':
            $sql .= " ORDER BY s.`rating`/s.`votes` DESC ";
            break;
        case 'featured':
            $sql .= " AND featured=1 ORDER BY RAND() ";
            break;
        case 'daily':
            $sql = " AND daily=1 ORDER BY RAND() ";
            break;
    }
    $options[2] = $options[2] > 0 ? $options[2] : 5;
    $sql .= " LIMIT 0, {$options['2']}";
    $result = $db->query($sql);
    $block = array();
    while ($row = $db->fetchArray($result)) {
        $item = new DTSoftware();
        $item->assignVars($row);
        $rtn = array();
        $rtn['name'] = $item->getVar('name');
        $rtn['version'] = $item->getVar('version');
        if ($options[3]) {
            $img = new RMImage();
            $img->load_from_params($item->getVar('image'));
            $rtn['image'] = $img->get_version($options[11]);
        }
        if ($options[4]) {
            $rtn['description'] = $item->getVar('shortdesc');
        }
        if ($options[5]) {
            $rtn['hits'] = sprintf(__('Downloaded %s times.', 'dtransport'), '<strong>' . $item->getVar('hits') . '</strong>');
        }
        if ($options[6]) {
            $rtn['urate'] = @number_format($item->getVar('rate') / $item->getVar('votes'), 1);
        }
        if ($options[7]) {
            $rtn['siterate'] = DTFunctions::ratingStars($item->getVar('siterate'));
        }
        $rtn['link'] = $item->permalink();
        $rtn['metas'] = $dtfunc->get_metas('down', $item->id());
        if ($options[9]) {
            $rtn['author'] = array('name' => $item->getVar('author_name'), 'url' => $item->getVar('author_url'));
        }
        $block['downs'][] = $rtn;
    }
    $block['showbutton'] = $options[8];
    $block['downlang'] = __('Download', 'dtransport');
    $block['lang_urate'] = __('User rating: %s', 'dtransport');
    $block['lang_author'] = __('Author: %s', 'dtransport');
    $block['langhits'] = _BK_DT_HITSTEXT;
    $block['langurate'] = _BK_DT_URATETEXT;
    $block['languser'] = _BK_DT_USERBY;
    return $block;
}
Ejemplo n.º 2
0
    default:
        $rss_channel['title'] = sprintf(__('Posts in %s', 'mywords'), $xoopsConfig['sitename']);
        $rss_channel['link'] = XOOPS_URL . ($config->permalinks ? $config->basepath : '/modules/mywords');
        $rss_channel['description'] = __('All recent published posts', 'mywords');
        $rss_channel['lastbuild'] = formatTimestamp(time(), 'rss');
        $rss_channel['webmaster'] = checkEmail($xoopsConfig['adminmail'], true);
        $rss_channel['editor'] = checkEmail($xoopsConfig['adminmail'], true);
        $rss_channel['category'] = 'Blog';
        $rss_channel['generator'] = 'Common Utilities';
        $rss_channel['language'] = RMCLANG;
        // Get posts
        $posts = MWFunctions::get_posts(0, 10);
        $rss_items = array();
        foreach ($posts as $post) {
            $item = array();
            $item['title'] = $post->getVar('title');
            $item['link'] = $post->permalink();
            $img = new RMImage();
            $img->load_from_params($post->getVar('image', 'e'));
            if (!$img->isNew()) {
                $image = '<img src="' . $img->url() . '" alt="' . $post->getVar('title') . '" /><br />';
            } else {
                $image = '';
            }
            $item['description'] = XoopsLocal::convert_encoding(htmlspecialchars($image . $post->content(true), ENT_QUOTES));
            $item['pubdate'] = formatTimestamp($post->getVar('pubdate'), 'rss');
            $item['guid'] = $post->permalink();
            $rss_items[] = $item;
        }
        break;
}
Ejemplo n.º 3
0
 /**
  * Muestra los controles para lanzar el administrador de imágenes
  * desde cualqueir punto
  * @param string Element name for inputs
  */
 public function image_manager($name, $default = '')
 {
     if ($default != '') {
         $img = new RMImage();
         $img->load_from_params($default);
     }
     $ret = '<div id="' . $name . '-container" class="rmimage_container">';
     $ret .= '<div class="thumbnail">';
     if ($default != '' && !$img->isNew()) {
         $ret .= '<a href="' . $img->url() . '" target="_blank"><img src="' . $img->get_smallest() . '" /></a>';
         $ret .= '<input type="hidden" name="' . $name . '" id="' . $name . '" value="' . $default . '" />';
         $ret .= '<br /><a href="#" class="removeButton removeButton-' . $name . '">' . __('Remove Image', 'rmcommon') . '</a>';
     } else {
         $ret .= '<input type="hidden" name="' . $name . '" id="' . $name . '" value="" />';
     }
     $ret .= '</div>';
     $ret .= '<span class="image_manager_launcher button buttonGreen">' . __('Image manager...', 'rmcommon') . '</span>';
     $ret .= '</div>';
     $tpl = RMTemplate::get();
     $tpl->add_head_script('var imgmgr_title = "' . __('Image Manager', 'rmcommon') . '"' . "\n" . 'var mgrURL = "' . RMCURL . '/include/tiny-images.php";');
     $tpl->add_local_script('image_mgr_launcher.js', 'rmcommon', 'include');
     return $ret;
 }
Ejemplo n.º 4
0
    mkdir($updir);
    chmod($updir, octdec('0777'));
}
if (!file_exists($updir . '/sizes')) {
    mkdir($updir . '/sizes');
    chmod($updir . '/sizes', octdec('0777'));
}
include RMCPATH . '/class/uploader.php';
$uploader = new RMFileUploader($updir, $cat->max_file_size(), array('gif', 'jpg', 'jpeg', 'png'));
$err = array();
if (!$uploader->fetchMedia('Filedata')) {
    error($uploader->getErrors());
}
if (!$uploader->upload()) {
    error($uploader->getErrors());
}
// Insertamos el archivo en la base de datos
$image = new RMImage();
$image->setVar('title', $uploader->savedFileName);
$image->setVar('date', time());
$image->setVar('file', $uploader->savedFileName);
$image->setVar('cat', $cat->id());
$image->setVar('uid', $xoopsUser->uid());
if (!$image->save()) {
    unlink($uploader->savedDestination);
    error(__('File could not be inserted to database!', 'rmcommon'));
}
$ret['message'] = '1';
$ret['id'] = $image->id();
echo json_encode($ret);
die;
Ejemplo n.º 5
0
    redirect_header($item->permalink(), 1, __('Sorry, you don\'t have permission to download this file!', 'dtransport'));
}
// Comprobamos los límites
if ($item->getVar('limits') > 0) {
    if ($item->downloadsCount() >= $item->getVar('limits')) {
        redirect_header($item->permalink(), 1, __('You have reached your download limit for this file!', 'dtransport'));
    }
}
// Verificamos si la descarga se debe realizar
$token = isset($_SESSION['dttoken']) ? $_SESSION['dttoken'] : '';
if ($token == '' || !$xoopsSecurity->validateToken($token)) {
    $_SESSION['dttoken'] = $xoopsSecurity->createToken();
    $xoopsOption['template_main'] = 'dtrans_getfile.html';
    $xoopsOption['module_subpage'] = 'getfile';
    include 'header.php';
    $img = new RMImage();
    $img->load_from_params($item->getVar('image'));
    $xoopsTpl->assign('item', array('title' => $item->getVar('name'), 'image' => $img->get_smallest(), 'link' => $item->permalink()));
    $xoopsTpl->assign('lang_message', sprintf(__('Your %s download will start shortly...', 'dtransport'), '<a href="' . $item->permalink() . '">' . $item->getVar('name') . '</a>'));
    $xoopsTpl->assign('lang_problems', sprintf(__('Problems with the download? Please %s to download immediately.', 'dtransport'), '<a href="' . $file->permalink() . '">' . __('use this link', 'dtransport') . '</a>'));
    $tpl->add_style('main.css', 'dtransport');
    $tpl->add_local_script('main.js', 'dtransport');
    $tpl->add_head_script('var down_message = "' . sprintf(__('Your %s download will start in {x} seconds...', 'dtransport'), '<a href=\'' . $item->permalink() . '\'>' . $item->getVar('name') . '</a>') . '";');
    $tpl->add_head_script('var timeCounter = ' . $mc['pause'] . ";\nvar dlink = '" . $file->permalink() . "';");
    $dtfunc->makeHeader();
    include 'footer.php';
    die;
}
// Comprobamos si el archivo es seguro o no
if (!$item->getVar('secure')) {
    // Comprobamos si es un archivo remoto o uno local
Ejemplo n.º 6
0
/**
* This function deletes all images in a category and the category
*/
function delete_category()
{
    global $xoopsSecurity;
    $id = rmc_server_var($_GET, 'id', 0);
    if (!$xoopsSecurity->check()) {
        redirectMsg('images.php?action=showcats', __('Operation not allowed!', 'rmcommon'), 1);
        die;
    }
    if ($id <= 0) {
        redirectMsg('images.php?action=showcats', __('Category ID not provided', 'rmcommon'), 1);
        die;
    }
    $cat = new RMImageCategory($id);
    if ($cat->isNew()) {
        redirectMsg('images.php?action=showcats', __('Category not found', 'rmcommon'), 1);
        die;
    }
    $sizes = array();
    foreach ($cat->getVar('sizes') as $size) {
        if ($size['width'] <= 0) {
            continue;
        }
        $sizes[] = '_' . $size['width'] . 'x' . $size['height'];
    }
    $db = Database::getInstance();
    $sql = "SELECT * FROM " . $db->prefix("rmc_images") . " WHERE cat='" . $cat->id() . "'";
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $image = new RMImage();
        $image->assignVars($row);
        $updir = XOOPS_UPLOAD_PATH . '/' . date('Y', $image->getVar('date')) . '/' . date('m', time());
        $fd = pathinfo($image->getVar('file'));
        foreach ($sizes as $size) {
            $file = $updir . '/sizes/' . $fd['filename'] . $size . '.' . $fd['extension'];
            @unlink($file);
        }
        $file = $updir . '/' . $image->getVar('file');
        @unlink($file);
        $image->delete();
    }
    if ($cat->delete()) {
        redirectMsg('images.php?action=showcats', __('Category deleted successfully!', 'rmcommon'), 0);
    } else {
        redirectMsg('images.php?action=showcats', __('Errors ocurred while deleting the category', 'rmcommon') . '<br />' . $cat->errors(), 0);
    }
}
Ejemplo n.º 7
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();
}
Ejemplo n.º 8
0
 $authors = array();
 $category = $cat;
 $sizes = $category->getVar('sizes');
 $current_size = array();
 foreach ($sizes as $size) {
     if (empty($current_size)) {
         $current_size = $size;
     } else {
         if ($current_size['width'] >= $size['width'] && $size['width'] > 0) {
             $current_size = $size;
         }
     }
 }
 $mimes = (include XOOPS_ROOT_PATH . '/include/mimetypes.inc.php');
 while ($row = $db->fetchArray($result)) {
     $img = new RMImage();
     $img->assignVars($row);
     if (!isset($categories[$img->getVar('cat')])) {
         $categories[$img->getVar('cat')] = new RMImageCategory($img->getVar('cat'));
     }
     if (!isset($authors[$img->getVar('uid')])) {
         $authors[$img->getVar('uid')] = new XoopsUser($img->getVar('uid'));
     }
     $fd = pathinfo($img->getVar('file'));
     $filesurl = XOOPS_UPLOAD_URL . '/' . date('Y', $img->getVar('date')) . '/' . date('m', $img->getVar('date'));
     $thumb = date('Y', $img->getVar('date')) . '/' . date('m', $img->getVar('date')) . '/sizes/' . $fd['filename'] . '_' . $current_size['width'] . 'x' . $current_size['height'] . '.' . $fd['extension'];
     if (!file_exists(XOOPS_UPLOAD_PATH . '/' . $thumb)) {
         $thumb = date('Y', $img->getVar('date')) . '/' . date('m', $img->getVar('date')) . '/' . $fd['filename'] . '.' . $fd['extension'];
     }
     $ret = array('id' => $img->id(), 'title' => $img->getVar('title'), 'date' => formatTimestamp($img->getVar('date'), 'l'), 'desc' => $img->getVar('desc', 'n'), 'cat' => $categories[$img->getVar('cat')]->getVar('name'), 'author' => $authors[$img->getVar('uid')], 'thumb' => XOOPS_UPLOAD_URL . '/' . $thumb, 'url' => $filesurl, 'file' => $fd['filename'], 'extension' => $fd['extension'], 'mime' => isset($mimes[$fd['extension']]) ? $mimes[$fd['extension']] : 'application/octet-stream', 'links' => array('file' => array('caption' => __('File URL', 'rmcommon'), 'value' => XOOPS_UPLOAD_URL . '/' . date('Y', $img->getVar('date')) . '/' . date('m', $img->getVar('date')) . '/' . $img->getVar('file')), 'none' => array('caption' => __('None', 'rmcommon'), 'value' => '')));
     $images[] = RMEvents::get()->run_event('rmcommon.loading.single.editorimgs', $ret, rmc_server_var($_REQUEST, 'url', ''));
Ejemplo n.º 9
0
    $categories = array();
    $authors = array();
    $category = $cat;
    $sizes = $category->getVar('sizes');
    $current_size = array();
    foreach ($sizes as $size) {
        if (empty($current_size)) {
            $current_size = $size;
        } else {
            if ($current_size['width'] >= $size['width'] && $size['width'] > 0) {
                $current_size = $size;
            }
        }
    }
    while ($row = $db->fetchArray($result)) {
        $img = new RMImage();
        $img->assignVars($row);
        $fd = pathinfo($img->getVar('file'));
        $filesurl = XOOPS_UPLOAD_URL . '/' . date('Y', $img->getVar('date')) . '/' . date('m', $img->getVar('date'));
        $thumb = date('Y', $img->getVar('date')) . '/' . date('m', $img->getVar('date')) . '/sizes/' . $fd['filename'] . '-' . $current_size['name'] . '.' . $fd['extension'];
        if (!file_exists(XOOPS_UPLOAD_PATH . '/' . $thumb)) {
            $thumb = date('Y', $img->getVar('date')) . '/' . date('m', $img->getVar('date')) . '/' . $fd['filename'] . '.' . $fd['extension'];
        }
        $images[] = array('id' => $img->id(), 'title' => $img->getVar('title'), 'thumb' => XOOPS_UPLOAD_URL . '/' . $thumb);
    }
    include RMTemplate::get()->get_template('rmc-images-list-editor.php', 'module', 'rmcommon');
} elseif ($action == 'image-details') {
    function images_send_json($data)
    {
        header('Cache-Control: no-cache, must-revalidate');
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
Ejemplo n.º 10
0
 /**
  * Muestra los controles para lanzar el administrador de imágenes
  * desde cualqueir punto
  * @param string $name Element name for inputs
  * @param string $id ID for this element
  * @param string $default Default value for field
  * @param array $data Array of data that will be inserted as data-{key} in HTML code
  * @return string
  */
 public function image_manager($name, $id = '', $default = '', $data = array())
 {
     $id = $id == '' ? $name : $id;
     if ($default != '') {
         $img = new RMImage();
         $img->load_from_params($default);
     }
     $ret = '<div id="' . $id . '-container" class="rmimage_container"';
     foreach ($data as $key => $value) {
         $ret .= ' data-' . $key . '="' . $value . '"';
     }
     $ret .= '>';
     $ret .= '<div class="thumbnail">';
     if ($default != '' && !$img->isNew()) {
         $ret .= '<a href="' . $img->url() . '" target="_blank"><img src="' . $img->get_by_size(300) . '" /></a>';
         $ret .= '<input type="hidden" name="' . $name . '" id="' . $id . '" value="' . $default . '" />';
         $ret .= '<br /><a href="#" class="removeButton removeButton-' . $id . '">' . __('Remove Image', 'rmcommon') . '</a>';
     } else {
         $ret .= '<input type="hidden" name="' . $name . '" id="' . $id . '" value="" />';
     }
     $ret .= '</div>';
     $ret .= '<span class="image_manager_launcher btn btn-success">' . __('Image manager...', 'rmcommon') . '</span>';
     $ret .= '</div>';
     $tpl = RMTemplate::get();
     $tpl->add_head_script('var imgmgr_title = "' . __('Image Manager', 'rmcommon') . '"' . "\n" . 'var mgrURL = "' . RMCURL . '/include/tiny-images.php";');
     $tpl->add_script('cu-image-mgr.js', 'rmcommon');
     return $ret;
 }
Ejemplo n.º 11
0
 /**
  * Get an image from image manager
  * @param $id int Image id
  * @param string Size name from category
  */
 function get_image($id, $size = '')
 {
     if ($id <= 0) {
         return false;
     }
     $img = new RMImage($id);
     if ($img->isNew()) {
         return false;
     }
     $cat = new RMImageCategory($img->getVar('cat'));
     $sizes = $cat->getVar('sizes');
     foreach ($sizes as $s) {
         if ($s['name'] == $size) {
             break;
         }
     }
     $date = explode('-', date('d-m-Y', $img->getVar('date')));
     $file = XOOPS_UPLOAD_URL . '/' . $date[2] . '/' . $date[1] . '/';
     if ($size == '') {
         $file .= $img->getVar('file');
         return $file;
     }
     $file .= 'sizes/' . substr($img->getVar('file'), 0, -4) . '_' . $s['width'] . 'x' . $s['height'] . substr($img->getVar('file'), -4);
     if (!is_file(str_replace(XOOPS_URL, XOOPS_ROOT_PATH, $file))) {
         return $img->getOriginal();
     }
     return $file;
 }
Ejemplo n.º 12
0
 /**
  * Get the default image according to specified size
  * @param string Size name to get
  * @return string
  */
 public function image()
 {
     if ($this->getVar('image', 'e') == '') {
         return '';
     }
     return RMImage::get()->load_from_params($this->getVar('image', 'e'));
 }
Ejemplo n.º 13
0
 /**
  * @desc Genera un array con los datos de un elemento específico
  * @param object {@link DTSoftware()}
  * @return array
  */
 public function createItemData(DTSoftware &$item)
 {
     global $mc, $xoopsUser;
     if (!$mc) {
         $mc = RMUtilities::module_config('dtransport');
     }
     $rmfunc = RMFunctions::get();
     $data = array();
     $data['link'] = $item->permalink();
     // Vinculo para detalles
     $data['dlink'] = $item->permalink(0, 'download');
     // Vinculo de descarga
     $data['id'] = $item->id();
     $data['name'] = $item->getVar('name');
     $data['description'] = $item->getVar('shortdesc');
     $data['votes'] = $item->getVar('votes');
     $data['comments'] = $item->getVar('comments');
     $data['siterate'] = DTFunctions::ratingStars($item->getVar('siterate'));
     $data['rating'] = @number_format($item->getVar('rating') / $item->getVar('votes'), 1);
     $data['language'] = $item->getVar('langs');
     // Image
     $img = new RMImage();
     $img->load_from_params($item->getVar('image'));
     $data['image'] = $img->get_smallest();
     $data['created'] = formatTimestamp($item->getVar('created'), 's');
     if ($item->getVar('created') < $item->getVar('modified')) {
         $data['modified'] = formatTimestamp($item->getVar('modified'), 's');
     }
     $data['is_new'] = $item->getVar('created') > time() - $mc['new'] * 86400;
     $data['is_updated'] = $data['is_new'] ? false : $item->getVar('modified') > time() - $mc['update'] * 86400;
     $data['approved'] = $item->getVar('approved');
     $data['downs'] = $item->getVar('hits');
     $data['screens'] = $item->getVar('screens');
     $data['featured'] = $item->getVar('featured');
     $data['nameid'] = $item->getVar('nameid');
     $data['candownload'] = $item->canDownload($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS);
     // Licencias
     $data['lics'] = '';
     foreach ($item->licences(true) as $lic) {
         $data['lics'] .= $data['lics'] == '' ? '<a href="' . $lic->link() . '" target="_blank">' . $lic->name() . '</a>' : ', <a href="' . $lic->link() . '" target="_blank">' . $lic->name() . '</a>';
     }
     //  Plataformas
     $data['os'] = '';
     foreach ($item->platforms(true) as $os) {
         $data['os'] .= $data['os'] == '' ? $os->name() : ', ' . $os->name();
     }
     $data['metas'] = $this->get_metas('down', $item->id());
     return $data;
 }
Ejemplo n.º 14
0
include 'header.php';
$xoopsTpl->assign('dtrans_option', 'details');
$dtfunc->makeHeader();
$candownload = $item->canDownload($xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS);
// Enlaces del elemento
$data = array();
$data['link'] = $item->permalink();
$data['screens'] = $item->permalink(0, 'screens');
$data['download'] = $candownload ? $item->permalink(0, 'download') : '';
$data['features'] = $item->permalink(0, 'features');
$data['logs'] = $item->permalink(0, 'logs');
// Datos generales
$data['name'] = $item->getVar('name');
$data['version'] = $item->getVar('version');
// Imagen por defecto
$img = new RMImage();
$img->load_from_params($item->getVar('image'));
$data['image'] = $img->url();
$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());
}
Ejemplo n.º 15
0
// Plugins?
$post_arr = RMEvents::get()->run_event('mywords.view.post', $post_arr, $post);
$xoopsTpl->assign('post', $post_arr);
// Related posts
if ($xoopsModuleConfig['related']) {
    $rtags = $post->tags();
    $tt = array();
    foreach ($rtags as $tag) {
        $tt[] = $tag['id_tag'];
    }
    unset($rtags, $tag);
    $related = MWFunctions::get_posts_by_tag($tt, 0, $xoopsModuleConfig['related_num'], 'RAND()', '', 'publish', $post->id());
    unset($tt);
    $tf = new RMTimeFormatter(0, "%d% %T%, %Y%");
    foreach ($related as $rpost) {
        $xoopsTpl->append('relatedPosts', array('title' => $rpost->getVar('title'), 'pubdate' => $tf->format($rpost->getVar('pubdate')), 'link' => $rpost->permalink(), 'image' => RMImage::get()->load_from_params($rpost->image)));
    }
}
// Social sites
if ($xoopsModuleConfig['showbookmarks']) {
    foreach ($socials as $site) {
        $xoopsTpl->append('socials', array('title' => $site->getVar('title'), 'icon' => $site->getVar('icon'), 'url' => $site->link($post->getVar('title'), $post->permalink(), TextCleaner::truncate($post->content(true), 60)), 'alt' => $site->getVar('alt')));
    }
}
unset($tags_list);
// Comments
// When use the common utilities comments system you can choose between
// use of Common Utilities templates or use your own templates
// We will use MyWords included templates
if ($post->getVar('comstatus')) {
    $comms = RMFunctions::get_comments('mywords', 'post=' . $post->id(), 'module', 0, null, false);