mirror of
https://github.com/Mibew/design.git
synced 2025-01-23 02:20:34 +03:00
Update setup_leavemessage function to return data
This commit is contained in:
parent
b8b73e82fe
commit
f904f05dc9
@ -89,7 +89,10 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
|||||||
if(!has_online_operators($groupid)) {
|
if(!has_online_operators($groupid)) {
|
||||||
$page = array();
|
$page = array();
|
||||||
setup_logo($group);
|
setup_logo($group);
|
||||||
setup_leavemessage($visitor['name'],$email,$firstmessage,$groupid,$groupname,$info,$referrer,can_show_captcha());
|
$page = array_merge_recursive(
|
||||||
|
$page,
|
||||||
|
setup_leavemessage($visitor['name'],$email,$firstmessage,$groupid,$groupname,$info,$referrer)
|
||||||
|
);
|
||||||
expand("styles/dialogs", getchatstyle(), "leavemessage.tpl");
|
expand("styles/dialogs", getchatstyle(), "leavemessage.tpl");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,10 @@ if(Settings::get("enablecaptcha") == "1" && can_show_captcha()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( count($errors) > 0 ) {
|
if( count($errors) > 0 ) {
|
||||||
setup_leavemessage($visitor_name,$email,$message,$groupid,$groupname,$info,$referrer,can_show_captcha());
|
$page = array_merge_recursive(
|
||||||
|
$page,
|
||||||
|
setup_leavemessage($visitor_name,$email,$message,$groupid,$groupname,$info,$referrer)
|
||||||
|
);
|
||||||
setup_logo($group);
|
setup_logo($group);
|
||||||
expand("styles/dialogs", getchatstyle(), "leavemessage.tpl");
|
expand("styles/dialogs", getchatstyle(), "leavemessage.tpl");
|
||||||
exit;
|
exit;
|
||||||
|
@ -137,27 +137,43 @@ function setup_logo($group = NULL)
|
|||||||
$page['webimHost'] = topage(empty($toplevelgroup['vchosturl'])?Settings::get('hosturl'):$toplevelgroup['vchosturl']);
|
$page['webimHost'] = topage(empty($toplevelgroup['vchosturl'])?Settings::get('hosturl'):$toplevelgroup['vchosturl']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_leavemessage($name, $email, $message, $groupid, $groupname, $info, $referrer, $canshowcaptcha)
|
/**
|
||||||
{
|
* Prepare data to display leave message form
|
||||||
global $page;
|
*
|
||||||
$page['formname'] = topage($name);
|
* @param string $name User name
|
||||||
$page['formemail'] = topage($email);
|
* @param string $email User email
|
||||||
$page['formmessage'] = $message ? topage($message) : "";
|
* @param string $message First message text
|
||||||
$page['showcaptcha'] = Settings::get("enablecaptcha") == "1" && $canshowcaptcha ? "1" : "";
|
* @param int $groupid Id of selected group
|
||||||
$page['formgroupid'] = $groupid;
|
* @param string $groupname Name of selected group
|
||||||
$page['formgroupname'] = $groupname;
|
* @param string $info User info
|
||||||
$page['forminfo'] = topage($info);
|
* @param string $referrer URL of referrer page
|
||||||
$page['referrer'] = urlencode(topage($referrer));
|
* @return array Array of leave message form data
|
||||||
|
*
|
||||||
|
* @todo Think about $info param. It seems to this param is meaningless.
|
||||||
|
*/
|
||||||
|
function setup_leavemessage($name, $email, $message, $groupid, $groupname, $info, $referrer) {
|
||||||
|
$data = array();
|
||||||
|
|
||||||
|
$canshowcaptcha = can_show_captcha();
|
||||||
|
$data['formname'] = topage($name);
|
||||||
|
$data['formemail'] = topage($email);
|
||||||
|
$data['formmessage'] = $message ? topage($message) : "";
|
||||||
|
$data['showcaptcha'] = Settings::get("enablecaptcha") == "1" && $canshowcaptcha ? "1" : "";
|
||||||
|
$data['formgroupid'] = $groupid;
|
||||||
|
$data['formgroupname'] = $groupname;
|
||||||
|
$data['forminfo'] = topage($info);
|
||||||
|
$data['referrer'] = urlencode(topage($referrer));
|
||||||
|
|
||||||
if (Settings::get('enablegroups') == '1') {
|
if (Settings::get('enablegroups') == '1') {
|
||||||
$groups = setup_groups_select($groupid, false);
|
$groups = setup_groups_select($groupid, false);
|
||||||
if ($groups) {
|
if ($groups) {
|
||||||
$page['groups'] = $groups['select'];
|
$data['groups'] = $groups['select'];
|
||||||
$page['group.descriptions'] = json_encode($groups['descriptions']);
|
$data['group.descriptions'] = json_encode($groups['descriptions']);
|
||||||
$page['default.department.description'] = $groups['defaultdescription'];
|
$data['default.department.description'] = $groups['defaultdescription'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,7 +186,7 @@ function setup_leavemessage($name, $email, $message, $groupid, $groupname, $info
|
|||||||
* @param string $referrer URL of referrer page
|
* @param string $referrer URL of referrer page
|
||||||
* @return array Array of survey data
|
* @return array Array of survey data
|
||||||
*
|
*
|
||||||
* @todo Think about $info param. It seems to be meaningless.
|
* @todo Think about $info param. It seems to this param is meaningless.
|
||||||
*/
|
*/
|
||||||
function setup_survey($name, $email, $groupid, $info, $referrer) {
|
function setup_survey($name, $email, $groupid, $info, $referrer) {
|
||||||
$data = array();
|
$data = array();
|
||||||
|
Loading…
Reference in New Issue
Block a user