mirror of
https://github.com/e107inc/e107.git
synced 2025-08-13 01:54:12 +02:00
This commit is contained in:
@@ -19,6 +19,13 @@ class private_message
|
||||
protected $e107;
|
||||
protected $pmPrefs;
|
||||
|
||||
|
||||
public function prefs()
|
||||
{
|
||||
return $this->pmPrefs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -128,6 +135,7 @@ class private_message
|
||||
{ // Send triggered by user - may be immediate or bulk dependent on number of recipients
|
||||
$vars['options'] = '';
|
||||
if(isset($vars['receipt']) && $vars['receipt']) {$pm_options .= '+rr+'; }
|
||||
|
||||
if(isset($vars['uploaded']))
|
||||
{
|
||||
foreach($vars['uploaded'] as $u)
|
||||
@@ -163,6 +171,9 @@ class private_message
|
||||
'pm_option' => $pm_options, /* Options associated with PM - '+rr' for read receipt */
|
||||
'pm_size' => $pmsize
|
||||
);
|
||||
|
||||
print_a($info);
|
||||
print_a($vars);
|
||||
}
|
||||
|
||||
if(isset($vars['to_userclass']) || isset($vars['to_array']))
|
||||
@@ -333,12 +344,12 @@ class private_message
|
||||
|
||||
/**
|
||||
* Convinient url assembling shortcut
|
||||
*/
|
||||
*//*
|
||||
public function url($action, $params = array(), $options = array())
|
||||
{
|
||||
if(strpos($action, '/') === false) $action = 'view/'.$action;
|
||||
e107::getUrl()->create('pm/'.$action, $params, $options);
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Send an email to notify of a PM
|
||||
@@ -354,8 +365,10 @@ class private_message
|
||||
{
|
||||
require_once(e_HANDLER.'mail.php');
|
||||
$subject = LAN_PM_100.SITENAME;
|
||||
// $pmlink = $this->url('show', 'id='.$pmid, 'full=1&encode=0'); //TODO broken - replace with e_url.php configuration.
|
||||
$pmlink = SITEURLBASE.e_PLUGIN_ABS."pm/pm.php?show.".$pmid;
|
||||
|
||||
// $pmlink = SITEURLBASE.e_PLUGIN_ABS."pm/pm.php?show.".$pmid;
|
||||
|
||||
$pmlink = e107::url('pm','index').'?show.'.$pmid;
|
||||
$txt = LAN_PM_101.SITENAME."\n\n";
|
||||
$txt .= LAN_PM_102.USERNAME."\n";
|
||||
$txt .= LAN_PM_103.$pmInfo['pm_subject']."\n";
|
||||
@@ -600,11 +613,13 @@ class private_message
|
||||
ORDER BY pm.pm_sent DESC
|
||||
LIMIT ".$from.", ".$limit."
|
||||
";
|
||||
|
||||
if($sql->gen($qry))
|
||||
{
|
||||
$total_messages = $sql->total_results; // Total number of messages
|
||||
$total_messages = $sql->foundRows(); // Total number of messages
|
||||
$ret['messages'] = $sql->db_getList();
|
||||
}
|
||||
|
||||
$ret['total_messages'] = $total_messages; // Should always be defined
|
||||
return $ret;
|
||||
}
|
||||
@@ -653,28 +668,56 @@ class private_message
|
||||
*
|
||||
* @return none
|
||||
*
|
||||
* @todo Can we use core send routine?
|
||||
*/
|
||||
function send_file($pmid, $filenum)
|
||||
{
|
||||
$pm_info = $this->pm_get($pmid);
|
||||
|
||||
$attachments = explode(chr(0), $pm_info['pm_attachments']);
|
||||
|
||||
if(!isset($attachments[$filenum]))
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
$fname = $attachments[$filenum];
|
||||
list($timestamp, $fromid, $rand, $file) = explode("_", $fname, 4);
|
||||
$filename = getcwd()."/attachments/{$fname}";
|
||||
|
||||
|
||||
$filename = false; // getcwd()."/attachments/{$fname}";
|
||||
|
||||
$pathList = array();
|
||||
$pathList[] = e_PLUGIN."pm/attachments/"; // getcwd()."/attachments/"; // legacy path.
|
||||
$pathList[] = e107::getFile()->getUserDir($fromid, false, 'attachments'); // new media path.
|
||||
|
||||
foreach($pathList as $path)
|
||||
{
|
||||
$tPath = $path.$fname;
|
||||
|
||||
if(is_file($tPath))
|
||||
{
|
||||
$filename = $tPath;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(empty($filename) || !is_file($filename))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if($fromid != $pm_info['pm_from'])
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if(!is_file($filename))
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// e107::getFile()->send($filename); // limited to Media and system folders. Won't work for legacy plugin path.
|
||||
// exit;
|
||||
|
||||
|
||||
|
||||
@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
|
||||
@@ -720,6 +763,12 @@ class private_message
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function updateTemplate($template)
|
||||
{
|
||||
|
Reference in New Issue
Block a user