Example #1
0
function get_teams()
{
    global $db;
    $tpl = new smarty();
    if (@$_GET['ajax']) {
        ob_end_clean();
    }
    $teams = array();
    $result = $db->query('SELECT tname, tID, info FROM ' . DB_PRE . 'ecp_teams ORDER BY posi ASC');
    while ($row = mysql_fetch_assoc($result)) {
        $members = array();
        $subresult = $db->query('SELECT `username`, `mID`, `userID`, `name`, `aufgabe`, `aktiv`, country FROM ' . DB_PRE . 'ecp_members LEFT JOIN ' . DB_PRE . 'ecp_user ON (ID = userID) WHERE teamID = ' . $row['tID'] . ' ORDER BY posi ASC');
        while ($subrow = mysql_fetch_assoc($subresult)) {
            $subrow['aktiv'] ? $subrow['aktiv'] = '<span class="member_aktiv" style="cursor:pointer" onclick="member_switch_status(' . $row['tID'] . ', ' . $subrow['userID'] . ');">' . AKTIV . '</span>' : ($subrow['aktiv'] = '<span style="cursor:pointer" class="member_inaktiv" onclick="member_switch_status(' . $row['tID'] . ', ' . $subrow['userID'] . ');">' . INAKTIV . '</span>');
            if ($subrow['name'] != '') {
                $subrow['username'] = $subrow['name'];
            }
            $members[] = $subrow;
        }
        $row['members'] = $members;
        $teams[] = $row;
    }
    $tpl->assign('teams', $teams);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/teams_overview.html');
    $content = ob_get_contents();
    ob_end_clean();
    if (@$_GET['ajax']) {
        echo html_ajax_convert($content);
        die;
    }
    main_content(OVERVIEW, '<div id="teams_overview">' . $content . '</div>', '', 1);
}
Example #2
0
function get_links()
{
    global $db;
    if (!isset($_SESSION['rights']['admin']['links']) and !isset($_SESSION['rights']['superadmin'])) {
        echo NO_ADMIN_RIGHTS;
    } else {
        $tpl = new smarty();
        if (@$_GET['ajax']) {
            ob_end_clean();
        }
        $links = array();
        $result = $db->query('SELECT `linkID`, `name`, `url`, `bannerurl`, `beschreibung`, `hits` FROM ' . DB_PRE . 'ecp_links ORDER BY name ASC');
        while ($row = mysql_fetch_assoc($result)) {
            $links[] = $row;
        }
        $tpl->assign('links', $links);
        ob_start();
        $tpl->display(DESIGN . '/tpl/admin/links_overview.html');
        $content = ob_get_contents();
        ob_end_clean();
        if (@$_GET['ajax']) {
            echo html_ajax_convert($content);
            die;
        }
        main_content(OVERVIEW, '<div id="links_overview">' . $content . '</div>', '', 1);
    }
}
Example #3
0
function shoutbox()
{
    global $db, $countries;
    $tpl = new smarty();
    $anzahl = $db->result(DB_PRE . 'ecp_comments', 'COUNT(comID)', 'bereich="shoutbox"');
    if ($anzahl) {
        $limits = get_sql_limit($anzahl, LIMIT_SHOUTBOX);
        $shouts = array();
        $db->query('SELECT comID, country, username, userID, author, datum, beitrag FROM ' . DB_PRE . 'ecp_comments LEFT JOIN ' . DB_PRE . 'ecp_user ON userID = ID WHERE bereich="shoutbox" ORDER BY datum DESC LIMIT ' . $limits[1] . ',' . LIMIT_SHOUTBOX);
        $anzahl -= $limits[1];
        while ($row = $db->fetch_assoc()) {
            $row['nr'] = format_nr($anzahl--, 0);
            $row['countryname'] = @$countries[$row['country']];
            $row['datum'] = date(LONG_DATE, $row['datum']);
            $shouts[] = $row;
        }
        $tpl->assign('shoutbox', $shouts);
        if ($limits[0] > 1) {
            $tpl->assign('seiten', makepagelink_ajax('?section=shoutbox', 'return load_shout_page({nr});', @$_GET['page'], $limits[0]));
        }
        ob_start();
        $tpl->display(DESIGN . '/tpl/shoutbox/shoutbox.html');
        $content = ob_get_contents();
        ob_end_clean();
        main_content(SHOUTBOX, '<div id="shout_overview">' . $content . '</div>', '', 1);
    } else {
        table(INFO, NO_ENTRIES);
    }
}
Example #4
0
function get_server()
{
    global $db;
    if (!isset($_SESSION['rights']['admin']['server']) and !isset($_SESSION['rights']['superadmin'])) {
        echo NO_ADMIN_RIGHTS;
    } else {
        $tpl = new smarty();
        if (@$_GET['ajax']) {
            ob_end_clean();
        }
        $server = array();
        $result = $db->query('SELECT `serverID`, `gamename`, response, `gametype`, `aktiv`, `displaymenu`, `ip`, `port`, `queryport`, `stat` FROM ' . DB_PRE . 'ecp_server ORDER BY posi ASC');
        while ($row = mysql_fetch_assoc($result)) {
            $data = unserialize($row['response']);
            $row['path'] = 'images/server/maps/' . $row['gametype'] . '/' . $data['s']['game'] . '/' . $data['s']['map'] . '.jpg';
            $server[] = $row;
        }
        $tpl->assign('server', $server);
        ob_start();
        $tpl->display(DESIGN . '/tpl/admin/server_overview.html');
        $content = ob_get_contents();
        ob_end_clean();
        if (@$_GET['ajax']) {
            echo html_ajax_convert($content);
            die;
        }
        main_content(OVERVIEW, '<div id="server_overview">' . $content . '</div>', '', 1);
    }
}
Example #5
0
 function admin_texte()
 {
     global $db, $countries;
     if (isset($_POST['submit'])) {
         foreach ($_POST as $key => $value) {
             if (strpos($key, '_h_')) {
                 $lang = substr($key, 0, strpos($key, '_'));
                 $name = substr($key, strpos($key, '_') + 3);
                 $sql = sprintf('UPDATE ' . DB_PRE . 'ecp_texte SET content = \'%s\', content2 = \'%s\' WHERE name= \'%s\' AND lang = \'%s\';', strsave($_POST[$lang . '_' . $name]), strsave($value), strsave($name), strsave($lang));
                 $db->query($sql);
             }
         }
         header('Location: ?section=admin&site=texte');
     } else {
         $tpl = new smarty();
         $lang = get_languages();
         $db->query('SELECT * FROM ' . DB_PRE . 'ecp_texte ORDER BY lang ASC');
         while ($row = $db->fetch_assoc()) {
             foreach ($lang as $key => $value) {
                 if ($value['lang'] == $row['lang']) {
                     $lang[$key]['data'][$row['name']] = htmlspecialchars($row['content']);
                     $lang[$key]['headline'][$row['name']] = htmlspecialchars($row['content2']);
                 }
             }
         }
         $tpl->assign('lang', $lang);
         ob_start();
         $tpl->display(DESIGN . '/tpl/admin/texte.html');
         $content = ob_get_contents();
         ob_end_clean();
         main_content(TEXTE, $content, '', 1);
     }
 }
