Ejemplo n.º 1
0
 function handle_recent(Doku_Event &$event, $param)
 {
     if (!$this->hlp->isActive()) {
         return;
     }
     $render = $event->data->_content;
     $parent = null;
     foreach ($render as $id => $element) {
         if ($this->isParentTag($element)) {
             $parent = $id;
             continue;
         }
         if ($parent === null) {
             continue;
         }
         $id = $this->getPageId($element);
         if (!$id) {
             continue;
         }
         if ($this->hlp->isCurrentRevisionApproved($id)) {
             $event->data->_content[$parent]['class'] .= ' approved_revision';
         } else {
             $event->data->_content[$parent]['class'] .= ' unapproved_revision';
         }
         $parent = null;
     }
     return true;
 }
Ejemplo n.º 2
0
 function handle_start(&$event, $param)
 {
     global $ACT;
     global $REV;
     global $INFO;
     global $ID;
     if ($ACT !== 'show') {
         return;
     }
     if ($REV != '') {
         return;
     }
     if ($INFO['perm'] != AUTH_READ) {
         return;
     }
     global $_GET;
     if ($_GET['force_rev']) {
         return;
     }
     if (!$this->hlp->isActive()) {
         return;
     }
     if (!$this->hlp->isCurrentRevisionApproved()) {
         $latestApproved = $this->hlp->getLatestApprovedRevision();
         if ($latestApproved) {
             $REV = $latestApproved;
             $INFO['rev'] = $latestApproved;
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * search callback function
  *
  * filter out pages which can't be approved by the current user
  * then check if they need approving
  */
 function _search_helper(&$data, $base, $file, $type, $lvl, $opts)
 {
     $ns = $opts[0];
     $valid_ns = $opts[1];
     $invalid_ns = $opts[2];
     if ($type == 'd') {
         return $this->hlp->in_sub_namespace($valid_ns, $ns . ':' . str_replace('/', ':', $file));
     }
     if (!preg_match('#\\.txt$#', $file)) {
         return false;
     }
     $id = pathID($ns . $file);
     if (!$this->hlp->in_namespace($valid_ns, $id)) {
         return false;
     }
     if ($this->hlp->in_namespace($invalid_ns, $id)) {
         return false;
     }
     if (auth_quickaclcheck($id) < AUTH_DELETE) {
         return false;
     }
     $meta = $this->hlp->getMeta($id);
     if ($this->hlp->isCurrentRevisionApproved($id)) {
         // Already approved
         return false;
     }
     $data[] = array($id, $meta['approval'], $meta['last_change']['date']);
     return false;
 }
Ejemplo n.º 4
0
 function showApproved()
 {
     if (!$this->hlp->isCurrentRevisionApproved()) {
         return;
     }
     echo '<span class="approval_approved">';
     printf($this->getLang('apr_approved'), '<span class="approval_date">' . dformat($this->hlp->getApprovalDate()) . '</span>', implode(', ', $this->hlp->getApprovers()));
     echo '</span>';
 }