1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-10 08:34:09 +02:00

new module creation

This commit is contained in:
mcfly
2006-12-02 04:36:16 +00:00
commit e149b35fcc
2196 changed files with 182987 additions and 0 deletions

View File

@@ -0,0 +1,186 @@
<?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/linkwords/admin_config.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:24 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
require_once("../../class2.php");
if (!getperms("P")) {
header("location:".e_BASE."index.php");
exit ;
}
require_once(e_ADMIN."auth.php");
@include_once(e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php");
@include_once(e_PLUGIN."linkwords/languages/English.php");
$deltest = array_flip($_POST);
if(isset($deltest[LWLAN_17]))
{
$delete_id = str_replace("delete_", "", $deltest[LWLAN_17]);
if ($sql->db_Count("linkwords", "(*)", "WHERE linkword_id = ".$delete_id))
{
$sql->db_Delete("linkwords", "linkword_id=".$delete_id);
$message = LWLAN_19;
}
}
if(e_QUERY)
{
list($action, $id) = explode(".", e_QUERY);
}
if (isset($_POST['submit_linkword']))
{
if(!$_POST['linkwords_word'] && $_POST['linkwords_url'])
{
$message = LWLAN_1;
}
else
{
$word = $tp -> toDB($_POST['linkword_word']);
$link = $tp -> toDB($_POST['linkword_link']);
$active = $_POST['linkword_active'];
$sql -> db_Insert("linkwords", "0, $active, '$word', '$link' ");
$message = LWLAN_2;
}
}
if (isset($_POST['update_linkword']))
{
if(!$_POST['linkwords_word'] && $_POST['linkwords_url'])
{
$message = LWLAN_1;
}
else
{
$id = $_POST['id'];
$word = $tp -> toDB($_POST['linkword_word']);
$link = $tp -> toDB($_POST['linkword_link']);
$active = $_POST['linkword_active'];
$sql -> db_Update("linkwords", "linkword_active=$active, linkword_word='$word', linkword_link='$link' WHERE linkword_id=".$id);
$message = LWLAN_3;
}
}
if (isset($message)) {
$ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
}
$text = "<div class='center'>\n";
if(!$sql -> db_Select("linkwords"))
{
$text .= LWLAN_4;
}
else
{
$text = "
<table style='".ADMIN_WIDTH."' class='fborder'>
<tr>
<td class='forumheader' style='width: 20%;'>".LWLAN_5."</td>
<td class='forumheader' style='width: 40%;'>".LWLAN_6."</td>
<td class='forumheader' style='width: 10%; text-align: center;'>".LWLAN_7."</td>
<td class='forumheader' style='width: 30%; text-align: center;'>".LWLAN_8."</td>
</tr>\n";
while($row = $sql -> db_Fetch())
{
extract($row);
$text .= "
<form action='".e_SELF."' method='post' id='myform_$linkword_id' onsubmit=\"return jsconfirm('".LWLAN_18." [ID: $linkword_id ]')\">
<tr>
<td class='forumheader' style='width: 20%;'>$linkword_word</td>
<td class='forumheader' style='width: 40%;'>$linkword_link</td>
<td class='forumheader' style='width: 10%; text-align: center;'>".(!$linkword_active ? LWLAN_12 : LWLAN_13)."</td>
<td class='forumheader' style='width: 30%; text-align: center;'>
<input class='button' type='button' onclick=\"document.location='".e_SELF."?edit.$linkword_id'\" value='Edit' id='edit_$linkword_id' name='edit_linkword_id' />
<input class='button' type='submit' value='Delete' id='delete_$linkword_id' name='delete_$linkword_id' />
</td>
</tr>
</form>\n";
}
$text .= "</table>";
}
$text .= "</div>";
$ns -> tablerender(LWLAN_11, $text);
if($action == "edit")
{
if($sql -> db_Select("linkwords", "*", "linkword_id=".$id))
{
$row = $sql -> db_Fetch();
extract($row);
define("EDIT", TRUE);
}
}
else
{
unset($linkword_word, $linkword_link, $linkword_active);
}
$text = "
<div class='center'>
<form method='post' action='".e_SELF."'>
<table style='".ADMIN_WIDTH."' class='fborder'>
<tr>
<td style='width:50%' class='forumheader3'>".LWLAN_21."</td>
<td style='width:50%' class='forumheader3'>
<input class='tbox' type='text' name='linkword_word' size='40' value='".$linkword_word."' maxlength='100' />
</td>
</tr>
<tr>
<td style='width:50%' class='forumheader3'>".LWLAN_6."</td>
<td style='width:50%' class='forumheader3'>
<input class='tbox' type='text' name='linkword_link' size='40' value='".$linkword_link."' maxlength='150' />
</td>
</tr>
<tr>
<td style='width:50%' class='forumheader3'>".LWLAN_22."</td>
<td style='width:50%; text-align:right' class='forumheader3'>
<input type='radio' name='linkword_active' value='0'".(!$linkword_active ? " checked='checked'" : "")." /> ".LWLAN_9."&nbsp;&nbsp;
<input type='radio' name='linkword_active' value='1'".($linkword_active ? " checked='checked'" : "")." /> ".LWLAN_10."
</td>
</tr>
<tr>
<td colspan='2' style='text-align:center' class='forumheader'>".
(defined("EDIT") ? "<input class='button' type='submit' name='update_linkword' value='".LWLAN_15."' /><input type='hidden' name='id' value='$id' />" : "<input class='button' type='submit' name='submit_linkword' value='".LWLAN_14."' />")."
</td>
</tr>
</table>
</form>
</div>\n";
$ns -> tablerender($caption, $text);
require_once(e_ADMIN."footer.php");
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,31 @@
<?php
define("LWLAN_1", "Field(s) left blank.");
define("LWLAN_2", "Link word saved.");
define("LWLAN_3", "Link word updated.");
define("LWLAN_4", "No link words defined yet.");
define("LWLAN_5", "Word");
define("LWLAN_6", "Link");
define("LWLAN_7", "Active?");
define("LWLAN_8", "Options");
define("LWLAN_9", "yes");
define("LWLAN_10", "no");
define("LWLAN_11", "Existing Linkwords");
define("LWLAN_12", "Yes");
define("LWLAN_13", "No");
define("LWLAN_14", "Submit LinkWord");
define("LWLAN_15", "Update LinkWord");
define("LWLAN_16", "Edit");
define("LWLAN_17", "Delete");
define("LWLAN_18", "Are you sure you want to delete this linkword?");
define("LWLAN_19", "Linkword deleted.");
define("LWLAN_20", "Unable to find that linkword entry.");
define("LWLAN_21","Word to autolink");
define("LWLAN_22","Activate?");
define("LWLANINS_1", "Linkwords");
define("LWLANINS_2", "This plugin will link specified words with a defined link");
define("LWLANINS_3", "Configure LinkWords");
define("LWLANINS_4", "To configure please click on the link in the plugins section of the admin front page");
?>

View File

@@ -0,0 +1,71 @@
<?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/linkwords/linkwords.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:24 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
class e_linkwords
{
var $linkwords = array();
var $linkhold = array(); // Placeholders in case url's contain linkwords
var $linkurls = array();
function e_linkwords()
{
/* constructor */
$sql = new db;
if($sql -> db_Select("linkwords", "*", "linkword_active=0"))
{
$linkWords = $sql -> db_getList();
$placeprefix="|*#!|"; // A highly unusual string
$iPlace = 1;
foreach($linkWords as $words)
{
$word = $words['linkword_word'];
$this -> linkwords[] = $word;
$this -> linkurls[] = " <a href='".$words['linkword_link']."' rel='external'>$word</a>";
$this -> linkhold[] = $placeprefix.$iPlace++.$placeprefix;
$word2 = substr_replace($word, strtoupper($word[0]), 0, 1);
$this -> linkwords[] = $word2;
$this -> linkhold[] = $placeprefix.$iPlace++.$placeprefix;
$this -> linkurls[] = " <a href='".$words['linkword_link']."' rel='external'>$word2</a>";
}
}
}
function linkwords($text)
{
$content = preg_split('#(<.*>)#mis', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
$ptext = "";
foreach($content as $cont)
{
if (strstr($cont, "<"))
{
$ptext .= $cont;
} else {
$cont2=str_replace($this -> linkwords, $this -> linkhold, $cont);
$cont2=str_replace($this -> linkhold, $this -> linkurls, $cont2);
$ptext .= $cont2;
}
}
return $ptext;
}
}
?>

View File

@@ -0,0 +1,7 @@
CREATE TABLE linkwords (
linkword_id INT(10) UNSIGNED NOT NULL auto_increment,
linkword_active tinyint(1) unsigned NOT NULL default '0',
linkword_word varchar(100) NOT NULL default '',
linkword_link varchar(150) NOT NULL default '',
PRIMARY KEY (linkword_id)
) TYPE=MyISAM AUTO_INCREMENT=1;

View File

@@ -0,0 +1,98 @@
<?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/linkwords/plugin.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:24 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
@include_once(e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php");
@include_once(e_PLUGIN."linkwords/languages/English.php");
// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = "LWLANINS_1";
$eplug_version = "1.0";
$eplug_author = "jalist";
$eplug_url = "http://e107.org";
$eplug_email = "jalist@e107.org";
$eplug_description = LWLANINS_2;
$eplug_compatible = "e107v7+";
$eplug_readme = "";
// leave blank if no readme file
// Name of the plugin's folder -------------------------------------------------------------------------------------
$eplug_folder = "linkwords";
// Mane 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/linkwords_32.png";
$eplug_icon_small = $eplug_folder."/images/linkwords_16.png";
$eplug_caption = LWLANINS_3;
// List of preferences -----------------------------------------------------------------------------------------------
$eplug_array_pref = array(
'tohtml_hook' => 'linkwords'
);
// List of table names -----------------------------------------------------------------------------------------------
$eplug_table_names = array(
"linkwords"
);
// List of sql requests to create tables -----------------------------------------------------------------------------
$eplug_tables = array(
"CREATE TABLE ".MPREFIX."linkwords (
linkword_id INT UNSIGNED NOT NULL auto_increment,
linkword_active tinyint(1) unsigned NOT NULL default '0',
linkword_word varchar(100) NOT NULL default '',
linkword_link varchar(150) NOT NULL default '',
PRIMARY KEY ( linkword_id )
) TYPE=MyISAM AUTO_INCREMENT=1;"
);
// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
$eplug_link = FALSE;
$eplug_link_name = "";
$ec_dir = e_PLUGIN."";
$eplug_link_url = "";
// Text to display after plugin successfully installed ------------------------------------------------------------------
$eplug_done = LWLANINS_4;
// upgrading ... //
$upgrade_add_prefs = "";
$upgrade_remove_prefs = "";
$upgrade_alter_tables = "";
$eplug_upgrade_done = "";
?>