1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 12:20:44 +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

BIN
e107_plugins/pm/images/attach.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
e107_plugins/pm/images/newpm.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
e107_plugins/pm/images/pm.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 877 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
e107_plugins/pm/images/read.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
e107_plugins/pm/images/unread.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

View File

View File

@@ -0,0 +1,80 @@
<?php
define('LAN_PM', "Private Message");
define('LAN_PM_1', "Send Private Message");
define('LAN_PM_2', "To");
define('LAN_PM_3', "Preview");
define('LAN_PM_4', "Userclass");
define('LAN_PM_5', "Subject");
define('LAN_PM_6', "Message");
define('LAN_PM_7', "Emotes");
define('LAN_PM_8', "Attachments");
define('LAN_PM_9', "Read receipt");
define('LAN_PM_10', "Send me an email when this PM is read");
define('LAN_PM_11', "add new upload");
define('LAN_PM_12', "You are not authorized to use the PM system");
define('LAN_PM_13', "Your outbox is currently {PERCENT}% full, you are unable to send PMs until you delete some");
define('LAN_PM_14', "ERROR: Possible duplicate post, PM not sent");
define('LAN_PM_15', "You are not allowed to send to userclass");
define('LAN_PM_16', "Must be member of class");
define('LAN_PM_17', "User not found");
define('LAN_PM_18', "You are not allowed to send PMs to: ");
define('LAN_PM_19', "Your outbox is full, you are not allowed to send PMs");
define('LAN_PM_21', "Adding this PM will exceed your maximum outbox size, PM not posted");
define('LAN_PM_22', "File upload failed");
define('LAN_PM_23', "You are not allowed to send attachments");
define('LAN_PM_24', "Deleting PM");
define('LAN_PM_25', "Inbox");
define('LAN_PM_26', "Outbox");
define('LAN_PM_27', "Unread");
define('LAN_PM_28', "N/A");
define('LAN_PM_29', "Message Sent");
define('LAN_PM_30', "Message Read");
define('LAN_PM_31', "From");
define('LAN_PM_32', "Received");
define('LAN_PM_33', "Sent");
define('LAN_PM_34', "No Messages");
define('LAN_PM_35', "Send new message");
define('LAN_PM_36', "total");
define('LAN_PM_37', "unread");
define('LAN_PM_38', "PM Sent to userclass");
define('LAN_PM_39', "Failed to send PM to");
define('LAN_PM_40', "PM Sent to user");
define('LAN_PM_41', "Failed to post PM to your Outbox");
define('LAN_PM_42', "PM deleted from inbox");
define('LAN_PM_43', "PM deleted from outbox");
define('LAN_PM_44', "Block removed: {UNAME} is now allowed to send you PMs");
define('LAN_PM_45', "ERROR: Block not removed, unknown error");
define('LAN_PM_46', "Block not in place for {UNAME}");
define('LAN_PM_47', "Block added: {UNAME} is no longer allowed to send you PMs");
define('LAN_PM_48', "ERROR: Block not added, unknown error");
define('LAN_PM_49', "ERROR: Block already in place for {UNAME}");
define('LAN_PM_50', "Block User");
define('LAN_PM_51', "Unblock User");
define('LAN_PM_52', "Delete");
define('LAN_PM_53', "Delete Selected");
define('LAN_PM_54', "Quote original");
define('LAN_PM_55', "Send Reply");
define('LAN_PM_56', "You are not permitted to reply to this message");
define('LAN_PM_57', "Message not found");
define('LAN_PM_58', "Re: ");
define('LAN_PM_59', "Go to page: ");
define('LAN_PM_60', "You are not permitted to view this message");
define('LAN_PM_61', "No subject");
define('LAN_PM_62', "File: [{FILENAME}] exceeds size limit - not attached");
define('LAN_PM_63', "class:");
define("LAN_PM_100", "New PM from ");
define("LAN_PM_101", "You have received a new Private Message from ");
define("LAN_PM_102", "Message sent from: ");
define("LAN_PM_103", "Message subject: ");
define("LAN_PM_104", "Number of attachments: ");
define("LAN_PM_105", "You can view the PM at: ");
define("LAN_PM_106", "PM read by ");
define("LAN_PM_107", "The Private Message you sent to {UNAME} was read on ");
define("LAN_PM_108", "Message sent on: ");
define("LAN_PM_109", "New Message(s)");
define("LAN_PM_110", "ok");
define("LAN_PM_111", "Read");
?>

View File

@@ -0,0 +1,63 @@
<?php
define('ADLAN_PM', "Private Messenger");
define('ADLAN_PM_1', "To activate please go to your menus screen and select the private_msg into one of your menu areas. <br /><br />If you need to convert messages from a previous version, please go to the main config page for this plugin and select the 'convert' link.");
define('ADLAN_PM_2', "Configure Private Messenger");
define('ADLAN_PM_3', "PM settings not found, default values set");
define('ADLAN_PM_4', "Options Updated");
define('ADLAN_PM_5', "Limit for selected userclass already exists");
define('ADLAN_PM_6', "Limit successfully added");
define('ADLAN_PM_7', "Limit not added - unknown error");
define('ADLAN_PM_8', "Limit status updated");
define('ADLAN_PM_9', " - Limit successfully removed");
define('ADLAN_PM_10', " - Limit not removed - unknown error");
define('ADLAN_PM_11', " - Limit successfully updated");
define('ADLAN_PM_12', "PM Options");
define('ADLAN_PM_13', "PM Conversion");
define('ADLAN_PM_14', "PM Limits");
define('ADLAN_PM_15', "Add PM Limit");
define('ADLAN_PM_16', "Plugin Title");
define('ADLAN_PM_17', "Show new PM animation");
define('ADLAN_PM_18', "Show user dropdown");
define('ADLAN_PM_19', "READ message timeout");
define('ADLAN_PM_20', "UNREAD message timeout");
define('ADLAN_PM_21', "Popup notification on new PM");
define('ADLAN_PM_22', "Popup delay timeout");
define('ADLAN_PM_23', "Restrict PM use to");
define('ADLAN_PM_24', "Number of PMs to show per page");
define('ADLAN_PM_25', "Enable PM email notifications");
define('ADLAN_PM_26', "Allow user to request read receipt email notifications");
define('ADLAN_PM_27', "Allow posting of attachments");
define('ADLAN_PM_28', "Maximum attachment size");
define('ADLAN_PM_29', "Allow sending to all members");
define('ADLAN_PM_30', "Allow sending to multiple recipients");
define('ADLAN_PM_31', "Enable sending to userclass");
define('ADLAN_PM_32', "Update Settings");
define('ADLAN_PM_33', "Inactive (no limits)");
define('ADLAN_PM_34', "PM counts");
define('ADLAN_PM_35', "PM box sizes");
define('ADLAN_PM_36', "Userclass");
define('ADLAN_PM_37', "Count limits");
define('ADLAN_PM_38', "Size limits (in KB)");
define('ADLAN_PM_39', "Inbox :");
define('ADLAN_PM_40', "Outbox :");
define('ADLAN_PM_41', "There are currently no limits set.");
define('ADLAN_PM_42', "Update Limits");
define('ADLAN_PM_43', "Add New Limit");
define('ADLAN_PM_44', "seconds");
define('ADLAN_PM_45', "Limit PM By: ");
define('ADLAN_PM_46', "PM Conversion");
define('ADLAN_PM_47', "You do not appear to have any old messages from previous versions, it is safe to uninstall the old plugin");
define('ADLAN_PM_48', "You have {OLDCOUNT} messages from the older version, please decide what you would like to do with these messages<br /><br />If converting messages, any message successfully converted will be removed from old system.");
define('ADLAN_PM_49', "Convert to new PM");
define('ADLAN_PM_50', "Discard old messages");
define('ADLAN_PM_51', "PM #{PMNUM} not converted");
define('ADLAN_PM_52', "messages converted");
define('ADLAN_PM_53', "No records found to convert.");
define('ADLAN_PM_54', "Main settings");
define('ADLAN_PM_55', "Limits");
define('ADLAN_PM_56', "Conversion");
define('ADLAN_PM_57', "This plugin is a fully featured Private Messaging system.");
define('ADLAN_PM_58', "Private Messenger");
?>

102
e107_plugins/pm/plugin.php Executable file
View File

