PageRenderTime 46ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/storecommander/ead6f6fce09/SC/lib/js/ckeditor/kcfinder/core/bootstrap.php

https://gitlab.com/ptisky/API_prestashop
PHP | 202 lines | 43 code | 25 blank | 134 comment | 10 complexity | 4bdc381544aac38e1008487152248d30 MD5 | raw file
  1. <?php
  2. /**
  3. * Store Commander
  4. *
  5. * @category administration
  6. * @author Store Commander - support@storecommander.com
  7. * @version 2015-09-15
  8. * @uses Prestashop modules
  9. * @since 2009
  10. * @copyright Copyright &copy; 2009-2015, Store Commander
  11. * @license commercial
  12. * All rights reserved! Copying, duplication strictly prohibited
  13. *
  14. * *****************************************
  15. * * STORE COMMANDER *
  16. * * http://www.StoreCommander.com *
  17. * * V 2015-09-15 *
  18. * *****************************************
  19. *
  20. * Compatibility: PS version: 1.1 to 1.6.1
  21. *
  22. **/
  23. /** This file is part of KCFinder project
  24. *
  25. * @desc This file is included first, before each other
  26. * @package KCFinder
  27. * @version 3.12
  28. * @author Pavel Tzonkov <sunhater@sunhater.com>
  29. * @copyright 2010-2014 KCFinder Project
  30. * @license http://opensource.org/licenses/GPL-3.0 GPLv3
  31. * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
  32. * @link http://kcfinder.sunhater.com
  33. *
  34. * This file is the place you can put any code (at the end of the file),
  35. * which will be executed before any other. Suitable for:
  36. * 1. Set PHP ini settings using ini_set()
  37. * 2. Custom session save handler with session_set_save_handler()
  38. * 3. Any custom integration code. If you use any global variables
  39. * here, they can be accessed in conf/config.php via $GLOBALS
  40. * array. It's recommended to use constants instead.
  41. */
  42. // PHP VERSION CHECK
  43. if (!preg_match('/^(\d+\.\d+)/', PHP_VERSION, $ver) || ($ver[1] < 5.3))
  44. die("You are using PHP " . PHP_VERSION . " when KCFinder require at least version 5.3.0! Some systems has an option to change the active PHP version. Please refer to your hosting provider or upgrade your PHP distribution.");
  45. // SAFE MODE CHECK
  46. if (ini_get("safe_mode"))
  47. die("The \"safe_mode\" PHP ini setting is turned on! You cannot run KCFinder in safe mode.");
  48. // CMS INTEGRATION
  49. if (isset($_GET['cms']) &&
  50. (basename($_GET['cms']) == $_GET['cms']) &&
  51. is_file("integration/{$_GET['cms']}.php")
  52. )
  53. require "integration/{$_GET['cms']}.php";
  54. // REGISTER AUTOLOAD FUNCTION
  55. require "core/autoload.php";
  56. // json_encode() IMPLEMENTATION IF JSON EXTENSION IS MISSING
  57. if (!function_exists("json_encode")) {
  58. function json_encode($data) {
  59. if (is_array($data)) {
  60. $ret = array();
  61. // OBJECT
  62. if (array_keys($data) !== range(0, count($data) - 1)) {
  63. foreach ($data as $key => $val)
  64. $ret[] = json_encode((string) $key) . ':' . json_encode($val);
  65. return "{" . implode(",", $ret) . "}";
  66. // ARRAY
  67. } else {
  68. foreach ($data as $val)
  69. $ret[] = json_encode($val);
  70. return "[" . implode(",", $ret) . "]";
  71. }
  72. // BOOLEAN OR NULL
  73. } elseif (is_bool($data) || ($data === null))
  74. return ($data === null)
  75. ? "null"
  76. : ($data ? "true" : "false");
  77. // FLOAT
  78. elseif (is_float($data))
  79. return rtrim(rtrim(number_format($data, 14, ".", ""), "0"), ".");
  80. // INTEGER
  81. elseif (is_int($data))
  82. return $data;
  83. // STRING
  84. return '"' .
  85. str_replace('/', "\\/",
  86. str_replace("\t", "\\t",
  87. str_replace("\r", "\\r",
  88. str_replace("\n", "\\n",
  89. str_replace('"', "\\\"",
  90. str_replace("\\", "\\\\",
  91. $data)))))) . '"';
  92. }
  93. }
  94. // CUSTOM SESSION SAVE HANDLER CLASS EXAMPLE
  95. //
  96. // Uncomment & edit it if the application you want to integrate with, have
  97. // its own session save handler. It's not even needed to save instances of
  98. // this class in variables. Just add a row:
  99. // new SessionSaveHandler();
  100. // and your handler will rule the sessions ;-)
  101. /*
  102. class SessionSaveHandler {
  103. protected $savePath;
  104. protected $sessionName;
  105. public function __construct() {
  106. session_set_save_handler(
  107. array($this, "open"),
  108. array($this, "close"),
  109. array($this, "read"),
  110. array($this, "write"),
  111. array($this, "destroy"),
  112. array($this, "gc")
  113. );
  114. }
  115. // Open function, this works like a constructor in classes and is
  116. // executed when the session is being opened. The open function expects
  117. // two parameters, where the first is the save path and the second is the
  118. // session name.
  119. public function open($savePath, $sessionName) {
  120. $this->savePath = $savePath;
  121. $this->sessionName = $sessionName;
  122. return true;
  123. }
  124. // Close function, this works like a destructor in classes and is
  125. // executed when the session operation is done.
  126. public function close() {
  127. return true;
  128. }
  129. // Read function must return string value always to make save handler
  130. // work as expected. Return empty string if there is no data to read.
  131. // Return values from other handlers are converted to boolean expression.
  132. // TRUE for success, FALSE for failure.
  133. public function read($id) {
  134. $file = $this->savePath . "/sess_$id";
  135. return (string) @file_get_contents($file);
  136. }
  137. // Write function that is called when session data is to be saved. This
  138. // function expects two parameters: an identifier and the data associated
  139. // with it.
  140. public function write($id, $data) {
  141. $file = $this->savePath . "/sess_$id";
  142. if (false !== ($fp = @fopen($file, "w"))) {
  143. $return = fwrite($fp, $data);
  144. fclose($fp);
  145. return $return;
  146. } else
  147. return false;
  148. }
  149. // The destroy handler, this is executed when a session is destroyed with
  150. // session_destroy() and takes the session id as its only parameter.
  151. public function destroy($id) {
  152. $file = $this->savePath . "/sess_$id";
  153. return @unlink($file);
  154. }
  155. // The garbage collector, this is executed when the session garbage
  156. // collector is executed and takes the max session lifetime as its only
  157. // parameter.
  158. public function gc($maxlifetime) {
  159. foreach (glob($this->savePath . "/sess_*") as $file)
  160. if (filemtime($file) + $maxlifetime < time())
  161. @unlink($file);
  162. return true;
  163. }
  164. }
  165. new SessionSaveHandler();
  166. */
  167. // PUT YOUR ADDITIONAL CODE HERE
  168. ?>