Exemplo n.º 1
0
function post()
{
    list($method, $url, $headers, $kwargs, $body) = @decode_request(@file_get_contents('php://input'));
    $password = $GLOBALS['__password__'];
    if ($password) {
        if (!isset($kwargs['password']) || $password != $kwargs['password']) {
            header("HTTP/1.0 403 Forbidden");
            echo message_html('403 Forbidden', 'Wrong Password', "please edit proxy.ini");
            exit(-1);
        }
    }
    $hostsdeny = $GLOBALS['__hostsdeny__'];
    if ($hostsdeny) {
        $urlparts = parse_url($url);
        $host = $urlparts['host'];
        foreach ($hostsdeny as $pattern) {
            if (substr($host, strlen($host) - strlen($pattern)) == $pattern) {
                echo_content("HTTP/1.0 403\r\n\r\n" . message_html('403 Forbidden', "hostsdeny matched({$host})", $url));
                exit(-1);
            }
        }
    }
    if ($body) {
        $headers['Content-Length'] = strval(strlen($body));
    }
    if (isset($headers['Connection'])) {
        $headers['Connection'] = 'close';
    }
    $header_array = array();
    foreach ($headers as $key => $value) {
        $header_array[] = join('-', array_map('ucfirst', explode('-', $key))) . ': ' . $value;
    }
    $timeout = $GLOBALS['__timeout__'];
    $curl_opt = array();
    switch (strtoupper($method)) {
        case 'HEAD':
            $curl_opt[CURLOPT_NOBODY] = true;
            break;
        case 'GET':
            break;
        case 'POST':
            $curl_opt[CURLOPT_POST] = true;
            $curl_opt[CURLOPT_POSTFIELDS] = $body;
            break;
        case 'PUT':
        case 'DELETE':
            $curl_opt[CURLOPT_CUSTOMREQUEST] = $method;
            $curl_opt[CURLOPT_POSTFIELDS] = $body;
            break;
        default:
            echo_content("HTTP/1.0 502\r\n\r\n" . message_html('502 Urlfetch Error', 'Invalid Method: ' . $method, $url));
            exit(-1);
    }
    $curl_opt[CURLOPT_HTTPHEADER] = $header_array;
    $curl_opt[CURLOPT_RETURNTRANSFER] = true;
    $curl_opt[CURLOPT_BINARYTRANSFER] = true;
    $curl_opt[CURLOPT_HEADER] = false;
    $curl_opt[CURLOPT_HEADERFUNCTION] = 'curl_header_function';
    $curl_opt[CURLOPT_WRITEFUNCTION] = 'curl_write_function';
    $curl_opt[CURLOPT_FAILONERROR] = false;
    $curl_opt[CURLOPT_FOLLOWLOCATION] = false;
    $curl_opt[CURLOPT_CONNECTTIMEOUT] = $timeout;
    $curl_opt[CURLOPT_TIMEOUT] = $timeout;
    $curl_opt[CURLOPT_SSL_VERIFYPEER] = false;
    $curl_opt[CURLOPT_SSL_VERIFYHOST] = false;
    $ch = curl_init($url);
    curl_setopt_array($ch, $curl_opt);
    $ret = curl_exec($ch);
    $errno = curl_errno($ch);
    if ($GLOBALS['__content__']) {
        echo_content($GLOBALS['__content__']);
    } else {
        if ($errno) {
            if (!headers_sent()) {
                header('Content-Type: ' . $__content_type__);
            }
            $content = "HTTP/1.0 502\r\n\r\n" . message_html('502 Urlfetch Error', "PHP Urlfetch Error curl({$errno})", curl_error($ch));
            echo_content($content);
        }
    }
    curl_close($ch);
}
Exemplo n.º 2
0
	</head>

	<body>

		<table width="100%" border="0">
			<tr>
				<td>
					<?php 
    echo_nav($topic_id);
    ?>
				</td>
			</tr>
			<tr>
				<td>
					<?php 
    echo_content($topic_id);
    ?>
				</td>
			</tr>

			<tr>
				<td>
					<?php 
    echo_subsection($topic_id);
    ?>
				</td>
			</tr>

			<tr>
				<td>
					<?php 
Exemplo n.º 3
0
            <a href="index.php?page=mfahrpwd">&sdot; Mitfahren</a>
