$sql->setDagarMellanUtskick($_POST['dagar_mellan_utskick']); $sql->setQuery($_POST['query']); $sql->setTitel($_POST['titel']); $sql->setInreMall($_POST['inre_mall']); $sql->setMeddelandeId(!empty($_POST['meddelande_id']) ? $_POST['meddelande_id'] : 0); $sql->commit(); } } $urlHandler->redirect('Paminnelser', URL_ADMIN_LIST); break; case "paminnelse_meddelanden": if (empty($_GET['id'])) { $obj = new Paminnelse_meddelanden($_POST); } else { if (!is_numeric($_GET['id'])) { throw new Exception("Ett felaktigt ID angavs", 1); } else { $meddelande = Paminnelse_meddelanden::loadById($_GET['id']); $meddelande->setNamn($_POST['namn']); $meddelande->setMall($_POST['mall']); $meddelande->commit(); } } $urlHandler->redirect('Paminnelser', URL_ADMIN_LIST); break; } if (empty($_GET["redirect"])) { header("Location: " . $_SERVER["HTTP_REFERER"]); } else { header("Location: " . $_GET["redirect"]); }
<?php require_once $_SERVER["DOCUMENT_ROOT"] . "/php/init.php"; Security::demand(ADMIN); $smarty = new AdminSmarty(); $smarty->assign("pagetitle", "Påminnelser"); $queries = Paminnelse_sql::listQueries(); $smarty->assign('queries', $queries); $yttre_mallar = Paminnelse_meddelanden::listMeddelanden(); $smarty->assign('yttre_mallar', $yttre_mallar); if (isset($ADMIN) && $ADMIN->isTyp(SUPERADMIN)) { $smarty->assign('superAdmin', true); } else { $smarty->assign('superAdmin', false); } $smarty->display('paminnelser.tpl');
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/php/init.php'; $allaPaminnelser = Paminnelse_sql::listAll(); if (DEBUG) { echo "--- DEBUG INFORMATION -----------------\n"; } foreach ($allaPaminnelser as $paminnelse) { $medlemsLista = Paminnelse_sql::getAktivaByPaminnelse($paminnelse); if (count($medlemsLista)) { $query = str_replace(array('#medlemslista#', '#sql_id#'), array(implode(', ', $medlemsLista), $paminnelse->getId()), $paminnelse->getQuery()); $resultat = array(); $yttre_mall = $paminnelse->getMeddelandeId() ? Paminnelse_meddelanden::loadById($paminnelse->getMeddelandeId()) : ''; $yttre_mall_code = html_entity_decode($yttre_mall->getMall()); $res = mysql_query($query) or die(mysql_error() . "\n" . $query); while ($data = mysql_fetch_assoc($res)) { if (isset($data['epost'])) { $key = $data['epost']; $title = $paminnelse->getTitel(); $content = $paminnelse->getInreMall(); foreach ($data as $field => $value) { $content = str_replace('#' . $field . '#', $value, $content); $title = str_replace('#' . $field . '#', $value, $title); } ob_start(); eval($yttre_mall_code); $resultat[$data['epost']]['text'] = ob_get_clean(); $resultat[$data['epost']]['subject'] = $title; } } if (count($resultat)) {