@@ -0,0 +1,102 @@
<?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/pm/plugin.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:37 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
include_lan(e_PLUGIN."pm/languages/admin/".e_LANGUAGE.".php");
// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = "ADLAN_PM";
$eplug_version = "3.0";
$eplug_author = "McFly";
$eplug_url = "";
$eplug_email = "mcfly@e107.org";
$eplug_description = ADLAN_PM_57;
$eplug_compatible = "e107v.7+";
// leave blank if no readme file
// Name of the plugin's folder -------------------------------------------------------------------------------------
$eplug_folder = "pm";
// Mane of menu item for plugin ----------------------------------------------------------------------------------
$eplug_menu_name = "pm";
// Name of the admin configuration file --------------------------------------------------------------------------
$eplug_conffile = "pm_conf.php";
// Icon image and caption text ------------------------------------------------------------------------------------
$eplug_icon = $eplug_folder."/images/pvt_message_32.png";
$eplug_icon_small = $eplug_folder."/images/pvt_message_16.png";
$eplug_caption = ADLAN_PM_2; //"Configure Private Messager";
// List of preferences -----------------------------------------------------------------------------------------------
// List of table names -----------------------------------------------------------------------------------------------
$eplug_table_names = array(
"private_msg",
"private_msg_block"
);
// List of sql requests to create tables -----------------------------------------------------------------------------
$eplug_tables = array(
"CREATE TABLE ".MPREFIX."private_msg (
pm_id int(10) unsigned NOT NULL auto_increment,
pm_from int(10) unsigned NOT NULL default '0',
pm_to varchar(250) NOT NULL default '',
pm_sent int(10) unsigned NOT NULL default '0',
pm_read int(10) unsigned NOT NULL default '0',
pm_subject text NOT NULL,
pm_text text NOT NULL,
pm_sent_del tinyint(1) unsigned NOT NULL default '0',
pm_read_del tinyint(1) unsigned NOT NULL default '0',
pm_attachments text NOT NULL,
pm_option varchar(250) NOT NULL default '',
pm_size int(10) unsigned NOT NULL default '0',
PRIMARY KEY (pm_id)
) TYPE=MyISAM AUTO_INCREMENT=1 ;",
"CREATE TABLE ".MPREFIX."private_msg_block (
pm_block_id int(10) unsigned NOT NULL auto_increment,
pm_block_from int(10) unsigned NOT NULL default '0',
pm_block_to int(10) unsigned NOT NULL default '0',
pm_block_datestamp int(10) unsigned NOT NULL default '0',
pm_block_count int(10) unsigned NOT NULL default '0',
PRIMARY KEY (pm_block_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 = ADLAN_PM_1;
if(!function_exists("pm_uninstall"))
{
//Remove prefs and menu entry during uninstall
function pm_uninstall()
{
global $sql;
$sql->db_Delete("core", "e107_name = 'pm_prefs'");
$sql->db_Delete("menus", "menu_name = 'private_msg_menu'");
}
}
?>

433
e107_plugins/pm/pm.php Executable file
View File

@@ -0,0 +1,433 @@
<?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/pm/pm.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:38 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
$retrieve_prefs[] = 'pm_prefs';
require_once("../../class2.php");
require_once(e_PLUGIN."pm/pm_class.php");
require_once(e_PLUGIN."pm/pm_func.php");
$lan_file = e_PLUGIN."pm/languages/".e_LANGUAGE.".php";
include_once(is_readable($lan_file) ? $lan_file : e_PLUGIN."pm/languages/English.php");
define("ATTACHMENT_ICON", "<img src='".e_PLUGIN."pm/images/attach.png' alt='' />");
$qs = explode(".", e_QUERY);
$action = $qs[0];
if($action == "") { $action = 'inbox'; }
$pm_prefs = $sysprefs->getArray("pm_prefs");
if(!check_class($pm_prefs['pm_class']))
{
require_once(HEADERF);
$ns->tablerender(LAN_PM, LAN_PM_12);
require_once(FOOTERF);
exit;
}
$pm =& new private_message;
$message = "";
$pm_prefs['perpage'] = intval($pm_prefs['perpage']);
if($pm_prefs['perpage'] == 0)
{
$pm_prefs['perpage'] = 10;
}
//Auto-delete message, if timeout set in admin
$del_qry = array();
$read_timeout = intval($pm_prefs['read_timeout']);
$unread_timeout = intval($pm_prefs['unread_timeout']);
if($read_timeout > 0)
{
$timeout = time()-($read_timeout * 60);
$del_qry[] = "(pm_sent < {$timeout} AND pm_read > 0)";
}
if($unread_timeout > 0)
{
$timeout = time()-($unread_timeout * 60);
$del_qry[] = "(pm_sent < {$timeout} AND pm_read = 0)";
}
if(count($del_qry) > 0)
{
$qry = implode(" OR ", $del_qry);
if($sql->db_Select("private_msg", "pm_id", $qry))
{
$delList = $sql->db_getList();
foreach($delList as $p)
{
$pm->del($p['pm_id']);
}
}
}
if("del" == $action || isset($_POST['pm_delete_selected']))
{
if(isset($_POST['pm_delete_selected']))
{
foreach(array_keys($_POST['selected_pm']) as $id)
{
$message .= LAN_PM_24.": $id <br />";
$message .= $pm->del($id);
}
}
if('del' == $action)
{
$message = $pm->del(intval($qs[1]));
}
if($qs[2] != "")
{
$action = $qs[2];
}
else
{
if(substr($_SERVER['HTTP_REFERER'], -5) == "inbox")
{
$action = "inbox";
}
if(substr($_SERVER['HTTP_REFERER'], -6) == "outbox")
{
$action = "outbox";
}
}
unset($qs);
}
if('block' == $action)
{
$message = $pm->block_add(intval($qs[1]));
$action = 'inbox';
}
if('unblock' == $action)
{
$message = $pm->block_del(intval($qs[1]));
$action = 'inbox';
}
if("get" == $action)
{
$pm->send_file(intval($qs[1]), intval($qs[2]));
exit;
}
require_once(HEADERF);
if(isset($_POST['postpm']))
{
$message = post_pm();
$action = 'outbox';
}
if($message != "")
{
$ns->tablerender("", $message);
}
if("send" == $action)
{
$ns->tablerender(LAN_PM, show_send(intval($qs[1])));
}
if("reply" == $action)
{
$pmid = intval($qs[1]);
if($pm_info = $pm->pm_get($pmid))
{
if($pm_info['pm_to'] != USERID)
{
$ns->tablerender(LAN_PM, LAN_PM_56);
}
else
{
$ns->tablerender(LAN_PM, show_send());
}
}
else
{
$ns->tablerender(LAN_PM, LAN_PM_57);
}
}
if("inbox" == $action)
{
$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox(intval($qs[1])), "PM");
}
if("outbox" == $action)
{
$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox(intval($qs[1])), "PM");
}
if("show" == $action)
{
show_pm(intval($qs[1]));
}
require_once(FOOTERF);
exit;
function show_send($to_uid)
{
global $tp, $pm_info;
$pm_outbox = pm_getInfo('outbox');
if($to_uid)
{
$sql2 =& new db;
if($sql2->db_Select('user', 'user_name', "user_id = '".intval($to_uid)."'"))
{
$row=$sql2->db_Fetch();
$pm_info['from_name'] = $row['user_name'];
}
}
if($pm_outbox['outbox']['filled'] >= 100)
{
return str_replace('{PERCENT}', $pm_outbox['outbox']['filled'], LAN_PM_13);
}
require_once(e_PLUGIN."pm/pm_shortcodes.php");
$tpl_file = THEME."pm_template.php";
include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN."pm/pm_template.php");
$enc = (check_class($pm_prefs['attach_class']) ? "enctype='multipart/form-data'" : "");
$text = "<form {$enc} method='post' action='".e_SELF."' id='dataform'>
<div><input type='hidden' name='numsent' value='{$pm_outbox['outbox']['total']}' />".
$tp->parseTemplate($PM_SEND_PM, TRUE, $pm_shortcodes).
"</div></form>";
return $text;
}
function show_inbox($start = 0)
{
global $pm, $tp, $pm_shortcodes, $pm_info, $pm_blocks, $pmlist, $pm_start, $pm_prefs;
$pm_start = $start;
require_once(e_PLUGIN."pm/pm_shortcodes.php");
$tpl_file = THEME."pm_template.php";
include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN."pm/pm_template.php");
$pm_blocks = $pm->block_get();
$pmlist = $pm->pm_get_inbox(USERID, $pm_start, $pm_prefs['perpage']);
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
$txt .= $tp->parseTemplate($PM_INBOX_HEADER, true, $pm_shortcodes);
if($pmlist['total_messages'])
{
foreach($pmlist['messages'] as $rec)
{
if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = "[".LAN_PM_61."]"; }
$pm_info = $rec;
$txt .= $tp->parseTemplate($PM_INBOX_TABLE, true, $pm_shortcodes);
}
}
else
{
$txt .= $tp->parseTemplate($PM_INBOX_EMPTY, true, $pm_shortcodes);
}
$txt .= $tp->parseTemplate($PM_INBOX_FOOTER, true, $pm_shortcodes);
$txt .= "</form>";
return $txt;
}
function show_outbox($start = 0)
{
global $pm, $tp, $pm_shortcodes, $pm_info, $pm_start, $pm_prefs, $pmlist;
$pm_start = $start;
require_once(e_PLUGIN."pm/pm_shortcodes.php");
$tpl_file = THEME."pm_template.php";
include(is_readable($tpl_file) ? $tpl_file : e_PLUGIN."pm/pm_template.php");
$pmlist = $pm->pm_get_outbox(USERID, $pm_start, $pm_prefs['perpage']);
$txt = "<form method='post' action='".e_SELF."?".e_QUERY."'>";
$txt .= $tp->parseTemplate($PM_OUTBOX_HEADER, true, $pm_shortcodes);
if($pmlist['total_messages'])
{
foreach($pmlist['messages'] as $rec)
{
if(trim($rec['pm_subject']) == '') { $rec['pm_subject'] = "[".LAN_PM_61."]"; }
$pm_info = $rec;
$txt .= $tp->parseTemplate($PM_OUTBOX_TABLE, true, $pm_shortcodes);
}
}
else
{
$txt .= $tp->parseTemplate($PM_OUTBOX_EMPTY, true, $pm_shortcodes);
}
$txt .= $tp->parseTemplate($PM_OUTBOX_FOOTER, true, $pm_shortcodes);
$txt .= "</form>";
return $txt;
}
function show_pm($pmid)
{
global $pm, $tp, $pm_shortcodes, $pm_info, $ns;
require_once(e_PLUGIN."pm/pm_shortcodes.php");
$tpl_file = THEME."pm_template.php";
include_once(is_readable($tpl_file) ? $tpl_file : e_PLUGIN."pm/pm_template.php");
$pm_info = $pm->pm_get($pmid);
if($pm_info['pm_to'] != USERID && $pm_info['pm_from'] != USERID)
{
$ns->tablerender(LAN_PM, LAN_PM_60);
require_once(FOOTERF);
exit;
}
if($pm_info['pm_read'] == 0 && $pm_info['pm_to'] == USERID)
{
$now = time();
$pm_info['pm_read'] = $now;
$pm->pm_mark_read($pmid, $pm_info);
}
$txt .= $tp->parseTemplate($PM_SHOW, true, $pm_shortcodes);
$ns -> tablerender(LAN_PM, $txt);
if($pm_info['pm_from'] == USERID) {
$ns->tablerender(LAN_PM." - ".LAN_PM_26, show_outbox(intval($qs[1])), "PM");
}
else
{
$ns->tablerender(LAN_PM." - ".LAN_PM_25, show_inbox(intval($qs[1])), "PM");
}
}
function post_pm()
{
global $pm_prefs, $pm, $pref, $sql, $tp;
if(!check_class($pm_prefs['pm_class']))
{
return LAN_PM_12;
}
$pm_info = pm_getInfo('outbox');
if($pm_info['outbox']['total'] != $_POST['numsent'])
{
return LAN_PM_14;
}
if(isset($_POST['user']))
{
$_POST['pm_to'] = $_POST['user'];
}
if(isset($_POST['pm_to']))
{
$msg = "";
if(isset($_POST['to_userclass']) && $_POST['to_userclass'])
{
if(!$pm_prefs['allow_userclass'])
{
return LAN_PM_15;
}
elseif(!check_class($_POST['pm_userclass']) && !ADMIN)
{
return LAN_PM_16;
}
}
else
{
$to_array = explode("\n", trim($_POST['pm_to']));
foreach($to_array as $k => $v)
{
$to_array[$k] = trim($v);
}
$to_array = array_unique($to_array);
if(count($to_array) == 1)
{
$_POST['pm_to'] = $to_array[0];
}
if(check_class($pm_prefs['multi_class']) && count($to_array) > 1)
{
foreach($to_array as $to)
{
if($to_info = $pm->pm_getuid($to))
{
if(!$sql->db_Update("private_msg_block","pm_block_count=pm_block_count+1 WHERE pm_block_from = '".USERID."' AND pm_block_to = '".$tp -> toDB($to)."'"))
{
$_POST['to_array'][] = $to_info;
}
}
}
}
else
{
if($to_info = $pm->pm_getuid($_POST['pm_to']))
{
$_POST['to_info'] = $to_info;
}
else
{
return LAN_PM_17;
}
if($sql->db_Update("private_msg_block","pm_block_count=pm_block_count+1 WHERE pm_block_from = '".USERID."' AND pm_block_to = '{$to_info['user_id']}'"))
{
return LAN_PM_18.$to_info['user_name'];
}
}
}
if(isset($_POST['receipt']))
{
if(!check_class($pm_prefs['receipt_class']))
{
unset($_POST['receipt']);
}
}
$totalsize = strlen($_POST['pm_message']);
$maxsize = intval($pm_prefs['attach_size']) * 1024;
foreach(array_keys($_FILES['file_userfile']['size']) as $fid)
{
if($maxsize > 0 && $_FILES['file_userfile']['size'][$fid] > $maxsize)
{
$msg .= str_replace("{FILENAME}", $_FILES['file_userfile']['name'][$fid], LAN_PM_62)."<br />";
$_FILES['file_userfile']['size'][$fid] = 0;
}
$totalsize += $_FILES['file_userfile']['size'][$fid];
}
if(intval($pref['pm_limit']) > 0)
{
if($pref['pm_limit'] == '1')
{
if($pm_info['outbox']['total'] == $pm_info['outbox']['limit'])
{
return LAN_PM_19;
}
}
else
{
if($pm_info['outbox']['size'] + $totalsize > $pm_info['outbox']['limit'])
{
return LAN_PM_21;
}
}
}
if($_FILES['file_userfile']['name'][0])
{
if(check_class($pm_prefs['attach_class']))
{
require_once(e_HANDLER."upload_handler.php");
$randnum = rand(1000, 9999);
$_POST['uploaded'] = file_upload(e_PLUGIN."pm/attachments", "attachment", $randnum."_");
if($_POST['uploaded'] == FALSE)
{
unset($_POST['uploaded']);
$msg .= LAN_PM_22."<br />";
}
}
else
{
$msg .= LAN_PM_23."<br />";
unset($_POST['uploaded']);
}
}
$_POST['from_id'] = USERID;
return $msg.$pm->add($_POST);
}
}
?>