<!--            <a href="index.php?page=fbeitrag">&sdot; Fachbeiträge</a>-->
            <a href="http://bpsem.fachakademie-muehldorf.com">&sdot; Berufspraktikum</a>

            <p>Fortbildungen</p>
            <a href="index.php?page=fortbe">&sdot; Einzelfortbildungen</a>
            <a href="index.php?page=fortbz">&sdot; Fortbildungsreihen</a>
            <a href="index.php?page=fortba">&sdot; Andere</a>
            <a href="index.php?page=fortbm">&sdot; Bedingungen</a>
            <br/>
            <a href="index.php?page=formulare">Formulare</a>
            <!--<a href="index.php?page=prstellen">Praktikumsstellen</a>-->
            <a href="index.php?page=anfahrt">Anfahrt</a>
            <a href="index.php?page=kontakt">Kontakt</a>
            <a href="index.php?page=impressum">Impressum</a>
        </nav>
        <main>
            <?php 
echo_content($content_name);
?>
        </main>
        <div class="clear"></div>
        <footer>
            &copy; 2016, Fachakademie für Sozialpädagogik Mühldorf des Diakonischen Werks Traunstein e.V.
        </footer>
    </div>

</body>

</html>
Exemplo n.º 4
0
 /**
  * Render the querstion as required for displaying results and feedback to the user
  * @param  array  $extra [description]
  */
 public function render_feedback($extra = array())
 {
     global $string;
     // Make sure data is arrays not encoded
     if (!is_array($this->useranswer)) {
         $this->useranswer = json_decode($this->useranswer, true);
     }
     if (!is_array($this->settings)) {
         $this->settings = json_decode($this->settings, true);
     }
     if (isset($this->useranswer['vars'])) {
         $varname = array_keys($this->useranswer['vars']);
         $varvalue = array_values($this->useranswer['vars']);
     } else {
         $varname = array('$A', '$B', '$C', '$D', '$E', '$F', '$G', '$H', '$I', '$J', '$K');
         $varvalue = array_fill(0, 11, '<span class="var_error"><img src="../artwork/small_yellow_warning_icon.gif" width="12" height="11" alt="!">&nbsp;ERROR</span>');
     }
     $leadin = str_ireplace($varname, $varvalue, $this->leadin);
     // Deal with the failed variables
     if ($this->scenario != '') {
         echo "<p>" . $this->scenario . "</p>\n";
     }
     if ($this->q_media != '') {
         echo "<p align=\"center\">" . display_media($this->q_media, $this->q_media_width, $this->q_media_height, '') . "</p>\n";
     }
     echo_content($leadin);
     if (!isset($this->useranswer['uans']) or $this->useranswer['uans'] == '') {
         if ($extra['hide_if_unanswered'] == 1) {
             $extra['tmp_display_correct_answer'] = 0;
             $extra['tmp_display_students_response'] = '0';
             $extra['tmp_display_feedback'] = '0';
             $extra['tmp_display_question_mark'] = '0';
         }
     }
     $saved_response = '';
     $saved_response_clean = '';
     if (isset($this->useranswer['uans'])) {
         $saved_response = $this->useranswer['uans'];
         $saved_response_clean = preg_replace('([^0-9\\.\\-])', '', $saved_response);
     }
     $part_id = 1;
     $tmp_fback = $this->correct_fback;
     echo "<table cellpadding=\"0\" cellspacing=\"1\" border=\"0\"><tr>";
     if ($extra['tmp_display_correct_answer'] == '1') {
         echo '<td>';
         if (isset($this->std[0])) {
             echo display_std($this->std[0]);
         }
         echo '</td>';
     } else {
         echo '<td></td>';
     }
     $marked = true;
     if ($saved_response_clean == '') {
         echo '<td>';
         if ($extra['tmp_exclude'] == '1') {
             echo '<span class="exclude">';
         }
         echo display_response($extra['tmp_display_students_response'], 'blank') . "<input type=\"text\" style=\"color:#808080; text-align:right\" name=\"q'" . $extra['question'] . "'\" size=\"10\" value=\"" . $string['unanswered'] . "\" />";
     } else {
         echo '<td>';
         if ($extra['tmp_exclude'] == '1') {
             echo '<span class="exclude">';
         }
         if (isset($this->useranswer['status']['overall']) and ($this->useranswer['status']['overall'] == Q_MARKING_EXACT or $this->useranswer['status']['overall'] == Q_MARKING_FULL_TOL)) {
             echo display_response($extra['tmp_display_students_response'], 'tick');
         } elseif (isset($this->useranswer['status']['overall']) and $this->useranswer['status']['overall'] == Q_MARKING_PART_TOL) {
             echo display_response($extra['tmp_display_students_response'], 'half');
         } elseif (isset($this->useranswer['status']['overall']) and $this->useranswer['status']['overall'] == Q_MARKING_WRONG) {
             echo display_response($extra['tmp_display_students_response'], 'cross');
         } else {
             echo display_response($extra['tmp_display_students_response'], 'unmarked');
             $marked = false;
         }
         if ($marked) {
             echo '<input type="text" style="text-align:right" name="q' . $extra['question'] . '" size="10" value="' . $this->useranswer['uansnumb'] . ' ' . $this->useranswer['uansunit'] . '" />';
         }
     }
     if ($marked) {
         if ($this->useranswer['ans']['units_used'] == '') {
             $display_units = '';
         } else {
             $display_units = ' ' . $this->useranswer['ans']['units_used'];
         }
     }
     if ($extra['tmp_display_correct_answer'] == '1') {
         if (!isset($this->useranswer['status'])) {
             echo ' <strong><span class="err">' . $string['unmarked'] . '</span></strong>';
         } elseif (!isset($this->useranswer['cans'])) {
             echo ' <strong><span class="err">' . $string['EnhancedCalcCorrectError'] . '</span></strong>';
         } else {
             echo ' <strong>' . $this->useranswer['cans'] . $display_units . '</strong>';
         }
     } else {
         echo ' ';
     }
     if (isset($this->useranswer['cans'])) {
         if (isset($this->useranswer['status']['overall']) and $this->useranswer['status']['overall'] == Q_MARKING_FULL_TOL) {
             echo ' ' . $string['withatoleranceof'] . ' ' . $this->settings['tolerance_full'] . str_replace('#', '', $this->settings['fulltoltyp']);
             echo ' (' . $this->useranswer['ans']['tolerance_fullansneg'] . $display_units . ' - ' . $this->useranswer['ans']['tolerance_fullans'] . $display_units . ')';
         }
         if (isset($this->useranswer['status']['overall']) and $this->useranswer['status']['overall'] == Q_MARKING_PART_TOL) {
             echo ' ' . $string['withatoleranceof'] . ' ' . $this->settings['tolerance_partial'] . str_replace('#', '', $this->settings['parttoltyp']);
             echo ' (' . $this->useranswer['ans']['tolerance_partialansneg'] . $display_units . ' - ' . $this->useranswer['ans']['tolerance_partialans'] . $display_units . ')';
         }
     }
     if ($extra['tmp_exclude'] == '1') {
         echo '</span>';
     }
     echo "</td></tr>\n</table>\n";
     if ($tmp_fback != '' and $extra['tmp_display_feedback'] == '1') {
         foreach ($varname as $individual_varname) {
             $tmp_fback = str_replace($individual_varname, $this->useranswer['vars'][$individual_varname], $tmp_fback);
         }
         echo "<br /><div class=\"fback\">" . nl2br($tmp_fback) . "</div>\n";
     }
 }
Exemplo n.º 5
0
function print_posts($posts, $tot_count, $offset, $taxonomy, $permalinkIsTaxonomy, $query, $currentTerm)
{
    /** JSON OUTPUT **/
    $final_posts = array("posts" => array(), "post-count" => $tot_count);
    $eager_loading = isset($_POST['allow_lazy']) ? $_POST['allow_lazy'] : false;
    $final_posts = get_final_posts($posts, $offset, $taxonomy, $eager_loading, $final_posts);
    // Add a top-level attribute for the taxonomy if we had a taxonomy permalink request
    if ($permalinkIsTaxonomy) {
        $final_posts['taxonomy'] = $taxonomy;
    }
    $current_user = wp_get_current_user();
    $final_posts = apply_filters('ml_posts', $final_posts, $current_user);
    //Preprocessing text for avoid "Invalid UTF-8" errors
    /*
        $charset = 'UTF-8';
        array_walk_recursive( $final_posts, function ( &$data ) use ( $charset ) {
            $data = iconv( $charset, 'UTF-8//IGNORE', $data );
        } );
    */
    $json_string = json_encode($final_posts);
    $key = http_build_query($_POST);
    set_cache('ml_json', $key, $json_string);
    echo_content($json_string);
}