예제 #1
0
파일: index.php 프로젝트: allysha/Loggix
         $item = $e->getArticleNotFoundMessage();
     }
     // (2) Permalink
 } elseif (!empty($_GET['id'])) {
     $id = intval($_GET['id']);
     $getPermalinkSql = 'SELECT ' . '* ' . 'FROM ' . DOWNLOADS_META_TABLE . ' ' . 'WHERE ' . '(id = :id) AND (draft = :draft)';
     $getPermalinkSql = $app->setDelimitedIdentifier($getPermalinkSql);
     $stmt = $app->db->prepare($getPermalinkSql);
     $stmt->execute(array(':id' => $id, ':draft' => 0));
     $itemArray = $stmt->fetch();
     if ($itemArray == true) {
         $item = $stmt->fetch();
         $item['title_date'] = date($config['title_date_format'], strtotime($item['file_date']));
         $item = $app->setEntryItems($itemArray);
         $permalinkTemplateFile = $pathToIndex . LM_Downloads::THEME_PATH . 'parmalink.html';
         $contentsView = new Loggix_View($permalinkTemplateFile);
         $contentsVars = array('session_state' => $sessionState, 'module' => $module, 'item' => $item, 'lang' => $lang);
         $contentsView->assign($contentsVars);
         $permalinkTitle = $app->setTitle(array('Downloads', $item['file_title']));
         $item = array('title' => $permalinkTitle, 'contents' => $app->plugin->applyFilters('permalink-view', $contentsView->render()), 'pager' => '', 'result' => '');
     } else {
         $e = new Loggix_Exception();
         $item = $e->getFileNotFoundMessage();
     }
     // (3) Index View (Show Recent Entries)
 } else {
     $getLatestItemsSql = 'SELECT ' . '* ' . 'FROM ' . DOWNLOADS_META_TABLE . ' AS d ' . 'WHERE ' . "d.draft = '0' " . 'ORDER BY ' . 'd.file_date DESC ' . 'LIMIT ' . $config['page_max'];
     $countTotalItemsSql = 'SELECT ' . 'COUNT(d.id) ' . 'FROM ' . DOWNLOADS_META_TABLE . ' AS d ' . 'WHERE ' . "d.draft = '0'";
     $totalItemsCount = $app->getTotalItemsCount($countTotalItemsSql);
     $item = array('title' => $app->setTitle('Downloads'), 'contents' => $app->getArchives($getLatestItemsSql), 'pager' => $app->getPager($totalItemsCount, $pageNumberToShow = '1', $date = '', $expand = '0'), 'result' => '');
 }
예제 #2
0
파일: edit.php 프로젝트: kaz6120/Loggix
         if ($sessionState == 'on') {
             $item['admin']['password'] = $_SESSION['user_pass'];
             $editFormAdminTemplateFile = $pathToIndex . Loggix_Module_Comment::COMMENT_THEME_PATH . 'edit-form-admin.html';
             $adminEditForm = new Loggix_View($editFormAdminTemplateFile);
             $adminEditForm->assign('item', $item);
             $adminEditForm->assign('lang', $lang);
             $item['admin']['button'] = $adminEditForm->render();
         } else {
             $item['admin']['password'] = '';
             $item['admin']['button'] = '';
         }
         $item = $app->setMenuItems($sessionState);
         $smileyButton = new Loggix_View($pathToIndex . '/theme/smiley-button.html');
         $item['smiley_button'] = $smileyButton->render();
         $editFormViewFile = $pathToIndex . Loggix_Module_Comment::COMMENT_THEME_PATH . 'edit-form.html';
         $contentsView = new Loggix_View($editFormViewFile);
         $templateVars = array('item' => $item, 'lang' => $lang, 'config' => $config);
         $contentsView->assign($templateVars);
         $item['contents'] = $contentsView->render();
         // Apply plugin filter
         $item['contents'] = $app->plugin->applyFilters('comment-text', $item['contents']);
     }
 } else {
     $item['contents'] = 'Error!';
 }
 $item['title'] = $app->setTitle(array($lang['edit'], $lang['comments'] . ' No.' . $item['comments']['id']));
 // Pager
 $item['pager'] = '';
 $item['result'] = '';
 $app->display($item, $sessionState);
 // Edit Action
예제 #3
0
    if ($config['show_date_title'] == 'yes') {
        $item['show_date_title_yes'] = ' checked="checked"';
        $item['show_date_title_no'] = '';
    } else {
        $item['show_date_title_yes'] = '';
        $item['show_date_title_no'] = ' checked="checked"';
    }
    if ($config['block_ascii_only_text'] == 'yes') {
        $item['block_status_1'] = ' checked="checked"';
        $item['block_status_2'] = '';
    } else {
        $item['block_status_1'] = '';
        $item['block_status_2'] = ' checked="checked"';
    }
    // Load system info view file
    $contents = new Loggix_View($pathToIndex . '/theme/admin/preferences.html');
    $contents->assign('config', $config);
    $contents->assign('item', $item);
    $contents->assign('lang', $lang);
    $item['contents'] = $contents->render();
    // Pager
    //--------------------------
    $item['pager'] = '';
    $item['result'] = '';
    // Title
    //--------------------------
    $item['title'] = $app->setTitle($lang['system_info']);
    $app->display($item, $sessionState);
} else {
    // When session is off...
    header('Location: ../index.php');
예제 #4
0
            } elseif ($_POST['send'] == $lang['contact']['send']) {
                // Change internal encoding
                ini_set("mbstring.internal_encoding", "UTF-8");
                // Success
                if (mail($sendto, $app->getMailSubject($subject), $app->getMailBody($name, $email, $message), $app->getMailHeader($name, $email), "-f {$sendto}")) {
                    $contactTitle = 'Success!';
                    $content = $app->showInformation($contactTitle, 'info', $lang['contact']['send_success']);
                    // Failure
                } else {
                    $contactTitle = 'Failure!';
                    $content = $app->showInformation($contactTitle, 'critical', $lang['contact']['send_failure']);
                }
                // Display form
                $content .= $app->showContactForm('post', $lang['contact']['default_name'], $lang['contact']['default_email'], $lang['contact']['default_subject'], $lang['contact']['default_message']);
            } else {
                throw new Exception();
            }
        }
        // Display form
    } else {
        $contactTitle = 'Contact';
        $content = $app->showInformation($contactTitle, 'info', $lang['contact']['announce']) . $app->showContactForm('post', $lang['contact']['default_name'], $lang['contact']['default_email'], $lang['contact']['default_subject'], $lang['contact']['default_message']);
    }
} catch (Exception $e) {
    $contactTitle = '404 Not Found';
    $templateFile = $pathToIndex . '/theme/errors/data-not-found.html';
    $contentsView = new Loggix_View($templateFile);
    $content = $contentsView->render();
}
$item = array('title' => $app->setTitle($contactTitle), 'contents' => $content, 'result' => '', 'pager' => '');
$app->display($item, $sessionState);
예제 #5
0
파일: Expander.php 프로젝트: kaz6120/Loggix
 /**
  * Display XHTML
  * 
  * @param  array $item
  * @param  string $sessionState
  * @uses   setMenuItems
  * @uses   sendHttpHeaders
  * @uses   Loggix_View
  */
 public function display($item, $sessionState)
 {
     global $config, $pathToIndex, $module, $lang;
     ob_start();
     $this->getModuleLanguage();
     $item['site_title'] = $this->plugin->applyFilters('h1', $config['loggix_title']);
     // Navigation View
     $navView = new Loggix_View();
     $navView->assign('item', $item);
     $navView->assign('lang', $lang);
     $navView->assign('module', $module);
     $item['navigation'] = $this->plugin->applyFilters('navigation', $navView->render('./theme/navigation.html'));
     // Send HTTP Headers
     $this->sendHttpHeaders();
     $item['gt'] = $this->getGenerationTime(self::$startTime);
     // View
     $xhtml = new Loggix_View();
     $xhtml->assign('item', $item);
     $xhtml->assign('lang', $lang);
     $xhtml->assign('module', $module);
     echo $this->plugin->applyFilters('xhtml', $xhtml->render('./theme/base.html'));
     ob_end_flush();
 }
예제 #6
0
 /**
  * @uses   Loggix_Application
  * @uses   Loggix_View
  * @return array $item
  */
 public function getFileNotFoundMessage()
 {
     global $pathToIndex;
     $errorView = new Loggix_View($pathToIndex . Loggix_Core::LOGGIX_THEME_DIR . 'errors/file-not-found.html');
     return array('contents' => $errorView->render(), 'pager' => '', 'result' => '', 'title' => Loggix_Application::setTitle('404 Not Found'));
 }
예제 #7
0
파일: edit.php 프로젝트: kaz6120/Loggix
            $item['file_type'] = stripslashes($item['file_type']);
            $item['file_name'] = stripslashes($item['file_name']);
            $item['file_size'] = $app->toMegaByte($item['file_size']);
            switch ($item['draft']) {
                case '1':
                    $item['draft_status_1'] = ' checked="checked"';
                    $item['draft_status_0'] = '';
                    break;
                default:
                    $item['draft_status_1'] = '';
                    $item['draft_status_0'] = ' checked="checked"';
                    break;
            }
            // Contents
            $item['attachments'] = $app->setAttachments();
            $item['tag_cloud'] = $app->getTagCloudArray('Downloads');
            $smileyButton = new Loggix_View($pathToIndex . '/theme/smiley-button.html');
            $item['smiley_button'] = $smileyButton->render();
            $templateFile = $pathToIndex . LM_Downloads::THEME_PATH . 'admin/edit.html';
            $contentsView = new Loggix_View($templateFile);
            $contentsVars = array('item' => $item, 'lang' => $lang, 'config' => $config);
            $contentsView->assign($contentsVars);
            $item = array('title' => $app->setTitle(array('Downloads', $lang['edit'], $item['title'])), 'contents' => $app->plugin->applyFilters('permalink-view', $contentsView->render()), 'pager' => '', 'result' => '');
            $app->display($item, $sessionState);
        }
    } else {
        header('Location: ../index.php');
    }
} else {
    header('Location: ../index.php');
}
예제 #8
0
파일: users.php 프로젝트: kaz6120/Loggix
        if ($res) {
            header('Location : ' . $_SERVER['PHP_SELF']);
        }
    }
    // Show Tag List
    $sql = 'SELECT * FROM ' . USER_TABLE;
    $res = $app->db->query($sql);
    $tagList = '';
    if ($res) {
        $items = array();
        while ($item = $res->fetch()) {
            $sql2 = 'SELECT ' . 'COUNT(user_id) ' . 'FROM ' . USER_TABLE . ' ' . 'WHERE ' . "user_id = '" . $item['user_id'] . "'";
            $res2 = $app->db->query($sql2);
            $item['number_of_tag'] = $res2->fetchColumn();
            $item['disabled_status'] = $item['user_name'] == $_SESSION['user_name'] ? 'disabled="disabled" ' : '';
            $items[] = $item;
        }
        $contentsView = new Loggix_View($pathToIndex . '/theme/admin/users.html');
        $contentsView->assign('items', $items);
        $contentsView->assign('lang', $lang);
        $item['contents'] = $contentsView->render();
    }
    // Pager
    $item['pager'] = '';
    $item['result'] = '';
    // Title
    $item['title'] = $app->setTitle($lang['log_tag']);
    $app->display($item, $sessionState);
} else {
    header('Location: ../index.php');
}
예제 #9
0
파일: index.php 프로젝트: kaz6120/Loggix
         $item = array('title' => $title, 'contents' => $app->getArchives($sql), 'pager' => $app->getPager($totalItemsCount, $pageNumberToShow, $date, $expand), 'result' => $result);
         $getLastModifiedSql = $sql;
     } else {
         $e = new Loggix_Exception();
         $item = $e->getArticleNotFoundMessage();
     }
     // (2) Permalink
 } elseif (!empty($_GET['id'])) {
     $id = intval($_GET['id']);
     $getPermalinkSql = 'SELECT ' . '`id`, `title`, `comment`, `date`, `mod`, ' . '`draft`, `allow_comments`, `allow_pings` ' . 'FROM ' . LOG_TABLE . ' AS l ' . 'WHERE ' . "(l.id = '" . $id . "') AND (l.draft = '0')";
     $getPermalinkSql = $app->setDelimitedIdentifier($getPermalinkSql);
     $stmt = $app->db->prepare($getPermalinkSql);
     if ($stmt->execute() == true) {
         $itemArray = $stmt->fetch();
         $item = $app->setEntryItems($itemArray);
         $contentsView = new Loggix_View();
         $templateVars = array('session_state' => $sessionState, 'module' => $module, 'item' => $item, 'lang' => $lang);
         $contentsView->assign($templateVars);
         $template = $pathToIndex . '/theme/permalink.html';
         $titleDate = date($config['title_date_format'], strtotime($item['date']));
         $item = array('title_date' => $titleDate, 'title' => $app->setTitle($item['title']), 'contents' => $app->plugin->applyFilters('permalink-view', $contentsView->render($template)), 'pager' => '', 'result' => '');
         $getLastModifiedSql = $getPermalinkSql;
     } else {
         $e = new Loggix_Exception();
         $item = $e->getFileNotFoundMessage();
     }
     // (3) Index View (Show the Latest Entries)
 } else {
     $getLatestItemsSql = 'SELECT ' . '*' . 'FROM ' . LOG_TABLE . ' ' . 'WHERE ' . "draft = '0' " . 'ORDER BY ' . 'date DESC ' . 'LIMIT ' . $config['page_max'];
     $countTotalItemsSql = 'SELECT ' . 'COUNT(id) ' . 'FROM ' . LOG_TABLE . ' l ' . 'WHERE ' . "draft = '0'";
     $totalItemsCount = $app->getTotalItemsCount($countTotalItemsSql);
예제 #10
0
파일: edit.php 프로젝트: kaz6120/Loggix
            }
            switch ($item['allow_pings']) {
                case '0':
                    $item['allow_pings_status'] = '';
                    break;
                default:
                    $item['allow_pings_status'] = ' checked="checked"';
                    break;
            }
            // Contents
            $item['attachments'] = $app->setAttachments();
            $item['tag_cloud'] = $app->getTagCloudArray();
            $smileyButton = new Loggix_View($pathToIndex . '/theme/smiley-button.html');
            $smileyButton->assign('relativePath', $pathToIndex);
            $item['smiley_button'] = $smileyButton->render();
            $contents = new Loggix_View($pathToIndex . '/theme/admin/edit.html');
            $contents->assign('item', $item);
            $contents->assign('lang', $lang);
            $contents->assign('config', $config);
            $item['contents'] = $app->plugin->applyFilters('edit-entry', $contents->render());
            // Pager
            $item['pager'] = '';
            $item['result'] = '';
            $item['title'] = $app->setTitle(array($lang['edit'], $item['title']));
            $app->display($item, $sessionState);
        }
    } else {
        header('Location: ../index.php');
    }
} else {
    header('Location: ../index.php');
예제 #11
0
파일: Rss.php 프로젝트: kaz6120/Loggix
 /**
  * Convert Text to Enclosure
  *
  * @param  string $comment
  * @return string $comment
  */
 public function toEnclosure($comment)
 {
     global $pathToIndex, $item;
     preg_match_all('/<!-- ?PODCAST=.*\\.(mp3|m4a|mov|m4v) ?-->/', $comment, $matches);
     $enclosure = '';
     for ($i = 0; $i < count($matches[0]); $i++) {
         $enclosureName = substr($matches[0][$i], 13, strpos($matches[0][$i], ' -->') - 13);
         $item = $this->getEnclosureInfo($enclosureName);
         if ($item['enclosure_name'] != '' && $item['enclosure_size'] != '' && $item['enclosure_uri'] != '') {
             $item['enclosure_size'] = $this->toMegaByte($item['enclosure_size']);
             if (stristr($item['enclosure_name'], '.mov')) {
                 $item['enclosure_class'] = 'mov';
                 $item['enclosure_mime'] = 'video/quicktime';
             } elseif (stristr($item['enclosure_name'], '.m4')) {
                 $item['enclosure_class'] = 'm4';
                 $item['enclosure_mime'] = 'audio/mpeg';
             } elseif (stristr($item['enclosure_name'], '.wav')) {
                 $item['enclosure_class'] = 'wav';
                 $item['enclosure_mime'] = 'audio/mpeg';
             } else {
                 $item['enclosure_class'] = 'mp3';
                 $item['enclosure_mime'] = 'audio/mpeg';
             }
             $templateFile = $pathToIndex . self::RSS_THEME_PATH . 'podcast.html';
             $enclosureView = new Loggix_View($templateFile);
             $enclosureView->assign('item', $item);
             $enclosureText = $enclosureView->render();
             $comment = preg_replace('/' . $matches[0][$i] . '/', $enclosureText, $comment);
         }
     }
     return $comment;
 }
예제 #12
0
파일: Comment.php 프로젝트: kaz6120/Loggix
 /**
  * Get Archived item list
  *
  * @uses   getModuleLanguage
  * @uses   setEntryItems
  * @uses   View
  * @return string
  */
 public function getArchives($getItemsSql)
 {
     global $sessionState, $module, $pathToIndex, $lang;
     $this->getModuleLanguage('comment');
     $getItemsSql = $this->setDelimitedIdentifier($getItemsSql);
     $stmt = $this->db->prepare($getItemsSql);
     $stmt->execute();
     $items = array();
     try {
         while ($item = $stmt->fetch()) {
             $setItem = $this->setEntryItem($item);
             if (!in_array($item['refer_id'], $this->getDraftLogIdArray())) {
                 $items[] = $setItem;
             }
         }
         if ($_SERVER['QUERY_STRING'] && empty($items)) {
             $xhtml = '/theme/errors/file-not-found.html';
         } elseif (!empty($items)) {
             $xhtml = self::COMMENT_THEME_PATH . 'archives.html';
         } else {
             $xhtml = self::COMMENT_THEME_PATH . 'default.html';
         }
     } catch (Exception $e) {
         $xhtml = '/theme/errors/file-not-found.html';
     }
     $contents = new Loggix_View($pathToIndex . $xhtml);
     $contents->assign('session_state', $sessionState);
     $contents->assign('items', $items);
     $contents->assign('lang', $lang);
     $contents->assign('module', $module);
     return $contents->render();
 }
예제 #13
0
파일: tags.php 프로젝트: kaz6120/Loggix
        header('Location : ' . $_SERVER['PHP_SELF']);
    }
    // Show Tag List
    $sql = 'SELECT ' . '* ' . 'FROM ' . LOG_TAG_TABLE;
    $res = $app->db->query($sql);
    $tagList = '';
    if ($res) {
        $items = array();
        while ($item = $res->fetch()) {
            $sql2 = 'SELECT ' . 'COUNT(id) ' . 'FROM ' . LOG_TAG_MAP_TABLE . ' ' . 'WHERE ' . 'tag_id = :tag_id';
            $stmt = $app->db->prepare($sql2);
            $stmt->execute(array(':tag_id' => $item['id']));
            $item['number_of_tag'] = $stmt->fetchColumn();
            $item['disabled_status'] = $item['id'] == '1' ? 'disabled="disabled" ' : '';
            $item['tag_name'] = htmlspecialchars($item['tag_name']);
            $items[] = $item;
        }
        $contentsView = new Loggix_View($pathToIndex . '/theme/admin/tags.html');
        $contentsView->assign('items', $items);
        $contentsView->assign('lang', $lang);
        $item['contents'] = $app->plugin->applyFilters('permalink-view', $contentsView->render());
    }
    // Pager
    $item['pager'] = '';
    $item['result'] = '';
    // Title
    $item['title'] = $app->setTitle($lang['log_tag']);
    $app->display($item, $sessionState);
} else {
    header('Location: ../index.php');
}
예제 #14
0
파일: count.php 프로젝트: kaz6120/Loggix
 * Manage Downloads Tag
 *
 * @package  Downloads
 * @since    5.5.26
 * @version  8.3.3 
 */
/**
 * Include Download Module class
 */
$pathToIndex = '../../..';
require_once $pathToIndex . '/modules/downloads/lib/LM_Downloads.php';
$app = new LM_Downloads();
$app->getModuleLanguage('downloads');
$sessionState = $app->getSessionState();
$config = $app->getConfigArray();
if ($sessionState == 'on') {
    $items = $app->getNumberOfDownloads();
    $viewFile = $pathToIndex . LM_Downloads::THEME_PATH . 'admin/count.html';
    $contentsView = new Loggix_View($viewFile);
    $viewVars = array('items' => $items, 'lang' => $lang);
    $contentsView->assign($viewVars);
    $item['contents'] = $contentsView->render();
    // Pager
    $item['pager'] = '';
    $item['result'] = '';
    // Title
    $item['title'] = $app->setTitle($lang['dl_tag']);
    $app->display($item, $sessionState);
} else {
    header('Location: ../index.php');
}
예제 #15
0
 /**
  * Show Form
  *
  * @param  string $name
  * @param  string $email
  * @param  string $subject
  * @param  string $message
  * @return string
  */
 public function showContactForm($mode, $name, $email, $subject, $message)
 {
     global $pathToIndex, $lang, $item, $module;
     $item['cd'] = $pathToIndex;
     $item['contact']['name'] = $name;
     $item['contact']['email'] = $email;
     $item['contact']['subject'] = $subject;
     $item['contact']['message'] = $message;
     if ($mode == 'pre') {
         $contactFormTheme = $pathToIndex . self::CONTACT_THEME_PATH . 'preview-form.html';
     } else {
         $contactFormTheme = $pathToIndex . self::CONTACT_THEME_PATH . 'post-form.html';
     }
     $contents = new Loggix_View($contactFormTheme);
     $contents->assign('session_state', $sessionState);
     $contents->assign('item', $item);
     $contents->assign('lang', $lang);
     $contents->assign('module', $module);
     return $contents->render();
 }
