public function index() { global $_FANWE; clearTempImage(); include template('page/index_index'); display(); }
public function run() { $project = 'test'; // Check for requested file if (!empty($this->config->filename) && !file_exists($this->config->filename)) { throw new NoSuchFile($this->config->filename); } elseif (!empty($this->config->dirname) && !file_exists($this->config->dirname)) { throw new NoSuchDir($this->config->filename); } // Check for requested analyze $analyzer = $this->config->program; if (Analyzer::getClass($analyzer)) { $analyzers_class = array($analyzer); } else { $r = Analyzer::getSuggestionClass($analyzer); if (count($r) > 0) { echo 'did you mean : ', implode(', ', str_replace('_', '/', $r)), "\n"; } throw new NoSuchAnalyzer($analyzer); } display("Cleaning DB\n"); $clean = new CleanDb($this->gremlin, $this->config, Tasks::IS_SUBTASK); $clean->run(); $load = new Load($this->gremlin, $this->config, Tasks::IS_SUBTASK); $load->run(); unset($load); display("Project loaded\n"); $analyze = new Analyze($this->gremlin, $this->config, Tasks::IS_SUBTASK); $analyze->run(); unset($analyze); $results = new Results($this->gremlin, $this->config, Tasks::IS_SUBTASK); $results->run(); unset($results); display("Analyzed project\n"); }
function message($mes, $title = 'Error', $dest = "", $time = "3", $show_header = true) { $parse['title'] = $title; $parse['mes'] = $mes; $page .= parsetemplate(gettemplate('message_body'), $parse); display($page, $title, $show_header, $dest != "" ? "<meta http-equiv=\"refresh\" content=\"{$time};url={$dest}\">" : "", false); }
function ShowGouv($user) { global $dpath, $lang; includeLang('INGAME'); $mode = $_GET['mode']; if ($_POST && $mode == "change") { $iduser = $user["id"]; $SetSort = intval($_POST['settings_sort']); if ($user['staatsform'] < 1) { doquery("UPDATE {{table}} SET `staatsform` = '.{$SetSort}.' WHERE `id` = '.{$iduser}.' LIMIT 1", 'users'); message($lang['erfolgreichestaatsformwahl'], $lang['Staatsform']); dispay(gettemplate('staatsform_confirm'), 'Confirmation', false); } else { message($lang['badstaatsformwahl'], $lang['Staatsform']); } } else { $parse = $lang; $parse['dpath'] = $dpath; $parse['staatsformeins'] = "<option value =\"1\"" . ($user['staatsform'] == 1 ? " selected" : "") . ">" . $lang['barbarisch'] . "</option>"; $parse['staatsformeins'] .= "<option value =\"2\"" . ($user['staatsform'] == 2 ? " selected" : "") . ">" . $lang['demokratie'] . "</option>"; $parse['staatsformeins'] .= "<option value =\"3\"" . ($user['staatsform'] == 3 ? " selected" : "") . ">" . $lang['monarchie'] . "</option>"; $parse['staatsformeins'] .= "<option value =\"4\"" . ($user['staatsform'] == 4 ? " selected" : "") . ">" . $lang['diktatur'] . "</option>"; $parse['staatsformeins'] .= "<option value =\"5\"" . ($user['staatsform'] == 5 ? " selected" : "") . ">" . $lang['imperialisme'] . "</option>"; $parse['staatsformeins'] .= "<option value =\"6\"" . ($user['staatsform'] == 6 ? " selected" : "") . ">" . $lang['aristocratie'] . "</option>"; display(parsetemplate(gettemplate('staatsform_body'), $parse), 'Gouvernement', false); } }
function decentNumber($n) { $fives = 0; $threes = 0; $max = 0; if ($n / 3 == 0) { $fives = $n; display($fives, $threes); return true; } $max = floor($n / 3); for ($max; $max > 0; $max--) { $fives = $max * 3; $threes = $n - $fives; if ($threes % 5 == 0) { display($fives, $threes); return true; } } $max = floor($n / 5); for ($max; $max >= 1; $max--) { $threes = $max * 5; $fives = $n - $threes; if ($fives % 3 == 0) { display($fives, $threes); return true; } } return false; }
function ShowTechTreePage($CurrentUser, $CurrentPlanet) { global $resource, $requeriments, $lang; $parse = $lang; foreach ($lang['tech'] as $Element => $ElementName) { $parse = array(); $parse['tt_name'] = $ElementName; if (!isset($resource[$Element])) { $parse['Requirements'] = $lang['tt_requirements']; $page .= parsetemplate(gettemplate('techtree/techtree_head'), $parse); } else { if (isset($requeriments[$Element])) { $parse['required_list'] = ""; foreach ($requeriments[$Element] as $ResClass => $Level) { if (isset($CurrentUser[$resource[$ResClass]]) && $CurrentUser[$resource[$ResClass]] >= $Level) { $parse['required_list'] .= "<font color=\"#00ff00\">"; } elseif (isset($CurrentPlanet[$resource[$ResClass]]) && $CurrentPlanet[$resource[$ResClass]] >= $Level) { $parse['required_list'] .= "<font color=\"#00ff00\">"; } else { $parse['required_list'] .= "<font color=\"#ff0000\">"; } $parse['required_list'] .= $lang['tech'][$ResClass] . " (" . $lang['tt_lvl'] . $Level . ")"; $parse['required_list'] .= "</font><br>"; } } else { $parse['required_list'] = ""; $parse['tt_detail'] = ""; } $parse['tt_info'] = $Element; $page .= parsetemplate(gettemplate('techtree/techtree_row'), $parse); } } $parse['techtree_list'] = $page; return display(parsetemplate(gettemplate('techtree/techtree_body'), $parse)); }
public function display($tpl = '') { foreach ($this->arrays as $key => $value) { ${$key} = $value; } include display($tpl); }
public function run() { if ($this->config->project === 'default') { throw new ProjectNeeded(); } $path = $this->config->projects_root . '/projects/' . $this->config->project; if (!file_exists($path)) { throw new NoSuchProject($this->config->project); } display("Cleaning project {$this->config->project}\n"); $dirsToErase = array('log', 'report', 'Premier-ace', 'faceted', 'faceted2', 'ambassador'); foreach ($dirsToErase as $dir) { $dirPath = $path . '/' . $dir; if (file_exists($dirPath)) { display('removing ' . $dir); rmdirRecursive($dirPath); } } // rebuild log mkdir($path . '/log', 0755); $filesToErase = array('Flat-html.html', 'Flat-markdown.md', 'Flat-sqlite.sqlite', 'Flat-text.txt', 'Premier-ace.zip', 'Premier-html.html', 'Premier-markdown.md', 'Premier-sqlite.sqlite', 'Premier-text.txt', 'datastore.sqlite', 'magicnumber.sqlite', 'report.html', 'report.md', 'report.odt', 'report.pdf', 'report.sqlite', 'report.txt', 'report.zip', 'EchoWithConcat.json', 'PhpFunctions.json', 'bigArrays.txt', 'counts.sqlite', 'stats.txt', 'dump.sqlite', 'faceted.zip', 'faceted2.zip'); $total = 0; foreach ($filesToErase as $file) { $filePath = $path . '/' . $file; if (file_exists($filePath)) { display('removing ' . $file); unlink($filePath); ++$total; } } display("Removed {$total} files\n"); $this->datastore = new Datastore($this->config, Datastore::CREATE); display("Recreating database\n"); }
function learn($letters, Perceptron $perceptron) { $learnFor = 11; $iterations = 100; display($perceptron->weights); for ($i = 0; $i <= $iterations; $i++) { foreach ($letters as $letterNumber => $fonts) { $isCorrect = $letterNumber == $learnFor; foreach ($fonts as $letter) { //if ($i % 250 == 0) // display($letter, '#999'); $perceptronResponse = $perceptron->calculate($letter); if ($perceptronResponse == $isCorrect) { //if ($i % 250 == 0) // display($perceptron->weights, 'green'); continue; } //if ($i % 250 == 0) //display($perceptron->weights, 'red'); $perceptron->correctWeights($letter, (int) $isCorrect, (int) $perceptronResponse); } } //if ($i % 250 == 0) // display($perceptron->weights); } display($perceptron->weights); }
function DisplayGameSettingsPage($CurrentUser) { global $lang, $game_config, $_POST, $Adminerlaubt, $user; includeLang('admin/einstellung/einstellung_az'); if ($user['authlevel'] >= 1 and in_array($user['id'], $Adminerlaubt)) { if ($_POST['opt_save'] == "1") { if (isset($_POST['angriffszone']) && $_POST['angriffszone'] == 'on') { $game_config['angriffszone'] = "1"; } else { $game_config['angriffszone'] = "0"; } doquery("UPDATE {{table}} SET `config_value` = '" . $game_config['angriffszone'] . "' WHERE `config_name` = 'angriffszone';", 'config'); AdminMessage($lang['speichern'][100], $lang['speichern'][101], '?'); } else { $parse = $lang; $parse['angriffszone'] = $game_config['angriffszone'] == 1 ? " checked = 'checked' " : ""; $PageTPL = gettemplate('admin/einstellung/einstellung_az'); $Page .= parsetemplate($PageTPL, $parse); display($Page, $lang['adm_opt_title'], false, '', true); } } else { AdminMessage($lang['system'][9000], $lang['system'][9001]); } return $Page; }
function authorize() { //如果未登录,展示登录页 display('oauth_response_user_check'); //如果已登录,展示授权页 display('oauth_response_user_check'); }
public function __construct($data) { if (isset($data['session'])) { $guid = $data['guid']; $title = $data['blog_title']; $description = $data['description']; $access_id = $data['access_id']; $user = getUserFromSession($data['session']); if (!$guid) { $blog = new Blog(); $blog->owner_guid = $user->guid; $blog->save(); } else { $blog = getEntity($guid); } if ($blog->owner_guid == $user->guid) { $blog->title = $title; $blog->description = $description; $blog->access_id = $access_id; $blog->status = "draft"; $guid = $blog->save(); $blog = getEntity($guid); echo json_encode(array("guid" => $guid, "timeago" => display("output/friendly_time", array("timestamp" => $blog->last_updated)))); } } }
function index() { $space_id = false; $location_id = false; $exact_date = date('Y-m-d'); $spaces = $this->spacemodel->wpGetSpacesList(); $locations = $this->locationmodel->wpGetLocationsList(); // Process a user reservation if (!empty($_REQUEST['data'])) { $data = $_REQUEST['data']; if (!empty($data['space_id'])) { $space_id = (int) $data['space_id']; } if (!empty($data['location_id'])) { $location_id = (int) $data['location_id']; } if (!isset($spaces[(int) $space_id])) { $space_id = false; } if (!isset($locations[(int) $location_id])) { $location_id = false; } if (!empty($data['exact_date'])) { $exact_date = date('Y-m-d', strtotime((string) $data['exact_date'])); } } // Get data for the page $reservations = $this->reservationmodel->wpGetReservations(compact('space_id', 'location_id', 'exact_date')); list($capacity, $spacesLeft) = $this->reservationmodel->reservationsLeft($exact_date, $location_id); $data = compact('spaces', 'locations', 'reservations', 'location_id', 'space_id', 'exact_date', 'capacity', 'spacesLeft'); display('admin/reservations', $data, "Reservations"); }
function dashboard() { $this->load->model("locationmodel"); $this->load->model("billing/planmodel", '', true); $this->load->model("issuesmodel"); $this->load->model("lookuptablemodel"); /***************************************** * CHECKIN MODULE ****************************************/ $locationId = $this->locationmodel->getCurrentLocation(); //echo "locationId = $locationId"; $data["location"] = $this->locationmodel->getLocation($locationId); $data["signedInMembers"] = $this->locationmodel->whosHere($locationId, 12); /***************************************** * ISSUES MODULE ****************************************/ $data["issues"] = $this->issuesmodel->getMemberIssues(true, 0, 5); /***************************************** * CONFERENCE ROOMS MODULE ****************************************/ $data["location"]->conferencerooms = $this->locationmodel->getConferenceRooms(true, $locationId); /***************************************** * PRICING MODULE ****************************************/ $data["accesspricing"] = $this->locationmodel->getAccessPricing(); $data["plans"] = $this->planmodel->get_plans(); $data["admin_only"] = true; display('admin/dashboard.php', $data, "Front Desk Dashboard"); }
function ShowTopKB() { global $lang; //anzeige der Top 100 Liste includeLang('INGAME'); $parse = $lang; $RowsTPL = gettemplate('topkb/topkb_rows'); $top = doquery("SELECT * FROM {{table}} ORDER BY gesamtunits DESC LIMIT 100;", 'topkb'); $a = 0; while ($data = mysql_fetch_array($top)) { $a++; $timedeut = date("D d M H:i:s", $data['time']); $user1 = doquery("SELECT * FROM {{table}} WHERE username='******';", 'users', true); if ($data['fleetresult'] == "a" and $user1['hof'] == 1) { $bloc['top_fighters'] = "<a href=\"javascript:f('topkbuser.php?mode=" . $data['rid'] . "', '');\"><font color=\"green\">" . $data['angreifer'] . "</font><b> VS </b><font color=\"red\">" . $data['defender'] . "</font></a>"; } else { if ($data['fleetresult'] == "r" and $user1['hof'] == 1) { $bloc['top_fighters'] = "<a href=\"javascript:f('topkbuser.php?page=showtopkb&mode=" . $data['rid'] . "', '');\"><font color=\"red\">" . $data['angreifer'] . "</font><b> VS </b><font color=\"green\">" . $data['defender'] . "</font></a>"; } else { if ($data['fleetresult'] == "w" and $user1['hof'] == 1) { $bloc['top_fighters'] = "<a href=\"javascript:f('topkbuser.php?mode=" . $data['rid'] . "', '');\">" . $data['angreifer'] . "<b> VS </b>" . $data['defender'] . "</a>"; } } } $bloc['top_rank'] = $a; $bloc['top_time'] = $timedeut; $bloc['top_units'] = pretty_number($data['gesamtunits']); $bloc['underrow'] = $lang['grata'] . "test"; // date("r", $data['time']); $parse['top_list'] .= parsetemplate($RowsTPL, $bloc); } display(parsetemplate(gettemplate('topkb/topkb'), $parse), false); }
function ShowImperiumPage($CurrentUser) { global $lang, $resource, $reslist, $dpath; $planetsrow = doquery("\r\n\tSELECT `id`,`name`,`galaxy`,`system`,`planet`,`planet_type`,\r\n\t`image`,`field_current`,`field_max`,`metal`,`metal_perhour`,\r\n\t`crystal`,`crystal_perhour`,`deuterium`,`deuterium_perhour`,\r\n\t`energy_used`,`energy_max`,`metal_mine`,`crystal_mine`,`deuterium_sintetizer`,\r\n\t`solar_plant`,`fusion_plant`,`robot_factory`,`nano_factory`,`hangar`,`metal_store`,\r\n\t`crystal_store`,`deuterium_store`,`laboratory`,`terraformer`,`ally_deposit`,`silo`,\r\n\t`small_ship_cargo`,`big_ship_cargo`,`light_hunter`,`heavy_hunter`,`crusher`,`battle_ship`,\r\n\t`colonizer`,`recycler`,`spy_sonde`,`bomber_ship`,`solar_satelit`,`destructor`,`dearth_star`,\r\n\t`battleship`,`supernova`,`misil_launcher`,`small_laser`,`big_laser`,`gauss_canyon`,`ionic_canyon`,\r\n\t`buster_canyon`,`small_protection_shield`,`planet_protector`,`big_protection_shield`,`interceptor_misil`,\r\n\t`interplanetary_misil`, `mondbasis`, `phalanx`, `sprungtor` FROM {{table}} WHERE `id_owner` = '" . $CurrentUser['id'] . "' AND `destruyed` = 0;", 'planets'); $parse = $lang; $planet = array(); while ($p = mysql_fetch_array($planetsrow)) { $planet[] = $p; } $parse['mount'] = count($planet) + 1; foreach ($planet as $p) { $datat = array('<a href="game.php?page=overview&cp=' . $p['id'] . '&re=0"><img src="' . $dpath . 'planeten/small/s_' . $p['image'] . '.jpg" border="0" height="80" width="80"></a>', $p['name'], "[<a href=\"game.php?page=galaxy&mode=3&galaxy={$p['galaxy']}&system={$p['system']}\">{$p['galaxy']}:{$p['system']}:{$p['planet']}</a>]", $p['field_current'] . '/' . $p['field_max'], '<a href="game.php?page=resources&cp=' . $p['id'] . '&re=0&planettype=' . $p['planet_type'] . '">' . pretty_number($p['metal']) . '</a> / ' . pretty_number($p['metal_perhour']), '<a href="game.php?page=resources&cp=' . $p['id'] . '&re=0&planettype=' . $p['planet_type'] . '">' . pretty_number($p['crystal']) . '</a> / ' . pretty_number($p['crystal_perhour']), '<a href="game.php?page=resources&cp=' . $p['id'] . '&re=0&planettype=' . $p['planet_type'] . '">' . pretty_number($p['deuterium']) . '</a> / ' . pretty_number($p['deuterium_perhour']), pretty_number($p['energy_max'] - $p['energy_used']) . ' / ' . pretty_number($p['energy_max'])); $f = array('file_images', 'file_names', 'file_coordinates', 'file_fields', 'file_metal', 'file_crystal', 'file_deuterium', 'file_energy'); for ($k = 0; $k < 8; $k++) { $data['text'] = $datat[$k]; $parse[$f[$k]] .= parsetemplate(gettemplate('empire/empire_row'), $data); } foreach ($resource as $i => $res) { $data['text'] = $p[$resource[$i]] == 0 && $CurrentUser[$resource[$i]] == 0 ? '-' : (in_array($i, $reslist['build']) ? "<a href=\"game.php?page=buildings&cp={$p['id']}&re=0&planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : (in_array($i, $reslist['tech']) ? "<a href=\"game.php?page=buildings&mode=research&cp={$p['id']}&re=0&planettype={$p['planet_type']}\">{$CurrentUser[$resource[$i]]}</a>" : (in_array($i, $reslist['fleet']) ? "<a href=\"game.php?page=buildings&mode=fleet&cp={$p['id']}&re=0&planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : (in_array($i, $reslist['defense']) ? "<a href=\"game.php?page=buildings&mode=defense&cp={$p['id']}&re=0&planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : '-')))); $r[$i] .= parsetemplate(gettemplate('empire/empire_row'), $data); } } $m = array('build', 'tech', 'fleet', 'defense'); $n = array('building_row', 'technology_row', 'fleet_row', 'defense_row'); for ($j = 0; $j < 4; $j++) { foreach ($reslist[$m[$j]] as $a => $i) { $data['text'] = $lang['tech'][$i]; $parse[$n[$j]] .= "<tr>" . parsetemplate(gettemplate('empire/empire_row'), $data) . $r[$i] . "</tr>"; } } return display(parsetemplate(gettemplate('empire/empire_table'), $parse), false); }
public function __construct() { $body = display("pages/search_friends"); $guid = getInput("guid"); $button = "<a class='btn btn-success' href='" . getSiteURL() . "profile/{$guid}'>Return</a>"; $this->html = drawPage(array("header" => "Search Results", "body" => $body, "button" => $button)); }
public function update($module_name, $action, $id, $groups, $user, $title, $icon) { $output = array(); if ($groups) { $count = array_count_values($groups); $authorized = isset($count[0]) ? $count[0] >= $count[1] : 0; $this->model()->delete($module_name, $action, $id, 'group')->add($module_name, $action, $id, 'group', array_keys(array_filter($groups, function ($a) use($authorized) { return $a == $authorized; })), $authorized); } else { if ($user) { $this->model()->delete($module_name, $action, $id, 'user', $user_id = array_keys($user)[0]); if (($authorized = current($user)) != -1) { $this->model()->add($module_name, $action, $id, 'user', $user_id, $authorized); } } } $this->access->reload(); if ($groups) { $output['details'] = display($this->index($action, $title, $icon, $module_name, $id)); } else { if ($user) { $output['user_authorized'] = $authorized = $this->access($module_name, $action, $id, NULL, $user_id); $output['user_ambiguous'] = $authorized === NULL; $output['user_forced'] = is_int($authorized); } } $output['count'] = $this->access->count($module_name, $action, $id, $ambiguous); $output['ambiguous'] = $ambiguous; return json_encode($output); }
function remove() { extract($_REQUEST); $sql = "DELETE FROM cubit.cust_dates WHERE id='{$id}'"; db_exec($sql) or errDie("Unable to remove date."); return display(); }
function login() { include 'config.php'; $link = opendb(); if (isset($_POST["submit"])) { $query = doquery("SELECT * FROM {{table}} WHERE username='******' AND password='******' LIMIT 1", "users"); if (mysql_num_rows($query) != 1) { die("Invalid username or password. Please go back and try again."); } $row = mysql_fetch_array($query); if (isset($_POST["rememberme"])) { $expiretime = time() + 31536000; $rememberme = 1; } else { $expiretime = 0; $rememberme = 0; } $cookie = $row["id"] . " " . $row["username"] . " " . md5($row["password"] . "--" . $dbsettings["secretword"]) . " " . $rememberme; setcookie("dkgame", $cookie, $expiretime, "/", "", 0); header("Location: index.php"); die; } $page = gettemplate("login"); $title = "Log In"; display($page, $title, false, false, false, false); }
private function body() { $children = get_children_by_rel_type($this->properties['id'], "body"); foreach ($children as $child) { display($child, $this); } }
public function gets() { if (!$this->isNeedRead()) { display('reflash too fast~', 0); return; } $this->m_info['last_time'] = time(); $this->initOauth(); $parameter = $this->getParameters(); $json = $this->m_connection->get('statuses/user_timeline', $parameter); if (isset($json[0]['id_str'])) { $this->m_info['sinceId'] = $json[0]['id_str']; } $this->serializeInfo(); if (empty($json) || !is_array($json)) { display(_er('E_NO_UPDATE'), 0); } $result = array(); foreach ($json as $tweet) { $this->expandUrl($tweet); //array_push ( $result, $tweet ['text'] ); $result["{tweet_{$tweet['id_str']}}"] = trim($tweet['text']); } unset($json); $this->filter($result); return $result; }
function message($mes, $title = 'Error', $dest = "", $time = "3") { //$parse['color'] = $color; $parse['title'] = $title; $parse['mes'] = $mes; $page = parsetemplate(gettemplate('message_body'), $parse); display($page, $title, false, $dest != "" ? "<meta http-equiv=\"refresh\" content=\"{$time};URL=javascript:self.location='{$dest}';\">" : "", false); }
function index() { $this->load->model("issuesmodel"); $issueId = $this->uri->segment(4); $data["issues"] = $this->issuesmodel->getMemberIssues(true, 0, 5); $data["admin_only"] = true; display('admin/issues', $data, "Issues"); }
function __construct() { $order_id = pageArray(1); $header = "Order Details"; $subheader = "Order #: " . $order_id; $body = display("pages/order"); $this->html = drawPage(array("header" => $header, "subheader" => $subheader, "body" => $body)); }
function display_404($message, $file = '', $line = '') { if (isset($_SERVER['argc']) && $_SERVER['argc'] > 0) { display("This page does not exist"); } else { echo "<div style='width: 600px; margin: 150px auto; text-align: center; background-color: #F7F7F7; border: 10px solid #EEEEEE; padding: 40px 0px; font-family: Georgia; Arial, sans-serif;'>This page does not exist</div>"; } }
function __construct() { $invoice_id = pageArray(1); $header = "Invoice Details"; $subheader = "Invoice #" . $invoice_id; $body = display("pages/invoice"); $this->html = drawPage(array("header" => $header, "subheader" => $subheader, "body" => $body)); }
function avatar() { global $topvar; $topvar = true; global $userrow; $page = gettemplate("avatar"); $topnav = "<a href=\"index.php\"><img src=\"images/jogar.gif\" alt=\"Voltar a Jogar\" border=\"0\" /></a><a href=\"help.php\"><img src=\"images/button_help.gif\" alt=\"Ajuda\" border=\"0\" /></a>"; display($page, "Trocar Avatar", false, false, false); }
function remove() { extract($_REQUEST); foreach ($remove as $id) { $sql = "DELETE FROM cubit.recon_reasons WHERE id='{$id}'"; db_exec($sql) or errDie("Unable to remove reason."); } return display(); }
public function __construct() { $title = $body = $button = NULL; switch (pageArray(1)) { case "all": default: if (loggedIn()) { $admin_groups = Setting::get("admin_groups"); if (!$admin_groups) { $admin_groups = "users"; } if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") { $button = "<a href='" . getSiteURL() . "groups/create' class='btn btn-success'>Create a Group</a>"; } } $title = "Groups"; $body = display("pages/groups"); break; case "create": $admin_groups = Setting::get("admin_groups"); if (!$admin_groups) { $admin_groups = "user"; } if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") { $title = "Create a Group"; $body = drawForm(array("name" => "create_group", "action" => "createGroup", "method" => "post", "files" => true)); } break; case "view": $guid = pageArray(2); $group = getEntity($guid); $edit_url = getSiteURL() . "groups/edit/{$guid}"; $delete_url = addTokenToURL(getSiteURL() . "action/deleteGroup/{$guid}"); if ($group->ownerIsLoggedIn()) { $button = "<a href='{$edit_url}' class='btn btn-warning'>Edit Group</a>"; $button .= "<a href='{$delete_url}' class='btn btn-danger confirm'>Delete Group</a>"; } if (GroupsPlugin::loggedInUserCanJoin($group)) { $join_group_url = addTokenToURL(getSiteURL() . "action/JoinGroup/" . $group->guid); $button .= "<a href='{$join_group_url}' class='btn btn-success confirm'>Join Group</a>"; } if ($group->loggedInUserIsMember() && $group->owner_guid != getLoggedInUserGuid()) { $leave_group_url = addTokenToURL(getSiteURL() . "action/LeaveGroup/" . $group->guid); $button .= "<a href='{$leave_group_url}' class='btn btn-danger confirm'>Leave Group</a>"; } $title = $group->title; $body = display("pages/group"); break; case "edit": $guid = pageArray(2); $group = getEntity($guid); $title = "Edit " . $group->title; $body = drawForm(array("name" => "edit_group", "action" => "editGroup", "method" => "post", "files" => true)); break; } $this->html = drawPage(array("header" => $title, "body" => $body, "button" => $button)); }