Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
BSteelooper committed Apr 11, 2018
1 parent d64a197 commit 636606c
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 0 deletions.
114 changes: 114 additions & 0 deletions guestbook.admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?php
//This is a module for pluck, an opensource content management system
//Website: http://www.pluck-cms.org

//MODULE NAME: Linklist
//LICENSE: MIT

//Make sure the file isn't accessed directly
defined('IN_PLUCK') or exit('Access denied!');

function guestbook_pages_admin() {
global $lang;

$module_page_admin[] = array(
'func' => 'Main',
'title' => $lang['guestbook']['main']
);
$module_page_admin[] = array(
'func' => 'activate',
'title' => $lang['guestbook']['adminpage']
);

return $module_page_admin;
}

function guestbook_page_admin_Main() {
global $lang;

showmenudiv($lang['guestbook']['adminpage'],$lang['guestbook']['adminpage'],'data/image/note.png','admin.php?module=guestbook&amp;page=activate',false);

if (!file_exists('data/settings/modules/guestbook')) {
mkdir('data/settings/modules/guestbook', 0775, true);
}

if (!file_exists('data/settings/modules/guestbook/new')) {
mkdir('data/settings/modules/guestbook/new', 0775, true);
}

if (isset($_GET['delete'])) {
unlink ('data/settings/modules/guestbook/'.$_GET['delete']);
echo $file . $lang['guestbook']['deleted'];
redirect ('?module=guestbook','0');
}

$dir = opendir('data/settings/modules/guestbook/');
while (false !== ($file = readdir($dir))) {
if(($file !== ".") and ($file !== "..") and ($file != "new")) {
include ('data/settings/modules/guestbook/'.$file);
echo '
<div class="menudiv" style="margin: 10px;">
<table width="100%">
<tr>
<td width="20"><img src="data/image/website_small.png"></td>
<td>
<span>'.$entrytitle.'</a></span><br/>
<p>'.$email.'</p>
<p>'.$entry.'</p>
</td>
<td align="right">
<a href="?module=guestbook&delete='.$file.'"><img src="data/image/trash_small.png" border="0" title="'.$lang['guestbook']['delete'].'" alt="'.$lang['guestbook']['delete'].'"></a>
</td>
</tr>
</table>
</div>';

}
}

}

function guestbook_page_admin_activate(){
global $lang;
showmenudiv($lang['guestbook']['backlink'],false,'data/image/restore.png','?module=guestbook',false);

$dir = opendir('data/settings/modules/guestbook/new/');
while (false !== ($file = readdir($dir))) {
if(($file !== ".") and ($file !== "..")) {
include ('data/settings/modules/guestbook/new/'.$file);
echo '
<div class="menudiv" style="margin: 10px;">
<table width="100%">
<tr>
<td width="20"><img src="data/image/website_small.png"></td>
<td>
<span>'.$entrytitle.'</a></span><br/>
<p>'.$email.'</p>
<p>'.$entry.'</p>
</td>
<td align="right">
<a href="?module=guestbook&page=activate&activate='.$file.'"><img src="data/image/add_small.png" border="0" title='.$lang['guestbook']['activate'].'" alt="'.$lang['linklist']['activate'].'"></a>
<a href="?module=guestbook&page=activate&delete='.$file.'"><img src="data/image/trash_small.png" border="0" title="'.$lang['guestbook']['delete'].'" alt="'.$lang['linklist']['delete'].'"></a>
</td>
</tr>
</table>
</div>';
}
}

if (isset($_GET['delete'])) {
unlink ('data/settings/modules/guestbook/new/' . $_GET['delete']);
echo $file . $lang['guestbook']['deleted'];
redirect('?module=guestbook','0');
}

if (isset($_GET['activate'])) {
copy('data/settings/modules/guestbook/new/'.$_GET['activate'],'data/settings/modules/guestbook/'.$_GET['activate']);
unlink ('data/settings/modules/guestbook/new/'.$_GET['activate']);
redirect('?module=guestbook&amp;page=activate','0');
}

}


?>
24 changes: 24 additions & 0 deletions guestbook.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
//This is a module for pluck, an opensource content management system
//Website: http://www.pluck-cms.org

//LICENSE: MIT

//Make sure the file isn't accessed directly
defined('IN_PLUCK') or exit('Access denied!');

function guestbook_info() {
global $lang;
$module_info = array(
'name' => $lang['guestbook']['name'],
'intro' => $lang['guestbook']['intro'],
'version' => '0.1',
'author' => $lang['guestbook']['author'],
'website' => 'http://xobit.nl',
'icon' => 'images/icon.png',
'compatibility' => '4.7'
);
return $module_info;
}

?>
111 changes: 111 additions & 0 deletions guestbook.site.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?php
//This is a module for pluck, an opensource content management system
//Website: http://www.pluck-cms.org

//Make sure the file isn't accessed directly.
defined('IN_PLUCK') or exit('Access denied!');

//Include language-items

function guestbook_pages_site() {
global $lang;

$module_page_admin[] = array(
'func' => 'Main',
'title' => $lang['guestbook']['main']
);
$module_page_admin[] = array(
'func' => 'newentry',
'title' => $lang['guestbook']['newentry']
);

return $module_page_admin;
}