예제 #16
0
파일: Core.php 프로젝트: kaz6120/Loggix
 /**
  * Get Admin Menu
  *
  * @param  string $sessionState
  * @uses   getMenuList
  * @uses   setXmlLanuguage
  * @return string
  */
 public function getAdminMenu($sessionState)
 {
     global $pathToIndex, $lang, $item, $id;
     $manLang = $this->setXmlLanguage();
     // Check drafts
     $sql = 'SELECT ' . 'COUNT(l.id) ' . 'FROM ' . LOG_TABLE . ' AS l ' . 'WHERE ' . "l.draft = '1'";
     $res = $this->db->query($sql);
     $rows = $res->fetchColumn();
     $numberOfDrafts = $lang['draft'] . ' (' . $rows . ')';
     // Check Downloads drafts
     $sql2 = 'SELECT ' . 'COUNT(dlm.id) ' . 'FROM ' . DOWNLOADS_META_TABLE . ' AS dlm ' . 'WHERE ' . "dlm.draft = '1'";
     $res2 = $this->db->query($sql2);
     $rows2 = $res2->fetchColumn();
     $numberOfDownloadDrafts = $lang['dl_draft'] . ' (' . $rows2 . ')';
     // Admin menu list
     $menuList1 = array($lang['logout'] => 'admin/login.php?status=logout', $lang['manage_users'] => 'admin/users.php');
     $menuList2 = array($lang['new_log'] => 'admin/write.php', $numberOfDrafts => 'admin/drafts.php', $lang['log_tag'] => 'admin/tags.php', $lang['resources'] => 'admin/resources.php');
     $menuList3 = array($lang['new_dl'] => 'modules/downloads/admin/write.php', $numberOfDownloadDrafts => 'modules/downloads/admin/drafts.php', $lang['dl_tag'] => 'modules/downloads/admin/tags.php', $lang['dl_count'] => 'modules/downloads/admin/count.php');
     $menuList4 = array($lang['preferences'] => 'admin/preferences.php', $lang['system_info'] => 'admin/info.php', $lang['manual'] => 'modules/manual/' . $manLang . '/');
     $item['admin']['list'][1] = $this->getMenuList($menuList1);
     $item['admin']['list'][2] = $this->getMenuList($menuList2);
     $item['admin']['list'][3] = $this->getMenuList($menuList3);
     $item['admin']['list'][4] = $this->getMenuList($menuList4);
     // Presentation
     if ($sessionState === 'on') {
         $templateFile = $pathToIndex . self::LOGGIX_THEME_DIR . 'admin/menu.html';
         $adminMenu = new Loggix_View($templateFile);
         $adminMenu->assign('item', $item);
         $adminMenu->assign('lang', $lang);
         return $adminMenu->render();
     } else {
         return $adminMenu = '';
     }
 }
예제 #17
0
파일: drafts.php 프로젝트: kaz6120/Loggix
     $date = $_GET['d'];
 }
 if (isset($_GET['ex'])) {
     $expand = $_GET['ex'];
 }
 $sql = 'SELECT ' . '* ' . 'FROM ' . LOG_TABLE . ' ' . 'WHERE ' . 'draft = :draft ' . 'ORDER BY ' . 'date DESC ' . 'LIMIT ' . $page . ', ' . $config['page_max'];
 $stmt = $app->db->prepare($sql);
 $res = $stmt->execute(array(':draft' => 1));
 if ($res) {
     $items = array();
     while ($item = $stmt->fetch()) {
         $item = $app->setEntryItems($item);
         $items[] = $item;
     }
     $templateFile = $pathToIndex . '/theme/admin/drafts.html';
     $contentsView = new Loggix_View($templateFile);
     $contentsVars = array('items' => $items, 'lang' => $lang);
     $contentsView->assign($contentsVars);
     //$item['contents'] = $contentsView->render();
     $item['contents'] = $app->plugin->applyFilters('permalink-view', $contentsView->render());
 } else {
     $item['contents'] = '';
 }
 // Pager
 $countSql = 'SELECT COUNT(id) FROM ' . LOG_TABLE . " WHERE draft = '1'";
 $countRes = $app->db->query($countSql);
 $totalItemsCount = $countRes->fetchColumn();
 $item['pager'] = $app->getPager($totalItemsCount, 'all', '', '1');
 $item['result'] = '';
 // Title
 $item['title'] = $app->setTitle($lang['draft']);
