/**
  * Create Main Menu
  */
 protected function createMainMenu()
 {
     if (Session::isAdmin()) {
         $link0 = array('title' => 'Admin Dashboard', 'url' => 'admin/');
         $link1 = array('title' => 'Add New Articles', 'url' => 'admin/pages/addarticle.php');
         $link2 = array('title' => 'Article Manager', 'url' => 'admin/pages/articlemanager.php');
         $link3 = array('title' => 'User Manager', 'url' => 'admin/pages/usermanager.php');
         $link4 = array('title' => 'Add New Challenge', 'url' => 'admin/pages/addchallenge.php');
         $link5 = array('title' => 'Challenge Manager', 'url' => 'admin/pages/challengemanager.php');
         $link6 = array('title' => 'Logout', 'url' => 'pages/logout.php');
         $menu = array($link0, $link1, $link2, $link3, $link4, $link5, $link6);
     } elseif (Session::isTeacher()) {
         $link1 = array('title' => 'Admin Dashboard', 'url' => 'admin');
         $link2 = array('title' => 'Article Manager', 'url' => 'admin/pages/articlemanager.php');
         $link3 = array('title' => 'User Manager', 'url' => 'admin/pages/usermanager.php');
         $link4 = array('title' => 'Create Class', 'url' => 'admin/pages/manageclass.php');
         $link5 = array('title' => 'Add Challenge', 'url' => 'admin/pages/addchallenge.php');
         $link6 = array('title' => 'Monitor Students', 'url' => 'pages/progress.php');
         $link7 = array('title' => 'Logout', 'url' => 'pages/logout.php');
         $menu = array($link1, $link2, $link3, $link4, $link5, $link6, $link7);
     } else {
         $link1 = array('title' => 'Progress Report', 'url' => 'pages/progress.php');
         $link2 = array('title' => 'Ranking', 'url' => 'pages/ranking.php');
         $link3 = array('title' => 'Logout', 'url' => 'pages/logout.php');
         $menu = array($link1, $link2, $link3);
     }
     return $menu;
 }
Example #2
0
 public function testIsMemberOf()
 {
     $this->assertFalse($this->object->isMemberOf('admin'));
     $this->assertFalse($this->object->isMemberOf('a'));
     $this->assertFalse($this->object->isMemberOf(''));
     $this->assertFalse($this->object->isAdmin());
     $this->object->setCurrentUser(1, 'test', array('a', 'b', 'c'));
     $this->assertFalse($this->object->isMemberOf('admin'));
     $this->assertTrue($this->object->isMemberOf('a'));
     $this->assertTrue($this->object->isMemberOf('b'));
     $this->assertTrue($this->object->isMemberOf('c'));
     $this->assertFalse($this->object->isMemberOf('test'));
     $this->assertFalse($this->object->isAdmin());
     $this->object->setCurrentUser(1, 'test', array('a'));
     $this->assertFalse($this->object->isMemberOf('admin'));
     $this->assertTrue($this->object->isMemberOf('a'));
     $this->assertFalse($this->object->isMemberOf('b'));
     $this->assertFalse($this->object->isMemberOf('c'));
     $this->assertFalse($this->object->isMemberOf('test'));
     $this->assertFalse($this->object->isAdmin());
     $this->object->setCurrentUser(1, 'test', array('xyz'));
     $this->assertFalse($this->object->isMemberOf('a'));
     $this->assertTrue($this->object->isMemberOf('xyz'));
     $this->assertFalse($this->object->isMemberOf('xy'));
     $this->assertFalse($this->object->isMemberOf('XYZ'));
     $this->assertFalse($this->object->isAdmin());
     //Admin is member of all groups
     $this->object->setCurrentUser(1, 'test', array('admin'));
     $this->assertTrue($this->object->isMemberOf('admin'));
     $this->assertTrue($this->object->isMemberOf('a'));
     $this->assertTrue($this->object->isMemberOf('b'));
     $this->assertTrue($this->object->isMemberOf('XYZ'));
     $this->assertTrue($this->object->isAdmin());
 }
 public function go()
 {
     $this->setViewTemplate("rankings.tpl");
     if ($this->isLoggedIn()) {
         $username = $this->getLoggedInUser();
         if (Session::isAdmin() || Session::isTeacher()) {
             $classes = Classes::getAllClasses();
         } else {
             $user = User::findByUserName($username);
             $classes = ClassMemberships::getMembershipsOfUserObjects($user->id);
         }
         $this->addToView('classes', $classes);
     }
     if (!isset($_GET["class"]) || $_GET["class"] == "") {
         $rankings = ChallengeAttempts::getUniversalRankings();
     } else {
         $class_id = $_GET["class"];
         $class = Classes::getClass($class_id);
         if (!$class) {
             $this->addErrorMessage("Not a valid class");
             return $this->generateView();
         } else {
             $rankings = ChallengeAttempts::getClasswiseRankings($class_id);
         }
     }
     $final = array();
     $counter = 1;
     $rank = 1;
     $rankcount = 1;
     $prevcount = null;
     foreach ($rankings as $ranking) {
         if ($counter != 1 && $prevcount == $ranking['count']) {
             $rank = $rankcount;
             $rankcount++;
         }
         if ($counter != 1 && $prevcount != $ranking['count']) {
             $rankcount++;
             $rank = $rankcount;
         }
         $prevcount = $ranking['count'];
         $counter++;
         $temp = array('user_id' => $ranking['user_id'], 'time' => $ranking['time'], 'count' => $ranking['count'], 'username' => $ranking['username'], 'rank' => $rank);
         array_push($final, $temp);
     }
     $this->addToView('rankings', $final);
     return $this->generateView();
 }
 public function update($status)
 {
     if (!Session::isAdmin() && !Session::isTeacher()) {
         $username = Session::getLoggedInUser();
         $url = $_SERVER['REQUEST_URI'];
         $url_components = explode("/", $url);
         $count_url_components = count($url_components);
         for ($i = 0; $url_components[$i] != "challenges"; $i++) {
         }
         $pkg_name = $url_components[$i + 1];
         $user = User::findByUserName($username);
         $challenge = Challenge::getChallengeByPkgName($pkg_name);
         $user_id = $user->id;
         $challenge_id = $challenge[0]->id;
         if (!ChallengeAttempts::isChallengeCleared($user_id, $challenge_id)) {
             ChallengeAttempts::addChallengeAttempt($user_id, $challenge_id, $status);
         }
     }
 }
 public function go()
 {
     $username = $this->getLoggedInUser();
     $user = User::findByUserName($username);
     if (!$user) {
         return;
     }
     if (Session::isAdmin() || Session::isTeacher()) {
         $challenges = Challenge::getChallengesFrontend();
     } else {
         $challenges = Challenge::getChallengesAssigned($user->id);
     }
     $menu = array();
     foreach ($challenges as $challenge) {
         $link = array('id' => $challenge->id, 'title' => $challenge->title, 'url' => 'challenges/' . $challenge->pkg_name . '/index.php');
         array_push($menu, $link);
     }
     return $menu;
 }
Example #6
0
<?php

include_once TEMPLATE_PATH . '/site/helper/format.php';
$project = $SOUP->get('project');
// admin, trusted, creator may edit
$hasPermission = Session::isAdmin() || $project->isTrusted(Session::getUserID()) || $project->isCreator(Session::getUserID());
$formattedRules = formatRules($project->getRules());
$fork = $SOUP->fork();
$fork->set('title', "Rules");
$fork->set('id', "rules");
$fork->set('editable', $hasPermission);
//$fork->set('editLabel', 'Edit Rules');
$fork->startBlockSet('body');
?>

