예제 #1
0
파일: Slug.php 프로젝트: Cheren/union
 /**
  * Create slug.
  *
  * @param $string
  * @return string
  */
 public function create($string)
 {
     $string = mb_strtolower((string) $string);
     foreach ($this->getTransliteration() as $replace => $keys) {
         foreach ($keys as $search) {
             $string = ireplace($search, $replace, $string);
         }
     }
     $string = preg_replace(['#\\s+#', '#[^\\x{00C0}-\\x{00D6}x{00D8}-\\x{00F6}\\x{00F8}-\\x{00FF}\\x{0370}-\\x{1FFF}\\x{4E00}-\\x{9FAF}a-z0-9\\-]#ui'], ['-', ''], $string);
     $string = preg_replace('#[-]+#u', '-', $string);
     $string = trim($string, '-');
     return utrim($string, true);
 }
 /**
  * Sets the end element handler function for the XML parser parser.end_element_handler.
  * @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler.
  * @param $name (string) The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
  * @private
  */
 private function endElementHandler($parser, $name)
 {
     global $l, $db;
     require_once '../config/tce_config.php';
     $name = strtolower($name);
     switch ($name) {
         case 'module':
             $this->addModule();
             $this->level = '';
             break;
         case 'subject':
             $this->addSubject();
             $this->level = 'module';
             break;
         case 'question':
             $this->addQuestion();
             $this->level = 'subject';
             break;
         case 'answer':
             $this->addAnswer();
             $this->level = 'question';
             break;
         default:
             $elname = $this->level . '_' . $name;
             if ($this->current_element == $elname) {
                 $this->level_data[$this->level][$this->current_element] = F_escape_sql(F_xml_to_text(utrim($this->current_data)), false);
             }
             break;
     }
 }
