Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 14, 2023. It is now read-only.
/ICEcoderPublic archive

Commit76dc065

Browse files
committed
Changing instances of dirname(__FILE__) to __DIR__
it's equivalent and easier to read this constant was introducedin php version 5.3.
1 parentf689908 commit76dc065

29 files changed

+96
-96
lines changed

‎editor.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,26 @@
2121
//-->
2222
<script src="<?phpecho$ICEcoder["codeMirrorDir"];?>/lib/codemirror-compressed.js?microtime=<?phpechomicrotime(true);?>"></script>
2323
<?php
24-
if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint-2.5.6.min.js")) {
24+
if (file_exists(__DIR__."/plugins/jshint/jshint-2.5.6.min.js")) {
2525
echo'<script src="plugins/jshint/jshint-2.5.6.min.js?microtime='.microtime(true).'></script>';
2626
};?>
2727
<script src="lib/mmd.js?microtime=<?phpechomicrotime(true);?>"></script>
2828
<link rel="stylesheet" href="<?phpecho$ICEcoder["codeMirrorDir"];?>/addon/fold/foldgutter.css?microtime=<?phpechomicrotime(true);?>">
2929
<link rel="stylesheet" href="<?phpecho$ICEcoder["codeMirrorDir"];?>/addon/scroll/simplescrollbars.css?microtime=<?phpechomicrotime(true);?>">
3030
<?php
31-
if (file_exists(dirname(__FILE__)."/plugins/emmet/emmet.min.js")) {
31+
if (file_exists(__DIR__."/plugins/emmet/emmet.min.js")) {
3232
echo'<script src="plugins/emmet/emmet.min.js?microtime='.microtime(true).'"></script>';
3333
};?>
3434
<?php
35-
if (file_exists(dirname(__FILE__)."/plugins/pesticide/pesticide.js")) {
35+
if (file_exists(__DIR__."/plugins/pesticide/pesticide.js")) {
3636
echo'<script src="plugins/pesticide/pesticide.js?microtime='.microtime(true).'"></script>';
3737
};?>
3838
<?php
39-
if (file_exists(dirname(__FILE__)."/plugins/stats.js/stats.min.js")) {
39+
if (file_exists(__DIR__."/plugins/stats.js/stats.min.js")) {
4040
echo'<script src="plugins/stats.js/stats.min.js?microtime='.microtime(true).'"></script>';
4141
};?>
4242
<?php
43-
if (file_exists(dirname(__FILE__)."/plugins/responsive-helper/responsive-helper.js")) {
43+
if (file_exists(__DIR__."/plugins/responsive-helper/responsive-helper.js")) {
4444
echo'<script src="plugins/responsive-helper/responsive-helper.js?microtime='.microtime(true).'"></script>';
4545
};?>
4646
<link rel="stylesheet" href="<?php

‎index.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
</span>
172172
<div onMouseOver="ICEcoder.showFileMenu()" style="padding: 2px 0"><hr></div>
173173
<?php
174-
if (file_exists(dirname(__FILE__)."/plugins/zip-it/index.php")) {
174+
if (file_exists(__DIR__."/plugins/zip-it/index.php")) {
175175
echo'<a href="#"diff-7413d6453f901e939bbd840c8f0d1c7b20c2ca0e7f71741e4e07c6cf036f16c0-176-176-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">176
176
};
177177
?>
@@ -344,4 +344,4 @@
344344

345345
</body>
346346

347-
</html>
347+
</html>

‎lib/backup-versions.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110

111111
<?php
112112
echo"fileName = '".basename($file)."';";
113-
include(dirname(__FILE__)."/language-modes-partial.js");
113+
include(__DIR__."/language-modes-partial.js");
114114
?>
115115

116116
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
@@ -167,4 +167,4 @@
167167

168168
</body>
169169

170-
</html>
170+
</html>

‎lib/bug-files-check.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
}
9494

9595
// Get dir name tmp dir's parent
96-
$tmpLoc =dirname(__FILE__);
96+
$tmpLoc =__DIR__;
9797
$tmpLoc =explode(DIRECTORY_SEPARATOR,$tmpLoc);
9898
$tmpLoc =$tmpLoc[count($tmpLoc)-2];
9999

@@ -112,4 +112,4 @@
112112
// Finally, display our status in JSON format as the XHR response text
113113
echojson_encode($status);
114114

115-
?>
115+
?>

‎lib/file-control-xhr.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function stitchChanges($fileLines) {
359359
$backupDirFormat ="Y-m-d";
360360

361361
// Establish the base, host and date dir parts...
362-
$backupDirBase =str_replace("\\","/",dirname(__FILE__))."/../backups/";
362+
$backupDirBase =str_replace("\\","/",__DIR__)."/../backups/";
363363
$backupDirHost =isset($ftpSite) ?parse_url($ftpSite,PHP_URL_HOST) :"localhost";
364364
$backupDirDate =date($backupDirFormat);
365365

@@ -815,7 +815,7 @@ function getDetails($fileArr) {
815815
}else {
816816
// Delete file to tmp dir or full delete
817817
$ICEcoder['deleteToTmp']
818-
?rename($fullPath,str_replace("\\","/",dirname(__FILE__))."/../tmp/.".str_replace(":","_",str_replace("/","_",$fullPath)))
818+
?rename($fullPath,str_replace("\\","/",__DIR__)."/../tmp/.".str_replace(":","_",str_replace("/","_",$fullPath)))
819819
:unlink($fullPath);
820820
}
821821
$fileName =basename($fullPath);
@@ -847,14 +847,14 @@ function rrmdir($dir) {
847847
rrmdir($dir."/".$object);
848848
}else {
849849
$ICEcoder['deleteToTmp']
850-
?rename($dir."/".$object,str_replace("\\","/",dirname(__FILE__))."/../tmp/.".str_replace(":","_",str_replace("/","_",$dir))."/".$object)
850+
?rename($dir."/".$object,str_replace("\\","/",__DIR__)."/../tmp/.".str_replace(":","_",str_replace("/","_",$dir))."/".$object)
851851
:unlink($dir."/".$object);
852852
}
853853
}
854854
}
855855
reset($objects);
856856
$ICEcoder['deleteToTmp']
857-
?rename($dir,str_replace("\\","/",dirname(__FILE__))."/../tmp/.".str_replace(":","_",str_replace("/","_",$dir)))
857+
?rename($dir,str_replace("\\","/",__DIR__)."/../tmp/.".str_replace(":","_",str_replace("/","_",$dir)))
858858
:rmdir($dir);
859859
}
860860
};
@@ -1009,4 +1009,4 @@ function rrmdir($dir) {
10091009
"errorMsg" : "'.$errorMsg.'"
10101010
}
10111011
}';
1012-
?>
1012+
?>

