当前位置: 首页>>代码示例>>PHP>>正文


PHP sanitize_languagecodeS函数代码示例

本文整理汇总了PHP中sanitize_languagecodeS函数的典型用法代码示例。如果您正苦于以下问题:PHP sanitize_languagecodeS函数的具体用法?PHP sanitize_languagecodeS怎么用?PHP sanitize_languagecodeS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sanitize_languagecodeS函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: insertlabelset

function insertlabelset()
{
    $postlabel_name = flattenText(Yii::app()->getRequest()->getPost('label_name'), false, true, 'UTF-8', true);
    $data = array('label_name' => $postlabel_name, 'languages' => sanitize_languagecodeS(implode(' ', Yii::app()->getRequest()->getPost('languageids', array('en')))));
    $result = LabelSet::model()->insertRecords($data);
    if (!$result) {
        Yii::app()->session['flashmessage'] = gT("Inserting the label set failed.");
    } else {
        return $result;
    }
}
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:11,代码来源:label_helper.php

示例2: _saveSettings

 private function _saveSettings()
 {
     if ($_POST['action'] !== "globalsettingssave") {
         return;
     }
     if (Yii::app()->session['USER_RIGHT_CONFIGURATOR'] != 1) {
         $this->getController()->redirect($this->getController()->createUrl('/admin'));
     }
     $clang = $this->getController()->lang;
     Yii::app()->loadHelper('surveytranslator');
     $maxemails = $_POST['maxemails'];
     if (sanitize_int($_POST['maxemails']) < 1) {
         $maxemails = 1;
     }
     $defaultlang = sanitize_languagecode($_POST['defaultlang']);
     $aRestrictToLanguages = explode(' ', sanitize_languagecodeS($_POST['restrictToLanguages']));
     if (!in_array($defaultlang, $aRestrictToLanguages)) {
         // Force default language in restrictToLanguages
         $aRestrictToLanguages[] = $defaultlang;
     }
     if (count(array_diff(array_keys(getLanguageData(false, Yii::app()->session['adminlang'])), $aRestrictToLanguages)) == 0) {
         $aRestrictToLanguages = '';
     } else {
         $aRestrictToLanguages = implode(' ', $aRestrictToLanguages);
     }
     setGlobalSetting('defaultlang', $defaultlang);
     setGlobalSetting('restrictToLanguages', trim($aRestrictToLanguages));
     setGlobalSetting('sitename', strip_tags($_POST['sitename']));
     setGlobalSetting('updatecheckperiod', (int) $_POST['updatecheckperiod']);
     setGlobalSetting('defaulthtmleditormode', sanitize_paranoid_string($_POST['defaulthtmleditormode']));
     setGlobalSetting('defaultquestionselectormode', sanitize_paranoid_string($_POST['defaultquestionselectormode']));
     setGlobalSetting('defaulttemplateeditormode', sanitize_paranoid_string($_POST['defaulttemplateeditormode']));
     setGlobalSetting('defaulttemplate', sanitize_paranoid_string($_POST['defaulttemplate']));
     setGlobalSetting('admintheme', sanitize_paranoid_string($_POST['admintheme']));
     setGlobalSetting('adminthemeiconsize', trim(file_get_contents(Yii::app()->getConfig("styledir") . DIRECTORY_SEPARATOR . sanitize_paranoid_string($_POST['admintheme']) . DIRECTORY_SEPARATOR . 'iconsize')));
     setGlobalSetting('emailmethod', strip_tags($_POST['emailmethod']));
     setGlobalSetting('emailsmtphost', strip_tags(returnGlobal('emailsmtphost')));
     if (returnGlobal('emailsmtppassword') != 'somepassword') {
         setGlobalSetting('emailsmtppassword', strip_tags(returnGlobal('emailsmtppassword')));
     }
     setGlobalSetting('bounceaccounthost', strip_tags(returnGlobal('bounceaccounthost')));
     setGlobalSetting('bounceaccounttype', strip_tags(returnGlobal('bounceaccounttype')));
     setGlobalSetting('bounceencryption', strip_tags(returnGlobal('bounceencryption')));
     setGlobalSetting('bounceaccountuser', strip_tags(returnGlobal('bounceaccountuser')));
     if (returnGlobal('bounceaccountpass') != 'enteredpassword') {
         setGlobalSetting('bounceaccountpass', strip_tags(returnGlobal('bounceaccountpass')));
     }
     setGlobalSetting('emailsmtpssl', sanitize_paranoid_string(Yii::app()->request->getPost('emailsmtpssl', '')));
     setGlobalSetting('emailsmtpdebug', sanitize_int(Yii::app()->request->getPost('emailsmtpdebug', '0')));
     setGlobalSetting('emailsmtpuser', strip_tags(returnGlobal('emailsmtpuser')));
     setGlobalSetting('filterxsshtml', strip_tags($_POST['filterxsshtml']));
     setGlobalSetting('siteadminbounce', strip_tags($_POST['siteadminbounce']));
     setGlobalSetting('siteadminemail', strip_tags($_POST['siteadminemail']));
     setGlobalSetting('siteadminname', strip_tags($_POST['siteadminname']));
     setGlobalSetting('shownoanswer', sanitize_int($_POST['shownoanswer']));
     setGlobalSetting('showxquestions', $_POST['showxquestions']);
     setGlobalSetting('showgroupinfo', $_POST['showgroupinfo']);
     setGlobalSetting('showqnumcode', $_POST['showqnumcode']);
     $repeatheadingstemp = (int) $_POST['repeatheadings'];
     if ($repeatheadingstemp == 0) {
         $repeatheadingstemp = 25;
     }
     setGlobalSetting('repeatheadings', $repeatheadingstemp);
     setGlobalSetting('maxemails', sanitize_int($maxemails));
     $iSessionExpirationTime = (int) $_POST['iSessionExpirationTime'];
     if ($iSessionExpirationTime == 0) {
         $iSessionExpirationTime = 7200;
     }
     setGlobalSetting('iSessionExpirationTime', $iSessionExpirationTime);
     setGlobalSetting('ipInfoDbAPIKey', $_POST['ipInfoDbAPIKey']);
     setGlobalSetting('googleMapsAPIKey', $_POST['googleMapsAPIKey']);
     setGlobalSetting('googleanalyticsapikey', $_POST['googleanalyticsapikey']);
     setGlobalSetting('googletranslateapikey', $_POST['googletranslateapikey']);
     setGlobalSetting('force_ssl', $_POST['force_ssl']);
     setGlobalSetting('surveyPreview_require_Auth', $_POST['surveyPreview_require_Auth']);
     setGlobalSetting('RPCInterface', $_POST['RPCInterface']);
     $savetime = (double) $_POST['timeadjust'] * 60 . ' minutes';
     //makes sure it is a number, at least 0
     if (substr($savetime, 0, 1) != '-' && substr($savetime, 0, 1) != '+') {
         $savetime = '+' . $savetime;
     }
     setGlobalSetting('timeadjust', $savetime);
     setGlobalSetting('usercontrolSameGroupPolicy', strip_tags($_POST['usercontrolSameGroupPolicy']));
     Yii::app()->session['flashmessage'] = $clang->gT("Global settings were saved.");
     $url = htmlspecialchars_decode(Yii::app()->session['refurl']);
     if ($url) {
         Yii::app()->getController()->redirect($url);
     }
 }
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:89,代码来源:globalsettings.php

