Example #1
0
 function makeNews(&$comments, &$db, $table, $tbl_users, $start, $end, $title)
 {
     global $lng;
     $news = '';
     $result = $db->query("SELECT * FROM `" . $table . "`, `" . $tbl_users . "`\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `" . $table . "`.`userid` = `" . $tbl_users . "`.`userid` \r\n\t\t\t\t\t\t\t\t\t\t\t\tAND `timestamp`>" . $start . " \r\n\t\t\t\t\t\t\t\t\t\t\t\tAND `timestamp`<" . $end . " \r\n\t\t\t\t\t\t\t\t\t\t\t\tAND (`language` = '" . secureMySQL($lng) . "' OR `language` = '')\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND (`domainid` = 0 OR `domainid` = " . getCurrentDomainIndex() . ")\r\n\t\t\t\t\t\t\t\t\t\t\t\tORDER BY `timestamp` DESC;");
     while ($row = mysql_fetch_assoc($result)) {
         $row['time'] = timeElapsed($row['timestamp']);
         $row['url'] = makeURL('news', array('newsid' => $row['newsid']));
         $row['text'] = stripslashes($row['text']);
         $row['title'] = stripslashes($row['title']);
         $row['user_url'] = makeURL('profile', array('userid' => $row['userid']));
         $row['comments'] = $comments->count('news', $row['newsid']);
         $news[] = $row;
     }
     return array('title' => $title, 'news' => $news, 'news_count' => mysql_num_rows($result));
 }
Example #2
0
 function getMenu($parentid = 0, $view_menu = null, $grl = null, $submenu = true)
 {
     global $rights;
     global $current_language;
     global $config;
     if ($view_menu === null) {
         $view_menu = $rights->isAllowed('admin', 'config') === true ? true : false;
     }
     $lng = secureMySQL($current_language);
     $menu = array();
     if ($this->login->currentUser() !== false) {
         if ($grl === null) {
             $gr = array_row($rights->getGroups($this->login->currentUserID()), 'groupid');
             $gr[] = 0;
             $gr[] = -1;
             $grl = '`assigned_groupid` IN (' . implode(', ', $gr) . ')';
         }
         $sql = "SELECT * FROM `" . $this->table . "`\r\n\t\t\t\t\tWHERE " . $grl . "\r\n\t\t\t\t\tAND `parentid`=" . (int) $parentid . "\r\n\t\t\t\t\tAND (`language` = '" . $lng . "' OR `language` = '')\r\n\t\t\t\t\tAND (`domainid` = '" . getCurrentDomainIndex() . "' OR `domainid` = '')\r\n\t\t\t\t\tORDER BY `order` ASC;";
     } else {
         $sql = "SELECT * FROM `" . $this->table . "`\r\n\t\t\t\t\tWHERE (`requires_login`=0 AND `assigned_groupid` IN (0, -1)) \r\n\t\t\t\t\tAND `parentid`=" . (int) $parentid . "\r\n\t\t\t\t\tAND (`language` = '" . $lng . "' OR `language` = '')\r\n\t\t\t\t\tAND (`domainid` = '" . getCurrentDomainIndex() . "' OR `domainid` = '')\r\n\t\t\t\t\tORDER BY `order` ASC;";
     }
     $result = $this->db->query($sql);
     while ($row = mysql_fetch_assoc($result)) {
         if ($config->get('core', 'maintenance') == 0 || $view_menu || $row['mod'] == 'login') {
             if ($row['mod'] != '---') {
                 $entry = array();
                 if ($row['mod'] != 'url') {
                     $url = makeURL($row['mod']);
                 } else {
                     $url = $row['url'];
                 }
                 $children = $submenu ? $this->getSubMenu($row) : array();
                 $children = array_merge($children, $this->getMenu($row['menuid'], $view_menu, $grl, $submenu));
                 @($active = $_GET['mod'] == $row['mod'] || $_GET['key'] == $row['mod'] && $_GET['mod'] != 'admin');
                 @($entry = array('title' => $row['title'], 'url' => $url, 'mod' => $row['mod'], 'children' => $children, 'active' => $active, 'template' => $row['template']));
                 if ($active) {
                     $this->active_menu_entry = $entry;
                 }
                 if ($row['assigned_groupid'] > -1) {
                     $menu[] = $entry;
                 }
             }
         }
     }
     return $menu;
 }
