build_start("Custom T-shirts and Drinking Mugs - Design Online - Personalized Gifts from Family Matrix","Design Personalized Gift for Birthdays, Graduations, Family Reunions, New Baby - Free Shipping" ,
"apparel,awesome,baby gift,birthday,birthday gift,clothing,coffee mugs,cool t shirts,cool t-shirts,custom coffee mugs,custom logo printed shirt,custom made shirts,custom made t shirts,custom mugs,custom printed shirts,
custom printed t shirt,custom printed t shirts,custom printed tee shirts,custom printing shirt t,custom screen printing,custom shirt,custom shirts,custom sweatshirt,custom t shirt,custom t shirt printing,custom t shirt screen printing,
custom t shirts,custom tee shirts,design,design your own,designer,designs,family memories,family reunion,family reunions,family reunions gift,famiy matrix,free,free shipping,funny tee shirts,funny tees,funny tshirts,gramdparent gift,
graphic tees,high school graduation,high school graduation gift,long sleeve t-shirt,long-sleeve,mothers day,mothers day gift,mugs,new baby,parent gift,personalized,personalized gifts,printed,printed t shirt,printed t shirts,
printed tshirt,screen printed t shirt,screen printed t shirts,screen printed t-shirts,screen printing,screen printing shirt,screen printing t shirts,screen printing tee shirt,screen-printing,shirt,shirt design,shirt printing,
shirts,short sleeve t-shirt,shrits,silk screen printing,silk screen t shirts,silk screen tee shirts,snorg tees,t shirt,t shirt printers,t shirt printing,t shirt screen printing,t shirts,tee,tee shirt printers,tee shirts,tees,
tee-shirt,teeshirts,tshirt,t-shirt,tshirts,t-shirts,unique,unique,unique design,unique gift,unique gifts,vintage,wholesale screen printing,wholesale t-shirts");
$formarray["words1"] = General::alpha_clean($formarray["words1"]);
$formarray["words2"] = General::alpha_clean($formarray["words2"]);
$formarray["words3"] = General::alpha_clean($formarray["words3"]);
$formarray["words4"] = General::alpha_clean($formarray["words4"]);
if($formarray["method"] != "") {
switch($formarray["method"]) {
case "clear":
unset($formarray["words1"]);
unset($formarray["words2"]);
unset($formarray["words3"]);
unset($formarray["words4"]);
unset($formarray["matrix_title"]);
unset($_SESSION["sess_latest_xml"]);
unset($_SESSION["sess_box1"]);
unset($_SESSION["sess_box2"]);
unset($_SESSION["sess_box3"]);
unset($_SESSION["sess_box4"]);
unset($_SESSION["sess_matrix_title"]);
unset($_SESSION["sess_title_color"]);
unlink(SITE_PATH."tmp/".session_id().".png");
unlink(SITE_PATH."tmp/".session_id()."_thumbnail.png");
$generate_matrix = false;
break;
case "generate":
$formarray["words"][1] = $formarray["words1"];
$formarray["words"][2] = $formarray["words2"];
$formarray["words"][3] = $formarray["words3"];
$formarray["words"][4] = $formarray["words4"];
$generate_matrix = true;
break;
}
} else {
if ($formarray["uid"] != "") {
// they clicked one one to see it...
// make sure they own it then draw it here!
$saved_matrix = $page->db->query("select * from saved_matrixes where uid='".$formarray["uid"]."' limit 1");
if (count($saved_matrix) == 1 && ($saved_matrix[0]["user_uid"] == $_SESSION["sess_uid"] || $saved_matrix[0]["user_uid"] == session_id())) {
$x = $saved_matrix[0];
$formarray["words1"] = $x["box1"];
$formarray["words2"] = $x["box2"];
$formarray["words3"] = $x["box3"];
$formarray["words4"] = $x["box4"];
$formarray["words"][1] = $formarray["words1"];
$formarray["words"][2] = $formarray["words2"];
$formarray["words"][3] = $formarray["words3"];
$formarray["words"][4] = $formarray["words4"];
$_SESSION["sess_box1"] = $formarray["words1"];
$_SESSION["sess_box2"] = $formarray["words2"];
$_SESSION["sess_box3"] = $formarray["words3"];
$_SESSION["sess_box4"] = $formarray["words4"];
$_SESSION["sess_matrix_title"] = $x["matrix_title"];
$_SESSION["sess_title_color"] = $x["title_color"];
$formarray["matrix_title"] = $x["matrix_title"];
$formarray["title_color"] = $x["title_color"];
$_SESSION["sess_latest_xml"] = $x["xml"];
require(SITE_PATH.'/Classes/MatrixClasses/php_crossword_output.class.php');
$success = true;
}
} else {
if (isset($_SESSION["sess_latest_xml"])) {
// they HAD a design and navigated away and are back....
$formarray["words1"] = $_SESSION["sess_box1"];
$formarray["words2"] = $_SESSION["sess_box2"];
$formarray["words3"] = $_SESSION["sess_box3"];
$formarray["words4"] = $_SESSION["sess_box4"];
$formarray["matrix_title"] = $_SESSION["sess_matrix_title"];
$formarray["title_color"] = $_SESSION["sess_title_color"];
$formarray["words"][1] = $formarray["words1"];
$formarray["words"][2] = $formarray["words2"];
$formarray["words"][3] = $formarray["words3"];
$formarray["words"][4] = $formarray["words4"];
require(SITE_PATH.'/Classes/MatrixClasses/php_crossword_output.class.php');
$success = true;
} else {
// they HAD no design show them the default
$_SESSION["sess_latest_xml"] = "202013- JERRY81113
- MARYCLAIRE9222
- PATRICIA11821
- KAREN101513
- KELLY6713
- PATRICK11812
- KIM6723
- COLLIN141022
- JIM15721
- ADAM3914
- ERICA81312
- BRAD3723
- SAM8312
";
$formarray["words1"] = "PATRICIA*\nJIM";
$formarray["words2"] = "SAM\nMARYCLAIRE\nPATRICK\nERICA\nCOLLIN";
$formarray["words3"] = "JERRY\nKIM\nKELLY\nBRAD\nKAREN";
$formarray["words4"] = "ADAM";
$formarray["words"][1] = $formarray["words1"];
$formarray["words"][2] = $formarray["words2"];
$formarray["words"][3] = $formarray["words3"];
$formarray["words"][4] = $formarray["words4"];
$_SESSION["sess_matrix_title"] = "Harvey Family Reunion";
$_SESSION["sess_title_color"] = 1;
$formarray["matrix_title"] = $_SESSION["sess_matrix_title"];
$formarray["title_color"] = $_SESSION["sess_title_color"];
$generate_matrix = true;
}
}
}
$onload_js = "";
$too_many_words = false;
if ($generate_matrix==true) {
// if they submit too many words, have to put it on hold and do it at night.
$num_words = 0;
$num_words += str_word_count($formarray["words1"]);
$num_words += str_word_count($formarray["words2"]);
$num_words += str_word_count($formarray["words3"]);
$num_words += str_word_count($formarray["words4"]);
if ($num_words > $max_words) {
$message = "There is a limit of $max_words per Matrix. You have $num_words words. ";
// if they are logged in, offer to save it
if ($_SESSION["sess_uid"]) {
$too_many_words = true; // only set this if they are logged in
$message .= " You can choose to save the Matrix and we will process your matrix overnight. Come back tomorrow to see it completed.";
} else {
$message .= " Please Log In to save your Matrix for overnight processing.";
}
$onload_js = "onload = \"window.alert('$message');\" ";
$_SESSION["sess_box1"] = $formarray["words1"];
$_SESSION["sess_box2"] = $formarray["words2"];
$_SESSION["sess_box3"] = $formarray["words3"];
$_SESSION["sess_box4"] = $formarray["words4"];
$_SESSION["sess_matrix_title"] = $formarray["matrix_title"];
$_SESSION["sess_title_color"] = $formarray["title_color"];
unset($_SESSION["sess_latest_xml"]);
unlink(SITE_PATH."tmp/".session_id().".png");
unlink(SITE_PATH."tmp/".session_id()."_thumbnail.png");
copy(SITE_PATH."images/awaiting_processing_thumb.png", SITE_PATH."tmp/".session_id().".png");
// $bg_image_style = "background-image: url(".SITE_URL."images/awaiting_processing.png)";
} else {
require(SITE_PATH.'/Classes/MatrixClasses/config.php');
require(SITE_PATH.'/Classes/MatrixClasses/utility.php');
require(SITE_PATH.'/Classes/MatrixClasses/php_crossword.class.php');
require(SITE_PATH.'/Classes/MatrixClasses/php_crossword_output.class.php');
$pc =& new PHP_Crossword;
$pc->setMaxWords(_CROSS_MAX_WORDS);
$pc->min_aspect = _CROSS_MIN_ASPECT;
$pc->max_aspect = _CROSS_MAX_ASPECT;
$pc->max_tries = (int)_CROSS_MAX_TRIES;
$pc->max_full_tries = (int)_CROSS_MAX_FULL_TRIES;
$pc->max_aspect_tries = (int)_CROSS_MAX_ASPECT_TRIES;
$success = $pc->generateFromWordsLists($formarray['words']);
$unused = $pc->getUnusedWords();
// store stuff for next visit to this page:
$_SESSION["sess_box1"] = $formarray["words1"];
$_SESSION["sess_box2"] = $formarray["words2"];
$_SESSION["sess_box3"] = $formarray["words3"];
$_SESSION["sess_box4"] = $formarray["words4"];
$_SESSION["sess_matrix_title"] = $formarray["matrix_title"];
$_SESSION["sess_title_color"] = $formarray["title_color"];
$_SESSION["sess_latest_xml"] = $pc->getXML();
// get unused words set up for JS
$unused_js = "";
if (count($unused)) {
foreach($unused as $row) {
$text_js .= "\\n".$row['word'];
}
$unused_js = $text_js."\\n\\n";
$onload_js = "onload = 'show_unused_words();' ";
}
}
}
if ($success) { // can be true on a new drawing or a redraw from memory
if ($_SESSION["sess_latest_xml"] != "") {
$output = new PHP_Crossword_Output( $_SESSION["sess_latest_xml"], "image");
if (isset($_SESSION["sess_title_color"])) $output->title_color = $output->COLORS[($_SESSION["sess_title_color"]-1)];
$output->title = stripslashes($_SESSION["sess_matrix_title"]); // added strip slashes on 02-25-10
$original_image = $output->getOutput();
$output_size = $output->output_size;
$height = $output_size["height"];
$width = $output_size["width"];
// Make images - one to show here and one for a thumbnail - if they save the image - rename the thumbnail....
$preview_image = imagecreatetruecolor(418, 418);
imagesavealpha($preview_image, true);
$trans_colour = imagecolorallocatealpha($preview_image, 0, 0, 0, 127);
imagefill($preview_image, 0, 0, $trans_colour);
imagecopyresampled($preview_image, $original_image, 13, 13, 0, 0, 392, 392, $width, $height);
imagepng( $preview_image, SITE_PATH."tmp/".session_id().".png" );
$thumbnail = imagecreatetruecolor(100, 100);
imagesavealpha($thumbnail, true);
$trans_colour = imagecolorallocatealpha($thumbnail, 0, 0, 0, 127);
imagefill($thumbnail, 0, 0, $trans_colour);
imagecopyresampled($thumbnail, $original_image, 0, 0, 0, 0, 100, 100, $width, $height);
imagepng( $thumbnail, SITE_PATH."tmp/".session_id()."_thumbnail.png" );
$bg_image_style = (file_exists(SITE_PATH."tmp/".session_id().".png")?"background-image: url(".SITE_URL."tmp/".session_id().".png?".rand().")":"");
} else {
// redraw on a saved one awaiting processing
copy(SITE_PATH."images/awaiting_processing_thumb.png", SITE_PATH."tmp/".session_id().".png");
$bg_image_style = "background-image: url(".SITE_URL."images/awaiting_processing.png)";
}
}
?>
build_body($onload_js);
echo $page->build_head();
?>
draw_flair();
echo $page->end_body("");
?>