428
e107_plugins/pm/pm_class.php Executable file
View File

@@ -0,0 +1,428 @@
<?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/pm/pm_class.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:38 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
class private_message
{
function pm_mark_read($pm_id, $pm_info)
{
$now = time();
global $pm_prefs, $sql;
if($pm_prefs['read_delete'])
{
$this->del($pm_id);
}
else
{
$sql->db_Select_gen("UPDATE #private_msg SET pm_read = {$now} WHERE pm_id=".intval($pm_id));
if(strpos($pm_info['pm_option'], "+rr") !== FALSE)
{
$this->pm_send_receipt($pm_info);
}
}
}
function pm_get($pmid)
{
global $sql;
$qry = "
SELECT pm.*, ut.user_image AS sent_image, ut.user_name AS sent_name, uf.user_image AS from_image, uf.user_name AS from_name, uf.user_email as from_email, ut.user_email as to_email FROM #private_msg AS pm
LEFT JOIN #user AS ut ON ut.user_id = pm.pm_to
LEFT JOIN #user AS uf ON uf.user_id = pm.pm_from
WHERE pm.pm_id='".intval($pmid)."'
";
if ($sql->db_Select_gen($qry))
{
$row = $sql->db_Fetch();
return $row;
}
return FALSE;
}
function add($vars)
{
global $pm_prefs, $tp, $sql;
$vars['options'] = "";
$pmsize = 0;
$attachlist = "";
$pm_options = "";
if(isset($vars['receipt']) && $vars['receipt']) {$pm_options .= "+rr+"; }
if(isset($vars['uploaded']))
{
foreach($vars['uploaded'] as $u)
{
if(!isset($u['error']))
{
$pmsize += $u['size'];
$a_list[] = $u['name'];
}
}
$attachlist = implode(chr(0), $a_list);
}
$pmsize += strlen($vars['pm_message']);
$pm_subject = $tp->toDB($vars['pm_subject']);
$pm_message = $tp->toDB($vars['pm_message']);
$sendtime = time();
if(isset($vars['to_userclass']) || isset($vars['to_array']))
{
if(isset($vars['to_userclass']))
{
require_once(e_HANDLER."userclass_class.php");
$toclass = r_userclass_name($vars['pm_userclass']);
$tolist = $this->get_users_inclass($vars['pm_userclass']);
$ret .= LAN_PM_38.": {$vars['to_userclass']}<br />";
$class = TRUE;
}
else
{
$tolist = $vars['to_array'];
$class = FALSE;
}
foreach($tolist as $u)
{
set_time_limit(30);
if($pmid = $sql->db_Insert("private_msg", "0, '".intval($vars['from_id'])."', '".$tp -> toDB($u['user_id'])."', '".intval($sendtime)."', '0', '{$pm_subject}', '{$pm_message}', '1', '0', '".$tp -> toDB($attachlist)."', '".$tp -> toDB($pm_options)."', '".intval($pmsize)."'"))
{
if($class == FALSE)
{
$toclass .= $u['user_name'].", ";
}
if(check_class($pm_prefs['notify_class'], $u['user_class']))
{
$vars['to_info'] = $u;
$this->pm_send_notify($u['user_id'], $vars, $pmid, count($a_list));
}
}
else
{
$ret .= LAN_PM_39.": {$u['user_name']} <br />";
}
}
if(!$pmid = $sql->db_Insert("private_msg", "0, '".intval($vars['from_id'])."', '".$tp -> toDB($toclass)."', '".intval($sendtime)."', '1', '{$pm_subject}', '{$pm_message}', '0', '0', '".$tp -> toDB($attachlist)."', '".$tp -> toDB($pm_options)."', '".intval($pmsize)."'"))
{
$ret .= LAN_PM_41."<br />";
}
}
else
{
if($pmid = $sql->db_Insert("private_msg", "0, '".intval($vars['from_id'])."', '".$tp -> toDB($vars['to_info']['user_id'])."', '".intval($sendtime)."', '0', '{$pm_subject}', '{$pm_message}', '0', '0', '".$tp -> toDB($attachlist)."', '".$tp -> toDB($pm_options)."', '".intval($pmsize)."'"))
{
if(check_class($pm_prefs['notify_class'], $vars['to_info']['user_class']))
{
set_time_limit(30);
$this->pm_send_notify($vars['to_info']['user_id'], $vars, $pmid, count($a_list));
}
$ret .= LAN_PM_40.": {$vars['to_info']['user_name']}<br />";
}
}
return $ret;
}
function del($pmid)
{
global $sql;
$ret = "";
$del_pm = FALSE;
$newvals = "";
if($sql->db_Select("private_msg", "*", "pm_id = ".intval($pmid)." AND (pm_from = ".USERID." OR pm_to = ".USERID.")"))
{
$row = $sql->db_Fetch();
if($row['pm_to'] == USERID)
{
$newvals = "pm_read_del = 1";
$ret .= LAN_PM_42."<br />";
if($row['pm_sent_del'] == 1) { $del_pm = TRUE; }
}
if($row['pm_from'] == USERID)
{
if($newvals != "") { $del_pm = TRUE; }
$newvals = "pm_sent_del = 1";
$ret .= LAN_PM_43."<br />";
if($row['pm_read_del'] == 1) { $del_pm = TRUE; }
}
if(count($newvals) == 2 || $del_pm == TRUE)
{
// Delete any attachments and remove PM from db
$attachments = explode(chr(0), $row['pm_attachments']);
foreach($attachments as $a)
{
$filename = getcwd()."/attachments/{$a}";
unlink($filename);
}
$sql->db_Delete("private_msg", "pm_id = ".intval($pmid));
}
else
{
$sql->db_Update("private_msg", $newvals." WHERE pm_id = ".intval($pmid));
}
return $ret;
}
}
function pm_send_notify($uid, $pminfo, $pmid, $attach_count = 0)
{
require_once(e_HANDLER."mail.php");
global $PLUGINS_DIRECTORY;
$subject = LAN_PM_100.SITENAME;
$pmlink = SITEURL.$PLUGINS_DIRECTORY."pm/pm.php?show.{$pmid}";
$txt = LAN_PM_101.SITENAME."\n\n";
$txt .= LAN_PM_102.USERNAME."\n";
$txt .= LAN_PM_103.$pminfo['pm_subject']."\n";
if($attch_count > 0)
{
$txt .= LAN_PM_104.$attach_count."\n";
}
$txt .= LAN_PM_105."\n".$pmlink."\n";
sendemail($pminfo['to_info']['user_email'], $subject, $txt, $pminfo['to_info']['user_name']);
}
function pm_send_receipt($pminfo)
{
require_once(e_HANDLER."mail.php");
global $PLUGINS_DIRECTORY;
$subject = LAN_PM_106.$pminfo['sent_name'];
$pmlink = SITEURL.$PLUGINS_DIRECTORY."pm/pm.php?show.{$pminfo['pm_id']}";
$txt = str_replace("{UNAME}", $pminfo['sent_name'], LAN_PM_107).date('l F dS Y h:i:s A')."\n\n";
$txt .= LAN_PM_108.date('l F dS Y h:i:s A', $pminfo['pm_sent'])."\n";
$txt .= LAN_PM_103.$pminfo['pm_subject']."\n";
$txt .= LAN_PM_105."\n".$pmlink."\n";
sendemail($pminfo['from_email'], $subject, $txt, $pminfo['from_name']);
}
function block_get($to = USERID)
{
global $sql, $tp;
$ret = array();
if($sql->db_Select("private_msg_block", "pm_block_from", "pm_block_to = '".$tp -> toDB($to)."'"))
{
while($row = $sql->db_Fetch())
{
$ret[] = $row['pm_block_from'];
}
}
return $ret;
}
function block_add($from, $to = USERID)
{
global $sql, $tp;
if($sql->db_Select("user", "user_name", "user_id = '".intval($from)."'"))
{
$uinfo = $sql->db_Fetch();
if(!$sql->db_Count("private_msg_block", "(*)", "WHERE pm_block_from = '".intval($from)."' AND pm_block_to = '".$tp -> toDB($to)."'"))
{
if($sql->db_Insert("private_msg_block", "0, '".intval($from)."', '".$tp -> toDB($to)."', '".time()."', '0'"))
{
return str_replace('{UNAME}', $uinfo['user_name'], LAN_PM_47);
}
else
{
return LAN_PM_48;
}
}
else
{
return str_replace('{UNAME}', $uinfo['user_name'], LAN_PM_49);
}
}
else
{
return LAN_PM_17;
}
}
function block_del($from, $to = USERID)
{
global $sql;
if($sql->db_Select("user", "user_name", "user_id = '".intval($from)."'"))
{
$uinfo = $sql->db_Fetch();
if($sql->db_Select("private_msg_block", "pm_block_id", "pm_block_from = '".intval($from)."' AND pm_block_to = '".intval($to)."'"))
{
$row = $sql->db_Fetch();
if($sql->db_Delete("private_msg_block", "pm_block_id = '".intval($row['pm_block_id'])."'"))
{
return str_replace("{UNAME}", $uinfo['user_name'], LAN_PM_44);
}
else
{
return LAN_PM_45;
}
}
else
{
return str_replace("{UNAME}", $uinfo['user_name'], LAN_PM_46);
}
}
else
{
return LAN_PM_17;
}
}
function pm_getuid($var)
{
global $sql, $tp;
if($sql->db_Select("user", "user_id, user_name, user_class, user_email", "user_name LIKE '".$sql -> escape(trim($var), TRUE)."'"))
{
$row = $sql->db_Fetch();
return $row;
}
return FALSE;
}
function get_users_inclass($class)
{
global $sql, $tp;
if($class == e_UC_MEMBER)
{
$qry = "SELECT user_id, user_name, user_email, user_class FROM #user WHERE 1";
}
elseif($class == e_UC_ADMIN)
{
$qry = "SELECT user_id, user_name, user_email, user_class FROM #user WHERE user_admin = 1";
}
elseif($class)
{
$regex = "(^|,)(".$tp -> toDB($class).")(,|$)";
$qry = "SELECT user_id, user_name, user_email, user_class FROM #user WHERE user_class REGEXP '{$regex}'";
}
if($sql->db_Select_gen($qry))
{
$ret = $sql->db_getList();
return $ret;
}
return FALSE;
}
function pm_get_inbox($uid = USERID, $from = 0, $limit = 10)
{
global $sql;
$ret = "";
if($total_messages = $sql->db_Count("private_msg", "(*)", "WHERE pm_to='{$uid}' AND pm_read_del=0"))
{
$qry = "
SELECT pm.*, u.user_image, u.user_name FROM #private_msg AS pm
LEFT JOIN #user AS u ON u.user_id = pm.pm_from
WHERE pm.pm_to='{$uid}' AND pm.pm_read_del=0
ORDER BY pm.pm_sent DESC
LIMIT ".intval($from).", ".intval($limit)."
";
if($sql->db_Select_gen($qry))
{
$ret['messages'] = $sql->db_getList();
$ret['total_messages'] = $total_messages;
}
return $ret;
}
}
function pm_get_outbox($uid = USERID, $from = 0, $limit = 10)
{
global $sql;
if(intval($limit < 1)) { $limit = 10; }
if($total_messages = $sql->db_Count("private_msg", "(*)", "WHERE pm_from='{$uid}' AND pm_sent_del=0"))
{
$qry = "
SELECT pm.*, u.user_image, u.user_name FROM #private_msg AS pm
LEFT JOIN #user AS u ON u.user_id = pm.pm_to
WHERE pm.pm_from='{$uid}' AND pm.pm_sent_del=0
ORDER BY pm.pm_sent DESC
LIMIT ".intval($from).", ".intval($limit)."
";
if($sql->db_Select_gen($qry))
{
$ret['messages'] = $sql->db_getList();
$ret['total_messages'] = $total_messages;
}
}
return $ret;
}
function send_file($pmid, $filenum)
{
global $pref;
$pm_info = $this->pm_get($pmid);
$attachments = explode(chr(0), $pm_info['pm_attachments']);
if(!isset($attachments[$filenum]))
{
return FALSE;
}
$fname = $attachments[$filenum];
list($timestamp, $fromid, $rand, $file) = explode("_", $fname, 4);
$filename = getcwd()."/attachments/{$fname}";
if($fromid != $pm_info['pm_from'])
{
return FALSE;
}
if(!is_file($filename))
{
return FALSE;
}
@set_time_limit(10 * 60);
@e107_ini_set("max_execution_time", 10 * 60);
while (@ob_end_clean()); // kill all output buffering else it eats server resources
if (connection_status() == 0)
{
if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
$file = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1);
}
if (isset($_SERVER['HTTP_RANGE']))
{
$seek = intval(substr($_SERVER['HTTP_RANGE'] , strlen('bytes=')));
}
$bufsize = 2048;
ignore_user_abort(true);
$data_len = filesize($filename);
if ($seek > ($data_len - 1)) $seek = 0;
$res =& fopen($filename, 'rb');
if ($seek)
{
fseek($res , $seek);
}
$data_len -= $seek;
header("Expires: 0");
header("Cache-Control: max-age=30" );
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename={$file}");
header("Content-Length: {$data_len}");
header("Pragma: public");
if ($seek)
{
header("Accept-Ranges: bytes");
header("HTTP/1.0 206 Partial Content");
header("status: 206 Partial Content");
header("Content-Range: bytes {$seek}-".($data_len - 1)."/{$data_len}");
}
while (!connection_aborted() && $data_len > 0)
{
echo fread($res , $bufsize);
$data_len -= $bufsize;
}
fclose($res);
}
}
}
?>

