diff --git a/inc/html.php b/inc/html.php index 7a9f839bcfd43cff0fd5ad045985825c57990d6e..eb4f2670dd34f99eaf96823e7f9ca250d3d7f88e 100644 --- a/inc/html.php +++ b/inc/html.php @@ -757,7 +757,7 @@ function html_revisions($first=0, $media_id = false){ * @param int $first * @param string $show_changes */ -function html_recent($first=0, $show_changes='both'){ +function html_recent($first = 0, $show_changes = 'both') { global $conf; global $lang; global $ID; @@ -766,29 +766,29 @@ function html_recent($first=0, $show_changes='both'){ * This is the cheapest solution to get this information. */ $flags = 0; - if ($show_changes == 'mediafiles' && $conf['mediarevisions']) { + if($show_changes == 'mediafiles' && $conf['mediarevisions']) { $flags = RECENTS_MEDIA_CHANGES; - } elseif ($show_changes == 'pages') { + } elseif($show_changes == 'pages') { $flags = 0; - } elseif ($conf['mediarevisions']) { + } elseif($conf['mediarevisions']) { $show_changes = 'both'; $flags = RECENTS_MEDIA_PAGES_MIXED; } - $recents = getRecents($first,$conf['recent'] + 1,getNS($ID),$flags); - if(count($recents) == 0 && $first != 0){ - $first=0; - $recents = getRecents($first,$conf['recent'] + 1,getNS($ID),$flags); + $recents = getRecents($first, $conf['recent'] + 1, getNS($ID), $flags); + if(count($recents) == 0 && $first != 0) { + $first = 0; + $recents = getRecents($first, $conf['recent'] + 1, getNS($ID), $flags); } $hasNext = false; - if (count($recents)>$conf['recent']) { + if(count($recents) > $conf['recent']) { $hasNext = true; array_pop($recents); // remove extra log entry } print p_locale_xhtml('recent'); - if (getNS($ID) != '') { + if(getNS($ID) != '') { print '<div class="level1"><p>' . sprintf($lang['recent_global'], getNS($ID), wl('', 'do=recent')) . '</p></div>'; } @@ -797,18 +797,19 @@ function html_recent($first=0, $show_changes='both'){ $form->addHidden('do', 'recent'); $form->addHidden('id', $ID); - if ($conf['mediarevisions']) { + if($conf['mediarevisions']) { $form->addElement('<div class="changeType">'); $form->addElement(form_makeListboxField( 'show_changes', array( 'pages' => $lang['pages_changes'], 'mediafiles' => $lang['media_changes'], - 'both' => $lang['both_changes']), + 'both' => $lang['both_changes'] + ), $show_changes, $lang['changes_type'], - '','', - array('class'=>'quickselect'))); + '', '', + array('class' => 'quickselect'))); $form->addElement(form_makeButton('submit', 'recent', $lang['btn_apply'])); $form->addElement('</div>'); @@ -826,11 +827,11 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement(form_makeOpenTag('li', array('class' => $class))); $form->addElement(form_makeOpenTag('div', array('class' => 'li'))); - if (!empty($recent['media'])) { + if(!empty($recent['media'])) { $form->addElement(media_printicon($recent['id'])); } else { - $icon = DOKU_BASE.'lib/images/fileicons/file.png'; - $form->addElement('<img src="'.$icon.'" alt="'.$recent['id'].'" class="icon" />'); + $icon = DOKU_BASE . 'lib/images/fileicons/file.png'; + $form->addElement('<img src="' . $icon . '" alt="' . $recent['id'] . '" class="icon" />'); } $form->addElement(form_makeOpenTag('span', array('class' => 'date'))); @@ -840,76 +841,76 @@ function html_recent($first=0, $show_changes='both'){ $diff = false; $href = ''; - if (!empty($recent['media'])) { + if(!empty($recent['media'])) { $changelog = new MediaChangeLog($recent['id']); $revs = $changelog->getRevisions(0, 1); $diff = (count($revs) && file_exists(mediaFN($recent['id']))); - if ($diff) { + if($diff) { $href = media_managerURL(array( - 'tab_details' => 'history', - 'mediado' => 'diff', - 'image' => $recent['id'], - 'ns' => getNS($recent['id']) - ), '&'); + 'tab_details' => 'history', + 'mediado' => 'diff', + 'image' => $recent['id'], + 'ns' => getNS($recent['id']) + ), '&'); } } else { - $href = wl($recent['id'],"do=diff", false, '&'); + $href = wl($recent['id'], "do=diff", false, '&'); } - if (!empty($recent['media']) && !$diff) { - $form->addElement('<img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" />'); + if(!empty($recent['media']) && !$diff) { + $form->addElement('<img src="' . DOKU_BASE . 'lib/images/blank.gif" width="15" height="11" alt="" />'); } else { $form->addElement(form_makeOpenTag('a', array('class' => 'diff_link', 'href' => $href))); $form->addElement(form_makeTag('img', array( - 'src' => DOKU_BASE.'lib/images/diff.png', - 'width' => 15, - 'height'=> 11, - 'title' => $lang['diff'], - 'alt' => $lang['diff'] - ))); + 'src' => DOKU_BASE . 'lib/images/diff.png', + 'width' => 15, + 'height' => 11, + 'title' => $lang['diff'], + 'alt' => $lang['diff'] + ))); $form->addElement(form_makeCloseTag('a')); } - if (!empty($recent['media'])) { + if(!empty($recent['media'])) { $href = media_managerURL(array('tab_details' => 'history', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); } else { - $href = wl($recent['id'],"do=revisions",false,'&'); + $href = wl($recent['id'], "do=revisions", false, '&'); } $form->addElement(form_makeOpenTag('a', array( 'class' => 'revisions_link', - 'href' => $href))); + 'href' => $href))); $form->addElement(form_makeTag('img', array( - 'src' => DOKU_BASE.'lib/images/history.png', - 'width' => 12, - 'height'=> 14, - 'title' => $lang['btn_revs'], - 'alt' => $lang['btn_revs'] - ))); + 'src' => DOKU_BASE . 'lib/images/history.png', + 'width' => 12, + 'height' => 14, + 'title' => $lang['btn_revs'], + 'alt' => $lang['btn_revs'] + ))); $form->addElement(form_makeCloseTag('a')); - if (!empty($recent['media'])) { + if(!empty($recent['media'])) { $href = media_managerURL(array('tab_details' => 'view', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); $class = file_exists(mediaFN($recent['id'])) ? 'wikilink1' : 'wikilink2'; $form->addElement(form_makeOpenTag('a', array( 'class' => $class, - 'href' => $href))); + 'href' => $href))); $form->addElement($recent['id']); $form->addElement(form_makeCloseTag('a')); } else { $form->addElement(html_wikilink(':' . $recent['id'], useHeading('navigation') ? null : $recent['id'])); } $form->addElement(form_makeOpenTag('span', array('class' => 'sum'))); - $form->addElement(' – '.htmlspecialchars($recent['sum'])); + $form->addElement(' – ' . htmlspecialchars($recent['sum'])); $form->addElement(form_makeCloseTag('span')); $form->addElement(form_makeOpenTag('span', array('class' => 'user'))); - if($recent['user']){ - $form->addElement('<bdi>'.editorinfo($recent['user']).'</bdi>'); - if(auth_ismanager()){ - $form->addElement(' <bdo dir="ltr">('.$recent['ip'].')</bdo>'); + if($recent['user']) { + $form->addElement('<bdi>' . editorinfo($recent['user']) . '</bdi>'); + if(auth_ismanager()) { + $form->addElement(' <bdo dir="ltr">(' . $recent['ip'] . ')</bdo>'); } - }else{ - $form->addElement('<bdo dir="ltr">'.$recent['ip'].'</bdo>'); + } else { + $form->addElement('<bdo dir="ltr">' . $recent['ip'] . '</bdo>'); } $form->addElement(form_makeCloseTag('span')); @@ -920,30 +921,30 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav'))); $last = $first + $conf['recent']; - if ($first > 0) { + if($first > 0) { $first -= $conf['recent']; - if ($first < 0) $first = 0; + if($first < 0) $first = 0; $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-prev'))); $form->addElement(form_makeOpenTag('button', array( - 'type' => 'submit', - 'name' => 'first['.$first.']', - 'accesskey' => 'n', - 'title' => $lang['btn_newer'].' [N]', - 'class' => 'button show' + 'type' => 'submit', + 'name' => 'first[' . $first . ']', + 'accesskey' => 'n', + 'title' => $lang['btn_newer'] . ' [N]', + 'class' => 'button show' ))); $form->addElement($lang['btn_newer']); $form->addElement(form_makeCloseTag('button')); $form->addElement(form_makeCloseTag('div')); } - if ($hasNext) { + if($hasNext) { $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-next'))); $form->addElement(form_makeOpenTag('button', array( - 'type' => 'submit', - 'name' => 'first['.$last.']', + 'type' => 'submit', + 'name' => 'first[' . $last . ']', 'accesskey' => 'p', - 'title' => $lang['btn_older'].' [P]', - 'class' => 'button show' - ))); + 'title' => $lang['btn_older'] . ' [P]', + 'class' => 'button show' + ))); $form->addElement($lang['btn_older']); $form->addElement(form_makeCloseTag('button')); $form->addElement(form_makeCloseTag('div'));