1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-08 15:46:44 +02:00

Merge pull request #6 from e107inc/master

Update e107
This commit is contained in:
rica-carv
2016-04-19 09:08:03 +01:00
19 changed files with 399 additions and 107 deletions

47
.codeclimate.yml Normal file
View File

@@ -0,0 +1,47 @@
---
engines:
csslint:
enabled: false
duplication:
enabled: true
config:
languages:
- javascript
- php
eslint:
enabled: false
fixme:
enabled: false
phpmd:
enabled: true
checks:
Identical code:
enabled: false
CleanCode/StaticAccess:
enabled: false
CleanCode/BooleanArgumentFlag:
enabled: false
UnusedFormalParameter:
enabled: false
Design/TooManyFields:
enabled: false
config:
file_extensions: "php"
rulesets: "cleancode,unusedcode,codesize"
ratings:
paths:
- "**.css"
- "**.js"
- "**.php"
exclude_paths:
- e107_admin/core_image.php
- e107_plugins/log/js/awesomechart.js
- e107_docs/**/*
- e107_images/**/*
- e107_handlers/hybridauth/**/*
- e107_handlers/jsshrink/**/*
- e107_handlers/phpmailer/**/*
- e107_handlers/phpthumb/**/*
- e107_handlers/xmlrpc/**/*
- e107_web/**/*

View File

