The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 916 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 916 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Recursive CHMOD function
#6
I found this in the archives

PHP Code:
<?php




$chmod_mode 
0755#no quotes around this number


/**
 * Recursive CHMOD
 *
 * @since 2.04
 * @author ccagle8
 *
 * @param string $path
 * @param string $filemode
 * @return bool
 */
function chmodr($path$filemode){
    if (!
is_dir($path)) {
        return 
chmod($path$filemode);
         }
    
$dh opendir($path);
    while ((
$file readdir($dh)) !== false)    {
        if (
$file != '.' && $file != '..')        {
            
$fullpath $path.'/'.$file;
            if(
is_link($fullpath)) {
                return 
FALSE;
            } elseif(!
is_dir($fullpath) && !chmod($fullpath$filemode)) {
                return 
FALSE;
            } elseif(!
chmodr($fullpath$filemode)) {
                return 
FALSE;
            }
        }
    }
 
    
closedir($dh);
 
    if(
chmod($path$filemode)) {
        return 
TRUE;
    } else {
        return 
FALSE;
    }
}




if (!isset(
$_GET['attemptfix'])) {
    echo 
"<html><head><title>Attempt to Fix</title></head><body>";
    echo 
'<a href="fix.php?attemptfix">Attempt to Fix</a>';
    echo 
"</body></html>";
} else {
    
$data_folder_status chmodr('data'$chmod_mode);
    
$backup_folder_status chmodr('backups'$chmod_mode);
    
    
$htaccess_folder_status chmod('temp.htaccess'$chmod_mode);
    
$gsconfig_folder_status chmod('temp.gsconfig.php'$chmod_mode);
    
    if (
$data_folder_status) {
        
$fix_status .= "Data path successfully chmod'd. <br />";
    } else {
        
$fix_status .= "Cannot chmod data path - Please do it manually. <br />";
    }
    
    if (
$data_folder_status) {    
        
$fix_status .= "Backup path successfully chmod'd. <br />";
    } else {
        
$fix_status .= "Cannot chmod backup path - Please do it manually. <br />";
    }
    
    if (
$htaccess_folder_status) {    
        
$fix_status .= ".htaccess successfully chmod'd. <br />";
        
copy('temp.htaccess''.htaccess');
        
chmod('.htaccess'$chmod_mode);
    } else {
        
$fix_status .= "Cannot chmod .htaccess - Please do it manually. <br />";
    }
    
    if (
$gsconfig_folder_status) {    
        
$fix_status .= "gsconfig.php successfully chmod'd. <br />";
        
copy('temp.gsconfig.php''gsconfig.php');
        
chmod('gsconfig.php'$chmod_mode);
    } else {
        
$fix_status .= "Cannot chmod gsconfig.php - Please do it manually. <br />";
    }    

    echo 
$fix_status;
}



?>
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply


Messages In This Thread
Recursive CHMOD function - by ccagle8 - 2010-11-12, 13:09:28
RE: Recursive CHMOD function - by akd - 2014-08-26, 16:14:03
RE: Recursive CHMOD function - by shawn_a - 2014-08-26, 23:07:01
RE: Recursive CHMOD function - by shawn_a - 2014-08-27, 00:42:56
RE: Recursive CHMOD function - by akd - 2014-08-29, 01:22:30
RE: Recursive CHMOD function - by shawn_a - 2014-08-29, 02:02:40
Recursive CHMOD function - by Oleg06 - 2010-11-12, 17:07:42
Recursive CHMOD function - by ccagle8 - 2010-11-12, 22:58:01



Users browsing this thread: 1 Guest(s)