Inheritance: extends Controller
Ejemplo n.º 1
0
 public function _processCreate($post)
 {
     parent::_processCreate($post);
     $uri = $this->getComponent()->getURI(array('controller=post', 'task=show', 'id=' . $post['post_id']));
     $this->setRedirect($uri);
     return false;
 }
 function perform()
 {
     // check if the password is correct
     $secretItems = new SecretItems();
     // if not, show another error
     if (!$secretItems->authenticateItem($this->_articleId, $this->_password)) {
         $this->_view = new ErrorView($this->_blogInfo, "Sorry, better luck next time!");
         $this->setCommonData();
         return false;
     }
     // but if correct, put the information in the session and try again
     $session = HttpVars::getSession();
     $sessionKey = "article_" . $this->_articleId;
     $session["{$sessionKey}"] = "OK";
     HttpVars::setSession($session);
     BlogController::setForwardAction("ViewArticle");
     return true;
 }
Ejemplo n.º 3
0
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title> Moj Blog </title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body>
    <?php 
include "blogController.php";
$controller = new BlogController();
$controller->showAllBlogs();
?>

</body>
</html>

Ejemplo n.º 4
0
//ini_set('memory_limit', "16M");
if (!defined("PLOG_CLASS_PATH")) {
    define("PLOG_CLASS_PATH", dirname(__FILE__) . "/");
}
include_once PLOG_CLASS_PATH . "class/controller/blogcontroller.class.php";
include_once PLOG_CLASS_PATH . "class/net/http/session/sessionmanager.class.php";
include_once PLOG_CLASS_PATH . "class/dao/userinfo.class.php";
include_once PLOG_CLASS_PATH . "class/dao/bloginfo.class.php";
include_once PLOG_CLASS_PATH . "class/plugin/pluginmanager.class.php";
// just to make php use &amp; as the separator when adding the PHPSESSID
// variable to our requests
ini_set("arg_seperator.output", "&amp;");
ini_set("magic_quotes_runtime", 0);
//
// a security check, or else people might forget to remove the wizard.php script
//
if (File::isReadable("wizard.php")) {
    print "<span style=\"color:red\">The wizard.php script has to be removed after the installation process.</span><br/><br/>\n               Please remove it first to continue.";
    die;
}
// initialize the session
SessionManager::init();
$controller = new BlogController();
// load the plugins, this needs to be done *before* we call the
// Controller::process() method, as some of the plugins _might_
// add new actions to the controller
$pluginManager =& PluginManager::getPluginManager();
$pluginManager->loadPlugins();
// give control to the, ehem, controller :)
$controller->process(HttpVars::getRequest(), "op");
//xdebug_dump_function_profile(4);
Ejemplo n.º 5
0
<?php

require_once 'blog/controller/blogController.php';
require_once 'session/session.php';
$session = new Session();
// Man ska alltid kunna gå in på bloggen, dock så är det i ett annat läge om man inte är inlogggad
if ($session->isLoggedIn()) {
    //Skicka ingenstans, men ha istället argument i controllern som skriver ut en sida utan möjlighet till inlägg eller något
    $blogController = new BlogController(true, $session->getUsername());
    $blogController->checkPostback();
    echo $blogController->getHTML();
} else {
    $blogController = new BlogController(false, "");
    //Borde jag verkligen ha den här här?
    $blogController->checkPostback();
    echo $blogController->getHTML();
}
Ejemplo n.º 6
0
<?php

include "blogController.php";
$controller = new BlogController();
$user_id = $_POST["user_id"];
$title = $_POST['title'];
$content = $_POST['content'];
$controller->newPost($title, $content, $user_id);
Ejemplo n.º 7
0
/**
 * user page template controller
 *
 * defined vars:
 * $userId     - user ID
 * $userHandle - user handle
 *
 * @package user
 * @subpackage template
 * @author The myTravelbook Team <http://www.sourceforge.net/projects/mytravelbook>
 * @copyright Copyright (c) 2005-2006, myTravelbook Team
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL)
 * @version $Id$
 */