@@ -191,7 +191,7 @@ class file_inspector {
$this->setOptions($_GET);
}
$lang_short = array();
foreach($langs as $k=>$val)
{
if($val == "English") // Core release language, so ignore it.
@@ -853,7 +853,8 @@ class file_inspector {
$parent_expand = TRUE;
}
if (!empty($this->opt('regex')))
$regexOpt = $this->opt('regex');
if (!empty($regexOpt))
{
$file_content = file($dir.'/'.$readdir);
if ($this -> files[$dir_id][$aid]['lines'] = preg_grep("#".$_POST['regex']."#".$_POST['mod'], $file_content))
@@ -1398,7 +1399,7 @@ class file_inspector {
echo "<div class='{$disp}' style='display:block;position:absolute;top:20px;width:100%;'>
echo "<div style='display:block;position:absolute;top:20px;width:100%;'>
<div style='width:700px;position:relative;margin-left:auto;margin-right:auto;text-align:center'>";
$active = "active";
@@ -1428,7 +1429,7 @@ class file_inspector {
<img src='".THEME."images/bar.jpg' style='width:".$inc."%;height:20px;vertical-align:top' />
</div>";
*/
/*
echo "<div style='width:100%;background-color:#EEEEEE'>".$diz."</div>";
@@ -1440,7 +1441,7 @@ class file_inspector {
echo "</div>
</div>";
*/
}
@@ -1585,26 +1586,107 @@ require_once(e_ADMIN.'footer.php');
function headerjs()
{
$c = e_IMAGE_ABS . 'fileinspector/contract.png';
/*$c = e_IMAGE_ABS . 'fileinspector/contract.png';
$e = e_IMAGE_ABS . 'fileinspector/expand.png';
$text = '<script type="text/javascript">
function ec(element) {
$("#d_"+element).stop().animate({"height": "toggle"}, { duration: 500 });
var $img = $("#e_"+element);
if ($img.attr("src") == "' . $e . '") {
$img.attr("src", "' . $c . '");
} else {
$img.attr("src", "' . $e . '");
}
function ec(element) {
$("#d_"+element).stop().animate({"height": "toggle"}, { duration: 500 });
var $img = $("#e_"+element);
if ($img.attr("src") == "' . $e . '") {
$img.attr("src", "' . $c . '");
} else {
$img.attr("src", "' . $e . '");
}
}
function sh(element) {
$("#"+element).stop().animate({"height": "toggle"}, { duration: 500 });
}
</script>';*/
/*
* // Start of rework
e107::js('footer-inline', "
c = new Image();
c = '".SITEURLBASE.e_IMAGE_ABS."fileinspector/contract.png';
e = '".SITEURLBASE.e_IMAGE_ABS."fileinspector/expand.png';
function ec(ecid) {
icon = $('#e_' + ecid).src;
if (icon == e) {
$('#e_' + ecid).src = c;
} else {
$('#e_' + ecid).src = e;
}
div = $('#d_' + ecid).style;
if (div.display == 'none')
{
div.display = '';
}
else
{
div.display = 'none';
}
}
function sh(element) {
$("#"+element).stop().animate({"height": "toggle"}, { duration: 500 });
var hideid = 'initial';
function sh(showid)
{
if (hideid != showid)
{
show = $('#'+showid).style;
hide = $('#'+hideid).style;
show.display = '';
hide.display = 'none';
hideid = showid;
}
}
</script>';
$text .= "
");*/
global $e107;
$text = "<script type='text/javascript'>
<!--
c = new Image(); c = '".SITEURLBASE.e_IMAGE_ABS."fileinspector/contract.png';
e = '".SITEURLBASE.e_IMAGE_ABS."fileinspector/expand.png';
function ec(ecid) {
icon = document.getElementById('e_' + ecid).src;
if (icon == e) {
document.getElementById('e_' + ecid).src = c;
} else {
document.getElementById('e_' + ecid).src = e;
}
div = document.getElementById('d_' + ecid).style;
if (div.display == 'none') {
div.display = '';
} else {
div.display = 'none';
}
}
var hideid = 'initial';
function sh(showid) {
if (hideid != showid) {
show = document.getElementById(showid).style;
hide = document.getElementById(hideid).style;
show.display = '';
hide.display = 'none';
hideid = showid;
}
}
//-->
</script>";
$text .= "
<style type='text/css'>
<!--\n";
if (vartrue($_POST['regex'])) {

View File

@@ -2215,14 +2215,19 @@ class pluginBuilder
}
if(vartrue($_POST['step']) == 3)
if(vartrue($_GET['step']) == 3)
{
$this->step3();
return;
return null;
}
if(vartrue($_POST['step']) == 4)
{
$this->step4();
return null;
}
if(vartrue($_GET['newplugin']) && $_GET['step']==2)
{
@@ -2231,7 +2236,7 @@ class pluginBuilder
return $this->step1();
$this->step1();
}
@@ -2259,7 +2264,7 @@ class pluginBuilder
$info = EPL_ADLAN_102;
$info .= "<ul>";
$info .= "<li>".str_replace('[x]', e_PLUGIN, EPL_ADLAN_103)."</li>";
$info .= "<li>".EPL_ADLAN_104."</li>";
// $info .= "<li>".EPL_ADLAN_104."</li>";
$info .= "<li>".EPL_ADLAN_105."</li>";
$info .= "<li>".EPL_ADLAN_106."</li>";
$info .= "</ul>";
@@ -2323,9 +2328,31 @@ class pluginBuilder
}
/**
* @param string $table
* @param string $file
*/
private function buildSQLFile($table, $file)
{
$table = e107::getParser()->filter($table);
e107::getDb()->gen("SHOW CREATE TABLE `#".$table."`");
$data = e107::getDb()->fetch('num');
if(!empty($data[1]))
{
$createData = str_replace("`".MPREFIX, '`', $data[1]);
$createData .= ";";
file_put_contents($file,$createData);
}
}
function step2()
function step3()
{
require_once(e_HANDLER."db_verify_class.php");
@@ -2334,19 +2361,19 @@ class pluginBuilder
$frm = e107::getForm();
$ns = e107::getRender();
$mes = e107::getMessage();
$tp = e107::getParser();
$newplug = $_GET['newplugin'];
$newplug = $tp->filter($_GET['newplugin']);
$this->pluginName = $newplug;
// $data = e107::getXml()->loadXMLfile(e_PLUGIN.'links_page/plugin.xml', 'advanced');
// print_a($data);
// echo "<pre>".var_export($data,true)."</pre>";
$sqlFile = e_PLUGIN.$newplug."/".$newplug."_sql.php";
if(!empty($_GET['build']) && !file_exists($sqlFile))
{
$this->buildSQLFile($_GET['build'], $sqlFile);
}
$ret = array();
if(file_exists($sqlFile))
@@ -2356,9 +2383,8 @@ class pluginBuilder
}
else
{
// $ret = $this->buildTables();
// $this->buildTable = true;
e107::getDebug()->log("SQL File Not Found");
// $this->buildTable = true;
}
$text = $frm->open('newplugin-step3','post', e_SELF.'?mode=create&newplugin='.$newplug.'&createFiles='.$this->createFiles.'&step=3');
@@ -2372,20 +2398,13 @@ class pluginBuilder
{
foreach($ret['tables'] as $key=>$table)
{
if($this->buildTable == true)
{
$label = "<span class='form-inline'>".$frm->checkbox('buildTable',1,false)." Build Table</span>";
}
else
{
$label = "Table: ".$table;
}
$label = "Table: ".$table;
$text .= "<li><a data-toggle='tab' href='#".$table."'>".$label."</a></li>";
$this->tableList[] = $table;
}
}
$text .= "<li><a data-toggle='tab' href='#preferences'>".LAN_PREFS."</a></li>";
$text .= "<li><a data-toggle='tab' href='#addons'>Addons</a></li>"; //TODO LAN
@@ -2408,6 +2427,10 @@ class pluginBuilder
$text .= "</div>";
}
}
$text .= "<div class='tab-pane' id='preferences'>\n";
$text .= $this->prefs();
$text .= "</div>";
@@ -2429,7 +2452,7 @@ class pluginBuilder
$text .= "
<div class='buttons-bar center'>
".$frm->hidden('newplugin', $this->pluginName)."
".$frm->admin_button('step', 3,'other', LAN_GENERATE)."
".$frm->admin_button('step', 4,'other', LAN_GENERATE)."
</div>";
$text .= $frm->close();
@@ -2444,29 +2467,74 @@ class pluginBuilder
private function buildTables()
private function step2()
{
$template = "plugin_id int(10) unsigned NOT NULL auto_increment,
plugin_datestamp int(10) unsigned NOT NULL default '0',
plugin_name varchar(255) NOT NULL default '',
plugin_text text NOT NULL,
plugin_boolean tinyint(1) unsigned NOT NULL default '0',
plugin_author int(10) unsigned default NULL,
plugin_visibility int(4) NOT NULL default '0',
plugin_tags varchar(255) NOT NULL default '',
plugin_order int(6) unsigned NOT NULL default '0',
PRIMARY KEY (plugin_id)";
$ret = array();
$frm = e107::getForm();
$ret['tables'] = array($this->pluginName);
$tables = e107::getDb()->tables();
$ret['data'] = array(0=> str_replace("plugin", $this->pluginName, $template) );
$ret['engine'] = array('0'=> 'InnoDB');
$text = $frm->open('buildTab', 'get', e_REQUEST_SELF);
return $ret;
$text .= "<table class='table adminform'>
<tr><td colspan='2'><h4>".ucfirst(LAN_OPTIONAL)."</h4></td></tr>
<tr>
<td class='col-label'>To generate your <em>".$this->pluginName."_sql.php</em> table creation file, please select your sql table then click 'Refresh'</td>
<td class='form-inline'>";
$text .= $frm->select('build', $tables, null, array('useValues'=>1), "(".LAN_OPTIONAL.")");
// $text .= "<a href='#' id='build-table-submit' class='btn btn-success'>Refresh</a>";
// $text .= $frm->button('step', 3, 'submit', "Continue");
unset($_GET['step']);
foreach($_GET as $k=>$v)
{
$text .= $frm->hidden($k,$v);
}
// $text .= $frm->hidden("build_table_url", e_REQUEST_SELF.'?'.$qry, array('id'=>'build-table-url'));
$text .= "</td></tr>
<tr><td>&nbsp;</td><td>
".$frm->button('step', 3, 'submit', LAN_CONTINUE)."
</td></tr></table>";
$text .= $frm->close();
/*
e107::js('footer-inline','
$(document).on("click", "#build-table-submit", function(e){
e.preventDefault();
$(this).addClass("disabled");
var url = $("#build-table-url").val();
var sel = $("#build-table-tbl").val();
url = url + "&build=" + sel;
window.location.href = url;
return false;
});
');*/
$ns = e107::getRender();
$ns->tablerender(ADLAN_98.SEP.EPL_ADLAN_114.SEP.EPL_ADLAN_115, $text);
return $text;
}
@@ -3470,7 +3538,7 @@ TEMPLATE;
// ******************************** CODE GENERATION AREA *************************************************
function step3()
function step4()
{
$pluginTitle = $_POST['xml']['main-name'] ;

View File

@@ -1637,7 +1637,7 @@ class e_parse extends e_parser
case 'html' : // This overrides and deprecates html.bb
$proc_funcs = TRUE;
$noBreak = TRUE;
// $code_text = str_replace("\r\n", " ", $code_text);
// $code_text = html_entity_decode($code_text, ENT_QUOTES, CHARSET);
// $code_text = str_replace('&','&amp;',$code_text); // validation safe.
@@ -1697,17 +1697,15 @@ class e_parse extends e_parser
// Do the 'normal' processing - in principle, as previously - but think about the order.
if ($proc_funcs && !empty($full_text)) // some more speed
{
// Split out and ignore any scripts and style blocks. With just two choices we can match the closing tag in the regex
$subcon = preg_split('#((?:<s)(?:cript[^>]+>.*?</script>|tyle[^>]+>.*?</style>))#mis', $full_text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE );
foreach ($subcon as $sub_blk)
{
if(substr($sub_blk, 0, 7) == '<script')
if(substr($sub_blk, 0, 7) == '<script') // Strip scripts unless permitted
{
if($opts['scripts'])
{
// Strip scripts unless permitted
$ret_parser .= $sub_blk;
$ret_parser .= html_entity_decode($sub_blk, ENT_QUOTES);
}
}
elseif(substr($sub_blk, 0, 6) == '<style')
@@ -3177,7 +3175,7 @@ class e_parser
'div','pre','section','article', 'blockquote','hgroup','aside','figure','figcaption', 'abbr','span', 'audio', 'video', 'br',
'small', 'caption', 'noscript', 'hr', 'section', 'iframe'
);
protected $scriptTags = array('script','applet','form','input','button'); //allowed when $pref['post_script'] is enabled.
protected $scriptTags = array('script','applet','form','input','button', 'embed', 'object'); //allowed when $pref['post_script'] is enabled.
protected $blockTags = array('pre','div','h1','h2','h3','h4','h5','h6','blockquote'); // element includes its own line-break.

View File

@@ -2454,6 +2454,18 @@ class e_form
{
$btype = 'submit';
if(strpos($action, 'action') === 0) $btype = 'button';
if(isset($options['loading']) && ($options['loading'] == false))
{
unset($options['loading']);
$include = '';
}
else
{
$include = (deftrue("FONTAWESOME")) ? "data-loading-icon='fa-spinner' data-disable='true'" : "";
}
$options = $this->format_options('admin_button', $name, $options);
$options['class'] = vartrue($options['class']);
@@ -2516,7 +2528,6 @@ class e_form
break;
}
$include = (deftrue("FONTAWESOME")) ? "data-loading-icon='fa-spinner' data-disable='true'" : "";
return "

View File

@@ -577,7 +577,10 @@ class e107Email extends PHPMailer
$message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n
<html xmlns='http://www.w3.org/1999/xhtml' >\n".$message;
}
if ($this->legacyBody && !preg_match('/<(font|br|a|img|b)/i', $message)) // Assume html if it includes one of these tags
;
// !preg_match('/<(table|div|font|br|a|img|b)/i', $message)
if ($this->legacyBody && e107::getParser()->isHtml($message) != true) // Assume html if it includes one of these tags
{ // Otherwise assume its a plain text message which needs some conversion to render in HTML
if($this->debug == true)

View File

@@ -119,8 +119,8 @@ define ('EPL_ADLAN_100',"click here to install some");
define ('EPL_ADLAN_101',"No plugins installed - [x].");
define ('EPL_ADLAN_102',"This Wizard will build an admin area for your plugin and generate a plugin.xml meta file. Before you start:");
define ('EPL_ADLAN_103',"Create a new writable folder in the [x] directory eg. [b]myplugin[/b]");
define ('EPL_ADLAN_104',"If your plugin will use sql tables, create a new file in this folder and name it the same as the directory but with [b]_sql.php[/b] as a sufix eg. [b]myplugin_sql.php[/b]");
define ('EPL_ADLAN_105',"Create your table in phpMyAdmin and paste an sql dump of it into your file and save. (see [i]e107_plugins/_blank/_blank_sql.php[/i] for an example)");
// define ('EPL_ADLAN_104',"If your plugin will use sql tables, create a new file in this folder and name it the same as the directory but with [b]_sql.php[/b] as a sufix eg. [b]myplugin_sql.php[/b]");
define ('EPL_ADLAN_105',"Create your table in phpMyAdmin in the same database as e107 and with the same table prefix.");
define ('EPL_ADLAN_106',"Select your plugin's folder to begin.");
define ('EPL_ADLAN_107',"Build an admin-area and xml file for:");
define ('EPL_ADLAN_108',"Check language files:");

View File

@@ -26,6 +26,7 @@ class banner_shortcodes extends e_shortcode
function sc_banner($parm='')
{
// $parm now can be array, old campaign $parm still allowed....
$sql = e107::getDb();
$tp = e107::getParser();
@@ -34,7 +35,16 @@ class banner_shortcodes extends e_shortcode
$seed = mt_rand(1,2000000000);
$time = time();
$query = " (banner_startdate=0 OR banner_startdate <= {$time}) AND (banner_enddate=0 OR banner_enddate > {$time}) AND (banner_impurchased=0 OR banner_impressions<=banner_impurchased)".($parm ? " AND banner_campaign='".$tp->toDB($parm)."'" : '')."
if(is_array($parm))
{
$parms = eHelper::scParams($parm);
$campaign = $parms['campaign'];
}
else
{
$campaign = $parm;
}
$query = " (banner_startdate=0 OR banner_startdate <= {$time}) AND (banner_enddate=0 OR banner_enddate > {$time}) AND (banner_impurchased=0 OR banner_impressions<=banner_impurchased)".($campaign ? " AND banner_campaign='".$tp->toDB($campaign)."'" : '')."
AND banner_active IN (".USERCLASS_LIST.") ";
if($tags = e107::getRegistry('core/form/related'))
@@ -50,7 +60,7 @@ class banner_shortcodes extends e_shortcode
if($sql->select('banner', 'banner_id, banner_image, banner_clickurl, banner_description', $query))
{
$row = $sql->fetch();
return $this->renderBanner($row);
return $this->renderBanner($row, $parm);
}
else
@@ -60,10 +70,14 @@ class banner_shortcodes extends e_shortcode
}
// Also used by banner_menu.php
public function renderBanner($row)
public function renderBanner($row, $parm = '')
{
$sql = e107::getDb('banner');
$tp = e107::getParser();
if(is_array($parm))
{
$parms = eHelper::scParams($parm);
}
if(!$row['banner_image'])
{
@@ -99,15 +113,14 @@ class banner_shortcodes extends e_shortcode
if($row['banner_image'][0] == '{')
{
$src = $row['banner_image'];
$ban_ret = $tp->toImage($src, array('class'=>'e-banner img-responsive', 'alt'=>$row['banner_clickurl']));
}
else
{
$src = e_IMAGE_ABS.'banners/'.$row['banner_image'];
$ban_ret = "<img class='e-banner img-responsive' src='".$src."' alt='".$row['banner_clickurl']."' style='border:0' />";
$style = "'border:0'";
}
$class = vartrue($parms['class']) ? $parms['class'] : "e-banner img-responsive img-rounded";
$ban_ret = $tp->toImage($src, array('class'=>$class, 'alt'=>$row['banner_clickurl'], 'style'=>$style));
break;
}
@@ -133,4 +146,4 @@ class banner_shortcodes extends e_shortcode
}
}
?>
?>

View File

@@ -909,6 +909,7 @@ class download_shortcodes extends e_shortcode
function sc_download_cat_search()
{
$tp = e107::getParser();
$text = "<form class='form-search form-inline' method='get' action='".e_BASE."search.php'>";
$text .= '<div><div class="input-group">';
$text .= "<input class='tbox form-control search-query' type='text' name='q' size='30' value='' placeholder=\"".LAN_SEARCH."\" maxlength='50' />
@@ -918,9 +919,11 @@ class download_shortcodes extends e_shortcode
$text .= '
<span class="input-group-btn">
<button class="btn btn-default" type="submit" name="s" value="1">
<span class="glyphicon glyphicon-search"></span>
</button>
<button class="btn btn-default" type="submit" name="s" value="1">';
$text .= $tp->toIcon('glyphicon-search.glyph');
$text .= '</button>
</span>
</div><!-- /input-group -->
</div></form>';

View File

@@ -60,14 +60,11 @@ class gallery
$template = array_change_key_case($template);
$sc = e107::getScBatch('gallery', true);
$text = "";
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootstrap3 to bootstrap2 compat.
{
$template['cat_start'] = str_replace('row', 'row-fluid', $template['cat_start']);
}
$text = e107::getParser()->parseTemplate($template['cat_start'], true, $sc);
foreach($this->catList as $val)
@@ -78,7 +75,7 @@ class gallery
$text .= e107::getParser()->parseTemplate($template['cat_end'], true, $sc);
$caption = $tp->parseTemplate($template['cat_caption'], true, $sc);
$caption = e107::getParser()->parseTemplate($template['cat_caption'], true, $sc);
e107::getRender()->tablerender($caption, $text);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1000 B

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -134,6 +134,10 @@ class private_msg_ui extends e_admin_ui
private function limitsPageAdd()
{
$sql = e107::getDb();
@@ -768,13 +772,49 @@ class private_msg_ui extends e_admin_ui
}
function sendTestNotify()
{
e107::includeLan(e_PLUGIN.'pm/languages/'.e_LANGUAGE.'.php');
require_once(e_PLUGIN."pm/pm_class.php");
$pmInfo = array ( 'numsent' => '1', 'pm_to' => USERID, 'pm_sent'=>time(), 'pm_userclass' => false, 'pm_subject' => 'Test Subject Random:'.md5(time()), 'pm_message' => 'Test Message '.md5(time()), 'postpm' => 'Send Private Message', 'keyword' => NULL,
'to_info' => array (
'user_id' => USERID,
'user_name' => USERNAME,
'user_class' => USERCLASS,
'user_email' => USEREMAIL,
),
'uploaded' => array ( ), 'from_id' => 1, 'options' => '', );
$pm = new private_message;
if($pm->pm_send_notify(null,$pmInfo, 1) === true)
{
e107::getMessage()->addSuccess("Test Email Sent");
}
else
{
e107::getMessage()->addError("Test Email Failed");
}
}
public function init()
{
// $this->listQry = "SELECT p.*,u.user_name FROM #private_msg AS p LEFT JOIN #user AS u ON p.pm_from = u.user_id ";
if(deftrue('e_DEVELOPER') || deftrue('e_DEBUG'))
{
$this->prefs['notify_class']['writeParms']['post']= e107::getForm()->button('testNotify', 1, 'primary', "Test");
if(!empty($_POST['testNotify']))
{
$this->sendTestNotify();
}
}
if($this->getMode() == 'inbox')
{
$this->listQry = 'SELECT p.*, u.user_name, f.user_name AS fromuser FROM #private_msg AS p LEFT JOIN #user AS u ON u.user_id = p.pm_to

View File

@@ -32,7 +32,7 @@ class private_message
* @param array $prefs - pref settings for PM plugin
* @return none
*/
public function __construct($prefs)
public function __construct($prefs=null)
{
$this->e107 = e107::getInstance();
$this->pmPrefs = $prefs; }
@@ -117,6 +117,8 @@ class private_message
$pm_options = '';
$ret = '';
$addOutbox = TRUE;
$timestamp = time();
$maxSendNow = varset($this->pmPrefs['pm_max_send'],100); // Maximum number of PMs to send without queueing them
if (isset($vars['pm_from']))
{ // Doing bulk send off cron task
@@ -161,7 +163,7 @@ class private_message
// Most of the pm info is fixed - just need to set the 'to' user on each send
$info = array(
'pm_from' => $vars['from_id'],
'pm_sent' => time(), /* Date sent */
'pm_sent' => $timestamp, /* Date sent */
'pm_read' => 0, /* Date read */
'pm_subject' => $pm_subject,
'pm_text' => $pm_message,
@@ -232,9 +234,10 @@ class private_message
{
$toclass .= $u['user_name'].', ';
}
if(check_class($this->pmPrefs['notify_class'], $u['user_class']))
if(check_class($this->pmPrefs['notify_class'], null, $u['user_id']))
{
$vars['to_info'] = $u;
$vars['pm_sent'] = $timestamp;
$this->pm_send_notify($u['user_id'], $vars, $pmid, count($a_list));
}
}
@@ -262,6 +265,7 @@ class private_message
if($pmid = $sql->insert('private_msg', $info))
{
$info['pm_id'] = $pmid;
$info['pm_sent'] = $timestamp;
e107::getEvent()->trigger('user_pm_sent', $info);
@@ -366,7 +370,7 @@ class private_message
*/
function pm_send_notify($uid, $pmInfo, $pmid, $attach_count = 0)
{
require_once(e_HANDLER.'mail.php');
// require_once(e_HANDLER.'mail.php');
$tpl_file = THEME.'pm_template.php';
@@ -388,13 +392,14 @@ class private_message
<tr><td>".LAN_PM_108."</td><td>{PM_DATE}</td></tr>
<tr><td>".LAN_PM_104."</td><td>{PM_ATTACHMENTS}</td></tr>
</table>
</table><br />
<div>".LAN_PM_105.": {PM_URL}</div>
</div>
";
}
$url = e107::url('pm','index', null, array('mode'=>'full')).'?show.'.$pmid;
$data = array();
$data['PM_SUBJECT'] = $pmInfo['pm_subject'];
@@ -402,13 +407,26 @@ class private_message
$data['PM_DATE'] = e107::getParser()->toDate($pmInfo['pm_sent'], 'long');
$data['SITENAME'] = SITENAME;
$data['USERNAME'] = USERNAME;
$data['PM_URL'] = e107::url('pm','index', null, array('mode'=>'full')).'?show.'.$pmid;;
$data['PM_URL'] = "<a href='".$url."'>".$url."</a>";// e107::url('pm','index', null, array('mode'=>'full')).'?show.'.$pmid;
$text = e107::getParser()->simpleParse($template, $data);
$subject = LAN_PM_100.SITENAME;
$eml = array();
$eml['email_subject'] = LAN_PM_100.USERNAME;
$eml['send_html'] = true;
$eml['email_body'] = $text;
$eml['template'] = 'default';
$eml['e107_header'] = $pmInfo['to_info']['user_id'];
if(e107::getEmail()->sendEmail($pmInfo['to_info']['user_email'], $pmInfo['to_info']['user_name'], $eml))
{
return true;
}
else
{
return false;
}
sendemail($pmInfo['to_info']['user_email'], $subject, $text, $pmInfo['to_info']['user_name']);
}

View File

@@ -176,7 +176,10 @@ if(!class_exists('plugin_pm_pm_shortcodes'))
else
{
$frm = e107::getForm();
$ret = $frm->userlist('pm_to',null,array('excludeSelf'=>true, 'default'=>'blank', 'classes'=>varset($this->pmPrefs['send_to_class'], e_UC_MEMBER)));
$exclude = (getperms('0') && e_DEBUG === true) ? false : true;
$ret = $frm->userlist('pm_to',null,array('excludeSelf'=>$exclude, 'default'=>'blank', 'classes'=>varset($this->pmPrefs['send_to_class'], e_UC_MEMBER)));
}

View File

@@ -277,7 +277,7 @@ $PM_NOTIFY =
<tr><td>".LAN_PM_108."</td><td>{PM_DATE}</td></tr>
<tr><td>".LAN_PM_104."</td><td>{PM_ATTACHMENTS}</td></tr>
</table>
</table><br />
<div>".LAN_PM_105.": {PM_URL}</div>
</div>
";

View File

@@ -259,16 +259,25 @@ img.image-selector { margin-bottom:0px; }
.dropdown-menu i,
.dropdown-menu img { padding: 0px 0px; margin-right: 10px; }
.nav ul li ul.dropdown-menu > li a img,
.nav ul li ul.dropdown-menu > li a i {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
filter: gray; /* IE6-9 */
-webkit-filter: grayscale(100%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */
ul.navbar-nav li ul.dropdown-menu > li a img,
ul.navbar-nav li ul.dropdown-menu > li a i {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray; /* IE 6-9 */
}
.nav ul li ul.dropdown-menu a:hover i,
.nav ul li ul.dropdown-menu a:hover img
{ filter: none; -webkit-filter: grayscale(0%); }
ul.navbar-nav li ul.dropdown-menu a:hover i,
ul.navbar-nav li ul.dropdown-menu a:hover img
{
filter: none;
-webkit-filter: none;
-moz-filter: none;
-ms-filter: none;
-o-filter: none;
}
td.options { }