function sendSignupEmails($customer_model, $commande_model)
 {
     global $payment_method;
     // Email Yii::app()->params['adminEmail'] with new user signup
     $message = new YiiMailMessage();
     $message->view = 'template';
     $order_totals = Yii::app()->user->OrderTotals;
     // Pass the credit card info if needed
     if (isset($_POST['cc'])) {
         Yii::app()->user->setState('cc', $_POST['cc']);
         $cc_images = array();
         foreach (array('cc_sideone', 'cc_sidetwo') as $cc_image) {
             // Save credit card images
             $cc_side = CUploadedFile::getInstanceByName($cc_image);
             if ($cc_side != null) {
                 $path = getUploadPath($cc_side);
                 $cc_side->saveAs($path);
                 // Massage the path names so they're clickable URLs
                 $path = pathToUrl($path);
                 $cc_images[$cc_image] = $path;
             }
         }
         $message->setBody(array('include' => 'new-signup.php', 'customer' => $customer_model, 'commande' => $commande_model, 'order_totals' => $order_totals, 'cc' => $_POST['cc'], 'cc_images' => $cc_images), 'text/html');
     } else {
         $message->setBody(array('include' => 'new-signup.php', 'customer' => $customer_model, 'commande' => $commande_model, 'order_totals' => $order_totals), 'text/html');
     }
     // TODO: VERY IMPORTANT TO REMOVE THIS BCC ONCE YOU HIT PRODUCTION!
     $message->addTo(Yii::app()->params['adminEmail']);
     $message->addFrom(Yii::app()->params['adminEmail']);
     $message->setSubject("New User Signup");
     Yii::app()->mail->send($message);
     // Email user welcome message
     $message = new YiiMailMessage();
     $message->view = 'template';
     //userModel is passed to the view
     $message->setBody(array('include' => 'welcome.php', 'customer' => $customer_model, 'payment_method' => $payment_method), 'text/html');
     $message->addTo($customer_model->bilemail);
     $message->addFrom(Yii::app()->params['adminEmail']);
     $message->setSubject("Welcome to Mailnetwork!");
     Yii::app()->mail->send($message);
 }