示例3: getLabelSets

/**
* Returns labelsets for given language(s), or for all if null
*
* @param string $languages
* @return array
*/
function getLabelSets($languages = null)
{
    $languagesarray = array();
    if ($languages) {
        $languages = sanitize_languagecodeS($languages);
        $languagesarray = explode(' ', trim($languages));
    }
    $criteria = new CDbCriteria();
    $criteria->order = "label_name";
    foreach ($languagesarray as $k => $item) {
        $criteria->params[':lang_like1_' . $k] = "% {$item} %";
        $criteria->params[':lang_' . $k] = $item;
        $criteria->params[':lang_like2_' . $k] = "% {$item}";
        $criteria->params[':lang_like3_' . $k] = "{$item} %";
        $criteria->addCondition("\n        ((languages like :lang_like1_{$k}) or\n        (languages = :lang_{$k}) or\n        (languages like :lang_like2_{$k}) or\n        (languages like :lang_like3_{$k}))");
    }
    $result = LabelSet::model()->findAll($criteria);
    $labelsets = array();
    foreach ($result as $row) {
        $labelsets[] = array($row->lid, $row->label_name);
    }
    return $labelsets;
}
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:29,代码来源:common_helper.php

示例4: insertlabelset

function insertlabelset()
{
    global $dbprefix, $connect, $clang, $labelsoutput;
    //	$labelsoutput.= $_POST['languageids'];  For debug purposes

    if (isset($_POST['languageids']))
    {
        $postlanguageids=sanitize_languagecodeS($_POST['languageids']);
    }

    if (isset($_POST['label_name']))
    {
        $postlabel_name=sanitize_labelname($_POST['label_name']);
    }

    $postlabel_name = db_quoteall($postlabel_name,true);
    $postlanguageids = db_quoteall($postlanguageids,true);

    $query = "INSERT INTO ".db_table_name('labelsets')." (label_name,languages) VALUES ({$postlabel_name},{$postlanguageids})";
    if (!$result = $connect->Execute($query))
    {
        safe_die("Inserting the label set failed:<br />".$query."<br />".$connect->ErrorMsg());
    }
    else
    {
        return $connect->Insert_ID(db_table_name_nq('labelsets'),"lid");
    }

}
开发者ID:nmklong,项目名称:limesurvey-cdio3,代码行数:29,代码来源:labels.php

