$data = $base_instance->get_data("SELECT default_link_category FROM {$base_instance->entity['USER']['MAIN']} WHERE ID='{$userid}'");
    $category_id = $data[1]->default_link_category;
}
#
$select_box = $misc_instance->build_category_select_box(0, $userid, 0, $category_id);
if (!$select_box) {
    $cat_title = 'New Category:';
    $select_category = '&nbsp;<input type="text" name="new_category" size="50" value="' . $new_category . '">';
} else {
    $cat_title = 'Category:';
    $select_category = '&nbsp;<select name="category_id"><option selected value=0>-- Choose Category --' . $select_box . '</select> or

<tr><td align="right"><b>New Category:</b></td><td align="left">&nbsp;<input type="text" name="new_category" size="50" value="' . $new_category . '"></td></tr>';
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Add Link &nbsp;&nbsp; <a href="help-link.php" target="_blank">[Help]</a>', 'TEXT_CENTER' => $text, 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BODY' => 'onLoad="javascript:self.focus();document.form1.url.focus()"', 'INNER_TABLE_WIDTH' => '500', 'TD_WIDTH' => '25%', 'BUTTON_TEXT' => 'Save Link'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'url', 'VALUE' => "{$url}", 'SIZE' => 50, 'TEXT' => 'URL'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => "{$cat_title}", 'TEXT2' => "{$select_category}", 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => "{$title}", 'SIZE' => 50, 'TEXT' => 'Title'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'subtitle', 'VALUE' => "{$subtitle}", 'SIZE' => 50, 'TEXT' => 'Subtitle'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'speed', 'VALUE' => "{$speed}", 'OPTION' => 'speed_array', 'TEXT' => 'Ascent Speed', 'DO_NO_SORT_ARRAY' => 1));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'sequence', 'VALUE' => "{$sequence}", 'SIZE' => 10, 'TEXT' => 'Sequence ID'));
$html_instance->add_form_field(array('TYPE' => 'radio', 'NAME' => 'public', 'FIELD_ARRAY' => 'public_array', 'VALUE' => "{$public}", 'TEXT' => 'Link is'));
if (!$number_of_days && !$number_of_hours && !$number_of_mins) {
    $number_of_days = 30;
}
if ($mode == 1) {
    $m1_checked = ' CHECKED';
} else {
    $m1_checked = '';
}
if ($mode == 2) {
require 'class.base.php';
require 'class.html.php';
$base_instance = new base();
$html_instance = new html();
$userid = $base_instance->get_userid();
if (isset($_POST['save'])) {
    $error = '';
    $title = $_POST['title'];
    if (!$title) {
        $error .= '<li> Title cannot be left blank';
    } else {
        $title = trim($title);
        if (strlen($title) > 50) {
            $error .= '<li> Title is too long (Max. 50 Characters)';
        }
        $title = str_replace('"', '&quot;', $title);
    }
    if (!$error) {
        $title = sql_safe($title);
        $html_instance->check_for_duplicates_by_title('NOTE', 'CATEGORY', $title, $userid);
        $base_instance->query('INSERT INTO ' . $base_instance->entity['NOTE']['CATEGORY'] . ' (title,user) VALUES ("' . $title . '",' . $userid . ')');
        $cat_id = mysqli_insert_id($base_instance->db_link);
        $base_instance->show_message('Notes Category saved', '<a href="add-note.php?category_id=' . $cat_id . '">[Add Note]</a> &nbsp;&nbsp; <a href="add-note-category.php">[Add Category]</a> &nbsp;&nbsp; <a href="edit-note-category.php?category_id=' . $cat_id . '">[Edit]</a> &nbsp;&nbsp; <a href="javascript:void(window.open(\'delete-note-category.php?category_id=' . $cat_id . '\',\'\',\'width=450,height=200,top=100,left=100\'))">[Delete]</a><p><a href="show-note-categories.php">[Show Notes Categories]</a>');
    } else {
        $html_instance->error_message = $error;
        $title = stripslashes($title);
    }
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Add Notes Category', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BODY' => 'onLoad="javascript:document.form1.title.focus()"', 'INNER_TABLE_WIDTH' => '400', 'TD_WIDTH' => '20%', 'BUTTON_TEXT' => 'Save Category'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => '', 'SIZE' => 35, 'TEXT' => 'Title'));
$html_instance->process();
<?php