‎lib/headers.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22
// Stop if we're running an old version in the tmp dir
3-
if(strpos(str_replace("\\","/",dirname(__FILE__)),"tmp/oldVersion") !==false) {
3+
if(strpos(str_replace("\\","/",__DIR__),"tmp/oldVersion") !==false) {
44
die("This is an old version of ICEcoder. Won't run from tmp/oldVersion/ dir.");
55
}
66

77
// Load common functions
8-
include_once(dirname(__FILE__)."/settings-common.php");
8+
include_once(__DIR__."/settings-common.php");
99
if (isset($_SESSION['text'])) {
1010
$text =$_SESSION['text'];
1111
$t =$text['headers'];
@@ -37,4 +37,4 @@
3737
header('Pragma: no-cache');// Caching over HTTP 1.0 covered
3838
header('Expires: 0');// Caching over Proxies covered
3939
}
40-
?>
40+
?>

‎lib/settings-common.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Don't display, but log all errors
33
ini_set('display_errors',0);
44
ini_set('log_errors',1);
5-
ini_set('error_log',dirname(__FILE__).'/../error-log.txt');
5+
ini_set('error_log',__DIR__.'/../error-log.txt');
66
error_reporting(-1);
77

88
// Set our default timezone and supress warning with @
@@ -22,13 +22,13 @@
2222
ini_set('session.name','ICEcoder_Cookie');// Set a seperate cookie session name
2323
ini_set('session.cookie_lifetime','0');// Until the browser restarts by default
2424
ini_set('session.cookie_domain','');// This domain only
25-
//ini_set('session.cookie_path',str_replace($_SERVER['DOCUMENT_ROOT'],'',dirname(dirname(__FILE__)))); // ICEcoder path only, fails ON IE
25+
//ini_set('session.cookie_path',str_replace($_SERVER['DOCUMENT_ROOT'],'',dirname(__DIR__))); // ICEcoder path only, fails ON IE
2626
ini_set('session.use_trans_sid','0');// Ensure this insecure feature is disabled
2727
ini_set('session.hash_function','sha512');// Use Sha512 for session
2828
ini_set('session.hash_bits_per_character','6');// Specify hash scheme of 0-9,a-v,A-Z,-,,
2929
//ini_set('session.use_strict_mode','1');// Reject any session ID that was user provided and not generated by the session(since PHP 5.5.2)
3030
ini_set('session.httponly','1');// Only allow http protocol (ie, not JS) access to the cookie(since PHP 5.2.0)
31-
ini_set('session.save_path',dirname(__FILE__).'/../tmp');// Localise the session files to /tmp
31+
ini_set('session.save_path',__DIR__.'/../tmp');// Localise the session files to /tmp
3232

3333
if (!empty($_SERVER['HTTPS']) &&$_SERVER['HTTPS'] !=='off') {
3434
ini_set('session.cookie_secure','1');// Only allows access to session ID when protocol is HTTPS, switched on under 'if https' condition
@@ -90,7 +90,7 @@ function getData($url,$type='fopen',$dieMessage=false,$timeout=60) {
9090

9191
// Logout if that's the action we're taking
9292
if (isset($_GET['logout'])) {
93-
include(dirname(__FILE__)."/../processes/on-user-logout.php");
93+
include(__DIR__."/../processes/on-user-logout.php");
9494
$_SESSION['loggedIn']=false;
9595
$_SESSION['username']=false;
9696
session_destroy();
@@ -254,7 +254,7 @@ function getVersionsCount($fileLoc,$fileName) {
254254
$dateCounts =array();
255255
$backupDateDirs =array();
256256
// Establish the base, host and date dirs within...
257-
$backupDirBase =str_replace("\\","/",dirname(__FILE__))."/../backups/";
257+
$backupDirBase =str_replace("\\","/",__DIR__)."/../backups/";
258258
$backupDirHost =isset($ftpSite) ?parse_url($ftpSite,PHP_URL_HOST) :"localhost";
259259
// check if folder exists if local before enumerating contents
260260
if(!isset($ftpSite)) {

‎lib/settings-screen.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
<div style="padding: 5px 5px 5px 5px; color: #888">
164164
<?php
165165
// Display number of days backups available
166-
$backupDirBase =str_replace("\\","/",dirname(__FILE__))."/../backups/";
166+
$backupDirBase =str_replace("\\","/",__DIR__)."/../backups/";
167167
$backupDirHost =isset($ftpSite) ?parse_url($ftpSite,PHP_URL_HOST) :"localhost";
168168
$backupDirsList =scandir($backupDirBase.$backupDirHost);
169169
// Remove . and .. from array
@@ -438,4 +438,4 @@ function changeFontSize() {
438438

439439
</body>
440440

441-
</html>
441+
</html>

‎lib/settings.php‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
// Create a new config file if it doesn't exist yet.
77
// The reason we create it, is so it has PHP write permissions, meaning we can update it later
8-
if (!file_exists(dirname(__FILE__)."/".$configSettings)) {
8+
if (!file_exists(__DIR__."/".$configSettings)) {
99
// Include our params to make use of (as $newConfigSettingsFile)
10-
include(dirname(__FILE__)."/settings-system-params.php");
11-
if ($fConfigSettings =fopen(dirname(__FILE__)."/".$configSettings,'w')) {
10+
include(__DIR__."/settings-system-params.php");
11+
if ($fConfigSettings =fopen(__DIR__."/".$configSettings,'w')) {
1212
fwrite($fConfigSettings,$newConfigSettingsFile);
1313
fclose($fConfigSettings);
1414
}else {
@@ -17,10 +17,10 @@
1717
}
1818

1919
// Load config settings
20-
include(dirname(__FILE__)."/".$configSettings);
20+
include(__DIR__."/".$configSettings);
2121

2222
// Load common functions
23-
include_once(dirname(__FILE__)."/settings-common.php");
23+
include_once(__DIR__."/settings-common.php");
2424

2525
// Establish user settings file
2626
$username ="";
@@ -32,15 +32,15 @@
3232
$setPWorLogin ="login";
3333

3434
// Create user settings file if it doesn't exist
35-
if (!file_exists(dirname(__FILE__)."/".$settingsFile) &&$ICEcoderSettings['enableRegistration']) {
36-
if (!copy(dirname(__FILE__)."/".$configUsersTemplate,dirname(__FILE__)."/".$settingsFile)) {
35+
if (!file_exists(__DIR__."/".$settingsFile) &&$ICEcoderSettings['enableRegistration']) {
36+
if (!copy(__DIR__."/".$configUsersTemplate,__DIR__."/".$settingsFile)) {
3737
die("Couldn't create$settingsFile. Maybe you need write permissions on the lib folder?");
3838
}
3939
$setPWorLogin ="set password";
4040
}
4141

4242
// Load user settings
43-
include(dirname(__FILE__)."/".$settingsFile);
43+
include(__DIR__."/".$settingsFile);
4444

4545
// Remove any previous files that are no longer there
4646
$prevFiles =explode(",",$ICEcoderUserSettings['previousFiles']);
@@ -55,9 +55,9 @@
5555

5656
// Replace our config created date with the filemtime?
5757
if (basename($_SERVER['SCRIPT_NAME']) =="index.php" &&$ICEcoderUserSettings['configCreateDate'] ==0) {
58-
$settingsContents =getData(dirname(__FILE__)."/".$settingsFile);
58+
$settingsContents =getData(__DIR__."/".$settingsFile);
5959
clearstatcache();
60-
$configfilemtime =filemtime(dirname(__FILE__)."/"."config___settings.php");
60+
$configfilemtime =filemtime(__DIR__."/"."config___settings.php");
6161
// Make it a number (avoids null, undefined etc)
6262
$configfilemtime =intval($configfilemtime);
6363
// Set it to the epoch time now if we don't have a real value
@@ -66,7 +66,7 @@
6666
}
6767
$settingsContents =str_replace('"configCreateDate"=> 0,','"configCreateDate"=>'.$configfilemtime.',',$settingsContents);
6868
// Now update the config file
69-
$fh =fopen(dirname(__FILE__)."/".$settingsFile,'w')ordie("Can't update config file. Please set public write permissions on".$settingsFile." and press refresh");
69+
$fh =fopen(__DIR__."/".$settingsFile,'w')ordie("Can't update config file. Please set public write permissions on".$settingsFile." and press refresh");
7070
fwrite($fh,$settingsContents);
7171
fclose($fh);
7272
// Set the new value in array
@@ -75,7 +75,7 @@
7575

7676
// On mismatch of settings file to system, rename to .old and reload
7777
If ($ICEcoderUserSettings["versionNo"] !=$ICEcoderSettings["versionNo"]) {
78-
rename(dirname(__FILE__)."/".$settingsFile,dirname(__FILE__)."/".str_replace(".php",".old",$settingsFile));
78+
rename(__DIR__."/".$settingsFile,__DIR__."/".str_replace(".php",".old",$settingsFile));
7979
header("Location: settings.php");
8080
echo"<script>window.location='settings.php';</script>";
8181
die('Found old settings file, reloading...');
@@ -86,10 +86,10 @@
8686

8787
// Include language file
8888
// Load base first as foundation
89-
include(dirname(__FILE__)."/../lang/".basename($ICEcoder['languageBase']));
89+
include(__DIR__."/../lang/".basename($ICEcoder['languageBase']));
9090
$baseText =$text;
9191
// Load chosen language ontop to replace base
92-
include(dirname(__FILE__)."/../lang/".basename($ICEcoder['languageUser']));
92+
include(__DIR__."/../lang/".basename($ICEcoder['languageUser']));
9393
$text =array_replace_recursive($baseText,$text);
9494
$_SESSION['text'] =$text;
9595

@@ -117,7 +117,7 @@
117117
$tDaysRemaining =intval($tRemaining/(60*60*24));
118118

119119
// Update this config file?
120-
include(dirname(__FILE__)."/settings-update.php");
120+
include(__DIR__."/settings-update.php");
121121

122122
// Set loggedIn and username to false if not set as yet
123123
if (!isset($_SESSION['loggedIn'])) {$_SESSION['loggedIn'] =false;};
@@ -132,12 +132,12 @@
132132
$_SESSION['username'] =$_POST['username'];
133133
}
134134
$_SESSION['loggedIn'] =true;
135-
include(dirname(__FILE__)."/../processes/on-user-login.php");
135+
include(__DIR__."/../processes/on-user-login.php");
136136
header('Location: ../');
137137
echo"<script>window.location='../';</script>";
138138
die('Logging you in...');
139139
}else {
140-
include(dirname(__FILE__)."/../processes/on-user-login-fail.php");
140+
include(__DIR__."/../processes/on-user-login-fail.php");
141141
}
142142
};
143143

@@ -184,10 +184,10 @@
184184
}
185185

186186
// Save currently opened files in previousFiles and last10Files arrays
187-
include(dirname(__FILE__)."/settings-save-current-files.php");
187+
include(__DIR__."/settings-save-current-files.php");
188188

189189
// Display the plugins
190-
include(dirname(__FILE__)."/plugins-display.php");
190+
include(__DIR__."/plugins-display.php");
191191

192192
// If loggedIn is false or we don't have a password set yet and we're not on login screen, boot user to that
193193
if ((!$_SESSION['loggedIn'] ||$ICEcoder["password"] =="") && !strpos($_SERVER['SCRIPT_NAME'],"lib/login.php")) {
@@ -251,15 +251,15 @@
251251
$serverAddr ="127.0.0.1";
252252
}
253253
$settingsFileAddr ='config-'.$username.str_replace(".","_",$serverAddr).'.php';
254-
if (!file_exists(dirname(__FILE__)."/".$settingsFileAddr)) {
255-
if (!copy(dirname(__FILE__)."/".$settingsFile,dirname(__FILE__)."/".$settingsFileAddr)) {
254+
if (!file_exists(__DIR__."/".$settingsFileAddr)) {
255+
if (!copy(__DIR__."/".$settingsFile,__DIR__."/".$settingsFileAddr)) {
256256
die("Couldn't create$settingsFileAddr. Maybe you need write permissions on the lib folder?");
257257
}
258258
}
259259
// Disable the enableRegistration config setting if the user had that option chosen
260260
if (isset($_POST['disableFurtherRegistration'])) {
261-
$updatedConfigSettingsFile =getData(dirname(__FILE__)."/".$configSettings);
262-
if ($fUConfigSettings =fopen(dirname(__FILE__)."/".$configSettings,'w')) {
261+
$updatedConfigSettingsFile =getData(__DIR__."/".$configSettings);
262+
if ($fUConfigSettings =fopen(__DIR__."/".$configSettings,'w')) {
263263
$updatedConfigSettingsFile =str_replace('"enableRegistration"=> true','"enableRegistration"=> false',$updatedConfigSettingsFile);
264264
fwrite($fUConfigSettings,$updatedConfigSettingsFile);
265265
fclose($fUConfigSettings);
@@ -272,7 +272,7 @@
272272
$_SESSION['username']=$_POST['username'];
273273
}
274274
$_SESSION['loggedIn'] =true;
275-
include(dirname(__FILE__)."/../processes/on-user-new.php");
275+
include(__DIR__."/../processes/on-user-new.php");
276276
// Finally, load again as now this file has changed and auto login
277277
header('Location: ../');
278278
echo"<script>window.location='../';</script>";
@@ -290,4 +290,4 @@
290290
// Continue with whatever we're doing
291291
// ==================================
292292
}
293-
?>
293+
?>

‎lib/terminal-xhr.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
2-
include(dirname(__FILE__)."/headers.php");
3-
include(dirname(__FILE__)."/settings.php");
2+
include(__DIR__."/headers.php");
3+
include(__DIR__."/settings.php");
44

55

66
functionproc_open_enabled() {
@@ -40,7 +40,7 @@ function proc_open_enabled() {
4040

4141
// If command contains cd but no dir
4242
if (preg_match('/^[[:blank:]]*cd[[:blank:]]*$/', @$_REQUEST['command'])) {
43-
$_SESSION['cwd'] =getcwd();//dirname(__FILE__);
43+
$_SESSION['cwd'] =getcwd();//__DIR__;
4444
// Else cd to a dir
4545
}elseif (preg_match('/^[[:blank:]]*cd[[:blank:]]+([^;]+)$/', @$_REQUEST['command'],$regs)) {
4646
// The current command is 'cd', which we have to handle as an internal shell command

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp