Beispiel #1
0
/**
 * _T($text[, $args])
 * Language function returns $lang[$text] && sprintf args
 */
function _T($text)
{
    static $lang;
    if (!isset($lang) || isset($_GET['lang'])) {
        // check to see if we are on a admin page
        if (defined('cfih') && cfih != 'admin') {
            // check for user pick
            if (isset($_GET['lang']) && file_exists(CFLANGPATH . $_GET['lang'] . '.lang.php')) {
                $getLang = cl(removeSymbols(end(explode('/', $_GET['lang']))));
                setcookie('lang', $getLang, null);
                $language = $getLang;
                unset($_GET['lang']);
                define('CFUSERLANG', $getLang);
            }
            // see if cookie has been set before
            if (!defined('CFUSERLANG') && isset($_COOKIE['lang']) && file_exists(CFLANGPATH . $_COOKIE['lang'] . '.lang.php')) {
                define('CFUSERLANG', $_COOKIE['lang']);
            }
        }
        // set default (admin set)
        if (!defined('CFUSERLANG')) {
            define('CFUSERLANG', getSettings('SET_LANGUAGE'));
        }
        // check for lang files
        if (!(require CFLANGPATH . CFUSERLANG . '.lang.php')) {
            // fallback
            if (!(require CFLANGPATH . 'english.lang.php')) {
                die('Can\'t find english.lang.php');
            }
        }
    }
    if (isset($lang[$text])) {
        $numargs = func_num_args();
        if ($numargs > 1) {
            $args = func_get_args();
            unset($args[0]);
            return vsprintf($lang[$text], $args);
        }
        return $lang[$text];
    }
    return $text;
}
Beispiel #2
0
 }
 // check for theme Settings
 $THUMB_OPTION = theme_setting('thumb_option', $THUMB_OPTION);
 $THUMB_MAX_WIDTH = theme_setting('thumb_max_width', $THUMB_MAX_WIDTH);
 $THUMB_MAX_HEIGHT = theme_setting('thumb_max_height', $THUMB_MAX_HEIGHT);
 // make thumb
 $thumb_mid_address = CFTHUMBPATH . $imgUp->info['new'];
 $imgUp->resizeImage($THUMB_MID_MAX_WIDTH, $THUMB_MID_MAX_HEIGHT, $THUMB_MID_OPTION);
 $imgUp->saveImage($thumb_mid_address, $imgUp->info['ext'] == 'png' ? $PNG_QUALITY : $JPG_QUALITY);
 // make small thumb
 $thumb_address = CFSMALLTHUMBPATH . $imgUp->info['new'];
 $imgUp->resizeImage($THUMB_MAX_WIDTH, $THUMB_MAX_HEIGHT, $THUMB_OPTION);
 $imgUp->saveImage($thumb_address, $imgUp->info['ext'] == 'png' ? $PNG_QUALITY : $JPG_QUALITY);
 $image = $imgUp->info;
 $imgUp->destroyImage();
 $image['alt'] = removeSymbols(cl(!empty($_POST['alt'][$i]) ? $_POST['alt'][$i] : $image['name']));
 //see if thumb's got made
 if (!file_exists($thumb_address) || !file_exists($thumb_mid_address)) {
     @unlink($image['address']);
     @unlink($thumb_address);
     @unlink($thumb_mid_address);
     user_feedback('error', '<b>' . $image['name'] . '</b> ' . _T("site_upload_err") . ' ..', 'thumbmade');
     continue;
 }
 // see if we need to get a short url for the image
 $shorturl = null;
 if (isset($_POST['shorturl'][$i]) && $_POST['shorturl'][$i] == 1 && $settings['SET_SHORT_URL_ON']) {
     $shorturl = shorturl_url('http://' . $_SERVER['HTTP_HOST'] . preg_replace('/\\/([^\\/]+?)$/', '/', $_SERVER['PHP_SELF']) . '?di=' . $image['id']);
 }
 // get thumb's file size
 $thumbsize = filesize($thumb_mid_address);