예제 #1
0
 public function install($position = 0)
 {
     if (!mkdir(PATH_PLUGINS_DB . $this->dir_name, 0777, true)) {
         return false;
     }
     // Template
     $xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
     $xml .= '<plugin>';
     $xml .= '</plugin>';
     // Object
     $new_obj = new NBXML($xml, 0, FALSE, '', FALSE);
     // Default attributes
     $new_obj->addAttribute('name', $this->name);
     $new_obj->addAttribute('author', $this->author);
     $new_obj->addAttribute('version', $this->version);
     $new_obj->addAttribute('installed_at', Date::unixstamp());
     // Default fields
     $new_obj->addChild('position', $position);
     $new_obj->addChild('title', $this->name);
     foreach ($this->fields as $field => $value) {
         $new_obj->addChild($field, $value);
     }
     if (!$new_obj->asXml(PATH_PLUGINS_DB . $this->dir_name . '/db.xml')) {
         return false;
     }
     return true;
 }
예제 #2
0
 private function get_items($file)
 {
     $xml = new NBXML(PATH_POSTS . $file, 0, TRUE, '', FALSE);
     $file_info = explode('.', $file);
     $content = (string) $xml->getChild('content');
     $tmp_content = explode("<!-- pagebreak -->", $content);
     $tmp_array = array('read_more' => false);
     $tmp_array['filename'] = (string) $file;
     $tmp_array['id'] = (int) $file_info[1];
     $tmp_array['id_cat'] = (int) $file_info[2];
     $tmp_array['id_user'] = (int) $file_info[3];
     $tmp_array['mode'] = (string) $file_info[4];
     $tmp_array['draft'] = (bool) ($file_info[4] == 'draft');
     $tmp_array['visits'] = (int) $xml->getChild('visits');
     $tmp_array['type'] = (string) $xml->getChild('type');
     $tmp_array['title'] = (string) $xml->getChild('title');
     $tmp_array['description'] = (string) $xml->getChild('description');
     $tmp_array['pub_date_unix'] = (string) $xml->getChild('pub_date');
     $tmp_array['mod_date_unix'] = (string) $xml->getChild('mod_date');
     $tmp_array['allow_comments'] = (bool) (int) $xml->getChild('allow_comments') == 1;
     // Slug
     $tmp_array['slug'] = $this->slug_get($tmp_array['id']);
     // CONTENT
     $tmp_array['content'][0] = $content;
     $tmp_array['content'][1] = $tmp_content[0];
     if (isset($tmp_content[1])) {
         $tmp_array['content'][2] = $tmp_content[1];
         $tmp_array['read_more'] = true;
     }
     // POST TYPE
     if ($tmp_array['type'] == 'video') {
         $tmp_array['video'] = (string) $xml->getChild('video');
     } elseif ($tmp_array['type'] == 'quote') {
         $tmp_array['quote'] = (string) $xml->getChild('quote');
     }
     return $tmp_array;
 }
예제 #3
0
 $xml .= '<pages autoinc="1">';
 $xml .= '<friendly></friendly>';
 $xml .= '</pages>';
 $obj = new NBXML($xml, 0, FALSE, '', FALSE);
 $obj->asXml(FILE_XML_PAGES);
 // notifications.xml
 $xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
 $xml .= '<notifications>';
 $xml .= '</notifications>';
 $obj = new NBXML($xml, 0, FALSE, '', FALSE);
 $obj->asXml(FILE_XML_NOTIFICATIONS);
 // users.xml
 $xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
 $xml .= '<users>';
 $xml .= '</users>';
 $obj = new NBXML($xml, 0, FALSE, '', FALSE);
 $node = $obj->addGodChild('user', array('username' => $_POST['username']));
 $node->addChild('id', 0);
 $node->addChild('session_fail_count', 0);
 $node->addChild('session_date', 0);
 $obj->asXml(FILE_XML_USERS);
 // shadow.php
 $new_salt = Text::random_text(11);
 $new_hash = Crypt::get_hash($_POST['password'], $new_salt);
 $text = '<?php $_USER[0]["uid"] = "0"; $_USER[0]["username"] = "******"; $_USER[0]["password"] = "******"; $_USER[0]["salt"] = "' . $new_salt . '"; $_USER[0]["email"] = "' . $_POST['email'] . '"; ?>';
 $file = fopen(FILE_SHADOW, 'w');
 fputs($file, $text);
 fclose($file);
 // keys.php
 $key1 = Crypt::get_hash(Text::random_text(11));
 $key2 = Crypt::get_hash(Text::random_text(11));
