diff --git a/cms/config/page_types.conf.php b/cms/config/page_types.conf.php index 5356d6a..233e2d8 100644 --- a/cms/config/page_types.conf.php +++ b/cms/config/page_types.conf.php @@ -52,12 +52,6 @@ $page_types['notes'] = array( 'requires_parameter' => true ); -$page_types['newsletter'] = array( -'page_type' => 'newsletter.php', -'page_type_label' => 'page_type_newsletter', -'requires_parameter' => false -); - $page_types['search'] = array( 'page_type' => 'search.php', 'page_type_label' => 'page_type_search', diff --git a/cms/data/content.sqlite b/cms/data/content.sqlite index b38c616..6212f00 100644 Binary files a/cms/data/content.sqlite and b/cms/data/content.sqlite differ diff --git a/cms/data/entries.sqlite b/cms/data/entries.sqlite index 7b2d3fc..f54ffd2 100644 Binary files a/cms/data/entries.sqlite and b/cms/data/entries.sqlite differ diff --git a/cms/data/userdata.sqlite b/cms/data/userdata.sqlite index cd117fb..720f3e9 100644 Binary files a/cms/data/userdata.sqlite and b/cms/data/userdata.sqlite differ diff --git a/cms/includes/page_types/commentable_page.php b/cms/includes/page_types/commentable_page.php index 23a5d92..096082f 100644 --- a/cms/includes/page_types/commentable_page.php +++ b/cms/includes/page_types/commentable_page.php @@ -149,6 +149,7 @@ if(empty($template_done)) $pingbacks = $comment->get_pingbacks(); $template->assign('comments', $comments); + $template->assign('total_comments', $comment->total_comments); $template->assign('pingbacks', $pingbacks); $template->assign('pagination', pagination($comment->total_pages,$comment->current_page)); $template->assign('current_page', $comment->current_page); diff --git a/cms/includes/page_types/newsletter.php b/cms/includes/page_types/newsletter.php deleted file mode 100644 index 1ac3b25..0000000 --- a/cms/includes/page_types/newsletter.php +++ /dev/null @@ -1,336 +0,0 @@ -prepare("DELETE FROM ".Database::$db_settings['newsletter_table']." WHERE time < :one_hour_ago AND confirmed = 0"); -$dbr->bindParam(':one_hour_ago', $one_hour_ago, PDO::PARAM_INT); -$dbr->execute(); - -if(isset($_GET['get_1']) && $_GET['get_1']=='subscribe') - { - $no_cache = true; - if(empty($_GET['get_2']) || empty($_GET['get_3'])) $error = true; - if(empty($error)) - { - if(trim($_GET['get_2'])=='' || trim($_GET['get_3'])=='') $error = true; - } - if(empty($error)) - { - $dbr = Database::$entries->prepare("SELECT confirmation_code FROM ".Database::$db_settings['newsletter_table']." WHERE id=:id LIMIT 1"); - $dbr->bindParam(':id', $_GET['get_2'], PDO::PARAM_INT); - $dbr->execute(); - $data = $dbr->fetch(); - if(isset($data['confirmation_code']) && $_GET['get_3'] == $data['confirmation_code']) - { - $dbr = Database::$entries->prepare("UPDATE ".Database::$db_settings['newsletter_table']." SET confirmed=1, confirmation_code='' WHERE id=:id"); - $dbr->bindParam(':id', $_GET['get_2'], PDO::PARAM_INT); - $dbr->execute(); - $action = 'confirmation_ok'; - } - else - { - $error = true; - } - } - if(isset($error)) $action = 'confirmation_failed'; - } - -if(isset($_GET['get_1']) && $_GET['get_1']=='unsubscribe') - { - $no_cache = true; - if(empty($_GET['get_2']) || empty($_GET['get_3'])) $error = true; - if(empty($error)) - { - if(trim($_GET['get_2'])=='' || trim($_GET['get_3'])=='') $error = true; - } - if(empty($error)) - { - $dbr = Database::$entries->prepare("SELECT confirmation_code FROM ".Database::$db_settings['newsletter_table']." WHERE id=:id LIMIT 1"); - $dbr->bindParam(':id', $_GET['get_2'], PDO::PARAM_INT); - $dbr->execute(); - $data = $dbr->fetch(); - if(isset($data['confirmation_code']) && $_GET['get_3'] == $data['confirmation_code']) - { - $dbr = Database::$entries->prepare("DELETE FROM ".Database::$db_settings['newsletter_table']." WHERE id=:id"); - $dbr->bindParam(':id', $_GET['get_2'], PDO::PARAM_INT); - $dbr->execute(); - $action = 'delete_ok'; - } - else $error = true; - } - if(isset($error)) $action = 'confirmation_failed'; - } - -if((isset($_POST['delete_checked']) || isset($_GET['get_1']) && $_GET['get_1']=='delete') && isset($_SESSION[$settings['session_prefix'].'user_id'])) - { - if(isset($_POST['checked'])) $checked_emails = $_POST['checked']; - elseif(isset($_GET['get_2'])) $checked_emails[] = $_GET['get_2']; - - if(isset($checked_emails) && is_array($checked_emails)) - { - $dbr = Database::$entries->prepare("SELECT id, email FROM ".Database::$db_settings['newsletter_table']." WHERE id=:id ORDER BY email ASC LIMIT 1"); - $dbr->bindParam(':id', $checked, PDO::PARAM_INT); - $i=0; - #Database::$entries->beginTransaction(); - foreach($checked_emails as $checked) - { - $dbr->execute(); - $data = $dbr->fetch(); - $emails2delete[$i]['id'] = $data['id']; - $emails2delete[$i]['email'] = htmlspecialchars($data['email']); - ++$i; - } - #Database::$entries->commit(); - if(isset($emails2delete)) - { - $template->assign('emails2delete',$emails2delete); - $action = 'delete_checked'; - } - } - } - -if(isset($_POST['delete_confirm'])) - { - if(isset($_POST['checked']) && is_array($_POST['checked'])) - { - $dbr = Database::$entries->prepare("DELETE FROM ".Database::$db_settings['newsletter_table']." WHERE id=:id"); - $dbr->bindParam(':id', $delete_id, PDO::PARAM_INT); - Database::$entries->beginTransaction(); - foreach($_POST['checked'] as $delete_id) - { - $dbr->execute(); - } - Database::$entries->commit(); - } - header('Location: '.BASE_URL.PAGE); - exit; - } - -/* -if(isset($_POST['delete_email']) && isset($_SESSION[$settings['session_prefix'].'user_id'])) - { - $dbr = Database::$entries->prepare("DELETE FROM ".Database::$db_settings['newsletter_table']." WHERE id=:id"); - $dbr->bindParam(':id', $_POST['email_id'], PDO::PARAM_INT); - $dbr->execute(); - header('Location: '.BASE_URL.PAGE); - exit; - } -*/ - -if(isset($_POST['add_email']) && isset($_SESSION[$settings['session_prefix'].'user_id'])) - { - $mail = new Mail(); - $mail->set_charset(CHARSET); - if(!$mail->is_valid_email($_POST['add_email'])) - #if(trim($_POST['add_email'])=='' || !preg_match("/^[^@]+@.+\.\D{2,5}$/", $_POST['add_email'])) - { - $template->assign('email', htmlspecialchars($_POST['add_email'])); - $errors[] = 'newsletter_error_invalid_email'; - } - if(empty($errors)) - { - $dbr = Database::$entries->prepare("SELECT email FROM ".Database::$db_settings['newsletter_table']." WHERE lower(email)=:email LIMIT 1"); - $dbr->bindValue(':email', mb_strtolower(trim($_POST['add_email']),CHARSET), PDO::PARAM_STR); - $dbr->execute(); - $data = $dbr->fetch(); - if(isset($data['email'])) - { - $errors[] = 'newsletter_error_email_exists'; - } - } - if(empty($errors)) - { - $dbr = Database::$entries->prepare("INSERT INTO ".Database::$db_settings['newsletter_table']." (newsletter_id, time, ip, email, confirmed, confirmation_code) VALUES (:newsletter_id, :time, :ip, :email, 1, '')"); - $dbr->bindParam(':newsletter_id', $page_id, PDO::PARAM_INT); - $dbr->bindValue(':time', time(), PDO::PARAM_INT); - $dbr->bindParam(':ip', $_SERVER["REMOTE_ADDR"], PDO::PARAM_STR); - $dbr->bindParam(':email', $_POST['add_email'], PDO::PARAM_STR); - $dbr->execute(); - header('Location: '.BASE_URL.PAGE); - exit; - } - - } - -if(isset($_POST['email']) && trim($_POST['email'])!='' && isset($_POST['subscribe'])) - { - $mail = new Mail(); - $mail->set_charset(CHARSET); - $mail->set_sender_name($settings['website_title']); - if($settings['mail_parameter']) $mail->set_mail_parameter($settings['mail_parameter']); - if($_POST['subscribe']=='subscribe') - { - if(!$mail->is_valid_email($_POST['email'])) - #if(trim($_POST['email'])=='' || !preg_match("/^[^@]+@.+\.\D{2,5}$/", $_POST['email'])) - { - $template->assign('email', htmlspecialchars($_POST['email'])); - $errors[] = 'newsletter_error_invalid_email'; - } - if(empty($errors)) - { - $dbr = Database::$entries->prepare("SELECT email FROM ".Database::$db_settings['newsletter_table']." WHERE lower(email)=:email LIMIT 1"); - $dbr->bindValue(':email', mb_strtolower(trim($_POST['email']),CHARSET), PDO::PARAM_STR); - $dbr->execute(); - $data = $dbr->fetch(); - if(isset($data['email'])) - { - $template->assign('email', htmlspecialchars($_POST['email'])); - $errors[] = 'newsletter_error_email_exists'; - } - } - if(empty($errors)) - { - $confirmation_code = md5(uniqid(rand())); - $dbr = Database::$entries->prepare("INSERT INTO ".Database::$db_settings['newsletter_table']." (newsletter_id, time, ip, email, confirmed, confirmation_code) VALUES (:newsletter_id, :time, :ip, :email, 0, :confirmation_code)"); - $dbr->bindParam(':newsletter_id', $page_id, PDO::PARAM_INT); - $dbr->bindValue(':time', time(), PDO::PARAM_INT); - $dbr->bindParam(':ip', $_SERVER["REMOTE_ADDR"], PDO::PARAM_STR); - $dbr->bindParam(':email', $_POST['email'], PDO::PARAM_STR); - $dbr->bindParam(':confirmation_code', $confirmation_code, PDO::PARAM_STR); - $dbr->execute(); - // get ID: - $dbr = Database::$entries->prepare("SELECT id FROM ".Database::$db_settings['newsletter_table']." WHERE email=:email LIMIT 1"); - $dbr->bindParam(':email', $_POST['email'], PDO::PARAM_STR); - $dbr->execute(); - $data = $dbr->fetch(); - - $confirm_link = BASE_URL.PAGE.',subscribe,'.$data['id'].','.$confirmation_code; - - $email_text = str_replace("[link]",$confirm_link,Localization::$lang['newsletter_subscribe_text']); - - if($mail->send($_POST['email'], $settings['email'], Localization::$lang['newsletter_subscribe_subj'], $email_text)) - { - $action = 'confirm_mail_sent'; - } - else - { - $dbr = Database::$entries->prepare("DELETE FROM ".Database::$db_settings['newsletter_table']." WHERE id=:id"); - $dbr->bindParam(':id', $data['id'], PDO::PARAM_INT); - $dbr->execute(); - $errors[] = 'newsletter_error_mail'; - } - } - if(isset($errors)) $action = 'main'; - } - elseif($_POST['subscribe']=='unsubscribe') - { - $dbr = Database::$entries->prepare("SELECT id, email FROM ".Database::$db_settings['newsletter_table']." WHERE lower(email)=:email"); - $dbr->bindValue(':email', mb_strtolower(trim($_POST['email']),CHARSET), PDO::PARAM_STR); - $dbr->execute(); - $data = $dbr->fetch(); - if(empty($data['email'])) - { - $errors[] = 'newsletter_error_email_not_exist'; - } - if(empty($errors)) - { - $confirmation_code = md5(uniqid(rand())); - $dbr = Database::$entries->prepare("UPDATE ".Database::$db_settings['newsletter_table']." SET confirmation_code=:confirmation_code WHERE id=:id"); - $dbr->bindParam(':id', $data['id'], PDO::PARAM_INT); - $dbr->bindParam(':confirmation_code', $confirmation_code, PDO::PARAM_STR); - $dbr->execute(); - - $confirm_link = BASE_URL.PAGE.',unsubscribe,'.$data['id'].','.$confirmation_code; - - $email_text = str_replace("[link]",$confirm_link,Localization::$lang['newsletter_unsubscribe_text']); - - if($mail->send($_POST['email'], $settings['email'], Localization::$lang['newsletter_unsubscribe_subj'], $email_text)) - { - $action = 'confirm_mail_sent'; - } - else - { - $errors[] = 'newsletter_error_mail'; - } - } - if(isset($errors)) $action = 'main'; - } - - } - -if(isset($_SESSION[$settings['session_prefix'].'user_id'])) $action = 'admin'; -if(empty($action)) $action = 'main'; - -switch($action) - { - case 'main': - $form['email'] = ''; - #$template->assign('newsletterform', true); - $template->assign('form', $form); - break; - case 'confirm_mail_sent': - $template->assign('confirm_mail_sent', true); - break; - case 'confirmation_ok': - $template->assign('confirmation_ok', true); - break; - case 'delete_ok': - $template->assign('delete_ok', true); - break; - case 'confirmation_failed': - $template->assign('confirmation_failed', true); - break; - case 'admin': - - $order = 'email ASC'; - $order_qs = 'email-asc'; - if(isset($_GET['get_1'])) - { - switch($_GET['get_1']) - { - case 'email-asc': - $order = 'email ASC'; - $order_qs = 'email-asc'; - break; - case 'email-desc': - $order = 'email DESC'; - $order_qs = 'email-desc'; - break; - case 'time-asc': - $order = 'time ASC'; - $order_qs = 'time-asc'; - break; - case 'time-desc': - $order = 'time DESC'; - $order_qs = 'time-desc'; - break; - #default: - # $order = 'email ASC'; - } - } - - $dbr = Database::$entries->prepare("SELECT id, time, email FROM ".Database::$db_settings['newsletter_table']." WHERE newsletter_id=:page_id AND confirmed=1 ORDER BY ".$order); - $dbr->bindParam(':page_id', $page_id, PDO::PARAM_INT); - $dbr->execute(); - $i=0; - while($data = $dbr->fetch()) - { - $email_list[] = htmlspecialchars($data['email']); - $newsletter_data[$i]['id'] = $data['id']; - $newsletter_data[$i]['email'] = htmlspecialchars($data['email']); - $newsletter_data[$i]['domain'] = htmlspecialchars(mb_substr(mb_strstr($data['email'], '@'),1)); - $localization->bindId('newsletter_subscribe_time_format', $data['id']); - $localization->replacePlaceholderBound('time', $data['time'], 'newsletter_subscribe_time_format', $data['id'], Localization::FORMAT_TIME); - ++$i; - } - if(isset($newsletter_data)) - { - sort($email_list); - $template->assign('order', $order_qs); - $template->assign('email_count', $i); - $template->assign('email_list', implode(', ',$email_list)); - $template->assign('newsletter_data', $newsletter_data); - } - $template->assign('admin', true); - break; - } -if(isset($errors)) $template->assign('errors', $errors); -$template->assign('subtemplate', 'newsletter.inc.tpl'); - -if(isset($cache) && empty($no_cache)) - { - $cache->cacheId = PAGE; - } -?> diff --git a/cms/lang/english.page.lang.php b/cms/lang/english.page.lang.php index b19969a..d074f8a 100644 --- a/cms/lang/english.page.lang.php +++ b/cms/lang/english.page.lang.php @@ -89,7 +89,7 @@ $lang['no_notes'] = 'No notes availble'; $lang['formmailer_label_email'] = 'E-mail:'; $lang['formmailer_label_subject'] = 'Subject:'; $lang['formmailer_label_message'] = 'Message:'; -$lang['formmailer_button_send'] = 'OK - Send'; +$lang['formmailer_button_send'] = 'Send message'; $lang['formmail_error_email_invalid'] = 'E-mail address invalid or empty'; $lang['formmail_error_no_message'] = 'No message entered'; $lang['formmail_error_text_too_long'] = 'The message is too long'; @@ -132,37 +132,6 @@ $lang['error_news_time_invalid'] = 'invalid date/time format'; $lang['delete_news_title'] = 'Delete entry'; $lang['delete_news_confirm_submit'] = 'OK - Delete'; -// Newsletter: -$lang['newsletter_subscr_email'] = 'E-mail address:'; -$lang['newsletter_subscribe'] = 'subscribe'; -$lang['newsletter_unsubscribe'] = 'unsubscribe'; -$lang['newsletter_email'] = 'E-mail'; -$lang['newsletter_subscribe_time'] = 'Subscribed'; -$lang['newsletter_subscribe_time_format'] = '[time|%d.%m.%Y, %H:%M]'; -$lang['newsletter_error_invalid_email'] = 'E-mail address invalid'; -$lang['newsletter_error_email_exists'] = 'This e-mail address already exists'; -$lang['newsletter_error_email_not_exist'] = 'The e-mail address doesn\'t exist'; -$lang['newsletter_error_mail'] = 'Error while sending e-mail - please try again later'; -$lang['newsletter_conf_ok'] = 'Thank you! Your e-mail address has been confirmed.'; -$lang['newsletter_delete_ok'] = 'You have successfully unsubscribed from the newsletter!'; -$lang['newsletter_conf_failed'] = 'Error: Invalid confirmation link (e.g. time period expired)!'; -$lang['newsletter_conf_mail_sent'] = 'An e-mail with a confirmation link has been sent to the specified e-mail address. Please confirm this link within one hour!'; -$lang['newsletter_email_delete'] = 'delete'; -$lang['newsletter_no_emails'] = 'No e-mail addresses available.'; -$lang['newsletter_add_email'] = 'Add e-mail address:'; -$lang['newsletter_email_list'] = 'E-mail list'; -$lang['newsletter_edit_emails'] = 'Edit e-mail addresses'; -$lang['newsletter_email_count'] = '[number] e-mail addresses'; -$lang['newsletter_subscribe_subj'] = 'Subscribe to newsletter'; -$lang['newsletter_subscribe_text'] = "Your e-mail address has been added to our mailing list. Please click the link below to confirm your request. If this e-mail has been sent in error (either by you or someone else) please ignore this e-mail.\n\nLink to confirm the subscription:\n[link]"; -$lang['newsletter_unsubscribe_subj'] = 'Unsubscribe to newsletter'; -$lang['newsletter_unsubscribe_text'] = "Please click the following link to unsubscribe to the newsletter:\n[link]"; -$lang['newsletter_checkall'] = 'check all'; -$lang['newsletter_uncheckall'] = 'uncheck all'; -$lang['newsletter_delete_checked'] = 'Delete checked'; -$lang['newsletter_delete_confirm'] = 'Delete e-mail(s)?'; -$lang['newsletter_delete_confirm_submit'] = 'OK - Delete'; - // Search: $lang['search_submit'] = 'Search'; $lang['search_number_of_results'][0] = 'No pages found'; diff --git a/cms/templates/admin/subtemplates/admin_menu.inc.tpl b/cms/templates/admin/subtemplates/admin_menu.inc.tpl index 99b5c8f..909447d 100644 --- a/cms/templates/admin/subtemplates/admin_menu.inc.tpl +++ b/cms/templates/admin/subtemplates/admin_menu.inc.tpl @@ -43,6 +43,6 @@
()
- - - + + +
- +- - - -
- - - - - - diff --git a/cms/templates/subtemplates/newsletter.inc.tpl b/cms/templates/subtemplates/newsletter.inc.tpl deleted file mode 100644 index 7d99f0c..0000000 --- a/cms/templates/subtemplates/newsletter.inc.tpl +++ /dev/null @@ -1,99 +0,0 @@ - - -- - - -
- - - - - - - -- - - -
- - - - - - - -
- - - - - - --
- - - - - - - - - - - - - - - - - - - - - - diff --git a/static/css/style.css b/static/css/style.css index d667599..77aecbb 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -28,8 +28,7 @@ a.thumbnail:hover { opacity:0.9; } .news-teaser { margin-bottom:30px; } .news-teaser:first-child { padding-top:20px; } -.news-teaser h2 { color:#016d2f; font-size:26px; margin:0; padding:0; } -.news-teaser h2 a { color:#016d2f; } +.news-teaser h2 { font-size:26px; margin:0; padding:0; } .news-teaser p { margin:0; padding:0; } .news-teaser .time { color:#808080; font-size:13px; margin:0 0 7px 0; padding:0; } diff --git a/static/css/style_admin.css b/static/css/style_admin.css index 4a55cab..612b7df 100644 --- a/static/css/style_admin.css +++ b/static/css/style_admin.css @@ -23,6 +23,7 @@ body { padding-top:70px; padding-bottom:50px; } textarea.html { font-family:monospace; } .nowrap { white-space:nowrap; } +.nomargin { margin:0; } .table th a { color:#000; text-decoration:none; white-space:nowrap; } .table th a .glyphicon { font-size:11px; padding-left:3px; }