A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

?-s - Stikked
From Sony, 13 Years ago, written in PHP.
Embed
  1. <?php
  2. /**
  3. * Class and Function List:
  4. * Function list:
  5. * - redirectForDreamweaverPreviewInBrowserRequest()
  6. * - verifyOnlyOneModeDefineIsTrue()
  7. * - fixHttpAuthenticationHeader()
  8. * - fixScriptEnvironmentVariables()
  9. * - redirectToProperWebDavUrl()
  10. * - redirectToProperPageUrl()
  11. * - redirectWindowsAttemptToDiscoverWebDav()
  12. * - permanentRedirect()
  13. * - xssSanitize()
  14. * - redirectDeployerRequests()
  15. * - xssSanitizeReplacer()
  16. * Classes list:
  17. */
  18. define('IS_HOSTED', (get_cfg_var('rnt.hosted') == 0) ? false : true);
  19.  
  20. if (IS_HOSTED) error_reporting(E_ALL & ~E_NOTICE);
  21. else error_reporting(~E_NOTICE);
  22. define('ORIGINAL_REQUEST_URI', $_SERVER['REQUEST_URI']);
  23. $function = '';
  24. $customControllerRequest = $isAppRequest = $isAdmin = $isDeployableAdmin = $facebookRequest = false;
  25. $runXssClean = true;
  26. $isDevelopment = ($_COOKIE['location'] === 'development') ? true : false;
  27. $isReference = ($_COOKIE['location'] === 'reference') ? true : false;
  28. define('STAGING_PREFIX', 'staging_');
  29. $isStaging = (0 === strncmp(STAGING_PREFIX, $_COOKIE['location'], 8)) ? true : false;
  30. define('STAGING_LOCATION', ($isStaging) ? $_COOKIE['location'] : null);
  31. $isProduction = ($isReference || $isDevelopment || $isStaging) ? false : true;
  32. $requestUri = explode('/', $_SERVER['REQUEST_URI']);
  33. switch (strtolower($requestUri[1]))
  34. {
  35. case 'cgi-bin':
  36.        
  37.         if (array_slice($requestUri, 3, 2) === array(
  38.                 'php',
  39.                 'enduser'
  40.         )) permanentRedirect('/ci/redirect/enduser/' . implode('/', array_slice($requestUri, 4)));
  41.         break;
  42. case '':
  43. case 'app':
  44.         redirectForDreamweaverPreviewInBrowserRequest($requestUri);
  45.         redirectWindowsAttemptToDiscoverWebDav($requestUri);
  46.         $isAppRequest = true;
  47.         $function = 'page/render';
  48.         break;
  49. case 'dav':
  50.         $isAdmin = true;
  51.         $function = 'webdav/index';
  52.         $runXssClean = false;
  53.         break;
  54. case 'ci':
  55.         switch (strtolower($requestUri[2]))
  56.         {
  57.         case 'webdav':
  58.                 redirectToProperWebDavUrl($requestUri);
  59.         break;
  60.         case 'page':
  61.                 redirectToProperPageUrl($requestUri);
  62.         break;
  63.         case 'tags':
  64.         case 'logs':
  65.         case 'logtest':
  66.         case 'deploy':
  67.         case 'designer':
  68.         case 'configurations':
  69.         case 'unittest':
  70.                 $isAdmin = true;
  71.                 $runXssClean = false;
  72.         break;
  73.         case 'admin':
  74.                 redirectDeployerRequests($requestUri);
  75.                 $isAdmin = true;
  76.                 $runXssClean = false;
  77.         break;
  78.         case 'answerpreview':
  79.                 $isDeployableAdmin = true;
  80.                 $runXssClean = false;
  81.         break;
  82.         case 'ds':
  83.                 $function = "syndicatedWidgetDataService/{$requestUri[3]}";
  84.         break;
  85.         case 'ws':
  86.                 $function = "widgetService/{$requestUri[3]}";
  87.         break;
  88.         case 'ajaxcustom':
  89.                 $customControllerRequest = true;
  90.         break;
  91.         case 'redirect':
  92.                 $runXssClean = false;
  93.         break;
  94.         }
  95.        
  96.         if ($_POST['rnFacebookAppReq'] === "1" || strpos($_SERVER['REQUEST_URI'], '/rnFacebookAppReq/1') !== false) $facebookRequest = true;
  97.         $isAppRequest = !$isAdmin && !$isDeployableAdmin && $isProduction;
  98.         break;
  99. case 'cc':
  100.         $customControllerRequest = true;
  101.         $isAppRequest = true;
  102.         break;
  103. case 'cx':
  104.         switch (strtolower($requestUri[2]))
  105.         {
  106.         case 'facebook':
  107.                
  108.                 if (IS_HOSTED)
  109.                 {
  110.                         $isDevelopment = $isReference = $isStaging = false;
  111.                         $isProduction = true;
  112.                 }
  113.                 $facebookRequest = true;
  114.                 $isAppRequest = true;
  115.                 $function = 'facebook/render';
  116.                 $_SERVER['REQUEST_URI'] = strstr(substr($_SERVER['REQUEST_URI'], 1) , '/');
  117.         break;
  118.         }
  119.         break;
  120. }
  121.  
  122. if ($runXssClean) xssSanitize();
  123.  
  124. if ($isAdmin)
  125. {
  126.         $isDevelopment = $isReference = $isProduction = $isStaging = false;
  127. }
  128. $documentRoot = get_cfg_var('doc_root');
  129. $_SERVER['QUERY_STRING'] = $function . strstr(substr($_SERVER['REQUEST_URI'], 1) , '/');
  130. define('HTMLROOT', get_cfg_var('rnt.html_root'));
  131. fixScriptEnvironmentVariables();
  132. $optimizedAssetsPath = HTMLROOT . '/euf/rightnow/optimized';
  133. $deployTimestampFile = "$documentRoot/euf/application/production/deployTimestamp";
  134.  
  135. if ($isProduction)
  136. {
  137.         $applicationFolder = "$documentRoot/euf/application/production/optimized";
  138. }
  139. else
  140. if ($isStaging)
  141. {
  142.         $applicationFolder = sprintf("$documentRoot/euf/application/staging/%s/optimized", STAGING_LOCATION);
  143.         $optimizedAssetsPath = sprintf('%s/euf/rightnow/staging/%s/optimized', HTMLROOT, STAGING_LOCATION);
  144.         $deployTimestampFile = sprintf("$documentRoot/euf/application/staging/%s/deployTimestamp", STAGING_LOCATION);
  145. }
  146. else
  147. {
  148.         $applicationFolder = "$documentRoot/euf/application/development/source";
  149.         fixHttpAuthenticationHeader();
  150. }
  151. define('OPTIMIZED_ASSETS_PATH', $optimizedAssetsPath);
  152. define('DEPLOY_TIMESTAMP_FILE', $deployTimestampFile);
  153. define('EXT', '.' . pathinfo(__FILE__, PATHINFO_EXTENSION));
  154. define('FCPATH', __FILE__);
  155. define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
  156. define('BASEPATH', realpath(dirname(__FILE__)) . '/CodeIgniter_1.5.4/system/');
  157. define('DOCROOT', $documentRoot);
  158. define('DEVELOPMENT_MODE', !$isProduction && !$isStaging);
  159. define('APP_REQUEST', $isAppRequest);
  160. define('CUSTOM_CONTROLLER_REQUEST', $customControllerRequest);
  161. define('APPPATH', "$applicationFolder/");
  162. define('SOURCEPATH', 'euf/application/rightnow');
  163. define('CPCORE', $documentRoot . '/' . SOURCEPATH . '/');
  164. define('CPCORESRC', "$documentRoot/euf/src/application/rightnow/");
  165. define('YUI_SOURCE_DIR', '/rnt/rnw/yui_2.7/');
  166. define('ASSETS_ROOT', $isReference ? '/euf/assets/default/' : '/euf/assets/');
  167. define('IS_PRODUCTION', $isProduction);
  168. define('IS_REFERENCE', $isReference);
  169. define('IS_STAGING', $isStaging);
  170. define('IS_DEVELOPMENT', $isDevelopment);
  171. define('IS_ADMIN', $isAdmin);
  172.  
  173. if (!$isProduction && !$isStaging)
  174. {
  175.         ini_set('display_errors', 'on');
  176. }
  177. verifyOnlyOneModeDefineIsTrue(array(
  178.         'IS_PRODUCTION',
  179.         'IS_REFERENCE',
  180.         'IS_DEVELOPMENT',
  181.         'IS_ADMIN',
  182.         'IS_STAGING'
  183. ));
  184. define('USES_ADMIN_IP_ACCESS_RULES', ($isAdmin || $isDeployableAdmin || $isDevelopment || $isReference));
  185. define('USES_ADMIN_HTTPS_SEC_RULES', ($isAdmin || $isDeployableAdmin));
  186. define('FACEBOOK_REQUEST', $facebookRequest);
  187. require_once (BASEPATH . 'codeigniter/CodeIgniter' . EXT);
  188.  
  189. function redirectForDreamweaverPreviewInBrowserRequest($requestUri)
  190. {
  191.        
  192.         if (count($requestUri) > 6 && strcasecmp($requestUri[2], 'euf') === 0 && strcasecmp($requestUri[3], 'development') === 0 && strcasecmp($requestUri[4], 'views') === 0 && strcasecmp($requestUri[5], 'pages') === 0 && strcasecmp(substr($requestUri[count($requestUri) - 1], -4) , '.php') === 0)
  193.         {
  194.                 permanentRedirect('/ci/admin/developmentRedirect/' . substr(implode('/', array_slice($requestUri, 6)) , 0, -4));
  195.         }
  196. }
  197.  
  198. function verifyOnlyOneModeDefineIsTrue($modeDefines)
  199. {
  200.         $numModeDefinesEnabled = 0;
  201.         foreach ($modeDefines as $modeDefine)
  202.         {
  203.                
  204.                 if (!defined($modeDefine))
  205.                 {
  206.                         throw new Exception("There is no $modeDefine define.");
  207.                 }
  208.                
  209.                 if (!is_bool(constant($modeDefine)))
  210.                 {
  211.                         throw new Exception("Mode defines must be true or false.  The value of $modeDefine is not.");
  212.                 }
  213.                
  214.                 if (constant($modeDefine))
  215.                 {
  216.                         ++$numModeDefinesEnabled;
  217.                 }
  218.         }
  219.        
  220.         if ($numModeDefinesEnabled != 1)
  221.         {
  222.                 throw new Exception('Exactly one of the mode constants must be true.');
  223.         }
  224. }
  225.  
  226. function fixHttpAuthenticationHeader()
  227. {
  228.        
  229.         if (!IS_HOSTED && isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))
  230.         {
  231.                 $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
  232.         }
  233. }
  234.  
  235. function fixScriptEnvironmentVariables()
  236. {
  237.        
  238.         if ($_SERVER['SCRIPT_FILENAME'])
  239.         {
  240.                 $_SERVER['SCRIPT_NAME'] = substr($_SERVER['SCRIPT_FILENAME'], strpos($_SERVER['SCRIPT_FILENAME'], '/cgi-bin/'));
  241.         }
  242.         putenv("SCRIPT_NAME={$_SERVER['SCRIPT_NAME']}");
  243. }
  244.  
  245. function redirectToProperWebDavUrl($requestUri)
  246. {
  247.         assert(strcasecmp($requestUri[1], 'ci') === 0);
  248.         assert(strcasecmp($requestUri[2], 'webdav') === 0);
  249.         permanentRedirect('/dav/' . implode('/', array_slice($requestUri, 3)));
  250. }
  251.  
  252. function redirectToProperPageUrl($requestUri)
  253. {
  254.         assert(strcasecmp($requestUri[1], 'ci') === 0);
  255.         assert(strcasecmp($requestUri[2], 'page') === 0);
  256.         $segmentsToSkip = 3;
  257.        
  258.         if (strcasecmp($requestUri[3], 'render') === 0)
  259.         {
  260.                 $segmentsToSkip = 4;
  261.         }
  262.         permanentRedirect('/app/' . implode('/', array_slice($requestUri, $segmentsToSkip)));
  263. }
  264.  
  265. function redirectWindowsAttemptToDiscoverWebDav($requestUri)
  266. {
  267.        
  268.         if (($_SERVER['REQUEST_METHOD'] === 'OPTIONS' || $_SERVER['REQUEST_METHOD'] === 'PROPFIND') && (($requestUri[0] === '') || (strcasecmp($requestUri[1], 'app') === 0 && $requestUri[2] === '')))
  269.         {
  270.                 permanentRedirect('/dav/');
  271.         }
  272. }
  273.  
  274. function permanentRedirect($url)
  275. {
  276.         header("Location: $url");
  277.         header('HTTP/1.1 301 Moved Permanently');
  278.         exit(' ');
  279. }
  280.  
  281. function xssSanitize()
  282. {
  283.         $serverGlobalsToEscape = array(
  284.                 'QUERY_STRING',
  285.                 'REQUEST_URI',
  286.                 'HTTP_REFERER',
  287.                 'REDIRECT_URL'
  288.         );
  289.         foreach ($serverGlobalsToEscape as $value)
  290.         {
  291.                 $_SERVER[$value] = xssSanitizeReplacer($_SERVER[$value]);
  292.         }
  293.         foreach ($_GET as $key => $value)
  294.         {
  295.                
  296.                 if (is_array($value))
  297.                 {
  298.                         foreach ($value as $subKey => $subValue)
  299.                         {
  300.                                 $cleanedSubKey = xssSanitizeReplacer($subKey);
  301.                                 $value[$cleanedSubKey] = xssSanitizeReplacer($subValue);
  302.                                
  303.                                 if ($cleanedSubKey != $subKey) unset($value[$subKey]);
  304.                         }
  305.                         continue;
  306.                 }
  307.                 $cleanedKey = xssSanitizeReplacer($key);
  308.                 $_GET[$cleanedKey] = $_REQUEST[$cleanedKey] = xssSanitizeReplacer($value);
  309.                
  310.                 if ($cleanedKey !== $key) unset($_GET[$key], $_REQUEST[$key]);
  311.         }
  312.         foreach ($_POST as $key => $value)
  313.         {
  314.                
  315.                 if (is_array($value))
  316.                 {
  317.                         foreach ($value as $subKey => $subValue)
  318.                         {
  319.                                 $cleanedSubKey = xssSanitizeReplacer($subKey);
  320.                                 $value[$cleanedSubKey] = xssSanitizeReplacer($subValue, false);
  321.                                
  322.                                 if ($cleanedSubKey != $subKey) unset($value[$subKey]);
  323.                         }
  324.                         continue;
  325.                 }
  326.                 $cleanedKey = xssSanitizeReplacer($key);
  327.                 $_POST[$cleanedKey] = $_REQUEST[$cleanedKey] = xssSanitizeReplacer($value, false);
  328.                
  329.                 if ($cleanedKey !== $key) unset($_POST[$key], $_REQUEST[$key]);
  330.         }
  331. }
  332.  
  333. function redirectDeployerRequests(&$requestUri)
  334. {
  335.         $mapping = array(
  336.                 'cmdline_deploy' => 'upgradeDeploy',
  337.                 'deploy' => 'productionDeploy',
  338.                 'prepare_deploy' => 'prepareDeploy',
  339.                 'commit_deploy' => 'commitDeploy',
  340.                 'servicepackdeploy' => 'servicePackDeploy',
  341.                 'unittestdeploy' => 'unitTestDeploy',
  342.                 'modifyclientworkflowviewsforclassicenduser' => 'modifyClientWorkflowViewsForClassicEnduser',
  343.                 'modifyclientworkflowviewsforcustomerportal' => 'modifyClientWorkflowViewsForCustomerPortal',
  344.                 'modifyproductionpagesetmappingfilestomatchdb' => 'modifyProductionPageSetMappingFilesToMatchDB'
  345.         );
  346.         $mappedTo = $mapping[strtolower($requestUri[3]) ];
  347.        
  348.         if (!$mappedTo)
  349.         {
  350.                 return;
  351.         }
  352.         $requestUri[2] = 'deploy';
  353.         $requestUri[3] = $mappedTo;
  354.         $_SERVER['REQUEST_URI'] = implode('/', $requestUri);
  355. }
  356.  
  357. function xssSanitizeReplacer($value, $cleanQuotes = true)
  358. {
  359.         $value = strtr($value, array(
  360.                 "\0" => '',
  361.                 "\t" => '    ',
  362.                 '%09' => '    '
  363.         ));
  364.         $value = preg_replace('@javascript(:|&#58;?|&#x3A;?|%3A)@i', 'javascript ', $value);
  365.         $value = str_ireplace(array(
  366.                 '%3C',
  367.                 '<'
  368.         ) , '&lt;', $value);
  369.         $value = str_ireplace(array(
  370.                 '%3E',
  371.                 '>'
  372.         ) , '&gt;', $value);
  373.        
  374.         if ($cleanQuotes)
  375.         {
  376.                 $value = str_replace(array(
  377.                         '%22',
  378.                         '"'
  379.                 ) , '&quot;', $value);
  380.                 return str_replace(array(
  381.                         '%27',
  382.                         "'"
  383.                 ) , '&#039;', $value);
  384.         }
  385.         return $value;
  386. }
  387.