/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
- function checkPerm($perm, $au)
+ function checkPerm($lvl, $au)
{
// default permissons are to
// allow create / edit / if the user has
if (!$au) {
-
-
-
return false;
}
$o = $this->object();
//print_r($o);
- if (method_exists($o, 'hasPerm')) {
+ if (method_exists($o, 'checkPerm')) {
// edit permissions on related object needed...
- return $o->hasPerm( $perm == 'S' ? 'S' : 'E' , $au);
+ return $o->checkPerm( $lvl == 'S' ? 'S' : 'E' , $au);
}
{
// copy the file into the storage area..
if (!file_exists($file) || !filesize($file)) {
+ $this->err = "File $file did not exist or is 0 size";
return false;
}
/// ctrl not used??
function onUpload($roo)
{
-// echo $_FILES['imageUpload']['type'];exit;
+ //print_r($_FILES); echo $_FILES['imageUpload']['type'];exit;
if (empty($_FILES['imageUpload']['tmp_name']) ||
empty($_FILES['imageUpload']['name']) ||
empty($_FILES['imageUpload']['type'])
) {
- $this->err = "Missing file details";
+ $this->err = "Missing file details : Error=". empty($_FILES['imageUpload']['error']) ? '?': $_FILES['imageUpload']['error'];
return false;
}
if (!$this->createFrom($_FILES['imageUpload']['tmp_name'])) {
+ $this->err = isset($this->err) ? $this->err : "createFrom Image failed";
return false;
}
return true;
}
- function toRooArray($req = array()) {
- // echo '<PRE>';print_r($req);exit;
+ function toRooArray($req) {
+
$ret= $this->toArray();
static $ff = false;
$ff->Pman_Images['public_baseURL'] : $ff->baseURL;
if (!empty($req['query']['imagesize'])) {
- $baseURL = isset($req['query']['imageBaseURL']) ? $req['query']['imageBaseURL'] : false;
+ // query/imageBaseURL ... depricated...? -- set it in config?
+
+ $baseURL = isset($req['query']['imageBaseURL']) ? $req['query']['imageBaseURL'] : $ret['public_baseURL'];
$ret['url'] = $this->URL(-1, '/Images/Download',$baseURL);
// print_r(!$this->onUpload($this));
if ( !$this->onUpload($this)) {
- $roo->jerr("File upload failed : ". (!empty($this->err) ? $this->err : ''));
+ $roo->jerr("File upload failed : error = ". (!empty($this->err) ? $this->err : ''));
}
$roo->addEvent("ADD", $this, $this->toEventString());