예제 #1
0
 *     list given in the XML document.
 */
function admin_topics()
{
    global $_GET;
    global $_POST;
    /*
     * Identify and store the submitted form values to be retained and
     * re-displayed on the form
     */
    $form_attrs['tid'] = $_GET['tid'];
    if (!$form_attrs['tid']) {
        $form_attrs['tid'] = $_POST['tid'];
    }
    $form_attrs['title'] = $_POST['title'];
    $form_attrs['owner'] = $_POST['owner'];
    $form_attrs['role'] = $_POST['role'];
    $form_attrs['approved'] = $_POST['approved'];
    /*
     * Define rules for what database queries should be used
     */
    if ($form_attrs['tid']) {
        $qry_ary['top_list'] = "SELECT topics.id, users.name as owner, t_role AS t_role, " . "DATE_FORMAT( topics.started, \"%e %b %Y\" ) as opened, " . "topics.name AS title, is_approved " . "FROM topics, users " . "WHERE topics.id = '" . $form_attrs['tid'] . "' " . "AND topics.t_owner = users.id";
    }
    /*
     * Create the form
     */
    $form_string = make_form("topics.xml", "", $form_attrs, $qry_ary);
}
$form_str = admin_topics();
echo $form_str;
예제 #2
0
파일: topics.php 프로젝트: ECP-Black/ECP
function get_topic_pics($pic = '')
{
    $pics = '<option value="0">' . CHOOSE . '</option>';
    $folder = scan_dir('images/topics/', true);
    foreach ($folder as $value) {
        $pic == $value ? $sub = 'selected' : ($sub = '');
        $pics .= '<option ' . $sub . ' value="' . $value . '">' . $value . '</option>';
    }
    return $pics;
}
if (!isset($_SESSION['rights']['admin']['topics']) and !isset($_SESSION['rights']['superadmin'])) {
    table(ERROR, NO_ADMIN_RIGHTS);
} else {
    if (isset($_GET['func'])) {
        switch ($_GET['func']) {
            case 'add':
                admin_topics_add();
                break;
            case 'edit':
                admin_topics_edit((int) $_GET['id']);
                break;
            case 'del':
                admin_topics_del((int) $_GET['id']);
                break;
            default:
                admin_topics();
        }
    } else {
        admin_topics();
    }
}