require 'class.base.php';
require 'class.html.php';
$base_instance = new base();
$html_instance = new html();
$userid = $base_instance->get_userid();
$category_id = isset($_REQUEST['category_id']) ? (int) $_REQUEST['category_id'] : exit;
if (isset($_POST['save_it'])) {
    $title_text_field = sql_safe($_POST['title_text_field']);
    $base_instance->query("INSERT INTO {$base_instance->entity['DATABASE']['TEXT_FIELDS']} (user,title,category_id) VALUES ({$userid},'{$title_text_field}',{$category_id})");
    $field_id = mysqli_insert_id($base_instance->db_link);
    $base_instance->show_message('Field saved', '<a href="add-database-number-field.php?category_id=' . $category_id . '">[Add Number Field]</a>&nbsp;&nbsp; <a href="add-database-text-field.php?category_id=' . $category_id . '">[Add Text Field]</a><p>
<a href="add-database-select-field.php?category_id=' . $category_id . '">[Add Select Field]</a> &nbsp;&nbsp; <a href="add-database-checkbox-field.php?category_id=' . $category_id . '">[Add Checkbox Field]</a><p><a href="add-database-data.php?category_id=' . $category_id . '">[Add Data]</a> &nbsp;&nbsp; <a href="edit-database-text-field.php?text_field_id=' . $field_id . '">[Edit Field]</a> &nbsp;&nbsp; <a href="show-database-data.php?category_id=' . $category_id . '">[Show all Data]</a>');
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Add Text Field', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'INNER_TABLE_WIDTH' => '400', 'TD_WIDTH' => '30%', 'BUTTON_TEXT' => 'Save Field'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'save_it', 'VALUE' => 1));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'category_id', 'VALUE' => "{$category_id}"));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title_text_field', 'VALUE' => '', 'SIZE' => 35, 'TEXT' => 'Name of Field'));
$html_instance->process();
                $base_instance->query("INSERT INTO {$base_instance->entity['DATABASE']['SELECT_ITEMS']} (title,user,select_field_id) VALUES ('{$name_item}',{$userid},{$select_field_id})");
            }
        }
        $base_instance->show_message('Field saved', '<a href="add-database-number-field.php?category_id=' . $category_id . '">[Add Number Field]</a>&nbsp;&nbsp; <a href="add-database-text-field.php?category_id=' . $category_id . '">[Add Text Field]</a><p>
<a href="add-database-select-field.php?category_id=' . $category_id . '">[Add Select Field]</a> &nbsp;&nbsp; <a href="add-database-checkbox-field.php?category_id=' . $category_id . '">[Add Checkbox Field]</a><p><a href="add-database-data.php?category_id=' . $category_id . '">[Add Data]</a> &nbsp;&nbsp; <a href="edit-database-select-field.php?select_field_id=' . $select_field_id . '">[Edit Field]</a> &nbsp;&nbsp; <a href="show-database-data.php?category_id=' . $category_id . '">[Show all Data]</a>');
    }
}
if (empty($number_of_fields)) {
    $number_of_fields = 5;
}
if (isset($_POST['title_select_field'])) {
    $title_select_field = sql_safe($_POST['title_select_field']);
} else {
    $title_select_field = '';
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Add Select Fields', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'INNER_TABLE_WIDTH' => '400', 'TD_WIDTH' => '30%', 'BUTTON_TEXT' => 'Save Field'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'save_it', 'VALUE' => 1));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'number_of_fields', 'VALUE' => "{$number_of_fields}"));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'category_id', 'VALUE' => "{$category_id}"));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title_select_field', 'VALUE' => "{$title_select_field}", 'SIZE' => 35, 'TEXT' => 'Name of Field'));
for ($index = 1; $index <= $number_of_fields; $index++) {
    $name = 'name_select_field_item_' . $index;
    if (isset($item_value[$index])) {
        $value = $item_value[$index];
    } else {
        $value = '';
    }
    $html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => $name, 'VALUE' => $value, 'SIZE' => 35, 'TEXT' => 'Name Item ' . $index));
}
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => '<input type="submit" name="add_fields" value="More Item Fields">'));
$html_instance->process();
$category_id = isset($_GET['category_id']) ? $_GET['category_id'] : '';
# build category section
$data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['FILE']['CATEGORY']} WHERE user='******' ORDER BY title");
if (!$data) {
    $cat_title = 'New Category:';
    $select_category = '&nbsp;<input type="text" name="new_category" value="' . $new_category . '">';
} else {
    $cat_title = 'Category:';
    $select_category = '&nbsp;<select name="category_id">';
    for ($index = 1; $index <= sizeof($data); $index++) {
        $category_title = $data[$index]->title;
        $ID = $data[$index]->ID;
        if ($ID == $category_id) {
            $select_category .= "<option selected value={$ID}>{$category_title}";
        } else {
            $select_category .= "<option value={$ID}>{$category_title}";
        }
    }
    $select_category .= '</select> or <b>New Category:</b> <input type="text" name="new_category" value="' . $new_category . '" size="12">';
}
#
$title = isset($_POST['title']) ? $_POST['title'] : '';
$text = isset($_POST['text']) ? $_POST['text'] : '';
$source = isset($_POST['source']) ? $_POST['source'] : '';
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Upload Image by URL', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BODY' => 'onLoad="javascript:document.form1.source.focus()"', 'BUTTON_TEXT' => 'Upload File'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'source', 'VALUE' => "{$source}", 'SIZE' => 55, 'TEXT' => 'Image URL'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => "{$title}", 'SIZE' => 55, 'TEXT' => 'Title'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Category:', 'TEXT2' => "{$select_category}", 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'textarea', 'NAME' => 'text', 'VALUE' => "{$text}", 'COLS' => 50, 'ROWS' => 3, 'TEXT' => 'Notes', 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'radio', 'NAME' => 'public', 'FIELD_ARRAY' => 'public_array', 'VALUE' => "{$public}", 'TEXT' => 'File is'));
$html_instance->process();
            } else {
                $feed = '';
            }
            if (isset($_POST['max_items' . $index])) {
                $max_items = $_POST['max_items' . $index];
            } else {
                $max_items = '';
            }
            $text .= '<tr><td align="right"><b>Feed Title ' . $index . ':</b></td><td align="left">&nbsp;<input type="text" name="title' . $index . '" size="65" value="' . $title . '"></td></tr><tr><td align="right"><b>Feed URL ' . $index . ':</b></td><td align="left">&nbsp;<input type="text" name="feed' . $index . '" size="65" value="' . $feed . '"></td></tr><tr><td align="right"><b>Max Items ' . $index . ':</b></td><td align="left">&nbsp;<input type="text" name="max_items' . $index . '" size="5" value="' . $max_items . '"></td></tr>';
        }
        $text .= '<tr><td></td><td><input type="SUBMIT" value="More Fields" name="more_fields"></td></tr></table>

<input type="Hidden" name="number_of_fields" value="' . $number_of_fields . '">';
    } else {
        $text = '<table>';
        $number_of_fields = 5;
        for ($index = 1; $index < $number_of_fields + 1; $index++) {
            $text .= '<tr><td align="right"><b>Feed Title ' . $index . ':</b></td><td align="left">&nbsp;<input type="text" name="title' . $index . '" size="65" value=""></td></tr>

<tr><td align="right"><b>Feed URL ' . $index . ':</b></td><td align="left">&nbsp;<input type="text" name="feed' . $index . '" size="65" value=""></td></tr>

<tr><td align="right"><b>Max Items ' . $index . ':</b></td><td align="left">&nbsp;<input type="text" name="max_items' . $index . '" size="5" value=""></td></tr>';
        }
        $text .= '<tr><td></td><td><input type="SUBMIT" value="More Feeds" name="more_fields"></td></tr></table>

<input type="Hidden" name="number_of_fields" value="' . $number_of_fields . '">';
    }
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Add RSS Feeds', 'INNER_TABLE_WIDTH' => '60%', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BODY' => 'onLoad="javascript:document.form1.title1.focus()"', 'BUTTON_TEXT' => 'Save RSS Feeds'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => $text));
$html_instance->process();
} else { newHeight=50; what.style.height="50px"; }
}

</script>';
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Edit Knowledge', 'HEAD' => $js, 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BUTTON_TEXT' => 'Update Knowledge'));
# build category select box
$select_box = '&nbsp;<select name="category_id">';
$data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['KNOWLEDGE']['CATEGORY']} WHERE user='******' ORDER BY title");
for ($index = 1; $index <= sizeof($data); $index++) {
    $category_title = $data[$index]->title;
    $ID = $data[$index]->ID;
    if ($ID == $category_id) {
        $select_box .= "<option selected value={$ID}>{$category_title}";
    } else {
        $select_box .= "<option value={$ID}>{$category_title}";
    }
}
$select_box .= '</select> or <b>New Category:</b> <input type="text" name="new_category" value="">';
#
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'knowledge_id', 'VALUE' => "{$knowledge_id}"));
if (empty($error)) {
    $html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Added:', 'TEXT2' => $datetime_converted, 'SECTIONS' => 2));
}
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => $title, 'SIZE' => 65, 'TEXT' => 'Title'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Category:', 'TEXT2' => $select_box, 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'value', 'VALUE' => $value, 'SIZE' => 3, 'TEXT' => 'Value'));
$html_instance->add_form_field(array('TYPE' => 'textarea', 'NAME' => 'text', 'VALUE' => $text, 'COLS' => 120, 'ROWS' => 12));
$html_instance->add_form_field(array('TYPE' => 'radio', 'NAME' => 'public', 'FIELD_ARRAY' => 'public_array', 'VALUE' => $public, 'TEXT' => 'Knowledge is'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => '<span class="fakelink" onclick="bigger(document.form1.text,100);">[+]</span>
<span class="fakelink" onclick="smaller(document.form1.text,100);">[-]</span>'));
$html_instance->process();
            $background = 1;
        }
        if (!$font_size) {
            $font_size = 2;
        }
        $base_instance->query("UPDATE {$base_instance->entity['USER']['MAIN']} SET font_face_main='{$font_face_main}',font_face_navigation='{$font_face_navigation}',font_size={$font_size},color_navigation='{$color_navigation}',color_main='{$color_main}',background='{$background}' WHERE ID={$userid}");
        $sid = (int) $_COOKIE['sid'];
        $base_instance->query("UPDATE {$base_instance->entity['SESSION']['MAIN']} SET font_face_main={$font_face_main},font_face_navigation={$font_face_navigation},font_size={$font_size},color_main={$color_main},color_navigation={$color_navigation},background={$background} WHERE session_id={$sid}");
        header('Location: start.php');
        exit;
    } else {
        $html_instance->error_message = $error;
    }
}
$data = $user_instance->get_userinfo($userid);
$font_face_navigation = $data[1]->font_face_navigation;
$font_face_main = $data[1]->font_face_main;
$font_size = $data[1]->font_size;
$color_navigation = $data[1]->color_navigation;
$color_main = $data[1]->color_main;
$background = $data[1]->background;
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Edit Theme', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'FORM_ATTRIB' => 'target="_top"', 'TD_WIDTH' => '30%', 'BUTTON_TEXT' => 'Save Theme'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'font_face_main', 'VALUE' => "{$font_face_main}", 'OPTION' => 'font_face_array', 'TEXT' => 'Font Face<br>(Main)'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'font_face_navigation', 'VALUE' => "{$font_face_navigation}", 'OPTION' => 'font_face_array', 'TEXT' => 'Font Face<br>(Navigation)'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'font_size', 'VALUE' => "{$font_size}", 'OPTION' => 'font_size_array', 'TEXT' => 'Font Size'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'background', 'VALUE' => "{$background}", 'OPTION' => 'background_array', 'TEXT' => 'Background<br>(Main)'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'color_main', 'VALUE' => "{$color_main}", 'OPTION' => 'color_array', 'TEXT' => 'Font Color<br>(Main)'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'color_navigation', 'VALUE' => "{$color_navigation}", 'OPTION' => 'color_array', 'TEXT' => 'Font Color<br>(Navigation)'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => '', 'TEXT2' => 'Or choose a preset here:', 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'theme_preset', 'VALUE' => '', 'OPTION' => 'theme_presets_array', 'TEXT' => 'Theme Presets'));
$html_instance->process();
if ($timezone == 19) {
    $select_box .= '<option selected value=19>Asia Jakarta';
} else {
    $select_box .= '<option value=19>Asia Jakarta';
}
if ($timezone == 20) {
    $select_box .= '<option selected value=20>Asia Hong Kong';
} else {
    $select_box .= '<option value=20>Asia Hong Kong';
}
if ($timezone == 21) {
    $select_box .= '<option selected value=21>Asia Japan';
} else {
    $select_box .= '<option value=21>Asia Japan';
}
if ($timezone == 22) {
    $select_box .= '<option selected value=22>Israel';
} else {
    $select_box .= '<option value=22>Israel';
}
$select_box .= '</select>';
$test = @putenv('TZ=Europe/London');
if ($test != 1) {
    $warning = '<font color="#ff0000">Warning: Your server runs with safe mode on. In this case timezones can not be customized here.<br>Please correct this if necessary.</font>';
} else {
    $warning = '';
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Change Date and Time', 'INNER_TABLE_WIDTH' => '60%', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'FORM_ATTRIB' => 'target="_top"', 'TEXT_CENTER' => 'Choose the current time of your timezone (24h format).<p>' . $warning, 'TD_WIDTH' => '30%', 'BUTTON_TEXT' => 'Save Settings'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'dateformat', 'VALUE' => $dateformat, 'OPTION' => 'date_format_array', 'TEXT' => 'Date format'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Timezone:', 'TEXT2' => $select_box, 'SECTIONS' => 2));
$html_instance->process();
    $number_of_hours = floor($frequency / 3600);
    $hours_in_second = $number_of_hours * 3600;
    $frequency = $frequency - $hours_in_second;
    $number_of_mins = floor($frequency / 60);
    $mins_in_second = $number_of_mins * 60;
}
$select_box = '&nbsp;<select name="category_id"><option selected value=0>-- Choose Category --';
$select_box .= $misc_instance->build_category_select_box(0, $userid, 0, $category_id);
$select_box .= '</select> or';
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Edit Link &nbsp;&nbsp; <a href="help-link.php" target="_blank">[Help]</a>', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'INNER_TABLE_WIDTH' => '500', 'TD_WIDTH' => '25%', 'BUTTON_TEXT' => 'Update Link'));
if (stristr($url, '://')) {
    $url2 = $url;
} else {
    $url2 = 'http://' . $url;
}
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'link_id', 'VALUE' => $link_id));
if (empty($error)) {
    $html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Added:', 'TEXT2' => $datetime_converted, 'SECTIONS' => '2'));
}
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'url', 'VALUE' => $url2, 'SIZE' => 50, 'TEXT' => 'URL'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Category:', 'TEXT2' => $select_box, 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'new_category', 'VALUE' => $new_category, 'SIZE' => 50, 'TEXT' => 'New Category'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => $title, 'SIZE' => 50, 'TEXT' => 'Title'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'subtitle', 'VALUE' => $subtitle, 'SIZE' => 50, 'TEXT' => 'Subtitle'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'speed', 'VALUE' => $speed, 'OPTION' => 'speed_array', 'TEXT' => 'Ascent Speed', 'DO_NO_SORT_ARRAY' => 1));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'sequence', 'VALUE' => $sequence, 'SIZE' => 10, 'TEXT' => 'Sequence ID'));
#$html_instance->add_form_field(array('TYPE'=>'radio','NAME'=>'public','FIELD_ARRAY'=>'public_array','VALUE'=>"$public",'TEXT'=>'Link is'));
if ($mode == 1) {
    $m1_checked = ' CHECKED';
} else {
    $m1_checked = '';
<?php

require 'class.base.php';
require 'class.html.php';
$base_instance = new base();
$html_instance = new html();
$userid = $base_instance->get_userid();
$text_field_id = isset($_REQUEST['text_field_id']) ? (int) $_REQUEST['text_field_id'] : exit;
if (isset($_POST['save'])) {
    $base_instance->query("DELETE FROM {$base_instance->entity['DATABASE']['TEXT_FIELDS']} WHERE ID={$text_field_id} AND user='******'");
    $base_instance->query("DELETE FROM {$base_instance->entity['DATABASE']['TEXT_VALUES']} WHERE text_field_id={$text_field_id} AND user='******'");
    header('Location: close-me.php');
    exit;
}
$data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['DATABASE']['TEXT_FIELDS']} WHERE ID={$text_field_id}");
if (!$data) {
    $base_instance->show_message('Database field not found');
    exit;
}
$title = $data[1]->title;
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => '<font color="#ff0000">Delete this field?</font>', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BUTTON_TEXT' => 'Delete Field'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'text_field_id', 'VALUE' => "{$text_field_id}"));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => '<div align="center"><b>' . $title . '</b></div>'));
$html_instance->process();
if ($year == 0) {
    $select_box .= '<option selected value=0>Every Year';
} else {
    $select_box .= '<option value=0>Every Year';
}
for ($index = $this_year; $index <= $max_year; $index++) {
    if ($index == $year) {
        $select_box .= "<option selected value={$index}>{$index}";
    } else {
        $select_box .= "<option value={$index}>{$index}";
    }
}
$select_box .= '</select>';
#
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Edit Reminder', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BUTTON_TEXT' => 'Update Reminder', 'HEAD' => '<script language="JavaScript" type="text/javascript">function tick_box(){document.form1.popup.checked=true;}</script>'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'reminder_id', 'VALUE' => $reminder_id));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => $title, 'SIZE' => 50, 'TEXT' => 'Title'));
$html_instance->add_form_field(array('TYPE' => 'textarea', 'NAME' => 'text', 'VALUE' => $text, 'COLS' => 50, 'ROWS' => 3, 'TEXT' => 'Notes', 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'day', 'VALUE' => $day, 'OPTION' => 'day_array', 'TEXT' => 'Day', 'DO_NO_SORT_ARRAY' => 1));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'month', 'VALUE' => $month, 'OPTION' => 'month_array', 'TEXT' => 'Month', 'DO_NO_SORT_ARRAY' => 1));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Year:', 'TEXT2' => $select_box, 'SECTIONS' => 2));
if ($email_alert) {
    $cb = '<input type="Checkbox" name="email_alert" value="1" checked id="tick_email_alert">';
} else {
    $cb = '<input type="Checkbox" name="email_alert" value="1" id="tick_email_alert">';
}
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => '', 'TEXT2' => "{$cb} <label for=\"tick_email_alert\">Send Email Alert on that day</label>", 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => '<hr color="#ececec" width="95%">'));
if ($homepage) {
    $cb = '<input type="Checkbox" name="homepage" value="1" checked id="tick_homepage">';
} else {
require 'class.base.php';
require 'class.html.php';
require 'class.user.php';
$base_instance = new base();
$html_instance = new html();
$user_instance = new user();
$userid = $base_instance->get_userid();
if (isset($_POST['save'])) {
    $error = '';
    $online_status = (int) $_POST['online_status'];
    if (!$online_status) {
        $error .= '<li> Online Status cannot be left blank';
    }
    if (!$error) {
        $sid = (int) $_COOKIE['sid'];
        $base_instance->query("UPDATE {$base_instance->entity['SESSION']['MAIN']} SET online_status={$online_status} WHERE session_id={$sid}");
        if ($online_status == 3) {
            $base_instance->query("UPDATE {$base_instance->entity['USER']['MAIN']} SET online_status={$online_status} WHERE ID={$userid}");
        } else {
            $base_instance->query("UPDATE {$base_instance->entity['USER']['MAIN']} SET online_status=1 WHERE ID={$userid}");
        }
        $base_instance->show_message('Online Status changed', '<a href="edit-online-status.php">[Edit Online Status]</a>');
    } else {
        $html_instance->error_message = $error;
    }
}
$data = $base_instance->get_data("SELECT online_status FROM {$base_instance->entity['SESSION']['MAIN']} WHERE user={$userid} ORDER BY ID DESC LIMIT 1");
$online_status = $data[1]->online_status;
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Change Online Status &nbsp;&nbsp; <a href="help-live-help.php">[Help]</a>', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'TD_WIDTH' => '50%', 'BUTTON_TEXT' => 'Save Status'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'online_status', 'VALUE' => "{$online_status}", 'OPTION' => 'online_status_array', 'TEXT' => 'Online Status'));
$html_instance->process();
Beispiel #14
0
$data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['FILE']['CATEGORY']} WHERE user='******' ORDER BY title");
if (!$data) {
    $cat_title = 'New Category:';
    $select_category = '&nbsp;<input type="text" name="new_category" value="' . $new_category . '">';
} else {
    $cat_title = 'Category:';
    $select_category = '&nbsp;<select name="category_id">';
    for ($index = 1; $index <= sizeof($data); $index++) {
        $category_title = $data[$index]->title;
        $ID = $data[$index]->ID;
        if ($ID == $category_id) {
            $select_category .= "<option selected value={$ID}>{$category_title}";
        } else {
            $select_category .= "<option value={$ID}>{$category_title}";
        }
    }
    $select_category .= '</select> or <b>New Category:</b> <input type="text" name="new_category" value="' . $new_category . '" size="12">';
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Upload File', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'FORM_ATTRIB' => 'enctype="multipart/form-data"', 'BUTTON_TEXT' => 'Upload File'));
$html_instance->add_form_field(array('TYPE' => 'file', 'NAME' => 'file1', 'SIZE' => 45, 'TEXT' => 'File'));
if ($overwrite) {
    $cb = '<input type="Checkbox" name="overwrite" value="1" checked id="tick_overwrite">';
} else {
    $cb = '<input type="Checkbox" name="overwrite" value="1" id="tick_overwrite">';
}
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => '', 'TEXT2' => "{$cb} <label for=\"tick_overwrite\">Overwrite if same filename</label>", 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => "{$title}", 'SIZE' => 50, 'TEXT' => 'Title'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => "{$cat_title}", 'TEXT2' => "{$select_category}", 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'textarea', 'NAME' => 'text', 'VALUE' => "{$text}", 'COLS' => 50, 'ROWS' => 3, 'TEXT' => 'Notes', 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'radio', 'NAME' => 'public', 'FIELD_ARRAY' => 'public_array', 'VALUE' => "{$public}", 'TEXT' => 'File is'));
$html_instance->process();
require 'class.base.php';
require 'class.html.php';
require 'class.user.php';
$base_instance = new base();
$html_instance = new html();
$user_instance = new user();
$user_instance->check_for_admin();
$news_id = isset($_REQUEST['news_id']) ? (int) $_REQUEST['news_id'] : exit;
if (isset($_POST['save'])) {
    $base_instance->query("DELETE FROM {$base_instance->entity['NEWS']['MAIN']} WHERE ID='{$news_id}'");
    header('Location: close-me.php');
    exit;
}
$data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['NEWS']['MAIN']} WHERE ID='{$news_id}'");
if (!$data) {
    $base_instance->show_message('News not found');
    exit;
}
$datetime = $data[1]->datetime;
$text = $data[1]->text;
$title = $data[1]->title;
$text2 = substr($text, 0, 50);
$datetime_converted = $base_instance->convert_date($datetime . ' 00:00:00');
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => '<font color="#ff0000">Delete this News?</font>', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BUTTON_TEXT' => 'Delete News'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'news_id', 'VALUE' => "{$news_id}"));
if ($title) {
    $text2 = "<b>{$title}</b>: {$text2}";
}
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => "<strong>Added:</strong> {$datetime_converted}<p>{$text2}"));
$html_instance->process();
    }
    if (!$error) {
        $base_instance->query("UPDATE {$base_instance->entity['CONTACT']['MAIN']} SET category='{$new_category}' WHERE user='******' AND category={$category_id}");
        $base_instance->query("DELETE FROM {$base_instance->entity['CONTACT']['CATEGORY']} WHERE user='******' AND ID='{$category_id}'");
        $base_instance->show_message('Categories have been merged', '<a href="show-contact-categories.php">[Show all Categories]</a>');
    } else {
        $html_instance->error_message = $error;
    }
}
$data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['CONTACT']['CATEGORY']} WHERE user='******' AND ID='{$category_id}'");
if (!$data) {
    $base_instance->show_message('Contact Category not found');
    exit;
}
$title = $data[1]->title;
# build category select box
$data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['CONTACT']['CATEGORY']} WHERE user='******'");
$select_box = '&nbsp;<select name="new_category"><option selected value=0>-- Choose Category --';
for ($index = 1; $index <= sizeof($data); $index++) {
    $category_title = $data[$index]->title;
    $ID = $data[$index]->ID;
    if ($ID != $category_id) {
        $select_box .= "<option value={$ID}>{$category_title}";
    }
}
$select_box .= '</select>';
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Merge Category', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'INNER_TABLE_WIDTH' => '400', 'TD_WIDTH' => '40%', 'BUTTON_TEXT' => 'Merge Category'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'category_id', 'VALUE' => "{$category_id}"));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => "Into which category do you want to merge the '{$title}' category?"));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Category:', 'TEXT2' => "{$select_box}", 'SECTIONS' => 2));
$html_instance->process();
if (isset($_POST['save'])) {
    $error = '';
    $about_me = $_POST['about_me'];
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $country = (int) $_POST['country'];
    if (!empty($about_me)) {
        $about_me = trim($about_me);
        if (strlen($about_me) > 65535) {
            $error .= '<li> Text is too long (Max. 65535 Characters)';
        }
    }
    if (!$error) {
        $base_instance->query('UPDATE ' . $base_instance->entity['USER']['MAIN'] . ' SET about_me="' . sql_safe($about_me) . '",firstname="' . sql_safe($firstname) . '",lastname="' . sql_safe($lastname) . '",country=' . $country . ' WHERE ID=' . $userid);
        $base_instance->show_message('About Me page updated', '<a href="show-user.php?userid=' . $userid . '">[View Profile Page]</a>');
    } else {
        $html_instance->error_message = $error;
    }
} else {
    $data = $base_instance->get_data("SELECT about_me,firstname,lastname,country FROM {$base_instance->entity['USER']['MAIN']} WHERE ID='{$userid}'");
    $about_me = $data[1]->about_me;
    $firstname = $data[1]->firstname;
    $lastname = $data[1]->lastname;
    $country = $data[1]->country;
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'About Me', 'TEXT_CENTER' => 'The About Me text is a public text which appears in your profile.<br>Firstname and lastname is not public, it will only be used for sending emails within the Organizer.<p>', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BODY' => 'onLoad="javascript:document.form1.about_me.focus()"', 'BUTTON_TEXT' => 'Update'));
$html_instance->add_form_field(array('TYPE' => 'textarea', 'NAME' => 'about_me', 'VALUE' => "{$about_me}", 'TEXT' => 'About me', 'COLS' => 80, 'ROWS' => 4));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'firstname', 'VALUE' => "{$firstname}", 'SIZE' => 35, 'TEXT' => 'Firstname'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'lastname', 'VALUE' => "{$lastname}", 'SIZE' => 35, 'TEXT' => 'Lastname'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'country', 'VALUE' => "{$country}", 'OPTION' => 'country_array', 'TEXT' => 'Country'));
$html_instance->process();
    $title = $_POST['title'];
    if (!$title) {
        $error .= '<li> Category cannot be left blank';
    } else {
        $title = trim($title);
        if (strlen($title) > 50) {
            $error .= '<li> Title is too long (Max. 50 Characters)';
        }
        $title = str_replace('"', '&quot;', $title);
    }
    if (!$error) {
        $base_instance->query('INSERT INTO ' . $base_instance->entity['LINK']['CATEGORY'] . ' (title,user,parent_id) VALUES ("' . sql_safe($title) . '",' . $userid . ',' . $category_id . ')');
        $cat_id = mysqli_insert_id($base_instance->db_link);
        $base_instance->show_message('Link Category saved', '<a href="add-link.php?category_id=' . $cat_id . '">[Add Link]</a> &nbsp;&nbsp; <a href="add-link-category.php">[Add Category]</a> &nbsp;&nbsp; <a href="edit-link-category.php?category_id=' . $cat_id . '">[Edit]</a> &nbsp;&nbsp; <a href="javascript:void(window.open(\'delete-link-category.php?category_id=' . $cat_id . '\',\'\',\'width=450,height=200,top=100,left=100\'))">[Delete]</a><p><a href="show-link-categories.php">[Show Link Categories]</a>');
    } else {
        $html_instance->error_message = $error;
        $title = stripslashes($title);
    }
}
$select_box = '&nbsp;<select name="category_id">';
if (empty($category_id)) {
    $select_box .= "<option selected value=0>-- MAIN CATEGORY --";
} else {
    $select_box .= '<option value=0>-- MAIN CATEGORY --';
}
$select_box .= $misc_instance->build_category_select_box(0, $userid, 0, $category_id);
$select_box .= '</select>';
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'New Link Category', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BODY' => 'onLoad="javascript:document.form1.title.focus()"', 'INNER_TABLE_WIDTH' => '400', 'TD_WIDTH' => '30%', 'BUTTON_TEXT' => 'Save Category'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => '', 'SIZE' => 35, 'TEXT' => 'Title'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Subcategory of', 'TEXT2' => "{$select_box}", 'SECTIONS' => 2));
$html_instance->process();
$category_id = isset($_REQUEST['category_id']) ? (int) $_REQUEST['category_id'] : exit;
if (isset($_POST['save'])) {
    $error = '';
    $title = $_POST['title'];
    if (!$title) {
        $error .= '<li> Title cannot be left blank';
    } else {
        $title = trim($title);
        if (strlen($title) > 50) {
            $error .= '<li> Title is too long (Max. 50 Characters)';
        }
        $title = str_replace('"', '&quot;', $title);
    }
    if (!$error) {
        $base_instance->query('UPDATE ' . $base_instance->entity['BLOG']['CATEGORY'] . ' SET title="' . sql_safe($title) . '" WHERE user='******' AND ID=' . $category_id);
        $base_instance->show_message('Blog Category updated', '<a href="add-blog.php?category_id=' . $category_id . '">[Add Blog Post]</a> &nbsp;&nbsp; <a href="add-blog-category.php">[Add Category]</a> &nbsp;&nbsp; <a href="edit-blog-category.php?category_id=' . $category_id . '">[Edit]</a> &nbsp;&nbsp; <a href="javascript:void(window.open(\'delete-blog-category.php?category_id=' . $category_id . '\',\'\',\'width=450,height=200,top=100,left=100\'))">[Delete]</a><p><a href="show-blog-categories.php">[Show Blog Categories]</a>');
    } else {
        $html_instance->error_message = $error;
    }
} else {
    $data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['BLOG']['CATEGORY']} WHERE user='******' AND ID='{$category_id}'");
    if (!$data) {
        $base_instance->show_message('Blog Category not found');
        exit;
    }
    $title = $data[1]->title;
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Edit Blog Category', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BODY' => 'onLoad="javascript:document.form1.title.focus()"', 'INNER_TABLE_WIDTH' => '400', 'TD_WIDTH' => '20%', 'BUTTON_TEXT' => 'Update Category'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'category_id', 'VALUE' => $category_id));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => $title, 'SIZE' => 35, 'TEXT' => 'Title'));
$html_instance->process();
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $country = (int) $_POST['country'];
    $allow_file_upload = (int) $_POST['allow_file_upload'];
    if (!$error) {
        $base_instance->query('UPDATE ' . $base_instance->entity['USER']['MAIN'] . ' SET email="' . sql_safe($email) . '",firstname="' . sql_safe($firstname) . '",lastname="' . $lastname . '",country=' . $country . ',allow_file_upload=' . $allow_file_upload . ' WHERE ID=' . $userid);
        $base_instance->query('UPDATE ' . $base_instance->entity['SESSION']['MAIN'] . ' SET allow_file_upload=' . $allow_file_upload . ' WHERE user='******'User updated', '<a href="show-user.php?userid=' . $userid . '">[View User Profile]</a> &nbsp;&nbsp; <a href="edit-user.php?userid=' . $userid . '">[Edit User]</a>');
    } else {
        $html_instance->error_message = $error;
    }
} else {
    $data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['USER']['MAIN']} WHERE ID='{$userid}'");
    if (!$data) {
        $base_instance->show_message('User not found', '', 1);
    }
    $about_me = $data[1]->about_me;
    $email = $data[1]->email;
    $firstname = $data[1]->firstname;
    $lastname = $data[1]->lastname;
    $country = $data[1]->country;
    $allow_file_upload = $data[1]->allow_file_upload;
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Edit User', 'TEXT_CENTER' => '', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BUTTON_TEXT' => 'Update'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'userid', 'VALUE' => "{$userid}"));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'email', 'VALUE' => "{$email}", 'SIZE' => 35, 'TEXT' => 'Email'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'firstname', 'VALUE' => "{$firstname}", 'SIZE' => 35, 'TEXT' => 'Firstname'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'lastname', 'VALUE' => "{$lastname}", 'SIZE' => 35, 'TEXT' => 'Lastname'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'country', 'VALUE' => "{$country}", 'OPTION' => 'country_array', 'TEXT' => 'Country'));
$html_instance->add_form_field(array('TYPE' => 'select', 'NAME' => 'allow_file_upload', 'VALUE' => "{$allow_file_upload}", 'OPTION' => 'allow_file_upload_array', 'TEXT' => 'File Upload Allowed'));
$html_instance->process();
            $base_instance->query("INSERT INTO {$base_instance->entity['DATABASE']['TEXT_VALUES']} (date,user,value,data_id,text_field_id,category_id) VALUES ('{$date}',{$userid},'{$value}',{$insert_id},{$ID},{$category_id})");
        }
        $base_instance->show_message('Data saved', '<script language="JavaScript" type="text/javascript">function createRequestObject(){try{var requester=new XMLHttpRequest();}catch(error){try{var requester=new ActiveXObject("Microsoft.XMLHTTP");}catch(error){return false;}} return requester;}var http=createRequestObject();function DelData(item){if(confirm("Delete Data?")){http.open(\'get\',\'delete-database-data.php?item=\'+item); http.send(null);}}</script>

<a href="add-database-data.php?category_id=' . $category_id . '">[Add more]</a> &nbsp;&nbsp; <a href="edit-database-data.php?data_id=' . $insert_id . '">[Edit]</a> &nbsp;&nbsp; <a href="javascript:DelData(\'' . $insert_id . '\')">[Delete]</a> &nbsp;&nbsp; <a href="show-database-data.php?category_id=' . $category_id . '">[Show all Data]</a><p>');
    } else {
        $html_instance->error_message = $error;
        $title = stripslashes($title);
    }
}
$day = date('j');
$month = date('n');
$year = date('Y');
$title = isset($_POST['title']) ? $_POST['title'] : '';
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Add Data', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BUTTON_TEXT' => 'Save Data'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'save_data', 'VALUE' => "1"));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'category_id', 'VALUE' => "{$category_id}"));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => "{$title}", 'SIZE' => 50, 'TEXT' => 'Title'));
# get number fields
$data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['DATABASE']['NUMBER_FIELDS']} WHERE user='******' AND category_id='{$category_id}'");
if ($data) {
    for ($index = 1; $index <= sizeof($data); $index++) {
        $number_field_id = $data[$index]->ID;
        $title = $data[$index]->title;
        $html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => "number{$number_field_id}", 'VALUE' => '', 'SIZE' => 50, 'TEXT' => "{$title}"));
    }
}
unset($data);
# get text fields
$data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['DATABASE']['TEXT_FIELDS']} WHERE user='******' AND category_id='{$category_id}'");
if ($data) {
        }
    }
    if ($freq_hours < 1 && $freq_mins < 1) {
        $error .= '<li> <strong>Hours / Mins</strong> cannot be left blank';
    }
    if (!$error) {
        $freq_total = 0;
        if ($freq_hours > 0) {
            $freq_total += $freq_hours * 3600;
        }
        if ($freq_mins > 0) {
            $freq_total += $freq_mins * 60;
        }
        $now = time();
        $datetime = $_POST['datetime'];
        $html_instance->check_for_duplicates('REMINDER', 'HOURS', $datetime, $userid);
        $base_instance->query('INSERT INTO ' . $base_instance->entity['REMINDER']['HOURS'] . ' (datetime, title, user, frequency, last_reminded, text) VALUES ("' . sql_safe($datetime) . '", "' . sql_safe($title) . '",' . $userid . ',' . $freq_total . ',' . $now . ',"' . sql_safe($text) . '")');
        $reminder_id = mysqli_insert_id($base_instance->db_link);
        $base_instance->show_message('Reminder saved', '<a href="add-reminder-hours.php">[Add more]</a> &nbsp;&nbsp; <a href="javascript:void(window.open(\'edit-reminder-hours.php?reminder_id=' . $reminder_id . '\',\'\',\'width=600,height=300,top=100,left=100\'))">[Edit]</a> &nbsp;&nbsp; <a href="javascript:void(window.open(\'delete-reminder-hours.php?reminder_id=' . $reminder_id . '\',\'\',\'width=450,height=300,top=100,left=100\'))">[Delete]</a> &nbsp;&nbsp; <a href="show-reminder-hours.php">[Show all]</a><p>');
    } else {
        $html_instance->error_message = $error;
        $title = stripslashes($title);
        $text = stripslashes($text);
    }
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Add Reminder (By Hours) &nbsp;&nbsp; <a href="help-reminder.php">[Help]</a>', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BUTTON_TEXT' => 'Save Reminder'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => "{$title}", 'SIZE' => 50, 'TEXT' => 'Title'));
$html_instance->add_form_field(array('TYPE' => 'textarea', 'NAME' => 'text', 'VALUE' => "{$text}", 'COLS' => 50, 'ROWS' => 3, 'TEXT' => 'Notes', 'SECTIONS' => 2));
$freq_text = 'Hours: <input type="text" name="freq_hours" size="2" value="' . $freq_hours . '"> &nbsp; Minutes: <input type="text" name="freq_mins" size="2" value="' . $freq_mins . '">';
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Every:', 'TEXT2' => "{$freq_text}", 'SECTIONS' => 2));
$html_instance->process();
    } else {
        $data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['DATABASE']['CHECKBOX_FIELDS']} WHERE user='******' AND ID='{$checkbox_field_id}'");
        if (!$data) {
            $base_instance->show_message('Database field not found');
            exit;
        }
        $title_field = $data[1]->title;
        $data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['DATABASE']['CHECKBOX_ITEMS']} WHERE user='******' AND checkbox_field_id='{$checkbox_field_id}' ORDER BY ID ASC");
        $number_of_fields = sizeof($data) + 3;
        for ($index = 1; $index <= sizeof($data); $index++) {
            $item_id[$index] = $data[$index]->ID;
            $item_name[$index] = $data[$index]->title;
        }
    }
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Edit Checkbox Field', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'TEXT_CENTER' => 'You can rename field names here, do not change the position of field items.<p>', 'BUTTON_TEXT' => 'Update Field'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'number_of_fields', 'VALUE' => "{$number_of_fields}"));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'checkbox_field_id', 'VALUE' => "{$checkbox_field_id}"));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title_field', 'VALUE' => "{$title_field}", 'SIZE' => 30, 'TEXT' => 'Name of Field'));
for ($index = 1; $index <= $number_of_fields; $index++) {
    if (empty($item_id[$index])) {
        $item_id[$index] = '';
    }
    if (empty($item_name[$index])) {
        $item_name[$index] = '';
    }
    $html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'name_checkbox_field_item_' . $index, 'VALUE' => $item_name[$index], 'SIZE' => 30, 'TEXT' => 'Name Item ' . $index));
    $html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'id_checkbox_field_item_' . $index, 'VALUE' => $item_id[$index]));
}
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => '<input type="submit" name="add_fields" value="More Item Fields">'));
$html_instance->process();
Beispiel #24
0
        } else {
            $select_category .= "<option value={$ID}>{$category_title}";
        }
    }
    $select_category .= '</select> or <b>New Category:</b> <input type="text" name="new_category" value="' . $new_category . '" size="12">';
}
#
$js = '<script language="JavaScript" type="text/javascript">

