function approvePhoto()
 {
     $session = Session::singletone();
     $db = Database::singletone()->db();
     $pid = Utils::pg("pid", 0);
     $this->_query->appendChild($this->_dom->createElement("photo-id", $pid));
     if ($pid <= 0) {
         $this->error("bad-arguments");
         return;
     }
     if (!$session->checkPerm("approve-photos")) {
         $this->error("permission-denied");
         return;
     }
     $photo = new Photo($pid);
     $photo->approve();
     $this->success();
 }
		$photo_approved = $_POST['photo_approved'];

		$photo->_dbo->photo_title = $photo_title;
		$photo->_dbo->photo_description = $photo_description;
		$photo->_cids = array();
		if (!empty($_POST['photo_cids']))
			$photo->_cids = $_POST['photo_cids'];

		$approve = false;
		if (empty($photo->_dbo->photo_approved) && Permissions::checkPerm("approve_photos") && $photo_approved) {
			$approve = true;
		}

		$photo->update();
		if ($approve)
			$photo->approve();

		if (!empty($ref))
			header("Location: " . $ref);

		$pane = new HTML_MessagePane("upd", "Zdjêcie zapisane", "", "a_ok_pane", "a_ok_pane_hdr");
		$pane->show();

	} catch (Exception2 $e) {
		$pane = new HTML_MessagePane("upd", $e->getMessage(), $e->getDescription(), "a_fail_pane", "a_fail_pane_hdr");
		$pane->show();
	}
}

function fill_category_tree($field, $ccid, $level) {
	global $db;