364
e107_plugins/pm/pm_conf.php Executable file
View File

@@ -0,0 +1,364 @@
<?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/pm/pm_conf.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:38 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
$retrieve_prefs[] = 'pm_prefs';
$eplug_admin = TRUE;
require_once("../../class2.php");
require_once(e_PLUGIN."pm/pm_class.php");
require_once(e_HANDLER."userclass_class.php");
require_once(e_HANDLER."form_handler.php");
if (!getperms("P"))
{
header("location:".e_BASE."index.php");
exit;
}
$action = e_QUERY;
require_once(e_ADMIN."auth.php");
if($action == "")
{
$action = "main";
}
$pm_prefs = $sysprefs->getArray("pm_prefs");
//pm_prefs record not found in core table, set to defaults and create record
if(!is_array($pm_prefs))
{
require_once(e_PLUGIN."pm/pm_default.php");
$pm_prefs = pm_set_default_prefs();
$sysprefs->setArray('pm_prefs');
$message = ADLAN_PM_3;
}
$lan_file = e_PLUGIN."pm/languages/admin/".e_LANGUAGE.".php";
include_once(is_readable($lan_file) ? $lan_file : e_PLUGIN."pm/languages/admin/English.php");
if (isset($_POST['update_prefs']))
{
foreach($_POST['option'] as $k => $v)
{
$pm_prefs[$k] = $v;
}
$sysprefs->setArray('pm_prefs');
$message = ADLAN_PM_4;
}
if(isset($_POST['addlimit']))
{
if($sql->db_Select('generic','gen_id',"gen_type = 'pm_limit' AND gen_datestamp = {$_POST['newlimit_class']}"))
{
$message = ADLAN_PM_5;
}
else
{
if($sql->db_Insert('generic',"0, 'pm_limit', '{$_POST['newlimit_class']}', '{$_POST['new_inbox_count']}', '{$_POST['new_outbox_count']}', '{$_POST['new_inbox_size']}', '{$_POST['new_outbox_size']}'"))
{
$message = ADLAN_PM_6;
}
else
{
$message = ADLAN_PM_7;
}
}
}
if(isset($_POST['updatelimits']))
{
if($pref['pm_limits'] != $_POST['pm_limits'])
{
$pref['pm_limits'] = $_POST['pm_limits'];
save_prefs();
$message .= ADLAN_PM_8."<br />";
}
foreach(array_keys($_POST['inbox_count']) as $id)
{
if($_POST['inbox_count'][$id] == "" && $_POST['outbox_count'][$id] == "" && $_POST['inbox_size'][$id] == "" && $_POST['outbox_size'][$id] == "")
{
//All entries empty - Remove record
if($sql->db_Delete('generic',"gen_id = {$id}"))
{
$message .= $id.ADLAN_PM_9."<br />";
}
else
{
$message .= $id.ADLAN_PM_10."<br />";
}
}
else
{
$sql->db_Update('generic',"gen_user_id = '{$_POST['inbox_count'][$id]}', gen_ip = '{$_POST['outbox_count'][$id]}', gen_intdata = '{$_POST['inbox_size'][$id]}', gen_chardata = '{$_POST['outbox_size'][$id]}' WHERE gen_id = {$id}");
$message .= $id.ADLAN_PM_11."<br />";
}
}
}
if(isset($message))
{
$ns->tablerender("", $message);
}
if($action == "main")
{
$ns->tablerender(ADLAN_PM_12, show_options());
}
if($action == "limits")
{
$ns->tablerender(ADLAN_PM_14, show_limits());
$ns->tablerender(ADLAN_PM_15, add_limit());
}
require_once(e_ADMIN."footer.php");
function yes_no($fname)
{
global $pm_prefs;
$ret =
form::form_radio("option[{$fname}]", "1", ($pm_prefs[$fname] ? "1" : "0"), "", "").LAN_YES." ".
form::form_radio("option[{$fname}]", "0", ($pm_prefs[$fname] ? "0" : "1"), "", "").LAN_NO;
return $ret;
}
function show_options()
{
global $pm_prefs;
$txt = "
<form method='post' action='".e_SELF."'>
<table class='fborder' style='width:95%'>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_16."</td>
<td class='forumheader3' style='width:25%'>".form::form_text('option[title]', 20, $pm_prefs['title'], 50)."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_17."</td>
<td class='forumheader3' style='width:25%'>".yes_no('animate')."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_18."</td>
<td class='forumheader3' style='width:25%'>".yes_no('dropdown')."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_19."</td>
<td class='forumheader3' style='width:25%'>".form::form_text('option[read_timeout]', 5, $pm_prefs['read_timeout'], 5)."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_20."</td>
<td class='forumheader3' style='width:25%'>".form::form_text('option[unread_timeout]', 5, $pm_prefs['unread_timeout'], 5)."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_21."</td>
<td class='forumheader3' style='width:25%'>".yes_no('popup')."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_22."</td>
<td class='forumheader3' style='width:25%'>".form::form_text('option[popup_delay]', 5, $pm_prefs['popup_delay'], 5)." ".ADLAN_PM_44."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_23."</td>
<td class='forumheader3' style='width:25%'>".r_userclass('option[pm_class]', $pm_prefs['pm_class'], 'off', 'members, admin, classes')."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_24."</td>
<td class='forumheader3' style='width:25%'>".form::form_text('option[perpage]', 5, $pm_prefs['perpage'], 5)."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_25."</td>
<td class='forumheader3' style='width:25%'>".r_userclass('option[notify_class]', $pm_prefs['notify_class'], 'off', 'nobody, members, admin, classes')."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_26."</td>
<td class='forumheader3' style='width:25%'>".r_userclass('option[receipt_class]', $pm_prefs['receipt_class'], 'off', 'nobody, members, admin, classes')."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_27."</td>
<td class='forumheader3' style='width:25%'>".r_userclass('option[attach_class]', $pm_prefs['attach_class'], 'off', 'nobody, members, admin, classes')."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_28."</td>
<td class='forumheader3' style='width:25%'>".form::form_text('option[attach_size]', 8, $pm_prefs['attach_size'], 8)." kB</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_29."</td>
<td class='forumheader3' style='width:25%'>".r_userclass('option[sendall_class]', $pm_prefs['sendall_class'], 'off', 'nobody, members, admin, classes')."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_30."</td>
<td class='forumheader3' style='width:25%'>".r_userclass('option[multi_class]', $pm_prefs['multi_class'], 'off', 'nobody, members, admin, classes')."</td>
</tr>
<tr>
<td class='forumheader3' style='width:75%'>".ADLAN_PM_31."</td>
<td class='forumheader3' style='width:25%'>".yes_no('allow_userclass')."</td>
</tr>
<tr>
<td class='forumheader' colspan='2' style='text-align:center'><input type='submit' class='button' name='update_prefs' value='".ADLAN_PM_32."' /></td>
</tr>
</table>
</form>
";
return $txt;
}
function show_limits()
{
global $sql, $pref;
if($sql->db_Select('userclass_classes','userclass_id, userclass_name'))
{
$classList = $sql->db_getList();
}
if($sql->db_Select("generic", "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'"))
{
while($row = $sql->db_Fetch())
{
$limitList[$row['limit_classnum']] = $row;
}
}
$txt = "
<form method='post' action='".e_SELF."?".e_QUERY."'>
<table class='fborder' style='width:95%'>
<tr>
<td colspan='3' class='forumheader3' style='text-align:left'>".ADLAN_PM_45."
<select name='pm_limits' class='tbox'>
";
$sel = ($pref['pm_limits'] == 0 ? "selected='selected'" : "");
$txt .= "<option value='0' {$sel}>".ADLAN_PM_33."</option>\n";
$sel = ($pref['pm_limits'] == 1 ? "selected='selected'" : "");
$txt .= "<option value='1' {$sel}>".ADLAN_PM_34."</option>\n";
$sel = ($pref['pm_limits'] == 2 ? "selected='selected'" : "");
$txt .= "<option value='2' {$sel}>".ADLAN_PM_35."</option>\n";
$txt .= "</select>\n";
$txt .= "
</td>
</tr>
<tr>
<td class='fcaption'>".ADLAN_PM_36."</td>
<td class='fcaption'>".ADLAN_PM_37."</td>
<td class='fcaption'>".ADLAN_PM_38."</td>
</tr>
";
if (isset($limitList)) {
foreach($limitList as $row)
{
$txt .= "
<tr>
<td class='forumheader3'>".r_userclass_name($row['limit_classnum'])."</td>
<td class='forumheader3'>
".ADLAN_PM_39."<input type='text' class='tbox' size='5' name='inbox_count[{$row['limit_id']}]' value='{$row['inbox_count']}' />
".ADLAN_PM_40."<input type='text' class='tbox' size='5' name='outbox_count[{$row['limit_id']}]' value='{$row['outbox_count']}' />
</td>
<td class='forumheader3'>
".ADLAN_PM_39."<input type='text' class='tbox' size='5' name='inbox_size[{$row['limit_id']}]' value='{$row['inbox_size']}' />
".ADLAN_PM_39."<input type='text' class='tbox' size='5' name='outbox_size[{$row['limit_id']}]' value='{$row['outbox_size']}' />
</td>
</tr>
";
}
} else {
$txt .= "
<tr>
<td class='forumheader3' colspan='3' style='text-align: center'>".ADLAN_PM_41."</td>
</tr>
";
}
$txt .= "
<tr>
<td class='forumheader' colspan='3' style='text-align:center'>
<input type='submit' class='button' name='updatelimits' value='".ADLAN_PM_42."' />
</td>
</tr>
";
$txt .= "</table></form>";
return $txt;
}
function add_limit()
{
global $sql, $pref;
if($sql->db_Select('userclass_classes','userclass_id, userclass_name'))
{
$classList = $sql->db_getList();
}
if($sql->db_Select("generic", "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as inbox_count, gen_ip as outbox_count, gen_intdata as inbox_size, gen_chardata as outbox_size", "gen_type = 'pm_limit'"))
{
while($row = $sql->db_Fetch())
{
$limitList[$row['limit_classnum']] = $row;
}
}
$txt = "
<form method='post' action='".e_SELF."?".e_QUERY."'>
<table class='fborder' style='width:95%'>
<tr>
<td class='fcaption'>".ADLAN_PM_36."</td>
<td class='fcaption'>".ADLAN_PM_37."</td>
<td class='fcaption'>".ADLAN_PM_38."</td>
</tr>
";
$txt .= "
<tr>
<td class='forumheader3'>".r_userclass("newlimit_class", 0, "off", "guest, member, admin, classes, language")."</td>
<td class='forumheader3'>
".ADLAN_PM_39."<input type='text' class='tbox' size='5' name='new_inbox_count' value='' />
".ADLAN_PM_40."<input type='text' class='tbox' size='5' name='new_outbox_count' value='' />
</td>
<td class='forumheader3'>
".ADLAN_PM_39."<input type='text' class='tbox' size='5' name='new_inbox_size' value='' />
".ADLAN_PM_40."<input type='text' class='tbox' size='5' name='new_outbox_size' value='' />
</td>
</tr>
<tr>
<td class='forumheader' colspan='3' style='text-align:center'>
<input type='submit' class='button' name='addlimit' value='".ADLAN_PM_43."' />
</td>
</tr>
";
$txt .= "</table></form>";
return $txt;
}
function show_menu($action)
{
global $sql;
if ($action == "") { $action = "main"; }
$var['main']['text'] = ADLAN_PM_54;
$var['main']['link'] = e_SELF;
$var['limits']['text'] = ADLAN_PM_55;
$var['limits']['link'] = e_SELF."?limits";
show_admin_menu(ADLAN_PM_12, $action, $var);
}
function pm_conf_adminmenu() {
global $action;
show_menu($action);
}
?>

