本文整理汇总了PHP中addNotification函数的典型用法代码示例。如果您正苦于以下问题:PHP addNotification函数的具体用法?PHP addNotification怎么用?PHP addNotification使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addNotification函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare
public function prepare()
{
$user = new User(1);
if (!$user->isAuthorized()) {
$this->redirect('?r=auth');
}
$fileName = str_replace('/', '', $_GET['fileName']);
$folder = str_replace('.', '', $_GET['folder']);
$taskId = str_replace('.', '', $_GET['taskId']);
$serverId = '';
if (isset($_GET['serverId'])) {
$serverId = (int) $_GET['serverId'];
}
if (!$user->checkRights('manager')) {
addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
$this->redirect('?r=store/' . $folder . '/folder&fid=' . $taskId . '&sid=' . $serverId);
}
switch ($folder) {
case 'local':
$path = __archiveDIR . "local/{$taskId}/{$fileName}";
break;
case 'remote':
$path = __archiveDIR . "servers/{$serverId}/{$taskId}/{$fileName}";
break;
}
//echo $path;
if (file_exists($path)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($path));
header('Content-Disposition: attachment; filename=' . basename($path));
readfile($path);
}
die;
}
示例2: execute
public function execute()
{
$user = new User(1);
if (!$user->checkRights('administrator')) {
addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
return 0;
}
$usersDB = new JsonDB(__userdb);
$id = (int) $_POST['id'];
$login = htmlspecialchars($_POST['login'], ENT_QUOTES);
$email = htmlspecialchars($_POST['email'], ENT_QUOTES);
$password1 = md5($_POST['password1']);
$password2 = md5($_POST['password2']);
$accessGroup = htmlspecialchars($_POST['accessGroup'], ENT_QUOTES);
$alerts = htmlspecialchars($_POST['alerts'], ENT_QUOTES);
$user = $usersDB->data[$id];
$_SESSION['formSent'] = $_POST;
if ($password1 != $password2) {
$this->redirect('?r=users/edit&id=' . $id . '&error=Passwords do not much!');
}
$user['login'] = $login;
$user['email'] = $email;
$user['accessGroup'] = $accessGroup;
$user['alerts'] = $alerts;
if ($_POST['password1'] != '') {
$user['password'] = $password1;
}
$usersDB->data[$id] = $user;
$usersDB->saveToFile(__userdb);
$_SESSION['formSent'] = array();
$this->redirect('?r=users/list');
}
示例3: execute
public function execute()
{
$user = new User(1);
if (!$user->checkRights('administrator')) {
addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
return 0;
}
$frequency = array();
$frequency['type'] = $_POST['n-start'];
switch ($_POST['n-start']) {
case 'n-minutes':
$frequency['n-minutes-minute'] = (int) $_POST['n-minutes-minute'];
break;
case 'n-every-hour':
$frequency['n-every-hour-minute'] = (int) $_POST['n-every-hour-minute'];
break;
case 'n-day':
$frequency['n-day-hour'] = (int) $_POST['n-day-hour'];
$frequency['n-day-minute'] = (int) $_POST['n-day-minute'];
break;
case 'n-month':
$frequency['n-month-day'] = (int) $_POST['n-month-day'];
$frequency['n-month-hour'] = (int) $_POST['n-month-hour'];
$frequency['n-month-minutes'] = (int) $_POST['n-month-minutes'];
break;
case 'n-once':
$frequency['n-once-month'] = (int) $_POST['n-once-month'];
$frequency['n-once-day'] = (int) $_POST['n-once-day'];
$frequency['n-once-year'] = (int) $_POST['n-once-year'];
$frequency['n-once-hour'] = (int) $_POST['n-once-hour'];
$frequency['n-once-minutes'] = (int) $_POST['n-once-minutes'];
break;
}
$sid = (int) $_POST['sid'];
$serversList = new JsonDB(__serversdb);
$newTask = array();
$newTask['added'] = time();
$newTask['type'] = 'mysql_backup';
$newTask['title'] = $_POST['title'];
$newTask['status'] = $_POST['status'];
$newTask['execStatus'] = 0;
$newTask['lastExec'] = time();
$newTask['deep'] = (int) $_POST['deep'];
$newTask['frequency'] = $frequency;
$newTask['mysql-backup-address'] = $_POST['mysql-backup-address'];
$newTask['mysql-backup-name'] = $_POST['mysql-backup-name'];
$newTask['mysql-backup-user'] = $_POST['mysql-backup-user'];
$newTask['mysql-backup-password'] = $_POST['mysql-backup-password'];
$query = new ApiQuery($serversList->data[$sid]['address'], $serversList->data[$sid]['apiKey']);
$result = $query->addTask($newTask, true);
if ($result['responseStatus'] == 'success') {
$id = (int) $result['id'];
$serversList->data[$sid]['tasks'][$id] = $result['task'];
$serversList->saveToFile(__serversdb);
}
$this->redirect('?r=servers/server_tasks_list&id=' . $sid);
}
示例4: save
/**
* сохраняем данные записи
* @param $data
*/
public function save($data)
{
foreach ($data as $key => $value) {
$data[$key] = $this->db->real_escape_string($value);
}
$stmt = $this->db->prepare("INSERT INTO users (name, surname, password, email, profile_image) VALUES (?, ?, ?, ?, ?);");
$stmt->bind_param('sssss', $data['exampleInputName'], $data['exampleInputSurname'], md5($data['exampleInputPassword1']), $data['exampleInputEmail1'], end(explode('/user_registration', $data['profile_image'])));
$stmt->execute();
$stmt->close();
addNotification($this->db->error, 'success');
}
示例5: execute
public function execute()
{
$user = new User(1);
if (!$user->checkRights('administrator')) {
addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
return 0;
}
$frequency = array();
$frequency['type'] = $_POST['n-start'];
switch ($_POST['n-start']) {
case 'n-minutes':
$frequency['n-minutes-minute'] = (int) $_POST['n-minutes-minute'];
break;
case 'n-every-hour':
$frequency['n-every-hour-minute'] = (int) $_POST['n-every-hour-minute'];
break;
case 'n-day':
$frequency['n-day-hour'] = (int) $_POST['n-day-hour'];
$frequency['n-day-minute'] = (int) $_POST['n-day-minute'];
break;
case 'n-month':
$frequency['n-month-day'] = (int) $_POST['n-month-day'];
$frequency['n-month-hour'] = (int) $_POST['n-month-hour'];
$frequency['n-month-minutes'] = (int) $_POST['n-month-minutes'];
break;
case 'n-once':
$frequency['n-once-month'] = (int) $_POST['n-once-month'];
$frequency['n-once-day'] = (int) $_POST['n-once-day'];
$frequency['n-once-year'] = (int) $_POST['n-once-year'];
$frequency['n-once-hour'] = (int) $_POST['n-once-hour'];
$frequency['n-once-minutes'] = (int) $_POST['n-once-minutes'];
break;
}
$id = time();
$newTask = array();
$newTask['id'] = $id;
$newTask['added'] = time();
$newTask['type'] = 'mysql_backup';
$newTask['title'] = $_POST['title'];
$newTask['status'] = $_POST['status'];
$newTask['execStatus'] = 0;
$newTask['lastExec'] = time();
$newTask['deep'] = (int) $_POST['deep'];
$newTask['frequency'] = $frequency;
$newTask['mysql-backup-address'] = $_POST['mysql-backup-address'];
$newTask['mysql-backup-name'] = $_POST['mysql-backup-name'];
$newTask['mysql-backup-user'] = $_POST['mysql-backup-user'];
$newTask['mysql-backup-password'] = $_POST['mysql-backup-password'];
$tasksDB = new JsonDB(__taskdb);
$tasksDB->data[$id] = $newTask;
$tasksDB->saveToFile(__taskdb);
$this->redirect('?r=tasks/list');
}
示例6: execute
public function execute()
{
$user = new User(1);
if (!$user->checkRights('administrator')) {
addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
return 0;
}
$id = (int) $_POST['id'];
$usersDB = new JsonDB(__userdb);
unset($usersDB->data[$id]);
$usersDB->saveToFile(__userdb);
$this->redirect('?r=users/list');
}
示例7: execute
public function execute()
{
$user = new User(1);
if (!$user->checkRights('administrator')) {
addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
return 0;
}
$id = (int) $_POST['id'];
$serversDB = new JsonDB(__serversdb);
$server = $serversDB->data[$id];
$serversDB->deleteById($id);
$serversDB->saveToFile(__serversdb);
deleteDir(__archiveDIR . 'servers/' . $server['id']);
$this->redirect('?r=servers/servers');
}
示例8: execute
public function execute()
{
$user = new User(1);
if (!$user->checkRights('administrator')) {
addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
return 0;
}
$settingsDB = new JsonDB(__settingsdb);
$settingsDB->data['serverName'] = $_POST['serverName'];
$settingsDB->data['shortName'] = $_POST['shortName'];
$settingsDB->data['apiKey'] = $_POST['apiKey'];
$settingsDB->data['lang'] = $_POST['lang'];
$settingsDB->saveToFile(__settingsdb);
$this->redirect('?r=settings/main');
}
示例9: execute
public function execute()
{
$user = new User(1);
if (!$user->checkRights('administrator')) {
addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
return 0;
}
$serversDB = new JsonDB(__serversdb);
$id = (int) $_POST['id'];
$serversDB->data[$id]['address'] = $_POST['address'];
$serversDB->data[$id]['apiKey'] = $_POST['apiKey'];
$serversDB->data[$id]['archSync'] = $_POST['archSync'];
$serversDB->data[$id]['archDepth'] = $_POST['depth'];
$serversDB->saveToFile(__serversdb);
$this->redirect('?r=servers/servers');
}
示例10: execute
public function execute()
{
$user = new User(1);
if (!$user->checkRights('administrator')) {
addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
return 0;
}
$id = (int) $_POST['id'];
$sid = (int) $_POST['sid'];
$serversList = new JsonDB(__serversdb);
$query = new ApiQuery($serversList->data[$sid]['address'], $serversList->data[$sid]['apiKey']);
$result = $query->deleteTask($id, true);
if ($result['responseStatus'] == 'success') {
$id = (int) $result['id'];
unset($serversList->data[$sid]['tasks'][$id]);
$serversList->saveToFile(__serversdb);
$dir = __archiveDIR . "servers/{$sid}/{$id}";
deleteDir($dir);
}
$this->redirect('?r=servers/server_tasks_list&id=' . $sid);
}
示例11: beforeInstall
function beforeInstall()
{
$res = 0;
if (!file_exists(__workfolder . 'conf.php')) {
$res = 1;
addNotification('conf.php not found. Please rename install_conf.php to conf.php', 'danger');
} else {
if (!is_writable(__workfolder . 'conf.php')) {
$res = 1;
addNotification('conf.php is not writable.', 'danger');
}
}
if (!is_writable(__archiveDIR)) {
$res = 1;
addNotification('"archive" folder is not writable.', 'danger');
}
if (!is_writable(__corePath . 'data')) {
$res = 1;
addNotification('"core/data" folder is not writable.', 'danger');
}
return $res;
}
示例12: execute
public function execute()
{
$user = new User(1);
if (!$user->checkRights('manager')) {
addNotification($this->_LANG['misc']["You don't have permissions"], 'warning');
return 0;
}
$taskId = (int) $_POST['taskId'];
$fileName = str_replace('/', '', $_POST['fileName']);
$folder = $_POST['folder'];
$server = (int) $_POST['server'];
switch ($folder) {
case 'local':
$path = __archiveDIR . "local/{$taskId}/{$fileName}";
unlink($path);
$this->redirect("?r=store/local/folder&id={$taskId}");
break;
case 'remote':
$path = __archiveDIR . "servers/{$server}/{$taskId}/{$fileName}";
unlink($path);
$this->redirect("?r=store/remote/folder&fid={$taskId}&sid={$server}");
break;
}
}
示例13: AddRaterToProject
require_once DIR_APP . 'projects.php';
$id = AddRaterToProject($_POST['project_id'], $_SESSION['uid'], $_POST['sent_to']);
if (!empty($id)) {
if ($id == 'limit') {
$responce['result'] = 'LIMIT';
} else {
$responce['result'] = 'OK';
$responce['id'] = $id;
$responce['user_id'] = $_POST['sent_to'];
$responce['user'] = getUserNameById($_POST['sent_to']);
// addSuggestion($_POST['project_id'], $_POST['sent_to'], $_SESSION['uid']);
$project_title = getProjectTitle($_POST['project_id']);
$author = getUserNameById($_SESSION['uid']);
$url = SITE_URL . '/project_details.php?pid=' . $_POST['project_id'];
$text = $author . ' assigned to rate project ' . $project_title;
addNotification($_POST['sent_to'], $text, $_SESSION['uid'], $url);
}
} else {
$responce['result'] = 'FALSE';
}
echo json_encode($responce);
break;
case 'register-profiled':
require_once DIR_APP . 'users.php';
require_once DIR_APP . 'projects.php';
$id = registerProfile($_POST);
if ($id == true) {
$responce['result'] = 'OK';
} else {
$responce['result'] = 'FALSE';
}
示例14: sendMail
function sendMail($from, $fromName, $to, $toName, $subject, $message, $options = array())
{
require_once APP_ROOT . '/lib/phpmailer.php';
require_once APP_ROOT . '/lib/class.smtp.php';
//smtp mail
$mail = new PHPMailer();
// defaults to using php "mail()"
if (!empty($options['emailSettings'])) {
$emailSettings = $options['emailSettings'];
}
if (!empty($emailSettings['smtpSettings'])) {
$smtpSettings = $emailSettings['smtpSettings'];
}
//if(true){
if (!empty($smtpSettings) && !empty($smtpSettings['useSmtp'])) {
$mail->IsSMTP();
$mail->Host = $smtpSettings['smtpHost'];
// sets the SMTP server
$mail->Port = $smtpSettings['smtpPort'];
if ($smtpSettings['smtpAuth'] == 1 && !empty($smtpSettings['smtpAuthUsername']) && !empty($smtpSettings['smtpAuthPassword'])) {
$mail->SMTPAuth = true;
//enable SMTP authentication
$mail->Username = $smtpSettings['smtpAuthUsername'];
// SMTP account username
$mail->Password = $smtpSettings['smtpAuthPassword'];
}
$mail->SMTPSecure = $smtpSettings['smtpEncryption'];
$mail->From = $from;
$mail->FromName = $fromName;
$mail->AddAddress($to);
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->MsgHTML($message);
//$mail->Debugoutput = function($str, $level) { /* place any code for debugging here. */ };
} else {
$body = $message;
$mail->SetFrom($from, $fromName);
$mail->AddAddress($to, $toName);
$mail->Subject = $subject;
$mail->MsgHTML($body);
}
if (!$mail->Send()) {
addNotification($type = 'E', $title = 'Mail Error', $message = $mail->ErrorInfo, $state = 'U');
return false;
} else {
//echo "Message sent!";
return true;
}
}
示例15: destroyFleet
if ($dahp < $tempdef) {
destroyFleet($sid, $dfid);
} else {
while ($tempdef > 1) {
for ($x = 1; $x < sizeof($dshiparray) + 1; $x++) {
if ($dshiparray[$x] > 0) {
$tempdef = $tempdef - getShipStat(hp, $x);
if ($tempdef > 0) {
$dshiparray[$x]--;
} else {
break;
}
}
}
if ($count == sizeof($ashiparray)) {
break;
}
}
for ($x = 1; $x < sizeof($dshiparray) + 1; $x++) {
$str = "ship" . $x;
setFleetStat($str, $dshiparray[$x], $sid, $dfid);
}
}
}
addNotification($endstr1, $sid, $aplayerid);
addNotification($endstr2, $sid, $dplayerid);
}
}
}
?>