PageRenderTime 55ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/www/admin/chmod.php

http://kandidat-cms.googlecode.com/
PHP | 84 lines | 84 code | 0 blank | 0 comment | 0 complexity | c7cfca388cc3d6a086ce45d339beb4a4 MD5 | raw file
Possible License(s): CC0-1.0
  1. <?php
  2. $path=substr(str_replace('\\','/',dirname(__FILE__)),0,-6);
  3. include $path.'/admin/adminses.php';
  4. if(3>getpermision())header('LOCATION:index.php');
  5. include CONF.'photoconf.php';
  6. $inst = (isset($_GET['inst'])) ? (int)$_GET['inst'] : 0;
  7. $perm_file=0666;
  8. $perm_dir=0777;
  9. function perm_file ($directory,$isperm){
  10. global $contentcenter,$dumbcount;
  11. $allok=0;
  12. $ok=0;
  13. $per=substr(sprintf('%o',fileperms($directory)),-4);
  14. $perm=substr(sprintf('%o',$isperm),-4);
  15. if($per==$perm)$ok=1;else $allok++;
  16. @$dumbcount++;
  17. $class = 'cline' . ($dumbcount % 2);
  18. if ( is_dir ($directory)){
  19. $contentcenter.='<tr class="'.$class.'" ><td class="line3"><b>'.$directory.'</b></td>
  20. <td class="line3"><b>'.$per.'</b></td>
  21. <td class="line3"><b>'.$perm.'</b></td>';
  22. if($ok)$contentcenter.='<td class="line3"><img src="images/ok.png" /></td></tr>';
  23. else $contentcenter.='<td class="line3"><img src="images/error.png" /></td></tr>';
  24. }else{
  25. $contentcenter.='<tr class="'.$class.'" ><td class="line3">'.$directory.'</td>
  26. <td class="line3">'.$per.'</td>
  27. <td class="line3">'.$perm.'</td>';
  28. if($ok)$contentcenter.='<td class="line3"><img src="images/ok.png" /></td></tr>';
  29. else $contentcenter.='<td class="line3"><img src="images/error.png" /></td></tr>';
  30. }
  31. return $allok;
  32. }
  33. function full_perm_dir ($directory,$permdir,$permfile){
  34. $allok=0;
  35. if ( is_dir ($directory))$allok+=perm_file($directory,$permdir);
  36. $dir = opendir($directory);
  37. while(($file = readdir($dir))){
  38. if ( is_file ($directory.'/'.$file)){
  39. if($file=='.htaccess')continue;
  40. $allok+=perm_file ($directory.'/'.$file,$permfile);
  41. }elseif(is_dir($directory.'/'.$file)&&($file != '.') && ($file != '..')){
  42. full_perm_dir ($directory.'/'.$file,$permdir,$permfile);
  43. }
  44. }
  45. closedir ($dir);
  46. return $allok;
  47. }
  48. if($inst){
  49. full_chmod_dir(CONF,$perm_dir,$perm_file);
  50. full_chmod_dir(ARTICLES,$perm_dir,$perm_file);
  51. full_chmod_dir(ENGINE,$perm_dir,$perm_file);
  52. # full_chmod_dir(MYCODE,$perm_dir,$perm_file);
  53. full_chmod_dir(PICTURES,$perm_dir,$perm_file);
  54. full_chmod_dir($localpath.'admin/templates',$perm_dir,$perm_file);
  55. full_chmod_dir($localpath.'templates',$perm_dir,$perm_file);
  56. header('LOCATION: chmod.php');
  57. }
  58. @$allok=0;
  59. @$contentcenter.= '<h3>????????? ???? CMS ????????</h3>';
  60. $contentcenter.='<br /><table cellpadding="2" cellspacing="0" width="90%">
  61. <thead>
  62. <td width="70%"><b>????</b></td>
  63. <td width="10%"><b>?????</b></td>
  64. <td width="10%"><b>????</b></td>
  65. <td width="10%"><b>??</b></td>
  66. </thead><tbody>';
  67. $allok+=full_perm_dir(CONF,$perm_dir,$perm_file);
  68. $allok+=full_perm_dir(ARTICLES,$perm_dir,$perm_file);
  69. $allok+=full_perm_dir(ENGINE,$perm_dir,$perm_file);
  70. #$allok+=full_perm_dir(MYCODE,$perm_dir,$perm_file);
  71. $allok+=full_perm_dir(PICTURES,$perm_dir,$perm_file);
  72. $allok+=full_perm_dir($localpath.'admin/templates',$perm_dir,$perm_file);
  73. $allok+=full_perm_dir($localpath.'templates',$perm_dir,$perm_file);
  74. $contentcenter.='</tbody></table><br /><br />';
  75. if($allok)$contentcenter.='<span style="color: rgb(255, 0, 51);">????? ?? ????????????? ?????????. ????????? ?????????</span>&nbsp;
  76. <a title="?????? ?????????" href="../admin/chmod.php?inst=1">?????????? ?????</a>';
  77. else $contentcenter.='????? ????????????? ?????????';
  78. include $localpath.'/admin/admintemplate.php';
  79. ?>