Permalink
Browse files

Fix back button

Signed-off-by: Simone <hello@simonewebdesign.it>
  • Loading branch information...
1 parent 30d674d commit b8b50d9cdc4f6062a0b66ec5af76fc6186c84c6c @simonewebdesign committed Mar 19, 2013
View
@@ -78,4 +78,4 @@ static function all() {
}
/***** INITIALIZATION *****/
-Newsletter::$db = $db;
+Newsletter::$db = $db;
View
@@ -1 +1 @@
-<form method=POST> <fieldset> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($l->id) ? $l->id : NOT_SET?>" disabled> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($l->name) ? $l->name : ''?>"> </p> <p> <label for="email_addresses"><?=EMAIL_ADDRESSES?></label> <?php $email_addresses_plain_text = ''; if (isset($l->id)) { $email_addresses = User::all_where("list_id = {$l->id}"); foreach ($email_addresses as $em) { $email_addresses_plain_text .= "$em->email\r\n"; } } ?> <textarea id="email_addresses" name="email_addresses" rows=15><?=$email_addresses_plain_text?></textarea> </p> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE : CREATE?>"> </p> </fieldset></form>
+<form method="POST"> <fieldset> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($l->id) ? $l->id : NOT_SET?>" disabled> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($l->name) ? $l->name : ''?>"> </p> <p> <label for="email_addresses"><?=EMAIL_ADDRESSES?></label> <?php $email_addresses_plain_text = ''; if (isset($l->id)) { $email_addresses = User::all_where("list_id = {$l->id}"); foreach ($email_addresses as $em) { $email_addresses_plain_text .= "$em->email\r\n"; } } ?> <textarea id="email_addresses" name="email_addresses" rows=15><?=$email_addresses_plain_text?></textarea> </p> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE : CREATE?>"> </p> </fieldset></form>
View
@@ -1 +1 @@
-<form method=POST enctype="multipart/form-data"> <fieldset> <legend><?=NEWSLETTERS?></legend> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($n->id) ? $n->id : NOT_SET?>" disabled> </p> <p> <label for="subject"><?=SUBJECT?></label> <input id="subject" name="subject" type="text" value="<?=isset($n->subject) ? $n->subject : ''?>" required> </p> <p> <label for="resource"><?=RESOURCE?></label> <input name="resource" type="file"> <small>La larghezza ottimale dell'immagine è di 525px.</small> </p> <?php include_once '_template_select.php' ?> <p> <input id="submit" name="submit" type="submit" value="<?=CREATE?>"> </p> </fieldset></form>
+<form method="POST" enctype="multipart/form-data"> <fieldset> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($n->id) ? $n->id : NOT_SET?>" disabled> </p> <p> <label for="subject"><?=SUBJECT?></label> <input id="subject" name="subject" type="text" value="<?=isset($n->subject) ? $n->subject : ''?>" required> </p> <p> <label for="resource"><?=RESOURCE?></label> <input name="resource" type="file"> <small>La larghezza ottimale dell'immagine è di 525px.</small> </p> <?php include_once '_template_select.php' ?> <p> <input id="submit" name="submit" type="submit" value="<?=CREATE?>"> </p> </fieldset></form>
View
@@ -1 +1 @@
-<p> <label for="newsletter_id"><?=NEWSLETTERS?></label> <select id="newsletter_id" name="newsletter_id"><?php foreach ($newsletters as $n) { ?> <option value="<?=$n->id?>"><?=date(PHP_DATE, strtotime($n->created_at)) . ' - ' . $n->subject?></option><?php } ?> </select></p>
+<p> <label for="newsletter_id"><?=NEWSLETTERS?></label> <select id="newsletter_id" name="newsletter_id"><?php foreach ($newsletters as $n) { ?> <option value="<?=$n->id?>"><?=date(PHP_DATE, strtotime($n->created_at)) . ' - ' . $n->subject?></option><?php } ?> </select></p>
View
@@ -1 +1 @@
-<!-- begin of codemirror stuff --><script src=CodeMirror/lib/codemirror.js></script><script src=CodeMirror/mode/xml/xml.js></script><script src=CodeMirror/mode/javascript/javascript.js></script><script src=CodeMirror/mode/css/css.js></script><script src=CodeMirror/mode/htmlmixed/htmlmixed.js></script><link rel=stylesheet href=CodeMirror/lib/codemirror.css><link rel=stylesheet href=CodeMirror/doc/docs.css><style> iframe { width: 800px; height: 600px; border: 1px solid #ddd; } .codeMirror { width:49%; }</style><!-- end of codemirror stuff --><form method="POST"> <fieldset> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($t->id) ? $t->id : NOT_SET?>" disabled> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($t->name) ? $t->name : ''?>" required placeholder="Nome del template"> </p> <p> <label for="body"><?=BODY?></label> <?php $default_template_body = '<!doctype html><html lang="it"><head> <meta charset="UTF-8"> <title>My Newsletter</title> <style> body { background: #eef; font-family: Arial, sans-serif; font-size:24px; } h1 { color: #448; } </style></head><body> <h1>My Newsletter</h1> <p>This is just a <em>paragraph</em>.</p> <img src="assets/images/header.jpg" alt="My Logo" /></body></html>'; ?> <textarea id="body" name="body" type="text"><?=isset($t->body) ? $t->body : $default_template_body?></textarea> </p> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE_TEMPLATE : CREATE_TEMPLATE ?>"> </p> </fieldset></form><h2><?=PREVIEW?></h2><iframe id="preview"></iframe> <script> var delay; // Initialize CodeMirror editor with the content of the textarea#body. var editor = CodeMirror.fromTextArea(document.getElementById('body'), { mode: 'text/html', tabMode: 'indent' }); editor.on("change", function() { clearTimeout(delay); delay = setTimeout(updatePreview, 300); }); function updatePreview() { var previewFrame = document.getElementById('preview'); var preview = previewFrame.contentDocument || previewFrame.contentWindow.document; preview.open(); preview.write(editor.getValue()); preview.close(); } setTimeout(updatePreview, 300);</script><h3>Note</h3><p>All'interno del template e' possibile usare dei <em>placeholder</em>, che verranno poi valorizzati nella fase finale di rendering. Ecco l'elenco completo:</p><dl> <dt>:from</dt> <dd>Email del mittente.</dd> <dt>:site_name</dt> <dd>Nome del sito.</dd> <dt>:logo</dt> <dd>Path assoluto del logo.</dd> <dt>:address</dt> <dd>Indirizzo geografico della propria azienda.</dd> <dt>:reply_to</dt> <dd>Email a cui rispondere.</dd> <dt>:site_url</dt> <dd>Path relativo al sito.</dd> <dt>:site_full_url</dt> <dd>Path assoluto al sito.</dd> <dt>:unsubscribe_url</dt> <dd>URL per cancellare l'iscrizione alla newsletter.</dd> <dt>:creation_date</dt> <dd>Data di creazione della newsletter.</dd> <dt>:online_version_url</dt> <dd>URL alla versione online della newsletter.</dd> <dt>:root</dt> <dd>La root di questa applicazione.</dd> <dt>:image_path</dt> <dd>Path relativo all'immagine allegata alla newsletter.</dd> <dt>:user_id</dt> <dd>ID univoco dell'utente che aprira' la newsletter.</dd> <dt>:newsletter_id</dt> <dd>ID univoco di questa newsletter.</dd> </dl>
+<!-- begin of codemirror stuff --><script src=CodeMirror/lib/codemirror.js></script><script src=CodeMirror/mode/xml/xml.js></script><script src=CodeMirror/mode/javascript/javascript.js></script><script src=CodeMirror/mode/css/css.js></script><script src=CodeMirror/mode/htmlmixed/htmlmixed.js></script><link rel=stylesheet href=CodeMirror/lib/codemirror.css><link rel=stylesheet href=CodeMirror/doc/docs.css><style> iframe { width: 800px; height: 600px; border: 1px solid #ddd; } .codeMirror { width:49%; }</style><!-- end of codemirror stuff --><form method="POST"> <fieldset> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($t->id) ? $t->id : NOT_SET?>" disabled> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($t->name) ? $t->name : ''?>" required placeholder="Nome del template"> </p> <p> <label for="body"><?=BODY?></label> <?php $default_template_body = '<!doctype html><html lang="it"><head> <meta charset="UTF-8"> <title>My Newsletter</title> <style> body { background: #eef; font-family: Arial, sans-serif; font-size:24px; } h1 { color: #448; } </style></head><body> <h1>My Newsletter</h1> <p>This is just a <em>paragraph</em>.</p> <img src="assets/images/header.jpg" alt="My Logo" /></body></html>'; ?> <textarea id="body" name="body" type="text"><?=isset($t->body) ? $t->body : $default_template_body?></textarea> </p> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE : CREATE ?>"> </p> </fieldset></form><h2><?=PREVIEW?></h2><iframe id="preview"></iframe> <script> var delay; // Initialize CodeMirror editor with the content of the textarea#body. var editor = CodeMirror.fromTextArea(document.getElementById('body'), { mode: 'text/html', tabMode: 'indent' }); editor.on("change", function() { clearTimeout(delay); delay = setTimeout(updatePreview, 300); }); function updatePreview() { var previewFrame = document.getElementById('preview'); var preview = previewFrame.contentDocument || previewFrame.contentWindow.document; preview.open(); preview.write(editor.getValue()); preview.close(); } setTimeout(updatePreview, 300);</script><h3>Note</h3><p>All'interno del template e' possibile usare dei <em>placeholder</em>, che verranno poi valorizzati nella fase finale di rendering. Ecco l'elenco completo:</p><dl> <dt>:from</dt> <dd>Email del mittente.</dd> <dt>:site_name</dt> <dd>Nome del sito.</dd> <dt>:logo</dt> <dd>Path assoluto del logo.</dd> <dt>:address</dt> <dd>Indirizzo geografico della propria azienda.</dd> <dt>:reply_to</dt> <dd>Email a cui rispondere.</dd> <dt>:site_url</dt> <dd>Path relativo al sito.</dd> <dt>:site_full_url</dt> <dd>Path assoluto al sito.</dd> <dt>:unsubscribe_url</dt> <dd>URL per cancellare l'iscrizione alla newsletter.</dd> <dt>:creation_date</dt> <dd>Data di creazione della newsletter.</dd> <dt>:online_version_url</dt> <dd>URL alla versione online della newsletter.</dd> <dt>:root</dt> <dd>La root di questa applicazione.</dd> <dt>:image_path</dt> <dd>Path relativo all'immagine allegata alla newsletter.</dd> <dt>:user_id</dt> <dd>ID univoco dell'utente che aprira' la newsletter.</dd> <dt>:newsletter_id</dt> <dd>ID univoco di questa newsletter.</dd> </dl>
View
@@ -1 +1 @@
-<?php $templates = Template::all(); ?><p> <label for="template_id"><?=TEMPLATES?></label> <select id="template_id" name="template_id"><?php foreach ($templates as $temp) { ?> <option value="<?=$temp->id?>"><?=$temp->name?></option><?php } ?> </select></p>
+<?php $templates = Template::all(); ?><p> <label for="template_id"><?=TEMPLATES?></label> <select id="template_id" name="template_id"><?php foreach ($templates as $temp) { ?> <option value="<?=$temp->id?>"><?=$temp->name?></option><?php } ?> </select></p>
View
@@ -1 +1 @@
-<form method=POST> <fieldset> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($u->id) ? $u->id : NOT_SET?>" disabled> </p> <p> <label for="email"><?=EMAIL?></label> <input id="email" name="email" type="email" value="<?=isset($u->email) ? $u->email : ''?>" required> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($u->name) ? $u->name : ''?>"> </p> <?php include_once '_list_select.php'; ?> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE : CREATE?>"> </p> </fieldset></form>
+<form method="POST"> <fieldset> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($u->id) ? $u->id : NOT_SET?>" disabled> </p> <p> <label for="email"><?=EMAIL?></label> <input id="email" name="email" type="email" value="<?=isset($u->email) ? $u->email : ''?>" required> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($u->name) ? $u->name : ''?>"> </p> <?php include_once '_list_select.php' ?> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE : CREATE?>"> </p> </fieldset></form>
View
@@ -57,4 +57,4 @@
<tfoot>
</tfoot>
-</table>
+</table>
View
@@ -0,0 +1,12 @@
+<?php
+
+$root = $cfg['root'];
+$filename = basename($_SERVER['PHP_SELF']);
+$parts = explode("_", $filename);
+$parent_page = $parts[0] . "s.php";
+
+?>
+
+<p>
+ <a href="<?=$parent_page?>"><?=BACK?></a>
+</p>
View
@@ -30,4 +30,4 @@
</footer>
</body>
-</html>
+</html>
View
@@ -1 +1 @@
-<?php/* PLEASE NOTE: * the root is not accessible by default * for security reasons. You can start * from where you want, i.e. quick.php **************************************/include_once 'bootstrap.php';header('Location: ' . $cfg['site_full_url']);
+<?php/* PLEASE NOTE: * the root is not accessible by default * for security reasons. You can start * from where you want, i.e. quick.php **************************************/include_once 'bootstrap.php';header('Location: ' . $cfg['site_full_url']);// CREDITS// https://github.com/simonewebdesign/newsletter// www.simonewebdesign.it
View
@@ -23,4 +23,5 @@
}
}
-?><p><a href="javascript:history.back(1)"><?=BACK?></a></p>
+include_once "back.php";
+include_once "foot.php";
View
@@ -13,6 +13,5 @@
echo FAIL;
}
-?>
-
-<p><a href="<?=$cfg['root']?>lists.php"><?=BACK?></a></p>
+include_once "back.php";
+include_once "foot.php";
View
@@ -17,8 +17,7 @@
<h4>Creata il <?=date(PHP_DATE, strtotime($lista->created_at))?></h4>
<h3>Elenco dei partecipanti</h3>
-<?php include_once '_users_table.php' ?>
+<?php include_once '_users_table.php';
-
-
-<p><a href="<?=$cfg['root']?>lists.php"><?=BACK?></a></p>
+include_once "back.php";
+include_once "foot.php";
View
@@ -26,4 +26,5 @@
$l = Lista::read($_GET['id']);
include_once '_list_form.php';
-?><p><a href="<?=$cfg['root']?>lists.php"><?=BACK?></a></p>
+include_once "back.php";
+include_once "foot.php";
View
@@ -62,4 +62,4 @@
<a href="<?=$cfg['root']?>list_create.php"><?=CREATE ." ". LISTA?></a>
-<?php include_once 'foot.php';
+<?php include_once "foot.php";
View
@@ -13,14 +13,14 @@
if ( isset($_POST['submit']) ) {
- if ( Newsletter::create($_POST['subject'], $_POST['template_id'])
- &&
- Resource::create($_FILES['resource'], $db->lastInsertId())
- ) {
+ if ( Newsletter::create($_POST['subject'], $_POST['template_id']) &&
+ Resource::create($_FILES['resource'], $db->lastInsertId()) ) {
echo SUCCESS;
} else {
echo FAIL;
}
}
-?><p><a href="javascript:history.back(1)"><?=BACK?></a></p>
+
+include_once "back.php";
+include_once "foot.php";
View
@@ -13,6 +13,6 @@
echo FAIL;
}
-?>
-<p><a href="javascript:history.back(1)"><?=BACK?></a></p>
+include_once "back.php";
+include_once "foot.php";
View
@@ -16,6 +16,6 @@
echo $user_template;
-?>
-<p><a href="javascript:history.back(1)"><?=BACK?></a></p>
+include_once "back.php";
+include_once "foot.php";
View
@@ -27,4 +27,6 @@
$n = Newsletter::read($_GET['id']);
include_once '_newsletter_form.php';
-?><p><a href="javascript:history.back(1)"><?=BACK?></a></p>
+
+include_once "back.php";
+include_once "foot.php";
View
@@ -64,8 +64,6 @@
<p><?=NO_DATA?></p>
-<?php } ?>
+<?php }
-<a href="<?=$cfg['root']?>newsletter_create.php"><?=CREATE ." ". NEWSLETTER?></a>
-
-<?php include_once 'foot.php';
+include_once "foot.php";
View
@@ -38,4 +38,5 @@
</ol>
</form>
-<?php include_once 'foot.php';
+<?php
+include_once "foot.php";
View
@@ -21,4 +21,4 @@
}
// Setto la list_id all'id della lista corrente, cosi' l'aggiunta e' completa
$update_list_id = $db->prepare("UPDATE users SET list_id = $list_id WHERE list_id <= 0");
-$update_list_id->execute();
+$update_list_id->execute();
View
@@ -1 +1 @@
-<?phpinclude_once 'bootstrap.php';include_once 'Lista.php';###############################$lists = Lista::all();?><h1><?=SELECT ." ". LIST?></h1><p>Prego selezionare la mailing list a cui si desidera inviare la newsletter.</p><ul><?php foreach ($lists as $list) { ?> <li> <a href="<?=$cfg['root'] . 'send.php?newsletter_id=' . $_GET['newsletter_id'] . '&list_id=' . $list->id?>"><?=$list->name?></a> </li><?php } ?></ul><p><a href="javascript:history.back(1)"><?=BACK?></a></p><?php include_once 'foot.php';
+<?phpif (!isset($_GET["newsletter_id"])) die('Error: You must select newsletter first. <a href="newsletters.php">Go back</a>'); include_once 'bootstrap.php';include_once 'Lista.php';###############################$lists = Lista::all();?><h1><?=SELECT ." ". LISTA?></h1><p>Prego selezionare la mailing list a cui si desidera inviare la newsletter.</p><ul><?php foreach ($lists as $list) { ?> <li> <a href="<?=$cfg['root'] . 'send.php?newsletter_id=' . $_GET['newsletter_id'] . '&list_id=' . $list->id?>"><?=$list->name?></a> </li><?php } ?></ul><?php include_once "foot.php";
Oops, something went wrong.

0 comments on commit b8b50d9

Please sign in to comment.