wiki
[ class tree: wiki ] [ index: wiki ] [ all elements ]

Source for file orphan_pages.php

Documentation is available at orphan_pages.php

  1. <?php
  2. /**
  3.  * @package wiki
  4.  * @subpackage functions
  5.  */
  6.  
  7. /**
  8.  * required setup
  9.  */
  10. require_once'../kernel/setup_inc.php' );
  11. include_onceWIKI_PKG_PATH.'BitPage.php' );
  12.  
  13. // verify stuff
  14. $gBitSystem->verifyPackage'wiki' );
  15.  
  16. $gBitSystem->verifyFeature'wiki_list_orphans' );
  17. $gContent new BitPage();
  18. $gContent->verifyViewPermission();
  19.  
  20. /* mass-remove:
  21.    the checkboxes are sent as the array $_REQUEST["checked[]"], values are the wiki-PageNames,
  22.    e.g. $_REQUEST["checked"][3]="HomePage"
  23.    $_REQUEST["submit_mult"] holds the value of the "with selected do..."-option list
  24.    we look if any page's checkbox is on and if remove_pages is selected.
  25.    then we check permission to delete pages.
  26.    if so, we call BitPage::expunge for all the checked pages.  */
  27. ifisset$_REQUEST["batch_submit"&& isset$_REQUEST["checked"&& $_REQUEST["batch_submit"== "remove_pages" {
  28.  
  29.     // Now check permissions to remove the selected pages
  30.     $gContent->verifyUserPermission'p_wiki_remove_page' );
  31.  
  32.     if!empty$_REQUEST['cancel')) {
  33.         // user cancelled - just continue on, doing nothing
  34.     elseifempty$_REQUEST['confirm')) {
  35.         $formHash['delete'TRUE;
  36.         $formHash['batch_submit''remove_pages';
  37.         foreach$_REQUEST["checked"as $del {
  38.             $tmpPage new BitPage$del);
  39.             if$tmpPage->load(&& !empty$tmpPage->mInfo['title')) {
  40.                 $info $tmpPage->mInfo['title'];
  41.             else {
  42.                 $info $del;
  43.             }
  44.             $formHash['input']['<input type="hidden" name="checked[]" value="'.$del.'"/>'.$info;
  45.         }
  46.         $gBitSystem->confirmDialog$formHash
  47.                 array
  48.                     'warning' => tra('Are you sure you want to delete these pages?'' (' tra('Count: 'count$_REQUEST["checked"')',                
  49.                     'error' => tra('This cannot be undone!'),
  50.                 )
  51.             );
  52.     else {
  53.         foreach$_REQUEST["checked"as $deletepage {
  54.             $tmpPage new BitPage$deletepage );
  55.             if!$tmpPage->load(|| !$tmpPage->expunge() ) {
  56.                 array_merge$errorsarray_values$tmpPage->mErrors ));
  57.             }
  58.         }
  59.         if!empty$errors )) {
  60.             $gBitSmarty->assign_by_ref'errors'$errors );
  61.         }
  62.     }
  63. }
  64.  
  65. $gContent new BitPage();
  66. $gBitSmarty->assign_by_ref"gContent"$gContent );
  67.  
  68. if!empty$_REQUEST['sort_mode')) {
  69.     $listHash['sort_mode'preg_replace'/^user_/''creator_user_'$_REQUEST['sort_mode');
  70. }
  71. $listHash $_REQUEST;
  72. $listHash['extras'TRUE;
  73. $listHash['orphans_only'TRUE;
  74. $listpages $gContent->getList$listHash );
  75.  
  76. // we will probably need a better way to do this
  77. $listHash['listInfo']['parameters']['find_title']       !empty$listHash['find_title'$listHash['find_title''';
  78. $listHash['listInfo']['parameters']['find_author']      !empty$listHash['find_author'$listHash['find_author''';
  79. $listHash['listInfo']['parameters']['find_last_editor'!empty$listHash['find_last_editor'$listHash['find_last_editor''';
  80.  
  81. $gBitSmarty->assign_by_ref'listpages'$listpages );
  82. $gBitSmarty->assign_by_ref'listInfo'$listHash['listInfo');
  83.  
  84. // Display the template
  85. $gBitSystem->display'bitpackage:wiki/orphan_pages.tpl'tra'Orphan Pages' )array'display_mode' => 'list' ));
  86. ?>

Documentation generated on Wed, 29 Jul 2015 13:57:14 +0000 by phpDocumentor 1.5.0-lsces