%%writer%%

%%prequery%%
$this->policyId= '$Id: writer,v 1.7 2003/04/29 23:16:04 csnyder Exp $';

global $session;

$session->statuswhere= " AND (obj.status='posted' OR obj.status='new' OR (obj.sitememberid='$sitemember->id' AND obj.status!='deleted') ) ";
$session->publicwhere= " AND obj.public LIKE '%' ";
$session->statusfolder= " AND folder.status='posted' ";
$session->publicfolder= " AND folder.public LIKE '%' ";
berror("applyPolicy: session:$session->id had no statuswhere ($session->statuswhere).",1);

$this->sqlSafe= $session->statuswhere.$session->publicwhere;
$this->sqlSafeFolder= $session->statusfolder.$session->publicfolder;
berror("applyPolicy: created sqlSafe ($this->sqlSafe) and sqlSafeFolder ($this->sqlSafeFolder) from session:$session->id.",1);

// publishing settings controls
$this->rankAllowed= $sitemember->rank;
$this->publicAllowed= 1;
$this->statusAllowed= "new,posted,hidden,deleted";

// why is this here???
if ($this->orderby!= "") {
	// do nothing
	}
elseif ($getvars[orderby]!="") {
if ($getvars[direction]!="") $direction= strtoupper(addslashes($getvars[direction]));
	$orderby= strtoupper(addslashes($getvars[orderby]));
	$this->orderby= "ORDER BY obj.$orderby $direction";
	}
else $this->orderby= "ORDER BY obj.id ASC";
if ($getvars[limit]!="") {
	$offset= strtoupper(addslashes($getvars[offset]));
	$limit= strtoupper(addslashes($getvars[limit]));
	if ($offset!="") $this->limit= "LIMIT $offset, $limit ";
	else $this->limit= "LIMIT $limit ";
	}
else $this->limit= "LIMIT 30 ";

%%addons%%
$this->canAddChild=1;
$this->canSave[document]=1;
$this->canSave[image]=1;
$this->canSave[audio]=1;
$this->canSave[video]=1;
$this->canSave[comment]=1;
$this->canSave[sitemember]=1;
$this->canSave[member]=1;
$this->canSave[event]=1;
$this->canSave[sequence]=1;
$this->canSave[uplink]=1;
$this->canSave[subscription]=1;

%%end of policy%%