예제 #18
0
파일: Calendar.php 프로젝트: kaz6120/Loggix
 /**
  * Create calendar
  *
  * @param  $mode  mode:== 'search' | 'admin' | 'access' | 'downloads'
  * @return string 
  */
 public function createCalendar()
 {
     global $pathToIndex, $item, $lang;
     // Set calendar mode
     $mode = $this->setMode();
     // Get calendar module language
     $this->getModuleLanguage('calendar');
     // Enable simple queries
     if (empty($_GET['k']) && empty($_GET['p']) && empty($_GET['pn']) && empty($_GET['c'])) {
         $_GET['k'] = '';
         $_GET['p'] = '0';
         $_GET['pn'] = '1';
         $_GET['c'] = '0';
     }
     // If the date query is sent, regard it as a key value.
     // if not, use the current date as a key.
     if (!empty($_GET['d'])) {
         $dateStr = $_GET['d'];
         if (preg_match('/^[0-9]{4}-[0-9]{2}/', $dateStr)) {
             $yyyy = substr($dateStr, 0, 4);
             $mm = substr($dateStr, 5, 2);
             $dayKey = getdate(mktime(0, 0, 0, $mm, 1, $yyyy));
         } else {
             $dayKey = getdate();
         }
     } else {
         $dayKey = getdate();
     }
     // Variable $dayKey is an array, so pull out the list data
     // and split it into the separated variables.
     $mon = $dayKey['mon'];
     $mday = $dayKey['mday'];
     $year = $dayKey['year'];
     // init log list
     $targetMonth = sprintf("%4d-%02d", $year, $mon);
     $this->initMonthArray($targetMonth, $mode);
     // For Navigation
     $monthFormat = self::$config['language'] == 'japanese' ? 'n月' : 'M';
     $thisMonth = date('Y-m', mktime(0, 0, 0, $mon, 1, $year));
     $prevMonth = date('Y-m', mktime(0, 0, 0, $mon, 0, $year));
     $nextMonth = date('Y-m', mktime(0, 0, 0, $mon + 1, 1, $year));
     $prevMonthLink = date($monthFormat, mktime(0, 0, 0, $mon, 0, $year));
     $nextMonthLink = date($monthFormat, mktime(0, 0, 0, $mon + 1, 1, $year));
     // Title date format
     $formatYearAndMonth = self::$config['language'] == 'japanese' ? 'Y年 n月' : 'F Y';
     $yearAndMonth = date($formatYearAndMonth, strtotime($mday . ' ' . $dayKey['month'] . ' ' . $year));
     // Days of the week
     $dayOfTheWeek = self::$config['language'] == 'japanese' ? array('日', '月', '火', '水', '木', '金', '土') : array('S', 'M', 'T', 'W', 'T', 'F', 'S');
     // Initialize the Calendar body
     $calendarBody = '';
     // Days of the previous month
     $first_day = getdate(mktime(0, 0, 0, $mon, 1, $year));
     $weekDay = $first_day['wday'];
     for ($i = 0; $i < $weekDay; $i++) {
         $calendarBody .= '<td class="day-of-prev-month">*</td>' . "\n";
     }
     // Change directory
     if ($mode == 'file' || $mode == 'forum') {
         $calDir = '.';
         $targetFile = 'index';
         $caption = 'Forum';
     } elseif ($mode == 'admin') {
         $calDir = '../..';
         $targetFile = 'index';
         $caption = $lang['calendar']['log_calendar'];
     } elseif ($mode == 'access') {
         $calDir = '../../modules/access';
         $targetFile = 'index';
         $caption = $lang['calendar']['access_calendar'];
     } elseif ($mode == 'comments') {
         $calDir = '../../modules/comment';
         $targetFile = 'index';
         $caption = $lang['calendar']['comments_calendar'];
     } elseif ($mode == 'trackbacks') {
         $calDir = '../../modules/trackback';
         $targetFile = 'index';
         $caption = $lang['calendar']['trackbacks_calendar'];
     } elseif ($mode == 'downloads') {
         $calDir = preg_match('/\\/downloads\\/admin\\//', $this->getRequestUri()) ? '../../../modules/downloads' : '../../modules/downloads';
         $targetFile = 'index';
         $caption = $lang['calendar']['downloads_calendar'];
     } else {
         $calDir = $pathToIndex;
         $targetFile = 'index';
         $caption = $lang['calendar']['log_calendar'];
     }
     // Start making calendar
     $day = 1;
     while (checkdate($mon, $day, $year)) {
         $day2digitsWithLeadingZeros = sprintf('%02d', $day);
         if ($this->hasLog($day2digitsWithLeadingZeros, $mode)) {
             $targetDate = sprintf("%4d-%02d-%02d", $year, $mon, $day);
             $uri = $calDir . '/' . $targetFile . '.php?d=' . $targetDate . '&amp;ex=1';
             $dateStr = '<td class="log-exists"><a href="' . $uri . '">' . $day . '</a></td>';
         } else {
             $dateStr = '<td>' . $day . "</td>\n";
         }
         switch ($weekDay) {
             case '0':
                 // When Sundays(0th day), add start tags ("<tr>") to start table rows.
                 if ($day == 1) {
                     $calendarBody .= $dateStr;
                 } else {
                     $calendarBody .= "<tr>\n" . $dateStr;
                 }
                 break;
             case '6':
                 // When Saturdays(6th day), add "</tr>" elements to break table rows.
                 $calendarBody .= $dateStr . "</tr>\n";
                 break;
             default:
                 $calendarBody .= $dateStr;
                 break;
         }
         $day++;
         $weekDay++;
         $weekDay = $weekDay % 7;
     }
     // Days of the next month
     if ($weekDay > 0) {
         while ($weekDay < 7) {
             $calendarBody .= '<td class="day-of-next-month">*</td>' . "\n";
             $weekDay++;
         }
         $calendarBody .= "</tr>\n";
     } else {
         $calendarBody .= '';
     }
     $item['calendar']['month_array'] = $this->_allMonthArray;
     $item['calendar']['year_array'] = $this->_allYearArray;
     $item['calendar']['caption'] = $caption;
     $item['calendar']['dir'] = $calDir;
     $item['calendar']['target'] = $targetFile;
     $item['calendar']['this_month'] = $thisMonth;
     $item['calendar']['year_and_month'] = $yearAndMonth;
     $item['calendar']['day_of_the_week'] = $dayOfTheWeek;
     $item['calendar']['prev_month'] = $prevMonth;
     $item['calendar']['prev_month_link'] = $prevMonthLink;
     $item['calendar']['next_month'] = $nextMonth;
     $item['calendar']['next_month_link'] = $nextMonthLink;
     $item['calendar']['body'] = $calendarBody;
     $calendarView = new Loggix_View($pathToIndex . self::CALENDAR_THEME_PATH . 'calendar.html');
     $calendarView->assign('item', $item);
     return $calendarView->render();
 }
