golden hour
/home/phakp/public_html/formtools/global/code
⬆️ Go Up
Upload
File/Folder
Size
Actions
Accounts.class.php
14.56 KB
Del
OK
Administrator.class.php
32.41 KB
Del
OK
Clients.class.php
19.25 KB
Del
OK
Constants.class.php
51 B
Del
OK
Core.class.php
23.23 KB
Del
OK
CoreFieldTypes.class.php
11.16 KB
Del
OK
Database.class.php
6.34 KB
Del
OK
DatabaseSessions.class.php
3.09 KB
Del
OK
Emails.class.php
60.66 KB
Del
OK
Errors.class.php
4.78 KB
Del
OK
FieldOptions.class.php
1.1 KB
Del
OK
FieldSettings.class.php
1.25 KB
Del
OK
FieldSizes.class.php
2.9 KB
Del
OK
FieldTypes.class.php
61.04 KB
Del
OK
FieldValidation.class.php
11.7 KB
Del
OK
Fields.class.php
57.75 KB
Del
OK
Files.class.php
18.61 KB
Del
OK
Forms.class.php
63.07 KB
Del
OK
General.class.php
47.2 KB
Del
OK
Hooks.class.php
21.66 KB
Del
OK
Installation.class.php
57.45 KB
Del
OK
ListGroups.class.php
2.35 KB
Del
OK
Menus.class.php
36.83 KB
Del
OK
Module.abstract.class.php
8.29 KB
Del
OK
ModuleMenu.class.php
3.84 KB
Del
OK
Modules.class.php
30.52 KB
Del
OK
OmitLists.class.php
2.4 KB
Del
OK
OptionLists.class.php
28.04 KB
Del
OK
Pages.class.php
8.61 KB
Del
OK
Schemas.class.php
814 B
Del
OK
SecureSmarty.class.php
403 B
Del
OK
Sessions.class.php
4.01 KB
Del
OK
Settings.class.php
23.12 KB
Del
OK
Submissions.class.php
70.8 KB
Del
OK
Templates.class.php
6.64 KB
Del
OK
Themes.class.php
14.04 KB
Del
OK
Translations.class.php
3.54 KB
Del
OK
Upgrade.class.php
6.81 KB
Del
OK
User.class.php
14.47 KB
Del
OK
ViewColumns.class.php
3.06 KB
Del
OK
ViewFields.class.php
19.39 KB
Del
OK
ViewFilters.class.php
15.07 KB
Del
OK
ViewTabs.class.php
3.46 KB
Del
OK
Views.class.php
47.25 KB
Del
OK
actions.php
17.92 KB
Del
OK
field_types
-
Del
OK
index.php
35 B
Del
OK
polyfills.php
5.07 KB
Del
OK
validation.php
15.79 KB
Del
OK
Edit: Sessions.class.php
<?php /** * Wrapper for any PHP sessions storage. Pre 3.0.0 session usage was littered throughout the code. Code needed to know * about the structure of the session data and made everything coupled with everything else. This class reduces * all that to a simple get/set interface. * * This file is independent of the TYPE of session (PHP/Database). If the user selected database sessions, the * DatabaseSession class is instantiated on page load, which automatically routes the $_SESSION interaction here to * store the values in the database. */ namespace FormTools; class Sessions { public static function get($key = "") { if (empty($key)) { return $_SESSION["ft"]; } $parts = explode(".", $key); $ref = &$_SESSION["ft"]; foreach ($parts as $section) { $ref = &$ref[$section]; } return $ref; } /** * Simple helper method to return the value of something in session, or if it's not defined, * @param $key * @param $defaultValue */ public static function getWithFallback($key, $defaultValue) { if (Sessions::exists($key)) { return Sessions::get($key); } else { return $defaultValue; } } /** * Stores data in sessions. * @param $key string dot-delimited e.g. settings.num_per_page */ public static function set($key, $value) { $parts = explode(".", $key); if (!isset($_SESSION["ft"])) { $_SESSION["ft"] = array(); } $ref = &$_SESSION["ft"]; foreach ($parts as $section) { $ref = &$ref[$section]; } $ref = $value; } public static function setIfNotExists($key, $value) { if (!self::exists($key)) { self::set($key, $value); } } public static function appendArrayItem($key, $value) { $array = Sessions::get($key); $array[] = $value; self::set($key, $array); } public static function removeArrayItem($key, $value) { $items = self::get($key); if (!in_array($value, $items)) { return; } array_splice($items, array_search($value, self::get($key)), 1); self::set($key, $items); } public static function exists($key) { if (!isset($_SESSION["ft"])) { return false; } // TODO test! $parts = explode(".", $key); $exists = false; $temp = &$_SESSION["ft"]; foreach ($parts as $section) { $exists = false; if (isset($temp[$section])) { $exists = true; } $temp = &$temp[$section]; } return $exists; } /** * Returns true is the key doesn't exist or if it's empty(). */ public static function isEmpty($key) { if (!self::exists($key)) { return true; } $value = self::get($key); return empty($value); } /** * Helper to find out if a key exists and is non-empty. */ public static function isNonEmpty($key) { if (!isset($_SESSION["ft"])) { return false; } // TODO test!!! $parts = explode(".", $key); $exists = false; $temp = &$_SESSION["ft"]; foreach ($parts as $section) { $exists = false; if (isset($temp[$section]) && !empty($temp[$section])) { $exists = true; } $temp = &$temp[$section]; } return $exists; } public static function createIfNotExists($key, $value) { if (!self::exists($key)) { self::set($key, $value); } } /** * Clears a key or keys. * @param $key */ public static function clear($key) { if (is_string($key)) { unset($_SESSION["ft"][$key]); } } public static function clearAll() { unset($_SESSION["ft"]); $_SESSION["ft"] = array(); } }
Save