function addApproval()
 {
     global $USERINFO;
     global $ID;
     global $INFO;
     if (!$INFO['exists']) {
         msg($this->getLang('cannot approve a non-existing revision'), -1);
         return;
     }
     $approvalRevision = $this->helper->getRevision();
     $approvals = $this->helper->getApprovals();
     if (!isset($approvals[$approvalRevision])) {
         $approvals[$approvalRevision] = array();
     }
     $approvals[$approvalRevision][$INFO['client']] = array($INFO['client'], $_SERVER['REMOTE_USER'], $USERINFO['mail'], time());
     $success = p_set_metadata($ID, array('approval' => $approvals), true, true);
     if ($success) {
         msg($this->getLang('version approved'), 1);
         $data = array();
         $data['rev'] = $approvalRevision;
         $data['id'] = $ID;
         $data['approver'] = $_SERVER['REMOTE_USER'];
         $data['approver_info'] = $USERINFO;
         if ($this->getConf('send_mail_on_approve') && $this->helper->isRevisionApproved($approvalRevision)) {
             /** @var action_plugin_publish_mail $mail */
             $mail = plugin_load('action', 'publish_mail');
             $mail->send_approve_mail();
         }
         trigger_event('PLUGIN_PUBLISH_APPROVE', $data);
     } else {
         msg($this->getLang('cannot approve error'), -1);
     }
     send_redirect(wl($ID, array('rev' => $this->helper->getRevision()), true, '&'));
 }