Ejemplo n.º 1
0
         $note['title'] = htmlspecialchars($data['title']);
         #$note['teaser'] = htmlspecialchars($data['teaser']);
         $note['text'] = $data['text'];
         $note['text_formatting'] = $data['text_formatting'];
         $note['link'] = htmlspecialchars($data['link']);
         $note['linkname'] = htmlspecialchars($data['linkname']);
         $note['time'] = date("Y-m-d H:i:s", $data['time']);
         $headline = $note['title'];
         $template->assign('note', $note);
         $action = 'edit_note';
     } else {
         $action = 'invalid_request';
     }
 }
 if (isset($_GET['move_up'])) {
     if ($note_section = move_up($_GET['move_up'], 'note_section', Database::$db_settings['notes_table'])) {
         if (isset($cache) && $cache->autoClear) {
             $cache->clear();
         }
         header('Location: ' . BASE_URL . ADMIN_DIR . 'index.php?mode=notes&edit=' . $note_section);
         exit;
     } else {
         $action = 'invalid_request';
     }
 }
 if (isset($_GET['move_down'])) {
     if ($note_section = move_down($_GET['move_down'], 'note_section', Database::$db_settings['notes_table'])) {
         if (isset($cache) && $cache->autoClear) {
             $cache->clear();
         }
         header('Location: ' . BASE_URL . ADMIN_DIR . 'index.php?mode=notes&edit=' . $note_section);
 * Page for displaying and editing profile fields.
 */
require_once '../inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'languages.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'menu.inc.php';
// Check if administrator is logged in.  If not display login form.
$logged['admin'] = member_auth(1);
$_page['header'] = 'Member Menu';
$_page['css_name'] = 'memb_menu.css';
// Check GET variables.
if (isset($_GET['ID']) && 'move_up' == $_GET['action']) {
    move_up($_GET['ID']);
    compileMenus();
    header('location:' . $_SERVER['PHP_SELF']);
}
if (isset($_GET['ID']) && 'move_down' == $_GET['action']) {
    move_down($_GET['ID']);
    compileMenus();
    header('location:' . $_SERVER['PHP_SELF']);
}
if ($_GET['ID'] && 'delete' == $_GET['action']) {
    // Process deleting
    delete_item($_GET['ID'], $res);
    compileMenus();
    header('location:' . $_SERVER['PHP_SELF']);
}
if (isset($_POST['Add'])) {
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'languages.inc.php';
// Check if administrator is logged in.  If not display login form.
$logged['admin'] = member_auth(1);
$_page['header'] = 'Profile Fields';
$_page['css_name'] = 'profile_fields.css';
// List of mandatory fields.
$mandatory = array('NickName', 'Sex', 'Email', 'LookingFor', 'Password', 'Password,Password1', 'Status', 'Country', 'City', 'Tags', 'zip', 'Headline', 'DescriptionMe', 'DateOfBirth', 'EmailFlag', 'EmailNotify');
TopCodeAdmin();
ContentBlockHead("");
// Check GET variables.
if ($_GET['ID'] && 'move_up' == $_GET['action']) {
    $query_str = "SELECT * FROM `ProfilesDesc` ORDER BY `order` ASC";
    $res = db_res($query_str);
    // Process moving
    if (!move_up($_GET['ID'], $res)) {
        echo "<p><span style=\"color:#ff6666;font-weight:bold\">Can't move up field.</span></p>\n";
    } else {
        $modified = (int) $_GET['ID'];
    }
}
if ($_GET['ID'] && 'move_down' == $_GET['action']) {
    $query_str = "SELECT * FROM `ProfilesDesc` ORDER BY `order` ASC";
    $res = db_res($query_str);
    // Process moving
    if (!move_down($_GET['ID'], $res)) {
        echo "<p><span style=\"color:#ff6666;font-weight:bold\">Can't move down field.</span></p>\n";
    } else {
        $modified = (int) $_GET['ID'];
    }
}
function main_code()
{
    global $site;
    global $modified;
    switch ($_REQUEST['action']) {
        // menu to move field to another join page
        case 'edit':
            // get element name, etc
            $id = (int) $_GET['id'];
            // get properties of field by it's id
            $query = "SELECT `name`, `namedisp`, `join_page`, FLOOR(`join_page` / 1000) as `jp`, `check` FROM `ProfilesDesc` WHERE `ID` = '{$id}'";
            $field_arr = db_arr($query);
            if (!$field_arr) {
                return "";
            }
            // calculate number of join pages
            $query = "SELECT FLOOR(`join_page` / 1000) as `jp` FROM `ProfilesDesc` WHERE `visible` & 2 AND (FIND_IN_SET('0',`show_on_page`) OR FIND_IN_SET('3',`show_on_page`)) AND `join_page` >= 1000 GROUP BY `jp`";
            $respd = db_res($query);
            $pages_num = mysql_num_rows($respd);
            $pages_num++;
            $content = "\n\t\t\t\t<form name=\"j_editform\" id=\"j_editform\" action=\"{$_SERVER['PHP_SELF']}\" method=\"POST\">\n\t\t\t\t\t<table width=\"100%\">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td valign=\"top\">\n\t\t\t\t\t\t\t\tField name - " . $field_arr['name'] . "<br />\n\t\t\t\t\t\t\t\tField caption - " . _t($field_arr['namedisp']) . "<br />\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td valign=\"top\">\n\t\t\t\t\t\t\t\tselect part of join page:&nbsp;\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"action\" value=\"change_page\">\n\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"id\" value=\"{$id}\">\n\t\t\t\t\t\t\t\t<select name=\"new_jp\" id=\"j_page\" onchange=\"javascript: document.forms['j_editform'].submit();\">\n\t\t\t\t\t\t\t\t\t<option value=\"0\">invisible</option>";
            for ($i = 1; $i <= $pages_num; $i++) {
                $selected = $i == $field_arr['jp'] ? 'selected' : '';
                $content .= "\n\t\t\t\t\t\t\t\t\t<option value=\"{$i}\" {$selected}>join page, part {$i}</option>";
            }
            $content .= "\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td valign=\"top\">\n\t\t\t\t\t\t\t\t<a href=\"{$_SERVER['PHP_SELF']}\">Back</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</form>";
            return $content;
            // reset join form
        // reset join form
        case 'reset':
            $query = "UPDATE `ProfilesDesc` SET `join_page` = `order` + 1000";
            $respd = db_res($query);
            break;
            // move field to another join page
        // move field to another join page
        case 'change_page':
            $res = db_res("SELECT `ID`, `name`, `namedisp`, `join_page`, `type`, `group_mark`, FLOOR(`join_page` / 1000) as `jp` FROM `ProfilesDesc` WHERE `visible` & 2 AND (FIND_IN_SET('0',`show_on_page`) OR FIND_IN_SET('3',`show_on_page`)) ORDER BY `join_page` ASC");
            // Process deleting
            change_page($_POST['id'], $_POST['new_jp'], $res);
            echo "<p><span style=\"color:#ff6666;font-weight:bold\">Join page changed.</span></p>\n";
            $modified = (int) $_POST['id'];
            break;
        case 'up':
            $res = db_res("SELECT `ID`, `name`, `namedisp`, `join_page`, `type`, `group_mark`, FLOOR(`join_page` / 1000) as `jp` FROM `ProfilesDesc` WHERE `visible` & 2 AND (FIND_IN_SET('0',`show_on_page`) OR FIND_IN_SET('3',`show_on_page`)) ORDER BY `join_page` ASC");
            if (!move_up($_GET['id'], $res)) {
                echo "<p><span style=\"color:#ff6666;font-weight:bold\">Can't move up field.</span></p>\n";
            } else {
                $modified = (int) $_GET['id'];
            }
            break;
        case 'down':
            $res = db_res("SELECT `ID`, `name`, `namedisp`, `join_page`, `type`, `group_mark`, FLOOR(`join_page` / 1000) as `jp` FROM `ProfilesDesc` WHERE `visible` & 2 AND (FIND_IN_SET('0',`show_on_page`) OR FIND_IN_SET('3',`show_on_page`)) ORDER BY `join_page` ASC");
            if (!move_down($_GET['id'], $res)) {
                echo "<p><span style=\"color:#ff6666;font-weight:bold\">Can't move down field.</span></p>\n";
            } else {
                $modified = (int) $_GET['id'];
            }
            break;
    }
    $reset_link = "<a href=\"{$_SERVER['PHP_SELF']}?action=reset\">reset join form to default</a><br>&nbsp;<br>";
    return $reset_link . display_fields();
}