" . $temp . ""; } $operator = check_login(); loadsettings(); $imageLocales = array(); $allLocales = get_available_locales(); foreach ($allLocales as $curr) { $imagesDir = "../locales/$curr/button"; if ($handle = @opendir($imagesDir)) { while (false !== ($file = readdir($handle))) { if (preg_match("/^(\w+)_on.gif$/", $file, $matches) && is_file("$imagesDir/" . $matches[1] . "_off.gif")) { $image = $matches[1]; if (!isset($imageLocales[$image])) { $imageLocales[$image] = array(); } $imageLocales[$image][] = $curr; } } closedir($handle); } } $image = verifyparam(isset($_GET['image']) ? "image" : "i", "/^\w+$/", "webim"); $image_locales = $imageLocales[$image]; $stylelist = array("" => getlocal("page.preview.style_default")); $stylesfolder = "../styles"; if ($handle = opendir($stylesfolder)) { while (false !== ($file = readdir($handle))) { if (preg_match("/^\w+$/", $file) && is_dir("$stylesfolder/$file")) { $stylelist[$file] = $file; } } closedir($handle); } $style = verifyparam("style", "/^\w*$/", ""); if ($style && !in_array($style, $stylelist)) { $style = ""; } $groupid = ""; if ($settings['enablegroups'] == '1') { $groupid = verifyparam("group", "/^\d{0,8}$/", ""); if ($groupid) { $group = group_by_id($groupid); if (!$group) { $errors[] = getlocal("page.group.no_such"); $groupid = ""; } } } $showhost = verifyparam("hostname", "/^on$/", "") == "on"; $forcesecure = verifyparam("secure", "/^on$/", "") == "on"; $modsecurity = verifyparam("modsecurity", "/^on$/", "") == "on"; $lang = verifyparam("lang", "/^[\w-]{2,5}$/", ""); if (!$lang || !in_array($lang, $image_locales)) $lang = in_array($current_locale, $image_locales) ? $current_locale : $image_locales[0]; $file = "../locales/${lang}/button/${image}_on.gif"; $size = get_gifimage_size($file); $imagehref = get_app_location($showhost, $forcesecure) . "/b.php?i=$image&lang=$lang"; if ($groupid) { $imagehref .= "&group=$groupid"; } $message = get_image($imagehref, $size[0], $size[1]); $page = array(); $page['buttonCode'] = generate_button("", $lang, $style, $groupid, $message, $showhost, $forcesecure, $modsecurity); $page['availableImages'] = array_keys($imageLocales); $page['availableLocales'] = $image_locales; $page['availableStyles'] = $stylelist; if ($settings['enablegroups'] == '1') { $link = connect(); $allgroups = get_all_groups($link); mysql_close($link); $page['groups'] = array(); $page['groups'][] = array('groupid' => '', 'vclocalname' => getlocal("page.gen_button.default_group")); foreach ($allgroups as $g) { $page['groups'][] = $g; } } $page['formgroup'] = $groupid; $page['formstyle'] = $style; $page['formimage'] = $image; $page['formlang'] = $lang; $page['formhostname'] = $showhost; $page['formsecure'] = $forcesecure; $page['formmodsecurity'] = $modsecurity; prepare_menu($operator); start_html_output(); require('../view/gen_button.php'); ?>