Campustream 1.0
A social network MQP for WPI
|
00001 <? 00002 if(isset($_POST['theme'])){ 00003 $basepath = "http://".$_SERVER['SERVER_NAME']; 00004 $path = pathinfo($_SERVER['PHP_SELF'],PATHINFO_DIRNAME); 00005 define("THEMEPATH",$basepath.$path."/themes/".$_POST['theme']."/"); 00006 00007 $html = "<div class=\"osimo-editor\">"; 00008 $html .= include_contents("themes/".$_POST['theme']."/template.php"); 00009 $html .= "</div>"; 00010 00011 echo json_encode(array('html'=>$html,'size'=>strlen($html))); exit; 00012 } 00013 00014 function getFontSelectorItems(){ 00015 $fonts = array( 00016 "Arial", 00017 "Comic Sans MS", 00018 "Georgia", 00019 "Helvetica", 00020 "Impact", 00021 "Tahoma", 00022 "Times New Roman", 00023 "Trebuchet MS", 00024 "Verdana" 00025 ); 00026 00027 echo "<option value='' selected>Font Family</option>"; 00028 00029 foreach($fonts as $font){ 00030 echo "<option value='$font' style='font-family:\"$font\",sans-serif'>$font</option>"; 00031 } 00032 } 00033 00034 function getFontSizeItems(){ 00035 $sizes = array("Small"=>10,"Normal"=>16,"Large"=>24,"Huge"=>30); 00036 00037 echo "<option value='' selected>Font Size</option>"; 00038 00039 foreach($sizes as $name=>$size){ 00040 echo "<option value='$size' style='font-size:{$size}px'>$name</option>"; 00041 } 00042 } 00043 00044 function getColorPickerItems(){ 00045 /* Might as well stick to the W3C/CSS Standards */ 00046 $colors = array( 00047 "aqua", 00048 "black", 00049 "blue", 00050 "fuchsia", 00051 "gray", 00052 "green", 00053 "lime", 00054 "maroon", 00055 "navy", 00056 "olive", 00057 "purple", 00058 "red", 00059 "silver", 00060 "teal", 00061 "white", 00062 "yellow" 00063 ); 00064 00065 echo "<option value='' selected>Font Color</option>"; 00066 00067 foreach($colors as $color){ 00068 if($color!='white'){ 00069 echo "<option value='$color' style='color:$color;'>".ucfirst($color)."</option>"; 00070 } 00071 else{ 00072 echo "<option value='$color'>".ucfirst($color)."</option>"; 00073 } 00074 } 00075 } 00076 00077 function include_contents($filename){ 00078 if (is_file($filename)) { 00079 ob_start(); 00080 include $filename; 00081 $contents = ob_get_contents(); 00082 ob_end_clean(); 00083 return $contents; 00084 } 00085 00086 return false; 00087 } 00088 ?>