$Blog = new BlogController();
$pageText = array();
$i18n = new MOD_i18n('apps/user/userpage.php');
$pageText = $i18n->getText('pageText');
?>
<h2><?php 
echo $userHandle;
?>
</h2>
<p>
<?php 
echo $pageText['default_desc'];
?>
</p>
<?php 
echo $groupChange;
 /**
  * Carries out the action
  */
 function perform()
 {
     // need to check the ip of the client
     $clientIp = Client::getIp();
     // fetch the same article again so that we can have all the comments from
     // the database, plus this last one
     $articles = new Articles();
     $article = $articles->getBlogArticle($this->_articleId, $this->_blogInfo->getId());
     // check if the user wanted to receive comments for this article
     // or not...
     if ($article->getCommentsEnabled() == false) {
         $this->_view = new ErrorView($this->_blogInfo);
         $this->_view->setValue("message", "Comments have been disabled for this article.");
         $this->setCommonData();
         return false;
     }
     $this->notifyEvent(EVENT_POST_LOADED, array("article" => &$article));
     // we have already checked all the data, so we are sure that everything's in place
     $comments = new ArticleComments();
     $comment = new UserComment($this->_articleId, $this->_parentId, $this->_commentTopic, $this->_commentText, null, $this->_userName, $this->_userEmail, $this->_userUrl, $clientIp);
     // check if there is already a comment with the same text, topic and made from the same
     // IP already in the database because if so, then we will not add the comment that
     // the user is trying to add (a reload button mistake, perhaps?)
     if (!$comments->getIdenticalComment($this->_commentTopic, $this->_commentText, $this->_articleId, $this->_parentId, $this->_userName, $this->_userEmail, $this->_userUrl, $clientIp)) {
         // fire an event
         $this->notifyEvent(EVENT_PRE_COMMENT_ADD, array("comment" => &$comment));
         if (!$comments->addComment($comment)) {
             // show an error message if problems
             $this->_view = new ErrorView($this->_blogInfo);
             $this->_view->setValue("message", "error_adding_comment");
             $this->setCommonData();
             return false;
         }
     }
     // finally, check if there was any user who wanted to be notified of new comments
     // to this post...
     $notifier = new ArticleNotifications();
     $notifier->notifyUsers($article->getId(), $this->_blogInfo);
     // fire the post event...
     $this->notifyEvent(EVENT_POST_COMMENT_ADD, array("comment" => &$comment));
     //
     // clear caches. This should be done in a more granular way, because right now
     // we're either removing *all* of them or none. I guess we should only remove the
     // cache whose identifier corresponds with the blog and article that we just removed,
     // but let's leave it as it is for the time being...
     //
     CacheControl::resetBlogCache($this->_blogInfo->getId());
     // clean up the request, there's a parameter called 'userName' also used by
     // ViewArticleAction but that doesn't have the same meaning so we better remove it
     // before it's too late! We also need to add a new request commentUserName to replace
     // original userName, in case developer need it in filter or event plugin.
     $request = HttpVars::getRequest();
     $request["commentUserName"] = $request["userName"];
     $request["userName"] = "";
     HttpVars::setRequest($request);
     // forward the action to ViewArticleAction
     return BlogController::setForwardAction("ViewArticle");
 }
Ejemplo n.º 9
0
<?php

session_start();
ini_set("display_errors", 1);
//mindent meghív a megadott mappából
function include_all_php($folder)
{
    foreach (glob("{$folder}/*.php") as $filename) {
        include $filename;
    }
}
//szükséges class-ok lérrehozása/include-olása
include_all_php('library');
include_all_php('model');
include_once 'controller/BlogController.php';
//controllerek kezelése, megfelelő alcontroller meghívása
$blog = new BlogController();
$controller_name = $blog->chooseController();
include 'controller/' . $controller_name . '.php';
Ejemplo n.º 10
0
Archivo: blog.php Proyecto: fg-ok/codev
            if (0 != $bpost->dest_user_id) {
                $destUser = UserCache::getInstance()->getUser($bpost->dest_user_id);
                $item['to'] = $destUser->getRealname();
            } else {
                if (0 != $bpost->dest_team_id) {
                    $team = TeamCache::getInstance()->getTeam($bpost->dest_team_id);
                    $item['to'] = $team->getName();
                } else {
                    if (0 != $bpost->dest_project_id) {
                        $destProj = ProjectCache::getInstance()->getProject($bpost->dest_project_id);
                        $item['to'] = $destProj->getName();
                    } else {
                        $item['to'] = '?';
                    }
                }
            }
            $item['activity'] = 'activities...';
            $item['buttons'] = "<input type='button' value='" . T_('Ack') . "' onclick='javascript: ackPost(" . $bpost->id . ")' />";
            $item['buttons'] .= "<input type='button' value='" . T_('Hide') . "' onclick='javascript: hidePost(" . $bpost->id . ")' />";
            // TODO only if i'm the owner
            $item['buttons'] .= "<input type='button' value='" . T_('Delete') . "' onclick='javascript: deletePost(" . $bpost->id . ")' />";
            $item['isHidden'] = '0';
            $blogPosts[$id] = $item;
        }
        return $blogPosts;
    }
}
// ========== MAIN ===========
BlogController::staticInit();
$controller = new BlogController('../', 'Blog', 'Blog');
$controller->execute();
Ejemplo n.º 11
0
<?php

$ctrl = new BlogController();
$callbackId = $ctrl->settingsProcess();
$vars =& PPostHandler::getVars($callbackId);
$settingsText = array();
$i18n = new MOD_i18n('apps/blog/usersettings.php');
$settingsText = $i18n->getText('settingsText');
?>
<fieldset id="blog-settings">
    <legend><?php 
echo $settingsText['title_legend'];
?>
</legend>
    <form method="post" action="user/settings/blog" class="def-form">
        <p><?php 
echo $settingsText['label_defaultvis'];
?>
:</p>
        <div class="row">
            <input type="radio" name="vis" value="p" id="blog-settings-visp"<?php 
if (isset($vars['vis']) && $vars['vis'] == 'p') {
    echo ' checked="checked"';
}
?>
/> <label for="blog-settings-visp"><?php 
echo $settingsText['label_vispublic'];
?>
</label><br/>
            <p class="desc"><?php 
echo $settingsText['description_vispublic'];