Beispiel #1
0
 $editsurvey .= ">" . $clang->gT("Question by Question") . "</option>\n" . "<option value='G'";
 if ($esrow['format'] == "G") {
     $editsurvey .= " selected='selected'";
 }
 $editsurvey .= ">" . $clang->gT("Group by Group") . "</option>\n" . "<option value='A'";
 if ($esrow['format'] == "A") {
     $editsurvey .= " selected='selected'";
 }
 $editsurvey .= ">" . $clang->gT("All in one") . "</option>\n" . "</select>\n" . "</li>\n";
 //TEMPLATES
 if (!$esrow['template']) {
     $esrow['template'] = $defaulttemplate;
 }
 $esrow['template'] = validate_templatedir($esrow['template']);
 $editsurvey .= "<li><label for='template'>" . $clang->gT("Template:") . "</label>\n" . "<select id='template' name='template'>\n";
 foreach (array_keys(gettemplatelist()) as $tname) {
     if ($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] == 1 || hasTemplateManageRights($_SESSION["loginID"], $tname) == 1) {
         $editsurvey .= "<option value='{$tname}'";
         if ($esrow['template'] && htmlspecialchars($tname) == $esrow['template']) {
             $editsurvey .= " selected='selected'";
         }
         $editsurvey .= ">{$tname}</option>\n";
     }
 }
 $editsurvey .= "</select>\n" . "</li>\n";
 $editsurvey .= "<li><label for='preview'>" . $clang->gT("Template Preview:") . "</label>\n" . "<img alt='" . $clang->gT("Template preview image") . "' id='preview' src='" . sGetTemplateURL($esrow['template']) . "/preview.png' />\n" . "</li>\n";
 //SHOW WELCOMESCRN
 $editsurvey .= "<li><label for='showwelcome'>" . $clang->gT("Show welcome screen?") . "</label>\n" . "<select id='showwelcome' name='showwelcome'>\n" . "<option value='Y'";
 if (!$esrow['showwelcome'] || $esrow['showwelcome'] == "Y") {
     $editsurvey .= " selected='selected'";
 }
