public static function init() { if (!wbCore::isFuncDisabled('ini_set')) { // PHP configuration variables // Stop adding SID to URLs ini_set('session.use_trans_sid', 0); // User-defined save handler ini_set('session.save_handler', 'user'); // How to store data ini_set('session.serialize_handler', 'php'); // Use cookie to store the session ID ini_set('session.use_cookies', 1); // Name of our cookie ini_set('session.name', 'WEBISID'); $path = wbServer::getBaseURI(); if (empty($path)) { $path = '/'; } // Lifetime of our cookie. Session lasts set number of days $lifetime = wbConfig::get('Session.Duration') * 86400; ini_set('session.cookie_lifetime', $lifetime); // Cookie path // this should be customized for multi-server setups wanting to share // sessions ini_set('session.cookie_path', $path); // Garbage collection ini_set('session.gc_probability', 1); // Inactivity timeout for user sessions ini_set('session.gc_maxlifetime', wbConfig::get('Session.InactivityTimeout') * 60); // Auto-start session ini_set('session.auto_start', 1); } include_once 'lib/adodb/session/adodb-session2.php'; $GLOBALS['ADODB_SESS_CONN'] =& wbDB::getConn(); ADODB_Session::table(wbConfig::get('DB.prefix') . '_sessions'); session_start(); }
/** * Carry out a redirect * * @access public * @param redirectURL string the URL to redirect to */ static function Redirect($url) { $redirectURL = urldecode($url); // this is safe if called multiple times. if (headers_sent() == true) { return false; } // Remove & entities to prevent redirect breakage $redirectURL = str_replace('&', '&', $redirectURL); if (substr($redirectURL, 0, 4) != 'http') { // Removing leading slashes from redirect url $redirectURL = preg_replace('!^/*!', '', $redirectURL); // Get base URL $baseurl = wbServer::getBaseURL(); $redirectURL = $baseurl . $redirectURL; } if (preg_match('/IIS/', wbServer::getVar('SERVER_SOFTWARE')) && preg_match('/CGI/', wbServer::getVar('GATEWAY_INTERFACE'))) { $header = "Refresh: 0; URL={$redirectURL}"; } else { $header = "Location: {$redirectURL}"; } // if // Start all over again header($header); // NOTE: we *could* return for pure '1 exit point' but then we'd have to keep track of more, // so for now, we exit here explicitly. Besides the end of index.php this should be the only // exit point. exit; }
public static function show() { $level_id = wbRequest::getVarClean('level_id', 'int', 0); $tahun = wbRequest::getVarClean('tahun', 'str', ''); //timestamp $t = wbRequest::getVarClean('t', 'str', ''); if (empty($level_id) or empty($tahun)) { exit; } try { $ws_client = self::getNusoap(); $params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'bds', 'class' => 'dashboard_pendidikan', 'method' => 'show', 'type' => '')), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit); $ws_data = self::getResultData($ws_client, $params); $data['items'] = $ws_data['data']; $data['total'] = $ws_data['total']; $data['message'] = $ws_data['message']; $data['success'] = $ws_data['success']; } catch (Exception $e) { $data['message'] = $e->getMessage(); } $items = $data['items']['items']; $itemLevel = $data['items']['itemLevel']; //$items = $tSchoolType->getAllByLevelID($level_id, $tahun); //$itemLevel = $tSchoolLevel->get($level_id); $print = wbRequest::getVarClean('print', 'int', 0); if (!empty($print)) { wbUtil::startExcel('pendidikan_dashboard.xls'); } echo '<div class="body-wrap">'; echo '<div style="float:left;margin:5 5 0 5;">'; echo '<div><h3>JUMLAH SISWA ' . strtoupper($itemLevel['description']) . ' <br/>BERDASARKAN JENISNYA - TAHUN ' . $tahun . '</h3></div>'; if (!empty($print)) { echo '<table border="1" width ="100%">'; } else { echo '<table border="0" class="table-data" width ="100%">'; } echo '<tr> <th width="15">No</th> <th width="150">Jenis ' . $itemLevel['description'] . '</th> <th width="100">Jumlah Masuk </th> <th width="100">Jumlah Lulus </th> <th width="100">Jumlah Aktif </th> </tr>'; $i = 1; $datay = array(); $dataCode = array(); foreach ($items as $item) { $datay[] = $item['jml_masuk']; $dataCode[] = $item['code']; echo '<tr>'; echo '<td>' . $i++ . '</td>'; echo '<td>' . $item['code'] . '</td>'; echo '<td align="right">' . wbUtil::numberFormat($item['jml_masuk'], 0) . '</td>'; echo '<td align="right">' . wbUtil::numberFormat($item['jml_lulus'], 0) . '</td>'; echo '<td align="right">' . wbUtil::numberFormat($item['jml_aktif'], 0) . '</td>'; echo '</tr>'; } echo '</table>'; wbCore::loadJPGraph(); // Create the graph and setup the basic parameters $graph = new Graph(550, 300, 'auto'); $graph->img->SetMargin(40, 30, 40, 40); $graph->SetScale("textint"); $graph->SetFrame(true, 'white', 1); $graph->SetColor('#C9C9C9'); $graph->SetMarginColor('#D0DEF0'); // Add some grace to the top so that the scale doesn't // end exactly at the max value. //$graph->yaxis->scale->SetGrace(20); // Setup X-axis labels $graph->xaxis->SetTickLabels($dataCode); $graph->xaxis->SetFont(FF_FONT1); $graph->xaxis->SetColor('#400000', 'black'); // Stup "hidden" y-axis by given it the same color // as the background $graph->yaxis->SetColor('lightblue', '#004080'); $graph->ygrid->SetColor('white'); // Setup graph title ands fonts $graph->title->Set('GRAFIK SISWA ' . strtoupper($itemLevel['description']) . ' - TAHUN ' . $tahun); // Create a bar pot $bplot = new BarPlot($datay); $bplot->SetFillColor('#6C6CFF'); $bplot->SetColor('darkblue'); $bplot->SetWidth(0.5); $bplot->SetShadow('darkgray'); // Setup the values that are displayed on top of each bar $bplot->value->Show(); // Must use TTF fonts if we want text at an arbitrary angle $bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 8); $bplot->value->SetFormat('%d'); // Black color for positive values and darkred for negative values $bplot->value->SetColor("black", "darkred"); $graph->Add($bplot); // Finally stroke the graph $graph->Stroke('var/dashboard/dashboard_pendidikan.png'); echo '</div>'; echo '</div>'; echo '<div style="float:right;margin:15 5 0 5;"> <img src="' . wbServer::getBaseURL() . 'var/dashboard/dashboard_pendidikan.png?' . $t . '" alt="' . $t . '" /> </div>'; exit; }
public static function url($module = NULL, $class = '', $method = 'main', $args = array(), $generateXMLURL = false, $fragment = NULL) { // Parameter separator and initiator. $psep = '&'; $pini = '?'; $pathsep = '/'; // Initialise the path. $path = ''; $BaseModURL = 'index.php'; // No module specified - just jump to the home page. if (empty($module)) { return wbServer::getBaseURL() . $BaseModURL; } // If we have an empty argument (ie null => null) then set a flag and // remove that element. // FIXME: this is way too hacky, NULL as a key for an array sooner or later will fail. (php 4.2.2 ?) if (is_array($args) && @array_key_exists(NULL, $args) && $args[NULL] === NULL) { // This flag means that the GET part of the URL must be opened. $open_get_flag = true; unset($args[NULL]); } // If the path is still empty, then there is either no short URL support // at all, or no short URL encoding was available for these arguments. if (empty($path)) { $baseargs = array(); $baseargs = array('module' => $module); $baseargs['class'] = $class; $baseargs['method'] = $method; // Standard entry point - index.php or BaseModURL if provided in config.system.php $args = $baseargs + $args; // Add GET parameters to the path, ensuring each value is encoded correctly. $path = self::_URLaddParametersToPath($args, $BaseModURL, $pini, $psep); // We have the long form of the URL here. // Again, some form of hook may be useful. } // Add the fragment if required. if (isset($fragment)) { $path .= '#' . urlencode($fragment); } // Encode the URL if an XML-compatible format is required. if ($generateXMLURL) { $path = htmlspecialchars($path); } // Return the URL. return wbServer::getBaseURL() . $path; }