25
e107_plugins/pm/pm_default.php Executable file
View File

@@ -0,0 +1,25 @@
<?php
if (!defined('e107_INIT')) { exit; }
function pm_set_default_prefs()
{
$ret = array(
'title' => 'PMLAN_PM',
'animate' => '1',
'dropdown' => '0',
'read_timeout' => '0',
'unread_timeout' => '0',
'popup' => '0',
'popup_delay' => '',
'pm_class' => e_UC_MEMBER,
'notify_class' => e_UC_ADMIN,
'receipt_class' => e_UC_MEMBER,
'attach_class' => e_UC_ADMIN,
'attach_size' => 500,
'sendall_class' => e_UC_ADMIN,
'multi_class' => e_UC_ADMIN,
'allow_userclass' => '1'
);
return $ret;
}
?>

97
e107_plugins/pm/pm_func.php Executable file
View File

@@ -0,0 +1,97 @@
<?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/pm/pm_func.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:38 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
function pm_getInfo($which = "inbox")
{
static $pm_info;
global $sql, $pref, $pm_prefs;
if('clear' == $which)
{
unset($pm_info['inbox']);
unset($pm_info['outbox']);
}
if('inbox' == $which)
{
$qry = "SELECT count(pm.pm_id) AS total, SUM(pm.pm_size)/1024 size, SUM(pm.pm_read = 0) as unread FROM #private_msg as pm WHERE pm.pm_to = ".USERID." AND pm.pm_read_del = 0";
}
else
{
$qry = "SELECT count(pm.pm_from) AS total, SUM(pm.pm_size)/1024 size, SUM(pm.pm_read = 0) as unread FROM #private_msg as pm WHERE pm.pm_from = ".USERID." AND pm.pm_sent_del = 0";
}
if(!isset($pm_info[$which]['total']))
{
$sql->db_Select_gen($qry);
$pm_info[$which] = $sql->db_Fetch();
if($which == 'inbox' && $pm_prefs['animate'] == 1 || $pm_prefs['popup'] == 1)
{
if($new = $sql->db_Count("private_msg", "(*)", "WHERE pm_sent > '.USERLV.' AND pm_read = 0 AND pm_to = '".USERID."' AND pm_read_del != 1"))
{
$pm_info['inbox']['new'] = $new;
}
}
}
if(!isset($pm_info[$which]['limit']))
{
if($pref['pm_limits'] > 0)
{
if($pref['pm_limits'] == 1)
{
$qry = "SELECT MAX(gen_user_id) AS inbox_limit, MAX(gen_ip) as outbox_limit FROM #generic WHERE gen_type='pm_limit' AND gen_datestamp IN (".USERCLASS_LIST.")";
}
else
{
$qry = "SELECT MAX(gen_intdata) AS inbox_limit, MAX(gen_chardata) as outbox_limit FROM #generic WHERE gen_type='pm_limit' AND gen_datestamp IN (".USERCLASS_LIST.")";
}
if($sql->db_Select_gen($qry))
{
$row = $sql->db_Fetch();
$pm_info['inbox']['limit'] = $row['inbox_limit'];
$pm_info['outbox']['limit'] = $row['outbox_limit'];
}
$pm_info['inbox']['limit_val'] = ($pref['pm_limits'] == 1 ? $pm_info['inbox']['total'] : $pm_info['inbox']['size']);
if(!$pm_info['inbox']['limit'] || !$pm_info['inbox']['limit_val'])
{
$pm_info['inbox']['filled'] = 0;
}
else
{
$pm_info['inbox']['filled'] = number_format($pm_info['inbox']['limit_val']/$pm_info['inbox']['limit'] * 100, 2);
}
$pm_info['outbox']['limit_val'] = ($pref['pm_limits'] == 1 ? $pm_info['outbox']['total'] : $pm_info['outbox']['size']);
if(!$pm_info['outbox']['limit'] || !$pm_info['outbox']['limit_val'])
{
$pm_info['outbox']['filled'] = 0;
}
else
{
$pm_info['outbox']['filled'] = number_format($pm_info['outbox']['limit_val']/$pm_info['outbox']['limit'] * 100, 2);
}
}
else
{
$pm_info['inbox']['limit'] = "";
$pm_info['outbox']['limit'] = "";
$pm_info['inbox']['filled'] = "";
$pm_info['outbox']['filled'] = "";
}
}
return $pm_info;
}
?>

