public function __construct($modulename) { global $config; parent::__construct("AdminForm_{$modulename}", "admin_saveSettings"); if ($m = readConf($modulename . "_name")) { $this->addField($modulename . "_inmenu", "", "CHECKBOX", t("add.to.menu", $m))->setValue(readConf($modulename . "_inmenu", "0")); $this->addField($modulename . "_startbutton", "", "CHECKBOX", t('show.as.button.on.home', $m))->setValue(readConf($modulename . "_startbutton", "0")); $this->addField($modulename . "_sortcode", "", "INPUT_REQUIRED", t('sortnumber.in.menu'))->setValue(readConf($modulename . "_sortcode", "0")); } }
/** * get master data * @see CTModuleInterface::getMasterData() * * @return array */ public function getMasterData() { global $user, $base_url, $files_dir, $config; $res = churchdb_getMasterDataTables(); $res["feldtyp"] = churchcore_getTableData("cdb_feldtyp"); $res["fields"] = getAllFields(); $res["groups"] = getAllGroups(); $res["tags"] = getAllTags(); $res["FUNachfolgeDomains"] = array("0" => array("id" => "0", "bezeichnung" => "Kein"), "1" => array("id" => "1", "bezeichnung" => $res["fields"]["f_group"]["fields"]["gruppentyp_id"]["text"]), "2" => array("id" => "2", "bezeichnung" => $res["fields"]["f_group"]["fields"]["distrikt_id"]["text"]), "3" => array("id" => "3", "bezeichnung" => t("group"))); $res["groupMemberTypes"] = getGroupMemberTypes(); $res["groupFilterTypes"] = churchdb_getGroupFilterTypes(); // master data information for maintain masterdata and statistics if (user_access("edit masterdata", "churchdb") || user_access("view statistics", "churchdb")) { $res["masterDataTables"] = churchdb_getMasterDataTablenames(); } $res["user_pid"] = $user->id; $res["userid"] = $user->vorname . " " . $user->cmsuserid . " [" . $user->id . "]"; $res["auth"] = churchdb_getAuthForAjax(); $res["site_name"] = readConf('site_name', 'ChurchTools'); $res["modulespath"] = churchdb_getModulesPath(); $res["files_url"] = $base_url . $files_dir; $res["modulename"] = "churchdb"; $res["max_uploadfile_size_kb"] = readConf('max_uploadfile_size_kb'); $res["adminemail"] = readConf('site_mail', ''); $res["max_exporter"] = readConf('churchdb_maxexporter', '150'); $res["groupnotchoosable"] = readConf('churchdb_groupnotchoosable', 30); $res["home_lat"] = readConf('churchdb_home_lat', '53.568537'); $res["home_lng"] = readConf('churchdb_home_lng', '10.03656'); $res["settings"] = churchdb_getUserSettings($user->id); $res["last_log_id"] = churchdb_getLastLogId(); $res["mailchimp"] = readConf('churchdb_mailchimp_apikey') != ""; if (user_access("administer persons", "churchcore")) { $res["auth_table"] = churchdb_getAuthTable(); } if (isset($res["auth"]["edit newsletter"])) { $nl = churchdb_getTableData("cdb_newsletter"); $newsletter = array(); foreach ($res["auth"]["edit newsletter"] as $n) { $newsletter = $nl[$n]; } $res["newsletter"] = $newsletter; } return $res; }
/** * upload file */ function churchcore__uploadfile() { global $files_dir, $config; // list of valid extensions, ex. array("jpeg", "xml", "bmp") $allowedExtensions = array(); // max file size in bytes $sizeLimit = ($s = readConf("max_uploadfile_size_kb")) ? $s * 1024 : 10 * 1024 * 1024; $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); $file_dir = $files_dir . "/files/" . $_GET["domain_type"] . "/"; if (isset($_GET["domain_id"])) { $file_dir .= $_GET["domain_id"]; } if (!file_exists($file_dir)) { mkdir($file_dir, 0777, true); } $result = $uploader->handleUpload($file_dir . "/"); // to pass data through iframe you will need to encode all html tags echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); }
function home_main() { global $config, $files_dir, $mapping; if ($m = readConf("admin_message")) { addErrorMessage($m); } checkFilesDir(); $btns = churchcore_getModulesSorted(); if (isset($_SESSION["family"])) { addInfoMessage(t('there.are.more.users.with.the.same.email')); } $txt = ' <div class="hero-unit hidden-phone"> <h1>' . $config["welcome"] . '</h1> <p class="hidden-phone">' . $config["welcome_subtext"] . '</p> <p>'; foreach ($btns as $key) { if (isset($config[$key . "_startbutton"]) && $config[$key . "_startbutton"] == "1" && user_access("view", $key)) { $txt .= '<a class="btn btn-large" href="?q=' . $key . '">' . $config[$key . "_name"] . '</a> '; } } $txt .= '</p>'; $txt .= '</div>'; $txt .= '<div class="well visible-phone"> <h1>' . t("welcome") . '!</h1> <p>' . $_SESSION["user"]->vorname . ', ' . t("chose.your.possibilities") . ':</p> <ul class="nav nav-pills nav-stacked">'; foreach ($btns as $key) { if (isset($config[$key . "_name"]) && $config[$key . "_name"] != "" && user_access("view", $key)) { include_once SYSTEM . '/' . $mapping[$key]; $txt .= '<li><a class="btn btn-large" href="?q=' . $key . '">' . $config[$key . "_name"] . '</a> '; } } $txt .= '</ul>'; $txt .= '</div>'; // blocks[]: label, col(1,2,3) sortkey, html $blocks = null; foreach ($btns as $key) { if (!empty($config[$key . "_name"])) { include_once SYSTEM . '/' . $mapping[$key]; if (function_exists($key . "_blocks")) { $b = call_user_func($key . "_blocks"); foreach ($b as $block) { $blocks[$block["col"]][] = $block; } } } } $txt .= '<div class="row-fluid">'; for ($i = 1; $i <= 3; $i++) { $txt .= '<ul class="span4">'; if (isset($blocks[$i])) { churchcore_sort($blocks[$i], "sortkey"); foreach ($blocks[$i] as $block) { if ($block["html"] != null && $block["html"] != "") { $txt .= '<li class="ct_whitebox'; if (isset($block["class"])) { $txt .= ' ' . $block["class"]; } $txt .= '">'; $txt .= '<label class="ct_whitebox_label">' . $block["label"] . "</label>"; if (isset($block["help"])) { $txt .= '<div style="float:right;margin:-34px -12px">'; $txt .= '<a href="http://intern.churchtools.de?q=help&doc=' . $block["help"] . '" title="' . t("open.help") . '" target="_clean"><i class="icon-question-sign"></i></a>'; $txt .= '</div>'; } $txt .= $block["html"]; } } } $txt .= '</ul>'; } $txt .= '</div>'; drupal_add_js(MAIN . '/home.js'); return $txt; }
if ($q == "login") { echo ' class="active"'; } echo '><a href="?q=login"><i class="icon-user icon-white"></i> ' . t("login") . '</a></li>'; ?> </ul> </div> <?php } ?> <div class="nav-collapse"> <ul class="nav"> <?php $arr = churchcore_getModulesSorted(); foreach ($arr as $key) { if (readConf($key . "_name") && readConf($key . "_inmenu") == "1" && (user_access("view", $key) || in_array($key, $mapping["page_with_noauth"]))) { echo "<li "; if ($q == $key) { echo 'class="active"'; } echo '><a href="?q=' . $key . '">'; echo $config[$key . "_name"]; echo "</a></li>" . NL; } } ?> </ul> <!--form class="navbar-search pull-right"> <input type="text" class="search-query" placeholder="Search"> </form-->
function admin_main() { global $config; drupal_add_css(ASSETS . '/fileuploader/fileuploader.css'); drupal_add_js(ASSETS . '/fileuploader/fileuploader.js'); $model = new CTForm("AdminForm", "admin_saveSettings"); $model->addField("site_name", "", "INPUT_REQUIRED", t("name.of.website"))->setValue($config["site_name"]); $model->addField("site_logo", "", "FILEUPLOAD", t("logo.of.website"))->setValue(readConf("site_logo")); $model->addField("welcome", "", "INPUT_REQUIRED", t("welcome.message")); $model->fields["welcome"]->setValue($config["welcome"]); $model->addField("welcome_subtext", "", "INPUT_REQUIRED", "Untertitel der Willkommensnachricht"); $model->fields["welcome_subtext"]->setValue($config["welcome_subtext"]); $model->addField("login_message", "", "INPUT_REQUIRED", "Willkommensnachricht vor dem Login"); $model->fields["login_message"]->setValue($config["login_message"]); $model->addField("invite_email_text", "", "TEXTAREA", "Text der Einladungs-EMail"); $model->fields["invite_email_text"]->setValue($config["invite_email_text"]); $model->addField("admin_message", "", "INPUT_OPTIONAL", "Admin-Nachricht auf Login- und Startseite z.B. für geplante Downtimes"); $model->fields["admin_message"]->setValue(variable_get("admin_message", "")); if (!isset($config["site_startpage"])) { $config["site_startpage"] = "home"; } $model->addField("site_startpage", "", "INPUT_REQUIRED", "Startseite beim Aufrufen von " . variable_get("site_name") . " (Standard ist <i>home</i>, möglich ist z.B. churchwiki, churchcal)"); $model->fields["site_startpage"]->setValue($config["site_startpage"]); $model->addField("site_mail", "", "EMAIL", "E-Mail-Adresse der Website (E-Mails werden von hier aus gesendet)"); $model->fields["site_mail"]->setValue($config["site_mail"]); if (!isset($config["admin_mail"])) { $config["admin_mail"] = $config["site_mail"]; } $model->addField("admin_mail", "", "EMAIL", "E-Mail-Adressen der Admins für Anfragen von Benutzern (Kommasepariert)"); $model->fields["admin_mail"]->setValue($config["admin_mail"]); // Now iterate through each module for naming the module $modules = churchcore_getModulesSorted(false, true); foreach ($modules as $module) { $model->addField($module . "_name", "", "INPUT_OPTIONAL", "Name für <i>{$module}</i> (Bitte Feld leerlassen, wenn das Modul nicht benötigt wird)"); $model->fields[$module . "_name"]->setValue(variable_get($module . "_name", "")); } $model->addField("max_uploadfile_size_kb", "", "INPUT_REQUIRED", "Maximale Upload-Dateigrösse in Kilobytes (z.B. 10MB entsprechen hier ca. 10000)"); $model->fields["max_uploadfile_size_kb"]->setValue($config["max_uploadfile_size_kb"]); $model->addField("cronjob_delay", "", "INPUT_REQUIRED", "Zeit in Sekunden zwischen automatischen Cronjob (0=kein automatischer Cron, sinnvolle Werte z.B. 3600)"); $model->fields["cronjob_delay"]->setValue($config["cronjob_delay"]); $model->addField("timezone", "", "INPUT_REQUIRED", "Standard-Zeitzone. Z.b. Europe/Berlin"); $model->fields["timezone"]->setValue($config["timezone"]); $model->addField("show_remember_me", "", "CHECKBOX", "Anzeige von <i>Zukünftig an mich erinnern</i> auf der Login-Seite"); $model->fields["show_remember_me"]->setValue($config["show_remember_me"]); $model->addField("mail_enabled", "", "CHECKBOX", "Senden von E-Mails erlauben"); $model->fields["mail_enabled"]->setValue($config["mail_enabled"]); $model->addField("site_offline", "", "CHECKBOX", "Seite offline schalten"); $model->fields["site_offline"]->setValue($config["site_offline"]); $model->addButton("Speichern", "ok"); $txtCommonForm = $model->render(); // Now iterate through each module getting the admin forms $m = array(); foreach ($modules as $module) { include_once constant(strtoupper($module)) . "/{$module}.php"; if (function_exists($module . "_getAdminForm")) { $model = call_user_func($module . "_getAdminForm"); if ($model != null) { $m[$module] = $model->render(); } } } $txt = '<h1>' . t("settings.for", variable_get("site_name")) . '</h1><p>Der Administrator kann hier Einstellung vornehmen. Diese gelten für alle Benutzer, bitte vorsichtig anpassen!</p>'; $txt .= '<div class="tabbable">'; $txt .= '<ul class="nav nav-tabs">'; $txt .= '<li class="active"><a href="#tab1" data-toggle="tab">' . t("general") . '</a></li>'; foreach ($modules as $module) { if (isset($m[$module]) && isset($config[$module . "_name"]) && $config[$module . "_name"] != "") { $txt .= '<li><a href="#tab' . $module . '" data-toggle="tab">' . $config[$module . "_name"] . '</a></li>'; } } $txt .= '</ul>'; $txt .= '<div class="tab-content">'; $txt .= '<div class="tab-pane active" id="tab1">'; $txt .= $txtCommonForm; $txt .= '</div>'; foreach ($modules as $module) { if (isset($m[$module])) { $txt .= '<div class="tab-pane" id="tab' . $module . '">'; $txt .= $m[$module]; $txt .= '</div>'; } } $txt .= '</div></div>'; return $txt; }
/** * send person an invitation with singleuse loginstring per email * * @param int $id */ function churchdb_invitePersonToSystem($id) { global $base_url; $loginstr = churchcore_createOnTimeLoginKey($id); $content = "<h3>Hallo [Vorname],</h3><P>"; $content .= htmlize(readConf('invite_email_text', "invitation.email.standard.text", readConf('site_name', 'ChurchTools'))); $content .= '<p><a href="' . $base_url . "?q=profile&loginstr={$loginstr}&id={$id}" . '" class="btn btn-royal">Auf %sitename anmelden</a>'; $res = churchcore_sendEMailToPersonIds($id, "Einladung zu " . readConf('site_name', 'ChurchTools'), $content, readConf('site_mail'), true); cdb_log("Person {$id} wurde zu " . readConf('site_name', 'ChurchTools') . " eingeladen:" . $content, 2, $id); }
/** * echo ical for services to do from user id (read from request) */ function churchservice_ical() { global $base_url, $config; if (!($id = readVar("id"))) { echo t("please.specify.id"); } drupal_add_http_header('Content-Type', 'text/calendar;charset=utf-8', false); drupal_add_http_header('Content-Disposition', 'inline;filename="ChurchTools.ics"', false); drupal_add_http_header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', false); drupal_add_http_header('Cache-Control', 'private', false); $content = drupal_get_header(); include_once './' . CHURCHSERVICE . '/churchservice_db.php'; $arr = churchservice_getUserCurrentServices($id); // TODO: use txt Template $txt = ""; foreach ($arr as $res) { $txt .= "BEGIN:VEVENT\r\n"; $txt .= "ORGANIZER:MAILTO:" . readConf('site_mail', '') . "\r\n"; if ($res->zugesagt_yn == 1) { $txt .= "SUMMARY:" . $res->dienst . " (" . $res->servicegroup . ")\r\n"; } else { $txt .= "SUMMARY:Anfrage: " . $res->dienst . " (" . $res->servicegroup . ")?\r\n"; } $txt .= "X-MICROSOFT-CDO-BUSYSTATUS:BUSY\r\n"; $txt .= "URL:" . $base_url . "/?q=churchservice/entrylist\r\n"; if ($res->ort != "") { $txt .= "LOCATION:" . $res->ort . "\r\n"; } $txt .= "DESCRIPTION:" . $res->dienst . " (" . $res->servicegroup . ") bei " . $res->event . "."; if ($res->zugesagt_yn == 1) { $txt .= "\r\n"; } else { $txt .= " " . t("request.from") . " {$res->vorname} {$res->name} [{$res->modified_pid}]\r\n"; } $txt .= "DTSTAMP:" . $res->modified_date . "\r\n"; $txt .= "UID:" . $res->eventservice_id . "\r\n"; $txt .= "DTSTART;TZID=" . $config["timezone"] . ":" . $res->datum_start . "\r\n"; $txt .= "DTEND;TZID=" . $config["timezone"] . ":" . $res->datum_end . "\r\n"; $txt .= "END:VEVENT\r\n"; } echo surroundWithVCALENDER($txt); }
/** * process uploaded files (test, save to DB + upload dir) * * @param string $uploadDirectory * @param bool $replaceOldFile * * @return array ('success'=>true) or ('error'=>'error message') */ function handleUpload($uploadDirectory, $replaceOldFile = false) { global $user; if (!is_writable($uploadDirectory)) { return array('error' => t("uploaddircetdory.not.writable")); } if (!$this->file) { return array('error' => t('no.uploaded.files')); } $size = $this->file->getSize(); if ($size == 0) { return array('error' => t('file.is.empty')); } if ($size > $this->sizeLimit) { return array('error' => t('file.is.to.large')); } $pathinfo = pathinfo($this->file->getName()); $bezeichnung = $pathinfo['filename']; // $filename = "aaaaa"; $filename = md5(uniqid()); $ext = $pathinfo['extension']; if ($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)) { return array('error' => t('invalid.fileextension.should.be.one.of.this', implode(', ', $this->allowedExtensions))); } if ($domainType = readConf("domain_type") && ($domainId = readConf("domain_id"))) { $dt = new DateTime(); $id = db_insert('cc_file')->fields(array("domain_type" => $domainType, "domain_id" => $domainId, "filename" => $filename . '.' . $ext, "bezeichnung" => $bezeichnung . '.' . $ext, "modified_date" => $dt->format('Y-m-d H:i:s'), "modified_pid" => $user->id))->execute(); } else { $id = null; } $filename_absolute = "{$uploadDirectory}{$filename}.{$ext}"; if ($this->file->save($filename_absolute)) { // If image should be resized if ($resize = readVar("resize") && $this->check_jpeg($filename_absolute)) { list($width, $height) = getimagesize($filename_absolute); if ($width > $height) { $new_width = $resize; $new_height = $height * $new_width / $width; } else { $new_height = $resize; $new_width = $width * $new_height / $height; } $image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefromjpeg($filename_absolute); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Output imagejpeg($image_p, $filename_absolute, 100); } return array('success' => true, "id" => $id, "filename" => "{$filename}.{$ext}", "bezeichnung" => "{$bezeichnung}.{$ext}"); } else { return array('error' => t('could.not.save.file.upvoad.canceled.ot.server.error')); } }
/** * Main entry point for churchtools. * This will be called from /index.php * Function loads i18n, configuration, check data security. * If everything is ok, it calls churchtools_processRequest() */ function churchtools_app() { global $q, $q_orig, $currentModule, $add_header, $config, $mapping, $content, $base_url, $files_dir, $user, $embedded, $i18n; include_once CHURCHCORE . "/churchcore_db.php"; $files_dir = DEFAULT_SITE; // which module is requested? $q = $q_orig = readVar("q", userLoggedIn() ? "home" : readConf("site_startpage", "home")); // $currentModule is needed for class autoloading and maybe other include paths list($currentModule) = explode('/', readVar("q")); // get first part of $q or churchcore $embedded = readVar("embedded", false); $base_url = getBaseUrl(); $config = loadConfig(); if ($config) { if (db_connect()) { // DBConfig overwrites the config files loadDBConfig(); date_default_timezone_set(variable_get("timezone", "Europe/Berlin")); if (isset($_COOKIE["language"])) { $config["language"] = $_COOKIE["language"]; } // Load i18n churchcore-bundle if (!isset($config["language"])) { if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $config["language"] = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); } else { $config["language"] = "de"; } } $i18n = new TextBundle(CHURCHCORE . "/resources/messages"); $i18n->load("churchcore", $config["language"] != null ? $config["language"] : null); // Session Init if (!file_exists($files_dir . "/tmp")) { @mkdir($files_dir . "/tmp", 0775, true); } if (!file_exists($files_dir . "/tmp")) { // Admin should act accordingly, default suggestion is 0755. addErrorMessage(t("permission.denied.write.dir", $files_dir)); } else { session_save_path($files_dir . "/tmp"); } session_name("ChurchTools_" . $config["db_name"]); session_start(); register_shutdown_function('handleShutdown'); // Check for offline mode. If it's activated display message and return false; if (readConf("site_offline") == 1) { if (!isset($_SESSION["user"]) || !in_array($_SESSION["user"]->id, readconf("admin_ids"))) { echo t("site.is.down"); return false; } } $embedded = readVar("embedded", false); $mapping = loadMapping(); $success = true; // Check for DB-Updates and loginstr only if this is not an ajax call. if (strrpos($q, "ajax") === false) { $success = checkForDBUpdates(); } if ($success) { // Is there a loginstr which does not fit to the current logged in user? if (readVar("loginstr") && readVar("id") && userLoggedIn() && $_SESSION["user"]->id != readVar("id")) { logout_current_user(); session_start(); } else { loadUserObjectInSession(); } } if ($success) { if (isset($_SESSION['user'])) { $user = $_SESSION['user']; } // Accept data security? if (userLoggedIn() && !isset($_SESSION["simulate"]) && $q != "logout" && isset($config["accept_datasecurity"]) && $config["accept_datasecurity"] == 1 && !isset($user->acceptedsecurity)) { $content .= pleaseAcceptDatasecurity(); } else { $content .= churchtools_processRequest($q); } } } } include INCLUDES . "/header.php"; echo $content; include INCLUDES . "/body.php"; }
function churchservice_inform_leader() { global $base_url; include_once "churchservice_db.php"; // Hole erst mal die Gruppen_Ids, damit ich gleich nicht alle Personen holen mu� $res = db_query("SELECT cdb_gruppen_ids FROM {cs_service} where cdb_gruppen_ids!='' and cdb_gruppen_ids is not null"); $arr = array(); foreach ($res as $g) { $arr[] = $g->cdb_gruppen_ids; } if (count($arr) == 0) { return false; } // Hole nun die Person/Gruppen wo die Person Leiter oder Co-Leiter ist $res = db_query("SELECT p.id person_id, gpg.gruppe_id, p.email, p.vorname, p.cmsuserid FROM {cdb_person} p, {cdb_gemeindeperson_gruppe} gpg, {cdb_gemeindeperson} gp\n where gpg.gemeindeperson_id=gp.id and p.id=gp.person_id and status_no>=1 and status_no<=2\n and gpg.gruppe_id in (" . implode(",", $arr) . ")"); // Aggregiere nach Person_Id P1[G1,G2,G3],P2[G3] $persons = array(); foreach ($res as $p) { $data = churchcore_getUserSettings("churchservice", $p->person_id); // Darf er �berhaupt noch, und wenn ja dann schaue ob der Leiter es will. // (Wenn noch nicht best�tigt, dann wird davon ausgegangen $auth = getUserAuthorization($p->person_id); if (isset($auth["churchservice"]["view"]) && (!isset($data["informLeader"]) || $data["informLeader"] == 1)) { if (!isset($data["informLeader"])) { $data["informLeader"] = 1; churchcore_saveUserSetting("churchservice", $p->person_id, "informLeader", "1"); } if (isset($persons[$p->person_id])) { $arr = $persons[$p->person_id]["group"]; } else { $persons[$p->person_id] = array(); $arr = array(); $persons[$p->person_id]["service"] = array(); $persons[$p->person_id]["person"] = $p; } $arr[] = $p->gruppe_id; $persons[$p->person_id]["group"] = $arr; } } // Gehe nun die Personen durch und schaue wer seit einer Zeit keine Mail mehr bekommen hatte. foreach ($persons as $person_id => $p) { if (!churchcore_checkUserMail($person_id, "informLeaderService", -1, 6 * 24)) { $persons[$person_id] = null; } } // Suche nun dazu die passenden Services $res = db_query("SELECT cdb_gruppen_ids, bezeichnung, id service_id FROM {cs_service} where cdb_gruppen_ids is not null"); foreach ($res as $d) { $gruppen_ids = explode(",", $d->cdb_gruppen_ids); foreach ($persons as $key => $person) { if ($person != null) { foreach ($person["group"] as $person_group) { if (in_array($person_group, $gruppen_ids)) { $persons[$key]["service"][] = $d->service_id; } } } } } // Gehe nun die Personen durch und suche nach Events foreach ($persons as $person_id => $person) { if ($person != null) { $res = db_query("SELECT es.id, c.bezeichnung event, DATE_FORMAT(e.startdate, '%d.%m.%Y %H:%i') datum, es.name, s.bezeichnung service \n FROM {cs_event} e, {cs_eventservice} es, {cs_service} s, {cc_cal} c \n where e.valid_yn=1 and c.id=e.cc_cal_id and es.service_id in (" . implode(",", $person["service"]) . ")\n and es.event_id=e.id and es.service_id=s.id and es.valid_yn=1 and zugesagt_yn=0\n and e.startdate>current_date and datediff(e.startdate,CURRENT_DATE)<=60 order by e.startdate"); $txt = ''; foreach ($res as $es) { $txt .= "<li>" . $es->datum . " " . $es->event . " - Dienst " . $es->service . ": "; $txt .= '<font style="color:red">'; if ($es->name == null) { $txt .= "?"; } else { $txt .= $es->name . "?"; } $txt .= '</font>'; } if ($txt != '') { $txt = "<h3>Hallo " . $person["person"]->vorname . "!</h3><p>Es sind in den nächsten 60 Tagen noch folgende Dienste offen:<ul>" . $txt . "</ul>"; $txt .= '<p><a href="' . $base_url . '/?q=churchservice" class="btn">' . t("more.information") . '</a> '; $txt .= '<p><a href="' . $base_url . '/?q=churchservice#SettingsView" class="btn">Benachrichtigung deaktivieren</a>'; churchservice_send_mail("[" . readConf('site_name', 'ChurchTools') . "] Offene Dienste", $txt, $person["person"]->email); } } } }
#!/usr/local/php/bin/php <?php require "s3.php"; date_default_timezone_set('Europe/Bucharest'); $confFile = "/data/up2S3/Resources/Publish/updateConfigFiles.txt"; $ResFile = "/data/up2S3/Resources/Publish/updateReouceFiles.txt"; $s3Conf = "Resources/Configuration/"; $s3Res = "Resources/"; $localConf = "/data/up2S3/Resources/Configuration/"; $localRes = "/data/up2S3/Resources/"; readConf($confFile, $localConf, $s3Conf); readConf($ResFile, $localRes, $s3Res); upVersionFile($s3Res, $confFile); upVersionFile($s3Res, $ResFile); echo "version file update successed!" . PHP_EOL; function upVersionFile($s3path, $file) { putFile2AmazonS3($s3path . "Publish" . strrchr($file, "/"), $file); } function readConf($file, $path, $s3Conf) { $fh = fopen($file, "r") or die("Unable to open file!"); $line = fgets($fh); while (!feof($fh)) { $line = fgets($fh); $arr = explode("\t", $line, 2); if (isset($arr[0]) && isset($arr[1])) { $newFile = $arr[0] . "_" . $arr[1]; $newFile = trim($newFile); $localF = $path . $newFile; $S3F = $s3Conf . $newFile;