Exemplo n.º 1
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;
}
Exemplo n.º 2
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;
}
Exemplo 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;
 }
Exemplo n.º 4
0
}
// 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
    if ($file->remote()) {
Exemplo n.º 5
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;
 }
Exemplo n.º 6
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;
 }