public function on_collaboration_invite($pars) { try { if ('' == $pars['url'] && isset($pars['content'])) { // resource not in the project tree $content = $pars['content']; } else { $content = AmyRemoteProject::load_resource($pars['url'], $pars['ticket'], $pars['path']); } if (false === ($row = Db::find_first("SELECT * FROM amy.coll_create(" . $this->user->userId . ", '" . Db::quote_literal($pars['url']) . "', '" . Db::quote_literal($pars['path']) . "', '" . Db::quote_literal($content) . "', '" . Db::quote_literal($pars['email']) . "', '" . Db::quote_literal($pars['permission']) . "', '" . Db::quote_literal($pars['message']) . "', '3:00:00')"))) { self::raiseError('Unable to invite: ' . Db::last_error()); } $mail = new Mail($this->user->credentials['email'], $pars['email']); $body = <<<BODY Hello, {$this->user->credentials['nickname']} has invited you to collaborate on the document `{$pars['path']}' via the Amy Editor. ---------------------------- {$pars['message']} ---------------------------- You can either visit the link http://www.april-child.com/amy/amy.php?invitation_code={$row['invitation_hash']} or (if you have already Amy Editor open) go to the File > Collaboration > Accept ... menu and enter the code: {$row['invitation_hash']} Cheers, Amy Editor. BODY; $mail->send('Amy Editor - Invitation to collaboration on ' . $pars['path'], $body); self::setResult($row); } catch (Exception $e) { self::raiseError($e->getMessage()); } }
public function on_project_save_resource($pars = array()) { try { self::setResult(AmyRemoteProject::save_resource($pars['url'], $pars['ticket'], $pars['path'], $pars['content'])); } catch (Exception $e) { $err_msg = $e->getMessage(); self::raiseError("Project resource at `{$pars['path']}' could not been saved due an error: `{$err_msg}'."); } }