示例5: _saveSettings

 private function _saveSettings()
 {
     if ($_POST['action'] !== "globalsettingssave") {
         return;
     }
     if (!Permission::model()->hasGlobalPermission('settings', 'update')) {
         $this->getController()->redirect(array('/admin'));
     }
     Yii::app()->loadHelper('surveytranslator');
     $iPDFFontSize = sanitize_int($_POST['pdffontsize']);
     if ($iPDFFontSize < 1) {
         $iPDFFontSize = 9;
     }
     $iPDFLogoWidth = sanitize_int($_POST['pdflogowidth']);
     if ($iPDFLogoWidth < 1) {
         $iPDFLogoWidth = 50;
     }
     $maxemails = $_POST['maxemails'];
     if (sanitize_int($_POST['maxemails']) < 1) {
         $maxemails = 1;
     }
     $defaultlang = sanitize_languagecode($_POST['defaultlang']);
     $aRestrictToLanguages = explode(' ', sanitize_languagecodeS($_POST['restrictToLanguages']));
     if (!in_array($defaultlang, $aRestrictToLanguages)) {
         // Force default language in restrictToLanguages
         $aRestrictToLanguages[] = $defaultlang;
     }
     if (count(array_diff(array_keys(getLanguageData(false, Yii::app()->session['adminlang'])), $aRestrictToLanguages)) == 0) {
         $aRestrictToLanguages = '';
     } else {
         $aRestrictToLanguages = implode(' ', $aRestrictToLanguages);
     }
     setGlobalSetting('defaultlang', $defaultlang);
     setGlobalSetting('restrictToLanguages', trim($aRestrictToLanguages));
     setGlobalSetting('sitename', strip_tags($_POST['sitename']));
     setGlobalSetting('defaulthtmleditormode', sanitize_paranoid_string($_POST['defaulthtmleditormode']));
     setGlobalSetting('defaultquestionselectormode', sanitize_paranoid_string($_POST['defaultquestionselectormode']));
     setGlobalSetting('defaulttemplateeditormode', sanitize_paranoid_string($_POST['defaulttemplateeditormode']));
     if (!Yii::app()->getConfig('demoMode')) {
         $sTemplate = Yii::app()->getRequest()->getPost("defaulttemplate");
         if (array_key_exists($sTemplate, getTemplateList())) {
             setGlobalSetting('defaulttemplate', $sTemplate);
         }
     }
     setGlobalSetting('admintheme', sanitize_paranoid_string($_POST['admintheme']));
     setGlobalSetting('adminthemeiconsize', trim(file_get_contents(Yii::app()->getConfig("styledir") . DIRECTORY_SEPARATOR . sanitize_paranoid_string($_POST['admintheme']) . DIRECTORY_SEPARATOR . 'iconsize')));
     setGlobalSetting('emailmethod', strip_tags($_POST['emailmethod']));
     setGlobalSetting('emailsmtphost', strip_tags(returnGlobal('emailsmtphost')));
     if (returnGlobal('emailsmtppassword') != 'somepassword') {
         setGlobalSetting('emailsmtppassword', strip_tags(returnGlobal('emailsmtppassword')));
     }
     setGlobalSetting('bounceaccounthost', strip_tags(returnGlobal('bounceaccounthost')));
     setGlobalSetting('bounceaccounttype', strip_tags(returnGlobal('bounceaccounttype')));
     setGlobalSetting('bounceencryption', strip_tags(returnGlobal('bounceencryption')));
     setGlobalSetting('bounceaccountuser', strip_tags(returnGlobal('bounceaccountuser')));
     if (returnGlobal('bounceaccountpass') != 'enteredpassword') {
         setGlobalSetting('bounceaccountpass', strip_tags(returnGlobal('bounceaccountpass')));
     }
     setGlobalSetting('emailsmtpssl', sanitize_paranoid_string(Yii::app()->request->getPost('emailsmtpssl', '')));
     setGlobalSetting('emailsmtpdebug', sanitize_int(Yii::app()->request->getPost('emailsmtpdebug', '0')));
     setGlobalSetting('emailsmtpuser', strip_tags(returnGlobal('emailsmtpuser')));
     setGlobalSetting('filterxsshtml', strip_tags($_POST['filterxsshtml']));
     $warning = '';
     // make sure emails are valid before saving them
     if (Yii::app()->request->getPost('siteadminbounce', '') == '' || validateEmailAddress(Yii::app()->request->getPost('siteadminbounce'))) {
         setGlobalSetting('siteadminbounce', strip_tags(Yii::app()->request->getPost('siteadminbounce')));
     } else {
         $warning .= gT("Warning! Admin bounce email was not saved because it was not valid.") . '<br/>';
     }
     if (Yii::app()->request->getPost('siteadminemail', '') == '' || validateEmailAddress(Yii::app()->request->getPost('siteadminemail'))) {
         setGlobalSetting('siteadminemail', strip_tags(Yii::app()->request->getPost('siteadminemail')));
     } else {
         $warning .= gT("Warning! Admin email was not saved because it was not valid.") . '<br/>';
     }
     setGlobalSetting('siteadminname', strip_tags($_POST['siteadminname']));
     setGlobalSetting('shownoanswer', sanitize_int($_POST['shownoanswer']));
     setGlobalSetting('showxquestions', $_POST['showxquestions']);
     setGlobalSetting('showgroupinfo', $_POST['showgroupinfo']);
     setGlobalSetting('showqnumcode', $_POST['showqnumcode']);
     $repeatheadingstemp = (int) $_POST['repeatheadings'];
     if ($repeatheadingstemp == 0) {
         $repeatheadingstemp = 25;
     }
     setGlobalSetting('repeatheadings', $repeatheadingstemp);
     setGlobalSetting('maxemails', sanitize_int($maxemails));
     $iSessionExpirationTime = (int) $_POST['iSessionExpirationTime'];
     if ($iSessionExpirationTime == 0) {
         $iSessionExpirationTime = 7200;
     }
     setGlobalSetting('iSessionExpirationTime', $iSessionExpirationTime);
     setGlobalSetting('ipInfoDbAPIKey', $_POST['ipInfoDbAPIKey']);
     setGlobalSetting('pdffontsize', $iPDFFontSize);
     setGlobalSetting('pdfshowheader', $_POST['pdfshowheader']);
     setGlobalSetting('pdflogowidth', $iPDFLogoWidth);
     setGlobalSetting('pdfheadertitle', $_POST['pdfheadertitle']);
     setGlobalSetting('pdfheaderstring', $_POST['pdfheaderstring']);
     setGlobalSetting('googleMapsAPIKey', $_POST['googleMapsAPIKey']);
     setGlobalSetting('googleanalyticsapikey', $_POST['googleanalyticsapikey']);
     setGlobalSetting('googletranslateapikey', $_POST['googletranslateapikey']);
     setGlobalSetting('force_ssl', $_POST['force_ssl']);
//.........这里部分代码省略.........
开发者ID:nicbon,项目名称:LimeSurvey,代码行数:101,代码来源:globalsettings.php

示例6: insertlabelset

function insertlabelset()
{
    //global $labelsoutput;
    //	$labelsoutput.= $_POST['languageids'];  For debug purposes
    $clang = Yii::app()->lang;
    $postlanguageids = sanitize_languagecodeS(Yii::app()->getRequest()->getPost('languageids'));
    $postlabel_name = flattenText(Yii::app()->getRequest()->getPost('label_name'), false, true, 'UTF-8', true);
    $data = array('label_name' => $postlabel_name, 'languages' => $postlanguageids);
    //$query = "INSERT INTO ".db_table_name('labelsets')." (label_name,languages) VALUES ({$postlabel_name},{$postlanguageids})";
    $result = LabelSet::model()->insertRecords($data);
    if (!$result) {
        Yii::app()->session['flashmessage'] = $clang->gT("Inserting the label set failed.");
    } else {
        return $result;
    }
}
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:16,代码来源:label_helper.php

示例7: FixLanguageConsistency

/**
 * FixLanguageConsistency() fixes missing groups,questions,answers & assessments for languages on a survey
 * @param string $sid - the currently selected survey
 * @param string $availlangs - space seperated list of additional languages in survey - if empty all additional languages of a survey are checked against the base language
 * @return bool - always returns true
 */
function FixLanguageConsistency($sid, $availlangs = '')
{
    global $connect, $databasetype;
    if (trim($availlangs) != '') {
        $availlangs = sanitize_languagecodeS($availlangs);
        $langs = explode(" ", $availlangs);
        if ($langs[count($langs) - 1] == "") {
            array_pop($langs);
        }
    } else {
        $langs = GetAdditionalLanguagesFromSurveyID($sid);
    }
    $baselang = GetBaseLanguageFromSurveyID($sid);
    $sid = sanitize_int($sid);
    $query = "SELECT * FROM " . db_table_name('groups') . " WHERE sid='{$sid}' AND language='{$baselang}'  ORDER BY group_order";
    $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
    //Checked
    if ($result->RecordCount() > 0) {
        while ($group = $result->FetchRow()) {
            foreach ($langs as $lang) {
                $query = "SELECT gid FROM " . db_table_name('groups') . " WHERE sid='{$sid}' AND gid='{$group['gid']}' AND language='{$lang}'";
                $gresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
                //Checked
                if ($gresult->RecordCount() < 1) {
                    db_switchIDInsert('groups', true);
                    $query = "INSERT INTO " . db_table_name('groups') . " (gid,sid,group_name,group_order,description,language) VALUES('{$group['gid']}','{$group['sid']}'," . db_quoteall($group['group_name']) . ",'{$group['group_order']}'," . db_quoteall($group['description']) . ",'{$lang}')";
                    $connect->Execute($query) or safe_die($connect->ErrorMsg());
                    //Checked
                    db_switchIDInsert('groups', false);
                }
            }
            reset($langs);
        }
    }
    $quests = array();
    $query = "SELECT * FROM " . db_table_name('questions') . " WHERE sid='{$sid}' AND language='{$baselang}' ORDER BY question_order";
    $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
    //Checked
    if ($result->RecordCount() > 0) {
        while ($question = $result->FetchRow()) {
            array_push($quests, $question['qid']);
            foreach ($langs as $lang) {
                $query = "SELECT qid FROM " . db_table_name('questions') . " WHERE sid='{$sid}' AND qid='{$question['qid']}' AND language='{$lang}'";
                $gresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
                //Checked
                if ($gresult->RecordCount() < 1) {
                    db_switchIDInsert('questions', true);
                    $query = "INSERT INTO " . db_table_name('questions') . " (qid,sid,gid,type,title,question,preg,help,other,mandatory,question_order,language, scale_id,parent_qid) VALUES('{$question['qid']}','{$question['sid']}','{$question['gid']}','{$question['type']}'," . db_quoteall($question['title']) . "," . db_quoteall($question['question']) . "," . db_quoteall($question['preg']) . "," . db_quoteall($question['help']) . ",'{$question['other']}','{$question['mandatory']}','{$question['question_order']}','{$lang}',{$question['scale_id']},{$question['parent_qid']})";
                    $connect->Execute($query) or safe_die($query . "<br />" . $connect->ErrorMsg());
                    //Checked
                    db_switchIDInsert('questions', false);
                }
            }
            reset($langs);
        }
        $sqlans = "";
        foreach ($quests as $quest) {
            $sqlans .= " OR qid = '" . $quest . "' ";
        }
        $query = "SELECT * FROM " . db_table_name('answers') . " WHERE language='{$baselang}' and (" . trim($sqlans, ' OR') . ") ORDER BY qid, code";
        $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
        //Checked
        if ($result->RecordCount() > 0) {
            while ($answer = $result->FetchRow()) {
                foreach ($langs as $lang) {
                    $query = "SELECT qid FROM " . db_table_name('answers') . " WHERE code='{$answer['code']}' AND qid='{$answer['qid']}' AND language='{$lang}'";
                    $gresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
                    //Checked
                    if ($gresult->RecordCount() < 1) {
                        db_switchIDInsert('answers', true);
                        $query = "INSERT INTO " . db_table_name('answers') . " (qid,code,answer,scale_id,sortorder,language,assessment_value) VALUES('{$answer['qid']}'," . db_quoteall($answer['code']) . "," . db_quoteall($answer['answer']) . ",{$answer['scale_id']},'{$answer['sortorder']}','{$lang}',{$answer['assessment_value']})";
                        $connect->Execute($query) or safe_die($connect->ErrorMsg());
                        //Checked
                        db_switchIDInsert('answers', false);
                    }
                }
                reset($langs);
            }
        }
    }
    $query = "SELECT * FROM " . db_table_name('assessments') . " WHERE sid='{$sid}' AND language='{$baselang}'";
    $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
    //Checked
    if ($result->RecordCount() > 0) {
        while ($assessment = $result->FetchRow()) {
            foreach ($langs as $lang) {
                $query = "SELECT id FROM " . db_table_name('assessments') . " WHERE sid='{$sid}' AND id='{$assessment['id']}' AND language='{$lang}'";
                $gresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
                //Checked
                if ($gresult->RecordCount() < 1) {
                    db_switchIDInsert('assessments', true);
                    $query = "INSERT INTO " . db_table_name('assessments') . " (id,sid,scope,gid,name,minimum,maximum,message,language) " . "VALUES('{$assessment['id']}','{$assessment['sid']}'," . db_quoteall($assessment['scope']) . "," . db_quoteall($assessment['gid']) . "," . db_quoteall($assessment['name']) . "," . db_quoteall($assessment['minimum']) . "," . db_quoteall($assessment['maximum']) . "," . db_quoteall($assessment['message']) . ",'{$lang}')";
                    $connect->Execute($query) or safe_die($connect->ErrorMsg());
                    //Checked
//.........这里部分代码省略.........
开发者ID:karime7gezly,项目名称:OpenConextApps-LimeSurvey,代码行数:101,代码来源:common_functions.php

示例8: _saveSettings

 private function _saveSettings()
 {
     if ($_POST['action'] !== "globalsettingssave") {
         return;
     }
     if (!Permission::model()->hasGlobalPermission('settings', 'update')) {
         $this->getController()->redirect(array('/admin'));
     }
     $clang = $this->getController()->lang;
     Yii::app()->loadHelper('surveytranslator');
     $maxemails = $_POST['maxemails'];
     if (sanitize_int($_POST['maxemails']) < 1) {
         $maxemails = 1;
     }
     $defaultlang = sanitize_languagecode($_POST['defaultlang']);
     $aRestrictToLanguages = explode(' ', sanitize_languagecodeS($_POST['restrictToLanguages']));
     if (!in_array($defaultlang, $aRestrictToLanguages)) {
         // Force default language in restrictToLanguages
         $aRestrictToLanguages[] = $defaultlang;
     }
     if (count(array_diff(array_keys(getLanguageData(false, Yii::app()->session['adminlang'])), $aRestrictToLanguages)) == 0) {
         $aRestrictToLanguages = '';
     } else {
         $aRestrictToLanguages = implode(' ', $aRestrictToLanguages);
     }
     setGlobalSetting('defaultlang', $defaultlang);
     setGlobalSetting('restrictToLanguages', trim($aRestrictToLanguages));
     setGlobalSetting('sitename', strip_tags($_POST['sitename']));
     setGlobalSetting('updatecheckperiod', (int) $_POST['updatecheckperiod']);
     setGlobalSetting('updatenotification', strip_tags($_POST['updatenotification']));
     setGlobalSetting('defaulthtmleditormode', sanitize_paranoid_string($_POST['defaulthtmleditormode']));
     setGlobalSetting('defaultquestionselectormode', sanitize_paranoid_string($_POST['defaultquestionselectormode']));
     setGlobalSetting('defaulttemplateeditormode', sanitize_paranoid_string($_POST['defaulttemplateeditormode']));
     setGlobalSetting('defaulttemplate', sanitize_paranoid_string($_POST['defaulttemplate']));
     setGlobalSetting('admintheme', sanitize_paranoid_string($_POST['admintheme']));
     setGlobalSetting('adminthemeiconsize', trim(file_get_contents(Yii::app()->getConfig("styledir") . DIRECTORY_SEPARATOR . sanitize_paranoid_string($_POST['admintheme']) . DIRECTORY_SEPARATOR . 'iconsize')));
     setGlobalSetting('emailmethod', strip_tags($_POST['emailmethod']));
     setGlobalSetting('emailsmtphost', strip_tags(returnGlobal('emailsmtphost')));
     if (returnGlobal('emailsmtppassword') != 'somepassword') {
         setGlobalSetting('emailsmtppassword', strip_tags(returnGlobal('emailsmtppassword')));
     }
     setGlobalSetting('bounceaccounthost', strip_tags(returnGlobal('bounceaccounthost')));
     setGlobalSetting('bounceaccounttype', strip_tags(returnGlobal('bounceaccounttype')));
     setGlobalSetting('bounceencryption', strip_tags(returnGlobal('bounceencryption')));
     setGlobalSetting('bounceaccountuser', strip_tags(returnGlobal('bounceaccountuser')));
     if (returnGlobal('bounceaccountpass') != 'enteredpassword') {
         setGlobalSetting('bounceaccountpass', strip_tags(returnGlobal('bounceaccountpass')));
     }
     setGlobalSetting('emailsmtpssl', sanitize_paranoid_string(Yii::app()->request->getPost('emailsmtpssl', '')));
     setGlobalSetting('emailsmtpdebug', sanitize_int(Yii::app()->request->getPost('emailsmtpdebug', '0')));
     setGlobalSetting('emailsmtpuser', strip_tags(returnGlobal('emailsmtpuser')));
     setGlobalSetting('filterxsshtml', strip_tags($_POST['filterxsshtml']));
     $warning = '';
     // make sure emails are valid before saving them
     if (Yii::app()->request->getPost('siteadminbounce', '') == '' || validateEmailAddress(Yii::app()->request->getPost('siteadminbounce'))) {
         setGlobalSetting('siteadminbounce', strip_tags(Yii::app()->request->getPost('siteadminbounce')));
     } else {
         $warning .= $clang->gT("Warning! Admin bounce email was not saved because it was not valid.") . '<br/>';
     }
     if (Yii::app()->request->getPost('siteadminemail', '') == '' || validateEmailAddress(Yii::app()->request->getPost('siteadminemail'))) {
         setGlobalSetting('siteadminemail', strip_tags(Yii::app()->request->getPost('siteadminemail')));
     } else {
         $warning .= $clang->gT("Warning! Admin email was not saved because it was not valid.") . '<br/>';
     }
     setGlobalSetting('siteadminname', strip_tags($_POST['siteadminname']));
     setGlobalSetting('shownoanswer', sanitize_int($_POST['shownoanswer']));
     setGlobalSetting('showxquestions', $_POST['showxquestions']);
     setGlobalSetting('showgroupinfo', $_POST['showgroupinfo']);
     setGlobalSetting('showqnumcode', $_POST['showqnumcode']);
     $repeatheadingstemp = (int) $_POST['repeatheadings'];
     if ($repeatheadingstemp == 0) {
         $repeatheadingstemp = 25;
     }
     setGlobalSetting('repeatheadings', $repeatheadingstemp);
     setGlobalSetting('maxemails', sanitize_int($maxemails));
     $iSessionExpirationTime = (int) $_POST['iSessionExpirationTime'];
     if ($iSessionExpirationTime == 0) {
         $iSessionExpirationTime = 7200;
     }
     setGlobalSetting('iSessionExpirationTime', $iSessionExpirationTime);
     setGlobalSetting('ipInfoDbAPIKey', $_POST['ipInfoDbAPIKey']);
     setGlobalSetting('googleMapsAPIKey', $_POST['googleMapsAPIKey']);
     setGlobalSetting('googleanalyticsapikey', $_POST['googleanalyticsapikey']);
     setGlobalSetting('googletranslateapikey', $_POST['googletranslateapikey']);
     setGlobalSetting('force_ssl', $_POST['force_ssl']);
     setGlobalSetting('surveyPreview_require_Auth', $_POST['surveyPreview_require_Auth']);
     setGlobalSetting('RPCInterface', $_POST['RPCInterface']);
     setGlobalSetting('rpc_publish_api', (bool) $_POST['rpc_publish_api']);
     //added by Gaurang 2014-04-14
     setGlobalSetting('Project_Manager', (int) $_POST['Project_Manager']);
     //setGlobalSetting('Sales_Person', (int) $_POST['Sales_Person']);
     setGlobalSetting('Own_Panel', (int) $_POST['Own_Panel']);
     // EOF Gaurang
     //added by Gaurang 2014-04-17
     // set global status of project
     setGlobalSetting('project_status_run', (int) $_POST['project_status_run']);
     setGlobalSetting('project_status_test', (int) $_POST['project_status_test']);
     setGlobalSetting('project_status_hold', (int) $_POST['project_status_hold']);
     setGlobalSetting('project_status_completed', (int) $_POST['project_status_completed']);
     setGlobalSetting('project_status_closed', (int) $_POST['project_status_closed']);
//.........这里部分代码省略.........
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:101,代码来源:globalsettings.php

示例9: insertlabelset

function insertlabelset()
{
    //global $labelsoutput;
    //	$labelsoutput.= $_POST['languageids'];  For debug purposes
    $clang = Yii::app()->lang;
    if (!empty($_POST['languageids'])) {
        $postlanguageids = sanitize_languagecodeS($_POST['languageids']);
    }
    if (!empty($_POST['label_name'])) {
        $postlabel_name = sanitize_labelname($_POST['label_name']);
    }
    //postlabel_name = dbQuoteAll($postlabel_name,true);
    //$postlanguageids = dbQuoteAll($postlanguageids,true);
    $data = array('label_name' => $postlabel_name, 'languages' => $postlanguageids);
    //$query = "INSERT INTO ".db_table_name('labelsets')." (label_name,languages) VALUES ({$postlabel_name},{$postlanguageids})";
    $result = Labelsets::model()->insertRecords($data);
    if (!$result) {
        safeDie("Inserting the label set failed:<br />" . $query . "<br />");
    } else {
        return $result;
    }
}
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:22,代码来源:label_helper.php


注:本文中的sanitize_languagecodeS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。