function guestbook_theme_Main() {
global $lang;

if (!file_exists('data/settings/modules/guestbook')) {
mkdir('data/settings/modules/guestbook', 0775, true);
}

if (!file_exists('data/settings/modules/guestbook/new')) {
mkdir('data/settings/modules/guestbook/new', 0775, true);
}
echo "<br/><br/>";
$dir = opendir('data/settings/modules/guestbook');
while (false !== ($file = readdir($dir))) {
if(($file !== ".") and ($file !== "..") and ($file !== "new")) {
include ('data/settings/modules/guestbook/'.$file);
echo '<h2>'.$entrytitle.'</h2><div>'.$entry.'<br/></div>';
}
}

echo '<br/><a href="'.SITE_URL.'/'.PAGE_URL_PREFIX.CURRENT_PAGE_SEONAME.'&amp;module=guestbook&amp;page=newentry">' . $lang['guestbook']['newentry'] . '</a>';

}

function guestbook_page_site_newentry(){
global $lang;
?>
<div>
<form method="post" action="" style="margin-top: 5px; margin-bottom: 15px;">
<?php echo $lang['guestbook']['title']; ?> <br /><input name="title" type="text" value="" /><br />
<?php echo $lang['guestbook']['email']; ?> <br /><input name="email" type="text" value="" /><br />
<?php echo $lang['guestbook']['descr']; ?> <br /><textarea name="description" rows="7" cols="45" class="mceNoEditor"></textarea><br />
<input type="submit" name="Submit" value="<?php echo $lang['guestbook']['send']; ?>" />
</form>
</div>

<?php

if(isset($_POST['Submit'])) {

//Check if everything has been filled in
if((!isset($_POST['title'])) || (!isset($_POST['email'])) || (!isset($_POST['description']))) { ?>
<span style="color: red;"><?php echo $lang['guestbook']['fillall']; ?></span>
<?php
// exit;
}
else {
//Then fetch our posted variables
$title = $_POST['title'];
$email = $_POST['email'];
$description = $_POST['description'];

//Check for HTML, and eventually block it
if ((ereg('<', $title)) || (ereg('>', $title)) || (ereg('<', $email)) || (ereg('>', $email)) || (ereg('<', $description)) || (ereg('>', $description))) { ?>
<span style="color: red;"><?php echo $lang['guestbook']['nohtml']; ?></span>
<?php }
else {

$description=str_replace("\n", '<br \>', $description);

$file=str_replace(" ", "_", $title);
$file=date ("dmY"). '-' . $file;

$fp = fopen ('data/settings/modules/guestbook/new/' . $file . '.php',"w");
fputs ($fp, '<?php'."\n"
.'$entrytitle = "'.$title.'";'."\n"
.'$email = "'.$email.'";'."\n"
.'$entry = "'.$description.'";'."\n"
.'');
fclose ($fp);

$message = $lang['guestbook']['mail']."<br><br>".
$lang['guestbook']['mail_tit'].'<br><b>'.$title."</b><br>".
$lang['guestbook']['mail_dis'].'<br>'.$description."<br>".
$lang['guestbook']['mail_email'].'<br>'.$email.'<br>';

mail ($site_email,$lang['guestbook']['msubject'],$message,"From: ".$email." \n" . "Content-type: text/html; charset=utf-8");

echo $lang['guestbook']['wsend'];

}
}
}

}


?>
Binary file added images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions lang/en.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
$lang['guestbook']['name'] = "guestbook";
$lang['guestbook']['intro'] = "Module to create a guestbook with userentries.";
$lang['guestbook']['author'] = 'Bas Steelooper';
$lang['guestbook']['main'] = "guestbook module";
$lang['guestbook']['pagessite'] = "Create new entry";
$lang['guestbook']['adminpage'] = "Activate entry";
$lang['guestbook']['newentry'] = "Create New entry";
$lang['guestbook']['title'] = "Entrytitle";
$lang['guestbook']['email'] = "Email address";
$lang['guestbook']['descr'] = "Sitedescription";
$lang['guestbook']['send'] = "Send entry";
$lang['guestbook']['fillall'] = "You didn't fill all fields.";
$lang['guestbook']['nohtml'] = "HTML-Tags in entries are not allowed";
$lang['guestbook']['activate'] = "Activate entry";
$lang['guestbook']['delete'] = "Delete entry";
$lang['guestbook']['deleted'] = " was deleted from system.";
$lang['guestbook']['backlink'] = "Back to main page";
$lang['guestbook']['wsend'] = "Your entry was send to the administration console.";
$lang['guestbook']['msubject'] = "New entry to guestbook";
$lang['guestbook']['mail'] = "A New entry was send to your page:";
$lang['guestbook']['mail_tit'] = "Entrytitle:";
$lang['guestbook']['mail_dis'] = "Description:";
$lang['guestbook']['mail_email']= "Email address:";
$lang['guestbook']['exhead'] = "Disclaimer";
$lang['guestbook']['exredir'] = "You will be redirected to";
$lang['guestbook']['adminset'] = "Settings for your guestbook";
$lang['guestbook']['pageis'] = "Disclaimer Page";
$lang['guestbook']['settings'] = "Settings";
$lang['guestbook']['save'] = "Save Settings";
$lang['guestbook']['distext'] = "Enter your Disclaimertext here"
?>

0 comments on commit 636606c

Please sign in to comment.