public static function index() { session::start(); render::add_val('content', phpexcel_block_class::getBlock()); render::get_main_tpl(); render::rend(); session::close(); }
public static function getBlock() { session::start(); $block_path = __DIR__ . '/block/'; $block_name = str_replace('_class', '', __CLASS__) . '.php'; self::$block_name = $block_name; self::$blocks[$block_name] = ['name' => $block_name, 'path' => $block_path]; return self::show(); }
function logon_perform() { // Check to see if the user is logging in as a guest or a normal user. if (isset($_POST['guest_logon'])) { // Check the Guest account is enabled. if (!user_guest_enabled()) { return false; } // Initialise Guest user session. session::start(0); // Generate new CSRF token session::refresh_csrf_token(); // Update the visitor log session::update_visitor_log(0, true); // Success return true; } else { if (isset($_POST['user_logon']) && isset($_POST['user_password'])) { // Extract the submitted username $user_logon = $_POST['user_logon']; // Extract the submitted password $user_password = $_POST['user_password']; // Try and login the user. if (($uid = user_logon($user_logon, $user_password)) !== false) { // Initialise a user session. session::start($uid); // Generate new CSRF token session::refresh_csrf_token(); // Update User's last forum visit forum_update_last_visit($uid); // Update the visitor log session::update_visitor_log($uid, true); // Check if we should save a token to allow auto logon, if (isset($_POST['user_remember']) && $_POST['user_remember'] == 'Y') { // Get a token for the entered password. $user_token = user_generate_token($uid); // Set a cookie with the logon and the token. html_set_cookie('user_logon', $user_logon, time() + YEAR_IN_SECONDS); html_set_cookie('user_token', $user_token, time() + YEAR_IN_SECONDS); } else { // Remove the cookie. html_set_cookie('user_logon', '', time() - YEAR_IN_SECONDS); html_set_cookie('user_token', '', time() - YEAR_IN_SECONDS); } // Success return true; } } } // Failed return false; }
public static function getBlock() { session::start(); $block_path = __DIR__ . '/block/'; $block_name = str_replace('_class', '', __CLASS__) . '.php'; self::$block_name = $block_name; self::$blocks[$block_name] = ['name' => $block_name, 'path' => $block_path]; // Create new PHPExcel object $xls = new PHPExcel(); // Устанавливаем индекс активного листа $xls->setActiveSheetIndex(0); // Получаем активный лист $sheet = $xls->getActiveSheet(); // Подписываем лист $sheet->setTitle('Таблица умножения'); // Вставляем текст в ячейку A1 $sheet->setCellValue("A1", 'Таблица умножения'); $sheet->getStyle('A1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID); $sheet->getStyle('A1')->getFill()->getStartColor()->setRGB('EEEEEE'); // Объединяем ячейки $sheet->mergeCells('A1:H1'); // Выравнивание текста $sheet->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); for ($i = 2; $i < 10; $i++) { for ($j = 2; $j < 10; $j++) { // Выводим таблицу умножения $sheet->setCellValueByColumnAndRow($i - 2, $j, $i . "x" . $j . "=" . $i * $j); // Применяем выравнивание $sheet->getStyleByColumnAndRow($i - 2, $j)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); } } //Сохранение листа excel в PDF рабочий вариант //1. скачать tcpdf, распаковать в classes //2. в PHPExcel/Settings строка 49 заменить tcPDF на tcpdf //3. далее работающий код $rendererLibrary = 'tcpdf'; $rendererLibraryPath = 'app/classes/' . $rendererLibrary; PHPExcel_Settings::setPdfRenderer('tcpdf', $rendererLibraryPath); $path = 'files/asdfg1_' . date('i') . '_' . date('s') . '.pdf'; $objWriter = new PHPExcel_Writer_PDF($xls); $objWriter = PHPExcel_IOFactory::createWriter($xls, 'PDF'); $objWriter->setSheetIndex(0); $objWriter->save($path); self::$values['path'] = $path; //echo //controller::call('/main/get_pdf', ['params' => ['path' => 'files/asdfg1.pdf']]); return self::show(); }
if (isset($_REQUEST['signout']) && $_REQUEST['signout']) { if (session::global_is_set('connected')) { $config = session::global_get('config'); if ($config->get_cfg_value('casActivated') == 'TRUE') { require_once 'CAS.php'; /* Move CAS autoload before FD autoload */ spl_autoload_unregister('CAS_autoload'); spl_autoload_register('CAS_autoload', TRUE, TRUE); phpCAS::client(CAS_VERSION_2_0, $config->get_cfg_value('casHost', 'localhost'), (int) $config->get_cfg_value('casPort', 443), $config->get_cfg_value('casContext', '')); // Set the CA certificate that is the issuer of the cert phpCAS::setCasServerCACert($config->get_cfg_value('casServerCaCertPath')); phpCas::logout(); } } session::destroy(); session::start(); } /* Reset errors */ session::set('errors', ''); session::set('errorsAlreadyPosted', ''); session::set('LastError', ''); /* Check if we need to run setup */ if (!file_exists(CONFIG_DIR . '/' . CONFIG_FILE)) { header('location:setup.php'); exit; } /* Check if fusiondirectory.conf (.CONFIG_FILE) is accessible */ if (!is_readable(CONFIG_DIR . '/' . CONFIG_FILE)) { msg_dialog::display(_('Configuration error'), sprintf(_('FusionDirectory configuration %s/%s is not readable. Please run fusiondirectory-setup --check-config to fix this.'), CONFIG_DIR, CONFIG_FILE), FATAL_ERROR_DIALOG); exit; }
/** * Initialize db connections, cache and session */ public static function init($options = []) { // initialize mbstring mb_internal_encoding('UTF-8'); mb_regex_encoding('UTF-8'); // get flags & dependencies $flags = application::get('flag'); $backend = application::get('numbers.backend', ['backend_exists' => true]); // processing wildcard first $wildcard = application::get('wildcard'); $wildcard_keys = null; if (!empty($wildcard['enabled']) && !empty($wildcard['model'])) { $wildcard_keys = call_user_func($wildcard['model']); application::set(['wildcard', 'keys'], $wildcard_keys); } // initialize cryptography $crypt = application::get('crypt'); if (!empty($crypt) && $backend) { foreach ($crypt as $crypt_link => $crypt_settings) { if (!empty($crypt_settings['submodule']) && !empty($crypt_settings['autoconnect'])) { $crypt_object = new crypt($crypt_link, $crypt_settings['submodule'], $crypt_settings); } } } // create database connections $db = application::get('db'); if (!empty($db) && $backend) { foreach ($db as $db_link => $db_settings) { if (empty($db_settings['autoconnect']) || empty($db_settings['servers']) || empty($db_settings['submodule'])) { continue; } $connected = false; foreach ($db_settings['servers'] as $server_key => $server_values) { $db_object = new db($db_link, $db_settings['submodule']); // wildcards replaces if (isset($wildcard_keys[$db_link])) { $server_values['dbname'] = $wildcard_keys[$db_link]['dbname']; } // connecting $server_values = array_merge2($server_values, $db_settings); $db_status = $db_object->connect($server_values); if ($db_status['success'] && $db_status['status']) { $connected = true; break; } } // checking if not connected if (!$connected) { throw new Exception('Unable to open database connection!'); } } } // initialize cache $cache = application::get('cache'); if (!empty($cache) && $backend) { foreach ($cache as $cache_link => $cache_settings) { if (empty($cache_settings['submodule']) || empty($cache_settings['autoconnect'])) { continue; } $connected = false; foreach ($cache_settings['servers'] as $cache_server) { $cache_object = new cache($cache_link, $cache_settings['submodule']); $cache_status = $cache_object->connect($cache_server); if ($cache_status['success']) { $connected = true; break; } } // checking if not connected if (!$connected) { throw new Exception('Unable to open cache connection!'); } } } // if we are from command line we exit here if (!empty($options['__run_only_bootstrap'])) { return; } // initialize session $session = application::get('flag.global.session'); if (!empty($session['start']) && $backend && !application::get('flag.global.__skip_session')) { session::start(isset($session['options']) ? $session['options'] : []); } // we need to get overrides from session and put them back to flag array $flags = array_merge_hard($flags, session::get('numbers.flag')); application::set('flag', $flags); // initialize i18n if ($backend) { $temp_result = i18n::init(); if (!$temp_result['success']) { throw new Exception('Could not initialize i18n.'); } } // format format::init(); // including libraries that we need to auto include if (!empty($flags['global']['library'])) { foreach ($flags['global']['library'] as $k => $v) { // we need to skip certain keys if ($k == 'submodule' || $k == 'options') { continue; } // we only include if autoconnect is on if (!empty($v['autoconnect'])) { factory::submodule('flag.global.library.' . $k . '.submodule')->add(); } } } // check if we need to include system files from frontend if (application::get('dep.submodule.numbers.frontend.system')) { numbers_frontend_system_model_base::start(); } }
} if ($valid) { $user_data = array('IPADDRESS' => get_ip_address(), 'REFERER' => session::get_http_referer(), 'LOGON' => $logon, 'NICKNAME' => $nickname, 'EMAIL' => $email); if (ban_check($user_data)) { $error_msg_array[] = gettext("The username or password you supplied is not valid."); $valid = false; } } if ($valid) { if (($new_uid = user_create($logon, $password, $nickname, $email)) !== false) { // Save the new user preferences user_update_prefs($new_uid, $new_user_prefs); // Save the new user signature user_update_sig($new_uid, $sig_content, true); // Initialise the new user session. session::start($new_uid); // Update User's last forum visit forum_update_last_visit($new_uid); // Update the visitor log session::update_visitor_log($new_uid, true); // Check to see if the user is going somewhere after they have registered. $final_uri = isset($final_uri) ? rawurlencode($final_uri) : ''; // If User Confirmation is enabled send the forum owners an email. if (forum_get_setting('require_user_approval', 'Y')) { admin_send_user_approval_notification($new_uid); } // If New User Notification is enabled send the forum owners an email. if (forum_get_setting('send_new_user_email', 'Y')) { admin_send_new_user_notification($new_uid); } // Display final success / confirmation page.
public static function end() { session::start(0); }
/** * 开启SESSION * 系统会对SESSION开启状态进行自动配置,所以这个方法不要使用 */ static function session_start() { session::start(); }
cache_disable_proxy(); // Check that Beehive is installed correctly install_check(); // Required includes require_once BH_INCLUDE_PATH . 'banned.inc.php'; require_once BH_INCLUDE_PATH . 'constants.inc.php'; require_once BH_INCLUDE_PATH . 'format.inc.php'; require_once BH_INCLUDE_PATH . 'header.inc.php'; require_once BH_INCLUDE_PATH . 'html.inc.php'; require_once BH_INCLUDE_PATH . 'lang.inc.php'; require_once BH_INCLUDE_PATH . 'session.inc.php'; // End Required includes // Initialise the session session::init(); // Populate the session store. session::start($_SESSION['UID']); // Perform ban check ban_check($_SESSION); // Update User's last forum visit forum_update_last_visit($_SESSION['UID']); // Update the visitor log session::update_visitor_log($_SESSION['UID']); // Initialise gettext lang_init(); // Enable the word filter ob filter ob_start('word_filter_ob_callback'); // Check to see if user account has been banned. if (session::user_banned()) { html_user_banned(); exit; }
} else { $sql = "insert into " . SESSION . " values('{$key}',{$expiry},'{$value}')"; } $re = $this->db->query($sql); if ($re) { return true; } else { return false; } } function destroy($key) { $qry = "delete from " . SESSION . " where sesskey = '{$key}'"; $qid = $this->db->query($qry); return $qid; } function gc($maxlifetime) { $qry = "delete from " . SESSION . " where expiry < " . time(); $qid = $this->db->query($qry); return true; } function start() { session_set_save_handler(array($this, 'open'), array($this, 'close'), array($this, 'read'), array($this, 'write'), array($this, 'destroy'), array($this, 'gc')); session_start(); } } $sess = new session(); $sess->start();
<?php include 'session.class.php'; $session = new session(); $session->start(); $session->set('test', 'Kada Rachid'); $session->stop(); echo $session->get('test');
echo $page->getOrdersStateIsone(); break; case 2: echo $page->getOrdersStateIstwo(); break; } break; case 14: //get orders from server $page = new page(); echo $page->getOrdersZeroFromServer(); break; case 15: //add or reduce prods of session $ses = new session(); $ses->start(); $_SESSION['shop'][$_POST['id']]['num'] += $_POST['add']; if ($_SESSION['shop'][$_POST['id']]['num'] <= 0) { unset($_SESSION['shop'][$_POST['id']]); } break; /* case 16://check root user if(isset($_POST['pass']) AND isset($_POST['name'])){ if($_POST['name']=='hyy' AND $_POST['pass']=='123'){ setcookie('hyy','1784794036',time()+3600*12); echo 1; exit(); }else{ echo 0; } }
public static function init() { session::start(); }