note 77163 added to function.chmod

From: Date: Fri, 17 Aug 2007 14:15:14 +0000
Subject: note 77163 added to function.chmod
Groups: php.notes 
Request: Send a blank email to php-notes+get-129558@lists.php.net to get a copy of this message
Just for those peoples can't remeber the codes 777 and so on I just created a small class :-) <?php class Chmod { private $dir; private $modes = array('owner' => 0 , 'group' => 0 , 'public' => 0); public function setOwnermodes($read,$write,$execute) { $this->modes['owner'] = $this->setMode($read,$write,$execute); } public function setGroupmodes($read,$write,$execute) { $this->modes['group'] = $this->setMode($read,$write,$execute); } public function setPublicmodes($read,$write,$execute) { $this->modes['public'] = $this->setMode($read,$write,$execute); } public function getMode() { return 0 . $this->modes['owner'] . $this->modes['group'] . $this->modes['public']; } private function setMode($r,$w,$e) { $mode = 0; if($r) $mode+=4; if($w) $mode+=2; if($e) $mode+=1; return $mode; } } $test = new Chmod; $test->setOwnermodes(true,true,true); $test->setGroupmodes(true,true,true); $test->setPublicmodes(true,true,true); chmod($dir , $test->getMode()); // chmods $dir to 0777 ?> ---- Server IP: 212.124.37.9 Probable Submitter: 85.81.9.158 ---- Manual Page -- http://www.php.net/manual/en/function.chmod.php Edit -- https://master.php.net/note/edit/77163 Del: integrated -- https://master.php.net/note/delete/77163/integrated Del: useless -- https://master.php.net/note/delete/77163/useless Del: bad code -- https://master.php.net/note/delete/77163/bad+code Del: spam -- https://master.php.net/note/delete/77163/spam Del: non-english -- https://master.php.net/note/delete/77163/non-english Del: in docs -- https://master.php.net/note/delete/77163/in+docs Del: other reasons-- https://master.php.net/note/delete/77163 Reject -- https://master.php.net/note/reject/77163 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129558) next »