예제 #19
0
 /**
  * Get Archived item list
  *
  * @uses   getModuleLanguage
  * @uses   setEntryItems
  * @uses   Loggix_View
  * @return string
  */
 public function getArchives($res)
 {
     global $sessionState, $module, $pathToIndex, $lang;
     $this->getModuleLanguage('trackback');
     $items = array();
     try {
         while ($item = $res->fetch()) {
             $setItem = $this->setEntryItem($item);
             if (!in_array($item['blog_id'], $this->getDraftLogIdArray())) {
                 $items[] = $setItem;
             }
         }
         if ($_SERVER['QUERY_STRING'] && empty($items)) {
             $xhtml = '/theme/errors/file-not-found.html';
         } elseif (!empty($items)) {
             $xhtml = self::TRACKBACK_THEME_PATH . 'archives.html';
         } else {
             $xhtml = self::TRACKBACK_THEME_PATH . 'default.html';
         }
     } catch (Exception $e) {
         $xhtml = '/theme/errors/file-not-found.html';
     }
     $contents = new Loggix_View($pathToIndex . $xhtml);
     $contents->assign('session_state', $sessionState);
     $contents->assign('items', $items);
     $contents->assign('lang', $lang);
     $contents->assign('module', $module);
     return $contents->render();
 }
예제 #20
0
파일: index.php 프로젝트: allysha/Loggix
                $result = '';
            } else {
                $contents = $app->getArchives($sql);
                $pager = $app->getPager($totalItemsCount, $pageNumberToShow, $date, $expand);
                $templateFile = $pathToIndex . '/theme/' . $resultTemplateFile;
                $resultView = new Loggix_View($templateFile);
                $item = $app->setSearchItems($res, $totalItemsCount, $previousItemNumber, $date);
                $resultView->assign('item', $item);
                $resultView->assign('lang', $lang);
                $result = $resultView->render();
            }
            // Contents, Pager, and Results
            $item['contents'] = $contents;
            $item['pager'] = $pager;
            $item['result'] = $result;
            $item['title'] = !empty($_GET['c']) ? $app->setTitle(array($item['keyword'], $lang['archive'])) : $app->setTitle($lang['archive']);
        }
        // (2) Index View (Show Recent Entries)
    } else {
        $sql = 'SELECT ' . '* ' . 'FROM ' . COMMENT_TABLE . ' ' . 'WHERE ' . "trash = '0' " . 'GROUP BY ' . 'refer_id ' . 'ORDER BY ' . 'date DESC ' . 'LIMIT ' . $config['page_max'];
        $countTotalItemsSql = 'SELECT ' . 'COUNT(id) ' . 'FROM ' . COMMENT_TABLE . ' ' . 'WHERE ' . "trash = '0' " . 'GROUP BY ' . 'refer_id';
        $countRes = $app->db->query($countTotalItemsSql);
        $totalItemsCount = count($countRes->fetchAll());
        $item = array('title' => $app->setTitle('Comments'), 'contents' => $app->getArchives($sql), 'pager' => $app->getPager($totalItemsCount, $pageNumberToShow = '1', $date = '', $expand = '0'), 'result' => '');
    }
} catch (Exception $e) {
    $templateFile = $pathToIndex . '/theme/errors/data-not-found.html';
    $contentsView = new Loggix_View($templateFile);
    $item = array('title' => $app->setTitle('404 Not Found'), 'contents' => $contentsView->render(), 'pager' => '', 'result' => '');
}
$app->display($item, $sessionState);
예제 #21
0
 /**
  * Display XHTML
  * 
  * @param  array $item
  * @param  string $sessionState
  * @uses   setMenuItems
  * @uses   sendHttpHeaders
  * @uses   View
  */
 public function display($item, $sessionState)
 {
     global $pathToIndex, $module, $lang, $getLastModifiedSql;
     // ob_start('ob_gzhandler');
     ob_start();
     $item['site_title'] = $this->plugin->applyFilters('h1', self::$config['loggix_title']);
     if (strpos($this->getRequestURI(), 'downloads')) {
         $this->getModuleLanguage('downloads');
         $lang['search_key'] = $lang['downloads']['search_key'];
     } else {
         if (strpos($this->getRequestURI(), 'comment')) {
             $this->getModuleLanguage('comment');
             $lang['search_key'] = $lang['comment']['search_key'];
         } else {
             if (strpos($this->getRequestURI(), 'trackback')) {
                 $this->getModuleLanguage('trackback');
                 $lang['search_key'] = $lang['trackback']['search_key'];
             }
         }
     }
     // Navigation View
     $templateFile = $pathToIndex . parent::LOGGIX_THEME_DIR . 'navigation.html';
     $navView = new Loggix_View($templateFile);
     $navView->assign('item', $this->setMenuItems($sessionState));
     $navView->assign('lang', $lang);
     $navView->assign('module', $module);
     $item['navigation'] = $this->plugin->applyFilters('navigation', $navView->render());
     // Send HTTP Headers
     $this->sendHttpHeaders($getLastModifiedSql);
     $item['gt'] = $this->getGenerationTime(self::$startTime);
     // Render XHTML View
     $xhtml = new Loggix_View();
     $xhtml->assign('module', $module);
     $xhtml->assign('item', $item);
     echo $xhtml->render($pathToIndex . parent::LOGGIX_THEME_DIR . 'base.html');
     ob_end_flush();
 }