17
e107_plugins/pm/pm_notes.txt Executable file
View File

@@ -0,0 +1,17 @@
pm_id
pm_from
pm_to
pm_sent
pm_read
pm_subject
pm_text
pm_sent_del
pm_read_del
pm_attachments
pm_options
pm_block_id
pm_block_from
pm_block_to
pm_block_datestamp
pm_block_count

371
e107_plugins/pm/pm_shortcodes.php Executable file
View File

@@ -0,0 +1,371 @@
<?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/pm/pm_shortcodes.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:39 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
include_once(e_HANDLER.'shortcode_handler.php');
include_once(e_PLUGIN.'pm/pm_func.php');
$pm_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
/*
SC_BEGIN FORM_TOUSER
global $pm_prefs, $pm_info;
if($pm_info['from_name'])
{
return "<input type='hidden' name='pm_to' value='{$pm_info['from_name']}' />{$pm_info['from_name']}";
}
require_once(e_HANDLER."user_select_class.php");
$us = new user_select;
$type = ($pm_prefs['dropdown'] == TRUE ? 'list' : 'popup');
if(check_class($pm_prefs['multi_class']))
{
$ret = $us->select_form($type, 'textarea.pm_to');
}
else
{
$ret = $us->select_form($type, 'pm_to');
}
return $ret;
SC_END
SC_BEGIN FORM_TOCLASS
global $pm_prefs, $pm_info;
if($pm_info['from_name'])
{
return "";
}
if($pm_prefs['allow_userclass'])
{
$ret = "<input type='checkbox' name='to_userclass' value='1' />".LAN_PM_4." ";
require_once(e_HANDLER."userclass_class.php");
$args = (ADMIN ? "admin, classes" : "matchclass");
if(check_class($pm_prefs['sendall_class']))
{
$args = "member, ".$args;
}
$ret .= r_userclass("pm_userclass", "", "off", $args);
}
return $ret;
SC_END
SC_BEGIN FORM_SUBJECT
global $pm_info;
$value = "";
if($pm_info['pm_subject'])
{
$value = $pm_info['pm_subject'];
if(substr($value, 0, strlen(LAN_PM_58)) != LAN_PM_58)
{
$value = LAN_PM_58.$value;
}
}
return "<input class='tbox' type='text' name='pm_subject' value='{$value}' size='63' maxlength='255' />";
SC_END
SC_BEGIN FORM_MESSAGE
global $pm_info;
$value = "";
if($pm_info['pm_text'])
{
if(isset($_POST['quote']))
{
$t = time();
$value = "[quote{$t}={$pm_info['from_name']}]\n{$pm_info['pm_text']}\n[/quote{$t}]\n\n";
}
}
return "<textarea class='tbox' name='pm_message' cols='60' rows='10' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>{$value}</textarea>";
SC_END
SC_BEGIN EMOTES
require_once(e_HANDLER."emote.php");
return r_emote();
SC_END
SC_BEGIN PM_POST_BUTTON
return "<input class='button' type='submit' name='postpm' value='".LAN_PM_1."' />";
SC_END
SC_BEGIN PM_PREVIEW_BUTTON
return "<input class='button' type='submit' name='postpm' value='".LAN_PM_3."' />";
SC_END
SC_BEGIN ATTACHMENT
global $pm_prefs;
if (check_class($pm_prefs['attach_class']))
{
$ret = "
<div id='up_container' >
<span id='upline' style='white-space:nowrap'>
<input class='tbox' type='file' name='file_userfile[]' size='40' />
</span>
</div>
<input type='button' class='button' value='".LAN_PM_11."' onclick=\"duplicateHTML('upline','up_container');\" />
";
return $ret;
}
return "";
SC_END
SC_BEGIN PM_ATTACHMENT_ICON
global $pm_info;
if($pm_info['pm_attachments'] != "")
{
return ATTACHMENT_ICON;
}
SC_END
SC_BEGIN PM_ATTACHMENTS
global $pm_info;
if($pm_info['pm_attachments'] != "")
{
$attachments = explode(chr(0), $pm_info['pm_attachments']);
$i = 0;
foreach($attachments as $a)
{
list($timestamp, $fromid, $rand, $filename) = explode("_", $a, 4);
$ret .= "<a href='".e_SELF."?get.{$pm_info['pm_id']}.{$i}'>{$filename}</a><br />";
$i++;
}
$ret = substr($ret, 0, -3);
return $ret;
}
SC_END
SC_BEGIN RECEIPT
global $pm_prefs;
if (check_class($pm_prefs['receipt_class']))
{
return "<input type='checkbox' name='receipt' value='1' />".LAN_PM_10;
}
return "";
SC_END
SC_BEGIN INBOX_TOTAL
$pm_inbox = pm_getInfo('inbox');
return $pm_inbox['inbox']['total'];
SC_END
SC_BEGIN INBOX_UNREAD
$pm_inbox = pm_getInfo('inbox');
return intval($pm_inbox['inbox']['unread']);
SC_END
SC_BEGIN INBOX_FILLED
$pm_inbox = pm_getInfo('inbox');
return (intval($pm_inbox['inbox']['filled']) > 0 ? $pm_inbox['inbox']['filled'] : "");
SC_END
SC_BEGIN OUTBOX_TOTAL
$pm_outbox = pm_getInfo('outbox');
return $pm_outbox['outbox']['total'];
SC_END
SC_BEGIN OUTBOX_UNREAD
$pm_outbox = pm_getInfo('outbox');
return intval($pm_outbox['outbox']['unread']);
SC_END
SC_BEGIN OUTBOX_FILLED
$pm_outbox = pm_getInfo('outbox');
return (intval($pm_outbox['outbox']['filled']) > 0 ? $pm_outbox['outbox']['filled'] : "");
SC_END
SC_BEGIN PM_DATE
global $pm_info;
require_once(e_HANDLER."date_handler.php");
if("lapse" != $parm)
{
return convert::convert_date($pm_info['pm_sent'], $parm);
}
else
{
return convert::computeLapse($pm_info['pm_sent']);
}
SC_END
SC_BEGIN PM_READ
global $pm_info;
if($pm_info['pm_read'] == 0)
{
return LAN_PM_27;
}
if($pm_info['pm_read'] == 1)
{
return LAN_PM_28;
}
require_once(e_HANDLER."date_handler.php");
if("lapse" != $parm)
{
return convert::convert_date($pm_info['pm_read'], $parm);
}
else
{
return convert::computeLapse($pm_info['pm_read']);
}
SC_END
SC_BEGIN PM_FROM_TO
global $pm_info, $tp;
if($pm_info['pm_from'] == USERID)
{
$ret = LAN_PM_2.": <br />";
$pm_info['user_name'] = $pm_info['sent_name'];
$ret .= $tp->parseTemplate("{PM_TO=link}");
}
else
{
$ret = LAN_PM_31.": <br />";
$pm_info['user_name'] = $pm_info['from_name'];
$ret .= $tp->parseTemplate("{PM_FROM=link}");
}
return $ret;
SC_END
SC_BEGIN PM_SUBJECT
global $pm_info, $tp;
$ret = $tp->toHTML($pm_info['pm_subject'], true, 'no_make_clickable');
if('link' == $parm)
{
$ret = "<a href='".e_PLUGIN_ABS."pm/pm.php?show.{$pm_info['pm_id']}'>".$ret."</a>";
}
return $ret;
SC_END
SC_BEGIN PM_FROM
global $pm_info;
if("link" == $parm)
{
return "<a href='".e_BASE."user.php?id.{$pm_info['pm_from']}'>{$pm_info['user_name']}</a>";
}
else
{
return $pm_info['user_name'];
}
SC_END
SC_BEGIN PM_SELECT
global $pm_info;
return "<input type='checkbox' name='selected_pm[{$pm_info['pm_id']}]' value='1' />";
SC_END
SC_BEGIN PM_READ_ICON
global $pm_info;
if($pm_info['pm_read'] > 0 )
{
return PM_READ_ICON;
}
else
{
return PM_UNREAD_ICON;
}
SC_END
SC_BEGIN PM_AVATAR
global $pm_info, $tp;
return $tp->parseTemplate("{USER_AVATAR={$pm_info['user_image']}}");
SC_END
SC_BEGIN PM_BLOCK_USER
global $pm_info, $pm_blocks;
if(in_array($pm_info['pm_from'], $pm_blocks))
{
return "<a href='".e_PLUGIN_ABS."pm/pm.php?unblock.{$pm_info['pm_from']}'><img src='".e_PLUGIN_ABS."pm/images/mail_unblock.png' title='".LAN_PM_51."' alt='".LAN_PM_51."' style='width: 16px; height: 16px; border: 0px' /></a>";
}
else
{
return "<a href='".e_PLUGIN_ABS."pm/pm.php?block.{$pm_info['pm_from']}'><img src='".e_PLUGIN_ABS."pm/images/mail_block.png' title='".LAN_PM_50."' alt='".LAN_PM_50."' style='width: 16px; height: 16px; border: 0px' /></a>";
}
SC_END
SC_BEGIN PM_DELETE
global $pm_info;
$extra = $parm != "" ? ".{$parm}" : "";
return "<a href='".e_PLUGIN_ABS."pm/pm.php?del.{$pm_info['pm_id']}{$extra}'><img src='".e_PLUGIN_ABS."pm/images/mail_delete.png' title='".LAN_PM_52."' alt='".LAN_PM_52."' style='width: 16px; height: 16px; border: 0px' /></a>";
SC_END
SC_BEGIN DELETE_SELECTED
global $pm_info;
return "<input type='submit' name='pm_delete_selected' class='button' value='".LAN_PM_53."' />";
SC_END
SC_BEGIN PM_TO
global $pm_info;
if(is_numeric($pm_info['pm_to']))
{
if("link" == $parm)
{
return "<a href='".e_BASE."user.php?id.{$pm_info['pm_to']}'>{$pm_info['user_name']}</a>";
}
else
{
return $pm_info['user_name'];
}
}
else
{
return LAN_PM_63." ".$pm_info['pm_to'];
}
SC_END
SC_BEGIN PM_MESSAGE
global $pm_info, $tp;
return $tp->toHTML($pm_info['pm_text'], true);
SC_END
SC_BEGIN PM_REPLY
global $pm_info;
if($pm_info['pm_to'] == USERID)
{
$ret = "
<form method='post' action='".e_SELF."?reply.{$pm_info['pm_id']}'>
<input type='checkbox' name='quote' /> ".LAN_PM_54." &nbsp;&nbsp;&nbsp<input class='button' type='submit' name='reply' value='".LAN_PM_55."' />
</form>
";
return $ret;
}
SC_END
SC_BEGIN SEND_PM_LINK
$pm_outbox = pm_getInfo('outbox');
if($pm_outbox['outbox']['filled'] < 100)
{
return "<a href='".e_PLUGIN_ABS."pm/pm.php?send'>".PM_SEND_LINK."</a>";
}
return "";
SC_END
SC_BEGIN NEWPM_ANIMATE
global $pm_prefs, $pm_inbox;
if($pm_prefs['animate'])
{
$pm_inbox = pm_getInfo('inbox');
if($pm_inbox['inbox']['new'] > 0)
{
return NEWPM_ANIMATION;
}
}
return "";
SC_END
SC_BEGIN PM_NEXTPREV
global $pmlist, $tp, $pm_start, $pm_prefs, $pmlist;
return $tp->parseTemplate("{NEXTPREV={$pmlist['total_messages']},{$pm_prefs['perpage']},{$pm_start},".e_SELF."?{$parm}.[FROM]}");
SC_END
*/
?>

