Example #1
0
function blog_admin_controller()
{
    $Blog = new Blog();
    getBlogUserPermissions();
    global $blogUserPermissions, $SITEURL;
    if (!isset($_GET['update'])) {
        $update = blog_version_check();
        if ($update[0] == 'current') {
            $ucolor = '#308000';
        } elseif ($update[0] == 'update') {
            $ucolor = '#FFA500';
        } elseif ($update[0] == 'beta') {
            $ucolor = '#2B5CB3';
        } else {
            $ucolor = '#D94136';
        }
    } else {
        $ucolor = '#777777';
    }
    if (isset($_GET['edit_post']) && $blogUserPermissions['blogeditpost'] == true) {
        editPost($_GET['edit_post']);
    } elseif (isset($_GET['create_post']) && $blogUserPermissions['blogcreatepost'] == true) {
        editPost();
    } elseif (isset($_GET['categories']) && $blogUserPermissions['blogcategories'] == true) {
        if (isset($_GET['edit_category'])) {
            $add_category = $Blog->saveCategory($_POST['new_category']);
            if ($add_category == true) {
                echo '<div class="updated">' . i18n_r(BLOGFILE . '/CATEGORY_ADDED') . '</div>';
            } else {
                echo '<div class="error">' . i18n_r(BLOGFILE . '/CATEGORY_ERROR') . '</div>';
            }
        }
        if (isset($_GET['delete_category'])) {
            $Blog->deleteCategory($_GET['delete_category']);
        }
        #edit_categories
        $category_file = getXML(BLOGCATEGORYFILE);
        require_once 'html/category-management.php';
    } elseif (isset($_GET['auto_importer']) && $blogUserPermissions['blogrssimporter'] == true) {
        if (isset($_POST['post-rss'])) {
            $post_data = array();
            $post_data['name'] = $_POST['post-rss'];
            $post_data['category'] = $_POST['post-category'];
            $add_feed = $Blog->saveRSS($post_data);
            if ($add_feed == true) {
                echo '<div class="updated">' . i18n_r(BLOGFILE . '/FEED_ADDED') . '</div>';
            } else {
                echo '<div class="error">' . i18n_r(BLOGFILE . '/FEED_ERROR') . '</div>';
            }
        } elseif (isset($_GET['delete_rss'])) {
            $delete_feed = $Blog->deleteRSS($_GET['delete_rss']);
            if ($delete_feed == true) {
                echo '<div class="updated">' . i18n_r(BLOGFILE . '/FEED_DELETED') . '</div>';
            } else {
                echo '<div class="error">' . i18n_r(BLOGFILE . '/FEED_DELETE_ERROR') . '</div>';
            }
        }
        #edit_rss
        $rss_file = getXML(BLOGRSSFILE);
        require_once 'html/feed-management.php';
    } elseif (isset($_GET['settings']) && $blogUserPermissions['blogsettings'] == true) {
        show_settings_admin();
    } elseif (isset($_GET['update']) && $blogUserPermissions['blogsettings'] == true) {
        show_update_admin();
    } elseif (isset($_GET['help']) && $blogUserPermissions['bloghelp'] == true) {
        require_once 'html/help-admin.php';
    } elseif (isset($_GET['custom_fields']) && $blogUserPermissions['blogcustomfields'] == true) {
        $CustomFields = new customFields();
        if (isset($_POST['save_custom_fields'])) {
            $saveCustomFields = $CustomFields->saveCustomFields();
            if ($saveCustomFields) {
                echo '<div class="updated">' . i18n_r(BLOGFILE . '/EDIT_OK') . '</div>';
            }
        }
        show_custom_fields();
    } else {
        if (isset($_GET['save_post'])) {
            savePost();
        } elseif (isset($_GET['delete_post']) && $blogUserPermissions['blogdeletepost'] == true) {
            $post_id = urldecode($_GET['delete_post']);
            $delete_post = $Blog->deletePost($post_id);
            if ($delete_post == true) {
                echo '<div class="updated">' . i18n_r(BLOGFILE . '/POST_DELETED') . '</div>';
            } else {
                echo '<div class="error">' . i18n(BLOGFILE . '/FEED_DELETE_ERROR') . '</div>';
            }
        }
        #show_posts_admin
        $all_posts = $Blog->listPosts(true, true);
        // Get a list of all the posts in the blog
        require_once 'html/posts-admin.php';
        // Bring in the HTML to show this section
    }
}
Example #2
0
/**
* Version Check Admin Page
* Update check page for the admin area.
*
* @return void
*/
function show_update_admin()
{
    $current_version = BLOGVERSION;
    $update_data = blog_version_check();
    if ($update_data[0] == 'current') {
        $updclass = 'OKmsg';
        $updstat = 'OK';
        $lvstat = 'OK';
        $lvclass = 'hint';
    } elseif ($update_data[0] == 'update') {
        $updclass = 'WARNmsg';
        $updstat = 'Update!';
        $lvstat = 'OK';
        $lvclass = 'hint';
    } elseif ($update_data[0] == 'beta') {
        $updclass = 'INFOmsg';
        $updstat = 'OK';
        $lvstat = 'OK';
        $lvclass = 'hint';
    } else {
        $updclass = 'hint';
        $updstat = 'OK';
        $lvstat = 'Error!';
        $lvclass = 'ERRmsg';
    }
    ?>
<h3 class="floated" style="float:left;"><?php 
    i18n(LANGFILE . "/VERSION_STATUS");
    ?>
</h3>
<div class="edit-nav">
  <p class="text 1">
    &nbsp;
  </p>
  <div class="clear"></div>
</div>
<p class="text 2"><?php 
    i18n(LANGFILE . "/VERSION_STATUS_DESC");
    ?>
</p>
<table class="highlight" style="margin-bottom:20px;">
	<tbody>
		<tr>
			<td colspan="2" style="text-align:center;"><span class="hint"><?php 
    echo $update_data[3];
    ?>
</span></td>
		</tr>
		<tr>
			<td><?php 
    i18n(LANGFILE . '/VERSION_UPDATESTATUS');
    ?>
</td>
			<td style="width:100px;text-align:center;">
				<span class="<?php 
    echo $updclass;
    ?>
"><?php 
    echo $update_data[0];
    ?>
</span><br />
			</td>
		</tr>
		<tr>
			<td><?php 
    i18n(LANGFILE . '/VERSION_CURRENTVER');
    ?>
</td>
			<td style="text-align:center;"><span class="<?php 
    echo $updclass;
    ?>
"><strong><?php 
    echo $update_data[1];
    ?>
</strong> - <?php 
    echo $updstat;
    ?>
</span></td>
		</tr>
		<tr>
			<td><?php 
    i18n(LANGFILE . '/VERSION_LATESTVER');
    ?>
</td>
			<td style="text-align:center;"><span class="<?php 
    echo $lvclass;
    ?>
"><strong><?php 
    echo $update_data[2];
    ?>
</strong> - <?php 
    echo $lvstat;
    ?>
</span></td>
		</tr>
	</tbody>
</table>
<div id="version_update_information" style="border:1px solid #eee;padding:20px;">
  <?php 
    if ($update_data[4] != NULL) {
        echo $update_data[4];
    }
    ?>
</div>
<?php 
}