예제 #22
0
 /**
  * Get Archived item list
  *
  * @uses   getModuleLanguage
  * @uses   getAdminEditMenu
  * @uses   setEntryItems
  * @uses   Loggix_View
  * @uses   Loggix_Exception
  * @return string $contentsView
  */
 public function getArchives($getItemsSql)
 {
     global $sessionState, $item, $module, $pathToIndex, $lang;
     $this->getModuleLanguage('downloads');
     $getItemsSql = $this->setDelimitedIdentifier($getItemsSql);
     $stmt = $this->db->prepare($getItemsSql);
     $items = array();
     if ($stmt->execute() == true) {
         while ($item = $stmt->fetch()) {
             $item = $this->setEntryItems($item);
             $items[] = $item;
         }
         $templateFile = $pathToIndex . self::THEME_PATH . 'archives.html';
         $contentsView = new Loggix_View($templateFile);
         $templateVars = array('session_state' => $sessionState, 'items' => $items, 'lang' => $lang, 'module' => $module);
         $contentsView->assign($templateVars);
     } else {
         if (!$_SERVER['QUERY_STRING']) {
             $templateFile = $pathToIndex . self::THEME_PATH . 'default.html';
             $contentsView = new Loggix_View($templateFile);
             $templateVars = array('config' => self::$config, 'lang' => $lang);
             $contentsView->assign($templateVars);
         } else {
             throw new Loggix_Exception();
         }
     }
     return $this->plugin->applyFilters('downloads-index-view', $contentsView->render());
 }
예제 #23
0
파일: login.php 프로젝트: kaz6120/Loggix
 */
$pathToIndex = '..';
require_once $pathToIndex . '/lib/Loggix/Application.php';
$app = new Loggix_Application();
$sessionState = $app->getSessionState();
$config = $app->getConfigArray();
$item = $app->setMenuItems($sessionState);
// Logout
if (isset($_REQUEST['status']) == 'logout') {
    $sessionState = $app->getOutOfSession();
    if ($sessionState == 'off') {
        header('Location: ' . $pathToIndex . '/index.php');
    }
}
// Session
if ($sessionState == 'on') {
    header('Location: ' . $pathToIndex . '/index.php');
} else {
    // When session is off...
    $contents = new Loggix_View($pathToIndex . '/theme/admin/login.html');
    $contents->assign('lang', $lang);
    $item['contents'] = $contents->render();
}
// Pager
//--------------------------
$item['pager'] = '';
$item['result'] = '';
// Title
//--------------------------
$item['title'] = $app->setTitle(array());
$app->display($item, $sessionState);
예제 #24
0
파일: 2.0.php 프로젝트: kaz6120/Loggix
        $extension = '.text';
        $contents = new Loggix_View($resource . $extension);
        $retrievedContents = $theRss->fixMarkdown(Markdown($contents->render()));
    } elseif (file_exists($resource . '.txt')) {
        $extension = '.txt';
        $contents = new Loggix_View($resource . $extension);
        $retrievedContents = $contents->render();
    } else {
        $extension = '.html';
        $contents = new Loggix_View($resource . $extension);
        $retrievedContents = $contents->render();
    }
    // Comment to Content Module
    $retrievedContents = str_replace('./data/resources/', $theRss->getRootUri() . $expanderDir . '/data/resources/', $retrievedContents);
    $item['title'] = $theRss->setTitle($config['title']);
    $item['link'] = $theRss->getRootUri() . $resourceUri;
    $item['content_encoded'] = $retrievedContents;
    $item['date'] = date($theRss->getRssTimeFormat('2.0'), filemtime($resource . $extension)) . $theRss->getTimeZone();
    $item['enclosure'] = '';
    $item['description'] = '';
    $items[] = $item;
    $xml['loggix_title'] = $theRss->setTitle($config['title']);
    $xml['root_uri'] = $theRss->getRootUri() . 'index.php';
    $xml['rss_uri'] = $theRss->getRootUri() . $resourceUri;
    $xml['last_modified'] = $item['date'];
    header("Content-type: application/xml");
    $rssVersion2 = new Loggix_View();
    $rssVersion2->assign('items', $items);
    $rssVersion2->assign('xml', $xml);
    $rssVersion2->display($pathToIndex . '/modules/rss/theme/rss.2.0.xml');
}