24
e107_plugins/pm/pm_sql.php Executable file
View File

@@ -0,0 +1,24 @@
CREATE TABLE private_msg (
pm_id int(10) unsigned NOT NULL auto_increment,
pm_from int(10) unsigned NOT NULL default '0',
pm_to varchar(250) NOT NULL default '',
pm_sent int(10) unsigned NOT NULL default '0',
pm_read int(10) unsigned NOT NULL default '0',
pm_subject text NOT NULL,
pm_text text NOT NULL,
pm_sent_del tinyint(1) unsigned NOT NULL default '0',
pm_read_del tinyint(1) unsigned NOT NULL default '0',
pm_attachments text NOT NULL,
pm_option varchar(250) NOT NULL default '',
pm_size int(10) unsigned NOT NULL default '0',
PRIMARY KEY (pm_id)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
CREATE TABLE private_msg_block (
pm_block_id int(10) unsigned NOT NULL auto_increment,
pm_block_from int(10) unsigned NOT NULL default '0',
pm_block_to int(10) unsigned NOT NULL default '0',
pm_block_datestamp int(10) unsigned NOT NULL default '0',
pm_block_count int(10) unsigned NOT NULL default '0',
PRIMARY KEY (pm_block_id)
) TYPE=MyISAM AUTO_INCREMENT=1 ;

194
e107_plugins/pm/pm_template.php Executable file
View File

@@ -0,0 +1,194 @@
<?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/pm/pm_template.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:39 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
global $sc_style;
define("PM_READ_ICON", "<img src='".e_PLUGIN."/pm/images/read.png' style='height:16px; width:16px; border:0px' alt='".LAN_PM_111."' />");
define("PM_UNREAD_ICON", "<img src='".e_PLUGIN."/pm/images/unread.png' style='height:16px; width:16px; border:0px' alt='".LAN_PM_27."' />");
$sc_style['PM_ATTACHMENT_ICON']['pre'] = " ";
$sc_style['PM_ATTACHMENTS']['pre'] = "<br /><div style='vertical-align:bottom; text-align:left;'>";
$sc_style['PM_ATTACHMENTS']['post'] = "</div>";
$sc_style['PM_NEXTPREV']['pre'] = "<tr><td class='forumheader' colspan='6' style='text-align:left'> ".LAN_PM_59;
$sc_style['PM_NEXTPREV']['post'] = "</td></tr>";
$sc_style['EMOTES']['pre'] = "
<tr>
<td class='forumheader3'>".LAN_PM_7.": </td>
<td class='forumheader3'>
";
$sc_style['EMOTES']['post'] = "</td></tr>";
$sc_style['ATTACHMENT']['pre'] = "
<tr>
<td class='forumheader3'>".LAN_PM_8.": </td>
<td class='forumheader3'>
";
$sc_style['ATTACHMENT']['post'] = "</td></tr>";
$sc_style['RECEIPT']['pre'] = "
<tr>
<td class='forumheader3'>".LAN_PM_9.": </td>
<td class='forumheader3'>
";
$sc_style['RECEIPT']['post'] = "</td></tr>";
$sc_style['PM_REPLY']['pre'] = "<tr>
<td class='forumheader' style='text-align:center' colspan='2'>
";
$sc_style['PM_REPLY']['post'] = "</td>
</tr>
";
$PM_SEND_PM = "<div style='text-align: center'>
<table style='width:95%' class='fborder'>
<tr>
<td colspan='2' class='fcaption'>".LAN_PM_1.": </td>
</tr>
<tr>
<td class='forumheader3' style='width: 30%'>".LAN_PM_2.": </td>
<td class='forumheader3' style='width: 70%; text-align:left'>{FORM_TOUSER}<br />{FORM_TOCLASS}</td>
</tr>
<tr>
<td class='forumheader3'>".LAN_PM_5.": </td>
<td class='forumheader3'>{FORM_SUBJECT}</td>
</tr>
<tr>
<td class='forumheader3'>".LAN_PM_6.": </td>
<td class='forumheader3'>{FORM_MESSAGE}</td>
</tr>
{EMOTES}
{ATTACHMENT}
{RECEIPT}
<tr>
<td class='forumheader' colspan='2' style='text-align:center;'>{PM_POST_BUTTON}</td>
</tr>
</table>
</div>
";
$PM_INBOX_HEADER = "
<table class='fborder' style='width:95%'>
<tr>
<td class='fcaption' style='width:1%'>&nbsp;</td>
<td class='fcaption' style='width:1%'>&nbsp;</td>
<td class='fcaption' style='width:38%'>".LAN_PM_5."</td>
<td class='fcaption' style='width:22%'>".LAN_PM_31."</td>
<td class='fcaption' style='width:30%'>".LAN_PM_32."</td>
<td class='fcaption' style='width:8%'>&nbsp;</td>
</tr>
";
$PM_INBOX_TABLE = "
<tr>
<td class='forumheader3'>{PM_SELECT}</td>
<td class='forumheader3'>{PM_READ_ICON}</td>
<td class='forumheader3'>{PM_SUBJECT=link}{PM_ATTACHMENT_ICON}</td>
<td class='forumheader3'>{PM_FROM=link}</td>
<td class='forumheader3'>{PM_DATE}</td>
<td class='forumheader3' style='text-align: center; white-space: nowrap'>{PM_DELETE=inbox}&nbsp;{PM_BLOCK_USER}</td>
</tr>
";
$PM_INBOX_EMPTY = "
<tr>
<td colspan='6' class='forumheader'>".LAN_PM_34."</td>
</tr>
";
$PM_INBOX_FOOTER = "
<tr>
<td class='forumheader' colspan='6' style='text-align:center'>
{DELETE_SELECTED}
</td>
</tr>
{PM_NEXTPREV=inbox}
</table>
";
$PM_OUTBOX_HEADER = "
<table class='fborder' style='width:95%'>
<tr>
<td class='fcaption' style='width:1%'>&nbsp;</td>
<td class='fcaption' style='width:1%'>&nbsp;</td>
<td class='fcaption' style='width:38%'>".LAN_PM_5."</td>
<td class='fcaption' style='width:22%'>".LAN_PM_2."</td>
<td class='fcaption' style='width:30%'>".LAN_PM_33."</td>
<td class='fcaption' style='width:8%'>&nbsp;</td>
</tr>
";
$PM_OUTBOX_TABLE = "
<tr>
<td class='forumheader3'>{PM_SELECT}</td>
<td class='forumheader3'>{PM_READ_ICON}</td>
<td class='forumheader3'>{PM_SUBJECT=link}{PM_ATTACHMENT_ICON}</td>
<td class='forumheader3'>{PM_TO=link}</td>
<td class='forumheader3'>{PM_DATE}</td>
<td class='forumheader3' style='text-align: center'>{PM_DELETE=outbox}</td>
</tr>
";
$PM_OUTBOX_EMPTY = "
<tr>
<td colspan='6' class='forumheader'>".LAN_PM_34."</td>
</tr>
";
$PM_OUTBOX_FOOTER = "
<tr>
<td class='forumheader' colspan='6' style='text-align:center'>
{DELETE_SELECTED}
</td>
</tr>
{PM_NEXTPREV=outbox}
</table>
";
$PM_SHOW =
"<div style='text-align: center'>
<table class='fborder' style='width:95%'>
<tr>
<td class='fcaption' colspan='2'>{PM_SUBJECT}</td>
</tr>
<tr>
<td class='forumheader3' style='width:20%; vertical-align:top'>
{PM_FROM_TO}
<br />
<br />
<span class='smalltext'>".LAN_PM_29.":<br />{PM_DATE}</span>
<br />
<br />
<span class='smalltext'>".LAN_PM_30.":<br />{PM_READ}</span>
<br />
<br />
{PM_DELETE}
</td>
<td class='forumheader3' style='width:80%; vertical-align:top'>{PM_MESSAGE}<br /><br />{PM_ATTACHMENTS}</td>
</tr>
{PM_REPLY}
</table>
</div>
";
?>

View File

@@ -0,0 +1,113 @@
<?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/pm/pm_update.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:39 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
set_time_limit(300);
@include_once(e_PLUGIN."pm/languages/admin/".e_LANGUAGE.".php");
@include_once(e_PLUGIN."pm/languages/admin/English.php");
$sql->db_Update("plugin", "plugin_name=".ADLAN_PM." WHERE plugin_path='pm'");
require_once(e_HANDLER.'plugin_class.php');
$plugin = new e107plugin;
$sql -> db_Select_gen("
CREATE TABLE ".MPREFIX."private_msg (
pm_id int(10) unsigned NOT NULL auto_increment,
pm_from int(10) unsigned NOT NULL default '0',
pm_to varchar(250) NOT NULL default '',
pm_sent int(10) unsigned NOT NULL default '0',
pm_read int(10) unsigned NOT NULL default '0',
pm_subject text NOT NULL,
pm_text text NOT NULL,
pm_sent_del tinyint(1) unsigned NOT NULL default '0',
pm_read_del tinyint(1) unsigned NOT NULL default '0',
pm_attachments text NOT NULL,
pm_option varchar(250) NOT NULL default '',
pm_size int(10) unsigned NOT NULL default '0',
PRIMARY KEY (pm_id)
) TYPE=MyISAM AUTO_INCREMENT=1 ;");
$sql -> db_Select_gen("
CREATE TABLE ".MPREFIX."private_msg_block (
pm_block_id int(10) unsigned NOT NULL auto_increment,
pm_block_from int(10) unsigned NOT NULL default '0',
pm_block_to int(10) unsigned NOT NULL default '0',
pm_block_datestamp int(10) unsigned NOT NULL default '0',
pm_block_count int(10) unsigned NOT NULL default '0',
PRIMARY KEY (pm_block_id)
) TYPE=MyISAM AUTO_INCREMENT=1 ;");
$plugin -> manage_plugin_prefs('add', 'plug_sc', 'pm', 'SENDPM');
pm_convert();
function pm_convert()
{
global $sql, $uinfo;
$sql2 =& new db;
$count = 0;
if($sql->db_Select("pm_messages","*"))
{
while($row = $sql->db_Fetch())
{
$from = pm_convert_uid($row['pm_from_user']);
$to = pm_convert_uid($row['pm_to_user']);
$size = strlen($row['pm_message']);
if($sql2->db_Insert("private_msg", "0, '".intval($from)."', '{$to}', '".intval($row['pm_sent_datestamp'])."', '".intval($row['pm_rcv_datestamp'])."', '{$row['pm_subject']}', '{$row['pm_message']}', '0', '0', '', '', '".intval($size)."'"))
{
//Insertion of new PM successful, delete old
$sql2->db_Delete("pm_messages", "pm_id='{$row['pm_id']}'");
$count++;
}
}
}
}
function pm_convert_uid($name)
{
global $uinfo, $tp;
$sqlu =& new db;
$name = trim($name);
if(!array_key_exists($uinfo[$name]))
{
if($sqlu->db_Select("user", "user_id", "user_name LIKE '".$tp -> todb($name, TRUE)."'"))
{
$row = $sqlu->db_Fetch();
$uinfo[$name] = $row['user_id'];
}
else
{
if($sqlu->db_Select("user", "user_id", "user_loginname LIKE '".$tp -> todb($name, TRUE)."'"))
{
$row = $sqlu->db_Fetch();
$uinfo[$name] = $row['user_id'];
}
else
{
return FALSE;
}
}
}
return $uinfo[$name];
}
?>

View File

@@ -0,0 +1,40 @@
<?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/pm/pm_update_check.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:39 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
include_lan(e_PLUGIN."pm/languages/admin/".e_LANGUAGE.".php");
$dbupdatep['pm_07'] = LAN_UPDATE_8." .617 ".ADLAN_PM_58." ".LAN_UPDATE_9." .7 ".ADLAN_PM_58;
function update_pm_07($type) {
global $sql, $mySQLdefaultdb;
if ($type == 'do') {
include_once(e_PLUGIN.'pm/pm_update.php');
} else {
if ($sql -> db_Select("plugin", "*", "plugin_path = 'pm_menu' AND plugin_installflag='1'")) {
if ($sql -> db_Count('pm_messages', '(*)')) {
return FALSE;
} else {
return TRUE;
}
} else {
return TRUE;
}
}
}
?>

View File

@@ -0,0 +1,113 @@
<?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/pm/private_msg_menu.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:39 $
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
global $sysprefs, $pref, $pm_prefs;
if(!isset($pm_prefs['perpage']))
{
$pm_prefs = $sysprefs->getArray("pm_prefs");
}
require_once(e_PLUGIN."pm/pm_func.php");
pm_getInfo('clear');
define("PM_INBOX_ICON", "<img src='".e_PLUGIN."pm/images/mail_get.png' style='height:16px; width:16px; border:0px;' alt='".LAN_PM_25."' title='".LAN_PM_25."' />");
define("PM_OUTBOX_ICON", "<img src='".e_PLUGIN."pm/images/mail_send.png' style='height:16px; width:16px; border:0px;' alt='".LAN_PM_26."' title='".LAN_PM_26."' />");
define("PM_SEND_LINK", LAN_PM_35);
define("NEWPM_ANIMATION", "<img src='".e_PLUGIN."pm/images/newpm.gif' alt='' style='border:0' />");
$sc_style['SEND_PM_LINK']['pre'] = "<br /><br />[ ";
$sc_style['SEND_PM_LINK']['post'] = " ]";
$sc_style['INBOX_FILLED']['pre'] = "[";
$sc_style['INBOX_FILLED']['post'] = "%]";
$sc_style['OUTBOX_FILLED']['pre'] = "[";
$sc_style['OUTBOX_FILLED']['post'] = "%]";
$sc_style['NEWPM_ANIMATE']['pre'] = "<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>";
$sc_style['NEWPM_ANIMATE']['post'] = "</a>";
if(!defined($pm_menu_template))
{
$pm_menu_template = "
<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>".PM_INBOX_ICON."</a>
<a href='".e_PLUGIN_ABS."pm/pm.php?inbox'>".LAN_PM_25."</a>
{NEWPM_ANIMATE}
<br />
{INBOX_TOTAL} ".LAN_PM_36.", {INBOX_UNREAD} ".LAN_PM_37." {INBOX_FILLED}
<br />
<a href='".e_PLUGIN_ABS."pm/pm.php?outbox'>".PM_OUTBOX_ICON."</a>
<a href='".e_PLUGIN_ABS."pm/pm.php?outbox'>".LAN_PM_26."</a><br />
{OUTBOX_TOTAL} ".LAN_PM_36.", {OUTBOX_UNREAD} ".LAN_PM_37." {OUTBOX_FILLED}
{SEND_PM_LINK}
";
}
if(check_class($pm_prefs['pm_class']))
{
global $tp, $pm_inbox;
$pm_inbox = pm_getInfo('inbox');
require_once(e_PLUGIN."pm/pm_shortcodes.php");
$txt = $tp->parseTemplate($pm_menu_template, TRUE, $pm_shortcodes);
if($pm_inbox['inbox']['new'] > 0 && $pm_prefs['popup'] && strpos(e_SELF, "pm.php") === FALSE && $_COOKIE["pm-alert"] != "ON")
{
$txt .= pm_show_popup();
}
$ns->tablerender(LAN_PM, $txt, 'pm');
}
function pm_show_popup()
{
global $pm_inbox, $pm_prefs;
$alertdelay = intval($pm_prefs['popup_delay']);
if($alertdelay == 0) { $alertdalay = 60; }
setcookie("pm-alert", "ON", time()+$alertdelay);
$popuptext = "
<html>
<head>
<title>".$pm_inbox['inbox']['new']." ".LAN_PM_109."</title>
<link rel=stylesheet href=" . THEME . "style.css>
</head>
<body style=\'padding-left:2px;padding-right:2px; padding:2px; padding-bottom:2px; margin:0px; text-align:center\' marginheight=\'0\' marginleft=\'0\' topmargin=\'0\' leftmargin=\'0\'>
<table style=\'width:100%; text-align:center; height:99%; padding-bottom:2px\' class=\'bodytable\'>
<tr>
<td width=100% >
<center><b>--- ".LAN_PM." ---</b><br />".$pm_inbox['inbox']['new']." ".LAN_PM_109."<br />".$pm_inbox['inbox']['unread']." ".LAN_PM_37."<br /><br />
<form>
<input class=\'button\' type=\'submit\' onclick=\'self.close();\' value = \'".LAN_PM_110."\' />
</form>
</center>
</td>
</tr>
</table>
</body>
</html> ";
$popuptext = str_replace("\n", "", $popuptext);
$popuptext = str_replace("\t", "", $popuptext);
$text .= "
<script type='text/javascript'>
winl=(screen.width-200)/2;
wint = (screen.height-100)/2;
winProp = 'width=200,height=100,left='+winl+',top='+wint+',scrollbars=no';
window.open('javascript:document.write(\"".$popuptext."\");', 'pm_popup', winProp);
</script >";
return $text;
}
?>

20
e107_plugins/pm/sendpm.sc Normal file
View File

@@ -0,0 +1,20 @@
@include_once(e_PLUGIN."pm/languages/".e_LANGUAGE.".php");
@include_once(e_PLUGIN."pm/languages/English.php");
global $sysprefs, $pm_prefs;
$pm_prefs = $sysprefs->getArray("pm_prefs");
if(check_class($pm_prefs['pm_class']))
{
if(file_exists(THEME."forum/pm.png"))
{
$img = "<img src='".THEME."forum/pm.png' alt='".LAN_PM."' title='".LAN_PM."' style='border:0' />";
}
else
{
$img = "<img src='".e_PLUGIN."pm/images/pm.png' alt='".LAN_PM."' title='".LAN_PM."' style='border:0' />";
}
return "<a href='".e_PLUGIN."pm/pm.php?send.{$parm}'>{$img}</a>";
}
else
{
return "";
}