Example #3
0
     }
     break;
 case 'manage':
     if ($isAllowed) {
         $breadcrumbs->addElement($lang->get('manage_movies'), makeURL($mod, array('mode' => 'manage')));
         $movies = $db->selectList('movies', '*', '1', '`order` ASC');
         $smarty->assign('movies', $movies);
         $smarty->assign('path', $template_dir . '/manage.tpl');
         break;
     }
 default:
     if ($isAllowed) {
         $menu->addSubElement($mod, $lang->get('manage_movies'), 'manage');
     }
     if ($movieid == 0) {
         $movies = $db->selectList('movies', '*', "`hidden`=0 AND (`language` = '' OR `language` = '" . $lng . "') AND (`domainid` = 0 OR `domainid`=" . @(int) getCurrentDomainIndex() . ")", '`order` ASC');
         foreach ($movies as $i => $movie) {
             $movies[$i]['description'] = $bbcode->parse($movie['description']);
         }
         $smarty->assign('movies', $movies);
         $smarty->assign('path', $template_dir . '/index.tpl');
         $smarty->assign('columns', $config->get($mod, 'columns'));
     } else {
         $smarty->assign('hd', $config->get($mod, 'high-definition'));
         $smarty->assign('autoplay', $config->get($mod, 'autoplay'));
         $movie = $db->selectOneRow('movies', '*', '`movieid` = ' . $movieid);
         $movie['description'] = $bbcode->parse($movie['description']);
         $smarty->assign('movie', $movie);
         $breadcrumbs->addElement($movie['title'], makeURL($mod, array('movieid' => $movieid)));
         $smarty->assign('path', $template_dir . '/movie.tpl');
     }
Example #4
0
<?php

if ($this->isInstalled('news')) {
    $topnews = $db->selectOneRow(MYSQL_TABLE_PREFIX . 'news', "*", "`domainid` = 0 OR `domainid` = " . getCurrentDomainIndex(), "`timestamp` DESC");
    $area['title'] = $lang->get('topnews') . ': ' . $topnews['title'];
    $area['content'] = cutString($bbcode->parse($topnews['preview']), 400, makeURL('news', array('newsid' => $topnews['newsid'])));
    $areas[] = $area;
}
Example #5
0
 function getRight()
 {
     global $db;
     return $db->selectList($this->table, "*", "`position`='right' AND `visible`=1 AND (`domainid` = 0 OR `domainid` = " . getCurrentDomainIndex() . ")", "`order` ASC");
 }
Example #6
0
} else {
    if ($isAllowed) {
        $menu->addSubElement($mod, $lang->get('edit_tags'), 'manage');
    }
    $toptext = $config->get($mod, 'top-text-' . $current_language);
    $headertext = $config->get($mod, 'header-' . $current_language);
    $smarty->assign('toptext', $toptext);
    $breadcrumbs->addElement($headertext, '');
    $smarty->assign('justify', $config->get($mod, 'justify'));
    $r['min'] = 25;
    $r['max'] = 120;
    $g['min'] = 25;
    $g['max'] = 206;
    $b['min'] = 112;
    $b['max'] = 250;
    $cloudtags = $db->selectList('tagcloud', '*', "(`language`='' OR `language`='" . $current_language . "') AND (`domainid` = 0 OR `domainid` = " . @(int) getCurrentDomainIndex() . ")", '`title` ASC');
    // Colorfy cloud tags
    for ($i = 0; $i < count($cloudtags); $i++) {
        $percent = (100 - $cloudtags[$i]['weight']) / 100;
        $r['diff'] = $r['max'] - $r['min'];
        $r['value'] = $r['diff'] * $percent + $r['min'];
        $g['diff'] = $g['max'] - $g['min'];
        $g['value'] = $g['diff'] * $percent + $g['min'];
        $b['diff'] = $b['max'] - $b['min'];
        $b['value'] = $b['diff'] * $percent + $b['min'];
        $r_hex = dechex($r['value']);
        $g_hex = dechex($g['value']);
        $b_hex = dechex($b['value']);
        $cloudtags[$i]['color'] = '#' . $r_hex . $g_hex . $b_hex;
    }
    $smarty->assign('tags', $cloudtags);
Example #7
0
<?php

$lang->addModSpecificLocalization('news');
global $current_language;
$limit = (int) $config->get('news', 'news-box-entries');
if ($limit == 0) {
    $limit = 5;
}
$tpl_file = $template_dir . "/default.tpl";
$tbl = 'news';
$list = $db->selectList($tbl, '*', "(`language`='" . secureMySQL($current_language) . "' OR `language`='') AND (`domainid` = 0 OR `domainid` = " . getCurrentDomainIndex() . ")", "`timestamp` DESC", $limit);
if (count($list) > 0) {
    foreach ($list as $i => $l) {
        $list[$i]['url'] = makeURL('news', array('newsid' => $l['newsid']));
        $list[$i]['timestamp_str'] = timeElapsed($l['timestamp']);
    }
}
$smarty->assign('news_box_entries', $list);
$visible = true;