예제 #4
0
 private function get_items($file)
 {
     $xml = new NBXML(PATH_PAGES . $file, 0, TRUE, '', FALSE);
     $file_info = explode('.', $file);
     $tmp_array['content'] = $xml->getChild('content');
     $tmp_array['filename'] = $file;
     $tmp_array['id'] = (int) $file_info[0];
     $tmp_array['draft'] = $file_info[3] == 'draft';
     $tmp_array['visits'] = $xml->getChild('visits');
     $tmp_array['title'] = $xml->getChild('title');
     $tmp_array['description'] = $xml->getChild('description');
     $tmp_array['position'] = $xml->getChild('position');
     $tmp_array['keywords'] = $xml->getChild('keywords');
     $tmp_array['pub_date_unix'] = $xml->getChild('pub_date');
     $tmp_array['mod_date_unix'] = $xml->getChild('mod_date');
     // Slug
     $tmp_array['slug'] = $this->slug_get($tmp_array['id']);
     return $tmp_array;
 }
예제 #5
0
 private function get_items($file)
 {
     $xml = new NBXML(PATH_COMMENTS . $file, 0, TRUE, '', FALSE);
     $file_info = explode('.', $file);
     include FILE_KEYS;
     $user_ip = Crypt::decrypt((string) $xml->getChild('author_ip'), $_KEYS[1]);
     $user_email = Crypt::decrypt((string) $xml->getChild('author_email'), $_KEYS[1]);
     $tmp_array = array();
     $tmp_array['filename'] = (string) $file;
     $tmp_array['id'] = (int) $file_info[0];
     $tmp_array['id_post'] = (int) $file_info[1];
     $tmp_array['id_user'] = (int) $file_info[2];
     $tmp_array['type'] = (string) $file_info[3];
     $tmp_array['author_email'] = $user_email;
     $tmp_array['author_ip'] = $user_ip;
     $tmp_array['author_name'] = (string) $xml->getChild('author_name');
     $tmp_array['content'] = (string) $xml->getChild('content');
     $tmp_array['pub_date_unix'] = (string) $xml->getChild('pub_date');
     $tmp_array['highlight'] = (bool) ((int) $xml->getChild('content') == 1);
     $tmp_array['pub_date'] = Date::format($tmp_array['pub_date_unix'], $this->settings['timestamp_format']);
     return $tmp_array;
 }
예제 #6
0
$obj = new NBXML(FILE_XML_COMMENTS, 0, TRUE, '', FALSE);
add_if_not($obj, 'comments_enabled', 1);
add_if_not($obj, 'moderate', 1);
add_if_not($obj, 'sanitize', 1);
add_if_not($obj, 'monitor_enable', 0);
add_if_not($obj, 'monitor_api_key', '');
add_if_not($obj, 'monitor_spam_control', '0.75');
add_if_not($obj, 'monitor_auto_delete', 0);
add_if_not($obj, 'disqus_shortname', '');
add_if_not($obj, 'facebook_appid', '');
$obj->asXml(FILE_XML_COMMENTS);
echo Html::p(array('class' => 'pass', 'content' => 'DB updated: ' . FILE_XML_COMMENTS));
// =====================================================
// Categories
// =====================================================
$obj = new NBXML(FILE_XML_CATEGORIES, 0, TRUE, '', FALSE);
$position = 0;
foreach ($obj->children() as $children) {
    // Slug
    $name = utf8_decode((string) $children->attributes()->name);
    $slug = Text::clean_url($name, '-', $translit_enable);
    @$children->addAttribute('slug', '');
    $children->attributes()->slug = utf8_encode($slug);
    // Position
    @$children->addAttribute('position', '');
    $children->attributes()->position = utf8_encode($position);
    $position++;
}
$obj->asXml(FILE_XML_CATEGORIES);
echo Html::p(array('class' => 'pass', 'content' => 'Categories updated...'));
// =====================================================