Run("cmd /C " . $command, 0, true); } else { if ($use_shell_exec) { shell_exec($command); } else { exec($command . " > /dev/null"); } } } ob_end_clean(); } function get_php_setting($val) { $r = (ini_get($val) == '1' ? 1 : 0); return $r ? 'ON' : 'OFF'; } function get_php_setting_val($val) { $r = ini_get($val); return $r; } function return_bytes($val) { if ($val) { $val = trim($val); $last = strtolower($val{strlen($val)-1}); switch($last) { case 'm': $val *= 1024; case 'k': $val *= 1; } } return $val; } function writableTree( $folder ) { global $xmldir; echo ''; echo '' . $folder; echo '/'; echo ''; echo ''; if (print_tree("../" . $folder) == 0) { echo 'All sub directories are writable'; } else { echo "
Not all sub directories are writable.
Please go to the TWG Admin -> Info for more details!
"; } echo ''; } /* Counts the number of jpegs in all trees */ function print_tree($file_dir) { global $password_file; global $url_file; global $exclude_directories; $localfiles = 0; if ($handle = @opendir($file_dir)){ $i = 0; $list = null; while (false !== ($file = @readdir($handle))){ if ($file != "." && $file != ".."){ $list[$i] = $file; $i++; } } $dir_length = count($list); for($i = 0;$i < $dir_length;$i++){ if (isset($list[$i])){ if (is_dir($file_dir . "/" . $list[$i])){ if (!in_array($list[$i], $exclude_directories)){ if (!is_writeable($file_dir . "/" . $list[$i])) { $localfiles++; } $localfiles += print_tree($file_dir . "/" . $list[$i]); } } } } closedir($handle); } return $localfiles; } function writableCell( $folder ) { echo ''; echo '' . $folder . '/'; echo ''; if (file_exists($folder)) { echo is_writable( $folder ) ? 'Writeable' : 'Unwriteable' . ''; } else { echo 'Not found'; } echo ''; } function gd_version() { static $gd_version_number = null; if ($gd_version_number === null) { if (function_exists("gd_info")) { $info = gd_info(); $module_info = $info["GD Version"]; if (preg_match("/[^\d\n\r]*?([\d\.]+)/i", $module_info, $matches)) { $gd_version_number = $matches[1]; } else { $gd_version_number = 0; } } else { // needed before 4.3 ! ob_start(); phpinfo(8); $module_info = ob_get_contents(); @ob_end_clean(); if (preg_match("/\bgd\s+version\b[^\d\n\r]+?([\d\.]+)/i", $module_info, $matches)) { $gd_version_number = $matches[1]; } else { $gd_version_number = 0; } } } return $gd_version_number; } function check_rotation() { global $cachedir, $install_dir; $image = $install_dir . "buttons/border.jpg"; $outputimage = $cachedir . "/_rotation_available.jpg"; $outputimageerror = $cachedir . "/_rotation_not_available.jpg"; if (file_exists($outputimage)) { unlink($outputimage); } if (file_exists($outputimageerror)) { unlink($outputimageerror); } if (!function_exists("imagerotate")) { if (function_exists("imagecreatetruecolor")) { $dst = imagecreatetruecolor(50, 37); $fh=fopen($outputimageerror,'w'); // fix for a but in some php - versions - thanks to Anders fclose($fh); imagejpeg($dst, $outputimageerror, 50); } return false; } else { $oldsize = getImageSize($image); $src = imagecreatefromjpeg($image); $dst = imagecreatetruecolor(50, 37); imagecopyresampled($dst, $src, 0, 0, 0, 0, 50, 37, 50, 37); $twg_rot = imagerotate($dst, 90, 0); $fh2=fopen($outputimage,'w'); // fix for a but in some php - versions - thanks to Anders fclose($fh2); if (!imagejpeg($twg_rot, $outputimage, 50)) { $fh3=fopen($outputimageerror,'w'); // fix for a but in some php - versions - thanks to Anders fclose($fh3); imagejpeg($dst, $outputimageerror, 50); return false; } else { return true; } } } /* We check if we can create a image with image magick */ function check_image_magic() { global $cachedir, $install_dir,$image_magic_path; $inputimage = "buttons/info_test.jpg"; $outputimageerror = $cachedir . "/_image_magick_test.jpg"; $outputcachetest = $cachedir . "/_image_magick_test.tmp.php"; if (file_exists($outputcachetest)) { // we only check once! return false; } else { $fh=fopen($outputcachetest,'w'); // fix for a but in some php - versions - thanks to Anders fclose($fh); } if (file_exists($outputimageerror)) { @unlink($outputimageerror); } $fh=fopen($outputimageerror,'w'); // fix for a but in some php - versions - thanks to Anders fclose($fh); $command = $image_magic_path. " \"" . realpath($inputimage) . "\" -quality 80 -resize 120x81 \"" . realpath($outputimageerror) . "\""; execute_command($command); if (file_exists($outputcachetest)) { @unlink($outputcachetest); } return (file_exists($outputimageerror) && (filesize($outputimageerror) > 0)); } /* We check if we can extract the 1st image of the ffmpeg_test.avi */ function check_ffmpeg() { global $cachedir, $install_dir,$ffmpeg_path; $inputimage = "html/ffmpeg_test.avi"; $outputimageerror = $cachedir . "/_ffmpeg_test.jpg"; $outputcachetest = $cachedir . "/_ffmpeg_test.tmp.php"; if (file_exists($outputcachetest)) { // we only check once! return false; } else { $fh=fopen($outputcachetest,'w'); // fix for a but in some php - versions - thanks to Anders fclose($fh); } if (file_exists($outputimageerror)) { @unlink($outputimageerror); } $fh=fopen($outputimageerror,'w'); // fix for a but in some php - versions - thanks to Anders fclose($fh); $command = $ffmpeg_path . " -y -i \"" . realpath($inputimage) . "\" -f mjpeg -ss 0 -vframes 1 -an \"" . realpath($outputimageerror) . "\""; execute_command($command); if (file_exists($outputcachetest)) { @unlink($outputcachetest); } return (file_exists($outputimageerror) && (filesize($outputimageerror) > 0)); } function check_ffmpeg_convert() { global $cachedir, $install_dir,$ffmpeg_path,$ffmpeg_convert_command; $inputimage = "html/ffmpeg_test.avi"; $outputimageerror = $cachedir . "/_ffmpeg_test.flv"; $outputcachetest = $cachedir . "/_ffmpeg_test_flv.tmp.php"; if (file_exists($outputcachetest)) { // we only check once! return false; } else { $fh=fopen($outputcachetest,'w'); // fix for a but in some php - versions - thanks to Anders fclose($fh); } if (file_exists($outputimageerror)) { @unlink($outputimageerror); } $fh=fopen($outputimageerror,'w'); // fix for a but in some php - versions - thanks to Anders fclose($fh); $command = $ffmpeg_path . " " . sprintf($ffmpeg_convert_command, realpath($inputimage), realpath($outputimageerror)); execute_command($command); if (file_exists($outputcachetest)) { @unlink($outputcachetest); } return (file_exists($outputimageerror) && (filesize($outputimageerror) > 0)); } function show_ffmpeg_video() { global $cachedir, $install_dir,$ffmpeg_path,$ffmpeg_convert_command; $flashtext = '
The flash requires at least Flash 6.
Please get it here<\/a><\/b>.<\/div><\/div>'; $movie = $install_dir . "html/mediaplayer.swf?"; $video_size_x = 30; $video_size_y = 30; $file = "file=../" . $cachedir . "/_ffmpeg_test.flv"; $auto_param = "autostart=true&icons=false&controlbar=false&repeat=always"; echo ' '; // noscript way $auto_param = str_replace("&" , "&" , $auto_param); // to make it w3c conform! echo ' '; } if ($showphpinfo) { echo '

'; echo ""; echo ''; echo '
'; echo phpinfo(); echo '

'; return; } echo ""; ?> TWG - Installation check!
TWG info
This check gives a basic check of your installation - Please go to the administration for a more detailed view of this page.

TWG installation check for TWG

If any of these items are highlighted in red then please take actions to correct them. Failure to do so could lead to your TWG installation not functioning correctly.
Yellow means that some functions tests failed and this feature is not available. Please go to the info in the administration to get more information to solve the problem! Please don't use red features in the config.php! The config.php is not modified by this check!
PHP version >= 4.3.0 No' : 'Yes'; echo " (" . phpversion() . ")"; ?>
  - XML support Available' : 'Unavailable';?>
  - GD lib support Available' : 'Unavailable';?>
  - GD lib >= 2.0 No' : 'Yes'; echo " (" . gd_version() . ")"; ?>
  - imagecreatetruecolor GDlib is not installed properly - TWG does not work!' : 'Available'; ?>
  - Memory limit Memory limit not detected'; } else { if ($limit > 48000) { echo 'Very Good'; } else if($limit > 30000) { echo 'O.k. but don\'t use large images'; } else { echo 'Only use small images'; } echo " (" . ini_get('memory_limit') . ")"; } ?>
  - Max resolution No limit'; } else { // internal memory is subtracted 3 MB for normal use. 6 MB if automatic folder image creation is used $intmem = $autocreate_folder_image ? 3000 : 6000; $xy = ($limit-$intmem) * 1024 / 6; $x = floor( sqrt ($xy / 0.75)); $y = floor( sqrt($xy / 1.33)); if ($limit > 48000) { echo "~ " . $x . " x " . $y . ""; } else if($limit > 30000) { echo "~ " . $x . " x " . $y . ""; } else { echo "~ " . $x . " x " . $y . ""; } } ?>
  - Rotate available Available' : 'Unavailable'; }else { echo 'Test failed - Check cache dir'; } ?>
  - Text watermark Available' : 'Unavailable (imagettftext not found)';?>
  - Remote jpg support Available' : 'Unavailable (allow_url_fopen = off)';?>
  - File uploads Available' : 'Unavailable';?>
     - Upload max filesize Upload max filesize not detected'; } else { if ($limit > 2500) { echo '' . ini_get('upload_max_filesize') . ''; } else { echo '' . ini_get('upload_max_filesize') . ' - Resize images > ' . ini_get('upload_max_filesize') . ''; } } ?>
Session Available' : 'Not available';?>
Javascript
Image Magick Support Available' : 'Not available';?>
ffmpeg Support Available' : 'Not available';?>
ffmpeg video convert Available' : 'Not available';?>
A couple of changing smilies have to be shown on the right if the auto conversion to flv works."; show_ffmpeg_video(); echo "
"; } ?>   Server name User agent

Directory and File Permissions:

'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; ?>
An image has to be shown below. If not, images cannot be
loaded properly! Please check the debug file for more details!
 Error loading image!

Recommended settings:

These settings are recommended for PHP in order to ensure full compatibility with TWG.
However, TWG will still operate if your settings do not quite match the recommended
Directive Recommended Actual
: :