public function run() { // Trigger tasks if (!defined('ENGINE_TASK_NOTRIGGER')) { $tasksTable = Engine_Api::_()->getDbtable('tasks', 'core'); if ($tasksTable->getTriggerType() == 'pre') { Engine_Api::_()->getDbtable('tasks', 'core')->trigger(); } } // Start main $this->bootstrap('frontcontroller'); $front = $this->getContainer()->frontcontroller; $default = $front->getDefaultModule(); if (null === $front->getControllerDirectory($default)) { throw new Zend_Application_Bootstrap_Exception('No default controller directory registered with front controller'); } // End main // Increment page views and referrer Engine_Api::_()->getDbtable('statistics', 'core')->increment('core.views'); Engine_Api::_()->getDbtable('referrers', 'core')->increment(); // Start main 2 $front->setParam('bootstrap', $this); $front->dispatch(); // End main 2 // Trigger tasks if (!defined('ENGINE_TASK_NOTRIGGER')) { if ($tasksTable->getTriggerType() == 'post') { Engine_Api::_()->getDbtable('tasks', 'core')->trigger(); } } // Close the session to prevent chicken-egg // http://bugs.php.net/bug.php?id=33772 Zend_Session::writeClose(); }
static function main() { Zend_Registry::set('config', new Strass_Config_Php('strass', array())); Zend_Registry::set('acl', new Strass_Installer_FakeAcl()); Strass_Cache::setup(); try { $fc = Zend_Controller_Front::getInstance(); $fc->setRequest(new Strass_Controller_Request_Http()); $fc->setParam('useDefaultControllerAlways', true); $fc->setParam('noViewRenderer', true); $fc->setModuleControllerDirectoryName('Installer'); $fc->addControllerDirectory(Strass::getPrefix() . 'include/Strass/Installer/Controller', 'Strass'); $fc->setDefaultModule('Strass'); $fc->registerPlugin(new Strass_Controller_Plugin_Error()); $fc->dispatch(); Zend_Session::writeClose(); } catch (Exception $e) { // affichage complet des exceptions non intercepté par le controlleur. À améliorer. $msg = ":(\n\n"; $msg .= $e->getMessage() . "\n\n"; $msg .= " à " . $e->getFile() . ":" . $e->getLine() . "\n\n"; $msg .= str_replace('#', '<br/>#', $e->getTraceAsString()) . "\n"; Orror::kill(strip_tags($msg)); } }
public function pageHeader() { // We have finished writing session data, so release the lock Zend_Session::writeClose(); // Ajax responses are always UTF8 header('Content-Type: text/html; charset=UTF-8'); $this->page_header = true; return $this; }
public function dispatchLoopShutdown() { if (Zend_Session::sessionExists() && Zend_Auth::getInstance()->hasIdentity()) { $ident = Zend_Auth::getInstance()->getIdentity(); $isVaporLogin = in_array($ident['authType'], array(App_Controller_Plugin_Auth::AUTH_TYPE_LOST_PASSWORD, App_Controller_Plugin_Auth::AUTH_TYPE_ASYNC, App_Controller_Plugin_Auth::AUTH_TYPE_EXTERNAL, App_Controller_Plugin_Auth::AUTH_TYPE_THIRD_PARTY, App_Controller_Plugin_Auth::AUTH_TYPE_DOWNLOAD_TOKEN)); if (!$isVaporLogin) { Zend_Session::writeClose(true); } else { Zend_Session::destroy(false); $_SESSION = array(); } } }
public function modAction($modAction) { switch ($modAction) { case 'ajax': Zend_Session::writeClose(); header('Content-Type: text/html; charset=UTF-8'); echo $this->getSidebarAjaxContent(); break; default: header('HTTP/1.0 404 Not Found'); break; } exit; }
public function modAction($mod_action) { switch ($mod_action) { case 'admin': $this->admin(); break; case 'generate': Zend_Session::writeClose(); $this->generate(WT_Filter::get('file')); break; default: header('HTTP/1.0 404 Not Found'); } }
function dAction() { $id = $this->_request->get('id'); $this->validateSignedLink($id); $id = intval($id); $media = $this->getDi()->videoTable->load($id); set_time_limit(600); while (@ob_end_clean()) { } Zend_Session::writeClose(); if ($path = $media->getFullPath()) { $this->_helper->sendFile($path, $media->getMime()); } else { $this->redirectLocation($media->getProtectedUrl($this->getDi()->config->get('storage.s3.expire', 15) * 60)); } }
public function run() { // Ensure frontcontroller and router are bootstrapped $this->bootstrap('frontcontroller'); $this->bootstrap('router'); $front = $this->getContainer()->frontcontroller; // Trigger tasks if (!defined('ENGINE_TASK_NOTRIGGER')) { // Get the request so we can get the params if (null === ($request = $front->getRequest())) { $request = new Zend_Controller_Request_Http(); $front->setRequest($request); } if ($request->getParam('notrigger')) { define('ENGINE_TASK_NOTRIGGER', true); } // Actually trigger now $tasksTable = Engine_Api::_()->getDbtable('tasks', 'core'); if ($tasksTable->getTriggerType() == 'pre') { Engine_Api::_()->getDbtable('tasks', 'core')->trigger(); } } // Start main $default = $front->getDefaultModule(); if (null === $front->getControllerDirectory($default)) { throw new Zend_Application_Bootstrap_Exception('No default controller directory registered with front controller'); } // End main // Start main 2 $front->setParam('bootstrap', $this); $front->dispatch(); // End main 2 // Trigger tasks if (!defined('ENGINE_TASK_NOTRIGGER')) { if ($tasksTable->getTriggerType() == 'post') { Engine_Api::_()->getDbtable('tasks', 'core')->trigger(); } } // Close the session to prevent chicken-egg // http://bugs.php.net/bug.php?id=33772 Zend_Session::writeClose(); }
public function run() { // Ensure frontcontroller and router are bootstrapped $this->bootstrap('frontcontroller'); $this->bootstrap('router'); $front = $this->getContainer()->frontcontroller; // Start main $default = $front->getDefaultModule(); if (null === $front->getControllerDirectory($default)) { throw new Zend_Application_Bootstrap_Exception('No default controller directory registered with front controller'); } // End main // Start main 2 $front->setParam('bootstrap', $this); $front->dispatch(); // End main 2 // Close the session to prevent chicken-egg // http://bugs.php.net/bug.php?id=33772 Zend_Session::writeClose(); }
public function modAction($modAction) { Zend_Session::writeClose(); header('Content-Type: text/html; charset=UTF-8'); switch ($modAction) { case 'search': $search = WT_Filter::get('search'); echo $this->search($search); break; case 'descendants': $individual = WT_Individual::getInstance(WT_Filter::get('xref', WT_REGEX_XREF)); if ($individual) { echo $this->loadSpouses($individual, 1); } break; default: header('HTTP/1.0 404 Not Found'); break; } exit; }
/** * Redirect to another URL * * By default, emits a 302 HTTP status header, prepends base URL as defined * in request object if url is relative, and halts script execution by * calling exit(). * * $options is an optional associative array that can be used to control * redirect behaviour. The available option keys are: * - exit: boolean flag indicating whether or not to halt script execution when done * - prependBase: boolean flag indicating whether or not to prepend the base URL when a relative URL is provided * - code: integer HTTP status code to use with redirect. Should be between 300 and 307. * * _redirect() sets the Location header in the response object. If you set * the exit flag to false, you can override this header later in code * execution. * * If the exit flag is true (true by default), _redirect() will write and * close the current session, if any. * * @param string $url * @param array $options Options to be used when redirecting * @return void */ protected function _redirect($url, array $options = null) { // prevent header injections $url = str_replace(array("\n", "\r"), '', $url); $exit = $this->getRedirectExit(); $prependBase = $this->getRedirectPrependBase(); $code = $this->getRedirectCode(); if (null !== $options) { if (isset($options['exit'])) { $exit = $options['exit'] ? true : false; } if (isset($options['prependBase'])) { $prependBase = $options['prependBase'] ? true : false; } if (isset($options['code'])) { $this->_checkRedirectCode($options['code']); $code = $options['code']; } } // If relative URL, decide if we should prepend base URL if ($prependBase && !preg_match('|^[a-z]+://|', $url)) { $request = $this->getRequest(); if ($request instanceof Zend_Controller_Request_Http) { $base = $request->getBaseUrl(); if ('/' != substr($base, -1) && '/' != substr($url, 0, 1)) { $url = $base . '/' . $url; } else { $url = $base . $url; } } } // Set response redirect $response = $this->getResponse(); $response->setRedirect($url, $code); if ($exit) { // Close session, if started if (class_exists('Zend_Session', false) && Zend_Session::isStarted()) { Zend_Session::writeClose(); } elseif (isset($_SESSION)) { session_write_close(); } $response->sendHeaders(); exit; } }
protected function _init() { set_include_path(implode(PATH_SEPARATOR, array(SP_LIB_PATH, SP_APP_PATH . DIRECTORY_SEPARATOR . 'modules', get_include_path()))); require_once 'Zend/Loader/Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->setFallbackAutoloader(false); $autoloader->registerNamespace('SP_'); $autoloader->registerNamespace('Apache_'); //for solr try { Zend_Session::start(); } catch (Zend_Session_Exception $error) { Zend_Session::writeClose(); Zend_Session::start(); Zend_Session::regenerateId(); trigger_error($error->getMessage()); } self::_setAutoloader(); self::_setConfig(); self::_setView(); self::_setRouter(); self::_setDbAdapter(); self::_setLog(); self::_setCache(); self::_setACL(); self::_setAuthAdapter(); self::_setLayout(); self::_setTranslate(); self::_setActionHelper(); $front = Zend_Controller_Front::getInstance(); $front->setRouter(self::$_router)->addModuleDirectory(SP_APP_PATH . '/modules')->setDefaultModule('default')->setModuleControllerDirectoryName('controllers')->throwExceptions(true)->returnResponse(false)->setDefaultControllerName('Index')->setDefaultAction('index')->setParam('prefixDefaultModule', true)->setParam('noViewRenderer', true)->setParam('useDefaultControllerAlways', false); //register some useful plugins $front->registerPlugin(new SP_Controller_Plugin_AppPlugin()); //set default db table adapter Zend_Db_Table::setDefaultAdapter(self::$_db); //set default translator for Zend_Form Zend_Form::setDefaultTranslator(self::$_translate); }
/** * @param array $args * @return integer Always returns zero. */ public function doGetArray(array $args) { $GLOBALS['fpc'] = 'get'; session_id($args[0]); if (isset($args[1]) && !empty($args[1])) { $s = new Zend_Session_Namespace($args[1]); } else { $s = new Zend_Session_Namespace(); } $result = ''; foreach ($s->getIterator() as $key => $val) { $result .= "{$key} === " . str_replace(array("\n", ' '), array(';', ''), print_r($val, true)) . ';'; } // file_put_contents('out.sesstiontest.get', print_r($s->someArray, true)); Zend_Session::writeClose(); echo $result; return 0; }
/** * Complete the installation writing the config file. * * @return void */ public function finish() { // Create config file $databaseNamespace = new Zend_Session_Namespace('databaseData'); $config = new Setup_Models_Config(); $content = $config->getDefaultProduction($databaseNamespace->data['dbUser'], $databaseNamespace->data['dbPass'], $databaseNamespace->data['dbName'], 'Pdo_Mysql', $databaseNamespace->data['dbHost']); $baseDir = str_replace('htdocs/setup.php', '', $_SERVER['SCRIPT_FILENAME']); $configFile = $baseDir . "configuration.php"; file_put_contents($configFile, $content); // Set access $baseDir = str_replace('htdocs/setup.php', '', $_SERVER['SCRIPT_FILENAME']); if (PHP_OS == 'WIN32' || PHP_OS == 'WINNT') { $this->_error[] = '"' . $baseDir . '" should have the next rights: 0750 for folders, 0640 for files'; } else { // Root if (!$this->chmodRecursive($baseDir, 0750, 0640)) { $this->_error[] = '"' . $baseDir . '" should have the next rights: 0750 for folders, 0640 for files'; } } // Delete a session if exists $_SESSION = array(); foreach ($_COOKIE as $key => $value) { setcookie($key, "", 1); } Zend_Session::writeClose(); }
public function initSession() { @ini_set('session.use_trans_sid', false); @ini_set('session.cookie_httponly', true); // lifetime must be bigger than admin and user auth timeout $lifetime = (int) ini_get('session.gc_maxlifetime'); if ($lifetime < ($max = max($this->di->config->get('login_session_lifetime', 120) * 60, 7200))) { @ini_set('session.gc_maxlifetime', $max); } $this->setSessionCookieDomain(); if ('db' == $this->getSessionStorageType()) { Zend_Session::setSaveHandler(new Am_Session_SaveHandler($this->di->db)); } if (defined('AM_SESSION_NAME') && AM_SESSION_NAME) { Zend_Session::setOptions(array('name' => AM_SESSION_NAME)); } try { Zend_Session::start(); } catch (Zend_Session_Exception $e) { // fix for Error #1009 - Internal error when disable shopping cart module if (strpos($e->getMessage(), "Failed opening 'Am/ShoppingCart.php'") !== false) { Zend_Session::destroy(); header("Location: " . $_SERVER['REQUEST_URI']); exit; } // process other session issues if (strpos($e->getMessage(), 'This session is not valid according to') === 0) { $_SESSION = array(); Zend_Session::regenerateId(); Zend_Session::writeClose(); } if (defined('AM_TEST') && AM_TEST) { // just ignore error } else { throw $e; } } // Workaround to fix bug: https://bugs.php.net/bug.php?id=68063 // Sometimes php starts session with empty session_id() if (!defined('AM_TEST') && !Zend_Session::getId()) { Zend_Session::destroy(); header("Location: " . $_SERVER['REQUEST_URI']); exit; } //disabled as it brokes flash uploads ! //Zend_Session::registerValidator(new Zend_Session_Validator_HttpUserAgent); $this->di->session = new Zend_Session_Namespace('amember'); }
/** * exit(): Perform exit for redirector * * @return void */ public function redirectAndExit() { // Close session, if started if (class_exists('Zend_Session', false) && Zend_Session::isStarted()) { Zend_Session::writeClose(); } elseif (isset($_SESSION)) { session_write_close(); } $this->getResponse()->sendHeaders(); exit; }
/** * update user credential cache * * - fires Tinebase_Event_User_ChangeCredentialCache * * @param string $password * @return array */ public function updateCredentialCache($password) { $oldCredentialCache = Tinebase_Core::get(Tinebase_Core::USERCREDENTIALCACHE); $credentialCache = Tinebase_Auth_CredentialCache::getInstance()->cacheCredentials(Tinebase_Core::getUser()->accountLoginName, $password); Tinebase_Core::set(Tinebase_Core::USERCREDENTIALCACHE, $credentialCache); $success = $this->_setCredentialCacheCookie(); if ($success) { // close session to allow other requests Zend_Session::writeClose(true); $event = new Tinebase_Event_User_ChangeCredentialCache($oldCredentialCache); Tinebase_Event::fireEvent($event); } return array('success' => $success); }
function shutdown() { Zend_Session::writeClose(true); }
public function pageHeader() { // Import global variables into the local scope, for the theme’s header.php global $SEARCH_SPIDER, $TEXT_DIRECTION, $REQUIRE_AUTHENTICATION, $headerfile, $view; // The title often includes the names of records, which may have markup // that cannot be used in the page title. $title = html_entity_decode(strip_tags($this->page_title), ENT_QUOTES, 'UTF-8'); // Initialise variables for the theme’s header.php $LINK_CANONICAL = $this->canonical_url; $META_ROBOTS = $this->meta_robots; $META_DESCRIPTION = WT_GED_ID ? get_gedcom_setting(WT_GED_ID, 'META_DESCRIPTION') : ''; if (!$META_DESCRIPTION) { $META_DESCRIPTION = strip_tags(WT_TREE_TITLE); } $META_GENERATOR = WT_WEBTREES . ' ' . WT_VERSION . ' - ' . WT_WEBTREES_URL; $META_TITLE = WT_GED_ID ? get_gedcom_setting(WT_GED_ID, 'META_TITLE') : ''; if ($META_TITLE) { $title .= ' - ' . $META_TITLE; } // This javascript needs to be loaded in the header, *before* the CSS. // All other javascript should be defered until the end of the page $javascript = '<script src="' . WT_MODERNIZR_URL . '"></script>'; // Give Javascript access to some PHP constants $this->addInlineJavascript(' var WT_STATIC_URL = "' . WT_Filter::escapeJs(WT_STATIC_URL) . '"; var WT_THEME_DIR = "' . WT_Filter::escapeJs(WT_THEME_DIR) . '"; var WT_MODULES_DIR = "' . WT_Filter::escapeJs(WT_MODULES_DIR) . '"; var WT_GEDCOM = "' . WT_Filter::escapeJs(WT_GEDCOM) . '"; var WT_GED_ID = "' . WT_Filter::escapeJs(WT_GED_ID) . '"; var WT_USER_ID = "' . WT_Filter::escapeJs(WT_USER_ID) . '"; var textDirection = "' . WT_Filter::escapeJs($TEXT_DIRECTION) . '"; var WT_SCRIPT_NAME = "' . WT_Filter::escapeJs(WT_SCRIPT_NAME) . '"; var WT_LOCALE = "' . WT_Filter::escapeJs(WT_LOCALE) . '"; var WT_CSRF_TOKEN = "' . WT_Filter::escapeJs(WT_Filter::getCsrfToken()) . '"; ', self::JS_PRIORITY_HIGH); // Temporary fix for access to main menu hover elements on android/blackberry touch devices $this->addInlineJavascript(' if(navigator.userAgent.match(/Android|PlayBook/i)) { jQuery("#main-menu > li > a").attr("href", "#"); jQuery("a.icon_arrow").attr("href", "#"); } '); header('Content-Type: text/html; charset=UTF-8'); require WT_ROOT . $headerfile; // Flush the output, so the browser can render the header and load javascript // while we are preparing data for the page if (ini_get('output_buffering')) { ob_flush(); } flush(); // Once we've displayed the header, we should no longer write session data. Zend_Session::writeClose(); // We've displayed the header - display the footer automatically $this->page_header = true; return $this; }
/** * セッションデータの書き込みを終了 * * @static * @access public * @param boolean $readonly セッションデータへ書き込み権限設定 */ public static function writeClose($readonly = true) { parent::writeClose($readonly); }
/** * save user phone * * @param array $recordData an array of phone properties * @return array */ public function saveMyPhone($recordData) { // close session to allow other requests Zend_Session::writeClose(true); unset($recordData['template_id']); $phone = new Phone_Model_MyPhone(); $phone->setFromArray($recordData); $phoneSettings = new Voipmanager_Model_Snom_PhoneSettings(); $phoneSettings->setFromArray($recordData); $phone->settings = $phoneSettings; $phone->lines = new Tinebase_Record_RecordSet('Voipmanager_Model_Snom_Line', isset($recordData['lines']) && !empty($recordData['lines']) ? $recordData['lines'] : array(), TRUE); if (!empty($phone->id)) { $phone = Phone_Controller_MyPhone::getInstance()->update($phone); } else { // will throw exception in any case $phone = Phone_Controller_MyPhone::getInstance()->create($phone); } return $this->getMyPhone($phone->getId()); }
public function writeClose() { \Zend_Session::writeClose(); }
public function modAction($mod_action) { switch ($mod_action) { case 'ajax': $html = $this->getSidebarAjaxContent(); Zend_Session::writeClose(); header('Content-Type: text/html; charset=UTF-8'); echo $html; break; case 'index': global $MAX_PEDIGREE_GENERATIONS, $controller, $WT_SESSION, $GEDCOM_MEDIA_PATH; require_once WT_ROOT . WT_MODULES_DIR . 'clippings/clippings_ctrl.php'; require_once WT_ROOT . 'includes/functions/functions_export.php'; $clip_ctrl = new WT_Controller_Clippings(); $controller = new WT_Controller_Page(); $controller->setPageTitle($this->getTitle())->PageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();'); echo '<script>'; echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}'; echo '</script>'; if (!$WT_SESSION->cart[WT_GED_ID]) { echo '<h2>', WT_I18N::translate('Family tree clippings cart'), '</h2>'; } if ($clip_ctrl->action == 'add') { $person = WT_GedcomRecord::getInstance($clip_ctrl->id); echo '<h3><a href="', $person->getHtmlUrl(), '">' . $person->getFullName(), '</a></h3>'; if ($clip_ctrl->type == 'fam') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <tr><td class="topbottombar"><?php echo WT_I18N::translate('Which other links from this family would you like to add?'); ?> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"></td></tr> <tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo WT_I18N::translate('Add just this family record.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="parents"><?php echo WT_I18N::translate('Add parents’ records together with this family record.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="members"><?php echo WT_I18N::translate('Add parents’ and children’s records together with this family record.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="descendants"><?php echo WT_I18N::translate('Add parents’ and all descendants’ records together with this family record.'); ?> </td></tr> <tr><td class="topbottombar"><input type="submit" value="<?php echo WT_I18N::translate('Continue adding'); ?> "></td></tr> </table> </form> <?php } else { if ($clip_ctrl->type == 'indi') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <tr><td class="topbottombar"><?php echo WT_I18N::translate('Which links from this individual would you also like to add?'); ?> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"></td></tr> <tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo WT_I18N::translate('Add just this individual.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="parents"><?php echo WT_I18N::translate('Add this individual, his parents, and siblings.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="ancestors" id="ancestors"><?php echo WT_I18N::translate('Add this individual and his direct line ancestors.'); ?> <br> <?php echo WT_I18N::translate('Number of generations:'); ?> <input type="text" size="5" name="level1" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?> " onfocus="radAncestors('ancestors');"></td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies"><?php echo WT_I18N::translate('Add this individual, his direct line ancestors, and their families.'); ?> <br > <?php echo WT_I18N::translate('Number of generations:'); ?> <input type="text" size="5" name="level2" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?> " onfocus="radAncestors('ancestorsfamilies');"></td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="members"><?php echo WT_I18N::translate('Add this individual, his spouse, and children.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="descendants" id="descendants"><?php echo WT_I18N::translate('Add this individual, his spouse, and all descendants.'); ?> <br > <?php echo WT_I18N::translate('Number of generations:'); ?> <input type="text" size="5" name="level3" value="<?php echo $MAX_PEDIGREE_GENERATIONS; ?> " onfocus="radAncestors('descendants');"></td></tr> <tr><td class="topbottombar"><input type="submit" value="<?php echo WT_I18N::translate('Continue adding'); ?> "> </table> </form> <?php } else { if ($clip_ctrl->type == 'sour') { ?> <form action="module.php" method="get"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <tr><td class="topbottombar"><?php echo WT_I18N::translate('Which records linked to this source should be added?'); ?> <input type="hidden" name="id" value="<?php echo $clip_ctrl->id; ?> "> <input type="hidden" name="type" value="<?php echo $clip_ctrl->type; ?> "> <input type="hidden" name="action" value="add1"></td></tr> <tr><td class="optionbox"><input type="radio" name="others" checked value="none"><?php echo WT_I18N::translate('Add just this source.'); ?> </td></tr> <tr><td class="optionbox"><input type="radio" name="others" value="linked"><?php echo WT_I18N::translate('Add this source and families/individuals linked to it.'); ?> </td></tr> <tr><td class="topbottombar"><input type="submit" value="<?php echo WT_I18N::translate('Continue adding'); ?> "> </table> </form> <?php } } } } if ($clip_ctrl->privCount > 0) { echo "<span class=\"error\">" . WT_I18N::translate('Some items could not be added due to privacy restrictions') . "</span><br><br>"; } if (!$WT_SESSION->cart[WT_GED_ID]) { if ($clip_ctrl->action != 'add') { echo WT_I18N::translate('The clippings cart allows you to take extracts (“clippings”) from this family tree and bundle them up into a single file for downloading and subsequent importing into your own genealogy program. The downloadable file is recorded in GEDCOM format.<br><ul><li>How to take clippings?<br>This is really simple. Whenever you see a clickable name (individual, family, or source) you can go to the Details page of that name. There you will see the <b>Add to clippings cart</b> option. When you click that link you will be offered several options to download.</li><li>How to download?<br>Once you have items in your cart, you can download them just by clicking the “Download” link. Follow the instructions and links.</li></ul>'); ?> <form method="get" name="addin" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <tr> <td colspan="2" class="topbottombar" style="text-align:center; "> <?php echo WT_I18N::translate('Enter an individual, family, or source ID'), help_link('add_by_id', $this->getName()); ?> </td> </tr> <tr> <td class="optionbox"> <input type="hidden" name="action" value="add"> <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5"> </td> <td class="optionbox"> <?php echo print_findindi_link('cart_item_id'); ?> <?php echo print_findfamily_link('cart_item_id'); ?> <?php echo print_findsource_link('cart_item_id', ''); ?> <input type="submit" value="<?php echo WT_I18N::translate('Add'); ?> "> </td> </tr> </table> </form> <?php } // -- end new lines echo WT_I18N::translate('Your clippings cart is empty.'); } else { // Keep track of the INDI from the parent page, otherwise it will // get lost after ajax updates $pid = WT_Filter::get('pid', WT_REGEX_XREF); if ($clip_ctrl->action != 'download' && $clip_ctrl->action != 'add') { ?> <table><tr><td class="width33" valign="top" rowspan="3"> <form method="get" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <input type="hidden" name="action" value="download"> <input type="hidden" name="pid" value="<?php echo $pid; ?> "> <table> <tr><td colspan="2" class="topbottombar"><h2><?php echo WT_I18N::translate('Download'); ?> </h2></td></tr> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Zip file(s)'), help_link('zip'); ?> </td> <td class="optionbox"><input type="checkbox" name="Zip" value="yes"></td></tr> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Include media (automatically zips files)'), help_link('include_media'); ?> </td> <td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes"></td></tr> <?php if (WT_USER_GEDCOM_ADMIN) { ?> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Apply privacy settings?'), help_link('apply_privacy'); ?> </td> <td class="optionbox"> <input type="radio" name="privatize_export" value="none" checked="checked"> <?php echo WT_I18N::translate('None'); ?> <br> <input type="radio" name="privatize_export" value="gedadmin"> <?php echo WT_I18N::translate('Manager'); ?> <br> <input type="radio" name="privatize_export" value="user"> <?php echo WT_I18N::translate('Member'); ?> <br> <input type="radio" name="privatize_export" value="visitor"> <?php echo WT_I18N::translate('Visitor'); ?> </td></tr> <?php } elseif (WT_USER_CAN_ACCESS) { ?> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Apply privacy settings?'), help_link('apply_privacy'); ?> </td> <td class="optionbox"> <input type="radio" name="privatize_export" value="user" checked="checked"> <?php echo WT_I18N::translate('Member'); ?> <br> <input type="radio" name="privatize_export" value="visitor"> <?php echo WT_I18N::translate('Visitor'); ?> </td></tr> <?php } ?> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Convert from UTF-8 to ANSI (ISO-8859-1)'), help_link('utf8_ansi'); ?> </td> <td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr> <tr><td class="descriptionbox width50 wrap"><?php echo WT_I18N::translate('Add the GEDCOM media path to filenames'), help_link('GEDCOM_MEDIA_PATH'); ?> </td> <td class="optionbox"> <input type="checkbox" name="conv_path" value="<?php echo WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH); ?> "> <span dir="auto"><?php echo WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH); ?> </span> </td></tr> <tr><td class="topbottombar" colspan="2"> <input type="submit" value="<?php echo WT_I18N::translate('Download'); ?> "> </form> </td></tr> </table> </td></tr> </table> <br> <form method="get" name="addin" action="module.php"> <input type="hidden" name="mod" value="clippings"> <input type="hidden" name="mod_action" value="index"> <table> <tr> <td colspan="2" class="topbottombar" style="text-align:center; "> <?php echo WT_I18N::translate('Enter an individual, family, or source ID'), help_link('add_by_id', $this->getName()); ?> </td> </tr> <tr> <td class="optionbox"> <input type="hidden" name="action" value="add"> <input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8"> </td> <td class="optionbox"> <?php echo print_findindi_link('cart_item_id'); ?> <?php echo print_findfamily_link('cart_item_id'); ?> <?php echo print_findsource_link('cart_item_id'); ?> <input type="submit" value="<?php echo WT_I18N::translate('Add'); ?> "> </td> </tr> </table> </form> <?php } ?> <br><a href="module.php?mod=clippings&mod_action=index&action=empty"><?php echo WT_I18N::translate('Empty the clippings cart'); ?> </a><?php echo help_link('empty_cart', $this->getName()); ?> </td></tr> <tr><td class="topbottombar"><h2><?php echo WT_I18N::translate('Family tree clippings cart'); ?> </h2></td></tr> <tr><td valign="top"> <table id="mycart" class="sortable list_table width100"> <tr> <th class="list_label"><?php echo WT_I18N::translate('Record'); ?> </th> <th class="list_label"><?php echo WT_I18N::translate('Remove'); ?> </th> </tr> <?php foreach (array_keys($WT_SESSION->cart[WT_GED_ID]) as $xref) { $record = WT_GedcomRecord::getInstance($xref); if ($record) { switch ($record::RECORD_TYPE) { case 'INDI': $icon = 'icon-indis'; break; case 'FAM': $icon = 'icon-sfamily'; break; case 'SOUR': $icon = 'icon-source'; break; case 'REPO': $icon = 'icon-repository'; break; case 'NOTE': $icon = 'icon-note'; break; case 'OBJE': $icon = 'icon-media'; break; default: $icon = 'icon-clippings'; break; } ?> <tr><td class="list_value"> <i class="<?php echo $icon; ?> "></i> <?php echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>'; ?> </td> <td class="list_value center vmiddle"><a href="module.php?mod=clippings&mod_action=index&action=remove&id=<?php echo $xref; ?> " class="icon-remove" title="<?php echo WT_I18N::translate('Remove'); ?> "></a></td> </tr> <?php } } ?> </table> </td></tr></table> <?php } break; default: header('HTTP/1.0 404 Not Found'); break; } }
/** * Initialize the paths, the config values and all the render stuff. * * @return void */ public function _initialize() { // Report all PHP errors error_reporting(-1); define('PHPR_CORE_PATH', PHPR_ROOT_PATH . DIRECTORY_SEPARATOR . 'application'); define('PHPR_LIBRARY_PATH', PHPR_ROOT_PATH . DIRECTORY_SEPARATOR . 'library'); if (!defined('PHPR_CONFIG_FILE')) { define('PHPR_CONFIG_FILE', PHPR_ROOT_PATH . DIRECTORY_SEPARATOR . 'configuration.php'); } set_include_path('.' . PATH_SEPARATOR . PHPR_LIBRARY_PATH . PATH_SEPARATOR . get_include_path()); require_once 'Zend/Loader/Autoloader.php'; require_once 'Phprojekt/Loader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->pushAutoloader(array('Phprojekt_Loader', 'autoload')); // Read the config file, but only the production setting try { $this->_config = new Zend_Config_Ini(PHPR_CONFIG_FILE, PHPR_CONFIG_SECTION, true); } catch (Zend_Config_Exception $error) { $response = new Zend_Controller_Request_Http(); $webPath = $response->getScheme() . '://' . $response->getHttpHost() . $response->getBasePath() . '/'; header("Location: " . $webPath . "setup.php"); die('You need the file configuration.php to continue. Have you tried the <a href="' . $webPath . 'setup.php">setup</a> routine?' . "\n" . '<br />Original error: ' . $error->getMessage()); } // Set webpath, tmpPath and applicationPath if (empty($this->_config->webpath)) { $response = new Zend_Controller_Request_Http(); $this->_config->webpath = $response->getScheme() . '://' . $response->getHttpHost() . $response->getBasePath() . '/'; } define('PHPR_ROOT_WEB_PATH', $this->_config->webpath . 'index.php/'); define('PHPR_TEMP_PATH', $this->_config->tmpPath); define('PHPR_USER_CORE_PATH', $this->_config->applicationPath); set_include_path('.' . PATH_SEPARATOR . PHPR_LIBRARY_PATH . PATH_SEPARATOR . PHPR_CORE_PATH . PATH_SEPARATOR . PHPR_USER_CORE_PATH . PATH_SEPARATOR . get_include_path()); // Set the timezone to UTC date_default_timezone_set('UTC'); // Start zend session to handle all session stuff try { Zend_Session::start(); } catch (Zend_Session_Exception $error) { Zend_Session::writeClose(); Zend_Session::start(); Zend_Session::regenerateId(); error_log($error); } // Set a metadata cache and clean it $frontendOptions = array('automatic_serialization' => true); $backendOptions = array('cache_dir' => PHPR_TEMP_PATH . 'zendCache' . DIRECTORY_SEPARATOR); try { $this->_cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); } catch (Exception $error) { die("The directory " . PHPR_TEMP_PATH . "zendCache do not exists or not have write access."); } Zend_Db_Table_Abstract::setDefaultMetadataCache($this->_cache); // Use for Debug only //Zend_Db_Table_Abstract::getDefaultMetadataCache()->clean(); // Check Logs $this->getLog(); $missingRequirements = array(); // The following extensions are either needed by components of the Zend Framework that are used // or by P6 components itself. $extensionsNeeded = array('mbstring', 'iconv', 'ctype', 'gd', 'pcre', 'pdo', 'Reflection', 'session', 'SPL', 'zlib'); // These settings need to be properly configured by the admin $settingsNeeded = array('magic_quotes_gpc' => 0, 'magic_quotes_runtime' => 0, 'magic_quotes_sybase' => 0); // Check the PHP version $requiredPhpVersion = "5.2.4"; if (version_compare(phpversion(), $requiredPhpVersion, '<')) { // This is a requirement of the Zend Framework $missingRequirements[] = "- PHP Version '" . $requiredPhpVersion . "' or newer"; } foreach ($extensionsNeeded as $extension) { if (!extension_loaded($extension)) { $missingRequirements[] = "- The '" . $extension . "' extension must be enabled."; } } // Check pdo library $mysql = extension_loaded('pdo_mysql'); $sqlite = extension_loaded('pdo_sqlite2'); $pgsql = extension_loaded('pdo_pgsql'); if (!$mysql && !$sqlite && !$pgsql) { $missingRequirements[] = "- You need one of these PDO extensions: pdo_mysql, pdo_pgsql or pdo_sqlite"; } foreach ($settingsNeeded as $conf => $value) { if (ini_get($conf) != $value) { $missingRequirements[] = "- The php.ini setting of '" . $conf . "' has to be '" . $value . "'."; } } if (!empty($missingRequirements)) { $message = "Your PHP does not meet the requirements needed for P6.<br />" . implode("<br />", $missingRequirements); die($message); } $helperPaths = $this->_getHelperPaths(); $view = $this->_setView($helperPaths); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); $viewRenderer->setViewBasePathSpec(':moduleDir/Views'); $viewRenderer->setViewScriptPathSpec(':action.:suffix'); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); foreach ($helperPaths as $helperPath) { Zend_Controller_Action_HelperBroker::addPath($helperPath['directory']); } $plugin = new Zend_Controller_Plugin_ErrorHandler(); $plugin->setErrorHandlerModule('Default'); $plugin->setErrorHandlerController('Error'); $plugin->setErrorHandlerAction('error'); $front = Zend_Controller_Front::getInstance(); $front->setDispatcher(new Phprojekt_Dispatcher()); $front->registerPlugin($plugin); $front->setDefaultModule('Default'); $front->setModuleControllerDirectoryName('Controllers'); $front->addModuleDirectory(PHPR_CORE_PATH); $front->addModuleDirectory(PHPR_USER_CORE_PATH); // Add SubModules directories with controlles $moduleDirectories = $this->_getControllersFolders($helperPaths); foreach ($moduleDirectories as $moduleDirectory) { $front->addModuleDirectory($moduleDirectory); } $front->setParam('useDefaultControllerAlways', true); // Define general error handler set_error_handler(array("Phprojekt", "errorHandler")); }
public function ajaxRequest() { global $SEARCH_SPIDER; // Search engines should not make AJAX requests if ($SEARCH_SPIDER) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); exit; } // Initialise tabs $tab = WT_Filter::get('module'); // A request for a non-existant tab? if (array_key_exists($tab, $this->tabs)) { $mod = $this->tabs[$tab]; } else { header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); exit; } header("Content-Type: text/html; charset=UTF-8"); // AJAX calls do not have the meta tag headers and need this set header("X-Robots-Tag: noindex,follow"); // AJAX pages should not show up in search results, any links can be followed though Zend_Session::writeClose(); echo $mod->getTabContent(); if (WT_DEBUG_SQL) { echo WT_DB::getQueryLog(); } }
/** * Called after Zend_Controller_Router exits. * * Called after Zend_Controller_Front exits from the router. * * @param Zend_Controller_Request_Abstract $request * @return void */ public function routeShutdown(Zend_Controller_Request_Abstract $request) { // Attempt to get session id $sid = $this->getRequest()->getParam($this->getSidKey()); // Check if an override was provided else stop execution if (!$sid) { return; } // Close an existing session if (Zend_Session::isStarted()) { // Already using this sid if (Zend_Session::getId() == $sid) { return; } Zend_Session::destroy(); Zend_Session::writeClose(); } // Start the session with the requested id /* We did not use Zend_Session here because it does not check whether a session was closed, so it throws an error Zend_Session::setId($sid); Zend_Session::start(); */ session_id($sid); session_start(); }
/** * Destructor * * @return void */ public function __destruct() { Zend_Session::writeClose(); }
public static function Terminate() { if (class_exists('Zend_Session')) { if (Zend_Session::isStarted()) { Zend_Session::writeClose(); } } else { @session_write_close(); } exit; }
// Do not delete ourself! $datum[13] = ''; } } // Total filtered/unfiltered rows $recordsFiltered = WT_DB::prepare("SELECT FOUND_ROWS()")->fetchOne(); $recordsTotal = User::count(); Zend_Session::writeClose(); header('Content-type: application/json'); echo json_encode(array('draw' => WT_Filter::getInteger('draw'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data)); exit; case 'load1row': // Generate an AJAX response for datatables to load expanded row $user_id = WT_Filter::getInteger('user_id'); $user = User::find($user_id); Zend_Session::writeClose(); header('Content-type: text/html; charset=UTF-8'); echo '<h2>', WT_I18N::translate('Details'), '</h2>'; echo '<dl>'; echo '<dt>', WT_I18N::translate('Administrator'), '</dt>'; echo '<dd>', edit_field_yes_no_inline('user_setting-' . $user_id . '-canadmin', $user->getSetting('canadmin')), '</dd>'; echo '<dt>', WT_I18N::translate('Password'), '</dt>'; echo '<dd>', edit_field_inline('user-password-' . $user_id, ''), '</dd>'; echo '<dt>', WT_I18N::translate('Preferred contact method'), '</dt>'; echo '<dd>', edit_field_contact_inline('user_setting-' . $user_id . '-contactmethod', $user->getSetting('contactmethod')), '</dd>'; echo '<dt>', WT_I18N::translate('Allow this user to edit his account information'), '</dt>'; echo '<dd>', edit_field_yes_no_inline('user_setting-' . $user_id . '-editaccount', $user->getSetting('editaccount')), '</dd>'; echo '<dt>', WT_I18N::translate('Automatically approve changes made by this user'), '</dt>'; echo '<dd>', edit_field_yes_no_inline('user_setting-' . $user_id . '-auto_accept', $user->getSetting('auto_accept')), '</dd>'; echo '<dt>', WT_I18N::translate('Theme'), '</dt>'; echo '<dd>', select_edit_control_inline('user_setting-' . $user_id . '-theme', array_flip(get_theme_names()), WT_I18N::translate('<default theme>'), $user->getSetting('theme')), '</dd>';
/** * Zend_Session::writeClose encapsulation * * @param string $readonly */ public static function writeClose($readonly = true) { Zend_Session::writeClose($readonly); }