Пример #1
0
*/
include '../inc/includes.php';
Session::checkRight("notification", 'r');
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
$notification = new Notification();
if (isset($_POST["add"])) {
    $notification->check(-1, 'w', $_POST);
    $newID = $notification->add($_POST);
    Event::log($newID, "notifications", 4, "notification", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
    Html::redirect($_SERVER['PHP_SELF'] . "?id={$newID}");
} else {
    if (isset($_POST["delete"])) {
        $notification->check($_POST["id"], 'd');
        $notification->delete($_POST);
        Event::log($_POST["id"], "notifications", 4, "notification", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
        $notification->redirectToList();
    } else {
        if (isset($_POST["update"])) {
            $notification->check($_POST["id"], 'w');
            $notification->update($_POST);
            Event::log($_POST["id"], "notifications", 4, "notification", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
            Html::back();
        } else {
            Html::header(Notification::getTypeName(2), $_SERVER['PHP_SELF'], "config", "mailing", "notification");
            $notification->showForm($_GET["id"]);
            Html::footer();
        }
    }
}
Пример #2
0
$tpl->setTemplate("notification.tpl.html");
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
$issue_id = @$HTTP_POST_VARS["issue_id"] ? $HTTP_POST_VARS["issue_id"] : $HTTP_GET_VARS["iss_id"];
$tpl->assign("issue_id", $issue_id);
// format default actions properly
$default = Notification::getDefaultActions();
$res = array();
foreach ($default as $action) {
    $res[$action] = 1;
}
$tpl->assign("default_actions", $res);
if (@$HTTP_POST_VARS["cat"] == "insert") {
    $res = Notification::subscribeEmail($usr_id, $issue_id, $HTTP_POST_VARS['email'], $HTTP_POST_VARS['actions']);
    $tpl->assign("insert_result", $res);
} elseif (@$HTTP_GET_VARS["cat"] == "edit") {
    $res = Notification::getDetails($HTTP_GET_VARS["id"]);
    $tpl->assign("info", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "update") {
    $res = Notification::update($HTTP_POST_VARS["id"]);
    $tpl->assign("update_result", $res);
} elseif (@$HTTP_POST_VARS["cat"] == "delete") {
    $res = Notification::remove($HTTP_POST_VARS["items"]);
    $tpl->assign("delete_result", $res);
}
$tpl->assign("list", Notification::getSubscriberListing($issue_id));
$t = Project::getAddressBook($prj_id, $issue_id);
$tpl->assign("assoc_users", $t);
$tpl->assign("allowed_emails", Project::getAddressBookEmails($prj_id, $issue_id));
$tpl->displayTemplate();
    public static function register()
    {
        global $https, $store_home;
        $trigger = new Notification();
        Database::register_trigger($trigger);
        $dir = dirname($_SERVER['PHP_SELF']);
        if ($dir != '/') {
            $dir .= '/';
        }
        $protocol = $https ? 'https' : 'http';
        $url = "{$protocol}://{$_SERVER['HTTP_HOST']}{$dir}";
        Notification::$insert = <<<end
Your affiliate account has been credited with a new order.  The details are as
follows:
end;
        Notification::$update = <<<end
An order in your affiliate account has been changed.  The details are as
follows:
end;
        Notification::$signoff = <<<end
You are receiving this message because you signed up to be an affiliate of
{$store_home} .

If you no longer wish to receive these emails, you can turn them off by
visiting {$url} and clicking ‘Your Account’.
This will take you to a page where you can set your email preferences.

If you have any questions, please feel free to contact us at any time.
However, this email was sent from an address which is not monitored, so a reply
will not reach us.

Thank you for being a member of our affiliate programme.
end;
    }
Пример #4
0
// format default actions properly
$default = Notification::getDefaultActions();
// first setup defaults
$res = array('updated' => 0, 'closed' => 0, 'files' => 0, 'emails' => 0);
foreach ($default as $action) {
    $res[$action] = 1;
}
$tpl->assign('default_actions', $res);
$cat = isset($_POST['cat']) ? (string) $_POST['cat'] : (isset($_GET['cat']) ? (string) $_GET['cat'] : null);
if ($cat == 'insert') {
    $res = Notification::subscribeEmail($usr_id, $issue_id, $_POST['email'], $_POST['actions']);
    if ($res == 1) {
        Misc::setMessage(ev_gettext('Thank you, the email has been subscribed to the issue.'));
    }
} elseif ($cat == 'update') {
    $res = Notification::update($issue_id, $_POST['id'], $_POST['email']);
    if ($res == 1) {
        Misc::setMessage(ev_gettext('Thank you, the notification entry was updated successfully.'));
    } elseif ($res == -1) {
        Misc::setMessage(ev_gettext('An error occurred while trying to update the notification entry.'), Misc::MSG_ERROR);
    } elseif ($res == -2) {
        Misc::setMessage(ev_gettext('Error: the given email address is not allowed to be added to the notification list.'), Misc::MSG_ERROR);
    }
    Auth::redirect(APP_RELATIVE_URL . 'notification.php?iss_id=' . $issue_id);
} elseif ($cat == 'edit') {
    $res = Notification::getDetails($_GET['id']);
    $tpl->assign('info', $res);
} elseif ($cat == 'delete') {
    $res = Notification::remove($_POST['items']);
    if ($res == 1) {
        Misc::setMessage(ev_gettext('Thank you, the items have been deleted.'));
Пример #5
0
 public function set_notification_read($notification_id)
 {
     $notification = new Notification($notification_id);
     $notification->set_read('TRUE');
     $notification->update();
     return $this;
 }
Пример #6
0
		}
	}
}else if($_REQUEST['mode'] == 'edit'){
	$title = "Edit Notification";
	if(empty($_REQUEST['id'])){
		$error_msg .= "Error: No ID specified!\n";
	}else{
		if(!$notification->get($_REQUEST['id'])){
			$error_msg .= "Error retrieving notification information!\n";
			debug_message($notification->getLastError());
		}
	}

	if($_POST['save']){
		$notification->updateFromAssocArray($_POST);
		if($notification->update()){
			if(!empty($_POST['new_address'])){
				if($notification->addAddress($_POST['new_address']) === FALSE){
					$error_msg .= "Error adding new address to notification!";
					debug_message($notification->getLastError());
				}
			}

			if(!empty($_POST['new_macro_name'])){
				if($notification->addMacro($_POST['new_macro_name'], $_POST['new_macro_description']) === FALSE){
					$error_msg .= "Error adding new macro to notification!";
					debug_message($notification->getLastError());
				}
			}

			if(empty($error_msg)){
Пример #7
0
 public function read(Notification $notification)
 {
     $notification->readed = 1;
     return $notification->update();
 }
 public function markNotificationRead(Notification $notification)
 {
     $notification->isRead(1);
     $notification->update();
 }