Beispiel #2
0
            if (empty($G['errors']['file' . $i])) {
                $data['file' . $i] = array('name' => $f['name'], 'tmp_name' => $f['tmp_name']);
            }
        }
    }
    // public date
    //$data['created_date'] = _post('start_year') . '-' . _post('start_month') . '-' . _post('start_day') . ' ' . _post('start_hour') . ':' . _post('start_min') . ':00';
    $s = intval(_post('start_year')) . '-' . intval(_post('start_month')) . '-' . intval(_post('start_day')) . ' ' . intval(_post('start_hour')) . ':' . intval(_post('start_min')) . ':00';
    //$date = DateTime::createFromFormat('Y-n-j G:i:s', $s);
    //$data['created_date'] = $date->getTimestamp();
    $data['created_date'] = strtotime($s);
    if (empty($G['errors'])) {
        // move file upload for check
        for ($i = 1; $i <= 5; $i++) {
            if (isset($data['file' . $i])) {
                $path = getUploadPath();
                $filename = uniqid() . $i . '_' . rand() . rand() . '_' . uniqid() . '.' . pathinfo($data['file' . $i]['name'], PATHINFO_EXTENSION);
                //if (move_uploaded_file($data['file' . $i]['tmp_name'], UPLOAD_PATH . '/' . $path . '/' . $filename)) {
                if (move_uploaded_file($data['file' . $i]['tmp_name'], UPLOAD_PATH . '/tmp/' . $filename)) {
                    //$data['file' . $i]['path'] = $path . '/' . $filename;
                    $data['file' . $i]['path'] = $filename;
                } else {
                    exit('Sorry, there was an error uploading your file.');
                }
            }
        }
        $G['data'] = $data;
        render('post-check');
        return;
    }
}
function doTextLink ($pagename, $attrstr, $linktext='') {
	$attribs = new Attributes($attrstr);
	$attr = $attribs->getAttribs('html');
	if (!isset($attr['file'])) 
		return '';
	if (!file_exists(getUploadPath($pagename, $attr['file']))) {
		global $ScriptUrl;
		$msg = "textlink file <i>$attr[file]</i> not found<br>";
		$msg.= "<a href='$ScriptUrl?n=$pagename/?action=upload&upname=$attr[file]'>upload now</a>";
		return Keep(errorHTML($msg));
	}
	$url = FmtPageName("\$PageUrl?action=m2m-showfile&amp;f=$attr[file]", $pagename);
	if ($linktext == '')
		return Keep("<a href='$url'>$attr[file]</a>");
	return Keep("<a href='$url'>").$linktext.Keep("</a>");
}
function HandleM2MShowFile ($pagename, $auth='read') {
	$file = $_REQUEST['f'];
	$path = getUploadPath($pagename, $file);
	if (file_exists($path)) {
		print "<html><head><title>Content of file $file</title></head><body><pre>";
		$f = fopen($path, 'r');
		while (!feof($f)) 
			print str_replace('<', '&lt;', fgets($f));
		fclose($f);
		print "</pre></body></html>";
	}
}
Beispiel #5
0
/**
 * Tries to match the PlantUML given as argument against the cache. 
 * If the picture has not been rendered before, it'll
 * try to render the PlantUML and drop it in the picture cache directory.
 * Embedded links will be expanded into a image map file with the same
 * name, but extension ".cmapx". When found, it will be included in the
 * results.
 *
 * @param string model in been format
 * @returns an array with four elements:
 *   'src':   the webserver based URL to a picture which contains the
 *            requested PlantUML model. If anything fails, this value is
 *            false.
 *   'file':  the full pathname to the file containing the image map data
 *            when present. When no map data is present, this value is empty.
 *   'map':   the rendered HTML-fragment for an image map. Empty when not
 *            needed.
 *   'mapid': the unique id for the rendered image map , useable for further
 *            HTML-rendering.
 */
function getImage($PlantUML_Source, $argv, $parser = null)
{
    global $plantumlImagetype;
    global $usecloud;
    // Compute hash
    $title_hash = md5(getPageTitle($parser));
    $formula_hash = md5($PlantUML_Source);
    $filename_prefix = 'uml-' . $title_hash . "-" . $formula_hash;
    $dirname = getUploadDirectory();
    $full_path_prefix = $dirname . "/" . $filename_prefix;
    $result = array('mapid' => $formula_hash, 'src' => false, 'map' => '', 'file' => '');
    $imgFile = $dirname . "/" . $filename_prefix . ".{$plantumlImagetype}";
    // Check cache. When found, reuse it. When not, generate image.
    // Honor the redraw tag as found in <uml redraw>
    if (is_file($imgFile) and !array_key_exists('redraw', $argv)) {
        $result['file'] = $imgFile;
    } else {
        if ($usecloud) {
            $result['file'] = renderPlantUML_cloud($PlantUML_Source, $imgFile);
        } else {
            $result['file'] = renderPlantUML($PlantUML_Source, $imgFile, $dirname, $filename_prefix);
        }
    }
    if ($result['file']) {
        $result['src'] = getUploadPath() . "/" . basename($result['file']);
        if (!$usecloud && $plantumlImagetype == 'png') {
            $map_filename = $full_path_prefix . ".cmapx";
            if (is_file($map_filename)) {
                // map file is temporary data - read it and delete it.
                $fp = fopen($map_filename, 'r');
                $image_map_data = fread($fp, filesize($map_filename));
                fclose($fp);
                //unlink($map_filename);
                // Replace generic ids with unique ids: first two ".." fields.
                $result['map'] = preg_replace('/"[^"]*"/', "\"{$result['mapid']}\"", $image_map_data, 2);
            }
        }
    }
    return $result;
}