updated getcode, images for history

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@13 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2007-07-03 17:53:39 +00:00
parent 1bd466b084
commit a6da5dd574
6 changed files with 53 additions and 13 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -17,18 +17,43 @@ require('../libs/operator.php');
$operator = check_login();
$lang = verifyparam("lang", "/^\w\w$/", "");
if( !$lang || !in_array($lang,$available_locales) )
$lang = $current_locale;
// collect available images and locales
$imageLocales = array();
$imagesDir = '../images/webim';
if($handle = opendir($imagesDir)) {
while (false !== ($file = readdir($handle))) {
if (preg_match("/^(\w+)_([\w-]+)_on.gif$/", $file, $matches)
&& is_file("$imagesDir/".$matches[1]."_".$matches[2]."_off.gif")) {
$image = $matches[1];
if( !isset($imageLocales[$image]) ) {
$imageLocales[$image] = array();
}
$imageLocales[$image][] = $matches[2];
}
}
closedir($handle);
}
$file = "../images/webim/webim_${lang}_on.gif";
$image = verifyparam("image","/^\w+$/", "webim");
$image_locales = $imageLocales[$image];
$lang = verifyparam("lang", "/^\w\w$/", "");
if( !$lang || !in_array($lang,$image_locales) )
$lang = in_array($current_locale,$image_locales) ? $current_locale : $image_locales[0];
$file = "../images/webim/${image}_${lang}_on.gif";
$size = get_gifimage_size($file);
$message = get_image("/webim/button.php?lang=$lang",$size[0],$size[1]);
$message = get_image("/webim/button.php?image=$image&lang=$lang",$size[0],$size[1]);
$page = array();
$page['operator'] = get_operator_name($operator);
$page['buttonCode'] = generate_button("",$lang,$message);
$page['availableImages'] = array_keys($imageLocales);
$page['availableLocales'] = $image_locales;
$page['formimage'] = $image;
$page['formlang'] = $lang;
start_html_output();
require('../view/gen_button.php');

View File

@ -51,19 +51,34 @@
<br />
<br />
<a href="/webim/operator/getcode.php?lang=en"><?php echo getstring("get_button_en") ?></a><br/>
<a href="/webim/operator/getcode.php?lang=ru"><?php echo getstring("get_button_ru") ?></a><br/>
<br/>
<form name="buttonCodeForm" method="get" action="/webim/operator/getcode.php">
<table cellspacing='0' cellpadding='0' border='0'><tr><td background='/webim/images/loginbg.gif'><table cellspacing='0' cellpadding='0' border='0'><tr><td><img src='/webim/images/logincrnlt.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='/webim/images/logincrnrt.gif' width='16' height='16' border='0' alt=''></td></tr><tr><td></td><td align='center'><table border='0' cellspacing='0' cellpadding='0'>
<tr>
<td colspan="3" class="formauth"><?php echo getstring("page.gen_button.choose_image") ?></td>
</tr>
<tr><td colspan="3" height="2"></td></tr>
<tr>
<td colspan="3">
<select name="image" onchange="this.form.submit();"><?php foreach($page['availableImages'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("image") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
</td>
</tr>
<tr><td colspan="3" height="5"></td></tr>
<tr>
<td colspan="3" class="formauth"><?php echo getstring("page.gen_button.choose_locale") ?></td>
</tr>
<tr><td colspan="3" height="2"></td></tr>
<tr>
<td colspan="3">
<select name="lang" onchange="this.form.submit();"><?php foreach($page['availableLocales'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("lang") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
</td>
</tr>
<tr><td colspan="3" height="5"></td></tr>
<tr>
<td class="formauth"><?php echo getstring("page.gen_button.code") ?></td>
<td width="10"><img src="/webim/images/free.gif" width="10" height="1" border="0" alt=""></td>
<td></td>
</tr>
<tr>
<td colspan="3" height="2"></td>
</tr>
<tr><td colspan="3" height="2"></td></tr>
<tr>
<td><textarea cols="60" rows="15"><?php echo $page['buttonCode'] ?></textarea></td>
<td></td>
@ -87,7 +102,7 @@
<td class="formauth" valign="top" nowrap><span class="formdescr"></span></td>
</tr>
</table></td><td></td></tr><tr><td><img src='/webim/images/logincrnlb.gif' width='16' height='16' border='0' alt=''></td><td></td><td><img src='/webim/images/logincrnrb.gif' width='16' height='16' border='0' alt=''></td></tr></table></td></tr></table>
</form>
</td>
</tr>
</table>