Initial checkin
This commit is contained in:
commit
d75eb444fc
4304 changed files with 369634 additions and 0 deletions
69
modules/news/news.module.php
Normal file
69
modules/news/news.module.php
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
class module_news extends admin_module{
|
||||
|
||||
function admin_panels(){
|
||||
$panels=array(array("add_news","News schreiben","newspaper_add"),array("edit_news","News editieren","newspaper_go"),array("group_only","Newskategorien"),array("addcategory_news","Newskategorie hinzufügen","tag_blue_add"),array("editcategory_news","Newskategorie editieren","tag_blue_edit"));
|
||||
return $panels;
|
||||
}
|
||||
|
||||
function get_info(){
|
||||
$info["name"]="Newsmodul";
|
||||
$info["file"]="news";
|
||||
$info["author"]="astat";
|
||||
$info["version"]="1.0.0";
|
||||
$info["url"]="http://www.astat.org";
|
||||
return $info;
|
||||
}
|
||||
|
||||
function install(){
|
||||
global $config, $db;
|
||||
$db->query("CREATE TABLE `" . $config['prefix'] . "news` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`title` varchar(60) NOT NULL default '',
|
||||
`text` text NOT NULL,
|
||||
`author` int(11) NOT NULL default '0',
|
||||
`date` int(11) NOT NULL default '0',
|
||||
`category` mediumint(9) NOT NULL default '0',
|
||||
`active` enum('false','true') NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM");
|
||||
|
||||
$db->query("CREATE TABLE `" . $config['prefix'] . "news_category` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`name` varchar(60) NOT NULL default '',
|
||||
`picture` varchar(60) NOT NULL,
|
||||
`active` enum('false','true') NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM");
|
||||
|
||||
|
||||
mkdir ($_SERVER["DOCUMENT_ROOT"] . $config['path']."/newsimages", 0777);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function uninstall(){
|
||||
global $config, $db;
|
||||
$db->query("DELETE FROM `" . $config["prefix"] . "navigation` WHERE file='frontpage_news'");
|
||||
$db->query("DROP TABLE `" . $config["prefix"] . "news`");
|
||||
$db->query("DROP TABLE `" . $config["prefix"] . "news_category`");
|
||||
@$this->recursive($_SERVER["DOCUMENT_ROOT"]. $config['path']."/newsimages");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function recursive($dest){
|
||||
$list = array_diff(scandir($dest), array('.', '..'));
|
||||
foreach ($list as $value) {
|
||||
$file = $dest.'/'.$value;
|
||||
if (is_dir($file)) {
|
||||
recursive($file);
|
||||
}else{
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
return rmdir($dest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue