Esempio n. 1
0
 static function check_content(GBExposedContent $obj)
 {
     if (!$obj) {
         return;
     }
     # already have meta values?
     $eval = null;
     foreach ($obj->meta as $k => $v) {
         if ($k === 'php-eval') {
             $eval = $v;
             break;
         }
     }
     if ($eval === null) {
         # no php-eval meta, so let's check the body for PHP tags
         if (strpos($obj->body, '<?') !== false && strpos($obj->body, '?>') !== false) {
             $eval = 'request';
         }
     } else {
         # normalize custom meta value
         if (is_string($eval)) {
             $eval = strtolower($eval);
         }
         if ($eval !== 'request' && $eval !== 'rebuild') {
             if (gb_strbool($eval, true) === true) {
                 $eval = 'request';
             } else {
                 unset($obj->meta['php-eval']);
                 $obj->body = strtr($obj->body, array('<?' => '&lt;?', '?>' => '&gt;?'));
                 $eval = null;
             }
         }
     }
     # eval now, at rebuild?
     if ($eval === 'rebuild') {
         ob_start();
         eval('?>' . $obj->body . '<?');
         $obj->body = ob_get_clean();
     }
 }
Esempio n. 2
0
 function parseHeaderFields()
 {
     parent::parseHeaderFields();
     # transfer order meta tag
     static $order_aliases = array('order', 'sort', 'priority');
     foreach ($order_aliases as $singular) {
         if (isset($this->meta[$singular])) {
             $this->order = $this->meta[$singular];
             unset($this->meta[$singular]);
         }
     }
     # transfer hidden meta tag
     static $hidden_aliases = array('hidden', 'hide', 'invisible');
     foreach ($hidden_aliases as $singular) {
         if (isset($this->meta[$singular])) {
             $s = $this->meta[$singular];
             $this->hidden = $s === '' || gb_strbool($s);
             unset($this->meta[$singular]);
         }
     }
 }
Esempio n. 3
0
        }
        gb::log(LOG_WARNING, 'unable to exactly deduce timezone -- guessing %s%d', $mindiff < 0 ? '-' : '+', $mindiff);
        return $mindiff;
    }
}
@ini_set('max_execution_time', '0');
set_time_limit(0);
gb::$title[] = 'Import Wordpress';
if (isset($_FILES['wpxml'])) {
    if ($_FILES['wpxml']['error']) {
        gb::$errors[] = 'file upload failed with unknown error (maybe you forgot to select the file?).';
    }
    if (!gb::$errors) {
        $importer = new WordpressImporter();
        $importer->includeAttachments = @gb_strbool($_POST['include-attachments']);
        $importer->includeComments = @gb_strbool($_POST['include-comments']);
    }
    include_once '../_header.php';
    ?>
<style type="text/css">
		div.msg {
			border-top:1px solid #ddd;
		}
		div.msg.error { background:#fed; }
		div.msg p.time {
			float:left;
			font-family:monospace;
			color:#357;
			width:15%;
			margin:5px 0;
		}
Esempio n. 4
0
function gb_filter_post_reload_content_get_conf(GBExposedContent $c)
{
    $conf = array('auto_linebreaks' => true, 'auto_paragraphs' => true);
    if (isset($c->meta['auto-linebreaks'])) {
        $conf['auto_linebreaks'] = gb_strbool($c->meta['auto-linebreaks']);
        unset($c->meta['auto-linebreaks']);
    }
    if (isset($c->meta['auto-paragraphs'])) {
        $conf['auto_paragraphs'] = gb_strbool($c->meta['auto-paragraphs']);
        unset($c->meta['auto-paragraphs']);
    }
    return $conf;
}