예제 #1
0
}
require_once KT_LIB_DIR . '/validation/customerror.php';
// {{{ prependPath()
function prependPath($path)
{
    $include_path = ini_get('include_path');
    ini_set('include_path', $path . PATH_SEPARATOR . $include_path);
}
// }}}
prependPath(KT_DIR . '/thirdparty/ZendFramework/library');
prependPath(KT_DIR . '/thirdparty/pear');
prependPath(KT_DIR . '/thirdparty/Smarty');
prependPath(KT_DIR . '/thirdparty/simpletest');
prependPath(KT_DIR . '/thirdparty/xmlrpc-2.2/lib');
prependPath(KT_DIR . '/ktapi');
prependPath(KT_DIR . '/search2');
require_once 'PEAR.php';
// Give everyone access to legacy PHP functions
require_once KT_LIB_DIR . '/util/legacy.inc';
// Give everyone access to KTUtil utility functions
require_once KT_LIB_DIR . '/util/ktutil.inc';
require_once KT_LIB_DIR . '/ktentity.inc';
require_once KT_LIB_DIR . '/config/config.inc.php';
require_once KT_DIR . '/search2/indexing/indexerCore.inc.php';
// {{{ KTInit
class KTInit
{
    // {{{ setupLogging()
    function setupLogging()
    {
        global $default;
예제 #2
0
파일: admin.php 프로젝트: basweerman/xi
 function saveRules()
 {
     global $survey;
     $section = $survey->getSection($_SESSION['section']);
     if (isset($_POST['rules'])) {
         $filename = prependPath($section->getRulesLocation());
         if (is_writable($filename)) {
             file_put_contents($filename, $_POST['rules']);
             return '<div class="alert alert-success" role="alert">Rules written</div>';
         }
         return '<div class="alert alert-danger" role="alert">Rules could not be written</div>';
     } else {
         //come here from language switch
         return '';
     }
 }
예제 #3
0
파일: section.php 프로젝트: basweerman/xi
 function writeQuestionsAndGroups()
 {
     $output = '<?php' . "\n" . '//xi questions (admin generated)';
     foreach ($this->getQuestions() as $question) {
         $output .= "\n" . $question->write();
     }
     $output .= "\n" . '//xi groups (admin generated)';
     foreach ($this->getQuestionGroups() as $question) {
         $output .= "\n" . $question->write();
     }
     $output .= "\n" . '?>';
     $filename = prependPath($this->getQuestionLocation());
     if (is_writable($filename)) {
         file_put_contents($filename, $output);
         return true;
     }
     return false;
 }
예제 #4
0
파일: display.php 프로젝트: basweerman/xi
 function showSectionQuestionEdit($question)
 {
     echo '<div class="well" style="background: white;">';
     echo '<form method=post>';
     echo '<input type=hidden name=page value="survey.section.question.save">';
     echo '<table style="border-spacing: 5px; border-collapse: separate;">';
     echo '<tr><td width=100px>Name</td><td><input type=text class="form-control" name="name" value="' . $question->getName() . '"></td></tr>';
     echo '<tr><td>Description</td><td><input type=text class="form-control" name="description" value="' . $question->getDescription() . '"></td></tr>';
     echo '<tr><td valign=top>Text</td><td><textarea name="questiontext" class="form-control" cols=50 rows=4>' . $question->getQuestionText($_SESSION['language']) . '</textarea></td></tr>';
     echo '<tr><td valign=top>Type</td><td>';
     echo '<select name=questiontype class="form-control">';
     global $survey;
     foreach ($survey->getTypes() as $name => $type) {
         $selected = $question->getQuestionType()->getName() == $name ? ' SELECTED' : '';
         echo '<option value="' . $name . '"' . $selected . '>' . $name . '</option>';
     }
     echo '</select>';
     echo '</td></tr>';
     echo '<tr><td valign=top>Template</td><td>';
     echo '<select name="template" class="form-control">';
     global $survey;
     foreach ($survey->getTemplates() as $name => $template) {
         if ($template->getType() == TEMPLATE_QUESTION) {
             echo '<option value="' . $name . '">' . $name . '</option>';
         }
     }
     echo '</select>';
     echo '</td></tr>';
     echo '</table>';
     $section = $this->survey->getSection($_SESSION['section']);
     echo $this->displayWhenWritable(prependPath($section->getQuestionLocation()), '<input type=submit class="btn btn-default">', 'questions');
     echo '</form>';
 }
예제 #5
0
파일: survey.php 프로젝트: basweerman/xi
 function writeTypes()
 {
     $output = '<?php' . "\n" . '//xi types (admin generated)';
     foreach ($this->getTypes() as $type) {
         $output .= "\n" . $type->write();
     }
     $output .= "\n" . '?>';
     $filename = prependPath($this->getTypesLocation());
     //        $filename = '/tmp/types.php';
     if (is_writable($filename)) {
         file_put_contents($filename, $output);
         //  sleep(2); //give php a change to load the new file
         //gc_collect_cycles();
         return true;
     }
     return false;
 }