コード例 #1
0
ファイル: adminFunctions.php プロジェクト: hatasu/appdroid
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
    }
}
コード例 #2
0
ファイル: tabledefs_custom.php プロジェクト: Jacquesvw/phpBMS
 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE   |
 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.    |
 |                                                                         |
 +-------------------------------------------------------------------------+
*/
include "../../include/session.php";
include "include/fields.php";
include "include/tabledefs_custom.php";
//Make sure table definition id is set
if (!isset($_GET["id"])) {
    $error = new appError(200, "Passed variable not set");
}
if (!hasRights("Admin")) {
    goURL(APP_PATH . "noaccess.php");
}
$customFields = new customFields($db, (int) $_GET["id"]);
$pageTitle = "Custom Fields: " . formatVariable($customFields->tableinfo["displayname"]);
if (isset($_POST["custom1name"])) {
    $statusmessage = $customFields->process($_POST);
}
$phpbms->cssIncludes[] = "pages/base/tablecustom.css";
$phpbms->jsIncludes[] = "modules/base/javascript/tablecustom.js";
//Form Elements
//==============================================================
$theform = $customFields->prepFields();
$theform->jsMerge();
//==============================================================
//End Form Elements
include "header.php";
$phpbms->showTabs("tabledefs entry", "tab:2ebf956d-5e39-c7d5-16b7-501b64685a5a", (int) $_GET["id"]);
?>
コード例 #3
0
/** 
* Display Custom Fields in admin "Edit/Create Post" page
* 
* @return void
*/
function displayCustomFields($area = 'options')
{
    global $SITEURL;
    if (isset($_GET['edit_post'])) {
        $id = $_GET['edit_post'];
        $file = BLOGPOSTSFOLDER . $id . '.xml';
        $data_edit = getXML($file);
    }
    // SimpleXML to read from
    $CustomFields = new customFields();
    $customFields = $CustomFields->getCustomFields();
    $customFieldsArea = $customFields[$area];
    if (!$customFields || count($customFields) <= 0) {
        return;
    }
    // Editor settings (copied from edit.php)
    if (defined('GSEDITORLANG')) {
        $EDLANG = GSEDITORLANG;
    } else {
        $EDLANG = 'en';
    }
    if (defined('GSEDITORTOOL')) {
        $EDTOOL = GSEDITORTOOL;
    } else {
        $EDTOOL = 'basic';
    }
    if (defined('GSEDITOROPTIONS') && trim(GSEDITOROPTIONS) != "") {
        $EDOPTIONS = ", " . GSEDITOROPTIONS;
    } else {
        $EDOPTIONS = '';
    }
    if ($EDTOOL == 'advanced') {
        $toolbar = "\r\n\t\t['Bold', 'Italic', 'Underline', 'NumberedList', 'BulletedList', 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock', 'Table', 'TextColor', 'BGColor', 'Link', 'Unlink', 'Image', 'RemoveFormat', 'Source'],\r\n\t\t'/',\r\n\t\t['Styles','Format','Font','FontSize']\r\n\t\t";
    } elseif ($EDTOOL == 'basic') {
        $toolbar = "['Bold', 'Italic', 'Underline', 'NumberedList', 'BulletedList', 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock', 'Link', 'Unlink', 'Image', 'RemoveFormat', 'Source']";
    } else {
        $toolbar = GSEDITORTOOL;
    }
    // Editor settings end
    $col = 0;
    $uploader_col = 0;
    foreach ($customFieldsArea as $the) {
        $key = strtolower($the['key']);
        $label = $the['label'];
        $type = $the['type'];
        $value = isset($_GET['edit_post']) && $_GET['edit_post'] != "" ? $data_edit->{$key} : '';
        $meta_class = $col % 2 ? 'even_meta' : 'odd_meta';
        switch ($type) {
            case 'textfull':
                // draw a full width TextBox
                echo '<p style="width:100%;">';
                if ($label != '') {
                    echo '<label>' . $label . ':</label>';
                }
                echo '<input class="text" type="text" style="width:533px;" id="post-' . $key . '" name="post-' . $key . '" value="' . $value . '" /></p>';
                $col += 2;
                break;
            case 'dropdown':
                echo '<p class="' . $meta_class . '">';
                if ($label != '') {
                    echo '<label>' . $label . ':</label>';
                }
                echo '<select id="post-' . $key . '" name="post-' . $key . '" class="text shorts">';
                if ($key == 'category') {
                    category_dropdown($data_edit->category);
                } else {
                    foreach ($the['options'] as $option) {
                        $attrs = $value == $option ? ' selected="selected"' : '';
                        echo '<option value="' . $option . '" ' . $attrs . '>' . $option . '</option>';
                    }
                }
                echo '</select></p>';
                $col++;
                break;
            case 'checkbox':
                if ($value != '') {
                    $checked = 'checked="checked"';
                } else {
                    $checked = '';
                }
                if ($label != '') {
                    echo '<p class="' . $meta_class . '"><label>' . $label . '?</label>';
                }
                echo '<input type="checkbox" class="checkp" id="post-' . $key . '" name="post-' . $key . '" value="on" ' . $checked . '/></p><div style="clear:both;"></div>';
                $col++;
                break;
            case "textarea":
                echo '<p style="width:100%;">';
                if ($label != '') {
                    echo '<label>' . $label . ':</label>';
                }
                echo '<textarea id="post-' . $key . '" name="post-' . $key . '" style="width:635px !important; height:420px;line-height:18px;text-align:left;	color:#333;
				border:1px solid #aaa;">' . $value . '</textarea></p>';
                ?>
				<script type="text/javascript" src="template/js/ckeditor/ckeditor.js"></script>
				<script type="text/javascript">
				// missing border around text area, too much padding on left side, ...
				$(function() {
					CKEDITOR.replace( 'post-<?php 
                echo $key;
                ?>
', {
						skin : 'getsimple',
						forcePasteAsPlainText : false,
						language : '<?php 
                echo $EDLANG;
                ?>
',
						defaultLanguage : '<?php 
                echo $EDLANG;
                ?>
',
						entities : false,
						uiColor : '#FFFFFF',
						height: '200px',
						baseHref : '<?php 
                echo $SITEURL;
                ?>
',
						toolbar : [ <?php 
                echo $toolbar;
                ?>
 ],
						<?php 
                echo $EDOPTIONS;
                ?>
						filebrowserBrowseUrl : 'filebrowser.php?type=all',
						filebrowserImageBrowseUrl : 'filebrowser.php?type=images',
						filebrowserWindowWidth : '730',
						filebrowserWindowHeight : '500'
					})
				});
				</script>
				<?php 
                $col += 2;
                break;
            case 'text':
            default:
                echo '<p class="' . $meta_class . '">';
                if ($label != '') {
                    echo '<label>' . $label . ':</label>';
                }
                echo '<input class="text short" type="text" id="post-' . $key . '" name="post-' . $key . '" value="' . $value . '" /></p>';
                $col++;
                break;
            case "hidden":
                echo '';
                echo '<input class="' . $meta_class . '" class="" type="hidden" id="post-' . $key . '" name="post-' . $key . '" value="' . $value . '" />';
                break;
            case "title":
                echo '<p>';
                if ($label != '') {
                    echo '<label>' . $label . ':</label>';
                }
                echo '<input class="text title" name="post-' . $key . '" id="post-' . $key . '" type="text" value="' . $value . '" /></p>';
        }
        if ($uploader_col >= 3) {
            $uploader_col = 0;
        }
        if ($col >= 2) {
            $col = 0;
        }
    }
    echo '<div style="clear:both;"></div>';
}
コード例 #4
0
ファイル: blog.php プロジェクト: hatasu/appdroid
/** 
* Handles conditionals for admin functions
* 
* @return void
*/
function blog_admin_controller()
{
    $Blog = new Blog();
    getBlogUserPermissions();
    global $blogUserPermissions;
    showAdminNav();
    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(BLOGFILE . '/CATEGORY_ADDED');
                echo '</div>';
            } else {
                echo '<div class="error">';
                i18n(BLOGFILE . '/CATEGORY_ERROR');
                echo '</div>';
            }
        }
        if (isset($_GET['delete_category'])) {
            $Blog->deleteCategory($_GET['delete_category']);
        }
        edit_categories();
    } 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(BLOGFILE . '/FEED_ADDED');
                echo '</div>';
            } else {
                echo '<div class="error">';
                i18n(BLOGFILE . '/FEED_ERROR');
                echo '</div>';
            }
        } elseif (isset($_GET['delete_rss'])) {
            $delete_feed = $Blog->deleteRSS($_GET['delete_rss']);
            if ($delete_feed == true) {
                echo '<div class="updated">';
                i18n(BLOGFILE . '/FEED_DELETED');
                echo '</div>';
            } else {
                echo '<div class="error">';
                i18n(BLOGFILE . '/FEED_DELETE_ERROR');
                echo '</div>';
            }
        }
        edit_rss();
    } elseif (isset($_GET['settings']) && $blogUserPermissions['blogsettings'] == true) {
        show_settings_admin();
    } elseif (isset($_GET['help']) && $blogUserPermissions['bloghelp'] == true) {
        show_help_admin();
    } 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(BLOGFILE . '/POST_DELETED');
                echo '</div>';
            } else {
                echo '<div class="error">';
                i18n(BLOGFILE . '/FEED_DELETE_ERROR');
                echo '</div>';
            }
        }
        show_posts_admin();
    }
}