示例#1
0
 /** 
  * Generates a richtext element using FCKeditor. 
  * 
  * @access public 
  * 
  * @param string|array $name If a string, the element name.  If an 
  * array, all other parameters are ignored, and the array elements 
  * are extracted in place of added parameters. 
  * 
  * @param mixed $value The element value. 
  * 
  * @param array $attribs Attributes for the element tag. 
  * 
  * @return string The element XHTML. 
  */
 public function RTE($name = null, $value = null, $attribs = null)
 {
     if (is_null($name) && is_null($value) && is_null($attribs)) {
         return $this;
     }
     $info = $this->_getInfo($name, $value, $attribs);
     extract($info);
     // name, value, attribs, options, listsep, disable
     $editor = new fckeditor($name);
     // set variables
     $editor->BasePath = '/js/fckeditor/';
     $editor->ToolbarSet = empty($attribs['ToolbarSet']) ? 'Default' : $attribs['ToolbarSet'];
     $editor->Width = empty($attribs['Width']) ? '100%' : $attribs['Width'];
     $editor->Height = empty($attribs['Height']) ? 200 : $attribs['Height'];
     $editor->Value = $value;
     // set Config
     $editor->Config['BaseHref'] = $editor->BasePath;
     //$editor->Config['CustomConfigurationsPath'] = $editor->BasePath.'editor/fckconfig.js';
     $editor->Config['CustomConfigurationsPath'] = $editor->BasePath . 'fckconfig.js';
     $editor->Config['SkinPath'] = $editor->BasePath . 'editor/skins/silver/';
     return $editor->createHtml();
 }
示例#2
0
 * == END LICENSE ==
 *
 * Configuration file for the File Manager Connector for PHP.
 */

global $Config ;

// SECURITY: You must explicitly enable this "connector". (Set it to "true").
// WARNING: don't just set "$Config['Enabled'] = true ;", you must be sure that only
//		authenticated users can access this file or use some kind of session checking.
$Config['Enabled'] = true ;


// Path to user files relative to the document root.
//$Config['UserFilesPath'] = '/userfiles/' ;
$Config['UserFilesPath'] = fckeditor::userpath();

// Fill the following value it you prefer to specify the absolute path for the
// user files directory. Useful if you are using a virtual directory, symbolic
// link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.
// Attention: The above 'UserFilesPath' must point to the same directory.
$Config['UserFilesAbsolutePath'] = '' ;

// Due to security issues with Apache modules, it is recommended to leave the
// following setting enabled.
$Config['ForceSingleExtension'] = true ;

// Perform additional checks for image files.
// If set to true, validate image size (using getimagesize).
$Config['SecureImageUploads'] = true;
示例#3
0
    static function editor($name,$value='') {
        $fckeditor=new fckeditor($name);
        $fckeditor->Value=$value;
        /*if(preg_match('/^my_/is', $name)){
            $fckeditor->ToolbarSet = "MyForm";
        }*/
        return $fckeditor->CreateHtml()."
		<br>
	<a href=\"javascript:;\" class=\"fckeditor_height_add_sub\" onclick=\"javascript:heightAdd('$name');\">+</a>
	<a href=\"javascript:;\" class=\"fckeditor_height_add_sub\" onclick=\"javascript:heightSub('$name');\">-</a>
                ";
    }