Example #6
0
function admin_joinus()
{
    global $db, $countries;
    $tpl = new smarty();
    $db->query('SELECT tname, `joinID`, `name`, b.username, b.email, b.icq, b.msn, `age`, b.country, `teamID`, `comment`, `IP`, `datum`, `closed`, `closedby`, a.username as closedby_username FROM ' . DB_PRE . 'ecp_joinus as b LEFT JOIN ' . DB_PRE . 'ecp_teams ON (teamID = tID) LEFT JOIN ' . DB_PRE . 'ecp_user as a ON (ID=closedby) ORDER BY closed ASC, datum ASC');
    $joinus = array();
    while ($row = $db->fetch_assoc()) {
        $row['datum'] = date(SHORT_DATE, $row['datum']);
        if ($row['joinID'] == (int) @$_GET['id']) {
            $spe = $row;
        }
        $joinus[] = $row;
    }
    if (@$spe) {
        ob_start();
        $tpl1 = new Smarty();
        foreach ($spe as $key => $value) {
            $tpl1->assign($key, $value);
        }
        $tpl1->assign('countryname', $countries[$spe['country']]);
        $tpl1->assign('id', $row['joinID']);
        $tpl1->display(DESIGN . '/tpl/admin/joinus_view.html');
        $tpl->assign('details', ob_get_contents());
        ob_end_clean();
    }
    $tpl->assign('joinus', $joinus);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/joinus.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(JOINUS, $content, '', 1);
}
Example #7
0
 public function smarty()
 {
     $smarty = new smarty();
     //实例化smarty
     $smarty->settemplatedir(BASE_PATH . '/views/default/');
     //设置模板文件存放目录
     $smarty->setcompiledir(BASE_PATH . '/storage/framework/smarty/compile/');
     //设置生成文件存放目录
     $smarty->setcachedir(BASE_PATH . '/storage/framework/smarty/cache/');
     //设置缓存文件存放目录
     $this->smarty = $smarty;
     return $smarty;
 }
Example #8
0
 public function render()
 {
     $this->_getContext($this->controller);
     $path = get_class($this->controller);
     $file = $this->_parseTemplatePath($path);
     if (!file_exists(APP_TEMPLATE_PATH . DS . $file)) {
         throw new AXION_EXCEPTION('没有找到模板文件');
     }
     foreach ($this->context as $k => $v) {
         $this->templateInstance->assign($k, $v);
     }
     $_str_resultHTML = $this->templateInstance->fetch($file);
     return $_str_resultHTML;
 }
