Пример #1
0
    $_REQUEST['source'] = pieCleanString($_REQUEST['source']);
    $_REQUEST['title'] = pieGetOption($_REQUEST['title']);
    $_REQUEST['comment'] = pieGetOption($_REQUEST['comment']);
} elseif (file_exists($preview)) {
    // Read source and meta data from temporary preview file.
    if (!($dump = file_get_contents($preview))) {
        pieError("SourceReadError");
    }
    $meta = pieExplodePage($dump);
    foreach (array('source', 'title', 'comment') as $i) {
        $_REQUEST[$i] = $meta[$i];
    }
    unset($meta);
} elseif ($page->exists($_REQUEST['page'])) {
    // The page already exists. Use and edit the existing source.
    $diff = new Increment();
    if (!($meta = $diff->readPage($_REQUEST['page'], $_REQUEST['stamp']))) {
        pieError("SourceVersionMissing");
    }
    $_REQUEST['source'] = $meta['source'];
    if ($_REQUEST['section'] > 0) {
        $section = new Section();
        // Extract the specified section.
        if (($_REQUEST['source'] = $section->extract($meta['source'], $_REQUEST['section'])) === false) {
            pieError('SectionNotFound');
        }
    }
    if ($meta['type'] == "alias") {
        // The existing page is an alias.
        if ($_REQUEST['overwrite']) {
            // Replace the alias by a new page.
Пример #2
0
    $meta['title'] = pieGetOption($_REQUEST['title']);
}
if (@$_REQUEST['comment']) {
    $meta['comment'] = pieGetOption($_REQUEST['comment']);
}
if (count($compiler->pages)) {
    $list = array_keys($compiler->pages);
    sort($list);
    $meta['pages'] = implode(" ", $list);
}
if (count($compiler->files)) {
    $list = array_keys($compiler->files);
    sort($list);
    $meta['files'] = implode(" ", $list);
}
$diff = new Increment();
if (!$diff->writePage($page->name, $meta)) {
    pieError("SourceWriteError");
}
if ($GLOBALS['pie']['page_caching']) {
    $cache = new Cache();
    $cid = $cache->key('page', array('page' => $_REQUEST['page']));
    if (!($f = fopen($cache->file($cid), 'w'))) {
        pieError("CacheWriteError");
    }
    if (!fwrite($f, $compiler->output)) {
        pieError("CacheWriteError");
    }
    fclose($f);
}
// Clean up.
Пример #3
0
 public function display_qstn($qid_no)
 {
     /*if(isset($_POST['submit'])==TRUE){
     		$this->form_validation->set_rules('reply','Answer','trim|required|max_length[4000]|xxs_clean|htmlspecialchars');
     		if($this->form_validation->run()==TRUE){
     				$obj=new Get_reply;
     				$obj->userid=$this->session->userdata('userid');
     				$obj->q_id=$qid_no;
     				$obj->reply=$this->input->post('reply');
     				$obj->store_reply();
     				$obj2=Increment::get_replies($qid_no);
     				Increment::increplies($qid_no,$obj2->replies);
     			}
     		}
     		*/
     $data['qid_no'] = $qid_no;
     $data['message'] = "";
     $obj1 = Increment::get_views($qid_no);
     Increment::incviews($qid_no, $obj1->views);
     $this->load->view('header/header_with', $data);
     $this->load->view('disp_qstn', $data);
     //$this->load->view('sidebar/right_sidebar',$data);
     $this->load->view('footer/footer', $data);
 }
Пример #4
0
pieHead();
$_REQUEST['page'] = pieGetOption(@$_REQUEST['page']);
$_REQUEST['old'] = intval(@$_REQUEST['old']);
$_REQUEST['new'] = intval(@$_REQUEST['new']);
if (!@$_REQUEST['sort']) {
    $_REQUEST['sort'] = 'descending';
}
$page = new Page();
if (!$page->isValidName(@$_REQUEST['page'])) {
    pieError('PageNameInvalid');
}
if (!$page->exists(@$_REQUEST['page'])) {
    pieError('PageNotFound');
}
if (@$_REQUEST['old'] > 0 && @$_REQUEST['new'] > 0) {
    $diff = new Increment();
    if (!($old = $diff->readPage($_REQUEST['page'], $_REQUEST['old']))) {
        pieError('SourceVersionMissing');
    }
    if (!($new = $diff->readPage($_REQUEST['page'], $_REQUEST['new']))) {
        pieError('SourceVersionMissing');
    }
    $cache = new Cache();
    $cid = $cache->key('diff', array('old' => $_REQUEST['old'], 'new' => $_REQUEST['new']));
    if ($GLOBALS['pie']['query_caching'] && $cache->exists($cid)) {
        // Use existing cache.
        $data = file_get_contents($cache->file($cid));
        $cache->update($cid);
    } else {
        // Create diff from two versions.
        if (!($data = $diff->diff($old['source'], $new['source']))) {