Пример #1
0
/**
 * showadminmenu() function returns html text for the administration button bar
 *
 * @global string $homedir
 * @global string $scriptname
 * @global string $surveyid
 * @global string $setfont
 * @global string $imageurl
 * @return string $adminmenu
 */
function showadminmenu()
{
    global $homedir, $scriptname, $surveyid, $setfont, $imageurl, $clang, $debug, $action, $updateavailable, $updatebuild, $updateversion, $updatelastcheck, $databasetype;
    $adminmenu = "<div class='menubar'>\n";
    if ($_SESSION['pw_notify'] && $debug < 2) {
        $_SESSION['flashmessage'] = $clang->gT("Warning: You are still using the default password ('password'). Please change your password and re-login again.");
    }
    $adminmenu .= "<div class='menubar-title ui-widget-header'>\n" . "<div class='menubar-title-left'>\n" . "<strong>" . $clang->gT("Administration") . "</strong>";
    if (isset($_SESSION['loginID'])) {
        $adminmenu .= " --  " . $clang->gT("Logged in as:") . " <strong>" . "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=personalsettings', '_top')\" title=\"" . $clang->gTview("Edit your personal preferences") . "\" >" . $_SESSION['user'] . " <img src='{$imageurl}/profile_edit.png' name='ProfileEdit' alt='" . $clang->gT("Edit your personal preferences") . "' /></a>" . "</strong>\n";
    }
    $adminmenu .= "</div>\n";
    if ($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 && isset($updatelastcheck) && $updatelastcheck > 0 && isset($updateavailable) && $updateavailable == 1) {
        $adminmenu .= "<div class='menubar-title-right'><a href='{$scriptname}?action=globalsettings'>" . sprintf($clang->gT('Update available: %s'), $updateversion . "({$updatebuild})") . '</a></div>';
    }
    $adminmenu .= "</div>\n" . "<div class='menubar-main'>\n" . "<div class='menubar-left'>\n" . "<a href=\"#\" onclick=\"window.open('{$scriptname}', '_top')\" title=\"" . $clang->gTview("Default Administration Page") . "\">" . "<img src='{$imageurl}/home.png' name='HomeButton' alt='" . $clang->gT("Default Administration Page") . "' /></a>\n";
    $adminmenu .= "<img src='{$imageurl}/blank.gif' alt='' width='11' />\n" . "<img src='{$imageurl}/seperator.gif' alt='' />\n";
    // Edit users
    $adminmenu .= "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=editusers', '_top')\" title=\"" . $clang->gTview("Create/Edit Users") . "\" >" . "<img src='{$imageurl}/security.png' name='AdminSecurity' alt='" . $clang->gT("Create/Edit Users") . "' /></a>";
    $adminmenu .= "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=editusergroups', '_top')\" title=\"" . $clang->gTview("Create/Edit Groups") . "\" >" . "<img src='{$imageurl}/usergroup.png' alt='" . $clang->gT("Create/Edit Groups") . "' /></a>\n";
    if ($_SESSION['USER_RIGHT_SUPERADMIN'] == 1) {
        $adminmenu .= "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=globalsettings', '_top')\" title=\"" . $clang->gTview("Global settings") . "\" >" . "<img src='{$imageurl}/global.png' name='GlobalSettings' alt='" . $clang->gT("Global settings") . "' /></a>" . "<img src='{$imageurl}/seperator.gif' alt='' border='0' hspace='0' />\n";
    }
    // Check data integrity
    if ($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1) {
        $adminmenu .= "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=checkintegrity', '_top')\" title=\"" . $clang->gTview("Check Data Integrity") . "\">" . "<img src='{$imageurl}/checkdb.png' name='CheckDataIntegrity' width='40' height='40' alt='" . $clang->gT("Check Data Integrity") . "' /></a>\n";
    }
    // list surveys
    $adminmenu .= "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=listsurveys', '_top')\" title=\"" . $clang->gTview("List Surveys") . "\" >\n" . "<img src='{$imageurl}/surveylist.png' name='ListSurveys' alt='" . $clang->gT("List Surveys") . "' />" . "</a>";
    // db backup & label editor
    if ($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1) {
        if ($databasetype == 'mysql' || $databasetype == 'mysqli') {
            $adminmenu .= "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=dumpdb', '_top')\" title=\"" . $clang->gTview("Backup Entire Database") . "\">\n" . "<img src='{$imageurl}/backup.png' name='ExportDB' alt='" . $clang->gT("Backup Entire Database") . "' />" . "</a>\n";
        } else {
            $adminmenu .= "<img src='{$imageurl}/backup_disabled.png' name='ExportDB' alt='" . $clang->gT("The database export is only available for MySQL databases. For other database types please use the according backup mechanism to create a database dump.") . "' />";
        }
        $adminmenu .= "<img src='{$imageurl}/seperator.gif' alt=''  border='0' hspace='0' />\n";
    }
    if ($_SESSION['USER_RIGHT_MANAGE_LABEL'] == 1) {
        $adminmenu .= "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=labels', '_top')\" title=\"" . $clang->gTview("Edit label sets") . "\">\n" . "<img src='{$imageurl}/labels.png'  name='LabelsEditor' alt='" . $clang->gT("Edit label sets") . "' /></a>\n" . "<img src='{$imageurl}/seperator.gif' alt=''  border='0' hspace='0' />\n";
    }
    if ($_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] == 1) {
        $adminmenu .= "<a href='{$scriptname}?action=templates' title=\"" . $clang->gTview("Template Editor") . "\" >" . "<img src='{$imageurl}/templates.png' name='EditTemplates' title='' alt='" . $clang->gT("Template Editor") . "' /></a>\n";
    }
    // survey select box
    $adminmenu .= "</div><div class='menubar-right'><span class=\"boxcaption\">" . $clang->gT("Surveys") . ":</span>" . "<select onchange=\"window.open(this.options[this.selectedIndex].value,'_top')\">\n" . getsurveylist() . "</select>\n";
    if ($_SESSION['USER_RIGHT_CREATE_SURVEY'] == 1) {
        $adminmenu .= "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=newsurvey', '_top')\"" . "title=\"" . $clang->gTview("Create, import, or copy a survey") . "\" >" . "<img src='{$imageurl}/add.png' name='AddSurvey' title='' alt='" . $clang->gT("Create, import, or copy a survey") . "' /></a>\n";
    }
    if (isset($_SESSION['loginID'])) {
        // Logout
        $adminmenu .= "<img src='{$imageurl}/seperator.gif' alt='' border='0' hspace='0' />" . "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=logout', '_top')\" title=\"" . $clang->gTview("Logout") . "\" >" . "<img src='{$imageurl}/logout.png' name='Logout' alt='" . $clang->gT("Logout") . "'/></a>";
        //Show help
        $adminmenu .= "<a href=\"http://docs.limesurvey.org\" target='_blank' title=\"" . $clang->gTview("LimeSurvey online manual") . "\" >" . "<img src='{$imageurl}/showhelp.png' name='ShowHelp' alt='" . $clang->gT("LimeSurvey online manual") . "'/></a>";
        $adminmenu .= "</div>" . "</div>\n" . "</div>\n";
        //  $adminmenu .= "<p style='margin:0;font-size:1px;line-height:1px;height:1px;'>&nbsp;</p>"; //CSS Firefox 2 transition fix
        if (!isset($action) && !isset($surveyid) && count(getsurveylist(true)) == 0) {
            $adminmenu .= '<div style="width:500px;margin:0 auto;">' . '<h2>' . sprintf($clang->gT("Welcome to %s!"), 'LimeSurvey') . '</h2>' . '<p>' . $clang->gT("Some piece-of-cake steps to create your very own first survey:") . '<br/>' . '<ol>' . '<li>' . sprintf($clang->gT('Create a new survey clicking on the %s icon in the upper right.'), "<img src='{$imageurl}/add_20.png' name='ShowHelp' title='' alt='" . $clang->gT("Add survey") . "'/>") . '</li>' . '<li>' . $clang->gT('Create a new question group inside your survey.') . '</li>' . '<li>' . $clang->gT('Create one or more questions inside the new question group.') . '</li>' . '<li>' . sprintf($clang->gT('Done. Test your survey using the %s icon.'), "<img src='{$imageurl}/do_20.png' name='ShowHelp' title='' alt='" . $clang->gT("Test survey") . "'/>") . '</li>' . '</ol></p><br />&nbsp;</div>';
        }
    }
    return $adminmenu;
}
Пример #2
0
        $is_html_email = false;
        if (isset($_POST['htmlemail']) && $_POST['htmlemail'] == "Y") {
            $is_html_email = true;
            $aDefaultTexts['admin_detailed_notification'] = $aDefaultTexts['admin_detailed_notification_css'] . conditional_nl2br($aDefaultTexts['admin_detailed_notification'], $is_html_email, 'unescaped');
        }
        $insertarray = array('surveyls_survey_id' => $surveyid, 'surveyls_language' => $_POST['language'], 'surveyls_title' => $_POST['surveyls_title'], 'surveyls_description' => $_POST['description'], 'surveyls_welcometext' => $_POST['welcome'], 'surveyls_urldescription' => $_POST['urldescrip'], 'surveyls_endtext' => $_POST['endtext'], 'surveyls_url' => $_POST['url'], 'surveyls_email_invite_subj' => $aDefaultTexts['invitation_subject'], 'surveyls_email_invite' => conditional_nl2br($aDefaultTexts['invitation'], $is_html_email, 'unescaped'), 'surveyls_email_remind_subj' => $aDefaultTexts['reminder_subject'], 'surveyls_email_remind' => conditional_nl2br($aDefaultTexts['reminder'], $is_html_email, 'unescaped'), 'surveyls_email_confirm_subj' => $aDefaultTexts['confirmation_subject'], 'surveyls_email_confirm' => conditional_nl2br($aDefaultTexts['confirmation'], $is_html_email, 'unescaped'), 'surveyls_email_register_subj' => $aDefaultTexts['registration_subject'], 'surveyls_email_register' => conditional_nl2br($aDefaultTexts['registration'], $is_html_email, 'unescaped'), 'email_admin_notification_subj' => $aDefaultTexts['admin_notification_subject'], 'email_admin_notification' => conditional_nl2br($aDefaultTexts['admin_notification'], $is_html_email, 'unescaped'), 'email_admin_responses_subj' => $aDefaultTexts['admin_detailed_notification_subject'], 'email_admin_responses' => $aDefaultTexts['admin_detailed_notification'], 'surveyls_dateformat' => $_POST['dateformat'], 'surveyls_numberformat' => $numberformatid);
        $dbtablename = db_table_name_nq('surveys_languagesettings');
        $isquery = $connect->GetInsertSQL($dbtablename, $insertarray);
        $isresult = $connect->Execute($isquery) or safe_die($isquery . "<br />" . $connect->ErrorMsg());
        // Checked
        unset($bplang);
        $_SESSION['flashmessage'] = $clang->gT("Survey was successfully added.");
        // Update survey permissions
        GiveAllSurveyPermissions($_SESSION['loginID'], $surveyid);
        LimeExpressionManager::SetSurveyId($surveyid);
        $surveyselect = getsurveylist();
        // Create initial Survey table
        //include("surveytable_functions.php");
        //$creationResult = surveyCreateTable($surveyid);
        // Survey table could not be created
        //if ($creationResult !== true)
        //{
        //    safe_die ("Initial survey table could not be created, please report this as a bug."."<br />".$creationResult);
        //}
    }
} elseif ($action == "savepersonalsettings") {
    $_POST = array_map('db_quote', $_POST);
    $uquery = "UPDATE {$dbprefix}users SET lang='{$_POST['lang']}', dateformat='{$_POST['dateformat']}', htmleditormode= '{$_POST['htmleditormode']}', questionselectormode= '{$_POST['questionselectormode']}', templateeditormode= '{$_POST['templateeditormode']}'\n               WHERE uid={$_SESSION['loginID']}";
    $uresult = $connect->Execute($uquery) or safe_die($uquery . "<br />" . $connect->ErrorMsg());
    // Checked
    $_SESSION['adminlang'] = $_POST['lang'];
Пример #3
0
     $editsurvey .= "<input type='hidden' id='surveysettingsaction' name='action' value='insertsurvey' />\n";
 } elseif ($action == "editsurveysettings") {
     $editsurvey .= "<input type='hidden' id='surveysettingsaction' name='action' value='updatesurveysettings' />\n" . "<input type='hidden' name='sid' value=\"{$esrow['sid']}\" />\n" . "<input type='hidden' name='languageids' id='languageids' value=\"{$esrow['additional_languages']}\" />\n" . "<input type='hidden' name='language' value=\"{$esrow['language']}\" />\n";
 }
 $editsurvey .= "</form>";
 if ($action == "newsurvey") {
     // Import TAB
     $editsurvey .= "<div id='import'>\n";
     // Import survey
     $editsurvey .= "<form enctype='multipart/form-data' class='form30' id='importsurvey' name='importsurvey' action='{$scriptname}' method='post' onsubmit='return validatefilename(this,\"" . $clang->gT('Please select a file to import!', 'js') . "\");'>\n" . "<ul>\n" . "<li><label for='the_file'>" . $clang->gT("Select survey structure file (*.lss, *.csv):") . "</label>\n" . "<input id='the_file' name=\"the_file\" type=\"file\" size=\"50\" /></li>\n" . "<li><label for='translinksfields'>" . $clang->gT("Convert resource links and INSERTANS fields?") . "</label>\n" . "<input id='translinksfields' name=\"translinksfields\" type=\"checkbox\" checked='checked'/></li></ul>\n" . "<p><input type='submit' value='" . $clang->gT("Import survey") . "' />\n" . "<input type='hidden' name='action' value='importsurvey' /></p></form>\n";
     // End Import TAB
     $editsurvey .= "</div>\n";
     // Copy survey TAB
     $editsurvey .= "<div id='copy'>\n";
     // Copy survey
     $editsurvey .= "<form class='form30' action='{$scriptname}' id='copysurveyform' method='post' onsubmit=\"return (isEmpty(document.getElementById('copysurveylist'), '" . $clang->gT("Error: You have to select an existing survey.", 'js') . "') || isEmpty(document.getElementById('copysurveyname'), '" . $clang->gT("Error: You enter a name for the survey copy.", 'js') . "'));\">\n" . "<ul>\n" . "<li><label for='copysurveylist'><span class='annotationasterisk'>*</span>" . $clang->gT("Select survey to copy:") . "</label>\n" . "<select id='copysurveylist' name='copysurveylist'>\n" . getsurveylist(false, true) . "</select> <span class='annotation'>" . $clang->gT("*Required") . "</span></li>\n" . "<li><label for='copysurveyname'><span class='annotationasterisk'>*</span>" . $clang->gT("New survey title:") . "</label>\n" . "<input type='text' id='copysurveyname' size='82' maxlength='200' name='copysurveyname' value='' />" . "<span class='annotation'>" . $clang->gT("*Required") . "</span></li>\n" . "<li><label for='copysurveytranslinksfields'>" . $clang->gT("Convert resource links and INSERTANS fields?") . "</label>\n" . "<input id='copysurveytranslinksfields' name=\"copysurveytranslinksfields\" type=\"checkbox\" checked='checked'/></li>\n" . "<li><label for='copysurveyexcludequotas'>" . $clang->gT("Exclude quotas?") . "</label>\n" . "<input id='copysurveyexcludequotas' name=\"copysurveyexcludequotas\" type=\"checkbox\" /></li>\n" . "<li><label for='copysurveyexcludeanswers'>" . $clang->gT("Exclude answers?") . "</label>\n" . "<input id='copysurveyexcludeanswers' name=\"copysurveyexcludeanswers\" type=\"checkbox\" /></li>\n" . "<li><label for='copysurveyresetconditions'>" . $clang->gT("Reset conditions?") . "</label>\n" . "<input id='copysurveyresetconditions' name=\"copysurveyresetconditions\" type=\"checkbox\" /></li></ul>\n" . "<p><input type='submit' value='" . $clang->gT("Copy survey") . "' />\n" . "<input type='hidden' name='action' value='copysurvey' /></p></form>\n";
     // End Copy survey TAB
     $editsurvey .= "</div>\n";
 } elseif ($action = "editsurveysettings") {
     // TAB Uploaded Resources Management
     $ZIPimportAction = " onclick='if (validatefilename(this.form,\"" . $clang->gT('Please select a file to import!', 'js') . "\")) {this.form.submit();}'";
     if (!function_exists("zip_open")) {
         $ZIPimportAction = " onclick='alert(\"" . $clang->gT("zip library not supported by PHP, Import ZIP Disabled", "js") . "\");'";
     }
     $disabledIfNoResources = '';
     if (hasResources($surveyid, 'survey') === false) {
         $disabledIfNoResources = " disabled='disabled'";
     }
     $editsurvey .= "<div id='resources'>\n" . "<form enctype='multipart/form-data'  class='form30' id='importsurveyresources' name='importsurveyresources' action='{$scriptname}' method='post' onsubmit='return validatefilename(this,\"" . $clang->gT('Please select a file to import!', 'js') . "\");'>\n" . "<input type='hidden' name='sid' value='{$surveyid}' />\n" . "<input type='hidden' name='action' value='importsurveyresources' />\n" . "<ul>\n" . "<li><label>&nbsp;</label>\n" . "<input type='button' onclick='window.open(\"{$homeurl}/scripts/kcfinder/browse.php\", \"_blank\")' value=\"" . $clang->gT("Browse Uploaded Resources") . "\" {$disabledIfNoResources} /></li>\n" . "<li><label>&nbsp;</label>\n" . "<input type='button' onclick='window.open(\"{$scriptname}?action=exportsurvresources&amp;sid={$surveyid}\", \"_blank\")' value=\"" . $clang->gT("Export Resources As ZIP Archive") . "\" {$disabledIfNoResources} /></li>\n" . "<li><label for='the_file'>" . $clang->gT("Select ZIP File:") . "</label>\n" . "<input id='the_file' name='the_file' type='file' size='50' /></li>\n" . "<li><label>&nbsp;</label>\n" . "<input type='button' value='" . $clang->gT("Import Resources ZIP Archive") . "' {$ZIPimportAction} /></li>\n" . "</ul></form>\n";
     // End TAB Uploaded Resources Management
     $editsurvey .= "</div>\n";