<?php 
if ($hasPermission) {
    ?>

<script type="text/javascript">
$(document).ready(function(){
	$("#btnSaveRules").mousedown(function(){
		buildPost({
			'processPage':'<?php 
    echo Url::detailsProcess($project->getID());
    ?>
',
			'info':
			{
				'action':'rules',
				'rules':$("#txtRules").val()
Example #7
0
}
?>
				<li class="left"><a href="<?php 
echo Url::projectNew();
?>
">Start a Project</a></li>			
				<li class="left"><a href="<?php 
echo Url::findProjects();
?>
">Find Projects</a></li>				
				<li class="left"><a href="<?php 
echo Url::help();
?>
">Help</a></li>
			<?php 
if (Session::isAdmin()) {
    ?>
				<li class="left"><a href="<?php 
    echo Url::admin();
    ?>
">Admin</a></li>
			<?php 
}
?>
			
			</ul>
		</div><!-- end .funnel -->	
	</div><!-- end .primary-nav -->
	<div class="funnel">
		<div class="heading">
				
Example #8
0
<?php

require_once "../../global.php";
if (!Session::isAdmin()) {
    header('Location: ' . Url::error());
    exit;
}
// projects
$projects = Project::getAllProjects();
// users
$users = User::getAllUsers();
// activity
$events = Event::getAllEvents(50);
$soup = new Soup();
$soup->set('projects', $projects);
$soup->set('users', $users);
$soup->set('events', $events);
$soup->set('selected', 'recentActivity');
$soup->render('site/page/admin');
Example #9
0
<?php

require_once "../../global.php";
$slug = Filter::text($_GET['slug']);
$filter = Filter::text($_GET['filter']);
$project = Project::getProjectFromSlug($slug);
// kick us out if slug invalid
if ($project == null) {
    header('Location: ' . Url::error());
    exit;
}
// if private project, limit access to invited users, members, and admins
// and exclude banned members
if ($project->getPrivate()) {
    if (!Session::isAdmin() && !$project->isCreator(Session::getUserID())) {
        if (!$project->isInvited(Session::getUserID()) && !$project->isMember(Session::getUserID()) && !$project->isTrusted(Session::getUserID()) || ProjectUser::isBanned(Session::getUserID(), $project->getID())) {
            header('Location: ' . Url::error());
            exit;
        }
    }
}
$projectID = $project->getID();
// page number, if any
if (empty($_GET['page'])) {
    $page = 1;
} else {
    $page = Filter::numeric($_GET['page']);
}
define('EVENTS_PER_PAGE', 10);
// how many events per page
switch ($filter) {
require_once "../../global.php";
require_once TEMPLATE_PATH . '/site/helper/format.php';
$projectId = isset($_POST['projectID']) ? Filter::numeric($_POST['projectID']) : $_POST['selProject'];
//Validate that the project id specified corresponds to an actual project.
// kick us out if slug or task invalid
$project = Project::load($projectId);
//Find referral url in case there is a problem and we have to redirect the user
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : Url::dashboard();
if ($project == null) {
    Session::setMessage('You must select a project to upload tasks from a CSV');
    header('Location: ' . $referer);
    exit;
} else {
    //Check if project creator or admin
    if (Session::isAdmin() || $project->isCreator(Session::getUserID())) {
        //Want to make sure end of file is .csv and not .xcsv (for example)
        //Need to figure out how to add CSV file filtering
        //Run each line of csv through validator and return JSON string
        $targetDir = UPLOAD_PATH;
        // 5 minutes execution time
        @set_time_limit(5 * 60);
        // Get parameters
        $chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
        $chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
        $fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
        //Make sure the user uploaded a file
        if (empty($fileName)) {
            Session::setMessage('You must select a CSV file');
            header('Location: ' . $referer);
            exit;
Example #11
0
 public static function isAuthor()
 {
     return Session::isAdmin() || "AUTHOR" === Session::getUserRole();
 }
Example #12
0
 /**
  * Return whether this is an admin session.
  *
  * @return boolean
  */
 public function isAdmin()
 {
     return Session::isAdmin();
 }
Example #13
0
 public function testLogOut()
 {
     $email = 'me@example.com';
     $cookie_dao = DAOFactory::getDAO('CookieDAO');
     $cookie = $cookie_dao->generateForEmail($email);
     $_COOKIE[Session::COOKIE_NAME] = $cookie;
     $this->simulateLogin($email, true);
     $session = new Session();
     $this->assertTrue(Session::isLoggedIn());
     $this->assertTrue(Session::isAdmin());
     $this->assertEqual(Session::getLoggedInUser(), $email);
     $test_email = $cookie_dao->getEmailByCookie($cookie);
     $this->assertEqual($email, $test_email);
     $session->logOut();
     $this->assertFalse(Session::isLoggedIn());
     $this->assertFalse(Session::isAdmin());
     $this->assertNull(Session::getLoggedInUser());
     $test_email = $cookie_dao->getEmailByCookie($cookie);
     $this->assertNull($test_email);
 }
Example #14
0
 public static function getUserEvents($userID = null, $limit = null)
 {
     if ($userID == null) {
         return null;
     }
     $loggedInUserID = Session::getUserID();
     $query = "SELECT e.id AS id FROM " . self::DB_TABLE . " e";
     $query .= " INNER JOIN " . EventType::DB_TABLE . " et ON ";
     $query .= " e.event_type_id = et.id";
     $query .= " LEFT OUTER JOIN " . Project::DB_TABLE . " p ON ";
     $query .= " e.project_id = p.id";
     $query .= " WHERE e.user_1_id = " . $userID;
     if (empty($loggedInUserID)) {
         $query .= " AND et.hidden = 0";
         // ignore hidden events
         $query .= " AND ( (p.private = 0) OR";
         $query .= " (e.project_id IS NULL) )";
     } elseif (!Session::isAdmin()) {
         // let fellow members see private project events
         $query .= " AND et.hidden = 0";
         // ignore hidden events
         $query .= " AND (p.private = 0";
         $query .= " OR p.id IN (";
         $query .= " SELECT project_id FROM " . ProjectUser::DB_TABLE;
         $query .= " WHERE user_id = " . $loggedInUserID;
         $query .= " AND relationship != " . ProjectUser::BANNED;
         $query .= " ) OR (e.project_id IS NULL) )";
     }
     $query .= " ORDER BY e.date_created DESC";
     if ($limit != null) {
         $query .= " LIMIT " . $limit;
     }
     //echo $query;
     $db = Db::instance();
     $result = $db->lookup($query);
     if (!mysql_num_rows($result)) {
         return array();
     }
     $events = array();
     while ($row = mysql_fetch_assoc($result)) {
         $events[$row['id']] = self::load($row['id']);
     }
     return $events;
 }
 function generate()
 {
     global $smarty;
     $prevdate = "";
     $this->kill_list_->rewind();
     $smarty->assign('daybreak', $this->daybreak_);
     $smarty->assign('comments_count', config::get('comments_count'));
     // evil hardcode-hack, don't do this at home kids ! ;)
     if (config::get('style_name') == 'revelations') {
         $smarty->assign('comment_white', '_white');
     }
     $c = 0;
     $kdpage = array('a', 'kill_detail', true);
     $krpage = array('a', 'kill_related', true);
     $kills = array();
     while ($kill = $this->kill_list_->getKill()) {
         if ($this->limit_ && $c >= $this->limit_) {
             break;
         } else {
             $c++;
         }
         $curdate = substr($kill->getTimeStamp(), 0, 10);
         if ($curdate != $prevdate) {
             if (count($kills) && $this->daybreak_) {
                 $kl[] = array('kills' => $kills, 'date' => strtotime($prevdate));
                 $kills = array();
             }
             $prevdate = $curdate;
         }
         $kll = array();
         $kll['id'] = $kill->getID();
         $kll['victimshipimage'] = $kill->getVictimShipImage(32);
         $kll['victimshipname'] = $kill->getVictimShipName();
         $kll['victimshipclass'] = $kill->getVictimShipClassName();
         $kll['victim'] = $kill->getVictimName();
         $kll['victimiskloss'] = $kill->getISKLoss();
         if ($kll['victimiskloss'] > 1000000000) {
             $kll['victimiskloss'] = sprintf("%.01fb", $kll['victimiskloss'] / 1000000000);
         } elseif ($kll['victimiskloss'] > 1000000) {
             $kll['victimiskloss'] = sprintf("%.01fm", $kll['victimiskloss'] / 1000000);
         } elseif ($kll['victimiskloss'] > 1000) {
             $kll['victimiskloss'] = sprintf("%.0fk", $kll['victimiskloss'] / 1000);
         }
         $kll['victimcorp'] = $kill->getVictimCorpName();
         $kll['victimalliancename'] = $kill->getVictimAllianceName();
         $kll['fb'] = $kill->getFBPilotName();
         $kll['fbcorp'] = $kill->getFBCorpName();
         if ($kill->isClassified() && !Session::isAdmin()) {
             if (config::get('killlist_regionnames')) {
                 $kll['region'] = Language::get("classified");
             }
             $kll['systemsecurity'] = "-";
             $kll['system'] = Language::get("classified");
         } else {
             if (config::get('killlist_regionnames')) {
                 $kll['region'] = $kill->getSystem()->getRegionName();
             }
             $kll['systemsecurity'] = $kill->getSolarSystemSecurity();
             $kll['system'] = $kill->getSolarSystemName();
         }
         $kll['victimid'] = $kill->getVictimID();
         $kll['victimcorpid'] = $kill->getVictimCorpID();
         $kll['victimallianceid'] = $kill->getVictimAllianceID();
         $kll['victimshipid'] = $kill->getVictimShipExternalID();
         $kll['fbid'] = $kill->getFBPilotID();
         $kll['fbcorpid'] = $kill->getFBCorpID();
         $kll['inv'] = 0;
         if (config::get('killlist_involved')) {
             $kll['inv'] = $kill->getInvolvedPartyCount();
         }
         $kll['timestamp'] = $kill->getTimeStamp();
         if (config::get('killlist_alogo')) {
             // Need to return yet another value from killlists.
             $all = new Alliance($kill->getVictimAllianceID());
             if (strcasecmp($all->getName(), "None") != 0) {
                 $kll['allianceexists'] = true;
                 $kll['victimallianceicon'] = $all->getPortraitURL(32);
             } else {
                 $kll['allianceexists'] = true;
                 $crp = new Corporation($kill->getVictimCorpID());
                 $kll['victimallianceicon'] = $crp->getPortraitURL(32);
             }
         }
         if (isset($kill->_tag)) {
             $kll['tag'] = $kill->_tag;
         }
         $kll['fbplext'] = $kill->getFBPilotExternalID();
         $kll['plext'] = $kill->getFBPilotExternalID();
         if (config::get('comments_count')) {
             $kll['commentcount'] = $kill->countComment();
         }
         $kll['loss'] = false;
         $kll['kill'] = false;
         if ($this->combined_) {
             if (config::get('cfg_allianceid') && in_array($kill->getVictimAllianceID(), config::get('cfg_allianceid'))) {
                 $kll['loss'] = true;
             } else {
                 if (config::get('cfg_corpid') && in_array($kill->getVictimCorpID(), config::get('cfg_corpid'))) {
                     $kll['loss'] = true;
                 } else {
                     if (config::get('cfg_pilotid') && in_array($kill->getVictimID(), config::get('cfg_pilotid'))) {
                         $kll['loss'] = true;
                     }
                 }
             }
             $kll['kill'] = !$kll['loss'];
         }
         $kll['urldetail'] = edkURI::build($kdpage, array('kll_id', $kll['id'], true));
         if (!$kill->isClassified()) {
             $kll['urlrelated'] = edkURI::build($krpage, array('kll_id', $kll['id'], true));
         }
         $kll['victimextid'] = $kill->getVictimExternalID();
         $kll['urlvictim'] = edkURI::page('pilot_detail', $kll['victimextid'] ? $kll['victimextid'] : $kll['victimid'], $kll['victimextid'] ? 'plt_ext_id' : 'plt_id');
         $kll['urlfb'] = edkURI::page('pilot_detail', $kll['fbplext'] ? $kll['fbplext'] : $kll['fbid'], $kll['fbplext'] ? 'plt_ext_id' : 'plt_id');
         if ($kll['allianceexists']) {
             $kll['urlvictimall'] = edkURI::page('alliance_detail', $kll['victimallianceid'], 'all_id');
         }
         $kll['urlvictimcorp'] = edkURI::page('corp_detail', $kll['victimcorpid'], 'crp_id');
         $kll['urlfbcorp'] = edkURI::page('corp_detail', $kll['fbcorpid'], 'crp_id');
         event::call('killlist_table_kill', $kll);
         $kills[] = $kll;
     }
     event::call('killlist_table_kills', $kills);
     if (count($kills)) {
         $kl[] = array('kills' => $kills, 'date' => strtotime($prevdate));
     }
     $smarty->assignByRef('killlist', $kl);
     $smarty->assign('killlist_iskloss', config::get('killlist_iskloss'));
     return $smarty->fetch(getcwd() . "/mods/highlight_capitals/templates/killlisttable.tpl");
 }
Example #16
0
<?php

require_once "../../global.php";
$slug = Filter::text($_GET['slug']);
$project = Project::getProjectFromSlug($slug);
// kick us out if slug invalid or not organizer/creator
if ($project == null) {
    header('Location: ' . Url::error());
    exit;
} elseif (!Session::isAdmin() && !$project->isTrusted(Session::getUserID()) && !$project->isCreator(Session::getUserID())) {
    header('Location: ' . Url::error());
    exit;
}
//do not allow banned members to access project
$isBanned = ProjectUser::isBanned(Session::getUserID(), $project->getID());
if ($isBanned) {
    header('Location: ' . Url::error());
    exit;
}
$yourTasks = Task::getYourTasks(Session::getUserID(), $project->getID());
$soup = new Soup();
$soup->set('project', $project);
$soup->set('yourTasks', $yourTasks);
$soup->render('project/page/taskNew');
Example #17
0
function show_header($title)
{
    // header for html-page
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");
    header("Content-Type: text/html; charset=" . $GLOBALS["charset"]);
    /* NAS4FREE & QUIXPLORER CODE*/
    // Html & Page Headers
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
    echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"" . system_get_language_code() . "\" lang=\"" . system_get_language_code() . "\" dir=\"" . $GLOBALS["text_dir"] . "\">\n";
    echo "<head>\n";
    echo "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"" . $GLOBALS["charset"] . "\">\n";
    echo "<title>Nas4free.local - File Manager</title>\n";
    if (isset($pgrefresh) && $pgrefresh) {
        echo "<meta http-equiv='refresh' content=\"" . $pgrefresh . "\"/>\n";
    }
    echo "<link href=\"./_style/style.css\" rel=\"stylesheet\"\ttype=\"text/css\">\n";
    echo "<link href=\"../gui.css\" rel=\"stylesheet\" type=\"text/css\">\n";
    echo "<link href=\"../navbar.css\" rel=\"stylesheet\" type=\"text/css\">\n";
    echo "<link href=\"../tabs.css\" rel=\"stylesheet\" type=\"text/css\">\n";
    echo "<script type=\"text/javascript\" src=\"../js/jquery.min.js\"></script>\n";
    echo "<script type=\"text/javascript\" src=\"../js/gui.js\"></script>\n";
    if (isset($pglocalheader) && !empty($pglocalheader)) {
        if (is_array($pglocalheader)) {
            foreach ($pglocalheader as $pglocalheaderv) {
                echo $pglocalheaderv;
                echo "\n";
            }
        } else {
            echo $pglocalheader;
            echo "\n";
        }
    }
    echo "</head>\n";
    // NAS4Free Header
    echo "<body>\n";
    echo "<div id=\"header\">\n";
    echo "<div id=\"headerlogo\">\n";
    echo "<a title=\"www." . get_product_url() . "\" href=\"http://" . get_product_url() . "\" target='_blank'><img src='../header_logo.png' alt='logo' /></a>\n";
    echo "</div>\n";
    echo "<div id=\"headerrlogo\">\n";
    echo "<div class=\"hostname\">\n";
    echo "<span>" . system_get_hostname() . "&nbsp;</span>\n";
    echo "</div>\n";
    echo "</div>\n";
    echo "</div>\n";
    echo "<div id=\"headernavbar\">\n";
    echo "<ul id=\"navbarmenu\">\n";
    echo display_menu("system");
    echo display_menu("network");
    echo display_menu("disks");
    echo display_menu("services");
    //-- Begin extension section --//
    if (Session::isAdmin() && isset($g) && isset($g['www_path']) && is_dir("{$g['www_path']}/ext")) {
        echo "<li>\n";
        echo "<a href=\"index.php\" onmouseover=\"mopen('extensions')\" onmouseout=\"mclosetime()\">" . gettext("Extensions") . "</a>\n";
        echo "<div id=\"extensions\" onmouseover=\"mcancelclosetime()\" onmouseout=\"mclosetime()\">\n";
        $dh = @opendir("{$g['www_path']}/ext");
        if ($dh) {
            while (($extd = readdir($dh)) !== false) {
                if ($extd === "." || $extd === "..") {
                    continue;
                }
                @(include "{$g['www_path']}/ext/" . $extd . "../menu.inc");
            }
            closedir($dh);
        }
        echo "</div>\n";
        echo "</li>\n";
    }
    //-- End extension section --//
    echo display_menu("access");
    echo display_menu("status");
    echo display_menu("diagnostics");
    echo display_menu("advanced");
    echo display_menu("help");
    echo "</ul>\n";
    echo "<div style=\"clear:both\"></div>\n";
    echo "</div>\n";
    echo "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />\n";
    // QuiXplorer Header
    $pgtitle = array(gettext("Advanced"), gettext("File Manager"));
    if (!isset($pgtitle_omit) || !$pgtitle_omit) {
        echo "<div style=\"margin-left: 50px;\"><p class=\"pgtitle\">" . htmlspecialchars(gentitle($pgtitle)) . "</p></div>\n";
    }
    echo "<center>\n";
    echo "<table border=\"0\" width=\"93%\" cellspacing=\"0\" cellpadding=\"5\">\n";
    echo "<tbody>\n";
    echo "<tr>\n";
    echo "<td class=\"title\" aligh=\"left\">\n";
    if ($GLOBALS["require_login"] && isset($GLOBALS['__SESSION']["s_user"])) {
        echo "[" . $GLOBALS['__SESSION']["s_user"] . "] ";
    }
    echo $title;
    echo "</td>\n";
    echo "<td class=\"title_version\" align=\"right\">\n";
    echo "Powered by QuiXplorer";
    echo "</td>\n";
    echo "</tr>\n";
    echo "</tbody>\n";
    echo "</table>\n";
    echo "</center>";
    echo "<div class=\"main_tbl\">";
}
Example #18
0
	<ul id="navbarmenu">
		<?php 
echo display_menu("system");
?>
		<?php 
echo display_menu("network");
?>
		<?php 
echo display_menu("disks");
?>
		<?php 
echo display_menu("services");
?>
		<!-- Begin extension section -->
		<?php 
if (Session::isAdmin() && is_dir("{$g['www_path']}/ext")) {
    ?>
		<li>
			<a href="index.php" onmouseover="mopen('extensions')" onmouseout="mclosetime()"><?php 
    echo gettext("Extensions");
    ?>
</a>
			<div id="extensions" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
				<?php 
    $dh = @opendir("{$g['www_path']}/ext");
    if ($dh) {
        while (($extd = readdir($dh)) !== false) {
            if ($extd === "." || $extd === "..") {
                continue;
            }
            @(include "{$g['www_path']}/ext/" . $extd . "/menu.inc");
 /**
  * Returns whether or not a logged-in Hackademic user is an admin
  *
  * @return bool whether or not logged-in user is an admin
  */
 protected function isAdmin()
 {
     return Session::isAdmin();
 }
Example #20
0
 public function testLogOut()
 {
     $this->simulateLogin('me@example.com', true);
     $session = new Session();
     $this->assertTrue(Session::isLoggedIn());
     $this->assertTrue(Session::isAdmin());
     $this->assertEqual(Session::getLoggedInUser(), 'me@example.com');
     $session->logOut();
     $this->assertFalse(Session::isLoggedIn());
     $this->assertFalse(Session::isAdmin());
     $this->assertNull(Session::getLoggedInUser());
 }
Example #21
0
 public static function GenerateRow($pods = false, $header = true)
 {
     global $smarty;
     $klist = new KillList();
     $klist->setOrdered(true);
     $klist->setOrderBy("kll_isk_loss DESC");
     if ($pods == false) {
         $klist->setPodsNoobShips(false);
     } else {
         $klist->addVictimShipClass(2);
     }
     $klist->setLimit(self::NUM_DISPLAYED);
     if (isset($_GET["w"])) {
         self::$week = intval($_GET["w"]);
     }
     if (isset($_GET["m"])) {
         self::$month = intval($_GET["m"]);
     }
     if (isset($_GET["y"])) {
         self::$year = intval($_GET["y"]);
     }
     self::setTime(self::$week, self::$year, self::$month);
     $view = preg_replace('/[^a-zA-Z0-9_-]/', '', $_GET['view']);
     if (config::get('show_monthly')) {
         $start = makeStartDate(0, self::$year, self::$month);
         $end = makeEndDate(0, self::$year, self::$month);
         $klist->setStartDate(gmdate('Y-m-d H:i', $start));
         $klist->setEndDate(gmdate('Y-m-d H:i', $end));
         $smarty->assign("displaylist", date('F', mktime(0, 0, 0, self::$month, 1, self::$year)) . ", " . self::$year);
     } else {
         $klist->setWeek(self::$week);
         $klist->setYear(self::$year);
         $plist->setWeek(self::$week);
         $plist->setYear(self::$year);
         $smarty->assign("displaylist", "Week " . self::$week . ", " . self::$year);
     }
     if (config::get("exp_incloss")) {
         $smarty->assign("displaytype", "Kills and Losses");
         involved::load($klist, "combined");
     } else {
         $smarty->assign("displaytype", "Kills");
         involved::load($klist, "kill");
     }
     $kills = array();
     while ($kill = $klist->getKill()) {
         $kll = array();
         $plt = new Pilot($kill->getVictimID());
         if ($kill->isClassified() && !Session::isAdmin()) {
             $kll['systemsecurity'] = "-";
             $kll['system'] = Language::get("classified");
         } else {
             $kll['systemsecurity'] = $kill->getSolarSystemSecurity();
             $kll['system'] = $kill->getSolarSystemName();
         }
         $kll["id"] = $kill->getID();
         $kll["victim"] = $kill->getVictimName();
         $kll["victimid"] = $kill->getVictimID();
         $kll["victimship"] = $kill->getVictimShipName();
         $kll["victimshipid"] = $kill->getVictimShipExternalID();
         $kll["victimshipclass"] = $kill->getVictimShipClassName();
         $kll["victimcorp"] = $kill->getVictimCorpName();
         $kll["victimcorpid"] = $kill->getVictimCorpID();
         $alliance = Alliance::getByID($kill->getVictimAllianceID());
         if ($pods == false) {
             $kll["victimimageurl"] = $kill->getVictimShipImage(128);
         } else {
             $kll["victimimageurl"] = $plt->getPortraitURL(128);
         }
         $kll["victimallimage"] = $alliance->getPortraitURL(32);
         $kll["victimallname"] = $alliance->getName();
         if ((int) number_format($kill->getISKLoss(), 0, "", "") > 1000000000) {
             $kll["isklost"] = number_format($kill->getISKLoss() / 1000000000, 2, ".", "") . " Billion";
         } elseif ((int) number_format($kill->getISKLoss(), 0, "", "") > 1000000) {
             $kll["isklost"] = number_format($kill->getISKLoss() / 1000000, 2, ".", "") . " Million";
         } else {
             $kll["isklost"] = number_format($kill->getISKLoss(), 0, ".", ",");
         }
         if (config::get('cfg_allianceid') && in_array($kill->getVictimAllianceID(), config::get('cfg_allianceid'))) {
             $kll["class"] = "kl-loss";
             $kll["classlink"] = '<font color="#AA0000">&bull;</font>';
         } elseif (config::get('cfg_corpid') && in_array($kill->getVictimCorpID(), config::get('cfg_corpid'))) {
             $kll["class"] = "kl-loss";
             $kll["classlink"] = '<font color=\\"#AA0000\\">&bull;</font>';
         } elseif (config::get('cfg_pilotid') && in_array($kill->getVictimID(), config::get('cfg_pilotid'))) {
             $kll["class"] = "kl-loss";
             $kll["classlink"] = '<font color="#AA0000">&bull;</font>';
         } else {
             $kll["class"] = "kl-kill";
             $kll["classlink"] = '<font color="#00AA00">&bull;</font>';
         }
         $kills[] = $kll;
     }
     if ($header == true) {
         $smarty->assign("header", true);
     } else {
         $smarty->assign("header", false);
     }
     $smarty->assign("killlist", $kills);
     $smarty->assign("width", 100 / self::NUM_DISPLAYED);
     return $smarty->fetch(get_tpl('most_expensive_summary'));
 }
Example #22
0
<?php

include_once TEMPLATE_PATH . '/site/helper/format.php';
$project = $SOUP->get('project');
$accepted = $SOUP->get('accepted');
$update = $SOUP->get('update');
$updates = $SOUP->get('updates');
$uploads = $SOUP->get('uploads');
$task = $SOUP->get('task', null);
$comments = $SOUP->get('comments');
// only update creator may edit or create
$hasPermission = Session::isAdmin() || $update->getCreatorID() == Session::getUserID();
$fork = $SOUP->fork();
$fork->set('title', 'Contribution');
$fork->set('id', 'update');
$fork->set('editable', $hasPermission);
$fork->set('editLabel', 'Edit');
$fork->startBlockSet('body');
?>

<?php 
if ($hasPermission) {
    ?>

<script type="text/javascript">
$(document).ready(function(){
	
	$('#selStatus').val('<?php 
    echo $accepted->getStatus();
    ?>
');	
 protected function handleDeleteBattleSetup()
 {
     if (!Session::isAdmin() || !config::get("fleet_battles_mod_sideassign") || !isset($_POST["deleteSideAssignments"]) || $_POST["deleteSideAssignments"] != "reset") {
         return;
     }
     $timestampStart = $_POST["timestampStart"];
     $timestampEnd = $_POST["timestampEnd"];
     $systemIds = explode(",", $_POST["systemIds"]);
     foreach ($_POST as $elementName => $side) {
         if (strpos($elementName, "side_") === 0) {
             $elementName = substr($elementName, 5);
             // index 0 is entityType
             // index 1 is entityId
             $entityInfo = explode("-", $elementName);
             // for each system
             foreach ($systemIds as $systemId) {
                 // delete side assignment
                 $this->deleteSideAssignment($systemId, $timestampStart, $timestampEnd, $entityInfo[1], $entityInfo[0]);
             }
         }
     }
     $this->checkForBattleCacheUpdate($systemIds, $timestampStart, $timestampEnd);
     $this->statusMessages[] = "Side assignments have been deleted.";
 }