예제 #3
0
    $subject_module_id = 0;
}
if (isset($_REQUEST['changecategory']) and $_REQUEST['changecategory'] > 0) {
    $changecategory = 1;
} elseif (isset($_REQUEST['selectcategory'])) {
    $changecategory = 1;
} else {
    $changecategory = 0;
}
if (isset($_REQUEST['subject_name'])) {
    $subject_name = utrim($_REQUEST['subject_name']);
} else {
    $subject_name = '';
}
if (isset($_REQUEST['subject_description'])) {
    $subject_description = utrim($_REQUEST['subject_description']);
} else {
    $subject_description = '';
}
if ($subject_id > 0) {
    if ($changecategory == 0) {
        $sql = 'SELECT subject_module_id FROM ' . K_TABLE_SUBJECTS . ' WHERE subject_id=' . $subject_id . ' LIMIT 1';
        if ($r = F_db_query($sql, $db)) {
            if ($m = F_db_fetch_array($r)) {
                $subject_module_id = $m['subject_module_id'];
                // check user's authorization for parent module
                if (!F_isAuthorizedUser(K_TABLE_MODULES, 'module_id', $subject_module_id, 'module_user_id') and !F_isAuthorizedUser(K_TABLE_SUBJECTS, 'subject_id', $subject_id, 'subject_user_id')) {
                    F_print_error('ERROR', $l['m_authorization_denied']);
                    exit;
                }
            }
예제 #4
0
 /**
  * Sets the end element handler function for the XML parser parser.end_element_handler.
  * @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler.
  * @param $name (string) The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
  * @private
  */
 private function endElementHandler($parser, $name)
 {
     global $l, $db;
     require_once '../config/tce_config.php';
     $name = strtolower($name);
     switch ($name) {
         case 'module':
             $this->addModule();
             $this->level = '';
             break;
         case 'subject':
             $this->addSubject();
             $this->level = 'module';
             break;
         case 'question':
             $this->addQuestion();
             $this->level = 'subject';
             break;
         case 'answer':
             $this->addAnswer();
             $this->level = 'question';
             break;
         default:
             $elname = $this->level . '_' . $name;
             if ($this->current_element == $elname) {
                 // convert XML special chars
                 $this->level_data[$this->level][$this->current_element] = F_xml_to_text(utrim($this->current_data));
                 if ($this->current_element == 'question_description' or $this->current_element == 'answer_description') {
                     // normalize UTF-8 string based on settings
                     $this->level_data[$this->level][$this->current_element] = F_utf8_normalizer($this->level_data[$this->level][$this->current_element], K_UTF8_NORMALIZATION_MODE);
                 }
                 // escape for SQL
                 $this->level_data[$this->level][$this->current_element] = F_escape_sql($db, $this->level_data[$this->level][$this->current_element], false);
             }
             break;
     }
 }
예제 #5
0
}
if (!isset($question_inline_answers) or empty($question_inline_answers)) {
    $question_inline_answers = 0;
} else {
    $question_inline_answers = intval($question_inline_answers);
}
if (!isset($question_auto_next) or empty($question_auto_next)) {
    $question_auto_next = 0;
} else {
    $question_auto_next = intval($question_auto_next);
}
if (isset($question_description)) {
    $question_description = utrim($question_description);
}
if (isset($question_explanation)) {
    $question_explanation = utrim($question_explanation);
} else {
    $question_explanation = '';
}
$qtype = array('S', 'M', 'T', 'O');
// question types
// check user's authorization
if (isset($_REQUEST['question_id']) and $_REQUEST['question_id'] > 0) {
    $question_id = intval($_REQUEST['question_id']);
    $sql = 'SELECT subject_module_id,question_subject_id
		FROM ' . K_TABLE_SUBJECTS . ', ' . K_TABLE_QUESTIONS . '
		WHERE subject_id=question_subject_id
			AND question_id=' . $question_id . '
		LIMIT 1';
    if ($r = F_db_query($sql, $db)) {
        if ($m = F_db_fetch_array($r)) {
예제 #6
0
 */
require_once '../config/tce_config.php';
$pagelevel = K_AUTH_ADMIN_MODULES;
require_once '../../shared/code/tce_authorization.php';
$thispage_title = $l['t_modules_editor'];
require_once '../code/tce_page_header.php';
require_once '../../shared/code/tce_functions_form.php';
require_once '../code/tce_functions_auth_sql.php';
// set default values
if (!isset($module_enabled) or empty($module_enabled)) {
    $module_enabled = 0;
} else {
    $module_enabled = intval($module_enabled);
}
if (isset($module_name)) {
    $module_name = utrim($module_name);
}
if (isset($module_user_id)) {
    $module_user_id = intval($module_user_id);
} else {
    $module_user_id = intval($_SESSION['session_user_id']);
}
if (isset($_REQUEST['module_id']) and $_REQUEST['module_id'] > 0) {
    $module_id = intval($_REQUEST['module_id']);
    // check user's authorization for module
    if (!F_isAuthorizedUser(K_TABLE_MODULES, 'module_id', $module_id, 'module_user_id')) {
        F_print_error('ERROR', $l['m_authorization_denied']);
        exit;
    }
} else {
    $module_id = 0;
예제 #7
0
 function getMail($id = 0, $offset = 0, $limit = 0, $search = array())
 {
     $Mail = array();
     $Return = array();
     if (!$limit) {
         $limit = $this->count_msg;
     }
     if ($limit + $offset > $this->count_msg) {
         $limit = $this->count_msg - $offset;
     }
     if ($id) {
         $offset = $id - 1;
         //da wir als id mindestens 1 uebergeben muessen wir hier eins abziehen da ein array bei 0 beginnen soll....
         $limit = 1;
     }
     $cc = 0;
     for ($i = $offset; $i < $offset + $limit; $i++) {
         $header = imap_headerinfo($this->mbox, $i + 1, 80, 80);
         //$i+1 !! messageno beginnt bei 1 und array bei 0!!!
         //alternative statt headerinfo etcie x header aus nach dnen wir ja auch unbedingt suchen wollen:
         //enthaelt den kompletten header
         $Mail[$cc]['header'] = imap_fetchheader($this->mbox, $i + 1);
         //=explode("\n", imap_fetchheader($mbox, $i));
         $to = isset($header->to) && isset($header->to[0]->mailbox) && isset($header->to[0]->host) ? $header->to[0]->mailbox . "@" . $header->to[0]->host : "k.a.";
         //: '".display($header->to[0]->mailbox."@".$header->to[0]->host)."'";
         #$from=$header->from[0]->mailbox."@".$header->from[0]->host;
         //fixed bug where from addrress is not a valid email address, e.g. From: MAILER-DAEMON (Mail Delivery System)
         //https://sourceforge.net/tracker/?func=detail&aid=3121248&group_id=190396&atid=933192
         //bug id 3121248
         //thx to tms-schmidt
         $from = isset($header->from) && isset($header->from[0]->mailbox) && isset($header->from[0]->host) ? $header->from[0]->mailbox . "@" . $header->from[0]->host : "k.a.";
         //: '".display($header->from[0]->mailbox."@".$header->from[0]->host)."'";
         //wenn kein filter oder filter matched, TO
         if (!isset($search['to']) || $search['to'] == $to) {
             $Mail[$cc]['to_box'] = isset($header->to[0]->mailbox) ? $header->to[0]->mailbox : "k.a.";
             $Mail[$cc]['to_host'] = isset($header->to[0]->host) ? $header->to[0]->host : "k.a.";
             #$Mail[$cc]['from_box'] =  $header->from[0]->mailbox;
             #$Mail[$cc]['from_host'] =  $header->from[0]->host;
             //fixed bug where from addrress is not a valid email address, e.g. From: MAILER-DAEMON (Mail Delivery System)
             //https://sourceforge.net/tracker/?func=detail&aid=3121248&group_id=190396&atid=933192
             //bug id 3121248
             //thx to tms-schmidt
             $Mail[$cc]['from_box'] = isset($header->from[0]->mailbox) ? $header->from[0]->mailbox : "k.a.";
             $Mail[$cc]['from_host'] = isset($header->from[0]->host) ? $header->from[0]->host : "k.a.";
             $Mail[$cc]['to'] = $to;
             $Mail[$cc]['from'] = $from;
             $Mail[$cc]['subject'] = isset($header->fetchsubject) ? $header->fetchsubject : "no Subject";
             $Mail[$cc]['date'] = isset($header->Date) ? $header->Date : "no Date";
             #$Mail[$cc]['id'] = $header->message_id;
             $Mail[$cc]['no'] = utrim($header->Msgno);
             $Mail[$cc]['size'] = $header->Size;
             $Mail[$cc]['unseen'] = $header->Unseen;
             $Mail[$cc]['recent'] = $header->Recent;
             $Mail[$cc]['flagged'] = $header->Flagged;
             //textparts aus der mail holen und anhaengen
             $Mail[$cc]['body'] = $this->getTextParts($i + 1);
             $cc++;
         } else {
             unset($Mail[$cc]);
             //$limit++; //limit um 1 erhoehen wenn filter gesetzt und nichts gefunden! damit wir immer $limit ergebnisse bekommen , maximal!
             // kann aber zu einer komischen schleife fuehren, liefert mehr ergebnisse als limit ist... :)
             //pruefen ob max nazahl mails ueberschritten, wenn ja, schleife abbrechen!
             #if (($offset+$limit+1)>$this->count_msg) {
             #	$i=$this->count_msg;
             #}
             #$limit++; // limit um 1 erhoehen!
         }
         //imap_setflag_full($this->mbox, $i, "\\SEEN");
         //nur imap!!! imap_setflag_full($this->mbox, imap_uid($this->mbox, $i), "\\Seen", ST_UID);
         //print_r(imap_headerinfo($this->mbox, $i, 80, 80));
     }
     //array neu ordnen
     $Mail = array_values($Mail);
     $this->Mails = $Mail;
     // an klassenweites array uebergeben! damit kann man immernoch sachen machen
     return $Mail;
 }
예제 #8
0
    $subject_enabled = intval($subject_enabled);
}
if (isset($subject_id)) {
    $subject_id = intval($subject_id);
}
if (isset($subject_module_id)) {
    $subject_module_id = intval($subject_module_id);
}
if (isset($selectcategory)) {
    $changecategory = 1;
}
if (isset($subject_name)) {
    $subject_name = utrim($subject_name);
}
if (isset($subject_description)) {
    $subject_description = utrim($subject_description);
}
if (isset($_REQUEST['subject_id']) and $_REQUEST['subject_id'] > 0) {
    $subject_id = intval($_REQUEST['subject_id']);
    if (!isset($changecategory) or $changecategory == 0) {
        $sql = 'SELECT subject_module_id FROM ' . K_TABLE_SUBJECTS . ' WHERE subject_id=' . $subject_id . ' LIMIT 1';
        if ($r = F_db_query($sql, $db)) {
            if ($m = F_db_fetch_array($r)) {
                $subject_module_id = $m['subject_module_id'];
                // check user's authorization for parent module
                if (!F_isAuthorizedUser(K_TABLE_MODULES, 'module_id', $subject_module_id, 'module_user_id')) {
                    F_print_error('ERROR', $l['m_authorization_denied']);
                    exit;
                }
            }
        } else {
예제 #9
0
 */
require_once '../config/tce_config.php';
$pagelevel = K_AUTH_ADMIN_SSLCERT;
require_once '../../shared/code/tce_authorization.php';
$thispage_title = $l['t_sslcerts'];
require_once '../code/tce_page_header.php';
require_once '../../shared/code/tce_functions_form.php';
require_once '../../shared/code/tce_functions_authorization.php';
// set default values
if (!isset($ssl_enabled) or empty($ssl_enabled)) {
    $ssl_enabled = false;
} else {
    $ssl_enabled = F_getBoolean($ssl_enabled);
}
if (isset($ssl_name)) {
    $ssl_name = utrim($ssl_name);
} else {
    $ssl_name = '';
}
if (isset($ssl_user_id)) {
    $ssl_user_id = intval($ssl_user_id);
} else {
    $ssl_user_id = intval($_SESSION['session_user_id']);
}
if (isset($_REQUEST['ssl_id']) and $_REQUEST['ssl_id'] > 0) {
    $ssl_id = intval($_REQUEST['ssl_id']);
    // check user's authorization for this certificate
    if (!F_isAuthorizedUser(K_TABLE_SSLCERTS, 'ssl_id', $ssl_id, 'ssl_user_id')) {
        F_print_error('ERROR', $l['m_authorization_denied']);
        exit;
    }
예제 #10
0
if (isset($answer_id)) {
    $answer_id = intval($answer_id);
}
if (isset($answer_question_id)) {
    $answer_question_id = intval($answer_question_id);
}
if (!isset($answer_keyboard_key) or empty($answer_keyboard_key)) {
    $answer_keyboard_key = '';
} else {
    $answer_keyboard_key = intval($answer_keyboard_key);
}
if (isset($answer_description)) {
    $answer_description = utrim($answer_description);
}
if (isset($answer_explanation)) {
    $answer_explanation = utrim($answer_explanation);
} else {
    $answer_explanation = '';
}
$qtype = array('S', 'M', 'T', 'O');
// question types
// check user's authorization
if (isset($_REQUEST['answer_id']) and $_REQUEST['answer_id'] > 0) {
    $answer_id = intval($_REQUEST['answer_id']);
    $sql = 'SELECT subject_module_id,question_subject_id,answer_question_id
		FROM ' . K_TABLE_SUBJECTS . ', ' . K_TABLE_QUESTIONS . ', ' . K_TABLE_ANSWERS . '
		WHERE subject_id=question_subject_id
			AND question_id=answer_question_id
			AND answer_id=' . $answer_id . '
		LIMIT 1';
    if ($r = F_db_query($sql, $db)) {
예제 #11
0
    $answer_question_id = 0;
}
if (!isset($answer_keyboard_key) or empty($answer_keyboard_key)) {
    $answer_keyboard_key = '';
} else {
    $answer_keyboard_key = intval($answer_keyboard_key);
}
if (isset($_REQUEST['answer_description'])) {
    $answer_description = utrim($_REQUEST['answer_description']);
    if (function_exists('normalizer_normalize')) {
        // normalize UTF-8 string based on settings
        $answer_description = F_utf8_normalizer($answer_description, K_UTF8_NORMALIZATION_MODE);
    }
}
if (isset($_REQUEST['answer_explanation'])) {
    $answer_explanation = utrim($_REQUEST['answer_explanation']);
} else {
    $answer_explanation = '';
}
$qtype = array('S', 'M', 'T', 'O');
// question types
// check user's authorization
if ($answer_id > 0) {
    $sql = 'SELECT subject_module_id,question_subject_id,answer_question_id
		FROM ' . K_TABLE_SUBJECTS . ', ' . K_TABLE_QUESTIONS . ', ' . K_TABLE_ANSWERS . '
		WHERE subject_id=question_subject_id
			AND question_id=answer_question_id
			AND answer_id=' . $answer_id . '
		LIMIT 1';
    if ($r = F_db_query($sql, $db)) {
        if ($m = F_db_fetch_array($r)) {
예제 #12
0
    $question_inline_answers = F_getBoolean($_REQUEST['question_inline_answers']);
}
if (!isset($_REQUEST['question_auto_next']) or empty($_REQUEST['question_auto_next'])) {
    $question_auto_next = false;
} else {
    $question_auto_next = F_getBoolean($_REQUEST['question_auto_next']);
}
if (isset($_REQUEST['question_description'])) {
    $question_description = utrim($_REQUEST['question_description']);
    if (function_exists('normalizer_normalize')) {
        // normalize UTF-8 string based on settings
        $question_description = F_utf8_normalizer($question_description, K_UTF8_NORMALIZATION_MODE);
    }
}
if (isset($_REQUEST['question_explanation'])) {
    $question_explanation = utrim($_REQUEST['question_explanation']);
} else {
    $question_explanation = '';
}
$qtype = array('S', 'M', 'T', 'O');
// question types
// check user's authorization
if ($question_id > 0) {
    $sql = 'SELECT subject_module_id, question_subject_id
		FROM ' . K_TABLE_SUBJECTS . ', ' . K_TABLE_QUESTIONS . '
		WHERE subject_id=question_subject_id
			AND question_id=' . $question_id . '
		LIMIT 1';
    if ($r = F_db_query($sql, $db)) {
        if ($m = F_db_fetch_array($r)) {
            // check user's authorization for parent module
예제 #13
0
 */
require_once '../config/tce_config.php';
$pagelevel = K_AUTH_ADMIN_MODULES;
require_once '../../shared/code/tce_authorization.php';
$thispage_title = $l['t_modules_editor'];
require_once '../code/tce_page_header.php';
require_once '../../shared/code/tce_functions_form.php';
require_once '../../shared/code/tce_functions_auth_sql.php';
// set default values
if (!isset($_REQUEST['module_enabled']) or empty($_REQUEST['module_enabled'])) {
    $module_enabled = false;
} else {
    $module_enabled = F_getBoolean($_REQUEST['module_enabled']);
}
if (isset($_REQUEST['module_name'])) {
    $module_name = utrim($_REQUEST['module_name']);
} else {
    $module_name = '';
}
if (isset($_REQUEST['module_user_id'])) {
    $module_user_id = intval($_REQUEST['module_user_id']);
} else {
    $module_user_id = intval($_SESSION['session_user_id']);
}
if (isset($_REQUEST['module_id']) and $_REQUEST['module_id'] > 0) {
    $module_id = intval($_REQUEST['module_id']);
    // check user's authorization for module
    if (!F_isAuthorizedUser(K_TABLE_MODULES, 'module_id', $module_id, 'module_user_id')) {
        F_print_error('ERROR', $l['m_authorization_denied']);
        exit;
    }