flush -- WIP admin panel

This commit is contained in:
Tony Yang
2019-05-30 14:18:07 +08:00
parent 75af7df7b4
commit 84fb4180c9
53 changed files with 9104 additions and 2 deletions

21
include/notification.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
function cavern_notify_user($username, $message="你有新的通知!", $url="", $type="") {
global $SQL;
$time = date('Y-m-d H:i:s');
$SQL->query("INSERT INTO `notification` (`username`, `message`, `url`, `type`, `time`) VALUES ('%s', '%s', '%s', '%s', '%s')", array($username, $message, $url, $type, $time));
}
function parse_user_tag($markdown) {
$regex = array(
"code_block" => "/(`{1,3}[^`]*`{1,3})/",
"email" => "/[^@\s]*@[^@\s]*\.[^@\s]*/",
"username" => "/@(\w+)/"
);
$tmp = preg_replace($regex["code_block"], " ", $markdown);
$tmp = preg_replace($regex["email"], " ", $tmp);
preg_match_all($regex["username"], $tmp, $username_list);
return array_unique($username_list[1]);
}