mirror of
https://github.com/e107inc/e107.git
synced 2025-08-07 07:06:30 +02:00
new module creation
This commit is contained in:
204
e107_plugins/featurebox/admin_config.php
Normal file
204
e107_plugins/featurebox/admin_config.php
Normal file
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/admin_config.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:10 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
require_once("../../class2.php");
|
||||
if (!getperms("P")) {
|
||||
header("location:".e_BASE."index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once(e_ADMIN."auth.php");
|
||||
require_once(e_HANDLER."userclass_class.php");
|
||||
require_once(e_HANDLER."file_class.php");
|
||||
$fl = new e_file;
|
||||
$rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$',"thumb_", 'index', 'null*');
|
||||
$templatelist = $fl->get_files(e_PLUGIN."featurebox/templates/","",$rejecthumb);
|
||||
|
||||
if (e_QUERY) {
|
||||
list($action, $id) = explode(".", e_QUERY);
|
||||
}
|
||||
else
|
||||
{
|
||||
$action = FALSE;
|
||||
$id = FALSE;
|
||||
}
|
||||
|
||||
if(isset($_POST['createFB']))
|
||||
{
|
||||
if ($_POST['fb_title'] && $_POST['fb_text']) {
|
||||
$fb_title = $tp -> toDB($_POST['fb_title']);
|
||||
$fb_text = $tp -> toDB($_POST['fb_text']);
|
||||
$fb_mode = $_POST['fb_mode'];
|
||||
$fb_class = $_POST['fb_class'];
|
||||
$fb_rendertype = $_POST['fb_rendertype'];
|
||||
$fb_template = $_POST['fb_template'];
|
||||
$sql->db_Insert("featurebox", "0, '$fb_title', '$fb_text', '$fb_mode', '$fb_class', '$fb_rendertype', '$fb_template'");
|
||||
$message = FBLAN_15;
|
||||
} else {
|
||||
$message = FBLAN_17;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST['updateFB']))
|
||||
{
|
||||
if ($_POST['fb_title'] && $_POST['fb_text']) {
|
||||
$fb_title = $tp -> toDB($_POST['fb_title']);
|
||||
$fb_text = $tp -> toDB($_POST['fb_text']);
|
||||
$fb_mode = $_POST['fb_mode'];
|
||||
$fb_class = $_POST['fb_class'];
|
||||
$fb_rendertype = $_POST['fb_rendertype'];
|
||||
$fb_template = $_POST['fb_template'];
|
||||
$sql->db_Update("featurebox", "fb_title='$fb_title', fb_text='$fb_text', fb_mode='$fb_mode', fb_class='$fb_class', fb_rendertype='$fb_rendertype', fb_template='$fb_template' WHERE fb_id=".$_POST['fb_id']);
|
||||
$message = FBLAN_16;
|
||||
} else {
|
||||
$message = FBLAN_17;
|
||||
}
|
||||
}
|
||||
|
||||
if($action == "delete") {
|
||||
$sql->db_Delete("featurebox", "fb_id=$id");
|
||||
$message = FBLAN_18;
|
||||
}
|
||||
|
||||
if (isset($message)) {
|
||||
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
|
||||
}
|
||||
|
||||
|
||||
if($headline_total = $sql->db_Select("featurebox "))
|
||||
{
|
||||
$nfArray = $sql -> db_getList();
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
<table class='fborder' style='".ADMIN_WIDTH.";'>
|
||||
<tr>
|
||||
<td class='forumheader' style='width: 5%; text-align: center;'>ID</td>
|
||||
<td class='forumheader' style='width: 50%;'>".FBLAN_07."</td>
|
||||
<td class='forumheader' style='width: 10%; text-align: center;'>".FBLAN_19."</td>
|
||||
</tr>\n";
|
||||
|
||||
foreach($nfArray as $entry)
|
||||
{
|
||||
$text .= "
|
||||
<tr>
|
||||
<td class='forumheader' style='width: 5%; text-align: center;'>".$entry['fb_id']."</td>
|
||||
<td class='forumheader' style='width: 50%;'>".$entry['fb_title']."</td>
|
||||
<td class='forumheader' style='width: 10%; text-align: center;'>
|
||||
<a href='".e_SELF."?edit.".$entry['fb_id']."'>".FBLAN_20."</a> - <a href='".e_SELF."?delete.".$entry['fb_id']."'>".FBLAN_21."</a>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$text .= "</table>\n</div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = FBLAN_05;
|
||||
}
|
||||
$ns->tablerender(FBLAN_06, $text);
|
||||
|
||||
if($action == "edit")
|
||||
{
|
||||
if($sql->db_Select("featurebox", "*", "fb_id=$id"))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
extract($row);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($fb_name, $fb_text, $fb_mode, $fb_class);
|
||||
}
|
||||
|
||||
$text = "<div style='text-align:center'>
|
||||
<form method='post' action='".e_SELF."'>\n
|
||||
<table style='".ADMIN_WIDTH."' class='fborder'>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".FBLAN_07."</td>
|
||||
<td style='width:50%; text-align: left;' class='forumheader3'>
|
||||
<input class='tbox' type='text' name='fb_title' style='width: 80%' value='$fb_title' maxlength='200' />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".FBLAN_08."</td>
|
||||
<td style='width:50%; text-align: left;' class='forumheader3'>
|
||||
<textarea class='tbox' name='fb_text' style='width: 90%' rows='6'>$fb_text</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".FBLAN_09."</td>
|
||||
<td style='width:50%; text-align: left;' class='forumheader3'>
|
||||
".r_userclass("fb_class", $fb_class, "public, guests, nobody, member, admin, classes")."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".FBLAN_12."</td>
|
||||
<td style='width:50%; text-align: left;' class='forumheader3'>
|
||||
<input type='radio' name='fb_mode' value='0'".(!$fb_mode ? " checked='checked'" : "")." /> ".FBLAN_13." <br />
|
||||
<input type='radio' name='fb_mode' value='1'".($fb_mode == 1 ? " checked='checked'" : "")." /> ".FBLAN_14."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".FBLAN_22."</td>
|
||||
<td style='width:50%; text-align: left;' class='forumheader3'>
|
||||
<input type='radio' name='fb_rendertype' value='0'".(!$fb_rendertype ? " checked='checked'" : "")." /> ".FBLAN_23." <br />
|
||||
<input type='radio' name='fb_rendertype' value='1'".($fb_rendertype == 1 ? " checked='checked'" : "")." /> ".FBLAN_24."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td style='width:50%' class='forumheader3'>".FBLAN_25."<br /><span class='smalltext'>".FBLAN_26."</span></td>
|
||||
<td style='width:50%; text-align: left;' class='forumheader3'>
|
||||
<select class='tbox' name='fb_template'>
|
||||
";
|
||||
|
||||
foreach($templatelist as $value)
|
||||
{
|
||||
$file = str_replace(".php", "", $value['fname']);
|
||||
$text .= "<option".($file == $fb_template ? " selected='selected'" : "").">$file</option>\n";
|
||||
}
|
||||
|
||||
$text .= "</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr style='vertical-align:top'>
|
||||
<td colspan='2' style='text-align:center' class='forumheader'>
|
||||
<input class='button' type='submit' name='".($action == "edit" ? "updateFB" : "createFB")."' value='".($action == "edit" ? FBLAN_11 : FBLAN_10)."' />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
".($action == "edit" ? "<input type='hidden' name='fb_id' value='$fb_id' />" : "")."
|
||||
</form>
|
||||
</div>";
|
||||
|
||||
$caption = ($action == "edit" ? FBLAN_11 : FBLAN_10);
|
||||
|
||||
$ns->tablerender($caption, $text);
|
||||
|
||||
require_once(e_ADMIN."footer.php");
|
||||
?>
|
43
e107_plugins/featurebox/e_rss.php
Normal file
43
e107_plugins/featurebox/e_rss.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
|
||||
|
||||
//##### create feed for admin, return array $eplug_rss_feed --------------------------------
|
||||
$feed['name'] = 'Featurebox';
|
||||
$feed['url'] = 'featurebox'; //the identifier for the rss feed url
|
||||
$feed['topic_id'] = ''; //the topic_id, empty on default (to select a certain category)
|
||||
$feed['path'] = 'featurebox'; //this is the plugin path location
|
||||
$feed['text'] = 'this is the rss feed for the featurebox entries';
|
||||
$feed['class'] = '0';
|
||||
$feed['limit'] = '9';
|
||||
$eplug_rss_feed[] = $feed;
|
||||
//##### ------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//##### create rss data, return as array $eplug_rss_data -----------------------------------
|
||||
$rss = array();
|
||||
$sqlrss = new db;
|
||||
if($items = $sqlrss -> db_Select('featurebox', "*", "fb_class = 0 DESC LIMIT 0,".$this->limit )){
|
||||
$i=0;
|
||||
while($rowrss = $sqlrss -> db_Fetch()){
|
||||
$rss[$i]['author'] = '';
|
||||
$rss[$i]['author_email'] = '';
|
||||
$rss[$i]['link'] = '';
|
||||
$rss[$i]['linkid'] = '';
|
||||
$rss[$i]['title'] = $rowrss['fb_title'];
|
||||
$rss[$i]['description'] = $rowrss['fb_text'];
|
||||
$rss[$i]['category_name'] = '';
|
||||
$rss[$i]['category_link'] = '';
|
||||
$rss[$i]['datestamp'] = '';
|
||||
$rss[$i]['enc_url'] = '';
|
||||
$rss[$i]['enc_leng'] = '';
|
||||
$rss[$i]['enc_type'] = '';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$eplug_rss_data[] = $rss;
|
||||
//##### ------------------------------------------------------------------------------------
|
||||
|
||||
?>
|
64
e107_plugins/featurebox/featurebox.php
Normal file
64
e107_plugins/featurebox/featurebox.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/featurebox.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:10 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
if($sql -> db_Select("featurebox", "*", "fb_mode=1 AND fb_class IN (".USERCLASS_LIST.") ORDER BY fb_class ASC"))
|
||||
{
|
||||
while($row = $sql->db_Fetch())
|
||||
{
|
||||
if($row['fb_class'] > 0 && $row['fb_class'] < 251)
|
||||
{
|
||||
extract($row);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$xentry = $row;
|
||||
}
|
||||
}
|
||||
if(!isset($fb_title))
|
||||
{
|
||||
extract($xentry);
|
||||
}
|
||||
}
|
||||
else if($sql -> db_Select("featurebox", "*", "fb_mode!=1 AND fb_class IN (".USERCLASS_LIST.")"))
|
||||
{
|
||||
$nfArray = $sql -> db_getList();
|
||||
$entry = $nfArray[array_rand($nfArray)];
|
||||
extract($entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$fbcc = $fb_title;
|
||||
$fb_title = $tp -> toHTML($fb_title, TRUE);
|
||||
$fb_text = $tp -> toHTML($fb_text, TRUE);
|
||||
if(!$fb_rendertype)
|
||||
{
|
||||
$ns -> tablerender($fb_title, $fb_text, 'featurebox');
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(e_PLUGIN."featurebox/templates/".$fb_template.".php");
|
||||
echo $FB_TEMPLATE;
|
||||
}
|
||||
?>
|
BIN
e107_plugins/featurebox/images/featurebox_16.png
Normal file
BIN
e107_plugins/featurebox/images/featurebox_16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 774 B |
BIN
e107_plugins/featurebox/images/featurebox_32.png
Normal file
BIN
e107_plugins/featurebox/images/featurebox_32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
47
e107_plugins/featurebox/languages/English.php
Normal file
47
e107_plugins/featurebox/languages/English.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/languages/English.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:10 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
define("FBLAN_01", "Feature Box");
|
||||
define("FBLAN_02", "This plugin allows you to display a box above your news items with features / whatever you like in it. The messages can either be revolved randomly or dynamically faded.");
|
||||
define("FBLAN_03", "Configure feature box");
|
||||
define("FBLAN_04", "Feature Box plugin has been successfully installed. To add messages and configure, return to the main admin page and click on the feature box icon in the plugin section.");
|
||||
define("FBLAN_05", "No feature box messages defined yet");
|
||||
define("FBLAN_06", "Existing Feature Box Messages");
|
||||
define("FBLAN_07", "Title / Caption");
|
||||
define("FBLAN_08", "Message text");
|
||||
define("FBLAN_09", "Visibility of message");
|
||||
define("FBLAN_10", "Create Feature Box Message");
|
||||
define("FBLAN_11", "Update Feature Box Message");
|
||||
define("FBLAN_12", "Mode");
|
||||
define("FBLAN_13", "Randomly revolve messages");
|
||||
define("FBLAN_14", "Show this message only");
|
||||
define("FBLAN_15", "Message added to database.");
|
||||
define("FBLAN_16", "Message updated in database.");
|
||||
define("FBLAN_17", "Field(s) left blank");
|
||||
define("FBLAN_18", "Feature Box Message deleted");
|
||||
define("FBLAN_19", "Options");
|
||||
define("FBLAN_20", "Edit");
|
||||
define("FBLAN_21", "Delete");
|
||||
define("FBLAN_22", "Render type");
|
||||
define("FBLAN_23", "In theme box");
|
||||
define("FBLAN_24", "Plain");
|
||||
define("FBLAN_25", "Template");
|
||||
define("FBLAN_26", "you can use a different template for each message, add templates to e107_plugins/featurebox/templates/ folder");
|
||||
|
||||
?>
|
77
e107_plugins/featurebox/plugin.php
Normal file
77
e107_plugins/featurebox/plugin.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/plugin.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:10 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
@include_once(e_PLUGIN."featurebox/languages/".e_LANGUAGE.".php");
|
||||
@include_once(e_PLUGIN."featurebox/languages/English.php");
|
||||
|
||||
// Plugin info -------------------------------------------------------------------------------------------------------
|
||||
$eplug_name = FBLAN_01;
|
||||
$eplug_version = "1.0";
|
||||
$eplug_author = "Steve Dunstan (jalist)";
|
||||
$eplug_url = "http://e107.org";
|
||||
$eplug_email = "jalist@e107.org";
|
||||
$eplug_description = FBLAN_02;
|
||||
$eplug_compatible = "e107v0.7+";
|
||||
$eplug_readme = "";
|
||||
|
||||
// Name of the plugin's folder -------------------------------------------------------------------------------------
|
||||
$eplug_folder = "featurebox";
|
||||
|
||||
// Name of menu item for plugin ----------------------------------------------------------------------------------
|
||||
$eplug_menu_name = "";
|
||||
|
||||
// Name of the admin configuration file --------------------------------------------------------------------------
|
||||
$eplug_conffile = "admin_config.php";
|
||||
|
||||
|
||||
// Icon image and caption text ------------------------------------------------------------------------------------
|
||||
$eplug_icon = $eplug_folder."/images/featurebox_32.png";
|
||||
$eplug_icon_small = $eplug_folder."/images/featurebox_16.png";
|
||||
$eplug_caption = FBLAN_03;
|
||||
|
||||
// List of preferences -----------------------------------------------------------------------------------------------
|
||||
$eplug_prefs = array("fb_active" => 1);
|
||||
|
||||
// List of table names -----------------------------------------------------------------------------------------------
|
||||
$eplug_table_names = array("featurebox");
|
||||
|
||||
// List of sql requests to create tables -----------------------------------------------------------------------------
|
||||
$eplug_tables = array(
|
||||
"CREATE TABLE ".MPREFIX."featurebox (
|
||||
fb_id int(10) unsigned NOT NULL auto_increment,
|
||||
fb_title varchar(200) NOT NULL default '',
|
||||
fb_text text NOT NULL,
|
||||
fb_mode tinyint(3) unsigned NOT NULL default '0',
|
||||
fb_class tinyint(3) unsigned NOT NULL default '0',
|
||||
fb_rendertype tinyint(1) unsigned NOT NULL default '0',
|
||||
fb_template varchar(50) NOT NULL default '',
|
||||
PRIMARY KEY (fb_id)
|
||||
) TYPE=MyISAM AUTO_INCREMENT=1 ;");
|
||||
|
||||
// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
|
||||
$eplug_link = FALSE;
|
||||
$eplug_link_name = "";
|
||||
$eplug_link_url = "";
|
||||
|
||||
// Text to display after plugin successfully installed ------------------------------------------------------------------
|
||||
$eplug_done = FBLAN_04; // "To activate please go to your menus screen and select the pm_menu into one of your menu areas.";
|
||||
|
||||
?>
|
30
e107_plugins/featurebox/templates/centered.php
Normal file
30
e107_plugins/featurebox/templates/centered.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/templates/centered.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:10 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$FB_TEMPLATE = "
|
||||
<div class='defaulttext' style='text-align: center;'><b>$fb_title</b>
|
||||
<hr />
|
||||
$fb_text
|
||||
</div>
|
||||
<br /><br />
|
||||
";
|
||||
|
||||
?>
|
28
e107_plugins/featurebox/templates/default.php
Normal file
28
e107_plugins/featurebox/templates/default.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
+ ----------------------------------------------------------------------------+
|
||||
| e107 website system
|
||||
|
|
||||
| <20>Steve Dunstan 2001-2002
|
||||
| http://e107.org
|
||||
| jalist@e107.org
|
||||
|
|
||||
| Released under the terms and conditions of the
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/featurebox/templates/default.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:35:10 $
|
||||
| $Author: mcfly_e107 $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$FB_TEMPLATE = "
|
||||
<div class='defaulttext'><b>$fb_title</b></div>
|
||||
<hr />
|
||||
$fb_text
|
||||
";
|
||||
|
||||
?>
|
Reference in New Issue
Block a user