Changeset 4b09d68 for src


Ignore:
Timestamp:
Sep 23, 2015, 7:44:28 PM (11 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
master
Parents:
363c1af
Message:

The webservice sends an email to the station owner to confirm the station creation

Location:
src/webservice
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/webservice/config/config.php.in

    r363c1af r4b09d68  
    2424        "spatialiteExtension" => "mod_spatialite.so",
    2525        "geonamesUsername" => "@WEBSERVICE_GEONAMES_USERNAME@",
     26        "mailaddressFrom" => "webmaster@example.org",
     27        "mailaddressCC" => "info@example.org",
    2628];
    2729
  • src/webservice/htdocs/SiWeather/Webservice/WebserviceApi.php

    r363c1af r4b09d68  
    413413                        // finish transaction
    414414                        $db->exec("COMMIT");
    415 
     415                       
     416                        $deletionDate = date(DATE_RFC850, time() + 14 * 24 * 60 * 60);
     417                        $mailRecipient = $json["email"];
     418                        $header = "From: ". WebserviceConfig::value("mailaddressFrom") ."\r\n" .
     419                                          "Reply-To: ". WebserviceConfig::value("mailaddressFrom") ."\r\n" .
     420                                          "CC: ". WebserviceConfig::value("mailaddressCC") ."\r\n" .
     421                                          "X-Mailer: PHP/". phpversion();
     422                        $message = "Dear user,\r\n" .
     423                                           "\r\n" .
     424                                           "please visit the following Link to confirm your newly created weather station ". $json["name"] .".\r\n" .
     425                                           "If you do not visit this link, your station will be delete in 14 days (". $deletionDate .").\r\n" .
     426                                           "\r\n" .
     427                                           WebserviceConfig::value("webserviceBaseUrl"). "/stations/". $uuid ."/confirm" ."\r\n" .
     428                                           "\r\n" .
     429                                           "Kind regards,\r\n" .
     430                                           "Your weather service\r\n";
     431                        mail($mailRecipient, \Translator::swGettext("Weather station %s - Confirmation request", $uuid), $message, $header);
    416432                        echo json_encode
    417433                        (
    418434                                [
    419435                                        "result" => "success",
    420                                         "message" => "Confirmation request is send to ". $json["email"] .".",
     436                                        "message" => "Confirmation request is send to ". $mailRecipient .". The station is fully functional already, but might be deleted in 14 days (". $deletionDate .") without any further warnings!",
    421437                                        "uuid" => $uuid,
    422438                                ]
  • src/webservice/htdocs/inc/header.php

    r363c1af r4b09d68  
    3131        <head>
    3232                <title><?php echo Translator::swGettext("SiWeather Webservice - %s", $title); ?></title>
    33                 <link rel="stylesheet" type="text/css" href="<?php echo $webserviceConfig->getConfig("webserviceBaseUrl"); ?>resources/css/webservice.css"/>
     33                <link rel="stylesheet" type="text/css" href="<?php echo SiWeather\Webservice\WebserviceConfig::value("webserviceBaseUrl"); ?>resources/css/webservice.css"/>
    3434        </head>
    3535        <body>
Note: See TracChangeset for help on using the changeset viewer.