예제 #1
0
/**
 * Implementation of module_admin()
 */
function sailing_admin()
{
    global $ssc_database;
    // Work out what we want to do
    $action = array_shift($_GET['param']);
    switch ($action) {
        case 'edit':
            // Edit existing series
            $out = ssc_generate_form('sailing_series');
            break;
        case 'page':
            // Allow for paging
            array_unshift($_GET['param'], 'page');
        case 'download':
            $id = array_shift($_GET['param']);
            $csv = _ssc_sailing_get_csv($id);
            if ($csv) {
                ssc_custom_data("text/csv", $csv, "series-{$id}.csv");
            } else {
                ssc_not_found();
            }
            break;
        case '':
            $out = ssc_admin_table(t('Regattas/Series'), "SELECT s.id, name, description, path FROM #__sailing_series s \n\t\t\tLEFT JOIN #__handler h ON h.id = s.id ORDER BY path ASC", null, array('perpage' => 10, 'pagelink' => '/admin/sailing/page/', 'link' => 'name', 'linkpath' => '/admin/sailing/edit/', 'customheads' => array('Download CSV'), 'customcols' => array('Download' => '/admin/sailing/download/')));
            $out .= l(t('New series'), '/admin/sailing/edit/0');
            break;
        default:
            ssc_not_found();
            $out = '';
    }
    return $out;
}
예제 #2
0
/**
 * Implementation of module_admin()
 */
function static_admin()
{
    // Work out what we want to do
    $action = array_shift($_GET['param']);
    switch ($action) {
        case 'edit':
            $out = '';
            if (!empty($_POST['form-id']) && $_POST['form-id'] == 'static_form' && !empty($_POST['body'])) {
                if (!ssc_load_library('sscText')) {
                    ssc_add_message(SSC_MSG_WARN, t('Unable to show page preview'));
                } else {
                    $out = sscText::convert($_POST['body']);
                }
            }
            $out .= ssc_generate_form('static_form');
            break;
        case 'page':
            // Allow for paging
            array_unshift($_GET['param'], 'page');
        case '':
            $out = ssc_admin_table(t('Simple pages'), "SELECT s.id, title, path FROM #__static s \n\t\t\tLEFT JOIN #__handler h ON h.id = s.id ORDER BY path ASC", null, array('perpage' => 10, 'link' => 'title', 'linkpath' => '/admin/static/edit/'));
            $out .= l(t('New page'), '/admin/static/edit/0');
            break;
        default:
            ssc_not_found();
            $out = '';
    }
    return $out;
}
예제 #3
0
/**
 * Implementation of module_admin()
 */
function gallery_admin()
{
    global $ssc_database;
    // What aspect of admin?
    $action = array_shift($_GET['param']);
    switch ($action) {
        case 'edit':
            $out = ssc_generate_form('gallery_form');
            break;
        case 'page':
            // Cater for page calls
            array_unshift($_GET['param'], 'page');
        case '':
            // "Main" admin page - show galleries
            $out = ssc_admin_table(t('Current galleries'), "SELECT g.id, title, description, COUNT(c.id) items, if (visible, 'Yes', 'No') Visible FROM \n\t\t\t#__gallery g LEFT JOIN #__gallery_content c ON g.id = gallery_id GROUP BY gallery_id\n\t\t\tORDER BY visible DESC, title asc", null, array('perpage' => 10, 'link' => 'title', 'linkpath' => "/admin/gallery/edit/"));
            $out .= l(t('New gallery'), "/admin/gallery/edit/0");
    }
    return $out;
}
예제 #4
0
/**
 * Implementation of module_admin
 */
function events_admin()
{
    global $ssc_database;
    // Check what we're doing
    $action = array_shift($_GET['param']);
    switch ($action) {
        case 'edit':
            // Editing a particular event
            $out = ssc_generate_form('events_edit');
            break;
        case 'page':
            // Allow for paging
            array_unshift($_GET['param'], 'page');
        case '':
            $out = ssc_admin_table(t('Event list'), "SELECT id, title, date, description, uri FROM #__events ORDER BY date DESC", null, array('perpage' => 20, 'pagelink' => '/admin/events/page/', 'link' => 'title', 'linkpath' => '/admin/events/edit/'));
            $out .= l(t('New event'), '/admin/events/edit/0');
            break;
        default:
            ssc_not_found();
            $out = '';
    }
    return $out;
}
예제 #5
0
/**
 * Implements module_admin
 */
function login_admin()
{
    $out = '';
    // Work out what we want to do
    $action = array_shift($_GET['param']);
    switch ($action) {
        case 'edit':
            $out = ssc_generate_form('login_profile');
            break;
        case 'page':
            // Allow for paging
            array_unshift($_GET['param'], 'page');
        case '':
            // Main admin page - list users and groups
            //
            $out = ssc_admin_table("Users", "SELECT u.id AS ID, username, fullname, g.name AS group_name, email \n\t\t\tFROM #__user u LEFT JOIN #__group g ON g.id = u.gid \n\t\t\tORDER BY username ASC", null, array('link' => 'username', 'linkpath' => '/admin/login/edit/', 'perpage' => 30, 'pagelink' => '/admin/login/page/'));
            $out .= ssc_admin_table("Permission groups", "SELECT id AS ID, name, description \n\t\t\tFROM #__group g ORDER BY name ASC", null, array('link' => 'name', 'linkpath' => '/admin/login/gedit/'));
            break;
        default:
            ssc_not_found();
            break;
    }
    return $out;
}
예제 #6
0
파일: blog.module.php 프로젝트: scott-t/ssc
/**
 * Implementation of module_admin()
 */