示例#4
0
文件: web.php 项目: kaspernj/knjphpfw
function form_drawInput($args){
	if (is_array($args["value"]) && is_callable($args["value"])){
		$value = call_user_func($args["value"]);
	}elseif(is_array($args["value"]) and ($args["value"]["type"] == "arr_rows" or $args["value"]["type"] == "arr_values")){
		//do nothing.
	}elseif(is_array($args["value"]) && is_object($args["value"][0])){
		$value = $args["value"][0]->$args["value"][1]($args["value"][2]);
	}else{
		if ($args["value"] === null && array_key_exists("default", $args)){
			$value = $args["default"];
		}else{
			$value = $args["value"];
		}
	}
	
	if (is_array($value)){
		$value = null;
	}
	
	if (is_null($value) and array_key_exists("default", $args)){
		$value = $args["default"];
	}
	
	if ($value and $args["value_callback"]){
		if (array_key_exists(1, $args["value_callback"])){
			$value = call_user_func($args["value_callback"][0], $value, $args["value_callback"][1]);
		}else{
			$value = call_user_func($args["value_callback"][0], $value);
		}
	}
	
	if (!$args["type"]){
		$f3 = substr($args["name"], 0, 3);
		if ($f3 == "che"){
			$args["type"] = "checkbox";
		}elseif($f3 == "tex"){
			$args["type"] = "text";
		}elseif($f3 == "sel" or array_key_exists("opts", $args)){
			$args["type"] = "select";
		}elseif($f3 == "fil"){
			$args["type"] = "file";
		}elseif($f3 == "rad"){
			$args["type"] = "radio";
		}
	}
	
	if (!$args["id"]){
		$id = $args["name"];
	}else{
		$id = $args["id"];
	}
	
	if (!$args["type"]){
		$args["type"] = "text";
	}
	
	if ($args["type"] == "password" and !$args["class"]){
		$args["class"] = "input_text";
	}
	
	if (!$args["class"]){
		$args["class"] = "input_" . $args["type"];
	}
	
	if ($args["colspan"]){
		$colspan_cont = $args["colspan"] - 1;
	}
	
	$classes_tr = array();
  if ($args["classes_tr"]){
    $classes_tr = array_merge($classes_tr, $args["classes_tr"]);
  }
  
  if (!array_key_exists("tr", $args) or $args["tr"]){
    if (!empty($classes_tr)){
      ?><tr class="<?php 
echo implode(" ", $classes_tr);
?>
"><?
    }else{
      ?><tr><?
    }
  }
	
	if ($args["title"]){
		$title_html = htmlspecialchars($args["title"]);
	}elseif($args["title_html"]){
		$title_html = $args["title_html"];
	}
	
	if ($args["div"]){
    $title_html = "<div>" . $title_html . "</div>";
	}
	
	$css = array();
	$td_html = "<td class=\"tdc\"";
	if ($args["td_width"]){
    $css["width"] = $args["td_width"];
	}
	if ($args["align"]){
    $css["text-align"] = $args["align"];
  }
  
  if (!empty($css)){
    $td_html .= " style=\"";
    foreach($css as $key => $val){
      $td_html .= $key . ": " . $val . ";";
    }
    $td_html .= "\"";
  }
  
	if ($colspan_cont > 1){
		$td_html .= " colspan=\"" . $colspan_cont . "\"";
	}
	$td_html .= ">";
	
	if ($args["div"]){
    $td_end_html = "</div></td>";
    $td_html .= "<div>";
  }else{
    $td_end_html = "</td>";
	}
	
	$js_tags = "";
	$js_tags_arr = array("onkeyup", "onkeydown", "onchange");
	foreach($js_tags_arr AS $js_tag){
		if ($args[$js_tag]){
			$js_tags .= " " . $js_tag . "=\"" . $args[$js_tag] . "\"";
		}
	}
	
	if (array_key_exists("autocomplete", $args) and !$args["autocomplete"]){
		$js_tags .= " autocomplete=\"off\"";
	}
	
	if ($args["type"] == "numeric"){
		$value = number_out($value, $args["decis"]);
	}
	
	if ($args["classes"]){
		$classes = $args["classes"];
	}else{
		$classes = array();
	}
	
	$classes[] = $args["class"];
	$args["class"] = implode(" ", $classes);
	
	if ($args["type"] == "spacer"){
		?><td colspan="2">&nbsp;</td><?
	}elseif($args["type"] == "checkbox"){
		?>
			<td colspan="2" class="tdcheck">
				<input<?if ($args["disabled"]){?> disabled<?}?> type="<?php 
echo $args["type"];
?>
" name="<?php 
echo $args["name"];
?>
" id="<?php 
echo $id;
?>
"<?if ($value){?> checked="checked"<?}?><?php 
echo $js_tags;
?>
 />
				<label for="<?php 
echo $id;
?>
"><?php 
echo $title_html;
?>
</label>
			</td>
		<?
	}elseif($args["type"] == "select"){
		$etags = "";
		if ($args["multiple"]){
			$etags .= " multiple=\"multiple\"";
		}
		
		if ($args["height"]){
			$etags .= " height=\"" . htmlspecialchars($args["height"]) . "\"";
		}
		
		if (is_null($value) and is_array($args["value"])){
      $value = $args["value"];
    }
		
		?>
			<td class="tdt">
				<?php 
echo $title_html;
?>
			</td>
			<?php 
echo $td_html;
?>
				<select<?php 
echo $etags;
?>
<?if ($args["size"]){?> size="<?php 
echo htmlspecialchars($args["size"]);
?>
"<?}?> name="<?php 
echo htmlspecialchars($args["name"]);
?>
" id="<?php 
echo htmlspecialchars($id);
?>
" class="<?php 
echo $args["class"];
?>
"<?php 
echo $js_tags;
?>
>
				<?php 
echo select_drawOpts($args["opts"], $value);
?>
				</select>
				<?if ($args["moveable"]){?>
					<div style="padding-top: 3px;">
						<input type="button" value="<?php 
echo _("Up");
?>
" onclick="select_moveup($('#<?php 
echo $id;
?>
'));" />
						<input type="button" value="<?php 
echo _("Down");
?>
" onclick="select_movedown($('#<?php 
echo $id;
?>
'));" />
					</div>
				<?}?>
			<?php 
echo $td_end_html;
?>
		<?
	}elseif($args["type"] == "imageupload"){
		if ($args["filetype"]){
			$ftype = $args["filetype"];
		}else{
			$ftype = "jpg";
		}
		
		if (!$value){
			$fn = null;
		}else{
			$fn = $args["path"] . "/" . $value . "." . $ftype;
		}
		
		if (!$fn or !file_exists($fn)){
			$found = false;
			$fn_nopic = "images/nopicture.jpg";
			$fn = null;
			
			if (file_exists($fn_nopic)){
				$fn = $fn_nopic;
			}
		}else{
			$found = true;
		}
		
		if ($args["dellink"]){
			$args["dellink"] = str_replace("%value%", $value, $args["dellink"]);
		}
		
		?>
			<td class="tdt">
				<?php 
echo $title_html;
?>
			</td>
			<?php 
echo $td_html;
?>
				<table class="designtable">
					<tr>
						<td style="width: 100%;">
							<input type="file" name="<?php 
echo htmlspecialchars($args["name"]);
?>
" id="<?php 
echo htmlspecialchars($id);
?>
" class="<?php 
echo htmlspecialchars($args["class"]);
?>
" />
						</td>
						<td>
							<?if ($fn){?>
								<img src="image.php?picture=<?php 
echo urlencode($fn);
?>
&amp;smartsize=80&amp;edgesize=20&amp;equaldim=true" alt="Preview" />
							<?}?>
							<?if ($found and $args["dellink"]){?>
								<div style="text-align: center;">
									<?if (function_exists("gtext")){?>
										(<a href="javascript: if (confirm('<?php 
echo gtext("Do you want to delete the picture?");
?>
')){location.href='<?php 
echo $args["dellink"];
?>
';}"><?php 
echo gtext("delete");
?>
</a>)
									<?}elseif(function_exists("_")){?>
										(<a href="javascript: if (confirm('<?php 
echo _("Do you want to delete the picture?");
?>
')){location.href='<?php 
echo $args["dellink"];
?>
';}"><?php 
echo _("delete");
?>
</a>)
									<?}else{?>
										(<a href="javascript: if (confirm('Do you want to delete the picture?')){location.href='<?php 
echo $args["dellink"];
?>
';}"><?php 
echo _("delete");
?>
</a>)
									<?}?>
								</div>
							<?}?>
						</td>
					</tr>
				</table>
			<?php 
echo $td_end_html;
?>
		<?
	}elseif($args["type"] == "file"){
		?>
			<td class="tdt">
				<?php 
echo $title_html;
?>
			</td>
			<?php 
echo $td_html;
?>
				<input type="file" class="input_<?php 
echo $args["type"];
?>
" name="<?php 
echo htmlspecialchars($args["name"]);
?>
" id="<?php 
echo htmlspecialchars($id);
?>
"<?php 
echo $js_tags;
?>
 />
			<?php 
echo $td_end_html;
?>
		<?
	}elseif($args["type"] == "textarea"){
		?>
			<td class="tdt">
				<?php 
echo $title_html;
?>
			</td>
			<?php 
echo $td_html;
?>
				<textarea name="<?php 
echo htmlspecialchars($args["name"]);
?>
" id="<?php 
echo htmlspecialchars($id);
?>
" class="<?php 
echo htmlspecialchars($args["class"]);
?>
"<?if ($args["height"]){?> style="height: <?php 
echo $args["height"];
?>
;"<?}?><?php 
echo $js_tags;
?>
><?php 
echo htmlspecialchars_textarea($value);
?>
</textarea>
			<?php 
echo $td_end_html;
?>
		<?
	}elseif($args["type"] == "fckeditor"){
		?>
			<td class="tdt">
				<?php 
echo $title_html;
?>
			</td>
			<?php 
echo $td_html;
?>
				<?
					$fck = new fckeditor($args["name"]);
					
					if ($args["height"]){
						$fck->Height = $args["height"];
					}else{
						$fck->Height = 300;
					}
					
					$fck->Value = $value;
					$fck->Create();
				?>
			<?php 
echo $td_end_html;
?>
		<?
	}elseif($args["type"] == "radio"){
		$id = $id . "_" . $value;
		?>
			<td class="tdt" colspan="2">
				<input type="radio" id="<?php 
echo htmlspecialchars($id);
?>
" name="<?php 
echo htmlspecialchars($args["name"]);
?>
" value="<?php 
echo htmlspecialchars($args["value"]);
?>
"<?if ($args["checked"]){?> checked="checked"<?}?><?php 
echo $js_tags;
?>
 />
				<label for="<?php 
echo htmlspecialchars($id);
?>
">
					<?php 
echo $title_html;
?>
				</label>
			</td>
		<?
	}elseif($args["type"] == "info"){
		?>
			<td class="tdt">
				<?php 
echo $title_html;
?>
			</td>
			<?php 
echo $td_html;
?>
				<?php 
echo $value;
?>
			<?php 
echo $td_end_html;
?>
		<?
	}elseif($args["type"] == "plain"){
		?>
			<td class="tdt">
				<?php 
echo $title_html;
?>
			</td>
			<?php 
echo $td_html;
?>
				<?php 
echo htmlspecialchars($value);
?>
			<?php 
echo $td_end_html;
?>
		<?
	}elseif($args["type"] == "headline"){
		?>
			<td class="tdheadline" colspan="2">
				<?php 
echo $title_html;
?>
			</td>
		<?
	}else{
		?>
			<td class="tdt">
				<?php 
echo $title_html;
?>
			</td>
			<?php 
echo $td_html;
?>
				<input type="<?php 
echo htmlspecialchars($args["type"]);
?>
"<?if ($args["disabled"]){?> disabled<?}?><?if ($args["maxlength"]){?> maxlength="<?php 
echo $args["maxlength"];
?>
"<?}?> class="<?php 
echo $args["class"];
?>
" id="<?php 
echo htmlspecialchars($id);
?>
" name="<?php 
echo htmlspecialchars($args["name"]);
?>
" value="<?php 
echo htmlspecialchars($value);
?>
"<?php 
echo $js_tags;
?>
 />
			<?php 
echo $td_end_html;
?>
		<?
	}
	
	if (!array_key_exists("tr", $args) or $args["tr"]){
		?></tr><?
	}
	
	if ($args["descr"]){
    $descr = $args["descr"];
    
    if ($args["div"]){
      $descr = "<div class=\"tdd\">" . $descr . "</div>";
    }
    
		?>
			<tr>
				<td colspan="2"<?if (!$args["div"]){?> class="tdd"<?}?>>
					<?php 
echo $descr;
?>
				</td>
			</tr>
		<?
	}
}