Wiki source for UnCategoryAction


Show raw source

=====Uncategory Actions=====

**actions/uncategory.php**
%%(php)
<?php
/**
* Display pages without category of the wiki.
*
* This action checks user write privileges and displays without categories pages.
*
* @package Actions
* @name uncategory
*
* @author {@link http://decipher.blackhole.cl/ Rodrigo Ramirez Norambuena}
*
* @output a list of pages without category
*
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
*
*/


define('PAGE_HEADING',"Uncategory Pages");
define('TEXT_CAPTION',"This is a list of pages without category on the wiki so that your can categorized");

if ($cattag = $_REQUEST["wakka"])
{
$tmp_sql_like = "";
$str = "";

if (!isset($col)) $col=1;
if (!isset($compact)) $compact=0;
if (!isset($page)) $page=$this->getPageTag();
$tag = $this->getPageTag();

$categorys = $this->LoadAll("select tag from ".$this->config["table_prefix"]."pages where latest = 'Y' and body like '%{{category%'");

foreach ($categorys as $i)
{
$tmp_sql_like .= " and body not like '%" . $i['tag'] . "%'";
}

$results = $this->LoadAll("select tag from ".$this->config["table_prefix"]."pages where latest = 'Y' and tag !='" .$tag. "' " .$tmp_sql_like);

if ($results)
{
if (!$compact) $str .= ' pages: <br /><table '.$class.' width="100%"><tr>';
else $str .= '<div '.$class.'><ul>';

$count = 0;
$pagecount = 0;
$list = array();

echo $this->Format('====' . PAGE_HEADING . '==== --- <<'. TEXT_CAPTION. '--- << ::c:: ---');

foreach ($results as $i => $cpage)
// check page distint current page and user write privileges
if($cpage['tag'] != $page && $this->HasAccess('write', $cpage['tag']))
{
array_push($list,$cpage['tag']);
}

sort($list);

while (list($key, $val) = each($list)) {
if ($count == $col & !$compact) { $str .= "</tr><tr>"; $count=0; }
if (!$compact) $str .= '<td>'.$this->Format('[['.$val.']]'). '</td>' ."\n" ;
else $str .= '<li>'.$this->Format('[['.$val.' | '.preg_replace( "/Category/", "",$val).']]').'</li>' ;
$count++;
$pagecount++;
}

$str = 'The following '.$pagecount.$str;
if (!$compact) $str .= '</tr></table>'; else $str .= '</ul></div>';
}
else $str = 'Not exists pages without category to be written or modify';

if ($count==0){
$str = 'Not exists pages without category to be written or modify';
}
print($str);
}
?>%%


----
CategoryUserContributions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki