add composer

This commit is contained in:
xiaomlove
2021-01-13 19:32:26 +08:00
parent 1eb5d8441e
commit 0541f2a6c0
665 changed files with 889 additions and 150 deletions

View File

@@ -7,7 +7,7 @@ define("NEXUSWIKIURL","http://www.nexusphp.com/wiki");
define("VERSION","Powered by <a href=\"aboutnexus.php\">".PROJECTNAME."</a>");
define("THISTRACKER","General");
$showversion = " - Powered by ".PROJECTNAME;
$rootpath=realpath(dirname(__FILE__) . '/..');
$rootpath= dirname(__DIR__);
set_include_path(get_include_path() . PATH_SEPARATOR . $rootpath);
$rootpath .= "/";
require $rootpath . 'include/functions.php';

View File

@@ -2,7 +2,7 @@
define('NEXUS_START', microtime(true));
# IMPORTANT: Do not edit below unless you know what you are doing!
define('IN_TRACKER', true);
$rootpath=realpath(dirname(__FILE__) . '/..')."/";
$rootpath= dirname(__DIR__) . '/';
require $rootpath . 'include/functions_announce.php';
require $rootpath . 'include/globalfunctions.php';

View File

@@ -41,3 +41,5 @@ define ("UC_SYSOP",15);
define ("UC_STAFFLEADER",16);
ignore_user_abort(1);
@set_time_limit(60);
require dirname(__DIR__) . '/vendor/autoload.php';

View File

@@ -1390,6 +1390,7 @@ function sent_mail($to,$fromname,$fromemail,$subject,$body,$type = "confirmation
ini_restore(sendmail_from);
}
elseif ($smtptype == 'external') {
/*
require_once ($rootpath . 'include/smtp/smtp.lib.php');
$mail = new smtp($hdr_encoding,'eYou');
$mail->debug(true);
@@ -1411,6 +1412,36 @@ function sent_mail($to,$fromname,$fromemail,$subject,$body,$type = "confirmation
$mail->body($body);
$mail->send() or stderr($lang_functions['std_error'], $lang_functions['text_unable_to_send_mail']);
$mail->close();
*/
/**
* use swiftmailer instead
*
* @since 1.6
* @author xiaomlove<1939737565@qq.com>
*/
$setting = get_setting('smtp');
// Create the Transport
$transport = (new Swift_SmtpTransport('smtp.example.org', 25))
->setUsername('your username')
->setPassword('your password')
;
// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
// Create a message
$message = (new Swift_Message('Wonderful Subject'))
->setFrom(['john@doe.com' => 'John Doe'])
->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself')
;
// Send the message
$result = $mailer->send($message);
}
if ($showmsg) {
if ($type == "confirmation")

View File

@@ -228,16 +228,12 @@ function config($key, $default = null)
/**
* get setting for given name and prefix
*
* $name == null and $prefix == null, return all
* $name == null and $prefix != null, return with specified prefix, but the result's prefix will be stripped
*
* @author xiaomlove
* @author xiaomlove<1939737565@qq.com>
* @date 2021/1/11
* @param null $name
* @param null $prefix
* @return array|mixed|string
*/
function get_setting($name = null, $prefix = null)
function get_setting($name = null)
{
static $settings;
if (is_null($settings)) {
@@ -343,4 +339,18 @@ function arr_get($array, $key, $default = null)
}
return $array;
}
?>
function arr_set(&$array, $key, $value)
{
if (strpos($key, '.') === false) {
$array[$key] = $value;
}
foreach (explode('.', $key) as $segment) {
if (isset($array[$segment])) {
$array = $array[$segment];
} else {
return $default;
}
}
return $array;
}