Example #1
0
 function getPage()
 {
     $data = array();
     // if there is no path, load the index
     if (empty($this->data['path'])) {
         $page = new Page(1);
     } else {
         $page = new Page();
         $page->get_page_from_path($this->data['path']);
     }
     // see if we have found a page
     if ($page->get('id')) {
         // store the information of the page
         /*
         $data['id'] = $this->data['id'] = $page->get('id');
         $data['title'] = stripslashes( $page->get('title') );
         $data['content'] = stripslashes( $page->get('content') );
         $data['tags'] = stripslashes( $page->get('tags') );
         $data['date'] = strtotime( stripslashes( $page->get('date') ) );
         */
         $data = $page->getAll();
         // check if the page has been classified as a category
         $this->category = strpos($data['tags'], "category") > -1 ? true : false;
         $data['path'] = $this->data['path'];
         //$data['view'] = getPath('views/main/body.php');
         $this->data['body'][] = $data;
         // FIX #38: copy data of "static" pages in a separate array for easy access
         $this->data['_page'] = $data;
         $this->data['template'] = stripslashes($page->get('template'));
         return true;
     } else {
         return false;
     }
 }
<?php

$objForm = new Form($this->objUrl);
$objForm->post2Url('srch');
$search = $this->objUrl->get('srch');
$search = urldecode(stripslashes($search));
$objPage = new Page($this->objLanguage);
if (!empty($search)) {
    $pages = $objPage->getAll(array('name' => $search, 'content' => $search, 'meta_title' => $search, 'meta_description' => $search, 'meta_keywords' => $search));
} else {
    $pages = $objPage->getAll();
}
$objPaging = new Paging($this->objUrl, $this->objLanguage, $pages, 10);
$pages = $objPaging->getRecords();
$paging = $objPaging->getPaging();
require_once 'header.php';
?>

<h1><?php 
echo $this->objLanguage->labels[7];
?>
</h1>

<form method="post" id="search">
	<table cellpadding="0" cellspacing="0" border="0" class="tbl_repeat">
		<tr>
			<th>
				<input type="text" name="srch" id="srch" class="table-field fll mrr4" value="<?php 
echo $search;
?>
">
Example #3
0
                                <th style="vertical-align: top">Bottom Desc</th>
                                <th style="vertical-align: top">Keyword</th>
                                <th style="vertical-align: top">Title</th>
                                <th style="vertical-align: top">Desc</th>
                                <th style="vertical-align: top">Author</th>
                                <th style="vertical-align: top">Date</th>
                                <th style="vertical-align: top">Modified By</th>
                                <th style="vertical-align: top">Access Type</th>
                                <th style="vertical-align: top">Status</th>
                                <th style="vertical-align: top">Actions</th>
                            </tr>
                        </thead>
                        <tbody>
                                <?php 
