Jump to content

Recommended Posts

Greetings.

 

I'm doing step 3 of the installation of my CMS now, which is to check file permissions. Can't seem to get it to work right...

 

Below is the code I'm using. I'm echoing $permissions in my template file. Outputs nothing...

 

<?php
function check_perms( $path, $file, $perm )
{
clearstatcache();
$configmod = substr(sprintf('%o', fileperms($path)), -4);
$text = (($configmod != $perm) ? "color: #e30000;" : "color: #88e300;");
$file_perm = "<tr>\n";
$file_perm .= "<td style=\"$text\">$file</td>\n";
$file_perm .= "<td style=\"$text\">$perm</td>\n";
$file_perm .= "<td style=\"$text\">$configmod</td>\n";
$file_perm .= "</tr>\n";
return $file_perm;
}

function permissions()
{
echo "<table class=\"form_area\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"10\">";
check_perms( "../config.php", "config.php", "0777" );
check_perms( "../downloads/uploads", "downloads/uploads/", "0777" );
check_perms( "../images/uploads", "images/uploads/", "0777" );
echo "</table>";
}

switch ($_GET['step'])
{

case 3:
$permissions = permissions();
include('templates/default/step3.tpl');
break;
?>

You need to echo out the functions

 

function permissions()
{
   echo "</pre>
<table class='\"form_area\"' width='\"100%\"' border='\"0\"' cellpadding='\"0\"' cellspacing='\"10\"'>";
   echo check_perms( "../config.php", "config.php", "0777" );
   echo check_perms( "../downloads/uploads", "downloads/uploads/", "0777" );
   echo check_perms( "../images/uploads", "images/uploads/", "0777" );
   echo "</table>"

Why don't you return a string...  Then you can echo $permissions wherever you want.

 

function permissions()
{
   $perm = "</pre>
<table class='\"form_area\"' width='\"100%\"' border='\"0\"' cellpadding='\"0\"' cellspacing='\"10\"'>";
   $perm .= check_perms( "../config.php", "config.php", "0777" );
   $perm .= check_perms( "../downloads/uploads", "downloads/uploads/", "0777" );
   $perm .= check_perms( "../images/uploads", "images/uploads/", "0777" );
   $perm .= "</table>";<br><br>   return $perm

Why don't you return a string...  Then you can echo $permissions wherever you want.

 

function permissions()
{
   $perm = "<table class=\"form_area\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"10\">";
   $perm .= check_perms( "../config.php", "config.php", "0777" );
   $perm .= check_perms( "../downloads/uploads", "downloads/uploads/", "0777" );
   $perm .= check_perms( "../images/uploads", "images/uploads/", "0777" );
   $perm .= "</table>";

   return $perm;
}

 

Thanks worked. You the man. :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.