| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
function required_param($varname, $options=PARAM_CLEAN) { |
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
global $CFG; |
|---|
| 41 |
if (!empty($CFG->detect_unchecked_vars)) { |
|---|
| 42 |
global $UNCHECKED_VARS; |
|---|
| 43 |
unset ($UNCHECKED_VARS->vars[$varname]); |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
if (isset($_POST[$varname])) { |
|---|
| 47 |
$param = $_POST[$varname]; |
|---|
| 48 |
} else if (isset($_GET[$varname])) { |
|---|
| 49 |
$param = $_GET[$varname]; |
|---|
| 50 |
} else { |
|---|
| 51 |
error('A required parameter ('.$varname.') was missing'); |
|---|
| 52 |
} |
|---|
| 53 |
|
|---|
| 54 |
return clean_param($param, $options); |
|---|
| 55 |
} |
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 |
function optional_param($varname, $default=NULL, $options=PARAM_CLEAN) { |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
global $CFG; |
|---|
| 75 |
if (!empty($CFG->detect_unchecked_vars)) { |
|---|
| 76 |
global $UNCHECKED_VARS; |
|---|
| 77 |
unset ($UNCHECKED_VARS->vars[$varname]); |
|---|
| 78 |
} |
|---|
| 79 |
|
|---|
| 80 |
if (isset($_POST[$varname])) { |
|---|
| 81 |
$param = $_POST[$varname]; |
|---|
| 82 |
} else if (isset($_GET[$varname])) { |
|---|
| 83 |
$param = $_GET[$varname]; |
|---|
| 84 |
} else { |
|---|
| 85 |
return $default; |
|---|
| 86 |
} |
|---|
| 87 |
|
|---|
| 88 |
return clean_param($param, $options); |
|---|
| 89 |
} |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
function clean_param($param, $options) { |
|---|
| 123 |
|
|---|
| 124 |
global $CFG; |
|---|
| 125 |
|
|---|
| 126 |
if (is_array($param)) { |
|---|
| 127 |
$newparam = array(); |
|---|
| 128 |
foreach ($param as $key => $value) { |
|---|
| 129 |
$newparam[$key] = clean_param($value, $options); |
|---|
| 130 |
} |
|---|
| 131 |
return $newparam; |
|---|
| 132 |
} |
|---|
| 133 |
|
|---|
| 134 |
if (!$options) { |
|---|
| 135 |
return $param; |
|---|
| 136 |
} |
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
//if ((string)$param == (string)(int)$param) { // It's just an integer |
|---|
| 140 |
// return (int)$param; |
|---|
| 141 |
//} |
|---|
| 142 |
|
|---|
| 143 |
if ($options & PARAM_CLEAN) { |
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
$param = clean_text($param); |
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
} |
|---|
| 150 |
|
|---|
| 151 |
$options & PARAM_INT) { |
|---|
| 152 |
$param = (int)$param; |
|---|
| 153 |
} |
|---|
| 154 |
|
|---|
| 155 |
$options & PARAM_ALPHA) { |
|---|
| 156 |
$param = eregi_replace('[^a-zA-Z]', '', $param); |
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 |
$options & PARAM_ALPHANUM) { |
|---|
| 160 |
$param = eregi_replace('[^A-Za-z0-9]', '', $param); |
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
$options & PARAM_ALPHAEXT) { |
|---|
| 164 |
$param = eregi_replace('[^a-zA-Z/_-]', '', $param); |
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
$options & PARAM_BOOL) { |
|---|
| 168 |
$tempstr = strtolower($param); |
|---|
| 169 |
$tempstr == 'on') { |
|---|
| 170 |
$param = 1; |
|---|
| 171 |
$tempstr == 'off') { |
|---|
| 172 |
$param = 0; |
|---|
| 173 |
|
|---|
| 174 |
$param = empty($param) ? 0 : 1; |
|---|
| 175 |
|
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 |
$options & PARAM_NOTAGS) { |
|---|
| 179 |
$param = strip_tags($param); |
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
$options & PARAM_SAFEDIR) { |
|---|
| 183 |
$param = eregi_replace('[^a-zA-Z0-9_-]', '', $param); |
|---|
| 184 |
|
|---|
| 185 |
|
|---|
| 186 |
$options & PARAM_CLEANFILE) { |
|---|
| 187 |
$param = clean_filename($param); |
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 |
$options & PARAM_FILE) { |
|---|
| 191 |
$param = ereg_replace('[[:cntrl:]]|[<>"`\|\':\\/]', '', $param); |
|---|
| 192 |
$param = ereg_replace('\.\.+', '', $param); |
|---|
| 193 |
$param == '.') { |
|---|
| 194 |
$param = ''; |
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
$options & PARAM_PATH) { |
|---|
| 199 |
$param = str_replace('\\\'', '\'', $param); |
|---|
| 200 |
$param = str_replace('\\"', '"', $param); |
|---|
| 201 |
$param = str_replace('\\', '/', $param); |
|---|
| 202 |
$param = ereg_replace('[[:cntrl:]]|[<>"`\|\':]', '', $param); |
|---|
| 203 |
$param = ereg_replace('\.\.+', '', $param); |
|---|
| 204 |
$param = ereg_replace('//+', '/', $param); |
|---|
| 205 |
$param = ereg_replace('/(\./)+', '/', $param); |
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 |
$options & PARAM_HOST) { |
|---|
| 209 |
preg_replace('/[^\.\d\w-]/','', $param ); |
|---|
| 210 |
|
|---|
| 211 |
if (preg_match('/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/',$param, $match)){ |
|---|
| 212 |
|
|---|
| 213 |
if ( $match[0] > 255 |
|---|
| 214 |
|| $match[1] > 255 |
|---|
| 215 |
|| $match[3] > 255 |
|---|
| 216 |
|| $match[4] > 255 ) { |
|---|
| 217 |
|
|---|
| 218 |
$param = ''; |
|---|
| 219 |
|
|---|
| 220 |
preg_match('/^[\w\d\.-]+$/', $param) |
|---|
| 221 |
&& !preg_match('/^[\.-]/', $param) |
|---|
| 222 |
&& !preg_match('/[\.-]$/', $param) |
|---|
| 223 |
) { |
|---|
| 224 |
|
|---|
| 225 |
} else { |
|---|
| 226 |
|
|---|
| 227 |
$param=''; |
|---|
| 228 |
|
|---|
| 229 |
|
|---|
| 230 |
|
|---|
| 231 |
$options & PARAM_URL) { |
|---|
| 232 |
|
|---|
| 233 |
include_once($CFG->dirroot . 'lib/validateurlsyntax.php'); |
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 |
|
|---|
| 241 |
|
|---|
| 242 |
|
|---|
| 243 |
|
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
|
|---|
| 249 |
|
|---|
| 250 |
|
|---|
| 251 |
|
|---|
| 252 |
if (!empty($param) && validateUrlSyntax($param, 's?H?S?F?E?u-P-a?I?p-f?q?r?')) { |
|---|
| 253 |
|
|---|
| 254 |
} else { |
|---|
| 255 |
$param =''; |
|---|
| 256 |
} |
|---|
| 257 |
$options ^= PARAM_URL; |
|---|
| 258 |
} |
|---|
| 259 |
|
|---|
| 260 |
$options & PARAM_LOCALURL) { |
|---|
| 261 |
|
|---|
| 262 |
|
|---|
| 263 |
if (!empty($param)) { |
|---|
| 264 |
preg_match(':^/:', $param)) { |
|---|
| 265 |
|
|---|
| 266 |
} elseif (preg_match('/^'.preg_quote($CFG->wwwroot, '/').'/i',$param)) { |
|---|
| 267 |
|
|---|
| 268 |
} else { |
|---|
| 269 |
|
|---|
| 270 |
if (validateUrlSyntax($param, 's-u-P-a-p-f+q?r?')) { |
|---|
| 271 |
|
|---|
| 272 |
} else { |
|---|
| 273 |
$param = ''; |
|---|
| 274 |
|
|---|
| 275 |
|
|---|
| 276 |
|
|---|
| 277 |
|
|---|
| 278 |
|
|---|
| 279 |
$options & PARAM_CLEANHTML) { |
|---|
| 280 |
|
|---|
| 281 |
$param = clean_text($param); |
|---|
| 282 |
|
|---|
| 283 |
} |
|---|
| 284 |
|
|---|
| 285 |
$param; |
|---|
| 286 |
|
|---|
| 287 |
|
|---|
| 288 |
|
|---|
| 289 |
|
|---|
| 290 |
|
|---|
| 291 |
|
|---|
| 292 |
|
|---|
| 293 |
|
|---|
| 294 |
|
|---|
| 295 |
|
|---|
| 296 |
|
|---|
| 297 |
function get_list_of_plugins($plugin='mod', $exclude='') { |
|---|
| 298 |
|
|---|
| 299 |
global $CFG; |
|---|
| 300 |
if ($plugin == 'mod') { |
|---|
| 301 |
$plugin = $CFG->dirroot . $plugin; |
|---|
| 302 |
} |
|---|
| 303 |
static $plugincache = array(); |
|---|
| 304 |
$plugincachename = $plugin . "_" . $exclude; |
|---|
| 305 |
|
|---|
| 306 |
if (isset($plugincache[$plugincachename])) { |
|---|
| 307 |
$plugins = $plugincache[$plugincachename]; |
|---|
| 308 |
} else { |
|---|
| 309 |
$plugins = array(); |
|---|
| 310 |
if ($basedir = opendir($plugin)) { |
|---|
| 311 |
while (false !== ($dir = readdir($basedir))) { |
|---|
| 312 |
$firstchar = substr($dir, 0, 1); |
|---|
| 313 |
if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf' or $dir == $exclude) { |
|---|
| 314 |
continue; |
|---|
| 315 |
} |
|---|
| 316 |
if ((filetype($plugin .'/'. $dir) != 'dir') && ((filetype($plugin .'/'. $dir) != 'link'))) { |
|---|
| 317 |
continue; |
|---|
| 318 |
} |
|---|
| 319 |
$plugins[] = $dir; |
|---|
| 320 |
} |
|---|
| 321 |
} |
|---|
| 322 |
if ($plugins) { |
|---|
| 323 |
asort($plugins); |
|---|
| 324 |
} |
|---|
| 325 |
$plugincache[$plugincachename] = $plugins; |
|---|
| 326 |
} |
|---|
| 327 |
return $plugins; |
|---|
| 328 |
} |
|---|
| 329 |
|
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
function listen_for_event($object_type, $event, $function) { |
|---|
| 333 |
|
|---|
| 334 |
global $CFG; |
|---|
| 335 |
$CFG->event_hooks[$object_type][$event][] = $function; |
|---|
| 336 |
|
|---|
| 337 |
} |
|---|
| 338 |
|
|---|
| 339 |
function plugin_hook($object_type,$event,$object = null) { |
|---|
| 340 |
|
|---|
| 341 |
global $CFG; |
|---|
| 342 |
|
|---|
| 343 |
if (!empty($CFG->event_hooks['all']['all']) && is_array($CFG->event_hooks['all']['all'])) { |
|---|
| 344 |
foreach($CFG->event_hooks['all']['all'] as $hook) { |
|---|
| 345 |
$object = $hook($object_type,$event,$object); |
|---|
| 346 |
} |
|---|
| 347 |
} |
|---|
| 348 |
if (!empty($CFG->event_hooks[$object_type]['all']) && is_array($CFG->event_hooks[$object_type]['all'])) { |
|---|
| 349 |
foreach($CFG->event_hooks[$object_type]['all'] as $hook) { |
|---|
| 350 |
$object = $hook($object_type,$event,$object); |
|---|
| 351 |
} |
|---|
| 352 |
} |
|---|
| 353 |
if (!empty($CFG->event_hooks['all'][$event]) && is_array($CFG->event_hooks['all'][$event])) { |
|---|
| 354 |
foreach($CFG->event_hooks['all'][$event] as $hook) { |
|---|
| 355 |
$object = $hook($object_type,$event,$object); |
|---|
| 356 |
} |
|---|
| 357 |
} |
|---|
| 358 |
if (!empty($CFG->event_hooks[$object_type][$event]) && is_array($CFG->event_hooks[$object_type][$event])) { |
|---|
| 359 |
foreach($CFG->event_hooks[$object_type][$event] as $hook) { |
|---|
| 360 |
$object = $hook($object_type,$event,$object); |
|---|
| 361 |
} |
|---|
| 362 |
} |
|---|
| 363 |
|
|---|
| 364 |
return $object; |
|---|
| 365 |
|
|---|
| 366 |
} |
|---|
| 367 |
|
|---|
| 368 |
function report_session_error() { |
|---|
| 369 |
global $CFG, $FULLME; |
|---|
| 370 |
|
|---|
| 371 |
|
|---|
| 372 |
setcookie('ElggSession'.$CFG->sessioncookie, '', time() - 3600, $CFG->cookiepath); |
|---|
| 373 |
setcookie('ElggSessionTest'.$CFG->sessioncookie, '', time() - 3600, $CFG->cookiepath); |
|---|
| 374 |
|
|---|
| 375 |
//if (isset($CFG->session_error_counter)) { |
|---|
| 376 |
// set_config('session_error_counter', 1 + $CFG->session_error_counter); |
|---|
| 377 |
//} else { |
|---|
| 378 |
// set_config('session_error_counter', 1); |
|---|
| 379 |
//} |
|---|
| 380 |
//called from setup.php, so gettext module hasn't been loaded yet |
|---|
| 381 |
redirect($FULLME, '', 1); |
|---|
| 382 |
} |
|---|
| 383 |
|
|---|
| 384 |
|
|---|
| 385 |
|
|---|
| 386 |
|
|---|
| 387 |
|
|---|
| 388 |
|
|---|
| 389 |
|
|---|
| 390 |
|
|---|
| 391 |
|
|---|
| 392 |
|
|---|
| 393 |
|
|---|
| 394 |
|
|---|
| 395 |
|
|---|
| 396 |
|
|---|
| 397 |
|
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 |
|
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 |
|
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 |
|
|---|
| 410 |
|
|---|
| 411 |
|
|---|
| 412 |
|
|---|
| 413 |
|
|---|
| 414 |
|
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 |
|
|---|
| 420 |
function sesskey() { |
|---|
| 421 |
global $USER; |
|---|
| 422 |
|
|---|
| 423 |
if(!isset($USER)) { |
|---|
| 424 |
return false; |
|---|
| 425 |
} |
|---|
| 426 |
|
|---|
| 427 |
if (empty($USER->sesskey)) { |
|---|
| 428 |
$USER->sesskey = random_string(10); |
|---|
| 429 |
} |
|---|
| 430 |
|
|---|
| 431 |
return $USER->sesskey; |
|---|
| 432 |
} |
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 |
|
|---|
| 436 |
|
|---|
| 437 |
|
|---|
| 438 |
|
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 |
|
|---|
| 442 |
|
|---|
| 443 |
|
|---|
| 444 |
|
|---|
| 445 |
|
|---|
| 446 |
|
|---|
| 447 |
|
|---|
| 448 |
|
|---|
| 449 |
|
|---|
| 450 |
|
|---|
| 451 |
function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $attachment='', $attachname='', $usetrueaddress=true, $replyto='', $replytoname='') { |
|---|
| 452 |
|
|---|
| 453 |
global $CFG; |
|---|
| 454 |
$textlib = textlib_get_instance(); |
|---|
| 455 |
|
|---|
| 456 |
include_once($CFG->libdir .'/phpmailer/class.phpmailer.php'); |
|---|
| 457 |
|
|---|
| 458 |
if (empty($user) || empty($user->email)) { |
|---|
| 459 |
return false; |
|---|
| 460 |
} |
|---|
| 461 |
|
|---|
| 462 |
|
|---|
| 463 |
if (over_bounce_threshold($user)) { |
|---|
| 464 |
error_log("User $user->id (".fullname($user).") is over bounce threshold! Not sending."); |
|---|
| 465 |
return false; |
|---|
| 466 |
} |
|---|
| 467 |
*/ // this doesn't exist right now, we may bring it in later though. |
|---|
| 468 |
|
|---|
| 469 |
$mail = new phpmailer; |
|---|
| 470 |
|
|---|
| 471 |
$mail->Version = 'Elgg '; |
|---|
| 472 |
$mail->PluginDir = $CFG->libdir .'/phpmailer/'; |
|---|
| 473 |
|
|---|
| 474 |
|
|---|
| 475 |
$mail->CharSet = 'UTF-8'; |
|---|
| 476 |
|
|---|
| 477 |
if (empty($CFG->smtphosts)) { |
|---|
| 478 |
$mail->IsMail(); |
|---|
| 479 |
} else if ($CFG->smtphosts == 'qmail') { |
|---|
| 480 |
$mail->IsQmail(); |
|---|
| 481 |
} else { |
|---|
| 482 |
$mail->IsSMTP(); |
|---|
| 483 |
if ($CFG->debug > 7) { |
|---|
| 484 |
echo '<pre>' . "\n"; |
|---|
| 485 |
$mail->SMTPDebug = true; |
|---|
| 486 |
} |
|---|
| 487 |
$mail->Host = $CFG->smtphosts; |
|---|
| 488 |
|
|---|
| 489 |
if ($CFG->smtpuser) { |
|---|
| 490 |
$mail->SMTPAuth = true; |
|---|
| 491 |
$mail->Username = $CFG->smtpuser; |
|---|
| 492 |
$mail->Password = $CFG->smtppass; |
|---|
| 493 |
} |
|---|
| 494 |
} |
|---|
| 495 |
|
|---|
| 496 |
|
|---|
| 497 |
// make up an email address for handling bounces |
|---|
| 498 |
if (!empty($CFG->handlebounces)) { |
|---|
| 499 |
$modargs = 'B'.base64_encode(pack('V',$user->ident)).substr(md5($user->email),0,16); |
|---|
| 500 |
$mail->Sender = generate_email_processing_address(0,$modargs); |
|---|
| 501 |
} |
|---|
| 502 |
else { |
|---|
| 503 |
$mail->Sender = $CFG->sysadminemail; |
|---|
| 504 |
} |
|---|
| 505 |
*/ |
|---|
| 506 |
$mail->Sender = $CFG->sysadminemail; |
|---|
| 507 |
|
|---|
| 508 |
// TODO add a preference for maildisplay |
|---|
| 509 |
if (is_string($from)) { |
|---|
| 510 |
$mail->From = $CFG->noreplyaddress; |
|---|
| 511 |
$mail->FromName = $from; |
|---|
| 512 |
} else if (empty($from)) { |
|---|
| 513 |
$mail->From = $CFG->sysadminemail; |
|---|
| 514 |
$mail->FromName = $CFG->sitename.' '.__gettext('Administrator'); |
|---|
| 515 |
} else if ($usetrueaddress and !empty($from->maildisplay)) { |
|---|
| 516 |
$mail->From = $from->email; |
|---|
| 517 |
$mail->FromName = $from->name; |
|---|
| 518 |
} else { |
|---|
| 519 |
$mail->From = $CFG->noreplyaddress; |
|---|
| 520 |
$mail->FromName = $from->name; |
|---|
| 521 |
if (empty($replyto)) { |
|---|
| 522 |
$mail->AddReplyTo($CFG->noreplyaddress,__gettext('Do not reply')); |
|---|
| 523 |
} |
|---|
| 524 |
} |
|---|
| 525 |
|
|---|
| 526 |
if (!empty($replyto)) { |
|---|
| 527 |
$mail->AddReplyTo($replyto,$replytoname); |
|---|
| 528 |
} |
|---|
| 529 |
|
|---|
| 530 |
$mail->Subject = $textlib->substr(stripslashes($subject), 0, 900); |
|---|
| 531 |
|
|---|
| 532 |
$mail->AddAddress($user->email, $user->name); |
|---|
| 533 |
|
|---|
| 534 |
$mail->WordWrap = 79; |
|---|
| 535 |
|
|---|
| 536 |
if (!empty($from->customheaders)) { |
|---|
| 537 |
if (is_array($from->customheaders)) { |
|---|
| 538 |
foreach ($from->customheaders as $customheader) { |
|---|
| 539 |
$mail->AddCustomHeader($customheader); |
|---|
| 540 |
} |
|---|
| 541 |
} else { |
|---|
| 542 |
$mail->AddCustomHeader($from->customheaders); |
|---|
| 543 |
} |
|---|
| 544 |
} |
|---|
| 545 |
|
|---|
| 546 |
if (!empty($from->priority)) { |
|---|
| 547 |
$mail->Priority = $from->priority; |
|---|
| 548 |
} |
|---|
| 549 |
|
|---|
| 550 |
|
|---|
| 551 |
$user->mailformat = 0; |
|---|
| 552 |
if ($messagehtml && $user->mailformat == 1) { |
|---|
| 553 |
$mail->IsHTML(true); |
|---|
| 554 |
$mail->Encoding = 'quoted-printable'; |
|---|
| 555 |
$mail->Body = $messagehtml; |
|---|
| 556 |
$mail->AltBody |
|---|