2007-10-10 19:15:47 +04:00
|
|
|
<?php
|
|
|
|
/*
|
2013-03-07 01:22:53 +04:00
|
|
|
* Copyright 2005-2013 the original author or authors.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2007-10-10 19:15:47 +04:00
|
|
|
*/
|
|
|
|
|
2008-06-05 01:36:54 +04:00
|
|
|
require_once('../libs/common.php');
|
|
|
|
require_once('../libs/operator.php');
|
2009-03-25 02:34:57 +03:00
|
|
|
require_once('../libs/groups.php');
|
2011-04-07 12:09:10 +04:00
|
|
|
require_once('../libs/getcode.php');
|
2011-12-14 19:50:10 +04:00
|
|
|
require_once('../libs/styles.php');
|
2011-02-26 13:56:17 +03:00
|
|
|
|
2007-10-10 19:15:47 +04:00
|
|
|
$operator = check_login();
|
2011-04-13 18:44:09 +04:00
|
|
|
force_password($operator);
|
|
|
|
|
2011-04-07 12:09:10 +04:00
|
|
|
$imageLocales = get_image_locales_map("../locales");
|
2009-09-01 12:50:11 +04:00
|
|
|
$image = verifyparam(isset($_GET['image']) ? "image" : "i", "/^\w+$/", "webim");
|
2011-04-07 12:09:10 +04:00
|
|
|
if (!isset($imageLocales[$image])) {
|
|
|
|
$errors[] = "Unknown image: $image";
|
|
|
|
$avail = array_keys($imageLocales);
|
|
|
|
$image = $avail[0];
|
2008-11-21 19:47:03 +03:00
|
|
|
}
|
2011-04-07 12:09:10 +04:00
|
|
|
$image_locales = $imageLocales[$image];
|
2008-11-21 19:47:03 +03:00
|
|
|
|
2011-12-14 19:50:10 +04:00
|
|
|
$stylelist = get_style_list("../styles/dialogs");
|
|
|
|
$stylelist[""] = getlocal("page.preview.style_default");
|
2011-02-26 17:06:19 +03:00
|
|
|
$style = verifyparam("style", "/^\w*$/", "");
|
|
|
|
if ($style && !in_array($style, $stylelist)) {
|
2008-11-21 19:47:03 +03:00
|
|
|
$style = "";
|
|
|
|
}
|
|
|
|
|
2011-12-14 19:50:10 +04:00
|
|
|
$invitationstylelist = get_style_list("../styles/invitations");
|
|
|
|
$invitationstylelist[""] = getlocal("page.preview.style_default");
|
|
|
|
$invitationstyle = verifyparam("invitationstyle", "/^\w*$/", "");
|
|
|
|
if ($invitationstyle && !in_array($invitationstyle, $invitationstylelist)) {
|
|
|
|
$invitationstyle = "";
|
|
|
|
}
|
|
|
|
|
2011-04-07 12:09:10 +04:00
|
|
|
$groupid = verifyparam_groupid("group");
|
2011-02-26 17:06:19 +03:00
|
|
|
$showhost = verifyparam("hostname", "/^on$/", "") == "on";
|
|
|
|
$forcesecure = verifyparam("secure", "/^on$/", "") == "on";
|
|
|
|
$modsecurity = verifyparam("modsecurity", "/^on$/", "") == "on";
|
2007-10-10 19:15:47 +04:00
|
|
|
|
2007-10-17 15:32:50 +04:00
|
|
|
$lang = verifyparam("lang", "/^[\w-]{2,5}$/", "");
|
2011-02-26 17:06:19 +03:00
|
|
|
if (!$lang || !in_array($lang, $image_locales))
|
|
|
|
$lang = in_array($current_locale, $image_locales) ? $current_locale : $image_locales[0];
|
2007-10-10 19:15:47 +04:00
|
|
|
|
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);
|
|
|
|
|
2011-02-26 17:06:19 +03:00
|
|
|
$imagehref = get_app_location($showhost, $forcesecure) . "/b.php?i=$image&lang=$lang";
|
|
|
|
if ($groupid) {
|
2009-06-05 03:01:17 +04:00
|
|
|
$imagehref .= "&group=$groupid";
|
|
|
|
}
|
2011-02-26 17:06:19 +03:00
|
|
|
$message = get_image($imagehref, $size[0], $size[1]);
|
2007-10-10 19:15:47 +04:00
|
|
|
|
|
|
|
$page = array();
|
2011-12-14 19:50:10 +04:00
|
|
|
$page['buttonCode'] = generate_button("", $lang, $style, $invitationstyle, $groupid, $message, $showhost, $forcesecure, $modsecurity);
|
2007-10-10 19:15:47 +04:00
|
|
|
$page['availableImages'] = array_keys($imageLocales);
|
|
|
|
$page['availableLocales'] = $image_locales;
|
2011-12-14 19:50:10 +04:00
|
|
|
$page['availableChatStyles'] = $stylelist;
|
|
|
|
$page['availableInvitationStyles'] = $invitationstylelist;
|
2011-04-07 12:09:10 +04:00
|
|
|
$page['groups'] = get_groups_list();
|
2009-03-25 02:34:57 +03:00
|
|
|
|
|
|
|
$page['formgroup'] = $groupid;
|
2008-11-21 19:47:03 +03:00
|
|
|
$page['formstyle'] = $style;
|
2011-12-14 19:50:10 +04:00
|
|
|
$page['forminvitationstyle'] = $invitationstyle;
|
2007-10-10 19:15:47 +04:00
|
|
|
$page['formimage'] = $image;
|
|
|
|
$page['formlang'] = $lang;
|
|
|
|
$page['formhostname'] = $showhost;
|
|
|
|
$page['formsecure'] = $forcesecure;
|
2009-07-24 12:06:24 +04:00
|
|
|
$page['formmodsecurity'] = $modsecurity;
|
2007-10-10 19:15:47 +04:00
|
|
|
|
2012-07-16 18:26:53 +04:00
|
|
|
$page['enabletracking'] = Settings::get('enabletracking');
|
2011-12-14 19:50:10 +04:00
|
|
|
|
2009-03-16 04:20:04 +03:00
|
|
|
prepare_menu($operator);
|
2007-10-10 19:15:47 +04:00
|
|
|
start_html_output();
|
|
|
|
require('../view/gen_button.php');
|
2007-05-10 21:31:10 +04:00
|
|
|
?>
|