コード例 #1
0
ファイル: auth.php プロジェクト: JiffSoft/FacePress
 /**
  * Returns the current instance of the FPBAuth object
  * @static
  * @return FPBAuth
  */
 public static function GetInstance()
 {
     if (!FPBAuth::$_instance) {
         FPBAuth::$_instance = new FPBAuth();
     }
     return FPBAuth::$_instance;
 }
コード例 #2
0
ファイル: toolbar.php プロジェクト: JiffSoft/FacePress
function fpb_toolbar_body()
{
    $toolbar_authorized = FPBAuth::GetInstance()->IsLoggedIn() && FPBAuth::GetInstance()->IsUserAdmin();
    /**
     * The 'toolbar_pre_authorize' hook runs before the toolbar code determines if the user is authorized to utilize
     * the toolbar
     * @see Hooks
     */
    Plugins::RunHook('toolbar_pre_authorize');
    if (!$toolbar_authorized) {
        return;
    }
    $toolbar_content = <<<HTML
    <div id="fpb-admin-tb">
        <a href="#" onclick="fpb_admin_Dashboard();">
            <div class="menu-item menu-dashboard">
            </div>
        </a><a href="#" onclick="fpb_admin_Posts();">
            <div class="menu-item menu-post">
            </div>
        </a><a href="#" onclick="alert('yo');">
            <div class="menu-item menu-media">
            </div>
        </a><a href="#" onclick="alert('yo');">
            <div class="menu-item menu-comments">
            </div>
        </a><a href="#" onclick="alert('yo');">
            <div class="menu-item menu-pages">
            </div>
        </a><hr/>
        <a href="#" onclick="alert('yo');">
            <div class="menu-item menu-appearance">
            </div>
        </a><a href="#" onclick="fpb_admin_Plugins();">
            <div class="menu-item menu-plugins">
            </div>
        </a><hr/><a href="#" onclick="alert('yo');">
            <div class="menu-item menu-users">
            </div>
        </a><a href="#" onclick="alert('yo');">
            <div class="menu-item menu-tools">
            </div>
        </a><a href="#" onclick="alert('yo');">
            <div class="menu-item menu-settings">
            </div>
        </a>
    </div>
    <div id="fpb-admin-popup"><div id="fpb-admin-popup-content"></div></div>
    <div id="fpb-admin-blackout"></div>
HTML;
    Plugins::RunHook('toolbar_body_content');
    /**
     * The 'toolbar_body_content' hook runs before the toolbar code returns the HTML to be added to the end of <body> -
     * hooks should 'global $toolbar_content;' to access the content returned
     * @see Hooks
     */
    echo $toolbar_content;
}
コード例 #3
0
ファイル: debugger.php プロジェクト: JiffSoft/FacePress
function FPB_Debugger_RenderDebugDiv()
{
    global $smarty;
    $var_dump = print_r($_SESSION, true);
    $var_dump .= print_r($_REQUEST, true);
    $var_dump .= print_r($_COOKIE, true);
    $plugins = print_r(Plugins::Instance()->PluginData(), true);
    $user = print_r(FPBAuth::GetInstance()->GetUser(), true);
    $debug_contents = <<<HTML
    <hr/>
    <pre>
        {$var_dump}
    </pre>
    <pre>
        {$plugins}
    </pre>
    <pre>
        {$user}
    </pre>
HTML;
    $smarty->assign('debug', $debug_contents);
}
コード例 #4
0
ファイル: load.php プロジェクト: JiffSoft/FacePress
/**
 * The 'pre_action' hook runs just before we figure out what action we will be taking
 * @see Hooks
 */
Plugins::RunHook('pre_action');
$full_action_requested = $_SERVER['REQUEST_URI'];
ob_start();
/**
 * The 'body_pre_action' hook runs in an output buffer before the body action is performed
 * @see Hooks
 */
Plugins::RunHook('body_pre_action');
if (preg_match("|/(?<year>[0-9]{4})/(?<month>[0-9]{2})/(?<day>[0-9]{2})/(?<title>[-A-Za-z0-9_]*)/?\$|", $full_action_requested, $action_parts) != 0) {
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        // post of a comment
        if (!FPBAuth::GetInstance()->IsLoggedIn() || FPBAuth::GetInstance()->IsUserBanned()) {
            $action = '403';
            header('HTTP/1.0 403 Not authorized', true, 403);
            $smarty->assign('page_title', 'Not authorized');
        } else {
            FPBDatabase::Instance()->CreateComment($_POST);
            echo 'make comment';
        }
        // and afterwards we go back to the post
    }
    // Find a post
    $action = 'post';
    $post = FPBDatabase::Instance()->GatherPostFromURIData($action_parts);
    $comments = FPBDatabase::Instance()->GetCommentsArray($post->ID);
    if ($post == null) {
        // 404!
コード例 #5
0
ファイル: index.php プロジェクト: JiffSoft/FacePress
} else {
    // otherwise include the config
    require BASEDIR . '/config.inc.php';
}
// load up the required classes
require BASEDIR . '/fpb-includes/smarty/Smarty.class.php';
require BASEDIR . '/fpb-includes/auth.php';
require BASEDIR . '/fpb-includes/database.php';
require BASEDIR . '/fpb-includes/functions.php';
require BASEDIR . '/fpb-includes/fbhelper.php';
require BASEDIR . '/fpb-includes/spyc.php';
require BASEDIR . '/fpb-includes/plugins.php';
Plugins::Instance()->Load();
FPBAuth::GetInstance()->CheckFBStatus();
// Check for a valid admin session
$admin_authorized = FPBAuth::GetInstance()->IsLoggedIn() && FPBAuth::GetInstance()->IsUserAdmin();
/**
 * The 'admin_pre_authorize' hook runs before the admin code determines if the user is authorized to utilize
 * its functions
 * @see Hooks
 */
Plugins::RunHook('admin_pre_authorize');
if (!$admin_authorized) {
    header("HTTP/1.0 403 Access denied", true, 403);
    die('HTTP/1.0 403 Access denied');
}
/**
 * The 'admin_bootstrap' hook runs after all files have been included and before any processing occurs in the
 * admin pages
 * @see Hooks
 */
コード例 #6
0
ファイル: database.php プロジェクト: JiffSoft/FacePress
 public function CreateComment($_form_data)
 {
     $this->DirectQuery("insert into " . $this->TableName('comments') . " (user_id, comment_date, comment_content, comment_parent, comment_post_ID)\r\n            values (?,CURRENT_TIMESTAMP,?,?,?)", array(0 => FPBAuth::GetInstance()->GetUser()->id, 1 => $_form_data['content'], 2 => $_form_data['reply_ID'], 3 => $_form_data['post_ID']));
     if (mysql_error()) {
         trigger_error('Unable to create comment: ' . mysql_error());
     }
 }