Example #1
0
 private static function _url_base()
 {
     return "http" . (sys_https() ? "s" : "") . "://" . $_SERVER["HTTP_HOST"] . dirname($_SERVER["SCRIPT_NAME"]) . "/";
 }
Example #2
0
 private static function _message($id, $data, $fields, $table)
 {
     $sgsml = new sgsml($data["folder"], "display", array($id), false);
     $message = $sgsml->att["MODULENAME"] . "\n";
     $message .= str_repeat("-", strlen($message) - 1) . "\n\n";
     foreach ($data as $key => $value) {
         if (strlen($value) == 0 or !in_array($key, $fields)) {
             continue;
         }
         $value = trim(asset::build_history($sgsml->fields[$key]["SIMPLE_TYPE"], $value, ""));
         if ($value != "") {
             $message .= $sgsml->fields[$key]["DISPLAYNAME"] . ": " . $value . "\n";
         }
     }
     $url = "http" . (sys_https() ? "s" : "") . "://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER["SCRIPT_NAME"]) . "/index.php?view=details&find=" . $table . "|" . $id;
     return $message . "\n{t}Details{/t}: " . $url;
 }
Example #3
0
 static function build_notification($module, $fields, $data_full, $data, $id, $data_row = array())
 {
     if (!is_numeric($data_full["folder"])) {
         $folder_title = basename($data_full["folder"]);
     } else {
         $folder_title = db_select_value("simple_sys_tree", "ftitle", array("id=@id@"), array("id" => $data_full["folder"]));
     }
     if (!empty($data_full["folder"])) {
         $details = "http" . (sys_https() ? "s" : "") . "://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER["SCRIPT_NAME"]);
         $details .= "/index.php?view=details&folder=" . $data_full["folder"] . "&item%5B%5D=" . $id;
     } else {
         $details = "";
     }
     $message = substr($data["history"], 0, strpos($data["history"], "\n")) . "\n\n";
     if (!empty($data_full["notification_summary"])) {
         $message .= "{t}Summary{/t}: " . trim($data_full["notification_summary"]) . "\n\n";
     }
     $title = "";
     foreach ($data_full as $key => $value) {
         if (!isset($data[$key]) and !isset($fields[$key]["REQUIRED"])) {
             continue;
         }
         if (!isset($fields[$key]["DISPLAYNAME"]) or !empty($fields[$key]["NO_SEARCH_INDEX"])) {
             continue;
         }
         if (is_array($value)) {
             $value = implode("|", $value);
         }
         if ($key != "notification_summary" and strlen($value) > 0) {
             if (!isset($data_row[$key])) {
                 $data_row[$key] = "";
             }
             $value = trim(self::build_history($fields[$key]["SIMPLE_TYPE"], $value, $data_row[$key]));
             if ($value != "") {
                 $message .= $fields[$key]["DISPLAYNAME"] . ": " . $value . "\n";
                 if ($title == "") {
                     $title = $fields[$key]["DISPLAYNAME"] . ": " . $value;
                 }
             }
         }
     }
     if ($details) {
         $message .= "\n{t}Details{/t}:\n" . $details;
     }
     $attachment = "";
     if ($module == "simple_calendar" and !empty($GLOBALS["t"])) {
         $attachment = implode("", sys_build_filename("invite.ics"));
         $ical_data = array();
         foreach ($data_full as $key => $val) {
             $ical_data[$key] = array("data" => (array) $val, "filter" => (array) $val);
         }
         $ical_data["_id"] = $id;
         file_put_contents($attachment, export::icalendar_data($ical_data), LOCK_EX);
     }
     $smtp_data = array("efrom" => "", "eto" => $data_full["notification"], "subject" => SMTP_NOTIFICATION . " - " . $folder_title . " - " . $title, "message" => $message, "attachment" => $attachment, "folder" => $data_full["folder"]);
     return $smtp_data;
 }
Example #4
0
 private function _set_base_url()
 {
     $base_url = "http" . (sys_https() ? "s" : "") . "://" . $_SERVER["HTTP_HOST"];
     if (CMS_REAL_URL == "") {
         $this->page["url"] = $base_url . $_SERVER["SCRIPT_NAME"];
     } else {
         $this->page["url"] = $base_url . CMS_REAL_URL;
     }
 }