filesize( $abs_item ); } //------------------------------------------------------------------------------ function get_dir_size($dir) { if(is_file($dir)) return array('size'=>filesize($dir),'howmany'=>0); if($dh=opendir($dir)) { $size=0; $n = 0; while(($file=readdir($dh))!==false) { if($file=='.' || $file=='..') continue; $n++; $data = get_dir_size($dir.'/'.$file); $size += $data['size']; $n += $data['howmany']; } closedir($dh); return array('size'=>$size,'howmany'=>$n); } return array('size'=>0,'howmany'=>0); } function parse_file_size($bytes, $precision = 2) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); if( !is_float($bytes)) { $bytes = (float)sprintf("%u", $bytes); } $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); return round($bytes, $precision) . ' ' . $units[$pow]; } //------------------------------------------------------------------------------ function get_file_date( $item) { // file date return @$GLOBALS['ext_File']->filemtime( $item ); } //------------------------------------------------------------------------------ function parse_file_date($date) { // parsed file date if ($date) { return @date($GLOBALS["date_fmt"],$date); } else { return " (unknown) "; } } //------------------------------------------------------------------------------ function get_is_image( $abs_item ) { // is this file an image? if(!get_is_file($abs_item)) return false; if( isset($abs_item['name'])) { $abs_item = $abs_item['name']; } return in_array(pathinfo($abs_item,PATHINFO_EXTENSION ), $GLOBALS["images_ext"]); } //----------------------------------------------------------------------------- function get_is_editable( $abs_item ) { // is this file editable? if(!get_is_file( $abs_item )) return false; if( is_array( $abs_item ) ) { $abs_item = $abs_item['name']; } if(in_array(".".strtolower(pathinfo($abs_item,PATHINFO_EXTENSION )), $GLOBALS["editable_ext"])) { return true; } return strpos( basename($abs_item), "." ) ? false : true; } //----------------------------------------------------------------------------- function get_mime_type( $abs_item, $query) { // get file's mimetype if(get_is_dir( $abs_item )) { // directory $mime_type = $GLOBALS["super_mimes"]["dir"][0]; $image = $GLOBALS["super_mimes"]["dir"][1]; if($query=="img") return $image; else return $mime_type; } $extra = $GLOBALS['ext_File']->is_link( $abs_item ) ? ' ('.$GLOBALS['mimes']['symlink'].')' : ''; if( ext_isFTPMode() && isset($abs_item['name']) ) { $abs_item=$abs_item['name']; } // mime_type foreach($GLOBALS["used_mime_types"] as $mime) { list($desc,$img,$ext) = $mime; if(stristr(basename($abs_item), $ext )) { $mime_type = $desc; $image = $img; if($query=="img") return $image; else return $mime_type . $extra; } } if((function_exists("is_executable") && @is_executable( $abs_item )) || @stristr($abs_item,$GLOBALS["super_mimes"]["exe"][2])) { // executable $mime_type = $GLOBALS["super_mimes"]["exe"][0]; $image = $GLOBALS["super_mimes"]["exe"][1]; } else { // unknown file $mime_type = $GLOBALS["super_mimes"]["file"][0]; $image = $GLOBALS["super_mimes"]["file"][1]; } if($query=="img") { return $image; } else { return $mime_type . $extra; } } //------------------------------------------------------------------------------ function get_show_item($dir, $item) { // show this file? if( is_array( $item )) { $item = $item['name']; } if($item == "." || $item == ".." || (substr($item,0,1)=="." && $GLOBALS["show_hidden"]==false)) return false; if($GLOBALS["no_access"]!="" && @preg_match($GLOBALS["no_access"],$item)) return false; if($GLOBALS["show_hidden"]==false) { $dirs=explode("/",$dir); foreach($dirs as $i) if(substr($i,0,1)==".") return false; } return true; } //------------------------------------------------------------------------------ function get_dir_list( $dir='' ) { if( ext_isFTPMode()) { $files = getCachedFTPListing(empty($dir) ? '.' : $dir); } else { $files = extReadDirectory( get_abs_dir( $dir), '.', false, true ); } $dirs =array(); foreach( $files as $item) { $itemname = ext_isFTPMode() ? (empty($dir) ? '' : $dir.'/') .$item['name'] : $item; $itemname = str_replace( '\\', '/', $itemname ); if( get_is_dir($item)) { $index = str_replace( str_replace('\\', '/', $GLOBALS['home_dir'].$GLOBALS['separator']), '', $itemname ); $dirs[$index]= basename($index); } } return $dirs; } /** * Returns select lists with all the subdirectories along the current directory path * * @param string $dir * @return string */ function get_dir_selects( $dir ) { $dirs = explode( "/", str_replace( "\\", '/', $dir ) ); $subdirs = get_dir_list(); if( sizeof( $subdirs ) > 0) { $subdirs = array_merge(Array('ext_disabled' => '-'), $subdirs ); } if( empty($dirs[0]) ) array_shift($dirs); $dirsCopy = $dirs; $implode = ''; $selectedDir = @$dirs[0]; foreach( $subdirs as $index => $val ) { if ($GLOBALS['use_mb']) { if (mb_detect_encoding($val) == 'ASCII') { $subdirs[$index] = utf8_encode($val); } else { $subdirs[$index] = $val; } } else { $subdirs[$index] = utf8_encode($val); } } $dir_links = ext_selectList('dirselect1', $selectedDir, $subdirs, 1, '', 'onchange="theDir=this.options[this.selectedIndex].value;if(theDir!=\'ext_disabled\' ) chDir(theDir);"' ); $i = 2; foreach( $dirs as $directory ) { if( $directory != "" ) { $implode .= $directory; $next = next($dirsCopy); $subdirs = get_dir_list( $implode ); foreach( $subdirs as $index => $val ) { unset( $subdirs[$index]); if ($GLOBALS['use_mb']) { if (mb_detect_encoding($index) == 'ASCII') { if (mb_detect_encoding($val) == 'ASCII') { $subdirs[utf8_encode($index)] = utf8_encode($val); } else { $subdirs[utf8_encode($index)] = $val; } } else { if (mb_detect_encoding($val) == 'ASCII') { $subdirs[$index] = utf8_encode($val); } else { $subdirs[$index] = $val; } } } else { $subdirs[utf8_encode($index)] = utf8_encode($val); } } if( $next !== false ) { $selectedDir .= '/'.$next; } else { if( sizeof( $subdirs ) > 0) { $subdirs = array_merge(Array('ext_disabled' => '-'), $subdirs ); } } $dir_links .= ' / '.ext_selectList('dirselect'.$i++, $selectedDir, $subdirs, 1, '', 'onchange="theDir=this.options[this.selectedIndex].value;if(theDir!=\'ext_disabled\' ) chDir(theDir);"' ); $implode .= '/'; } } //echo '
'.htmlspecialchars($dir_links).'
';exit; return $dir_links; } //------------------------------------------------------------------------------ function ext_copy_dir($source,$dest) { // copy dir $ok = true; $source = str_replace( '\\', '/', $source ); $dest = str_replace( '\\', '/', $dest ); if(!@mkdir($dest,0777)) return false; $itemlist = extReadDirectory( $source, '.', true, true ); if( empty( $itemlist )) return true; foreach( $itemlist as $file ) { if(($file==".." || $file==".")) continue; $file = str_replace( '\\', '/', $file ); $new_dest = str_replace( $source, $dest, $file ); if(@is_dir($file)) { @mkdir($new_dest,0777); } else { $ok=@copy($file,$new_dest); } } return $ok; } //------------------------------------------------------------------------------ function remove($item) { // remove file / dir if( !is_link( $item )) { $item = realpath($item); } $ok = true; if( is_link($item) || is_file($item)) $ok = unlink($item); elseif( @is_dir($item)) { if(($handle= opendir($item))===false) ext_Result::sendResult('delete', false, basename($item).": ".$GLOBALS["error_msg"]["opendir"]); while(($file=readdir($handle))!==false) { if(($file==".." || $file==".")) continue; $new_item = $item."/".$file; if(!file_exists($new_item)) ext_Result::sendResult('delete', false, basename($item).": ".$GLOBALS["error_msg"]["readdir"]); //if(!get_show_item($item, $new_item)) continue; if( @is_dir($new_item)) { $ok=remove($new_item); } else { $ok= unlink($new_item); } } closedir($handle); $ok=@rmdir($item); } return $ok; } function chmod_recursive($item, $mode) { // chmod file / dir $ok = true; if(@is_link($item) || @is_file($item)) { $ok=@chmod( $item, $mode ); if($ok) ext_Result::add_message($GLOBALS['messages']['permchange'].' '.$new_item); else ext_Result::add_error($GLOBALS['error_msg']['permchange'].' '.$new_item); } elseif(@is_dir($item)) { if(($handle=@opendir($item))===false) { ext_Result::add_error(basename($item).": ".$GLOBALS["error_msg"]["opendir"]); return false; } while(($file=readdir($handle))!==false) { if(($file==".." || $file==".")) continue; $new_item = $item."/".$file; if(!@file_exists($new_item)) { ext_Result::add_error(basename($item).": ".$GLOBALS["error_msg"]["readdir"]); continue; } //if(!get_show_item($item, $new_item)) continue; if(@is_dir($new_item)) { $ok=chmod_recursive($new_item, $mode); } else { $ok=@chmod($new_item, $mode); if($ok) ext_Result::add_message($GLOBALS['messages']['permchange'].' '.$new_item); else ext_Result::add_error($GLOBALS['error_msg']['permchange'].' '.$new_item); } } closedir($handle); if( @is_dir( $item )) { $bin = decbin( $mode ); // when we chmod a directory we must care for the permissions // to prevent that the directory becomes not readable (when the "execute bits" are removed) $bin = substr_replace( $bin, '1', 2, 1 ); // set 1st x bit to 1 $bin = substr_replace( $bin, '1', 5, 1 );// set 2nd x bit to 1 $bin = substr_replace( $bin, '1', 8, 1 );// set 3rd x bit to 1 $mode = bindec( $bin ); } $ok=@chmod( $item, $mode ); if($ok) ext_Result::add_message($GLOBALS['messages']['permchange'].' '.$item); else ext_Result::add_error($GLOBALS['error_msg']['permchange'].' '.$item); } return $ok; } //------------------------------------------------------------------------------ function get_max_file_size() { // get php max_upload_file_size return calc_php_setting_bytes( ini_get("upload_max_filesize") ); } function get_max_upload_limit() { return calc_php_setting_bytes( ini_get('post_max_size')); } function calc_php_setting_bytes( $value ) { switch(strtoupper(substr($value,-1))) { case 'G': $value = substr($value,0,-1); $value = round($value*1073741824); break; case 'M': $value = substr($value,0,-1); $value = round($value*1048576); break; case 'K': $value = substr($value,0,-1); $value = round($value*1024); break; } return $value; } //------------------------------------------------------------------------------ function down_home($abs_dir) { // dir deeper than home? if( ext_isFTPMode() ) { return true; } $real_home = @realpath($GLOBALS["home_dir"]); $real_dir = @realpath($abs_dir); if( $real_dir == '' ) $real_dir = dirname( $abs_dir ); if( $real_home == '' ) $real_home = $_SERVER['DOCUMENT_ROOT']; //echo 'NOW: $real_home = '.$real_home; //echo ', $real_dir = '.$real_dir; if(@stristr($abs_dir,"\\.\\.")) return false; if(strcmp($real_home,@substr($real_dir,0,strlen($real_home)))) { return false; } return true; } //------------------------------------------------------------------------------ function id_browser() { $browser=$GLOBALS['__SERVER']['HTTP_USER_AGENT']; if(preg_match('/Opera(\/| )([0-9]\.[0-9]{1,2})/', $browser)) { return 'OPERA'; } else if(preg_match('/MSIE ([0-9]\.[0-9]{1,2})/', $browser)) { return 'IE'; } else if(preg_match('/OmniWeb\/([0-9]\.[0-9]{1,2})/', $browser)) { return 'OMNIWEB'; } else if(preg_match('/(Konqueror\/)(.*)/', $browser)) { return 'KONQUEROR'; } else if(preg_match('/Mozilla\/([0-9]\.[0-9]{1,2})/', $browser)) { return 'MOZILLA'; } else { return 'OTHER'; } } function ext_isArchive( $file ) { $file_info = pathinfo($file); $ext = @strtolower($file_info["extension"]); $archive_types = array("tar", "gz", "tgz", "zip", "bzip2", "bz2", "tbz", 'rar'); if( in_array( $ext, $archive_types )) { return true; } return false; } if( !extension_loaded('posix') ) { function posix_geteuid() { return false; } function posix_getpwnam() { } } //------------------------------------------------------------------------------ /** * Checks if the User Agent String identifies the browser as Internet Explorer * * @return boolean */ function ext_isWindows() { if(empty($GLOBALS['isWindows'])) { $GLOBALS['isWindows'] = substr(PHP_OS, 0, 3) == 'WIN'; } return $GLOBALS['isWindows']; } /** * Returns the valid directory separator for this OS & Webserver combination * * @return string */ function ext_getSeparator() { if( defined( 'DIRECTORY_SEPARATOR')) { return DIRECTORY_SEPARATOR; } elseif (@preg_match('/Microsoft|WebSTAR|Xitami/', $_SERVER['SERVER_SOFTWARE']) ) { return '\\'; } else { return '/'; } } /** * Checks if the User Agent String identifies the browser as Internet Explorer * * @return boolean */ function ext_isIE() { return (preg_match('/MSIE ([0-9]\.[0-9]{1,2})/', $_SERVER['HTTP_USER_AGENT'])); } /** * Prints an HTML dropdown box named $name using $arr to * load the drop down. If $value is in $arr, then $value * will be the selected option in the dropdown. * @author gday * @author soeren * * @param string $name The name of the select element * @param string $value The pre-selected value * @param array $arr The array containting $key and $val * @param int $size The size of the select element * @param string $multiple use "multiple=\"multiple\" to have a multiple choice select list * @param string $extra More attributes when needed * @return string HTML drop-down list */ function ext_selectList($name, $selectedkey, $arr, $size=1, $multiple="", $extra="") { $html = ''; if( !empty( $arr ) ) { $html = "\n"; } return $html; } function ext_scriptTag( $src = '', $script = '') { if( $src!='') { return ''; } if( $script != '') { return ''; } } function ext_alertBox( $msg ) { return ext_scriptTag('', 'Ext.Msg.alert( \''.$GLOBALS["error_msg"]['message'].'\', \''. @mysql_escape_string( $msg ) .'\' );' ); } function ext_successBox( $msg ) { return ext_scriptTag('', 'Ext.msgBoxSlider.msg( \''.ext_Lang::msg('success', true ).'\', \''. @mysql_escape_string( $msg ) .'\' );' ); } function ext_docLocation( $url ) { return ext_scriptTag('', 'document.location=\''. $url .'\';' ); } function ext_isXHR() { return strtolower(extGetParam($_SERVER,'HTTP_X_REQUESTED_WITH')) == 'xmlhttprequest' || strtolower(extGetParam($_POST,'requestType')) == 'xmlhttprequest'; } function ext_exit() { global $mainframe; if( class_exists( 'jfactory' )) { $app = jfactory::getApplication(); $app->close(); } if( is_callable( array( $mainframe, 'close' ) ) ) { $mainframe->close(); } else { session_write_close(); exit; } } function ext_isJoomla( $version='', $operator='=', $compare_minor_versions=true) { $this_version = ''; if( !empty($GLOBALS['_VERSION']) && is_object($GLOBALS['_VERSION'])) { $jversion =& $GLOBALS['_VERSION']; $this_version = $jversion->RELEASE .'.'. $jversion->DEV_LEVEL; } elseif ( class_exists('JVersion') ) { $jversion = new JVersion(); $this_version = $jversion->RELEASE .'.'. $jversion->DEV_LEVEL; } else { return false; } if( empty( $version ) ) { return !empty($this_version); } $allowed_operators = array( '<', 'lt', '<=', 'le', '>', 'gt', '>=', 'ge', '==', '=', 'eq', '!=', '<>', 'ne' ); if( $compare_minor_versions ) { $this_version = $jversion->RELEASE; } if( in_array($operator, $allowed_operators )) { return version_compare( $this_version, $version, $operator ); } return false; } /** * Raise the memory limit when it is lower than the needed value * * @param string $setLimit Example: 16M */ function ext_RaiseMemoryLimit( $setLimit ) { $memLimit = @ini_get('memory_limit'); if( stristr( $memLimit, 'k') ) { $memLimit = str_replace( 'k', '', str_replace( 'K', '', $memLimit )) * 1024; } elseif( stristr( $memLimit, 'm') ) { $memLimit = str_replace( 'm', '', str_replace( 'M', '', $memLimit )) * 1024 * 1024; } if( stristr( $setLimit, 'k') ) { $setLimitB = str_replace( 'k', '', str_replace( 'K', '', $setLimit )) * 1024; } elseif( stristr( $setLimit, 'm') ) { $setLimitB = str_replace( 'm', '', str_replace( 'M', '', $setLimit )) * 1024 * 1024; } if( $memLimit < $setLimitB ) { @ini_set('memory_limit', $setLimit ); } } /** * Reads a file and sends them in chunks to the browser * This should overcome memory problems * http://www.php.net/manual/en/function.readfile.php#54295 * * @since 1.4.1 * @param string $filename * @param boolean $retbytes * @return mixed */ function readFileChunked($filename,$retbytes=true) { $chunksize = 1*(1024*1024); // how many bytes per chunk $buffer = ''; $cnt =0; // $handle = fopen($filename, 'rb'); $handle = fopen($filename, 'rb'); if ($handle === false) { return false; } while (!feof($handle)) { $buffer = fread($handle, $chunksize); echo $buffer; sleep(1); ob_flush(); flush(); if ($retbytes) { $cnt += strlen($buffer); } } $status = fclose($handle); if ($retbytes && $status) { return $cnt; // return num. bytes delivered like readfile() does. } return $status; } //implements file_put_contents function for compatability with PHP < 4.3 if ( ! function_exists('file_put_contents') ) { function file_put_contents ( $filename, $filecont ){ $handle = fopen( $filename, 'w' ); if ( is_array($filecont) ) { $size = 0; foreach ( $filecont as $filestring ) { fwrite( $handle, $filestring ); $size += strlen( $filestring ); } fclose($handle); return $size; } else { fwrite( $handle, $filecont ); fclose($handle); return strlen( $filecont ); } } } if ( ! function_exists('scandir') ) { function scandir($dir,$listDirectories=false, $skipDots=true) { $dirArray = array(); if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if (($file != "." && $file != "..") || $skipDots == true) { if($listDirectories == false) { if(@is_dir($file)) { continue; } } array_push($dirArray,basename($file)); } } closedir($handle); } return $dirArray; } } /** * Page generation time * @package Joomla */ class extProfiler { /** @var int Start time stamp */ var $start=0; /** @var string A prefix for mark messages */ var $prefix=''; /** * Constructor * @param string A prefix for mark messages */ function __construct( $prefix='' ) { $this->start = $this->getmicrotime(); $this->prefix = $prefix; } /** * @return string A format message of the elapsed time */ function mark( $label ) { return sprintf ( "\n
$this->prefix %.3f $label
", $this->getmicrotime() - $this->start ); } /** * @return float The current time in milliseconds */ function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } } /** * Utility class for all HTML drawing classes * @package eXtplorer */ class extHTML { static function loadExtJS() { $scripts[] = array('dir' => 'scripts/editarea/', 'file' => 'edit_area_full_with_plugins.js'); $scripts[] = array('dir' => 'scripts/extjs3/adapter/ext/', 'file' => 'ext-base.js'); $scripts[] = array('dir' => 'scripts/extjs3/', 'file' => 'ext-all.js'); $scripts[] = array('dir' => 'scripts/extjs3-ext/ux.ondemandload/', 'file' => 'scriptloader.js'); $scripts[] = array('dir' => 'scripts/extjs3-ext/ux.editareaadapater/', 'file' => 'ext-editarea-adapter.js'); $scripts[] = array('dir' => 'scripts/extjs3-ext/ux.statusbar/', 'file' => 'ext-statusbar.js'); $scripts[] = array('dir' => 'scripts/extjs3-ext/ux.fileuploadfield/', 'file' => 'ext-fileUploadField.js'); $scripts[] = array('dir' => 'scripts/extjs3-ext/ux.locationbar/', 'file' => 'Ext.ux.LocationBar.js'); $styles[] = array('dir' => 'scripts/extjs3/resources/css/', 'file' => 'ext-all.css'); $styles[] = array('dir' => 'scripts/extjs3-ext/ux.locationbar/', 'file' => 'LocationBar.css'); $styles[] = array('dir' => 'scripts/extjs3-ext/ux.fileuploadfield/', 'file' => 'fileuploadfield.css'); $scriptTag = ''; if( !empty($_GET['nofetchscript']) || !empty( $_COOKIE['nofetchscript'])) { foreach( $scripts as $script ) { $scriptTag .= ''; } foreach( $styles as $style ) { $scriptTag .= ''; } } else { $scriptTag = ' '; $scriptTag .= ' '; } $scriptTag .= ' '; if (defined('EXT_STANDALONE')) { $GLOBALS['mainframe']->addcustomheadtag($scriptTag); } else { echo $scriptTag; } } static function makeOption( $value, $text='', $value_name='value', $text_name='text' ) { $obj = new stdClass; $obj->$value_name = $value; $obj->$text_name = trim( $text ) ? $text : $value; return $obj; } static function writableCell( $folder, $relative=1, $text='', $visible=1 ) { $writeable = 'Writeable'; $unwriteable = 'Unwriteable'; echo ''; echo ''; echo $text; if ( $visible ) { echo $folder . '/'; } echo ''; echo ''; if ( $relative ) { echo is_writable( "../$folder" ) ? $writeable : $unwriteable; } else { echo is_writable( "$folder" ) ? $writeable : $unwriteable; } echo ''; echo ''; } /** * Generates an HTML select list * @param array An array of objects * @param string The value of the HTML name attribute * @param string Additional HTML attributes for the "; $count = count( $arr ); for ($i=0, $n=$count; $i < $n; $i++ ) { $k = $arr[$i]->$key; $t = $arr[$i]->$text; $id = ( isset($arr[$i]->id) ? @$arr[$i]->id : null); $extra = ''; $extra .= $id ? " id=\"" . $arr[$i]->id . "\"" : ''; if (is_array( $selected )) { foreach ($selected as $obj) { $k2 = $obj->$key; if ($k == $k2) { $extra .= " selected=\"selected\""; break; } } } else { $extra .= ($k == $selected ? " selected=\"selected\"" : ''); } $html .= "\n\t"; } $html .= "\n\n"; return $html; } /** * Writes a select list of integers * @param int The start integer * @param int The end integer * @param int The increment * @param string The value of the HTML name attribute * @param string Additional HTML attributes for the tag * @param mixed The key that is selected * @returns string HTML for the select list values */ static function monthSelectList( $tag_name, $tag_attribs, $selected ) { $arr = array( extHTML::makeOption( '01', _JAN ), extHTML::makeOption( '02', _FEB ), extHTML::makeOption( '03', _MAR ), extHTML::makeOption( '04', _APR ), extHTML::makeOption( '05', _MAY ), extHTML::makeOption( '06', _JUN ), extHTML::makeOption( '07', _JUL ), extHTML::makeOption( '08', _AUG ), extHTML::makeOption( '09', _SEP ), extHTML::makeOption( '10', _OCT ), extHTML::makeOption( '11', _NOV ), extHTML::makeOption( '12', _DEC ) ); return extHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected ); } /** * Writes a yes/no select list * @param string The value of the HTML name attribute * @param string Additional HTML attributes for the tag * @param mixed The key that is selected * @param string The name of the object variable for the option value * @param string The name of the object variable for the option text * @returns string HTML for the select list */ static function radioList( &$arr, $tag_name, $tag_attribs, $selected=null, $key='value', $text='text' ) { reset( $arr ); $html = ""; for ($i=0, $n=count( $arr ); $i < $n; $i++ ) { $k = $arr[$i]->$key; $t = $arr[$i]->$text; $id = ( isset($arr[$i]->id) ? @$arr[$i]->id : null); $extra = ''; $extra .= $id ? " id=\"" . $arr[$i]->id . "\"" : ''; if (is_array( $selected )) { foreach ($selected as $obj) { $k2 = $obj->$key; if ($k == $k2) { $extra .= " selected=\"selected\""; break; } } } else { $extra .= ($k == $selected ? " checked=\"checked\"" : ''); } $html .= "\n\t"; $html .= "\n\t"; } $html .= "\n"; return $html; } /** * Writes a yes/no radio list * @param string The value of the HTML name attribute * @param string Additional HTML attributes for the