$pageObj = new Page();
$rows = $pageObj->getAll();
foreach ($rows as $row) {
    ?>
                            <tr>
                                <td class="center"><?php 
    echo $row['page_id'];
    ?>
</td>
                                <td class="center"><?php 
    echo $row['category_name'];
    ?>
</td>
                                <td class="center"><?php 
    echo $row['name'];
    ?>
</td>
Example #4
0
 function edit($id = null)
 {
     $page = new Page($id);
     // see if we have found a page
     if ($page->get('id')) {
         $data = $page->getAll();
         // clean up this old logic...
         $data['id'] = $this->data['id'] = $page->get('id');
         //$data['title'] = stripslashes( $page->get('title') );
         //$data['content'] = stripslashes( $page->get('content') );
         $data['path'] = $this->data['path'] = $page->get('path');
         $data['tags'] = $page->get('tags');
         $data['view'] = getPath('views/admin/edit_page.php');
         $data['status'] = $this->data['status'] = "edit";
         // presentation variables
         $data['template'] = $page->get('template');
     } else {
         $data['status'] = $this->data['status'] = "error";
         $data['view'] = getPath('views/admin/error.php');
     }
     // Now render the output
     $this->data['body'][] = $data;
     $this->data['template'] = ADMIN_TEMPLATE;
     // trigger event
     Event::trigger('admin:edit', $this->data);
     // display the page
     Template::output($this->data);
 }
 public function addLanguage($label = null)
 {
     if (!empty($label)) {
         $sql = "INSERT INTO `{$this->table}`\n\t\t\t\t\t(`name`) VALUES (?)";
         if ($this->Db->insert($sql, $label)) {
             $id = $this->Db->_id;
             $languages = $this->getAll();
             $values = array();
             if (!empty($languages)) {
                 $sql = "START TRANSACTION;";
                 foreach ($languages as $language) {
                     $sql .= "INSERT INTO `{$this->table_5}`\n\t\t\t\t\t\t\t\t(`language_id`, `language`, `label`)\n\t\t\t\t\t\t\t\tVALUES (?, ?, ?);";
                     $values[] = $id;
                     $values[] = $language['id'];
                     $values[] = $label;
                     $sql .= "INSERT INTO `{$this->table_5}`\n\t\t\t\t\t\t\t\t(`language_id`, `language`, `label`)\n\t\t\t\t\t\t\t\tVALUES (?, ?, ?);";
                     $values[] = $language['id'];
                     $values[] = $id;
                     $values[] = $language['label'];
                 }
                 $sql .= "INSERT INTO `{$this->table_5}`\n\t\t\t\t\t\t\t(`language_id`, `language`, `label`)\n\t\t\t\t\t\t\tVALUES (?, ?, ?);";
                 $values[] = $id;
                 $values[] = $id;
                 $values[] = $label;
                 $objPage = new Page();
                 $pages = $objPage->getAll();
                 if (!empty($pages)) {
                     foreach ($pages as $page) {
                         $sql .= "INSERT INTO `{$this->table_7}`\n\t\t\t\t\t\t\t\t\t(`page`, `language`, `name`, `content`,\n\t\t\t\t\t\t\t\t\t`meta_title`, `meta_description`,\n\t\t\t\t\t\t\t\t\t`meta_keywords`)\n\t\t\t\t\t\t\t\t\tVALUES (?, ?, ?, ?, ?, ?, ?);";
                         $values[] = $page['id'];
                         $values[] = $id;
                         $values[] = $page['name'];
                         $values[] = $page['content'];
                         $values[] = $page['meta_title'];
                         $values[] = $page['meta_description'];
                         $values[] = $page['meta_keywords'];
                     }
                 }
                 $objNavigation = new Navigation();
                 $navigation_types = $objNavigation->getAllTypes();
                 if (!empty($navigation_types)) {
                     foreach ($navigation_types as $navigation_type) {
                         $sql .= "INSERT INTO `{$this->table_8}`\n\t\t\t\t\t\t\t\t\t(`navigation`, `language`, `label`)\n\t\t\t\t\t\t\t\t\tVALUES (?, ?, ?);";
                         $values[] = $navigation_type['navigation'];
                         $values[] = $id;
                         $values[] = $navigation_type['label'];
                     }
                 }
                 $label_types = $this->getTypes();
                 if (!empty($label_types)) {
                     foreach ($label_types as $label_type) {
                         $sql .= "INSERT INTO `{$this->table_6}`\n\t\t\t\t\t\t\t\t\t(`label`, `language`, `content`)\n\t\t\t\t\t\t\t\t\tVALUES (?, ?, ?);";
                         $values[] = $label_type['label'];
                         $values[] = $id;
                         $values[] = $label_type['name'];
                     }
                 }
                 if (!empty($this->labels)) {
                     foreach ($this->labels as $key => $value) {
                         $sql .= "INSERT INTO `{$this->table_3}`\n\t\t\t\t\t\t\t\t\t(`label`, `language`, `content`)\n\t\t\t\t\t\t\t\t\tVALUES (?, ?, ?);";
                         $values[] = $key;
                         $values[] = $id;
                         $values[] = $value;
                     }
                 }
                 $sql .= "COMMIT;";
                 return $this->Db->execute($sql, $values);
             }
             return false;
         }
         return false;
     }
     return false;
 }
                    } else {
                        echo json_encode(array('error' => false));
                    }
                } else {
                    echo json_encode(array('error' => true));
                }
            } else {
                echo json_encode(array('error' => true));
            }
            break;
    }
} else {
    $this->addScript('/admin/js/jquery.tablednd_0_5.js');
    $navigations = $objNavigation->getAllTypes();
    $objPage = new Page($this->objLanguage);
    $pages = $objPage->getAll();
    $main = $objNavigation->getRecords(1);
    $left = $objNavigation->getRecords(2);
    $footer = $objNavigation->getRecords(3);
    require_once 'header.php';
    ?>

<h1><?php 
    echo $this->objLanguage->labels[10];
    ?>
</h1>

<form method="post" class="form-add">
	<select name="type" id="type" class="field fll mrr4">
		<option value=""><?php 
    echo $this->objLanguage->labels[43];