function globalsettingsdisplay()
{
    global $action, $connect, $js_admin_includes, $editsurvey, $subaction, $scriptname, $clang;
    global $updateversion, $updatebuild, $updateavailable, $updatelastcheck, $demoModeOnly;

    if (isset($subaction) && $subaction == "updatecheck")
    {
        $updateinfo=updatecheck();
    }

    if (isset($action) && $action == "globalsettings")
    {
        if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1)
        {
            $js_admin_includes[]='scripts/globalsettings.js';
            // header
            $editsurvey = "<div class='header ui-widget-header'>".$clang->gT("Global settings")."</div>\n";
            // beginning TABs section
            $editsurvey .= "\t<div id='tabs'>
            <ul>
            <li><a href='#overview'>".$clang->gT("Overview & update")."</a></li>
            <li><a href='#general'>".$clang->gT("General")."</a></li>
            <li><a href='#email'>".$clang->gT("Email settings")."</a></li>
            <li><a href='#bounce'>".$clang->gT("Bounce settings")."</a></li>
            <li><a href='#security'>".$clang->gT("Security")."</a></li>
            <li><a href='#presentation'>".$clang->gT("Presentation")."</a></li>
            </ul>\n";
            $editsurvey .= "<form class='form30' id='frmglobalsettings' name='frmglobalsettings' action='$scriptname' method='post'>\n";
            $editsurvey .= "<div id='overview'>\n";
            $editsurvey .= checksettings();
            $thisupdatecheckperiod=getGlobalSetting('updatecheckperiod');
            $editsurvey .= "<br /></p><div class='header ui-widget-header'>".$clang->gT("Updates")."</div><ul>"
            . "\t<li><label for='updatecheckperiod'>".$clang->gT("Check for updates:")."</label>\n"
            . "\t\t\t<select name='updatecheckperiod' id='updatecheckperiod'>\n"
            . "\t\t\t\t<option value='0'";
            if ($thisupdatecheckperiod==0) {$editsurvey .= " selected='selected'";}
            $editsurvey .=">".$clang->gT("Never")."</option>\n"
            . "\t\t\t\t<option value='1'";
            if ($thisupdatecheckperiod==1) {$editsurvey .= " selected='selected'";}
            $editsurvey .=">".$clang->gT("Every day")."</option>\n"
            . "\t\t\t\t<option value='7'";
            if ($thisupdatecheckperiod==7) {$editsurvey .= " selected='selected'";}
            $editsurvey .=">".$clang->gT("Every week")."</option>\n"
            . "<option value='14'";
            if ($thisupdatecheckperiod==14) {$editsurvey .= " selected='selected'";}
            $editsurvey .=">".$clang->gT("Every 2 weeks")."</option>\n"
            . "<option value='30'";
            if ($thisupdatecheckperiod==30) {$editsurvey .= " selected='selected'";}
            $editsurvey .=">".$clang->gT("Every month")."</option>\n"
            . "</select>&nbsp;<input type='button' onclick=\"window.open('$scriptname?action=globalsettings&amp;subaction=updatecheck', '_top')\" value='".$clang->gT("Check now")."' />&nbsp;<span id='lastupdatecheck'>".sprintf($clang->gT("Last check: %s"),$updatelastcheck)."</span></li></ul><p>\n";

            if (isset($updateavailable) && $updateavailable==1)
            {
                $editsurvey .='<span style="font-weight: bold;">'.sprintf($clang->gT('There is a LimeSurvey update available: Version %s'),$updateversion."($updatebuild)").'</span><br />';
                $editsurvey .=sprintf($clang->gT('You can update %smanually%s or use the %s'),"<a href='http://docs.limesurvey.org/tiki-index.php?page=Upgrading+from+a+previous+version'>","</a>","<a href='$scriptname?action=update'>".$clang->gT('3-Click ComfortUpdate').'</a>').'.<br />';
            }
            elseif (isset($updateinfo['errorcode']))
            {
                $editsurvey .=sprintf($clang->gT('There was an error on update check (%s)'),$updateinfo['errorcode']).'.<br />';
                $editsurvey .="<textarea readonly='readonly' style='width:35%; height:60px; overflow: auto;'>".strip_tags($updateinfo['errorhtml']).'</textarea>';

            }
            else
            {
                $editsurvey .=$clang->gT('There is currently no newer LimeSurvey version available.');
            }
            $editsurvey .= "</p></div>";



            // General TAB
            $editsurvey .= "\t<div id='general'>\n";
            // Administrator...
            $editsurvey .= "<ul>"
            . "\t<li><label for='sitename'>".$clang->gT("Site name:").(($demoModeOnly==true)?'*':'')."</label>\n"
            . "\t\t<input type='text' size='50' id='sitename' name='sitename' value=\"".htmlspecialchars(getGlobalSetting('sitename'))."\" /></li>\n"
            . "\t<li><label for='defaultlang'>".$clang->gT("Default site language:").(($demoModeOnly==true)?'*':'')."</label>\n"
            . "\t\t<select name='defaultlang' id='defaultlang'>\n";
            $actuallang=getGlobalSetting('defaultlang');
            foreach (getLanguageData(true) as  $langkey2=>$langname)
            {
                $editsurvey .= "\t\t\t<option value='".$langkey2."'";
                if ($actuallang == $langkey2) {$editsurvey .= " selected='selected'";}
                $editsurvey .= ">".$langname['nativedescription']." - ".$langname['description']."</option>\n";
            }

            $editsurvey .= "\t\t</select></li>";

            $thisdefaulttemplate=getGlobalSetting('defaulttemplate');
            $templatenames=array_keys(gettemplatelist());
            $editsurvey .= ""
            . "\t<li><label for='defaulttemplate'>".$clang->gT("Default template:")."</label>\n"
            . "\t\t\t<select name='defaulttemplate' id='defaulttemplate'>\n";
            foreach ($templatenames as $templatename)
            {
                $editsurvey.= "\t\t\t\t<option value='$templatename'";
                if ($thisdefaulttemplate==$templatename) {$editsurvey .= " selected='selected'";}
                $editsurvey .=">$templatename</option>\n";
            }
            $editsurvey .="\t\t\t</select></li>\n";


            $thisdefaulthtmleditormode=getGlobalSetting('defaulthtmleditormode');
            $editsurvey .= ""
            . "\t<li><label for='defaulthtmleditormode'>".$clang->gT("Default HTML editor mode:").(($demoModeOnly==true)?'*':'')."</label>\n"
            . "\t\t\t<select name='defaulthtmleditormode' id='defaulthtmleditormode'>\n"
            . "\t\t\t\t<option value='default'";
            if ($thisdefaulthtmleditormode=='default') {$editsurvey .= " selected='selected'";}
            $editsurvey .=">".$clang->gT("Default HTML editor mode")."</option>\n"
            . "\t\t\t\t<option value='none'";
            if ($thisdefaulthtmleditormode=='none') {$editsurvey .= " selected='selected'";}
            $editsurvey .=">".$clang->gT("No HTML editor")."</option>\n"
            . "<option value='inline'";
            if ($thisdefaulthtmleditormode=='inline') {$editsurvey .= " selected='selected'";}
            $editsurvey .=">".$clang->gT("Inline HTML editor")."</option>\n"
            . "<option value='popup'";
            if ($thisdefaulthtmleditormode=='popup') {$editsurvey .= " selected='selected'";}
            $editsurvey .=">".$clang->gT("Popup HTML editor")."</option>\n"
            . "</select></li>\n";

            $dateformatdata=getDateFormatData($_SESSION['dateformat']);
            $editsurvey.= "\t<li><label for='timeadjust'>".$clang->gT("Time difference (in hours):")."</label>\n"
            . "\t\t<span><input type='text' size='10' id='timeadjust' name='timeadjust' value=\"".htmlspecialchars(str_replace(array('+',' hours'),array('',''),getGlobalSetting('timeadjust')))."\" /> "
            . $clang->gT("Server time:").' '.convertDateTimeFormat(date('Y-m-d H:i:s'),'Y-m-d H:i:s',$dateformatdata['phpdate'].' H:i')." - ".$clang->gT("Corrected time :").' '.convertDateTimeFormat(date_shift(date("Y-m-d H:i:s"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')),'Y-m-d H:i:s',$dateformatdata['phpdate'].' H:i')."
            </span></li>\n";

            $thisusepdfexport=getGlobalSetting('usepdfexport');
            $editsurvey .= "\t<li><label for='usepdfexport'>".$clang->gT("PDF export available:")."</label>\n"
            . "<select name='usepdfexport' id='usepdfexport'>\n"
            . "<option value='1'";
            if ( $thisusepdfexport == true) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("On")."</option>\n"
            . "<option value='0'";
            if ( $thisusepdfexport == false) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Off")."</option>\n"
            . "\t\t</select>\n\t</li>\n";

            $thisaddTitleToLinks=getGlobalSetting('addTitleToLinks');
            $editsurvey .= "\t<li><label for='addTitleToLinks'>".$clang->gT("Screen reader compatibility mode:")."</label>\n"
            . "<select name='addTitleToLinks' id='addTitleToLinks'>\n"
            . "<option value='1'";
            if ( $thisaddTitleToLinks == true) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("On")."</option>\n"
            . "<option value='0'";
            if ( $thisaddTitleToLinks == false) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Off")."</option>\n"
            . "</select>\n</li>\n"
            . "<li><label for='sessionlifetime'>".$clang->gT("Session lifetime (seconds):")."</label>\n"
            . "<input type='text' size='10' id='sessionlifetime' name='sessionlifetime' value=\"".htmlspecialchars(getGlobalSetting('sessionlifetime'))."\" /></li>"
            . "<li><label for='ipInfoDbAPIKey'>".$clang->gT("IP Info DB API Key:")."</label>\n"
            . "<input type='text' size='35' id='ipInfoDbAPIKey' name='ipInfoDbAPIKey' value=\"".htmlspecialchars(getGlobalSetting('ipInfoDbAPIKey'))."\" /></li>"
            . "<li><label for='googleMapsAPIKey'>".$clang->gT("Google Maps API key:")."</label>\n"
            . "<input type='text' size='35' id='googleMapsAPIKey' name='googleMapsAPIKey' value=\"".htmlspecialchars(getGlobalSetting('googleMapsAPIKey'))."\" /></li>"

                    ;


            // End General TAB

            $editsurvey .= "\t</ul></div>\n";

            // Email TAB
            $editsurvey .= "\t<div id='email'><ul>\n";
			 //Format
            $editsurvey.= "\t<li><label for='siteadminemail'>".$clang->gT("Default site admin email:")."</label>\n"
            . "\t\t<input type='text' size='50' id='siteadminemail' name='siteadminemail' value=\"".htmlspecialchars(getGlobalSetting('siteadminemail'))."\" /></li>\n"

            . "\t<li><label for='siteadminname'>".$clang->gT("Administrator name:")."</label>\n"
            . "\t\t<input type='text' size='50' id='siteadminname' name='siteadminname' value=\"".htmlspecialchars(getGlobalSetting('siteadminname'))."\" /><br /><br /></li>\n"
            . "\t<li><label for='emailmethod'>".$clang->gT("Email method:")."</label>\n"
            . "\t\t<select id='emailmethod' name='emailmethod'>\n"
            . "\t\t\t<option value='mail'";
            if (getGlobalSetting('emailmethod')=='mail') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("PHP (default)")."</option>\n"
            . "\t\t\t<option value='smtp'";
            if (getGlobalSetting('emailmethod')=='smtp') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("SMTP")."</option>\n"
            . "\t\t\t<option value='sendmail'";
            if (getGlobalSetting('emailmethod')=='sendmail') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Sendmail")."</option>\n"
            . "\t\t\t<option value='qmail'";
            if (getGlobalSetting('emailmethod')=='qmail') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Qmail")."</option>\n"
            . "\t\t</select></li>\n"
            . "\t<li>\n\t\t<label for=\"emailsmtphost\">".$clang->gT("SMTP host:")."</label>\n"
            . "\t\t<input type='text' size='50' id='emailsmtphost' name='emailsmtphost' value=\"".htmlspecialchars(getGlobalSetting('emailsmtphost'))."\" />&nbsp;<font size='1'>".$clang->gT("Enter your hostname and port, e.g.: my.smtp.com:25")."</font></li>\n"
            . "\t<li><label for='emailsmtpuser'>".$clang->gT("SMTP username:"******"</label>\n"
            . "\t\t<input type='text' size='50' id='emailsmtpuser' name='emailsmtpuser' value=\"".htmlspecialchars(getGlobalSetting('emailsmtpuser'))."\" /></li>\n"
            . "\t<li><label for='emailsmtppassword'>".$clang->gT("SMTP password:"******"</label>\n"
            . "\t\t<input type='password' size='50' id='emailsmtppassword' name='emailsmtppassword' value='somepassword' /></li>\n"
            . "\t<li><label for='emailsmtpssl'>".$clang->gT("SMTP SSL/TLS:")."</label>\n"
            . "\t\t<select id='emailsmtpssl' name='emailsmtpssl'>\n"
            . "\t\t\t<option value=''";
            if (getGlobalSetting('emailsmtpssl')=='') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Off")."</option>\n"
            . "\t\t\t<option value='ssl'";
            if (getGlobalSetting('emailsmtpssl')=='ssl' || getGlobalSetting('emailsmtpssl')==1) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("SSL")."</option>\n"
            . "\t\t\t<option value='tls'";
            if (getGlobalSetting('emailsmtpssl')=='tls') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("TLS")."</option>\n"
            . "\t\t</select></li>\n"
            . "\t<li><label for='emailsmtpdebug'>".$clang->gT("SMTP debug mode:")."</label>\n"
            . "\t\t<select id='emailsmtpdebug' name='emailsmtpdebug'>\n"
            . "\t\t\t<option value=''";
            if (getGlobalSetting('emailsmtpdebug')=='0') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Off")."</option>\n"
            . "\t\t\t<option value='1'";
            if (getGlobalSetting('emailsmtpdebug')=='1' || getGlobalSetting('emailsmtpssl')==1) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("On errors")."</option>\n"
            . "\t\t\t<option value='2'";
            if (getGlobalSetting('emailsmtpdebug')=='2' || getGlobalSetting('emailsmtpssl')==1) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Always")."</option>\n"
            . "\t\t</select><br />&nbsp;</li>\n"
            . "\t<li><label for='maxemails'>".$clang->gT("Email batch size:")."</label>\n"
            . "\t\t<input type='text' size='5' id='maxemails' name='maxemails' value=\"".htmlspecialchars(getGlobalSetting('maxemails'))."\" /></li>\n"
            . "\t</ul>\n";
            // End Email TAB
            $editsurvey .= "\t</div>\n";
            // Start bounce tab
            $editsurvey .= "\t<div id='bounce'><ul>\n"
            . "\t<li><label for='siteadminbounce'>".$clang->gT("Default site bounce email:")."</label>\n"
            . "\t\t<input type='text' size='50' id='siteadminbounce' name='siteadminbounce' value=\"".htmlspecialchars(getGlobalSetting('siteadminbounce'))."\" /></li>\n"
            . "\t<li><label for='bounceaccounttype'>".$clang->gT("Server type:")."</label>\n"
	        . "\t\t<select id='bounceaccounttype' name='bounceaccounttype'>\n"
  	        . "\t\t\t<option value='off'";
            if (getGlobalSetting('bounceaccounttype')=='off') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Off")."</option>\n"
            . "\t\t\t<option value='IMAP'";
            if (getGlobalSetting('bounceaccounttype')=='IMAP') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("IMAP")."</option>\n"
            . "\t\t\t<option value='POP'";
            if (getGlobalSetting('bounceaccounttype')=='POP') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("POP")."</option>\n"
            ."\t\t</select></li>\n"

            . "\t<li><label for='bounceaccounthost'>".$clang->gT("Server name & port:")."</label>\n"
            . "\t\t<input type='text' size='50' id='bounceaccounthost' name='bounceaccounthost' value=\"".htmlspecialchars(getGlobalSetting('bounceaccounthost'))."\" />\n"."<font size='1'>".$clang->gT("Enter your hostname and port, e.g.: imap.gmail.com:995")."</font>\n"

            . "\t<li><label for='bounceaccountuser'>".$clang->gT("User name:")."</label>\n"
            . "\t\t<input type='text' size='50' id='bounceaccountuser' name='bounceaccountuser' value=\"".htmlspecialchars(getGlobalSetting('bounceaccountuser'))."\" /></li>\n"
            . "\t<li><label for='bounceaccountpass'>".$clang->gT("Password:"******"</label>\n"
            . "\t\t<input type='password' size='50' id='bounceaccountpass' name='bounceaccountpass' value='enteredpassword' /></li>\n";
	    $editsurvey.= "\t<li><label for='bounceencryption'>".$clang->gT("Encryption type:")."</label>\n"
	    . "\t\t<select id='bounceencryption' name='bounceencryption'>\n"
  	    . "\t\t\t<option value='off'";
            if (getGlobalSetting('bounceencryption')=='off') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Off")."</option>\n"
            . "\t\t\t<option value='SSL'";
            if (getGlobalSetting('bounceencryption')=='SSL') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("SSL")."</option>\n"
            . "\t\t\t<option value='TLS'";
            if (getGlobalSetting('bounceencryption')=='TLS') {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("TLS")."</option>\n"
            ."\t\t</select></li>\n</ul>";
            $editsurvey .= "\t</div>\n";
            // End of bounce tabs
            // Security Settings
            $editsurvey .= "\t<div id='security'><ul>\n";
            // Expiration
            $thissurveyPreview_require_Auth=getGlobalSetting('surveyPreview_require_Auth');
            $editsurvey .= "\t<li><label for='surveyPreview_require_Auth'>".$clang->gT("Survey preview only for administration users")."</label>\n"
            . "\t\t<select id='surveyPreview_require_Auth' name='surveyPreview_require_Auth'>\n"
            . "\t\t\t<option value='1'";
            if ($thissurveyPreview_require_Auth == true) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Yes")."</option>\n"
            . "\t\t\t<option value='0'";
            if ($thissurveyPreview_require_Auth == false) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("No")."</option>\n"
            . "\t\t</select></li>\n";

            // Auto registration
            $thisfilterxsshtml=getGlobalSetting('filterxsshtml');
            $editsurvey .= "\t<li><label for='filterxsshtml'>".$clang->gT("Filter HTML for XSS:").(($demoModeOnly==true)?'*':'')."</label>\n"
            . "\t\t<select id='filterxsshtml' name='filterxsshtml'>\n"
            . "\t\t\t<option value='1'";
            if ( $thisfilterxsshtml == true) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Yes")."</option>\n"
            . "\t\t\t<option value='0'";
            if ( $thisfilterxsshtml == false) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("No")."</option>\n"
            . "\t\t</select></li>\n";

            $thisusercontrolSameGroupPolicy=getGlobalSetting('usercontrolSameGroupPolicy');
            $editsurvey .= "\t<li><label for='usercontrolSameGroupPolicy'>".$clang->gT("Group member can only see own group:")."</label>\n"
            . "\t\t<select id='usercontrolSameGroupPolicy' name='usercontrolSameGroupPolicy'>\n"
            . "\t\t\t<option value='1'";
            if ( $thisusercontrolSameGroupPolicy == true) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("Yes")."</option>\n"
            . "\t\t\t<option value='0'";
            if ( $thisusercontrolSameGroupPolicy == false) {$editsurvey .= " selected='selected'";}
            $editsurvey .= ">".$clang->gT("No")."</option>\n"
            . "\t\t</select></li>\n";

            $thisforce_ssl = getGlobalSetting('force_ssl');
	    $opt_force_ssl_on = $opt_force_ssl_off = $opt_force_ssl_neither = '';
	    $warning_force_ssl = $clang->gT('Warning: Before turning on HTTPS, ')
	    . '<a href="https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'"title="'
	    . $clang->gT('Test if your server has SSL enabled by clicking on this link.').'">'
	    . $clang->gT('check if this link works.').'</a><br/> '
	    . $clang->gT("If the link does not work and you turn on HTTPS, LimeSurvey will break and you won't be able to access it.");
//	    $warning_force_ssl = ' Do <strong>NOT</strong> force "On" if you\'re <strong>not completely certain</strong> your server has a SSL enabled. <br />'
//	    . 'Before turning on HTTPS, <a href="https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'">See if this link works</a><br />'
//	    . 'If not, <strong>LimeSurvey will break</strong> if SSL is forced on but your server does not have a valid secure certificate installed and enabled.<br />';
	    switch($thisforce_ssl)
	    {
	    	case 'on':
		    $warning_force_ssl = '&nbsp;';
		    break;
		case 'off':
		case 'neither':
		    break;
	    	default:
		    $thisforce_ssl = 'neither';
	    };
	    $this_opt = 'opt_force_ssl_'.$thisforce_ssl;
	    $$this_opt = ' selected="selected"';
	    $editsurvey .= '<li><label for="force_ssl">'.$clang->gT('Force HTTPS:')."</label>\n"
	    . "<select name=\"force_ssl\" id=\"force_ssl\">\n\t"
            . '<option value="on" '.$opt_force_ssl_on.'>'.$clang->gT('On')."</option>\n\t"
            . '<option value="off" '.$opt_force_ssl_off.'>'.$clang->gT('Off')."</option>\n\t"
            . '<option value="neither" '.$opt_force_ssl_neither.'>'.$clang->gT('Don\'t force on or off')."</option>\n\t"
	    . "</select></li>\n"
	    . "<li><span style='font-size:0.7em;'>$warning_force_ssl\n</span></li>\n";
	    unset($thisforce_ssl,$opt_force_ssl_on,$opt_force_ssl_off,$opt_force_ssl_neither,$warning_force_ssl,$this_opt);


        $editsurvey .= "\t</ul></div>\n";

        // presentation settings tab
        $editsurvey .= "\t<div id='presentation'><ul>\n";
        // shownoanswer
        $shownoanswer=getGlobalSetting('shownoanswer');
	    $sel_na = array( 0 => '' , 1 => '' , 2 => '');
	    $sel_na[$shownoanswer] = ' selected="selected"';
        $editsurvey .= "\t<li><label for='shownoanswer'>".$clang->gT("Show 'no answer' option for non-mandatory questions:")."</label>\n"
        . "\t\t<select id='shownoanswer' name='shownoanswer'>\n"
        . "\t\t\t<option value=\"1\"{$sel_na[1]}>".$clang->gT('Yes')."</option>\n"
        . "\t\t\t<option value=\"0\"{$sel_na[0]}>".$clang->gT('No')."</option>\n"
        . "\t\t\t<option value=\"2\"{$sel_na[2]}>".$clang->gT('Survey admin can choose')."</option>\n"
        . "\t\t</select></li>\n";

        $thisrepeatheadings=getGlobalSetting('repeatheadings');
        $editsurvey .= "\t<li><label for='repeatheadings'>".$clang->gT("Repeating headings in array questions every X subquestions:")."</label>\n"
        . "\t\t<input id='repeatheadings' name='repeatheadings' value='$thisrepeatheadings' size='4' maxlength='4' /></li>\n";


        // showXquestions
        $set_xq=getGlobalSetting('showXquestions');
	    $sel_xq = array( 'hide' => '' , 'show' => '' , 'choose' => '');
	    $sel_xq[$set_xq] = ' selected="selected"';
	    if( empty($sel_xq['hide']) && empty($sel_xq['show']) && empty($sel_xq['choose']))
	    {
	    	$sel_xq['choose'] = ' selected="selected"';
	    };
            $editsurvey .= "\t<li><label for=\"showXquestions\">".$clang->gT('Show "There are X questions in this survey"')."</label>\n"
            . "\t\t<select id=\"showXquestions\" name=\"showXquestions\">\n"
            . "\t\t\t<option value=\"show\"{$sel_xq['show']}>".$clang->gT('Yes')."</option>\n"
            . "\t\t\t<option value=\"hide\"{$sel_xq['hide']}>".$clang->gT('No')."</option>\n"
            . "\t\t\t<option value=\"choose\"{$sel_xq['choose']}>".$clang->gT('Survey admin can choose')."</option>\n"
            . "\t\t</select></li>\n";
	    unset($set_xq,$sel_xq);






	    // showgroupinfo
            $set_gri=getGlobalSetting('showgroupinfo');
	    $sel_gri = array( 'both' => '' , 'choose' =>'' , 'description' => '' , 'name' => '' , 'none' => '' );
	    $sel_gri[$set_gri] = ' selected="selected"';
	    if( empty($sel_gri['both']) && empty($sel_gri['choose']) && empty($sel_gri['description']) && empty($sel_gri['name']) && empty($sel_gri['none']))
	    {
	    	$sel_gri['choose'] = ' selected="selected"';
	    };
            $editsurvey .= "\t<li><label for=\"showgroupinfo\">".$clang->gT('Show question group name and/or description')."</label>\n"
            . "\t\t<select id=\"showgroupinfo\" name=\"showgroupinfo\">\n"
            . "\t\t\t<option value=\"both\"{$sel_gri['both']}>".$clang->gT('Show both')."</option>\n"
            . "\t\t\t<option value=\"name\"{$sel_gri['name']}>".$clang->gT('Show group name only')."</option>\n"
            . "\t\t\t<option value=\"description\"{$sel_gri['description']}>".$clang->gT('Show group description only')."</option>\n"
            . "\t\t\t<option value=\"none\"{$sel_gri['none']}>".$clang->gT('Hide both')."</option>\n"
            . "\t\t\t<option value=\"choose\"{$sel_gri['choose']}>".$clang->gT('Survey admin can choose')."</option>\n"
            . "\t\t</select></li>\n";
	    unset($set_gri,$sel_gri);

	    // showqnumcode
            $set_qnc=getGlobalSetting('showqnumcode');
	    $sel_qnc = array( 'both' => '' , 'choose' =>'' , 'number' => '' , 'code' => '' , 'none' => '' );
	    $sel_qnc[$set_qnc] = ' selected="selected"';
	    if( empty($sel_qnc['both']) && empty($sel_qnc['choose']) && empty($sel_qnc['number']) && empty($sel_qnc['code']) && empty($sel_qnc['none']))
	    {
	    	$sel_qnc['choose'] = ' selected="selected"';
	    };
            $editsurvey .= "\t<li><label for=\"showqnumcode\">".$clang->gT('Show question number and/or question code')."</label>\n"
            . "\t\t<select id=\"showqnumcode\" name=\"showqnumcode\">\n"
            . "\t\t\t<option value=\"both\"{$sel_qnc['both']}>".$clang->gT('Show both')."</option>\n"
            . "\t\t\t<option value=\"number\"{$sel_qnc['number']}>".$clang->gT('Show question number only')."</option>\n"
            . "\t\t\t<option value=\"code\"{$sel_qnc['code']}>".$clang->gT('Show question code only')."</option>\n"
            . "\t\t\t<option value=\"none\"{$sel_qnc['none']}>".$clang->gT('Hide both')."</option>\n"
            . "\t\t\t<option value=\"choose\"{$sel_qnc['choose']}>".$clang->gT('Survey admin can choose')."</option>\n"
           . "\t\t</select></li>\n";
	    unset($set_qnc,$sel_qnc);

            $editsurvey .= "\t</ul>\n";
            // End TAB page & form
            $editsurvey .= "\t</div><input type='hidden' name='action' value='globalsettingssave'/></form>\n";

            // End tabs
            $editsurvey .= "</div>\n";

            // The external button to sumbit Survey edit changes
            $editsurvey .= "\t<p><input type='button' onclick='$(\"#frmglobalsettings\").submit();' class='standardbtn' value='".$clang->gT("Save settings")."' /><br /></p>\n";
            if ($demoModeOnly==true)
            {
                $editsurvey .= '<p>'.$clang->gT("Note: Demo mode is activated. Marked (*) settings can't be changed.").'</p>\n';
            }




        }
        else
        {
            include("access_denied.php");
        }
    }
}
function refreshtemplates() {
    global $connect ;
    global $dbprefix ;

    $template_a = gettemplatelist();
	foreach ($template_a as $tp=>$fullpath) {
        // check for each folder if there is already an entry in the database
        // if not create it with current user as creator (user with rights "create user" can assign template rights)
        $query = "SELECT * FROM ".$dbprefix."templates WHERE folder LIKE '".$tp."'";
        $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); //Checked

        if ($result->RecordCount() == 0) {
            $query2 = "INSERT INTO ".$dbprefix."templates (".db_quote_id('folder').",".db_quote_id('creator').") VALUES ('".$tp."', ".$_SESSION['loginID'].')' ;
            $connect->Execute($query2) or safe_die($connect->ErrorMsg()); //Checked
        }
    }
    return true;
}
Beispiel #4
0
}
if (isset($_POST['changes'])) {
    $changedtext = $_POST['changes'];
    $changedtext = str_replace('<?', '', $changedtext);
    if (get_magic_quotes_gpc()) {
        $changedtext = stripslashes($changedtext);
    }
}
if (isset($_POST['changes_cp'])) {
    $changedtext = $_POST['changes_cp'];
    $changedtext = str_replace('<?', '', $changedtext);
    if (get_magic_quotes_gpc()) {
        $changedtext = stripslashes($changedtext);
    }
}
$templates = gettemplatelist();
// check if a template like this exists
if (!isset($templates[$templatename])) {
    $templatename = $defaulttemplate;
}
if ($subaction == "delete" && is_template_editable($templatename) == true) {
    if (rmdirr($usertemplaterootdir . "/" . $templatename) == true) {
        $templatequery = "UPDATE {$dbprefix}surveys set template='{$defaulttemplate}' where template='{$templatename}'\n";
        $connect->Execute($templatequery) or safe_die("Couldn't update surveys with default template!<br />\n{$utquery}<br />\n" . $connect->ErrorMsg());
        //Checked
        $templatequery = "UPDATE {$dbprefix}surveys set template='{$defaulttemplate}' where template='{$templatename}'\n";
        $connect->Execute($templatequery) or safe_die("Couldn't update surveys with default template!<br />\n{$utquery}<br />\n" . $connect->ErrorMsg());
        //Checked
        $templatequery = "delete from {$dbprefix}templates_rights where folder='{$templatename}'\n";
        $connect->Execute($templatequery) or safe_die("Couldn't update template_rights<br />\n{$utquery}<br />\n" . $connect->ErrorMsg());
        //Checked
Beispiel #5
0
 function scriptadvance()
 {
     $this->commonhelper->checkpermission("modify_scripts");
     $go_ErrorPassingemptydatacontactyoursupport = $this->lang->line('go_ErrorPassingemptydatacontactyoursupport');
     // check if $_POST has value
     if (!empty($_POST)) {
         global $dbprefix, $connect, $clang, $databasetype, $databasetabletype, $uploaddir, $limedb, $link;
         $rootdir = $this->config->item('lime_path') . "/limesurvey";
         require $rootdir . '/common_functions_ci.php';
         require $rootdir . '/admin/admin_functions_ci.php';
         require $rootdir . '/classes/core/sanitize.php';
         require $rootdir . '/classes/core/language.php';
         require $rootdir . '/admin/classes/core/sha256.php';
         $clang = new limesurvey_lang('en');
         require $rootdir . '/classes/core/surveytranslator_ci.php';
         include $rootdir . '/admin/activate_functions.php';
         require $rootdir . '/limesurvey_functions_ce.php';
         // get asterisk dbname
         $database = $this->go_script->asteriskDB->database;
         // vicidial_script table
         $data['fields'] = array('fullname' => 'Agent Name', 'vendor_lead_code' => 'vendor_lead_code', 'source_id' => 'source_id', 'list_id' => 'list_id', 'gmt_offset_now' => 'gmt_offset_now', 'called_since_last_reset' => 'called_since_last_reset', 'phone_code' => 'phone_code', 'phone_number' => 'phone_number', 'title' => 'title', 'first_name' => 'first_name', 'middle_initial' => 'middle_initial', 'last_name' => 'last_name', 'address1' => 'address1', 'address2' => 'address2', 'address3' => 'address3', 'city' => 'city', 'state' => 'state', 'province' => 'province', 'postal_code' => 'postal_code', 'country_code' => 'country_code', 'gender' => 'gender', 'date_of_birth' => 'date_of_birth', 'alt_phone' => 'alt_phone', 'email' => 'email', 'security_phrase' => 'security_phrase', 'comments' => 'comments', 'lead_id' => 'lead_id', 'campaign' => 'campaign', 'phone_login' => 'phone_login', 'group' => 'group', 'channel_group' => 'channel_group', 'SQLdate' => 'SQLdate', 'epoch' => 'epoch', 'uniqueid' => 'uniqueid', 'customer_zap_channel' => 'customer_zap_channel', 'server_ip' => 'server_ip', 'SIPexten' => 'SIPexten', 'session_id' => 'session_id', 'dialed_number' => 'dialed_number', 'dialed_label' => 'dialed_label', 'rank' => 'rank', 'owner' => 'owner', 'camp_script' => 'camp_script', 'in_script' => 'in_script', 'script_width' => 'script_width', 'script_height' => 'script_height', 'recording_filename' => 'recording_filename', 'recording_id' => 'recording_id', 'user_custom_one' => 'user_custom_one', 'user_custom_two' => 'user_custom_two', 'user_custom_three' => 'user_custom_three', 'user_custom_four' => 'user_custom_four', 'user_custom_five' => 'user_custom_five', 'preset_number_a' => 'preset_number_a', 'preset_number_b' => 'preset_number_b', 'preset_number_c' => 'preset_number_c', 'preset_number_d' => 'preset_number_d', 'preset_number_e' => 'preset_number_e', 'preset_number_f' => 'preset_number_f', 'preset_dtmf_a' => 'preset_dtmf_a', 'preset_dtmf_b' => 'preset_dtmf_b', 'did_id' => 'did_id', 'did_extension' => 'did_extension', 'did_pattern' => 'did_pattern', 'did_description' => 'did_description', 'closecallid' => 'closecallid', 'xfercallid' => 'xfercallid', 'agent_log_id' => 'agent_log_id', 'entry_list_id' => 'entry_list_id');
         $info = $this->commonhelper->simpleretrievedata('vicidial_scripts', "script_id,script_name,script_comments,script_text,active", null, array(array('script_id' => $_POST['script_id'])));
         $data['vicidial_script'] = $info->result();
         // get the data from limesurvey
         $this->go_script->limesurveyDB->select("surveyls_survey_id,surveyls_title,surveyls_description,ls.active,surveyls_welcometext,\n                                                   surveyls_endtext,surveyls_language,surveyls_url,surveyls_urldescription,surveyls_dateformat,\n                                                   admin,adminemail,format,showwelcome,navigationdelay,allowprev,allowjumps,nokeyboard,showprogress,\n\t                                           printanswers,publicstatistics,publicgraphs,autoredirect,showXquestions,showgroupinfo,showqnumcode,\n\t                                           ls.template,surveyls_numberformat,ls.sid,vs.script_name,vs.script_comments,vs.script_id");
         $this->go_script->limesurveyDB->from("lime_surveys_languagesettings as lsl");
         $this->go_script->limesurveyDB->join("lime_surveys as ls", "lsl.surveyls_survey_id=ls.sid", "left");
         $this->go_script->limesurveyDB->join("{$database}.go_scripts as gs", "ls.sid={$database}.gs.surveyid", "right");
         $this->go_script->limesurveyDB->join("{$database}.vicidial_scripts as vs", "gs.script_id={$database}.vs.script_id", "right");
         $this->go_script->limesurveyDB->where("gs.script_id = '" . $_POST['script_id'] . "'");
         $data['script'] = $this->go_script->limesurveyDB->get()->result();
         //get the questions
         $this->go_script->limesurveyDB->select("qid,title,question,type,mandatory,question_order,language,help,preg");
         $this->go_script->limesurveyDB->where("sid", $data['script'][0]->sid);
         $this->go_script->limesurveyDB->order_by("question_order", "asc");
         $data['questions'] = $this->go_script->limesurveyDB->get("lime_questions")->result();
         $data['script'][0]->surveyls_language = getLanguageNameFromCode($data['script'][0]->surveyls_language, false, $clang);
         foreach (getRadixPointData(-1, $clang) as $index => $val) {
             $data['radixpoint'][$index] = $val['desc'];
         }
         $templaterootDir = $rootdir . "/templates";
         $standardtemplate = $rootdir . "/templates";
         $standardtemplaterootDir = $rootdir . "/templates";
         foreach (gettemplatelist($templaterootDir, $standardtemplate, $standardtemplaterootDir) as $template => $templateval) {
             $data['template'][$template] = $template;
         }
         $data['type'] = getqtypelist($data['questions'][0]->type, 'group');
         $data['preview'] = sGetTemplateURL($data['script'][0]->template);
         $this->load->view('go_script/go_script_advance_ce', $data);
     } else {
         //die ($go_ErrorPassingemptydatacontactyoursupport);
         die("" . $this->lang->line("go_error_passing_empty_data") . "");
     }
 }
Beispiel #6
0
function globalsettingsdisplay()
{
    global $action, $connect, $js_admin_includes, $editsurvey, $subaction, $scriptname, $clang;
    global $updateversion, $updatebuild, $updateavailable, $updatelastcheck, $demoModeOnly;
    if (isset($subaction) && $subaction == "updatecheck") {
        $updateinfo = updatecheck();
    }
    if (isset($action) && $action == "globalsettings") {
        if ($_SESSION['USER_RIGHT_SUPERADMIN'] == 1) {
            $js_admin_includes[] = 'scripts/globalsettings.js';
            // header
            $editsurvey = "<div class='header'>" . $clang->gT("Global settings") . "</div>\n";
            // beginning TABs section
            $editsurvey .= "\t<div class='tab-pane' id='tab-pane-globalsettings'>\n";
            $editsurvey .= "<form id='frmglobalsettings' name='frmglobalsettings' action='{$scriptname}' method='post'>\n";
            $editsurvey .= "\t<div class='tab-page'> <h2 class='tab'>" . $clang->gT("Overview & Update") . "</h2>\n";
            $editsurvey .= checksettings();
            $thisupdatecheckperiod = getGlobalSetting('updatecheckperiod');
            $editsurvey .= "<br /></p><div class='header'>" . $clang->gT("Updates") . "</div><ul>" . "\t<li><label for='updatecheckperiod'>" . $clang->gT("Check for updates:") . "</label>\n" . "\t\t\t<select name='updatecheckperiod' id='updatecheckperiod'>\n" . "\t\t\t\t<option value='0'";
            if ($thisupdatecheckperiod == 0) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Never") . "</option>\n" . "\t\t\t\t<option value='1'";
            if ($thisupdatecheckperiod == 1) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Every day") . "</option>\n" . "\t\t\t\t<option value='7'";
            if ($thisupdatecheckperiod == 7) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Every week") . "</option>\n" . "<option value='14'";
            if ($thisupdatecheckperiod == 14) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Every 2 weeks") . "</option>\n" . "<option value='30'";
            if ($thisupdatecheckperiod == 30) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Every month") . "</option>\n" . "</select>&nbsp;<input type='button' onclick=\"window.open('{$scriptname}?action=globalsettings&amp;subaction=updatecheck', '_top')\" value='" . $clang->gT("Check now") . "' />&nbsp;<span id='lastupdatecheck'>" . sprintf($clang->gT("Last check: %s"), $updatelastcheck) . "</span></li></ul><p>\n";
            if (isset($updateavailable) && $updateavailable == 1) {
                $editsurvey .= '<span style="font-weight: bold;">' . sprintf($clang->gT('There is a LimeSurvey update available: Version %s'), $updateversion . "({$updatebuild})") . '</span><br />';
                $editsurvey .= sprintf($clang->gT('You can update %smanually%s or use the %s'), "<a href='http://docs.limesurvey.org/tiki-index.php?page=Upgrading+from+a+previous+version'>", "</a>", "<a href='{$scriptname}?action=update'>" . $clang->gT('3-Click ComfortUpdate') . '</a>') . '.<br />';
            } elseif (isset($updateinfo['errorcode'])) {
                $editsurvey .= sprintf($clang->gT('There was an error on update check (%s)'), $updateinfo['errorcode']) . '.<br />';
                $editsurvey .= "<textarea readonly='readonly' style='width:35%; height:60px; overflow: auto;'>" . strip_tags($updateinfo['errorhtml']) . '</textarea>';
            } else {
                $editsurvey .= $clang->gT('There is currently no newer LimeSurvey version available.');
            }
            $editsurvey .= "</p></div>";
            // General TAB
            $editsurvey .= "\t<div class='tab-page'> <h2 class='tab'>" . $clang->gT("General") . "</h2>\n";
            // Administrator...
            $editsurvey .= "<ul>" . "\t<li><label for='sitename'>" . $clang->gT("Site name:") . ($demoModeOnly == true ? '*' : '') . "</label>\n" . "\t\t<input type='text' size='50' id='sitename' name='sitename' value=\"" . htmlspecialchars(getGlobalSetting('sitename')) . "\" /></li>\n" . "\t<li><label for='defaultlang'>" . $clang->gT("Default site language:") . ($demoModeOnly == true ? '*' : '') . "</label>\n" . "\t\t<select name='defaultlang' id='defaultlang'>\n";
            $actuallang = getGlobalSetting('defaultlang');
            foreach (getLanguageData(true) as $langkey2 => $langname) {
                $editsurvey .= "\t\t\t<option value='" . $langkey2 . "'";
                if ($actuallang == $langkey2) {
                    $editsurvey .= " selected='selected'";
                }
                $editsurvey .= ">" . $langname['nativedescription'] . " - " . $langname['description'] . "</option>\n";
            }
            $editsurvey .= "\t\t</select></li>";
            $thisdefaulttemplate = getGlobalSetting('defaulttemplate');
            $templatenames = array_keys(gettemplatelist());
            $editsurvey .= "" . "\t<li><label for='defaulttemplate'>" . $clang->gT("Default template:") . "</label>\n" . "\t\t\t<select name='defaulttemplate' id='defaulttemplate'>\n";
            foreach ($templatenames as $templatename) {
                $editsurvey .= "\t\t\t\t<option value='{$templatename}'";
                if ($thisdefaulttemplate == $templatename) {
                    $editsurvey .= " selected='selected'";
                }
                $editsurvey .= ">{$templatename}</option>\n";
            }
            $editsurvey .= "\t\t\t</select></li>\n";
            $thisdefaulthtmleditormode = getGlobalSetting('defaulthtmleditormode');
            $editsurvey .= "" . "\t<li><label for='defaulthtmleditormode'>" . $clang->gT("Default HTML editor mode:") . ($demoModeOnly == true ? '*' : '') . "</label>\n" . "\t\t\t<select name='defaulthtmleditormode' id='defaulthtmleditormode'>\n" . "\t\t\t\t<option value='default'";
            if ($thisdefaulthtmleditormode == 'default') {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Default HTML editor mode") . "</option>\n" . "\t\t\t\t<option value='none'";
            if ($thisdefaulthtmleditormode == 'none') {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("No HTML editor") . "</option>\n" . "<option value='inline'";
            if ($thisdefaulthtmleditormode == 'inline') {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Inline HTML editor") . "</option>\n" . "<option value='popup'";
            if ($thisdefaulthtmleditormode == 'popup') {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Popup HTML editor") . "</option>\n" . "</select></li>\n";
            $dateformatdata = getDateFormatData($_SESSION['dateformat']);
            $editsurvey .= "\t<li><label for='timeadjust'>" . $clang->gT("Time difference (in hours):") . "</label>\n" . "\t\t<input type='text' size='10' id='timeadjust' name='timeadjust' value=\"" . htmlspecialchars(str_replace(array('+', ' hours'), array('', ''), getGlobalSetting('timeadjust'))) . "\" /> " . $clang->gT("Server time:") . ' ' . convertDateTimeFormat(date('Y-m-d H:i:s'), 'Y-m-d H:i:s', $dateformatdata['phpdate'] . ' H:i') . " - " . $clang->gT("Corrected time :") . ' ' . convertDateTimeFormat(date_shift(date("Y-m-d H:i:s"), 'Y-m-d H:i:s', getGlobalSetting('timeadjust')), 'Y-m-d H:i:s', $dateformatdata['phpdate'] . ' H:i') . "\r\n            </li>\n";
            $thisusepdfexport = getGlobalSetting('usepdfexport');
            $editsurvey .= "\t<li><label for='usepdfexport'>" . $clang->gT("PDF export available:") . "</label>\n" . "<select name='usepdfexport' id='usepdfexport'>\n" . "<option value='1'";
            if ($thisusepdfexport == true) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("On") . "</option>\n" . "<option value='0'";
            if ($thisusepdfexport == false) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Off") . "</option>\n" . "\t\t</select>\n\t</li>\n";
            $thisaddTitleToLinks = getGlobalSetting('addTitleToLinks');
            $editsurvey .= "\t<li><label for='addTitleToLinks'>" . $clang->gT("Screen reader compatibility mode:") . "</label>\n" . "<select name='addTitleToLinks' id='addTitleToLinks'>\n" . "<option value='1'";
            if ($thisaddTitleToLinks == true) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("On") . "</option>\n" . "<option value='0'";
            if ($thisaddTitleToLinks == false) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Off") . "</option>\n" . "</select>\n</li>\n" . "<li><label for='sessionlifetime'>" . $clang->gT("Session lifetime (seconds):") . "</label>\n" . "<input type='text' size='10' id='sessionlifetime' name='sessionlifetime' value=\"" . htmlspecialchars(getGlobalSetting('sessionlifetime')) . "\" /></li>";
            // End General TAB
            $editsurvey .= "\t</ul></div>\n";
            // Email TAB
            $editsurvey .= "\t<div class='tab-page'> <h2 class='tab'>" . $clang->gT("Email settings") . "</h2><ul>\n";
            //Format
            $editsurvey .= "\t<li><label for='siteadminemail'>" . $clang->gT("Default site admin email:") . "</label>\n" . "\t\t<input type='text' size='50' id='siteadminemail' name='siteadminemail' value=\"" . htmlspecialchars(getGlobalSetting('siteadminemail')) . "\" /></li>\n" . "\t<li><label for='siteadminbounce'>" . $clang->gT("Default site bounce email:") . "</label>\n" . "\t\t<input type='text' size='50' id='siteadminbounce' name='siteadminbounce' value=\"" . htmlspecialchars(getGlobalSetting('siteadminbounce')) . "\" /></li>\n" . "\t<li><label for='siteadminname'>" . $clang->gT("Administrator name:") . "</label>\n" . "\t\t<input type='text' size='50' id='siteadminname' name='siteadminname' value=\"" . htmlspecialchars(getGlobalSetting('siteadminname')) . "\" /><br /><br /></li>\n" . "\t<li><label for='emailmethod'>" . $clang->gT("Email method:") . "</label>\n" . "\t\t<select id='emailmethod' name='emailmethod'>\n" . "\t\t\t<option value='mail'";
            if (getGlobalSetting('emailmethod') == 'mail') {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("PHP (default)") . "</option>\n" . "\t\t\t<option value='smtp'";
            if (getGlobalSetting('emailmethod') == 'smtp') {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("SMTP") . "</option>\n" . "\t\t\t<option value='sendmail'";
            if (getGlobalSetting('emailmethod') == 'sendmail') {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Sendmail") . "</option>\n" . "\t\t\t<option value='qmail'";
            if (getGlobalSetting('emailmethod') == 'qmail') {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Qmail") . "</option>\n" . "\t\t</select></li>\n" . "\t<li><label for='emailsmtphost'>" . $clang->gT("SMTP host:") . "</label>\n" . "\t\t<input type='text' size='50' id='emailsmtphost' name='emailsmtphost' value=\"" . htmlspecialchars(getGlobalSetting('emailsmtphost')) . "\" />&nbsp;<font size='1'>" . $clang->gT("Enter your hostname and port, e.g.: my.smtp.com:25") . "</font></li>\n" . "\t<li><label for='emailsmtpuser'>" . $clang->gT("SMTP username:"******"</label>\n" . "\t\t<input type='text' size='50' id='emailsmtpuser' name='emailsmtpuser' value=\"" . htmlspecialchars(getGlobalSetting('emailsmtpuser')) . "\" /></li>\n" . "\t<li><label for='emailsmtppassword'>" . $clang->gT("SMTP password:"******"</label>\n" . "\t\t<input type='password' size='50' id='emailsmtppassword' name='emailsmtppassword' value='somepassword' /></li>\n" . "\t<li><label for='emailsmtpssl'>" . $clang->gT("SMTP SSL/TLS:") . "</label>\n" . "\t\t<select id='emailsmtpssl' name='emailsmtpssl'>\n" . "\t\t\t<option value=''";
            if (getGlobalSetting('emailsmtpssl') == '') {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Off") . "</option>\n" . "\t\t\t<option value='ssl'";
            if (getGlobalSetting('emailsmtpssl') == 'ssl' || getGlobalSetting('emailsmtpssl') == 1) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("SSL") . "</option>\n" . "\t\t\t<option value='tls'";
            if (getGlobalSetting('emailsmtpssl') == 'tls') {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("TLS") . "</option>\n" . "\t\t</select></li>\n" . "\t<li><label for='emailsmtpdebug'>" . $clang->gT("SMTP debug mode:") . "</label>\n" . "\t\t<select id='emailsmtpdebug' name='emailsmtpdebug'>\n" . "\t\t\t<option value=''";
            if (getGlobalSetting('emailsmtpdebug') == '0') {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Off") . "</option>\n" . "\t\t\t<option value='1'";
            if (getGlobalSetting('emailsmtpdebug') == '1' || getGlobalSetting('emailsmtpssl') == 1) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("On errors") . "</option>\n" . "\t\t\t<option value='2'";
            if (getGlobalSetting('emailsmtpdebug') == '2' || getGlobalSetting('emailsmtpssl') == 1) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Always") . "</option>\n" . "\t\t</select><br />&nbsp;</li>\n" . "\t<li><label for='maxemails'>" . $clang->gT("Email batch size:") . "</label>\n" . "\t\t<input type='text' size='5' id='maxemails' name='maxemails' value=\"" . htmlspecialchars(getGlobalSetting('maxemails')) . "\" /></li>\n" . "\t</ul>\n";
            // End Email TAB
            $editsurvey .= "\t</div>\n";
            // Security Settings
            $editsurvey .= "\t<div class='tab-page'> <h2 class='tab'>" . $clang->gT("Security") . "</h2><ul>\n";
            // Expiration
            $thissurveyPreview_require_Auth = getGlobalSetting('surveyPreview_require_Auth');
            $editsurvey .= "\t<li><label for='surveyPreview_require_Auth'>" . $clang->gT("Survey preview only for administration users") . "</label>\n" . "\t\t<select id='surveyPreview_require_Auth' name='surveyPreview_require_Auth'>\n" . "\t\t\t<option value='1'";
            if ($thissurveyPreview_require_Auth == true) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Yes") . "</option>\n" . "\t\t\t<option value='0'";
            if ($thissurveyPreview_require_Auth == false) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("No") . "</option>\n" . "\t\t</select></li>\n";
            // Auto registration
            $thisfilterxsshtml = getGlobalSetting('filterxsshtml');
            $editsurvey .= "\t<li><label for='filterxsshtml'>" . $clang->gT("Filter HTML for XSS:") . ($demoModeOnly == true ? '*' : '') . "</label>\n" . "\t\t<select id='filterxsshtml' name='filterxsshtml'>\n" . "\t\t\t<option value='1'";
            if ($thisfilterxsshtml == true) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Yes") . "</option>\n" . "\t\t\t<option value='0'";
            if ($thisfilterxsshtml == false) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("No") . "</option>\n" . "\t\t</select></li>\n";
            $thisusercontrolSameGroupPolicy = getGlobalSetting('usercontrolSameGroupPolicy');
            $editsurvey .= "\t<li><label for='usercontrolSameGroupPolicy'>" . $clang->gT("Group member can only see own group:") . "</label>\n" . "\t\t<select id='usercontrolSameGroupPolicy' name='usercontrolSameGroupPolicy'>\n" . "\t\t\t<option value='1'";
            if ($thisusercontrolSameGroupPolicy == true) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Yes") . "</option>\n" . "\t\t\t<option value='0'";
            if ($thisusercontrolSameGroupPolicy == false) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("No") . "</option>\n" . "\t\t</select></li>\n";
            $editsurvey .= "\t</ul></div>\n";
            // Miscellaneous Settings
            $editsurvey .= "\t<div class='tab-page'> <h2 class='tab'>" . $clang->gT("Miscellaneous") . "</h2><ul>\n";
            // shownoanswer
            $shownoanswer = getGlobalSetting('shownoanswer');
            $editsurvey .= "\t<li><label for='shownoanswer'>" . $clang->gT("Show 'no answer' option for non-mandatory questions:") . "</label>\n" . "\t\t<select id='shownoanswer' name='shownoanswer'>\n" . "\t\t\t<option value='1'";
            if ($shownoanswer == 1) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("Yes") . "</option>\n" . "\t\t\t<option value='0'";
            if ($shownoanswer == 0) {
                $editsurvey .= " selected='selected'";
            }
            $editsurvey .= ">" . $clang->gT("No") . "</option>\n" . "\t\t</select></li>\n";
            $thisrepeatheadings = getGlobalSetting('repeatheadings');
            $editsurvey .= "\t<li><label for='repeatheadings'>" . $clang->gT("Number of answers to show before repeating the headings in array questions:") . "</label>\n" . "\t\t<input id='repeatheadings' name='repeatheadings' value='{$thisrepeatheadings}' size='4' maxlength='4' /></li>\n";
            $editsurvey .= "\t</ul>\n";
            // End TAB page & form
            $editsurvey .= "\t</div><input type='hidden' name='action' value='globalsettingssave'/></form>\n";
            // End tabs
            $editsurvey .= "</div>\n";
            // The external button to sumbit Survey edit changes
            $editsurvey .= "\t<p><input type='button' onclick='\$(\"#frmglobalsettings\").submit();' class='standardbtn' value='" . $clang->gT("Save settings") . "' /><br /></p>\n";
            if ($demoModeOnly == true) {
                $editsurvey .= '<p>' . $clang->gT("Note: Demo mode is activated. Marked (*) settings can't be changed.") . '</p>\\n';
            }
        } else {
            include "access_denied.php";
        }
    }
}