function bigger(what,add) {
if (what.style.height==\'\') { what.style.height=\'300px\'; }
newHeight=parseInt(what.style.height)+add;
what.style.height=newHeight+"px";
}

function smaller(what,deduct) {
if ((parseInt(what.style.height)-deduct) > 50) {
newHeight=parseInt(what.style.height)-deduct;
what.style.height=newHeight+"px";
} else { newHeight=50; what.style.height="50px"; }
}

</script>';
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Add Note', 'HEAD' => $js, 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BODY' => 'onLoad="javascript:document.form1.title.focus()"', 'BUTTON_TEXT' => 'Save Note'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => $title, 'SIZE' => 50, 'TEXT' => 'Title'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => $cat_title, 'TEXT2' => $select_category, 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'textarea', 'NAME' => 'text', 'VALUE' => $text, 'COLS' => 120, 'ROWS' => 12));
$html_instance->add_form_field(array('TYPE' => 'radio', 'NAME' => 'public', 'FIELD_ARRAY' => 'public_array', 'VALUE' => $public, 'TEXT' => 'Note is'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => '<span class="fakelink" onclick="bigger(document.form1.text,100);">[+]</span>
<span class="fakelink" onclick="smaller(document.form1.text,100);">[-]</span>'));
$html_instance->process();
<?php

require 'class.base.php';
require 'class.html.php';
$base_instance = new base();
$html_instance = new html();
$userid = $base_instance->get_userid();
$category_id = isset($_GET['category_id']) ? $_GET['category_id'] : '';
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Link Search', 'FORM_ACTION' => 'show-links.php', 'BODY' => 'onLoad="javascript:document.form1.text_search.focus()"', 'TD_WIDTH' => '35%', 'BUTTON_TEXT' => 'Search Links'));
# build category select box
$select_box = '&nbsp;<select name="category_id"><option>&lt;All&gt;';
$data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['LINK']['CATEGORY']} WHERE user='******' ORDER BY title");
for ($index = 1; $index <= sizeof($data); $index++) {
    $category_title = $data[$index]->title;
    $ID = $data[$index]->ID;
    if ($ID == $category_id) {
        $select_box .= "<option selected value={$ID}>{$category_title}";
    } else {
        $select_box .= "<option value={$ID}>{$category_title}";
    }
}
$select_box .= '</select>';
#
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'text_search', 'VALUE' => '', 'SIZE' => 30, 'TEXT' => 'Text'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => 'Category:', 'TEXT2' => "{$select_box}", 'SECTIONS' => 2));
$html_instance->process();
            $error .= '<li> Title cannot be left blank';
        }
    }
    if ($text) {
        $text = trim($text);
        if (strlen($text) > 65535) {
            $error .= '<li> Text is too long (Max. 65535 Characters)';
        }
    } else {
        $error .= '<li> Message cannot be left blank';
    }
    if (!$error) {
        $datetime = $_POST['datetime'];
        $base_instance->query('INSERT INTO ' . $base_instance->entity['FORUM']['MAIN'] . ' (datetime,updated,text,title,followup,user) VALUES ("' . sql_safe($datetime) . '","' . sql_safe($datetime) . '","' . sql_safe($text) . '","' . sql_safe($title) . '",' . $followup . ',' . $userid . ')');
        if (_FORUM_NOTIFY == 1 && $userid != _ADMIN_USERID) {
            $msg = "New Forum Message:\n\n" . $title . "\n\n" . $text;
            $base_instance->send_email_from_admin('New Forum Message Notification', $msg, _ADMIN_EMAIL);
        }
        header('Location: show-forum.php');
        exit;
    } else {
        $html_instance->error_message = $error;
        $text = stripslashes($text);
        $title = stripslashes($title);
    }
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'New Forum Message', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BODY' => 'onLoad="javascript:document.form1.title.focus()"', 'BUTTON_TEXT' => 'Post new Message'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'followup', 'VALUE' => "{$followup}"));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'title', 'VALUE' => "{$title}", 'SIZE' => 50, 'TEXT' => 'Title'));
$html_instance->add_form_field(array('TYPE' => 'textarea', 'NAME' => 'text', 'VALUE' => "{$text}", 'COLS' => 90, 'ROWS' => 11));
$html_instance->process();
    for ($index = 1; $index <= sizeof($data); $index++) {
        $checkbox_field_id = $data[$index]->ID;
        $base_instance->query("DELETE FROM {$base_instance->entity['DATABASE']['CHECKBOX_ITEMS']} WHERE user='******' AND checkbox_field_id='{$checkbox_field_id}'");
    }
    $base_instance->query("DELETE FROM {$base_instance->entity['DATABASE']['CHECKBOX_FIELDS']} WHERE user='******' AND category_id='{$category_id}'");
    # delete select records
    $base_instance->query("DELETE FROM {$base_instance->entity['DATABASE']['SELECT_VALUES']} WHERE user='******' AND category_id='{$category_id}'");
    $data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['DATABASE']['SELECT_FIELDS']} WHERE user='******' AND category_id='{$category_id}'");
    for ($index = 1; $index <= sizeof($data); $index++) {
        $select_field_id = $data[$index]->ID;
        $base_instance->query("DELETE FROM {$base_instance->entity['DATABASE']['SELECT_ITEMS']} WHERE user='******' AND select_field_id='{$select_field_id}'");
    }
    $base_instance->query("DELETE FROM {$base_instance->entity['DATABASE']['SELECT_FIELDS']} WHERE user='******' AND category_id='{$category_id}'");
    # delete number records
    $base_instance->query("DELETE FROM {$base_instance->entity['DATABASE']['NUMBER_FIELDS']} WHERE user='******' AND category_id='{$category_id}'");
    $base_instance->query("DELETE FROM {$base_instance->entity['DATABASE']['NUMBER_VALUES']} WHERE user='******' AND category_id='{$category_id}'");
    header('Location: close-me.php');
    exit;
} else {
    $data = $base_instance->get_data("SELECT * FROM {$base_instance->entity['DATABASE']['CATEGORY']} WHERE user='******' AND ID='{$category_id}'");
    if (!$data) {
        $base_instance->show_message('Database Category not found');
        exit;
    }
    $title = $data[1]->title;
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => '<font color="#ff0000">Delete this category?</font>', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BUTTON_TEXT' => 'Delete Category'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'category_id', 'VALUE' => "{$category_id}"));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'delete_it', 'VALUE' => 1));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => "Are you sure you want to delete the <b>'{$title}'</b> category AND the items of this category?"));
$html_instance->process();
' . $url . '

For the password reminder go here:

' . _HOMEPAGE . '/password-reminder.php';
        $msg .= "\n\n";
        $msg .= _SEPARATOR . "\n";
        $msg .= _EMAIL_ADVERT_TEXT . "\n";
        $msg .= _SEPARATOR . "\n";
        $msg .= _SLOGAN . "\n";
        $msg .= _HOMEPAGE . "\n";
        $msg .= 'Email: ' . _ADMIN_EMAIL . "\n";
        mail($email, $mailsubject, $msg, $mailheaders);
        $base_instance->query("UPDATE {$base_instance->entity['USER']['MAIN']} SET last_reminded='{$today}' WHERE ID={$ID}");
    }
    if ($sizeof > 0) {
        echo '<head><meta http-equiv="refresh" content="10;URL=send-warning.php?months=' . $months . '&save=1"></head><p><strong>Continue to send more reminder emails in a few seconds (' . $fnd_rows . ' left) ..</strong>';
    } else {
        echo 'finished';
    }
    exit;
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Send Reminder', 'TEXT_CENTER' => 'Send a reminder email to user who have not logged in for a long time.<p>', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BUTTON_TEXT' => 'Send', 'INNER_TABLE_WIDTH' => '220'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => '<strong>Send Email to users who have .. </strong>'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT' => '<select name="months">
<option value=3>Not logged in for 3 months
<option selected value=6>Not logged in for 6 months
<option value=12>Not logged in for 1 year
<option value=24>Not logged in for 2 years
</select>'));
$html_instance->process();
    $cat_title = 'New Category:';
    $select_category = '&nbsp;<input type="text" name="new_category" value="' . $new_category . '">';
} else {
    $cat_title = 'Category:';
    $select_category = '&nbsp;<select name="category_id">';
    for ($index = 1; $index <= sizeof($data); $index++) {
        $category_title = $data[$index]->title;
        $ID = $data[$index]->ID;
        if ($ID == $category_id) {
            $select_category .= "<option selected value={$ID}>{$category_title}";
        } else {
            $select_category .= "<option value={$ID}>{$category_title}";
        }
    }
    $select_category .= '</select> or <b>New Category:</b> <input type="text" name="new_category" value="' . $new_category . '" size="12">';
}
#
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Add Contact', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'BODY' => 'onLoad="javascript:document.form1.firstname.focus()"', 'BUTTON_TEXT' => 'Save Contact'));
$html_instance->add_form_field(array('TYPE' => 'label', 'TEXT1' => "{$cat_title}", 'TEXT2' => $select_category, 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'firstname', 'VALUE' => $firstname, 'SIZE' => 45, 'TEXT' => 'First Name'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'lastname', 'VALUE' => $lastname, 'SIZE' => 45, 'TEXT' => 'Last Name'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'company', 'VALUE' => $company, 'SIZE' => 45, 'TEXT' => 'Company'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'email', 'VALUE' => $email, 'SIZE' => 45, 'TEXT' => 'Email'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'telephone', 'VALUE' => $telephone, 'SIZE' => 45, 'TEXT' => 'Telephone'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'fax', 'VALUE' => $fax, 'SIZE' => 45, 'TEXT' => 'Fax'));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'mobile', 'VALUE' => $mobile, 'SIZE' => 45, 'TEXT' => 'Mobile'));
$html_instance->add_form_field(array('TYPE' => 'textarea', 'NAME' => 'address', 'VALUE' => $address, 'COLS' => 60, 'ROWS' => 3, 'TEXT' => 'Address', 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'textarea', 'NAME' => 'notes', 'VALUE' => $notes, 'COLS' => 60, 'ROWS' => 6, 'TEXT' => 'Notes', 'SECTIONS' => 2));
$html_instance->add_form_field(array('TYPE' => 'text', 'NAME' => 'url', 'VALUE' => $url, 'SIZE' => 45, 'TEXT' => 'Website'));
$html_instance->add_form_field(array('TYPE' => 'radio', 'NAME' => 'public', 'FIELD_ARRAY' => 'public_array', 'VALUE' => $public, 'TEXT' => 'Contact is'));
$html_instance->process();
        }
    }
    if (!$error) {
        $data = $base_instance->get_data('SHOW TABLE STATUS');
        for ($index = 1; $index <= sizeof($data); $index++) {
            $table_name = $data[$index]->Name;
            $first_part = substr($table_name, 0, 10);
            if ($first_part == 'organizer_') {
                $base_instance->query("DROP TABLE {$table_name}");
            } else {
                echo 'Table "', $table_name, '" not dropped<br>';
            }
        }
        $userid = _ADMIN_USERID;
        $filename2 = substr($filename, 0, -3);
        `gunzip ./upload/{$filename}`;
        $loginname = _DB_USER;
        $password = _DB_PW;
        $db_name = _DB_NAME;
        `mysql -u {$loginname} -p{$password} {$db_name} < ./upload/{$filename2}`;
        unlink("./upload/{$filename2}");
        echo 'Finished. Please <a href="index.php" target="_blank">login</a> here.';
        exit;
    } else {
        $html_instance->error_message = $error;
    }
}
$html_instance->add_parameter(array('ACTION' => 'show_form', 'HEADER' => 'Restore Backup', 'TEXT_CENTER' => 'Upload Backup File here (only gz extension). <font color="#FF0000">Be aware that this will delete all organizer tables of your current database!</font><br>If the backup file is very big you might be unable to successfully upload it from here. In this case you will have to restore it manually from shell.<p>', 'FORM_ACTION' => $_SERVER['PHP_SELF'], 'FORM_ATTRIB' => 'enctype="multipart/form-data"', 'BUTTON_TEXT' => 'Upload Backup'));
$html_instance->add_form_field(array('TYPE' => 'hidden', 'NAME' => 'MAX_FILE_SIZE', 'VALUE' => '10000000'));
$html_instance->add_form_field(array('TYPE' => 'file', 'NAME' => 'file1', 'SIZE' => 45, 'TEXT' => 'File'));
$html_instance->process();