Example #9
0
function get_matchtypes()
{
    global $db;
    $db->query('SELECT matchtypeID, matchtypename, fightus FROM ' . DB_PRE . 'ecp_wars_matchtype ORDER BY matchtypename');
    $match = array();
    while ($row = $db->fetch_assoc()) {
        $match[] = $row;
    }
    $tpl = new smarty();
    $tpl->assign('matchtype', $match);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/matchtype_overview.html');
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Example #10
0
 function admin_settings()
 {
     global $db, $countries;
     if (isset($_POST['submit'])) {
         unset($_POST['submit']);
         $_POST['SITE_URL'] = strrpos($_POST['SITE_URL'], '/') !== strlen($_POST['SITE_URL']) - 1 ? check_url($_POST['SITE_URL'] . '/') : check_url($_POST['SITE_URL']);
         $sql = 'UPDATE ' . DB_PRE . 'ecp_settings SET ';
         foreach ($_POST as $key => $value) {
             $sql .= $key . ' = "' . strsave($value) . '", ';
         }
         $sql = substr($sql, 0, strlen($sql) - 2);
         if ($db->query($sql)) {
             header('Location: ?section=admin&site=settings');
         }
     } else {
         $dir = scan_dir('templates', true);
         $designs = '';
         foreach ($dir as $value) {
             if (is_dir('templates/' . $value)) {
                 $designs .= '<option ' . ($value == DESIGN ? 'selected="selected"' : '') . ' value="' . $value . '">' . $value . '</option>';
             }
         }
         $tpl = new smarty();
         $tpl->assign('designs', $designs);
         $tpl->assign('langs', get_languages());
         $dir = scan_dir('module', true);
         $start = '';
         foreach ($dir as $value) {
             if (is_dir('module/' . $value)) {
                 $start .= '<option ' . ('modul|' . $value == STARTSEITE ? 'selected="selected"' : '') . ' value="modul|' . $value . '">' . $value . '</option>';
             }
         }
         $start .= '<option value="">-----' . OWN_SITES . '----</option>';
         $db->query('SELECT headline, cmsID FROM ' . DB_PRE . 'ecp_cms ORDER BY headline ASC');
         while ($row = $db->fetch_assoc()) {
             $title = json_decode($row['headline'], true);
             isset($title[LANGUAGE]) ? $title = $title[LANGUAGE] : ($title = $title[DEFAULT_LANG]);
             $start .= '<option ' . ('cms|' . $row['cmsID'] == STARTSEITE ? 'selected="selected"' : '') . ' value="cms|' . $row['cmsID'] . '">' . $title . '</option>';
         }
         $tpl->assign('startseite', $start);
         ob_start();
         $tpl->display(DESIGN . '/tpl/admin/settings.html');
         $content = ob_get_contents();
         ob_end_clean();
         main_content(SETTINGS, $content, '', 1);
     }
 }
Example #11
0
function admin_fightus()
{
    global $db;
    $tpl = new smarty();
    $db->query('SELECT tname, gamename, icon, matchtypename, a.homepage, `fightusID`, a.clanname, `wardatum`, `bearbeitet`, `vonID`, username FROM ' . DB_PRE . 'ecp_fightus as a LEFT JOIN ' . DB_PRE . 'ecp_teams ON (teamID = tID) LEFT JOIN ' . DB_PRE . 'ecp_wars_games ON (gID=gameID) LEFT JOIN ' . DB_PRE . 'ecp_wars_matchtype ON (mID= matchtypeID) LEFT JOIN ' . DB_PRE . 'ecp_user ON (ID=vonID) ORDER BY bearbeitet ASC, wardatum ASC');
    $fightus = array();
    while ($row = $db->fetch_assoc()) {
        $row['wardatum'] = date(SHORT_DATE, $row['wardatum']);
        $fightus[] = $row;
    }
    $tpl->assign('fightus', $fightus);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/fightus.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(FIGHTUS, $content, '', 1);
}
Example #12
0
function clankasse()
{
    global $db;
    $tpl = new smarty();
    $konto = $db->fetch_assoc('SELECT * FROM ' . DB_PRE . 'ecp_clankasse');
    $konto['kontostand'] = number_format($konto['kontostand'], 2, ',', '');
    foreach ($konto as $key => $value) {
        $tpl->assign($key, $value);
    }
    ob_start();
    $anzahl = $db->result(DB_PRE . 'ecp_clankasse_transaktion', 'COUNT(ID)', '1');
    $limits = get_sql_limit($anzahl, LIMIT_CLANKASSE_TRANS);
    $db->query('SELECT a.*, b.username, c.username as buchusername FROM ' . DB_PRE . 'ecp_clankasse_transaktion as a LEFT JOIN ' . DB_PRE . 'ecp_user as b ON b.ID = vonuser LEFT JOIN ' . DB_PRE . 'ecp_user as c ON c.ID = userID ORDER BY datum DESC LIMIT ' . $limits[1] . ',' . LIMIT_CLANKASSE_TRANS);
    $buchung = array();
    while ($row = $db->fetch_assoc()) {
        $row['datum'] = date(LONG_DATE, $row['datum']);
        if ($row['vonuser']) {
            $row['verwendung'] .= ' ' . FROM . ' ' . $row['username'];
        }
        $row['geld'] = number_format($row['geld'], 2, ',', '.');
        $buchung[] = $row;
    }
    if ($limits[0] > 1) {
        $tpl->assign('seiten', makepagelink_ajax('?section=clankasse', 'return load_clankasse_page({nr});', @$_GET['page'], $limits[0]));
    }
    $tpl->assign('buchung', $buchung);
    $tpl->display(DESIGN . '/tpl/clankasse/kontodaten.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(FINANCES, $content, '', 1);
    if (date('m') > 3) {
        clankasse_buchungen(date('m') - 2, date('Y'));
    } elseif (date('m') == 2) {
        clankasse_buchungen(12, date('Y') - 1);
    } elseif (date('m') == 1) {
        clankasse_buchungen(11, date('Y') - 1);
    } else {
        clankasse_buchungen(1, date('Y'));
    }
}
Example #13
0
 /**
  * @param $template
  * @param $ary
  * @return mixed
  */
 public static function genHtml($template, $ary)
 {
     $smarty = new smarty();
     $smarty->settemplatedir(BASE_PATH . '/resources/email/');
     $smarty->setcompiledir(BASE_PATH . '/storage/framework/smarty/compile/');
     $smarty->setcachedir(BASE_PATH . '/storage/framework/smarty/cache/');
     // add config
     $smarty->assign('config', Config::getPublicConfig());
     $smarty->assign('analyticsCode', DbConfig::get('analytics-code'));
     foreach ($ary as $key => $value) {
         $smarty->assign($key, $value);
     }
     return $smarty->fetch($template);
 }
Example #14
0
function admin_smilies_add()
{
    global $db;
    if (!isset($_SESSION['rights']['admin']['smilies']['add']) and !isset($_SESSION['rights']['superadmin'])) {
        echo NO_ADMIN_RIGHTS;
    } else {
        if (@$_FILES['smilie']['tmp_name'] == '') {
            table(ERROR, NOT_NEED_ALL_INPUTS);
            $tpl = new smarty();
            ob_start();
            $tpl->display(DESIGN . '/tpl/admin/smilies.html');
            $content = ob_get_contents();
            ob_end_clean();
            main_content(SMILIES, $content, '', 1);
            get_smilies();
        } elseif ($_FILES['smilie']['type'] != 'image/jpg' and $_FILES['smilie']['type'] != 'image/gif' and $_FILES['smilie']['type'] != 'image/png' and $_FILES['smilie']['type'] != 'image/jpeg') {
            table(ERROR, WRONG_FILE_TYPE);
            $tpl = new smarty();
            ob_start();
            $tpl->display(DESIGN . '/tpl/admin/smilies.html');
            $content = ob_get_contents();
            ob_end_clean();
            main_content(SMILIES, $content, '', 1);
            get_smilies();
        } else {
            ajax_convert_array($_POST);
            ajax_convert_array($_FILES);
            if (move_uploaded_file($_FILES['smilie']['tmp_name'], 'images/smilies/' . str_replace(' ', '_', $_FILES['smilie']['name']))) {
                umask(0);
                chmod('images/smilies/' . str_replace(' ', '_', $_FILES['smilie']['name']), CHMOD);
                $sql = sprintf('INSERT INTO ' . DB_PRE . 'ecp_smilies (`bedeutung`, `filename`) 
								VALUES (\'%s\', \'%s\')', strsave($_POST['bedeutung']), strsave(str_replace(' ', '_', $_FILES['smilie']['name'])));
                if ($db->query($sql)) {
                    header1('?section=admin&site=smilies');
                }
            }
        }
    }
}
Example #15
0
function awards_view($id)
{
    global $db;
    $row = $db->fetch_assoc('SELECT `awardID`, `eventname`, `eventdatum`, `url`, `platz`, `teamID`, `gID`, `preis`, spieler, bericht, tname, icon, gamename FROM `' . DB_PRE . 'ecp_awards` LEFT JOIN ' . DB_PRE . 'ecp_teams ON tID = teamID LEFT JOIN ' . DB_PRE . 'ecp_wars_games ON gameID = gID WHERE awardID = ' . $id);
    if (@$row['eventname']) {
        $tpl = new smarty();
        $row['eventdatum'] = date('d.m.Y', $row['eventdatum']);
        $report = json_decode($row['bericht'], true);
        $spieler = explode(',', $row['spieler']);
        $row['preis'] = htmlentities($row['preis'], ENT_QUOTES, "UTF-8");
        $row['eventname'] = htmlentities($row['eventname'], ENT_QUOTES, "UTF-8");
        foreach ($spieler as $value) {
            if ((int) $value) {
                @($ids .= ' OR ID = ' . $value);
            }
        }
        $db->query('SELECT username, ID FROM ' . DB_PRE . 'ecp_user WHERE ID = 0' . @$ids);
        while ($sub = $db->fetch_assoc()) {
            @($players .= ', <a href="?section=user&id=' . $sub['ID'] . '" >' . $sub['username'] . '</a>');
        }
        $tpl->assign('players', substr(@$players, 2));
        if (isset($report[LANGUAGE])) {
            $row['bericht'] = $report[LANGUAGE];
        } else {
            $row['bericht'] = @$report['de'];
        }
        foreach ($row as $key => $value) {
            $tpl->assign($key, $value);
        }
        ob_start();
        $tpl->display(DESIGN . '/tpl/awards/view.html');
        $content = ob_get_contents();
        ob_end_clean();
        main_content(AWARDS, $content, '', 1);
    } else {
        table(ERROR, NO_ENTRIES_ID);
    }
}
Example #16
0
function lotto_winlist($id)
{
    global $db, $countries;
    $runde = $db->fetch_assoc('SELECT `anfang`, `ende`, `rundenjackpot`, `auszahlung`, a.zahl1, a.zahl2, a.zahl3, a.zahl4, `4er`, `3er`, `2er`, `geld4er`, `geld3er`, `geld2er`, COUNT(scheinID) as scheine FROM ' . DB_PRE . 'ecp_lotto_runden as a LEFT JOIN ' . DB_PRE . 'ecp_lotto_scheine as b ON (a.rundenID = b.rundenID) WHERE a.rundenID = ' . $id . ' GROUP BY a.rundenID');
    if (isset($runde['rundenjackpot'])) {
        $tpl = new smarty();
        $runde['anfang'] = date(LONG_DATE, $runde['anfang']);
        $runde['ende'] = date(LONG_DATE, $runde['ende']);
        $runde['winner'] = format_nr($runde['4er'] + $runde['3er'] + $runde['2er']);
        $runde['geld4eruser'] = format_nr($runde['geld4er'] / ($runde['4er'] == 0 ? 1 : $runde['4er']), 2);
        $runde['geld3eruser'] = format_nr($runde['geld3er'] / ($runde['3er'] == 0 ? 1 : $runde['3er']), 2);
        $runde['geld2eruser'] = format_nr($runde['geld2er'] / ($runde['2er'] == 0 ? 1 : $runde['2er']), 2);
        $runde['quote'] = format_nr($runde['winner'] / ($runde['scheine'] == 0 ? 1 : $runde['scheine']) * 100, 1);
        foreach ($runde as $key => $value) {
            if ($key == 'rundenjackpot' or $key == 'auszahlung' or $key == 'geld4er' or $key == 'geld3er' or $key == 'geld2er') {
                $value = format_nr($value, 2);
            }
            $tpl->assign($key, $value);
        }
        if ($runde['winner']) {
            $db->query('SELECT gewinn, art, COUNT(scheinID) as scheine, username, a.userID, country, uID as online FROM ' . DB_PRE . 'ecp_lotto_gewinner as a LEFT JOIN ' . DB_PRE . 'ecp_user ON (a.userID = ID) LEFT JOIN ' . DB_PRE . 'ecp_online ON (uID = a.userID) LEFT JOIN ' . DB_PRE . 'ecp_lotto_scheine as b ON (rundenID = ' . $id . ' AND b.userID = a.userID) WHERE a.rID = ' . $id . ' GROUP BY gewinnID ORDER BY art DESC, username ASC');
            $gewinner = array();
            while ($row = $db->fetch_assoc()) {
                $row['gewinn'] = format_nr($row['gewinn'], 2);
                $row['countryname'] = $countries[$row['country']];
                $gewinner[] = $row;
            }
            $tpl->assign('gewinner', $gewinner);
        }
        ob_start();
        $tpl->display(DESIGN . '/tpl/lotto/winlist.html');
        $content = ob_get_contents();
        ob_end_clean();
        main_content(LOTTO_ROUND, $content, '', 1);
    } else {
        table(ERROR, NO_ENTRIES_ID);
    }
}
Example #17
0
function get_events()
{
    global $db;
    $events = array();
    $db->query('SELECT calID, eventname, datum FROM ' . DB_PRE . 'ecp_calendar ORDER BY datum DESC');
    while ($row = $db->fetch_assoc()) {
        $row['datum'] = date(LONG_DATE, $row['datum']);
        $events[] = $row;
    }
    $tpl = new smarty();
    $tpl->assign('events', $events);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/calendar_overview.html');
    $content = ob_get_contents();
    ob_end_clean();
    if (isset($_GET['ajax'])) {
        ob_end_clean();
        echo html_ajax_convert($content);
        die;
    } else {
        return $content;
    }
}
Example #18
0
 public static function getSmarty()
 {
     $smarty = new smarty();
     //实例化smarty
     $smarty->settemplatedir(BASE_PATH . '/resources/views/' . Config::get('theme') . '/');
     //设置模板文件存放目录
     $smarty->setcompiledir(BASE_PATH . '/storage/framework/smarty/compile/');
     //设置生成文件存放目录
     $smarty->setcachedir(BASE_PATH . '/storage/framework/smarty/cache/');
     //设置缓存文件存放目录
     // add config
     $smarty->assign('config', Config::getPublicConfig());
     $smarty->assign('user', Auth::getUser());
     $smarty->assign('analyticsCode', DbConfig::get('analytics-code'));
     return $smarty;
 }
Example #19
0
function admin_ranks_add()
{
    global $db;
    if (!isset($_SESSION['rights']['admin']['ranks']['add']) and !isset($_SESSION['rights']['superadmin'])) {
        echo NO_ADMIN_RIGHTS;
    } else {
        if (@$_FILES['rank']['tmp_name'] == '' or $_POST['rankname'] == '') {
            table(ERROR, NOT_NEED_ALL_INPUTS);
            $tpl = new smarty();
            ob_start();
            $tpl->display(DESIGN . '/tpl/admin/ranks.html');
            $content = ob_get_contents();
            ob_end_clean();
            main_content(RANGS, $content, '', 1);
            get_ranks();
        } elseif ($_FILES['rank']['type'] != 'image/jpg' and $_FILES['rank']['type'] != 'image/gif' and $_FILES['rank']['type'] != 'image/png' and $_FILES['rank']['type'] != 'image/jpeg') {
            table(ERROR, WRONG_FILE_TYPE);
            $tpl = new smarty();
            ob_start();
            $tpl->display(DESIGN . '/tpl/admin/ranks.html');
            $content = ob_get_contents();
            ob_end_clean();
            main_content(RANGS, $content, '', 1);
            get_ranks();
        } else {
            if (move_uploaded_file($_FILES['rank']['tmp_name'], 'images/ranks/' . str_replace(' ', '_', $_FILES['rank']['name']))) {
                umask(0);
                chmod('images/ranks/' . str_replace(' ', '_', $_FILES['rank']['name']), CHMOD);
                $sql = sprintf('INSERT INTO ' . DB_PRE . 'ecp_ranks (`rankname`, `iconname`, abposts, fest, money) 
								VALUES (\'%s\', \'%s\', %d, %d, %f)', strsave($_POST['rankname']), strsave(str_replace(' ', '_', $_FILES['rank']['name'])), (int) @$_POST['abposts'], (int) @$_POST['fest'], (double) str_replace(',', '.', @$_POST['money']));
                if ($db->query($sql)) {
                    header1('?section=admin&site=ranks');
                }
            }
        }
    }
}
Example #20
0
function main_content($headline, $content, $footer = '', $mode = 0)
{
    $tpl = new smarty();
    if ($mode == 1) {
        $tpl->assign('headline', 'templates/' . DESIGN . '/picture.php?text=' . base64_encode('» ' . $headline));
    } else {
        $tpl->assign('headline', $headline);
    }
    $tpl->assign('content', $content);
    $tpl->assign('footer', $footer);
    $tpl->assign('mode', $mode);
    $tpl->display(DESIGN . '/tpl/content.html');
}
Example #21
0
function main_content($headline, $content, $footer = '', $mode = 0)
{
    $tpl = new smarty();
    if ($mode == 1) {
        $tpl->assign('headline', $headline);
    } else {
        $tpl->assign('headline', $headline);
    }
    $tpl->assign('content', $content);
    $tpl->assign('footer', $footer);
    $tpl->assign('mode', $mode);
    $tpl->display(DESIGN . '/tpl/content.html');
}
Example #22
0
 public function smarty()
 {
     //global $config;
     $smarty = new smarty();
     //实例化smarty
     $smarty->settemplatedir(BASE_PATH . '/views/' . Config::get('theme') . '/');
     //设置模板文件存放目录
     $smarty->setcompiledir(BASE_PATH . '/storage/framework/smarty/compile/');
     //设置生成文件存放目录
     $smarty->setcachedir(BASE_PATH . '/storage/framework/smarty/cache/');
     //设置缓存文件存放目录
     // add config
     $smarty->assign('config', Config::getPublicConfig());
     $smarty->assign('user', Auth::getUser());
     $this->smarty = $smarty;
     return $smarty;
 }
Example #23
0
function admin_survey()
{
    global $db, $groups;
    $anzahl = $db->result(DB_PRE . 'ecp_survey', 'COUNT(surveyID)', '1');
    if ($anzahl) {
        $limits = get_sql_limit($anzahl, LIMIT_SURVEY);
        $db->query('SELECT `surveyID`, `start`, `ende`, `frage` FROM `' . DB_PRE . 'ecp_survey` ORDER BY ende DESC LIMIT ' . $limits[1] . ', ' . LIMIT_SURVEY);
        $umfrage = array();
        while ($row = $db->fetch_assoc()) {
            if ($row['start'] > time()) {
                $row['status'] = PLANNED;
                $row['closed'] = 1;
            } elseif ($row['ende'] < time()) {
                $row['status'] = CLOSED;
                $row['closed'] = 1;
            } else {
                $row['status'] = RUN;
            }
            $row['start'] = date(LONG_DATE, $row['start']);
            $row['ende'] = date(LONG_DATE, $row['ende']);
            $umfrage[] = $row;
        }
    }
    $tpl = new smarty();
    $db->query('SELECT groupID, name FROM ' . DB_PRE . 'ecp_groups ORDER by name ASC');
    $rights = '<option value="all" selected="selected">' . ALL . '</option>';
    while ($row = $db->fetch_assoc()) {
        if (isset($groups[$row['name']])) {
            $row['name'] = $groups[$row['name']];
        }
        $rights .= '<option value="' . $row['groupID'] . '">' . $row['name'] . '</option>';
    }
    $tpl->assign('rights', $rights);
    $tpl->assign('anzahl', $anzahl);
    $tpl->assign('umfrage', @$umfrage);
    $tpl->assign('pages', @$limits[0]);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/survey.html');
    $tpl->display(DESIGN . '/tpl/admin/survey_overview.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(SURVEY, $content, '', 1);
}
Example #24
0
function admin_downloads()
{
    global $db;
    $tpl = new smarty();
    $tpl->assign('lang', get_languages());
    $tpl->assign('rights', get_form_rights(@$_POST['rights']));
    $tpl->assign('kate', download_get_cate(@$_POST['subID']));
    $db->query('SELECT name, dID FROM ' . DB_PRE . 'ecp_downloads ORDER BY name ASC');
    $dl = '<option value="0">' . CHOOSE . '</option>';
    while ($row = $db->fetch_assoc()) {
        $dl .= '<option value="' . $row['dID'] . '">' . $row['name'] . '</option>';
    }
    $tpl->assign('dls', $dl);
    //foreach($_POST AS $key=>$value) $tpl->assign($key, $value);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/downloads.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(DOWNLOADS, $content, '', 1);
}
Example #25
0
    $parameter = 'action=photo&doing=view_photo&photo_id=7&';
    $pagebar = pagebar(get_self(), $parameter, $page_current, $page_size, $count);
    $smarty = new smarty();
    smarty_header();
    $smarty->assign('pagebar', $pagebar);
    $smarty->assign('photo', $rows);
    $smarty->display('admin_photo_list.html');
}
if ($doing == 'manage_photo') {
    check_browser();
    check_user();
    $format = "SELECT * FROM `{$db_prefix}photo`";
    $query = $db->query($format);
    $page_size = 10;
    $page_current = isset($_GET['page']) && is_numeric($_GET['page']) ? intval($_GET['page']) : 1;
    $count = $db->getCount($format);
    $res = $db->getAll($format . " LIMIT " . ($page_current - 1) * $page_size . "," . $page_size);
    $rows = array();
    if ($count > 1) {
        foreach ($res as $value) {
            $rows[] = $value;
        }
    }
    $parameter = 'action=photo&doing=manage_photo&';
    $pagebar = pagebar(get_self(), $parameter, $page_current, $page_size, $count);
    $smarty = new smarty();
    smarty_header();
    $smarty->assign('pagebar', $pagebar);
    $smarty->assign('photo', $rows);
    $smarty->display('admin_manage_photo.html');
}
Example #26
0
     while ($row = $query->fetch_assoc()) {
         $rows[] = $row;
     }
     foreach ($rows as $v) {
         $page[$v['page_id']]['page_id'] = $v['page_id'];
         $page[$v['page_id']]['page_name'] = $v['page_name'];
         $page[$v['page_id']]['page_adds'] = $v['page_adds'];
         $page[$v['page_id']]['page_sort'] = $v['page_sort'];
         $format = "SELECT `page_name` FROM `{$db_prefix}page` WHERE `page_fid`='%d'";
         $format = sprintf($format, $rows['page_fid']);
         $query = $db->query($format);
         $page_f_name = $query->fetch_assoc();
         $page_f_name['page_f_name'] = $page_f_name['page_name'];
         $page[$v['page_id']]['page_f_name'] = $page_f_name;
     }
     $smarty = new smarty();
     smarty_header();
     $smarty->assign('page', $rows);
     $smarty->display('admin_edit_page.html');
 }
 if (isset($_POST['edit_btn'])) {
     $page_class = empty($_POST['page_fid']) ? '' : intval($_POST['page_fid']);
     $page_name = empty($_POST['page_name']) ? '' : trim(addslashes($_POST['page_name']));
     $page_adds = empty($_POST['page_adds']) ? '' : trim(addslashes($_POST['page_adds']));
     $page_sort = empty($_POST['page_sort']) ? '' : intval($_POST['page_sort']);
     $page_id = empty($_POST['page_id']) ? '' : intval($_POST['page_id']);
     $format = "UPDATE `{$db_prefix}page` SET `page_fid` ='%d', `page_name`= '%s', `page_adds`= '%s', `page_sort`='%d' WHERE `page_id`='%d'";
     $format = sprintf($format, $page_class, $page_name, $page_adds, $page_sort, $page_id);
     if ($db->query($format)) {
         message(array('text' => $language['page_edit_success'], 'link' => '?action=page&doing=page_manage'));
     }
   -----------------------------------------------------------------------------------------
   based on: 
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommercebased on original files from OSCommerce CVS 2.2 2002/08/28 02:14:35 www.oscommerce.com 
   (c) 2003 nextcommerce (loginbox.php,v 1.10 2003/08/17); www.nextcommerce.org
   (c) 2006 XT-Commerce

   Released under the GNU General Public License 
   -----------------------------------------------------------------------------------------
   Third Party contributions:
   Loginbox V1.0          Aubrey Kilian <*****@*****.**>

   Released under the GNU General Public License
   ---------------------------------------------------------------------------------------*/
if (!isset($_SESSION['customer_id'])) {
    require_once DIR_FS_INC . 'xtc_image_submit.inc.php';
    require_once DIR_FS_INC . 'xtc_draw_password_field.inc.php';
    $box_smarty = new smarty();
    $box_smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
    $box_smarty->assign('FORM_ACTION', '<form id="loginbox" method="post" action="' . xtc_href_link(FILENAME_LOGIN, 'action=process', 'SSL') . '">');
    $box_smarty->assign('FIELD_EMAIL', xtc_draw_input_field('email_address', '', 'maxlength="50" style="width: 100%!important;""'));
    $box_smarty->assign('FIELD_PWD', xtc_draw_password_field('password', '', 'maxlength="30" style="width: 100%!important;""'));
    $box_smarty->assign('BUTTON', xtc_image_submit('button_login_small.gif', IMAGE_BUTTON_LOGIN));
    $box_smarty->assign('LINK_LOST_PASSWORD', xtc_href_link(FILENAME_PASSWORD_DOUBLE_OPT, '', 'SSL'));
    $box_smarty->assign('FORM_END', '</form>');
    $box_smarty->assign('BOX_CONTENT', '');
    $box_smarty->caching = 0;
    $box_smarty->assign('language', $_SESSION['language']);
    $box_loginbox = $box_smarty->fetch(CURRENT_TEMPLATE . '/boxes/box_login.html');
    $smarty->assign('box_LOGIN', $box_loginbox);
}
Example #28
0
	function initialize_panels($mode)
	{
		global $g_project;
		global $g_dropdown_menu;

		$smarty = new smarty();
		$smarty->template_dir = find_best_location_in_include_path( "templates" );
		$smarty->compile_dir = find_best_location_in_include_path( "templates_c" );

		$dummy="";
		$version = "4.0";

		$forward_url_params = session_request_item('forward_url_get_parameters', $this->forward_url_get_parameters);
		$forward_url_params_graph = session_request_item('forward_url_get_parameters_graph', $this->forward_url_get_parameters_graph);
		$forward_url_params_dbimage = session_request_item('forward_url_get_parameters_dbimage', $this->forward_url_get_parameters_dbimage);

		$smarty->assign('REPORTICO_VERSION', $version);

        // Assign user parameters to template
        if ( $this->user_parameters && is_array($this->user_parameters) )
	        foreach ( $this->user_parameters as $k => $v )
            {
                $param = preg_replace("/ /", "_", $k);
                $smarty->assign('USER_'.$param, $v);
            }

		// Smarty needs to include Javascript if AJAX enabled
		if ( !defined ('AJAX_ENABLED') )
			define('AJAX_ENABLED', true);
		$smarty->assign('AJAX_ENABLED', AJAX_ENABLED);

		// Date format for ui Datepicker
        global $g_language;
		$smarty->assign('AJAX_DATEPICKER_LANGUAGE', get_datepicker_language($g_language));
		$smarty->assign('AJAX_DATEPICKER_FORMAT', get_datepicker_format(SW_PREP_DATEFORMAT));
		

		$smarty->assign('DB_LOGGEDON', false);
		$smarty->assign('ADMIN_MENU_URL', false);
		$smarty->assign('CONFIGURE_MENU_URL', false);
		$smarty->assign('CREATE_REPORT_URL', false);
		$smarty->assign('SESSION_ID', reportico_session_name());

        // Set smarty variables
		$smarty->assign('SCRIPT_SELF',  $this->url_path_to_calling_script);

		$smarty->assign('REPORTICO_AJAX_MODE',  $this->reportico_ajax_mode);
		$smarty->assign('REPORTICO_AJAX_CALLED',  $this->reportico_ajax_called);

        if ( $this->url_path_to_assets )
		    $smarty->assign('REPORTICO_URL_DIR',  $this->url_path_to_assets);
        else
		    $smarty->assign('REPORTICO_URL_DIR',  $this->reportico_url_path);

		$smarty->assign('REPORTICO_AJAX_RUNNER',  $this->reportico_ajax_script_url);

		$smarty->assign('PRINTABLE_HTML', false);
        if ( get_request_item("printable_html") )
        {
		    $smarty->assign('PRINTABLE_HTML', true);
        }

        // In frameworks we dont want to load jquery when its intalled once when the module load
        // so flag this unless specified in new_reportico_window
		$smarty->assign('REPORTICO_STANDALONE_WINDOW',  false);
		$smarty->assign('REPORTICO_AJAX_PRELOADED',  $this->reportico_ajax_preloaded);
        if ( get_request_item("new_reportico_window",  false ) )
        {
		    $smarty->assign('REPORTICO_AJAX_PRELOADED',  false);
		    $smarty->assign('REPORTICO_STANDALONE_WINDOW',  true);
        }
    
		$smarty->assign('SHOW_LOGOUT', false);
		$smarty->assign('SHOW_LOGIN', false);
		$smarty->assign('SHOW_REPORT_MENU', false);
		$smarty->assign('SHOW_SET_ADMIN_PASSWORD', false);
		$smarty->assign('SHOW_OUTPUT', false);
		$smarty->assign('SHOW_DESIGN_BUTTON', false);
		$smarty->assign('SHOW_ADMIN_BUTTON', true);
	    $smarty->assign('PROJ_PASSWORD_ERROR', "");
        $smarty->assign('SHOW_PROJECT_MENU_BUTTON', true);
        if ( $this->access_mode && ( $this->access_mode != "DEMO" && $this->access_mode != "FULL" && $this->access_mode != "ALLPROJECTS" && $this->access_mode != "ONEPROJECT" )  )
        {
            $smarty->assign('SHOW_PROJECT_MENU_BUTTON', false);
        }
		$smarty->assign('SHOW_EXPAND', false);
		$smarty->assign('SHOW_CRITERIA', false);
		$smarty->assign('SHOW_EXPANDED', false);
		$smarty->assign('SHOW_MODE_MAINTAIN_BOX', false);
		$smarty->assign('STATUSMSG', '');
		$smarty->assign('ERRORMSG', false);
		$smarty->assign('SET_ADMIN_PASSWORD_INFO', '');
		$smarty->assign('SET_ADMIN_PASSWORD_ERROR', '');
		$smarty->assign('ADMIN_PASSWORD_ERROR', '');
		$smarty->assign('PASSWORD_ERROR', '');
		$smarty->assign('DEMO_MODE', false);
		$smarty->assign('DROPDOWN_MENU_ITEMS', false);

        // Dont allow admin menu buttons to show in demo mode
        if ( $this->allow_maintain == "DEMO" )
        {
            $smarty->assign('DEMO_MODE', true);
            $smarty->assign('SHOW_ADMIN_BUTTON', false);
        }

        if ( !$this->admin_accessible )
        {
            $smarty->assign('SHOW_ADMIN_BUTTON', false);
        }

        // Dont show admin button 
        if ( $this->access_mode && ( $this->access_mode != "DEMO" && $this->access_mode != "FULL" && $this->access_mode != "ALLPROJECTS" )  )
        {
            $smarty->assign('SHOW_ADMIN_BUTTON', false);
        }
	    	
        $partialajaxpath = find_best_location_in_include_path( "partial.php" );
		$smarty->assign('AJAX_PARTIAL_RUNNER', $this->reportico_url_path.$partialajaxpath );

        // Use alternative location for js/css/images if specified.
        // Set stylesheet to the reportico bootstrap if bootstrap styles in place
        $this->bootstrap_styles = register_session_param("bootstrap_styles", $this->bootstrap_styles);

        // Force reportico modals or decide based on style?
        $this->force_reportico_mini_maintains = register_session_param("force_reportico_mini_maintains", $this->force_reportico_mini_maintains);

        $this->url_path_to_assets = register_session_param("url_path_to_assets", $this->url_path_to_assets);
        $this->jquery_preloaded = register_session_param("jquery_preloaded", $this->jquery_preloaded);
        $this->bootstrap_preloaded = register_session_param("bootstrap_preloaded", $this->bootstrap_preloaded);

        if ( !$this->bootstrap_styles )
        {
            $csspath = $this->url_path_to_assets."/css/reportico.css";
            if ( $this->url_path_to_assets )
                $csspath = $this->url_path_to_assets."/css/reportico.css";
            else
                $csspath = $this->reportico_url_path."/".find_best_url_in_include_path( "/css/reportico.css" );
        }
        else
        {
            if ( $this->url_path_to_assets )
                $csspath = $this->url_path_to_assets."/css/reportico_bootstrap.css";
            else
                $csspath = $this->reportico_url_path."/".find_best_url_in_include_path( "css/reportico_bootstrap.css" );
        }
		$smarty->assign('STYLESHEET', $csspath);
		$smarty->assign('STYLESHEETDIR', dirname($csspath));

		$smarty->assign('REPORTICO_JQUERY_PRELOADED', $this->jquery_preloaded);
		$smarty->assign('BOOTSTRAP_STYLES', $this->bootstrap_styles);
		$smarty->assign('REPORTICO_BOOTSTRAP_PRELOADED', $this->bootstrap_preloaded);
		$smarty->assign('BOOTSTRAP_STYLE_GO_BUTTON', $this->getBootstrapStyle('button_go'));
		$smarty->assign('BOOTSTRAP_STYLE_RESET_BUTTON', $this->getBootstrapStyle('button_reset'));
		$smarty->assign('BOOTSTRAP_STYLE_ADMIN_BUTTON', $this->getBootstrapStyle('button_admin'));
		$smarty->assign('BOOTSTRAP_STYLE_DROPDOWN', $this->getBootstrapStyle('dropdown'));
		$smarty->assign('BOOTSTRAP_STYLE_CHECKBOX_BUTTON', $this->getBootstrapStyle('checkbox_button'));
		$smarty->assign('BOOTSTRAP_STYLE_CHECKBOX', $this->getBootstrapStyle('checkbox'));
		$smarty->assign('BOOTSTRAP_STYLE_TOOLBAR_BUTTON', $this->getBootstrapStyle('toolbar_button'));
		$smarty->assign('BOOTSTRAP_STYLE_MENU_TABLE', $this->getBootstrapStyle('menu_table'));
		$smarty->assign('BOOTSTRAP_STYLE_TEXTFIELD', $this->getBootstrapStyle('textfield'));
		$smarty->assign('BOOTSTRAP_STYLE_SMALL_BUTTON', $this->getBootstrapStyle('small_button'));

        // Set charting engine 
        $smarty->assign('REPORTICO_CHARTING_ENGINE', $this->charting_engine_html);

        // Set on/off template elements
        foreach ( $this->output_template_parameters as $k => $v )
        {
            $smarty->assign(strtoupper($k), $v);
        }

        if ( $this->url_path_to_assets )
        {
            $jspath = $this->url_path_to_assets."/js";
		    $smarty->assign('JSPATH', $jspath);
        }
        else
        {
            $jspath = find_best_url_in_include_path( "js/reportico.js" );
		    if ( $jspath ) $jspath = dirname($jspath);
		    $smarty->assign('JSPATH', $this->reportico_url_path.$jspath);
        }

		$this->panels["MAIN"] = new reportico_panel($this, "MAIN");
		$this->panels["MAIN"]->set_smarty($smarty);
		$this->panels["BODY"] = new reportico_panel($this, "BODY");
		$this->panels["TITLE"] = new reportico_panel($this, "TITLE");
		$this->panels["TOPMENU"] = new reportico_panel($this, "TOPMENU");
		$this->panels["MENUBUTTON"] = new reportico_panel($this, "MENUBUTTON");
		$this->panels["LOGIN"] = new reportico_panel($this, "LOGIN");
		$this->panels["SET_ADMIN_PASSWORD"] = new reportico_panel($this, "SET_ADMIN_PASSWORD");
		$this->panels["LOGOUT"] = new reportico_panel($this, "LOGOUT");
		$this->panels["FORM"] = new reportico_panel($this, "FORM");
		$this->panels["MENU"] = new reportico_panel($this, "MENU");
		$this->panels["ADMIN"] = new reportico_panel($this, "ADMIN");
		$this->panels["USERINFO"] = new reportico_panel($this, "USERINFO");
		$this->panels["RUNMODE"] = new reportico_panel($this, "RUNMODE");
		$this->panels["PREPARE"] = new reportico_panel($this, "PREPARE");
		$this->panels["CRITERIA"] = new reportico_panel($this, "CRITERIA");
		$this->panels["CRITERIA_FORM"] = new reportico_panel($this, "CRITERIA_FORM");
		$this->panels["CRITERIA_EXPAND"] = new reportico_panel($this, "CRITERIA_EXPAND");
		$this->panels["MAINTAIN"] = new reportico_panel($this, "MAINTAIN");
		$this->panels["REPORT"] = new reportico_panel($this, "REPORT");
		$this->panels["DESTINATION"] = new reportico_panel($this, "DESTINATION");
		$this->panels["EXECUTE"] = new reportico_panel($this, "EXECUTE");
		$this->panels["STATUS"] = new reportico_panel($this, "STATUS");
		$this->panels["ERROR"] = new reportico_panel($this, "ERROR");

		// Identify which panels are visible by default
		$this->panels["MAIN"]->set_visibility(true);
		$this->panels["BODY"]->set_visibility(true);
		$this->panels["TITLE"]->set_visibility(true);
		$this->panels["TOPMENU"]->set_visibility(true);
		$this->panels["STATUS"]->set_visibility(true);
		$this->panels["ERROR"]->set_visibility(true);

		// Set up a default panel hierarchy
		$this->panels["MAIN"]->add_panel($this->panels["BODY"]);
		$this->panels["BODY"]->add_panel($this->panels["TITLE"]);
		$this->panels["BODY"]->add_panel($this->panels["TOPMENU"]);
		$this->panels["BODY"]->add_panel($this->panels["FORM"]);
		$this->panels["BODY"]->add_panel($this->panels["STATUS"]);
		$this->panels["BODY"]->add_panel($this->panels["ERROR"]);
		$this->panels["FORM"]->add_panel($this->panels["CRITERIA"]);
		$this->panels["FORM"]->add_panel($this->panels["MAINTAIN"]);
		$this->panels["FORM"]->add_panel($this->panels["REPORT"]);
		$this->panels["FORM"]->add_panel($this->panels["MENU"]);
		$this->panels["FORM"]->add_panel($this->panels["ADMIN"]);
		$this->panels["CRITERIA"]->add_panel($this->panels["CRITERIA_FORM"]);
		$this->panels["CRITERIA"]->add_panel($this->panels["CRITERIA_EXPAND"]);
		$this->panels["CRITERIA"]->add_panel($this->panels["DESTINATION"]);
		$this->panels["BODY"]->add_panel($this->panels["REPORT"]);
		$this->panels["TOPMENU"]->add_panel($this->panels["LOGIN"]);
		$this->panels["TOPMENU"]->add_panel($this->panels["SET_ADMIN_PASSWORD"]);
		$this->panels["TOPMENU"]->add_panel($this->panels["USERINFO"]);
		$this->panels["TOPMENU"]->add_panel($this->panels["MENUBUTTON"]);
		$this->panels["TOPMENU"]->add_panel($this->panels["RUNMODE"]);
		$this->panels["TOPMENU"]->add_panel($this->panels["LOGOUT"]);

		// Store any menu page URL, in ajax mode links go through the general ajax link, otherwise go through calling script
        $calling_script = $this->get_action_url();
		$this->prepare_url =  $calling_script."?execute_mode=PREPARE&amp;reportico_session_name=".reportico_session_name();
		$this->menu_url =  $calling_script."?execute_mode=MENU&amp;reportico_session_name=".reportico_session_name();
		$this->admin_menu_url =  $calling_script."?project=admin&amp;execute_mode=MENU&amp;reportico_session_name=".reportico_session_name();
		$this->configure_project_url =  $calling_script."?execute_mode=PREPARE&amp;xmlin=configureproject.xml&amp;reportico_session_name=".reportico_session_name();
		$this->delete_project_url =  $calling_script."?execute_mode=PREPARE&amp;xmlin=deleteproject.xml&amp;reportico_session_name=".reportico_session_name();
		$this->create_report_url =  $calling_script."?execute_mode=MAINTAIN&amp;xmlin=&amp;reportico_session_name=".reportico_session_name();

		if ( $forward_url_params )
		{
				$this->prepare_url .= "&".$forward_url_params;
				$this->menu_url .= "&".$forward_url_params;
				$this->admin_menu_url .= "&".$forward_url_params;
				$this->configure_project_url .= "&".$forward_url_params;
				$this->delete_project_url .= "&".$forward_url_params;
				$this->create_report_url .= "&".$forward_url_params;
		}
		// ***MENUURL ***if (array_key_exists("menu_url", $_SESSION[reportico_namespace()]))
		// ***MENUURL ***{
			// ***MENUURL ***$this->menu_url = get_reportico_session_param("menu_url");
		// ***MENUURL ***}

        // Generate dropdown menu strip in menu or prepare mode
        if ( $g_dropdown_menu && !$this->dropdown_menu)
        {
            $this->dropdown_menu = $g_dropdown_menu;
        }

		if ( $this->dropdown_menu && ( $mode == "MENU" || $mode == "PREPARE" ) )
        {
		    $this->generate_dropdown_menu ( $this->dropdown_menu );
		    $smarty->assign('DROPDOWN_MENU_ITEMS', $this->dropdown_menu);
        }
        global $g_menu_title;
		$smarty->assign('MENU_TITLE', $g_menu_title);

		if ( $mode == "MENU" )
		{
			// Store the URL of thi smenu so it can be referred to 
			// in later screens
			// ***MENUURL ***$this->menu_url = $_SERVER["PHP_SELF"];
			// ***MENUURL ***set_reportico_session_param("menu_url",$this->menu_url);
			$this->panels["MENU"]->set_visibility(true);
			//$this->panels["FORM"]->add_panel($this->panels["MENU"]);
		}

		if ( $mode == "EXECUTE" )
		{
			$this->panels["REPORT"]->set_visibility(true);
			//$this->panels["FORM"]->add_panel($this->panels["REPORT"]);
		}

		if ( $mode == "MAINTAIN" )
		{
		    $this->panels["MAINTAIN"]->set_visibility(true);
			//$this->panels["FORM"]->add_panel($this->panels["MAINTAIN"]);
		}

		if ( $mode == "ADMIN" )
		{
			$this->panels["ADMIN"]->set_visibility(true);
			$this->panels["MENU"]->set_visibility(true);
			//$this->panels["FORM"]->add_panel($this->panels["MAINTAIN"]);
		}

		if ( $mode == "PREPARE" )
		{
			$this->panels["CRITERIA"]->set_visibility(true);
			$this->panels["CRITERIA_FORM"]->set_visibility(true);
			$this->panels["CRITERIA_EXPAND"]->set_visibility(true);
			$this->panels["DESTINATION"]->set_visibility(true);
			//$this->panels["FORM"]->add_panel($this->panels["CRITERIA"]);
		}

		// Visibility of Login details depends on whether user has provided login
		// details and also whether those details are valid, so set user name
		// and password to use for connection and then attempt to connect
		$this->panels["MENUBUTTON"]->set_visibility(true);
		$this->panels["LOGIN"]->set_visibility(false);
		$this->panels["SET_ADMIN_PASSWORD"]->set_visibility(false);
		$this->panels["LOGOUT"]->set_visibility(true);
		$this->panels["USERINFO"]->set_visibility(true);
		$this->panels["RUNMODE"]->set_visibility(true);

		$smarty->assign('REPORTICO_BOOTSTRAP_MODAL', true);
        if ( !$this->bootstrap_styles || $this->force_reportico_mini_maintains )
            $smarty->assign('REPORTICO_BOOTSTRAP_MODAL', false);

		// If no admin password then force user to enter one and  a language
		if ( $g_project == "admin" && SW_ADMIN_PASSWORD == "PROMPT" )
		{
			$smarty->assign('LANGUAGES', available_languages());
			// New Admin password submitted, attempt to set password and go to MENU option
			if ( array_key_exists("submit_admin_password", $_REQUEST) )
			{
				$smarty->assign('SET_ADMIN_PASSWORD_ERROR', 
					$this->save_admin_password($_REQUEST["new_admin_password"], $_REQUEST["new_admin_password2"], $_REQUEST["jump_to_language"]  ) );
			}

			$this->panels["SET_ADMIN_PASSWORD"]->set_visibility(true);
			$smarty->assign('SHOW_SET_ADMIN_PASSWORD', true);
			$this->panels["LOGOUT"]->set_visibility(false);
			$this->panels["MENU"]->set_visibility(false);
			$smarty->assign('SHOW_REPORT_MENU', false);
			if ( !defined('SW_ADMIN_PASSWORD_RESET') )
				return;
			else
				$smarty->assign('SHOW_SET_ADMIN_PASSWORD', false);
		} 

		$smarty->assign('SHOW_MINIMAINTAIN', false);
		{
			set_reportico_session_param("loggedin",true);
			if ( $this->login_check($smarty) )
			{
				// User has supplied details ( user and password ), so assume that login box should
				// not occur ( user details
				$this->panels["MENUBUTTON"]->set_visibility(true);
				$this->panels["LOGIN"]->set_visibility(false);
				$this->panels["SET_ADMIN_PASSWORD"]->set_visibility(false);
				$this->panels["LOGOUT"]->set_visibility(true);
				$this->panels["USERINFO"]->set_visibility(true);
				$this->panels["FORM"]->set_visibility(true);

                // Show quick edit/mini maintain elements if in design or demo mode 
                // unless the report is a reportico configuration report
                if ( $this->login_type == "DESIGN" || $this->access_mode == "DEMO" )
		            $smarty->assign('SHOW_MINIMAINTAIN', true);

				if ( $this->login_type == "DESIGN" )
				{
					$this->panels["RUNMODE"]->set_visibility(true);
				}
				else
					$this->panels["RUNMODE"]->set_visibility(false);
				$smarty->assign('SHOW_REPORT_MENU', true);

				// Only show a logout button if a password is in effect
				if ( $this->login_type == "DESIGN" || $this->login_type == "ADMIN" || ( defined ('SW_PROJECT_PASSWORD') && SW_PROJECT_PASSWORD != '' ) )
					$smarty->assign('SHOW_LOGOUT', true);

                // Dont show logout button in ALLPROJECTS, ONE PROJECT
                if ( $this->access_mode && ( $this->access_mode != "DEMO" && $this->access_mode != "FULL" && $this->access_mode != "ALLPROJECTS" ) )
					$smarty->assign('SHOW_LOGOUT', false);

                if ( $mode == "PREPARE" && ( $this->xmlinput == "deleteproject.xml" || $this->xmlinput == "configureproject.xml" || $this->xmlinput == "createtutorials.xml" ) )
                {
                    // Dont show database errors if displaying Configure Project prepare page as database connectivity could be wrong
                    // and user will correct it 
                }
                else
				if ( $this->datasource->connect() || $mode != "MAINTAIN" )
				{
					// Store connection session details
					set_reportico_session_param("database",$this->datasource->database);
					set_reportico_session_param("hostname",$this->datasource->host_name);
					set_reportico_session_param("driver",$this->datasource->driver);
					set_reportico_session_param("server",$this->datasource->server);
					set_reportico_session_param("protocol",$this->datasource->protocol);
				}
				else
				{
					//echo "not connected okay<br>";
					$this->panels["LOGIN"]->set_visibility(true);
					$this->panels["SET_ADMIN_PASSWORD"]->set_visibility(false);
					$this->panels["MENUBUTTON"]->set_visibility(false);
					$this->panels["LOGOUT"]->set_visibility(false);
					$this->panels["USERINFO"]->set_visibility(false);
					$this->panels["RUNMODE"]->set_visibility(true);
					$this->panels["FORM"]->set_visibility(false);
					$this->panels["STATUS"]->set_visibility(true);
					$this->panels["ERROR"]->set_visibility(true);
				}
				//echo "done connecting";
			}
			else
			{
				// If not logged in then set first criteria entry to true
				// So when we do get into criteria it will work
				set_reportico_session_param("firstTimeIn",true);
				set_reportico_session_param("loggedin",false);
				
				$this->panels["LOGIN"]->set_visibility(true);
				$this->panels["MENUBUTTON"]->set_visibility(true);
				$this->panels["LOGOUT"]->set_visibility(false);
				$this->panels["USERINFO"]->set_visibility(false);
				$this->panels["RUNMODE"]->set_visibility(false);

                // Dont allow admin design access if access mode is set and not FULL access
		        if ( $g_project == "admin" )
                if ( $this->access_mode && ( $this->access_mode != "FULL" )  )
                {
			        $this->panels["LOGIN"]->set_visibility(false);
                }
				
				// We do want to show the "run project" list in admin mode if not logged in
				if ( $g_project == "admin" )
					$this->panels["FORM"]->set_visibility(true);
				else
					$this->panels["FORM"]->set_visibility(false);


			}
		}

        // Turn off design mode if login type anything except design
        if ( $this->login_type != "DESIGN" )
		    $this->panels["MAINTAIN"]->set_visibility(false);
	}
Example #29
0
<?php

if (!file_exists('./includes/admin_config.php')) {
    header('Location:install.php');
}
include 'front.php';
$smarty = new smarty();
smarty_front();
get_nav();
get_adds();
get_news();
get_hot_news();
get_new_message();
$smarty->display('index.html');
Example #30
0
if (@$_SESSION['rights']['public']['links']['view'] or @$_SESSION['rights']['superadmin']) {
    global $db;
    if (isset($_GET['goto'])) {
        $link = $db->result(DB_PRE . 'ecp_links', 'url', 'linkID= ' . (int) $_GET['goto']);
        if ($link) {
            if (!isset($_SESSION['links'][(int) $_GET['id']])) {
                $_SESSION['links'][(int) $_GET['id']] = true;
                $db->query('UPDATE ' . DB_PRE . 'ecp_links SET hits = hits + 1 WHERE linkID = ' . (int) $_GET['goto']);
            }
            header('Location: ' . $link);
        } else {
            table(ERROR, NO_ENTRIES_ID);
        }
    } else {
        $tpl = new smarty();
        $anzahl = $db->result(DB_PRE . 'ecp_links', 'COUNT(linkID)', '1');
        if ($anzahl) {
            $limits = get_sql_limit($anzahl, LIMIT_LINKS);
            $links = array();
            $db->query('SELECT * FROM ' . DB_PRE . 'ecp_links ORDER BY name ASC LIMIT ' . $limits[1] . ',' . LIMIT_LINKS);
            while ($row = $db->fetch_assoc()) {
                $row['hits'] = format_nr($row['hits'], 0);
                $links[] = $row;
            }
            $tpl->assign('links', $links);
            if ($limits[0] > 1) {
                $tpl->assign('seiten', makepagelink_ajax('?section=links', 'return load_links({nr});', @$_GET['page'], $limits[0]));
            }
            ob_start();
            $tpl->display(DESIGN . '/tpl/links/links.html');