row($sql); $w = $row['width']; $h = $row['height']; } if($size){ list($w,$h) = calculateImageSize($w,$h,$size); $size = '/'.$size; } } return ''.hsc($title).''; } /** * Calculates the correct image width and height maintaining the * aspect ratio * * @returns array with width and height or false if no resize needed */ function calculateImageSize($w,$h,$size){ $sizes = array( 'square' => 75, 'thumb' => 100, 'small' => 240, 'medium' => 500, 'large' => 1024, ); $sz = $sizes[$size]; if(!$sz){ // no size return false; } if($w <= $sz && $h <= $sz){ // we don't upscale return false; } //calculate size with correct aspect ratio if($w > $h){ $to_w = $sz; $to_h = round(($h*$sz)/$w); }else{ $to_h = $sz; $to_w = round(($w*$sz)/$h); } return array($to_w,$to_h); } /** * Uses print_r to dump a variable * * @author Andreas Gohr * @see print_r */ function dbg($val){ print '
';
    print_r($val);
    print '
'; } /** * Creates a directory hierachy. * * @link http://www.php.net/manual/en/function.mkdir.php * @author * @author Andreas Gohr */ function mkdir_p($target){ if (@is_dir($target)||empty($target)) return 1; // best case check first if (@file_exists($target) && !is_dir($target)) return 0; //recursion if (mkdir_p(substr($target,0,strrpos($target,'/')))){ $ret = @mkdir($target); // crawl back up & create dir tree return $ret; } return 0; } function hsc($string){ return htmlspecialchars($string); } function clp($path){ return str_replace('//','/',$path); } /* * Yes, hacking this function will work, but please consider paying for the * noadcode instead */ function adv($s='big'){ $conf = core_object('Conf'); if($conf->get('noadhash') == 'ddaffd539e8b6055df398b73329d86e7') return; if($s == 'small'){ $w = 234; $h = 60; }else{ $w = 250; $h = 250; } ?>

* @link http://www.php.net/manual/en/function.utf8-encode.php */ function utf8_check($Str) { for ($i=0; $i