/** * @return All the users in the database. */ public function getAllUsers() { $conn = new connections(); $db = $conn->connect(); $res = $db->query('SELECT * FROM users'); if ($count = $res->num_rows) { $rows = $res->fetch_all(MYSQLI_ASSOC); return $rows; } else { return "No users in the table."; } }
/** * Event call to return data for a specific project * * @param object $model Project model * @param string $action Plugin task * @param string $areas Plugins to return data * @return array Return array of html */ public function onProject($model, $action = '', $areas = null, $params = array()) { $returnhtml = true; $arr = array('html' => '', 'metadata' => ''); // Get this area details $this->_area = $this->onProjectAreas(); // Check if our area is in the array of areas we want to return results for if (is_array($areas)) { if (empty($this->_area) || !in_array($this->_area['name'], $areas)) { return; } } // Project model $this->model = $model; // Check authorization if ($this->model->exists() && !$this->model->access('member')) { return $arr; } // Are we returning HTML? if ($returnhtml) { // Load repo model $repoName = !empty($params['repo']) ? $params['repo'] : Request::getVar('repo', 'local'); $this->repo = new \Components\Projects\Models\Repo($this->model, $repoName); $default = $this->params->get('default_action', 'browse'); $this->_publishing = Plugin::isEnabled('projects', 'publications') ? 1 : 0; $this->_database = \App::get('db'); $this->_uid = User::get('id'); $this->_task = $action ? $action : Request::getVar('action', $default); $this->subdir = trim(urldecode(Request::getVar('subdir', '')), DS); $this->publication = Request::getInt('pid', 0); // Set repo path if (!$this->model->exists()) { // Contribute process outside of projects $this->model->set('provisioned', 1); $this->_path = $this->getMembersPath(); } else { if (!$this->repo->exists()) { // Default to local repo (will redirect to add repo page in the future) $this->repo = new \Components\Projects\Models\Repo($this->model, 'local'); } $this->_path = $this->repo->get('path'); } // Establish connection to external services if ($this->model->exists() && !$this->model->isProvisioned()) { $this->_connect = new \Components\Projects\Helpers\Connect($this->model, $this->_uid, date_default_timezone_get()); // Sync service is Google if (!empty($this->_connect->_active) && $this->repo->isLocal()) { $this->_remoteService = 'google'; } } $ctask = 'connections'; if (($connection = Request::getInt('connection', null)) || $this->_task == 'editconnection' || $this->_task == 'saveconnection' || $this->_task == 'newconnection' || $this->_task == 'deleteconnection' || $this->_task == 'refreshconnection') { $ctask = $this->_task; $this->_task = 'connections'; } // File actions switch ($this->_task) { // Basic file management case 'upload': $arr['html'] = $this->_upload(); break; case 'save': case 'saveprov': $arr['html'] = $this->_save(); break; case 'delete': case 'removeit': $arr['html'] = $this->_delete(); break; case 'move': case 'moveit': $arr['html'] = $this->_move(); break; case 'rename': case 'renameit': $arr['html'] = $this->_rename(); break; case 'share': case 'shareit': $arr['html'] = $this->_share(); break; // History // History case 'history': $arr['html'] = $this->_history(); break; case 'diff': $arr['html'] = $this->_diff(); break; // Serve/preview // Serve/preview case 'compile': $arr['html'] = $this->_compile(); break; case 'serve': $arr['html'] = $this->serve(); break; case 'download': case 'open': $arr['html'] = $this->_download(); break; // Manage directory // Manage directory case 'newdir': $arr['html'] = $this->_newDir(); break; case 'deletedir': $arr['html'] = $this->_deleteDir(); break; case 'savedir': $arr['html'] = $this->_saveDir(); break; // Manage deleted // Manage deleted case 'trash': $arr['html'] = $this->_showTrash(); break; case 'restore': $arr['html'] = $this->_restore(); break; // Disk space management // Disk space management case 'diskspace': $arr['html'] = $this->diskspace($this->model, $this->repo->get('name'), $this->_uid); break; case 'optimize': case 'advoptimize': $arr['html'] = $this->optimize($this->model, $this->repo->get('name')); break; // Publishing selectors // Publishing selectors case 'select': case 'filter': $arr['html'] = $this->_select(); break; // Connections // Connections case 'connect': case 'disconnect': $arr['html'] = $this->_connect(); break; // Sync with remote // Sync with remote case 'sync': $arr['html'] = $this->_iniSync(); break; case 'sync_status': $arr['html'] = $this->syncStatus(); break; case 'sync_error': $arr['html'] = $this->syncError(); break; // New connected methods // New connected methods case 'connections': require_once __DIR__ . DS . 'connections.php'; $controller = new connections($this, $this->_option, $connection); $arr['html'] = $controller->execute($ctask); break; // File browser // File browser case 'browse': default: $arr['html'] = $this->_browse(); break; } } // Return data return $arr; }
public static function parseHafasXml($serverData, $lang) { $xml = new SimpleXMLElement($serverData); $connection = array(); $i = 0; //DEBUG: echo $serverData ; if (isset($xml->ConRes->ConnectionList->Connection)) { //get stations from & to once for all connections $fromstation = connections::getStationFromHafasLocation($xml->ConRes->ConnectionList->Connection[0]->Overview->Departure->BasicStop->Station['x'], $xml->ConRes->ConnectionList->Connection[0]->Overview->Departure->BasicStop->Station['y'], $lang); $tostation = connections::getStationFromHafasLocation($xml->ConRes->ConnectionList->Connection[0]->Overview->Arrival->BasicStop->Station['x'], $xml->ConRes->ConnectionList->Connection[0]->Overview->Arrival->BasicStop->Station['y'], $lang); foreach ($xml->ConRes->ConnectionList->Connection as $conn) { $connection[$i] = new Connection(); $connection[$i]->departure = new DepartureArrival(); $connection[$i]->arrival = new DepartureArrival(); $connection[$i]->duration = tools::transformDuration($conn->Overview->Duration->Time); $connection[$i]->departure->station = $fromstation; $connection[$i]->departure->time = tools::transformTime($conn->Overview->Departure->BasicStop->Dep->Time, $conn->Overview->Date); $connection[$i]->departure->platform = new Platform(); $connection[$i]->departure->direction = trim($conn->Overview->Departure->BasicStop->Dep->Platform->Text); $connection[$i]->departure->platform->name = trim($conn->Overview->Departure->BasicStop->Dep->Platform->Text); $connection[$i]->arrival->time = tools::transformTime($conn->Overview->Arrival->BasicStop->Arr->Time, $conn->Overview->Date); $connection[$i]->arrival->platform = new Platform(); $connection[$i]->arrival->platform->name = trim($conn->Overview->Arrival->BasicStop->Arr->Platform->Text); $connection[$i]->arrival->station = $tostation; //Delay and platform changes //TODO: get Delay from railtime instead - much better information $delay0 = 0; $delay1 = 0; $platformNormal0 = true; $platformNormal1 = true; if ($conn->RtStateList->RtState["value"] == "HAS_DELAYINFO") { $delay0 = tools::transformTime($conn->Overview->Departure->BasicStop->StopPrognosis->Dep->Time, $conn->Overview->Date) - $connection[$i]->departure->time; if ($delay0 < 0) { $delay0 = 0; } //echo "delay: " .$conn->Overview -> Departure -> BasicStop -> StopPrognosis -> Dep -> Time . "\n"; $delay1 = tools::transformTime($conn->Overview->Arrival->BasicStop->StopPrognosis->Arr->Time, $conn->Overview->Date) - $connection[$i]->arrival->time; if ($delay1 < 0) { $delay1 = 0; } if (isset($conn->Overview->Departure->BasicStop->StopPrognosis->Dep->Platform->Text)) { $platform0 = trim($conn->Overview->Departure->BasicStop->StopPrognosis->Dep->Platform->Text); $platformNormal0 = false; } if (isset($conn->Overview->Arrival->BasicStop->StopPrognosis->Arr->Platform->Text)) { $platform1 = trim($conn->Overview->Arrival->BasicStop->StopPrognosis->Arr->Platform->Text); $platformNormal1 = false; } } $connection[$i]->departure->delay = $delay0; $connection[$i]->departure->platform->normal = $platformNormal0; $connection[$i]->arrival->delay = $delay1; $connection[$i]->arrival->platform->normal = $platformNormal1; $trains = array(); $vias = array(); $directions = array(); $j = 0; $k = 0; $connectionindex = 0; //yay for spaghetti code. if (isset($conn->ConSectionList->ConSection)) { foreach ($conn->ConSectionList->ConSection as $connsection) { if (isset($connsection->Journey->JourneyAttributeList->JourneyAttribute)) { foreach ($connsection->Journey->JourneyAttributeList->JourneyAttribute as $att) { if ($att->Attribute["type"] == "NAME") { $trains[$j] = str_replace(" ", "", $att->Attribute->AttributeVariant->Text); $j++; } else { if ($att->Attribute["type"] == "DIRECTION") { $directions[$k] = stations::getStationFromName(trim($att->Attribute->AttributeVariant->Text), $lang); $k++; } } } if ($conn->Overview->Transfers > 0 && strcmp($connsection->Arrival->BasicStop->Station['name'], $conn->Overview->Arrival->BasicStop->Station['name']) != 0) { //current index for the train: j-1 $departDelay = 0; //Todo: NYImplemented $connarray = $conn->ConSectionList->ConSection; $departTime = tools::transformTime($connarray[$connectionindex + 1]->Departure->BasicStop->Dep->Time, $conn->Overview->Date); $departPlatform = trim($connarray[$connectionindex + 1]->Departure->BasicStop->Dep->Platform->Text); $arrivalTime = tools::transformTime($connsection->Arrival->BasicStop->Arr->Time, $conn->Overview->Date); $arrivalPlatform = trim($connsection->Arrival->BasicStop->Arr->Platform->Text); $arrivalDelay = 0; //Todo: NYImplemented $vias[$connectionindex] = new Via(); $vias[$connectionindex]->arrival = new ViaDepartureArrival(); $vias[$connectionindex]->arrival->time = $arrivalTime; $vias[$connectionindex]->arrival->platform = new Platform(); $vias[$connectionindex]->arrival->platform->name = $arrivalPlatform; $vias[$connectionindex]->arrival->platform->normal = 1; $vias[$connectionindex]->departure = new ViaDepartureArrival(); $vias[$connectionindex]->departure->time = $departTime; $vias[$connectionindex]->departure->platform = new Platform(); $vias[$connectionindex]->departure->platform->name = $departPlatform; $vias[$connectionindex]->departure->platform->normal = 1; $vias[$connectionindex]->timeBetween = $departTime - $arrivalTime; $vias[$connectionindex]->direction = $directions[$k - 1]; $vias[$connectionindex]->vehicle = "BE.NMBS." . $trains[$j - 1]; $vias[$connectionindex]->station = connections::getStationFromHafasLocation($connsection->Arrival->BasicStop->Station['x'], $connsection->Arrival->BasicStop->Station['y'], $lang); $connectionindex++; } } } if ($connectionindex != 0) { $connection[$i]->via = $vias; } } $connection[$i]->departure->vehicle = "BE.NMBS." . $trains[0]; $connection[$i]->departure->direction = $directions[0]; $connection[$i]->arrival->vehicle = "BE.NMBS." . $trains[sizeof($trains) - 1]; $connection[$i]->arrival->direction = $directions[sizeof($directions) - 1]; $i++; } } else { throw new Exception("We're sorry, we could not retrieve the correct data from our sources", 2); } return $connection; }
<?php if (session_start()) { echo " session started"; } else { echo " session not started"; } require 'require_connect_modals.php'; $con = new connections(); $con->modal_connect(); ?> <div id='imgs'> <?php $mc = new myclass(); $ri = new resizeImage(); $pa = new postarticle(); $tres = $_GET['tres']; $home_tab = $_GET['home_tab']; $home_tab = "lates"; if (!empty($home_tab)) { $_SESSION['home_tab'] = $home_tab; echo " tab is not empty tab = {$home_tab} session is " . $_SESSION['home_tab'] . "<br>"; } else { echo " tab is empty tab = {$home_tab} session is " . $_SESSION['home_tab'] . "<br>"; $home_tab = $_SESSION['home_tab']; } // echo " tres = $tres home_tab = $home_tab"; $con->calculate_show(22, intval($_GET['tres']), $mc); $con->home_tabs_selected($home_tab, $mc, 80); // while(false)
<?php require 'require_connect_modals.php'; $con = new connections(); $con->local_connect(); ?> <div id='imgs'> <?php $usr = new myclass(); $tres = $_GET['tres']; $con->calculate_show(8, intval($_GET['tres']), $usr); $con->home_tabs_selected($_GET['home_tab'], $usr); // new do it once at a time // $con->latest_look = get_all_look_latest(); // $con->all_users = $usr->get_all_user(); // $Tlatest_look = count($con->latest_look); // $Tall_users = count($con->all_users); // end do it onece at a time // print_r($con->activity); // echo "<br>"; // $Tresults = 2; //count($con->activity); // for ($i=0; $i <count($con->activity) ; $i++) // { // echo ' con->mno = '.$con->activity[$i]['con->mno'].'<br>'; // echo ' action = '.$con->activity[$i]['action'].'<br>'; // echo ' _table = '.$con->activity[$i]['_table'].'<br>'; // echo ' _table_id = '.$con->activity[$i]['_table_id'].'<br>'; // echo "user is name is = ". $usr->get_full_name_by_id($con->activity[$i]['con->mno']); // echo " rate comment and favorite a look "; // echo "by = ".$usr->get_full_name_by_look_id($con->activity[$i]['_table_id']);
public static function parseHafasXml($serverData, $lang, $fast) { $xml = new SimpleXMLElement($serverData); $connection = []; $i = 0; //DEBUG: //echo $serverData ; if (isset($xml->ConRes->ConnectionList->Connection)) { //get stations from & to once for all connections $fromstation = connections::getStationFromHafasDescription($xml->ConRes->ConnectionList->Connection[0]->Overview->Departure->BasicStop->Station['name'], $xml->ConRes->ConnectionList->Connection[0]->Overview->Departure->BasicStop->Station['x'], $xml->ConRes->ConnectionList->Connection[0]->Overview->Departure->BasicStop->Station['y'], $lang); $tostation = connections::getStationFromHafasDescription($xml->ConRes->ConnectionList->Connection[0]->Overview->Arrival->BasicStop->Station['name'], $xml->ConRes->ConnectionList->Connection[0]->Overview->Arrival->BasicStop->Station['x'], $xml->ConRes->ConnectionList->Connection[0]->Overview->Arrival->BasicStop->Station['y'], $lang); foreach ($xml->ConRes->ConnectionList->Connection as $conn) { $connection[$i] = new Connection(); $connection[$i]->departure = new DepartureArrival(); $connection[$i]->arrival = new DepartureArrival(); $connection[$i]->duration = tools::transformDuration($conn->Overview->Duration->Time); $connection[$i]->departure->station = $fromstation; $connection[$i]->departure->time = tools::transformTime($conn->Overview->Departure->BasicStop->Dep->Time, $conn->Overview->Date); $connection[$i]->departure->platform = new Platform(); $connection[$i]->departure->direction = trim($conn->Overview->Departure->BasicStop->Dep->Platform->Text); $connection[$i]->departure->platform->name = trim($conn->Overview->Departure->BasicStop->Dep->Platform->Text); $connection[$i]->arrival->time = tools::transformTime($conn->Overview->Arrival->BasicStop->Arr->Time, $conn->Overview->Date); $connection[$i]->arrival->platform = new Platform(); $connection[$i]->arrival->platform->name = trim($conn->Overview->Arrival->BasicStop->Arr->Platform->Text); $connection[$i]->arrival->station = $tostation; //Delay and platform changes //TODO: get Delay from railtime instead - much better information $delay0 = 0; $delay1 = 0; $platformNormal0 = true; $platformNormal1 = true; if ($conn->RtStateList->RtState["value"] == "HAS_DELAYINFO") { $delay0 = tools::transformTime($conn->Overview->Departure->BasicStop->StopPrognosis->Dep->Time, $conn->Overview->Date) - $connection[$i]->departure->time; if ($delay0 < 0) { $delay0 = 0; } //echo "delay: " .$conn->Overview -> Departure -> BasicStop -> StopPrognosis -> Dep -> Time . "\n"; $delay1 = tools::transformTime($conn->Overview->Arrival->BasicStop->StopPrognosis->Arr->Time, $conn->Overview->Date) - $connection[$i]->arrival->time; if ($delay1 < 0) { $delay1 = 0; } if (isset($conn->Overview->Departure->BasicStop->StopPrognosis->Dep->Platform->Text)) { $platform0 = trim($conn->Overview->Departure->BasicStop->StopPrognosis->Dep->Platform->Text); $platformNormal0 = false; } if (isset($conn->Overview->Arrival->BasicStop->StopPrognosis->Arr->Platform->Text)) { $platform1 = trim($conn->Overview->Arrival->BasicStop->StopPrognosis->Arr->Platform->Text); $platformNormal1 = false; } } $connection[$i]->departure->delay = $delay0; $connection[$i]->departure->platform->normal = $platformNormal0; $connection[$i]->arrival->delay = $delay1; $connection[$i]->arrival->platform->normal = $platformNormal1; $trains = []; $vias = []; $directions = []; $j = 0; $k = 0; $connectionindex = 0; //yay for spaghetti code. if (isset($conn->ConSectionList->ConSection)) { foreach ($conn->ConSectionList->ConSection as $connsection) { if (isset($connsection->Journey->JourneyAttributeList->JourneyAttribute)) { foreach ($connsection->Journey->JourneyAttributeList->JourneyAttribute as $att) { if ($att->Attribute["type"] == "NAME") { $trains[$j] = str_replace(" ", "", $att->Attribute->AttributeVariant->Text); $j++; } elseif ($att->Attribute["type"] == "DIRECTION") { $__stat = new stdClass(); //This recently changed: only fetch direction name, nothing else. $__stat->name = str_replace(" [NMBS/SNCB]", "", trim($att->Attribute->AttributeVariant->Text)); $directions[$k] = $__stat; $k++; } } if ($conn->Overview->Transfers > 0 && strcmp($connsection->Arrival->BasicStop->Station['name'], $conn->Overview->Arrival->BasicStop->Station['name']) != 0) { //current index for the train: j-1 $departDelay = 0; //Todo: NYImplemented $connarray = $conn->ConSectionList->ConSection; $departTime = tools::transformTime($connarray[$connectionindex + 1]->Departure->BasicStop->Dep->Time, $conn->Overview->Date); $departPlatform = trim($connarray[$connectionindex + 1]->Departure->BasicStop->Dep->Platform->Text); $arrivalTime = tools::transformTime($connsection->Arrival->BasicStop->Arr->Time, $conn->Overview->Date); $arrivalPlatform = trim($connsection->Arrival->BasicStop->Arr->Platform->Text); $arrivalDelay = 0; //Todo: NYImplemented $vias[$connectionindex] = new Via(); $vias[$connectionindex]->arrival = new ViaDepartureArrival(); $vias[$connectionindex]->arrival->time = $arrivalTime; $vias[$connectionindex]->arrival->platform = new Platform(); $vias[$connectionindex]->arrival->platform->name = $arrivalPlatform; $vias[$connectionindex]->arrival->platform->normal = 1; $vias[$connectionindex]->departure = new ViaDepartureArrival(); $vias[$connectionindex]->departure->time = $departTime; $vias[$connectionindex]->departure->platform = new Platform(); $vias[$connectionindex]->departure->platform->name = $departPlatform; $vias[$connectionindex]->departure->platform->normal = 1; $vias[$connectionindex]->timeBetween = $departTime - $arrivalTime; if (isset($directions[$k - 1])) { $vias[$connectionindex]->direction = $directions[$k - 1]; } else { $vias[$connectionindex]->direction = "unknown"; } $vias[$connectionindex]->vehicle = "BE.NMBS." . $trains[$j - 1]; $vias[$connectionindex]->station = connections::getStationFromHafasDescription($connsection->Arrival->BasicStop->Station['name'], $connsection->Arrival->BasicStop->Station['x'], $connsection->Arrival->BasicStop->Station['y'], $lang); $connectionindex++; } } } //check if there were vias at all if ($connectionindex != 0) { //if there were, lets calculate a URI for them $counter = 0; for ($counter = 1; $counter < sizeof($directions); $counter++) { if (isset($trains[$counter]) && isset($directions[$counter]) && isset($vias[$counter])) { $vias[$counter - 1]->departure->{"@id"} = connections::createDepartureURI($vias[$counter - 1]->station->{"@id"}, $trains[$counter], $directions[$counter]->name, $vias[$counter]->departure->time); } } //if there were vias, add them to the array $connection[$i]->via = $vias; } } $connection[$i]->departure->vehicle = "BE.NMBS." . $trains[0]; if (isset($directions[0])) { $connection[$i]->departure->direction = $directions[0]; $connection[$i]->departure->{"@id"} = connections::createDepartureURI($fromstation->{"@id"}, $trains[0], $directions[0]->name, $connection[$i]->departure->time); } else { $connection[$i]->departure->direction = "unknown"; } $connection[$i]->arrival->vehicle = "BE.NMBS." . $trains[sizeof($trains) - 1]; if (isset($directions[sizeof($directions) - 1])) { $connection[$i]->arrival->direction = $directions[sizeof($directions) - 1]; } else { $connection[$i]->arrival->direction = "unknown"; } $i++; } } else { throw new Exception("We're sorry, we could not retrieve the correct data from our sources", 2); } return $connection; }
<link href="css/style.css" type="text/css" rel="stylesheet"> <script src="js/myscript.js"> </script> <script src="js/jquery.js"></script> </head> <?php include_once "../connect.php"; if (isset($_SESSION["admin"])) { header("location:adminpanel.php"); } if (isset($_SESSION["modname"])) { header("location:moderatpanel.php"); } if (isset($_POST["submit"])) { $a = $_POST["email"]; $b = $_POST["password"]; $obj = new connections(); $obj->login($a, $b); //print $mesg1; } ?> <body> <div class="top"> <div class="head"> <p class="headtext1">Sarbat Khalsa</p> <hr width="120px" size="4" align="left" color="#137FF1" style="margin-left:30px; margin-top:-1px;"> <p class="headtext2">World Sikh Parliament</p> </div> <hr size="4" color="#000000" style="margin-top:30px"> </div>