function blog_admin()
{
    global $ssc_database;
    // Work out what we want to do
    $action = array_shift($_GET['param']);
    switch ($action) {
        case 'edit':
            if (!empty($_GET['param'][1]) && $_GET['param'][1] == 'post') {
                // Edit a post
                if ((isset($_POST['prev']) || isset($_POST['sub'])) && ssc_load_library('sscText')) {
                    $out = "<h2>Preview - " . (empty($_POST['title']) ? "notitle" : $_POST['title']) . "</h2>\n";
                    $out .= sscText::convert(empty($_POST['body']) ? "nobody" : $_POST['body']);
                } else {
                    $out = "";
                }
                $out .= ssc_generate_form('blog_post');
                $out .= '<hr /><h3>Comments</h3><form action="" method="post"><table class="admin-table"><tr><th><input type="hidden" name="form-id" value="blog_spam_ham" />ID</th><th>Name</th><th>Email</th><th>Comment</th><th>Action</th></tr>';
                $result = $ssc_database->query("SELECT id, author, site, email, body, status FROM #__blog_comment WHERE post_id = %d ORDER BY created ASC", $_GET['param'][2]);
                // Button to hide comment
                $sub_hide = array('#value' => 'Hide comment', '#type' => 'submit');
                $sub_show = array('#value' => 'Show comment', '#type' => 'submit');
                $sub_spam = array('#value' => 'Mark spam', '#type' => 'submit');
                $sub_ham = array('#value' => 'Unmark spam', '#type' => 'submit');
                $row = 0;
                while ($data = $ssc_database->fetch_object($result)) {
                    $out .= "<tr class=\"row" . $row++ . "\"><td>{$data->id}</td><td>" . l($data->author, $data->site) . "</td><td>" . check_plain($data->email) . "</td><td";
                    $status = $data->status;
                    if ($status & SSC_BLOG_COMMENT_SPAM) {
                        $out .= " class=\"blog-spam-icon\"";
                    } else {
                        $out .= " class=\"blog-notspam-icon\"";
                    }
                    $out .= ">" . check_plain($data->body) . "</td><td>";
                    // If tree for actions
                    if ($status & SSC_BLOG_COMMENT_CAN_SPAM) {
                        // Hasn't been re-submitted yet
                        if ($status & SSC_BLOG_COMMENT_SPAM) {
                            // Was marked as spam
                            $sub_ham['#name'] = "ham[{$data->id}]";
                            $out .= theme_render_input($sub_ham);
                            $sub_show['#name'] = "show[{$data->id}]";
                            $out .= theme_render_input($sub_show);
                        } else {
                            // Was not marked spam
                            $sub_spam['#name'] = "spam[{$data->id}]";
                            $out .= theme_render_input($sub_spam);
                            $sub_hide['#name'] = "hide[{$data->id}]";
                            $out .= theme_render_input($sub_hide);
                        }
                    } else {
                        // Has already been resubmitted
                        if ($status & SSC_BLOG_COMMENT_SPAM) {
                            // Currently spam/hidden
                            $sub_show['#name'] = "show[{$data->id}]";
                            $out .= theme_render_input($sub_show);
                        } else {
                            // Marked as normal currently
                            $sub_hide['#name'] = "hide[{$data->id}]";
                            $out .= theme_render_input($sub_hide);
                        }
                    }
                    $out .= "</td></tr>";
                }
                $out .= '</table></form>';
            } else {
                // Return list of posts to edit
                if ($_GET['param'][0] == 0) {
                    $out = '';
                } else {
                    $out = ssc_admin_table(t('Current posts'), "SELECT p.id, title, is_draft, COUNT(c.body) comments FROM #__blog_post p LEFT JOIN #__blog_comment c ON p.id = post_id\n\t\t\t\t\tWHERE blog_id = %d GROUP BY p.id ORDER BY p.created DESC", array($_GET['param'][0]), array('perpage' => 10, 'link' => 'title', 'linkpath' => "/admin/blog/edit/{$_GET['param'][0]}/post/", 'pagelink' => "/admin/blog/edit/{$_GET['param'][0]}/page/"));
                    $out .= l(t('New post'), "/admin/blog/edit/{$_GET['param'][0]}/post/0");
                }
                // List off paged posts for the specified blog
                $out .= ssc_generate_form('blog_form');
            }
            break;
        case 'page':
            // Allow for paging
            array_unshift($_GET['param'], 'page');
        case '':
            $out = ssc_admin_table(t('News pages'), "SELECT b.id, name title, path FROM #__blog b \n\t\t\tLEFT JOIN #__handler h ON h.id = b.id ORDER BY path ASC", null, array('perpage' => 10, 'link' => 'title', 'linkpath' => '/admin/blog/edit/'));
            $out .= l(t('New page'), '/admin/blog/edit/0');
            //where ryan thinks gravatar form should go with gravatar caching options and gravatar options. should there be a function or just add it straight in here
            break;
        default:
            ssc_not_found();
            $out = '';
    }
    return $out;
}