2007-10-10 19:15:47 +04:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* This file is part of Web Instant Messenger project.
|
|
|
|
*
|
2008-10-02 16:01:31 +04:00
|
|
|
* Copyright (c) 2005-2008 Web Messenger Community
|
2007-10-10 19:15:47 +04:00
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* Evgeny Gryaznov - initial API and implementation
|
|
|
|
*/
|
|
|
|
|
2008-06-05 01:36:54 +04:00
|
|
|
require_once('../libs/common.php');
|
|
|
|
require_once('../libs/operator.php');
|
2007-10-10 19:15:47 +04:00
|
|
|
|
|
|
|
$operator = check_login();
|
|
|
|
|
|
|
|
$imageLocales = array();
|
2007-10-17 15:32:50 +04:00
|
|
|
foreach($available_locales as $curr) {
|
|
|
|
$imagesDir = "../locales/$curr/button";
|
|
|
|
if($handle = opendir($imagesDir)) {
|
|
|
|
while (false !== ($file = readdir($handle))) {
|
2008-09-30 02:41:59 +04:00
|
|
|
if (preg_match("/^(\w+)_on.gif$/", $file, $matches)
|
2007-10-17 15:32:50 +04:00
|
|
|
&& is_file("$imagesDir/".$matches[1]."_off.gif")) {
|
|
|
|
$image = $matches[1];
|
|
|
|
if( !isset($imageLocales[$image]) ) {
|
|
|
|
$imageLocales[$image] = array();
|
|
|
|
}
|
|
|
|
$imageLocales[$image][] = $curr;
|
2007-10-10 19:15:47 +04:00
|
|
|
}
|
|
|
|
}
|
2007-10-17 15:32:50 +04:00
|
|
|
closedir($handle);
|
2007-10-10 19:15:47 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$image = verifyparam("image","/^\w+$/", "webim");
|
|
|
|
$image_locales = $imageLocales[$image];
|
|
|
|
|
|
|
|
$showhost = verifyparam("hostname","/^on$/", "") == "on";
|
|
|
|
$forcesecure = verifyparam("secure","/^on$/", "") == "on";
|
|
|
|
|
2007-10-17 15:32:50 +04:00
|
|
|
$lang = verifyparam("lang", "/^[\w-]{2,5}$/", "");
|
2007-10-10 19:15:47 +04:00
|
|
|
if( !$lang || !in_array($lang,$image_locales) )
|
|
|
|
$lang = in_array($current_locale,$image_locales) ? $current_locale : $image_locales[0];
|
|
|
|
|
2007-10-17 15:32:50 +04:00
|
|
|
$file = "../locales/${lang}/button/${image}_on.gif";
|
2007-10-10 19:15:47 +04:00
|
|
|
$size = get_gifimage_size($file);
|
|
|
|
|
2008-09-30 02:41:59 +04:00
|
|
|
$message = get_image(get_app_location($showhost,$forcesecure)."/button.php?image=$image&lang=$lang",$size[0],$size[1]);
|
2007-10-10 19:15:47 +04:00
|
|
|
|
|
|
|
$page = array();
|
2008-05-06 15:14:48 +04:00
|
|
|
$page['operator'] = topage(get_operator_name($operator));
|
2007-10-10 19:15:47 +04:00
|
|
|
$page['buttonCode'] = generate_button("",$lang,$message,$showhost,$forcesecure);
|
|
|
|
$page['availableImages'] = array_keys($imageLocales);
|
|
|
|
$page['availableLocales'] = $image_locales;
|
|
|
|
|
|
|
|
$page['formimage'] = $image;
|
|
|
|
$page['formlang'] = $lang;
|
|
|
|
$page['formhostname'] = $showhost;
|
|
|
|
$page['formsecure'] = $forcesecure;
|
|
|
|
|
|
|
|
start_html_output();
|
|
|
|
require('../view/gen_button.php');
|
2007-05-10 21:31:10 +04:00
|
|
|
?>
|