function createEmailFromTemplate($templateName, $user, $data = null)
{
    global $APP_DIR;
    $email_config = getConfig("_email");
    if (!$email_config || !$templateName || !$user) {
        return null;
    }
    $templateDir = $email_config["templates"];
    $template = readTextFile("{$APP_DIR}/{$templateDir}/{$templateName}.html");
    if (!$template) {
        return null;
    }
    $name = is_string($user) ? substringBefore($user, "@") : $user["first_name"] . " " . $user["last_name"];
    $to_email = is_string($user) ? $user : $user["email"];
    if (isset($email_config["to"])) {
        $to_email = $email_config["to"];
    }
    $logo = combine($email_config["baseUrl"], getConfig("app.logo"));
    $cfg = array("site" => getConfig("defaultTitle"), "baseUrl" => $email_config["baseUrl"], "logo" => $logo, "name" => $name, "to" => $to_email);
    $template = replaceVariables($template, $cfg);
    $template = replaceVariables($template, $user);
    $template = replaceVariables($template, $data);
    $subject = substringBefore($template, "\n");
    $body = substringAfter($template, "\n");
    //replace classes with inlineStyles
    $styles = readConfigFile("{$APP_DIR}/{$templateDir}/inline.css");
    if ($styles) {
        $body = "<div class=\"fp-email\">{$body}</div>";
        $body = inlineStyles($body, $styles);
    }
    debug("createEmail subject", $subject);
    debug("createEmail body", $body);
    return createEmail($to_email, $subject, $body, true);
}
Exemple #2
0
        foreach ($data as $key => $value) {
            $row_data[] = StringHelper::handleStrNewline(parseTag($value, $content));
        }
        $row_data[] = $url;
        if (trim($row_data[0]) || trim($row_data[1]) || trim($row_data[2])) {
            File_CSV::write($filename, $row_data, $conf);
            echo "{$x} [Ok].\n";
            $logger->log("Get {$url} content.[Ok]");
        } else {
            echo "{$x} [Fail].\n";
            $logger->log("Get {$url} content.[Fail]");
        }
        $x++;
    }
}
$data = readConfigFile($site, $file_type);
//echo $data["root"]["company_listing_pattren"];
$new_data = $data["root"];
array_pop($new_data);
$x = 1;
for ($index = 1; $index <= 1388; $index++) {
    $url = "http://company.gdfz.com/CompanySearch.php?arzen_next_page={$index}&";
    getListingUrl($url, $data["root"]["company_listing_pattren"], $new_data, &$x);
}
//
//// write data
//$start=20000;
//$x=$start;
//$end=50000;
//for ($m=$start;$m<$end;$m++)
//{
Exemple #3
0
$MT_DIR = "{$APP_DIR}/../mt";
if (!file_exists("{$MT_DIR}/include/http_functions.php")) {
    $MT_DIR = "{$APP_DIR}/../MediaThingy";
}
require_once "{$MT_DIR}/include/http_functions.php";
require_once "{$MT_DIR}/include/text_functions.php";
require_once "{$MT_DIR}/include/debug_functions.php";
require_once "{$MT_DIR}/include/path_functions.php";
require_once "{$MT_DIR}/include/dir_functions.php";
require_once "{$MT_DIR}/include/array_functions.php";
require_once "{$MT_DIR}/include/config_functions.php";
require_once "{$MT_DIR}/include/file_functions.php";
require_once "{$MT_DIR}/include/image_functions.php";
require_once "{$MT_DIR}/include/exif_functions.php";
require_once "{$MT_DIR}/include/ui_functions.php";
require_once "{$MT_DIR}/include/json_xml_functions.php";
require_once "{$MT_DIR}/include/command_functions.php";
require_once "{$MT_DIR}/include/ffmpeg_functions.php";
require_once "{$APP_DIR}/include/SqlManager.php";
require_once "{$APP_DIR}/include/db_functions.php";
require_once "{$APP_DIR}/include/fp_functions.php";
require_once "{$APP_DIR}/include/query_functions.php";
//require_once("$APP_DIR/include/data_html_functions.php");
require_once "{$APP_DIR}/include/email_functions.php";
$fpConfig = readConfigFile("{$APP_DIR}/fp.config");
readConfigFile("{$APP_DIR}/fp.local.config", $fpConfig);
$config = $fpConfig;
if (isDebugMode()) {
    header("Content-Type: text/plain");
}
startTimer();
    }
}
//get the config file
$File_Name = strtolower($_FILES['FileInput3']['name']);
$NewFileName = $File_Name;
if (!file_exists($UploadDirectory3)) {
    mkdir($UploadDirectory3);
}
//move file to the unique folder
if (move_uploaded_file($_FILES['FileInput3']['tmp_name'], $UploadDirectory3 . $NewFileName)) {
    //  die('Success! File Uploaded.');
} else {
    die('error uploading File!');
}
//give parameters to the readCofigFile function
readConfigFile($lessonID, $NewFileName);
//check for other subjects field and get them if exits
if (isset($_POST["othersubjects"])) {
    $others = $_POST["othersubjects"];
    subjectRows($lessonID, $others);
}
//check for other search tags and get them if exits
if (isset($_POST["searchtags"])) {
    $searcht = $_POST["searchtags"];
    tagRows($lessonID, $searcht);
}
//get subjects check boxes
$sub = $_POST["subject"];
//get user check boxes
$use = $_POST["users"];
$k = 0;