{
    // Get objects and vars from outside this function
    global $admin, $template, $database, $TEXT, $MESSAGE;
    // Get page list from database
    // $database = new database();
    $sql = 'SELECT `page_id` FROM `' . TABLE_PREFIX . 'pages` ' . 'WHERE `parent`=' . (int) $parent;
    // Insert values into main page list
    if ($get_pages = $database->query($sql)) {
        // Insert values into main page list
        while ($page = $get_pages->fetchRow(MYSQLI_ASSOC)) {
            // Fix page trail
            $sql = 'UPDATE `' . TABLE_PREFIX . 'pages` ' . 'SET `page_trail`=\'' . get_page_trail($page['page_id']) . '\' ' . ($root_parent != 0 ? '`root_parent`=' . (int) $root_parent . ', ' : '') . 'WHERE `page_id`=' . (int) $page['page_id'];
            $database->query($sql);
            // Run this query on subs
            fix_page_trail($page['page_id'], $root_parent);
        }
    }
}
// Fix sub-pages page trail
fix_page_trail($page_id, $root_parent);
/* END page "access file" code */
// Check if there is a db error, otherwise say successful
if ($database->is_error()) {
    $admin->print_error($database->get_error(), $target_url);
} elseif ($bBackLink) {
    $admin->print_success($MESSAGE['PAGES_SAVED_SETTINGS'], $pagetree_url);
} else {
    $admin->print_success($MESSAGE['PAGES_SAVED_SETTINGS'], $target_url);
}
// Print admin footer
$admin->print_footer();
            if (!$database->query($sql)) {
                $admin->print_error($database->get_error, $js_back);
                break;
            }
        }
    }
}
// Query current search settings in the db, then loop through them and update the db with the new value
$sql = 'SELECT `name`, `value` FROM `' . TABLE_PREFIX . 'search` ' . 'WHERE `extra`=\'\'';
if (!($res_search = $database->query($sql))) {
    $admin->print_error($database->is_error(), $js_back);
}
while ($search_setting = $res_search->fetchRow()) {
    $old_value = $search_setting['value'];
    $setting_name = $search_setting['name'];
    $post_name = 'search_' . $search_setting['name'];
    // hold old value if post is empty
    // check search template
    $value = $admin->get_post($post_name) == '' && $setting_name != 'template' ? $old_value : $admin->get_post($post_name);
    if (isset($value)) {
        $value = $database->escapeString($value);
        $sql = 'UPDATE `' . TABLE_PREFIX . 'search` ' . 'SET `value`=\'' . $value . '\' ' . 'WHERE `name`=\'' . $setting_name . '\' AND `extra`=\'\'';
        if (!$database->query($sql)) {
            $admin->print_error(TABLE_PREFIX . 'search :: ' . $MESSAGE['GENERIC_NOT_UPGRADED'] . '<br />' . $database->get_error, $js_back);
            break;
        }
        // $sql_info = mysql_info($database->db_handle); //->> nicht mehr erforderlich
    }
}
$admin->print_success($MESSAGE['SETTINGS_SAVED'], $js_back);
$admin->print_footer();
        $common_field = 'page_id';
        $table = TABLE_PREFIX . 'sections';
    } else {
        $id = $_GET['page_id'];
        $id_field = 'page_id';
        $common_field = 'parent';
        $table = TABLE_PREFIX . 'pages';
    }
} else {
    header("Location: index.php");
    exit(0);
}
// Create new admin object and print admin header
$admin = new admin('Pages', 'pages_settings');
// Create new order object an reorder
$order = new order($table, 'position', $id_field, $common_field);
if ($id_field == 'page_id') {
    if ($order->move_up($id)) {
        $admin->print_success($MESSAGE['PAGES_REORDERED']);
    } else {
        $admin->print_error($MESSAGE['PAGES_CANNOT_REORDER']);
    }
} else {
    if ($order->move_up($id)) {
        $admin->print_success($TEXT['SUCCESS'], ADMIN_URL . '/pages/sections.php?page_id=' . $page_id);
    } else {
        $admin->print_error($TEXT['ERROR'], ADMIN_URL . '/pages/sections.php?page_id=' . $page_id);
    }
}
// Print admin footer
$admin->print_footer();
    if ($list == 0) {
        // error while trying to extract the archive (most likely wrong format)
        $admin->print_error('UNABLE TO UNZIP FILE' . $archive->errorInfo(true));
    }
    $sum_files = 0;
    // rename executable files!
    foreach ($list as $key => $val) {
        if ($val['folder'] && change_mode($val['filename'])) {
            $sum_dirs++;
        } elseif (is_writable($val['filename']) && $val['status'] == 'ok' && change_mode($val['filename'])) {
            $sum_files++;
        }
    }
    if (isset($_POST['delzip'])) {
        unlink($filename1);
    }
    $dir = dirname($filename1);
    if (file_exists($dir)) {
        $array = createFolderProtectFile($dir);
    }
}
unset($list);
if ($sum_files == 1) {
    $admin->print_success($sum_files . ' ' . $MESSAGE['MEDIA_SINGLE_UPLOADED']);
} elseif ($sum_files > 1) {
    $admin->print_success($sum_files . ' ' . $MESSAGE['MEDIA_UPLOADED']);
} else {
    $admin->print_error($MESSAGE['MEDIA_NO_FILE_UPLOADED']);
}
// Print admin
$admin->print_footer();
<?php

/*
*	@version	0.1
*	@author		Ruud Eisinga (Ruud)
*	@date		2009-04-10
*/
require '../../config.php';
// Get id
if (!isset($_GET['group_id']) or !is_numeric($_GET['group_id'])) {
    header("Location: " . ADMIN_URL . "/pages/index.php");
} else {
    $group_id = $_GET['group_id'];
}
// Include WB admin wrapper script
require_once WB_PATH . '/framework/class.admin.php';
require_once WB_PATH . '/framework/functions.php';
$admintool_link = ADMIN_URL . '/admintools/index.php';
$module_edit_link = ADMIN_URL . '/admintools/tool.php?tool=capslider';
$admin = new admin('admintools', 'admintools');
$gtable = TABLE_PREFIX . 'mod_capslider_groups';
$database->query("DELETE FROM " . $gtable . " WHERE group_id = '{$group_id}' LIMIT 1");
// Check if there is a db error, otherwise say successful
if ($database->is_error()) {
    $admin->print_error($database->get_error(), $module_edit_link);
} else {
    $admin->print_success($TEXT['SUCCESS'], $module_edit_link);
}
// Print admin footer
$admin->print_footer();
<?php

/*
*	@version	0.1.0
*	@author		Ruud Eisinga (Ruud)
*	@date		2009-04-10
*/
require '../../config.php';
require_once WB_PATH . '/framework/class.admin.php';
require_once WB_PATH . '/framework/functions.php';
$admin = new admin('admintools', 'admintools', false, false);
if ($admin->get_permission('admintools') == true) {
    $admintool_link = ADMIN_URL . '/admintools/index.php';
    $module_edit_link = ADMIN_URL . '/admintools/tool.php?tool=capslider';
    $admin = new admin('admintools', 'admintools');
    $gtable = TABLE_PREFIX . 'mod_capslider_groups';
    $database->query("INSERT INTO " . $gtable . " (group_name) VALUES ('' )");
    // Get the id
    $group_id = $database->get_one("SELECT LAST_INSERT_ID()");
    // Say that a new record has been added, then redirect to modify page
    if ($database->is_error()) {
        $admin->print_error($database->get_error(), $module_edit_link);
    } else {
        $admin->print_success($TEXT['SUCCESS'], WB_URL . '/modules/capslider/modify_group.php?group_id=' . $group_id);
    }
    // Print admin footer
    $admin->print_footer();
} else {
    die(header('Location: ../../index.php'));
}
 *
 */
require '../../config.php';
require_once WB_PATH . '/framework/class.admin.php';
$admin = new admin('Pages', 'pages');
// Include the WB functions file
require_once WB_PATH . '/framework/functions.php';
// Get page list from database
// $database = new database();
$query = "SELECT * FROM " . TABLE_PREFIX . "pages WHERE visibility = 'deleted' ORDER BY level DESC";
$get_pages = $database->query($query);
// Insert values into main page list
if ($get_pages->numRows() > 0) {
    while ($page = $get_pages->fetchRow()) {
        // Delete page subs
        $sub_pages = get_subs($page['page_id'], array());
        foreach ($sub_pages as $sub_page_id) {
            delete_page($sub_page_id);
        }
        // Delete page
        delete_page($page['page_id']);
    }
}
// Check if there is a db error, otherwise say successful
if ($database->is_error()) {
    $admin->print_error($database->get_error());
} else {
    $admin->print_success($TEXT['TRASH_EMPTIED']);
}
// Print admin
$admin->print_footer();
Exemple #8
0
/*
*	@version	0.1.0
*	@author		Ruud Eisinga (Ruud)
*	@date		2009-04-10
*/
require '../../config.php';
require_once WB_PATH . '/framework/class.admin.php';
require_once WB_PATH . '/framework/functions.php';
$admin = new admin('admintools', 'admintools', false, false);
if ($admin->get_permission('admintools') == true) {
    $admintool_link = ADMIN_URL . '/admintools/index.php';
    $module_edit_link = ADMIN_URL . '/admintools/tool.php?tool=capslider';
    $admin = new admin('admintools', 'admintools');
    $modified_when = time();
    $modified_by = $admin->get_user_id();
    $btable = TABLE_PREFIX . 'mod_capslider_slide';
    $database->query("INSERT INTO " . $btable . " (active,modified_when,modified_by) VALUES ('1','{$modified_when}','{$modified_by}' )");
    // Get the id
    $slide_id = $database->get_one("SELECT LAST_INSERT_ID()");
    // Say that a new record has been added, then redirect to modify page
    if ($database->is_error()) {
        $admin->print_error($database->get_error(), $module_edit_link);
    } else {
        $admin->print_success($TEXT['SUCCESS'], WB_URL . '/modules/capslider/modify_slide.php?slide_id=' . $slide_id);
    }
    // Print admin footer
    $admin->print_footer();
} else {
    die(header('Location: ../../index.php'));
}
$name = trim(media_filename($name), '.');
// Target location
$requestMethod = '_' . strtoupper($_SERVER['REQUEST_METHOD']);
$target = isset(${$requestMethod}['target']) ? ${$requestMethod}['target'] : '';
if (!$admin->checkFTAN()) {
    $admin->print_header();
    $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL);
}
// After check print the header
$admin->print_header();
if (!check_media_path($target, false)) {
    $admin->print_error($MESSAGE['MEDIA_TARGET_DOT_DOT_SLASH']);
}
// Create relative path of the new dir name
$directory = WB_PATH . $target . '/' . $name;
// Check to see if the folder already exists
if (file_exists($directory)) {
    $admin->print_error($MESSAGE['MEDIA_DIR_EXISTS']);
}
//if ( sizeof(createFolderProtectFile( $directory )) )
if (!make_dir($directory)) {
    $admin->print_error($MESSAGE['MEDIA_DIR_NOT_MADE']);
} else {
    createFolderProtectFile($directory);
    $usedFiles = array();
    // feature freeze
    // require_once(ADMIN_PATH.'/media/dse.php');
    $admin->print_success($MESSAGE['MEDIA_DIR_MADE']);
}
// Print admin
$admin->print_footer();
Exemple #10
0
// Make sure the template dir exists, and chmod if needed
if (!file_exists($template_dir)) {
    make_dir($template_dir);
} else {
    change_mode($template_dir);
}
if (!function_exists("rename_recursive_dirs")) {
    require_once LEPTON_PATH . "/framework/functions/function.rename_recursive_dirs.php";
}
rename_recursive_dirs($temp_unzip, $template_dir);
// Delete the temp zip file
if (file_exists($temp_file)) {
    unlink($temp_file);
}
// Chmod all the uploaded files
$dir = dir($template_dir);
while (false !== ($entry = $dir->read())) {
    // Skip pointers
    if (substr($entry, 0, 1) != '.' and $entry != '.svn' and !is_dir($template_dir . '/' . $entry)) {
        // Chmod file
        change_mode($template_dir . '/' . $entry);
    }
}
// is done by function rename_recursive_dirs
//rm_full_dir(LEPTON_PATH.'/temp/unzip/');
// Load template info into DB
load_template($template_dir);
// Print success message
$admin->print_success($success_message);
// Print admin footer
$admin->print_footer();
            $group_id = $b[1];
            if ($count == 1) {
                $new_group = $group_id;
            } else {
                $new_group = $new_group . ',' . $group_id;
            }
        }
    }
    if ($count == 0) {
        $err_page_id = $index_page[$p];
        //$pagetree_url = ADMIN_URL.'/pages/index.php';
        $target_url = ADMIN_URL . '/admintools/tool.php?tool=page_permission';
        //$admin->print_error($MESSAGE['PAGES']['SAVED_SETTINGS'], $target_url );
        $admin->print_error($MOD_PAGE_PERMISSION['TXT_ERROR'] . $err_page_id . $MOD_PAGE_PERMISSION['TXT_ERROR_HINT'], $target_url);
    } else {
        //Zurueckschreiben
        echo 'UPDATE `' . TABLE_PREFIX . 'pages` SET `admin_groups` = "' . $new_group . '" WHERE `page_id` = ' . $page_id . '<br />';
        $sql = 'UPDATE `' . TABLE_PREFIX . 'pages` SET `admin_groups` = "' . $new_group . '" WHERE `page_id` = ' . $page_id;
        $database->query($sql);
    }
}
$pagetree_url = ADMIN_URL . '/pages/index.php';
$target_url = ADMIN_URL . '/admintools/tool.php?tool=page_permission';
// Check if there is a db error, otherwise say successful
if ($database->is_error()) {
    $admin->print_error($database->get_error(), $target_url);
} else {
    $admin->print_success($MESSAGE['PAGES']['SAVED_SETTINGS'], $target_url);
}
// Print admin footer
$admin->print_footer();
            break;
        default:
            $error['no_sort'] = 1;
            break;
    }
}
if ($error != null) {
    header("Location: ../../index.php");
    exit;
}
// Create new admin object and print admin header
require_once WB_PATH . '/framework/class.admin.php';
$admin = new admin('Pages', 'pages_settings');
$sql = "SELECT file_name, position, id FROM `" . TABLE_PREFIX . "mod_foldergallery_files` WHERE parent_id =" . $cat_id . " ORDER BY file_name " . $sort;
$query = $database->query($sql);
if ($query->numRows()) {
    $sql = "UPDATE `" . TABLE_PREFIX . "mod_foldergallery_files` SET position= CASE ";
    $position = 1;
    while ($result = $query->fetchRow()) {
        $sql = $sql . "WHEN id=" . $result['id'] . " THEN '" . $position . "' ";
        $position++;
    }
    $sql = $sql . " ELSE position END;";
}
if ($database->query($sql)) {
    $admin->print_success($MESSAGE['PAGES']['REORDERED'], WB_URL . '/modules/foldergallery/admin/modify_cat_sort.php?page_id=' . $page_id . '&section_id=' . $section_id . '&cat_id=' . $cat_id);
} else {
    $admin->print_error($TEXT['ERROR'], WB_URL . '/modules/foldergallery/admin/modify_cat_sort.php?page_id=' . $page_id . '&section_id=' . $section_id . '&cat_id=' . $cat_id);
}
// Print admin footer
$admin->print_footer();
                }
            }
        }
    }
    // Update the page visibility to 'deleted'
    $sql = 'UPDATE `' . TABLE_PREFIX . 'pages` SET ' . '`visibility` = \'deleted\' ' . 'WHERE `page_id` = ' . $page_id . ' ' . '';
    $database->query($sql);
    if ($database->is_error()) {
        $admin->print_error($database->get_error());
    }
    //
    // Run trash subs for this page
    trash_subs($page_id);
} else {
    // Really dump the page
    // Delete page subs
    $sub_pages = get_subs($page_id, array());
    foreach ($sub_pages as $sub_page_id) {
        delete_page($sub_page_id);
    }
    // Delete page
    delete_page($page_id);
}
// Check if there is a db error, otherwise say successful
if ($database->is_error()) {
    $admin->print_error($database->get_error());
} else {
    $admin->print_success($MESSAGE['PAGES_DELETED']);
}
// Print admin footer
$admin->print_footer();
Exemple #14
0
        $id = $_GET['id'];
        $id_field = 'id';
        $common_field = 'parent_id';
        $table = TABLE_PREFIX . 'mod_foldergallery_categories';
    }
} else {
    header("Location: index.php");
    exit(0);
}
// Create new admin object and print admin header
require_once WB_PATH . '/framework/class.admin.php';
$admin = new admin('Pages', 'pages_settings');
// Include the ordering class
require WB_PATH . '/framework/class.order.php';
// Create new order object an reorder
$order = new order($table, 'position', $id_field, $common_field);
if ($id_field == 'id') {
    if ($order->move_up($id)) {
        $admin->print_success($MESSAGE['PAGES']['REORDERED'], ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
    } else {
        $admin->print_error($MESSAGE['PAGES']['CANNOT_REORDER'], ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
    }
} else {
    if ($order->move_up($id)) {
        $admin->print_success($TEXT['SUCCESS'], ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
    } else {
        $admin->print_error($TEXT['ERROR'], ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
    }
}
// Print admin footer
$admin->print_footer();
Exemple #15
0
require_once LEPTON_PATH . '/framework/summary.functions.php';
// load WB language file
require_once LEPTON_PATH . '/languages/' . LANGUAGE . '.php';
// create Admin object with admin header
$admin = new admin('Addons', '', true, false);
$js_back = ADMIN_URL . '/modules/index.php?advanced';
/**
 * Manually execute the specified module file (install.php, upgrade.php or uninstall.php)
 */
// check if specified module folder exists
$mod_path = LEPTON_PATH . '/modules/' . basename(LEPTON_PATH . '/' . $_POST['file']);
// let the old variablename if module use it
$module_dir = $mod_path;
if (!file_exists($mod_path . '/' . $_POST['action'] . '.php')) {
    $admin->print_error($TEXT['NOT_FOUND'] . ': <tt>"' . htmlentities(basename($mod_path)) . '/' . $_POST['action'] . '.php"</tt> ', $js_back);
}
// include modules install.php script
require $mod_path . '/' . $_POST['action'] . '.php';
// load module info into database and output status message
require $mod_path . "/info.php";
load_module($mod_path, false);
$msg = $TEXT['EXECUTE'] . ': <tt>"' . htmlentities(basename($mod_path)) . '/' . $_POST['action'] . '.php"</tt>';
switch ($_POST['action']) {
    case 'install':
    case 'upgrade':
    case 'uninstall':
        $admin->print_success($msg, $js_back);
        break;
    default:
        $admin->print_error($TEXT["ACTION_NOT_SUPPORTED"], $js_back);
}
Exemple #16
0
    } else {
        $admin->print_error($MESSAGE['USERS_INVALID_EMAIL'], 'index.php');
    }
}
/**
 *	Update the database
 *
 */
$fields = array('groups_id' => $groups_id, 'active' => $active, 'display_name' => $display_name, 'home_folder' => $home_folder, 'email' => $email);
if ($password2 != "") {
    $fields['password'] = md5($password);
}
/**
 *	Prevent from renaming user to "admin"
 *
 */
if ($username != 'admin') {
    $fields['username'] = $username;
}
$query = $database->build_mysql_query('UPDATE', TABLE_PREFIX . "users", $fields, "`user_id`='" . $user_id . "'");
$database->query($query);
if ($database->is_error()) {
    $admin->print_error($database->get_error(), 'index.php');
} else {
    $admin->print_success($MESSAGE['USERS_SAVED']);
}
/**
 *	Print admin footer
 *
 */
$admin->print_footer();
// After check print the header
$admin->print_header();
// Get perms
$sql = 'SELECT `admin_groups`,`admin_users` ' . 'FROM `' . TABLE_PREFIX . 'pages` ' . 'WHERE `page_id` = ' . $page_id;
$results = $database->query($sql);
$results_array = $results->fetchRow();
if (!$admin->ami_group_member($results_array['admin_users']) && !$admin->is_group_match($admin->get_groups_id(), $results_array['admin_groups'])) {
    $admin->print_error($MESSAGE['PAGES_INSUFFICIENT_PERMISSIONS']);
}
// Get page module
$sql = 'SELECT `module` FROM `' . TABLE_PREFIX . 'sections` ' . 'WHERE `page_id`=' . $page_id . ' AND `section_id`=' . $section_id;
$module = $database->get_one($sql);
if (!$module) {
    $admin->print_error($database->is_error() ? $database->get_error() : $MESSAGE['PAGES_NOT_FOUND']);
}
// Update the pages table
$now = time();
$sql = 'UPDATE `' . TABLE_PREFIX . 'pages` ' . 'SET `modified_when`=' . $now . ', ' . '`modified_by`=' . $admin->get_user_id() . ' ' . 'WHERE `page_id`=' . $page_id;
$database->query($sql);
// Include the modules saving script if it exists
if (file_exists(WB_PATH . '/modules/' . $module . '/save.php')) {
    include_once WB_PATH . '/modules/' . $module . '/save.php';
}
// Check if there is a db error, otherwise say successful
if ($database->is_error()) {
    $admin->print_error($database->get_error(), ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
} else {
    $admin->print_success($MESSAGE['PAGES_SAVED'], ADMIN_URL . '/pages/modify.php?page_id=' . $page_id);
}
// Print admin footer
$admin->print_footer();
    $admin->print_header();
    $admin->print_error($droplet_id . ' ) ' . $MESSAGE['GENERIC_SECURITY_ACCESS'], $ToolUrl);
}
$admin->print_header();
// Validate all fields
if ($admin->get_post('title') == '') {
    $admin->print_error($MESSAGE['GENERIC_FILL_IN_ALL'] . ' ( Droplet Name )', $ToolUrl);
} else {
    $title = $admin->add_slashes($admin->get_post('title'));
    $active = (int) $admin->get_post('active');
    $admin_view = (int) $admin->get_post('admin_view');
    $admin_edit = (int) $admin->get_post('admin_edit');
    $show_wysiwyg = (int) $admin->get_post('show_wysiwyg');
    $description = $admin->add_slashes($admin->get_post('description'));
    $tags = array('<?php', '?>', '<?');
    $content = $admin->add_slashes(str_replace($tags, '', $_POST['savecontent']));
    $comments = trim($admin->add_slashes($admin->get_post('comments')));
    $modified_when = time();
    $modified_by = (int) $admin->get_user_id();
}
// Update row
$sql = 'UPDATE `' . TABLE_PREFIX . 'mod_droplets` SET ' . '`name` = \'' . $title . '\', ' . '`active` = ' . $active . ', ' . '`admin_view` = ' . $admin_view . ', ' . '`admin_edit` = ' . $admin_edit . ', ' . '`show_wysiwyg` = ' . $show_wysiwyg . ', ' . '`description` = \'' . $description . '\', ' . '`code` = \'' . $content . '\', ' . '`comments` = \'' . $comments . '\', ' . '`modified_when` = ' . $modified_when . ', ' . '`modified_by` = ' . $modified_by . ' ' . 'WHERE `id` = ' . $droplet_id;
$database->query($sql);
// Check if there is a db error, otherwise say successful
if ($database->is_error()) {
    $admin->print_error($database->get_error(), $ToolUrl);
} else {
    $admin->print_success($TEXT['SUCCESS'], $ToolUrl);
}
// Print admin footer
$admin->print_footer();
if (!$admin->checkFTAN()) {
    $admin->print_header();
    $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $js_back);
}
// Check if group group_id is a valid number and doesnt equal 1
$group_id = intval($admin->checkIDKEY('group_id', 0, $_SERVER['REQUEST_METHOD']));
if ($group_id < 2) {
    // if($admin_header) { $admin->print_header(); }
    $admin->print_header();
    $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
}
// Gather details entered
$group_name = $admin->get_post_escaped('group_name');
// Check values
if ($group_name == "") {
    $admin->print_error($MESSAGE['GROUPS_GROUP_NAME_BLANK'], $js_back);
}
// After check print the header
$admin->print_header();
// Get system permissions
require_once ADMIN_PATH . '/groups/get_permissions.php';
// Update the database
$query = "UPDATE `" . TABLE_PREFIX . "groups` SET `name` = '{$group_name}', `system_permissions` = '{$system_permissions}', `module_permissions` = '{$module_permissions}', `template_permissions` = '{$template_permissions}' WHERE `group_id` = '{$group_id}'";
$database->query($query);
if ($database->is_error()) {
    $admin->print_error($database->get_error());
} else {
    $admin->print_success($MESSAGE['GROUPS_SAVED'], ADMIN_URL . '/groups/index.php');
}
// Print admin footer
$admin->print_footer();
Exemple #20
0
        // Function to change all child pages visibility to deleted
        function restore_subs($parent = 0)
        {
            global $database;
            // Query pages
            $query_menu = $database->query("SELECT page_id FROM " . TABLE_PREFIX . "pages WHERE parent = '{$parent}' ORDER BY position ASC");
            // Check if there are any pages to show
            if ($query_menu->numRows() > 0) {
                // Loop through pages
                while ($page = $query_menu->fetchRow()) {
                    // Update the page visibility to 'deleted'
                    $database->query("UPDATE " . TABLE_PREFIX . "pages SET visibility = 'public' WHERE page_id = '" . $page['page_id'] . "' LIMIT 1");
                    // Run this function again for all sub-pages
                    restore_subs($page['page_id']);
                }
            }
        }
        // Update the page visibility to 'deleted'
        $database->query("UPDATE " . TABLE_PREFIX . "pages SET visibility = 'public' WHERE page_id = '{$page_id}.' LIMIT 1");
        // Run trash subs for this page
        restore_subs($page_id);
    }
}
// Check if there is a db error, otherwise say successful
if ($database->is_error()) {
    $admin->print_error($database->get_error());
} else {
    $admin->print_success($MESSAGE['PAGES_RESTORED']);
}
// Print admin footer
$admin->print_footer();
                $delete_file = $name;
                $type = 'file';
            }
        }
    }
}
// Check to see if we could find an id to match
if (!isset($delete_file)) {
    $admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], $dirlink, false);
}
$relative_path = WB_PATH . MEDIA_DIRECTORY . '/' . $directory . '/' . $delete_file;
// Check if the file/folder exists
if (!file_exists($relative_path)) {
    $admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], $dirlink, false);
}
// Find out whether its a file or folder
if ($type == 'folder') {
    // Try and delete the directory
    if (rm_full_dir($relative_path)) {
        $admin->print_success($MESSAGE['MEDIA']['DELETED_DIR'], $dirlink);
    } else {
        $admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_DIR'], $dirlink, false);
    }
} else {
    // Try and delete the file
    if (unlink($relative_path)) {
        $admin->print_success($MESSAGE['MEDIA']['DELETED_FILE'], $dirlink);
    } else {
        $admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_FILE'], $dirlink, false);
    }
}
if (!$list) {
    $admin->print_error($MESSAGE['GENERIC_CANNOT_UNZIP']);
}
// Delete the temp zip file
if (file_exists($temp_file)) {
    unlink($temp_file);
}
// Chmod all the uploaded files
$dir = dir($module_dir);
while (false !== ($entry = $dir->read())) {
    // Skip pointers
    if (substr($entry, 0, 1) != '.' and $entry != '.svn' and !is_dir($module_dir . '/' . $entry)) {
        // Chmod file
        change_mode($module_dir . '/' . $entry, 'file');
    }
}
// Run the modules install // upgrade script if there is one
if (file_exists($module_dir . '/' . $action . '.php')) {
    require $module_dir . '/' . $action . '.php';
}
// Print success message
if ($action == "install") {
    // Load module info into DB
    load_module(WB_PATH . '/modules/' . $module_directory, false);
    $admin->print_success($MESSAGE['GENERIC_INSTALLED']);
} elseif ($action == "upgrade") {
    upgrade_module($module_directory, false);
    $admin->print_success($MESSAGE['GENERIC_UPGRADED']);
}
// Print admin footer
$admin->print_footer();
Exemple #23
0
    $template->pparse('output', 'page');
} elseif ($_POST['action'] == 'delete') {
    /**	************************
     *	Try to delete the selected User
     */
    //	Get Admin access to the current page?
    $admin = new admin('Access', 'users_delete');
    /**
     *	Test for user statusflags == 32 
     */
    $result = array();
    $database->execute_query("SELECT `statusflags` FROM `" . TABLE_PREFIX . "users` WHERE `user_id`= '" . $_POST['user_id'] . "'", true, $result, false);
    if ($result['statusflags'] == 32) {
        /**
         *	NOTICE: Aldus 15.12.2014	Error message is not in the language-file!
         */
        $admin->print_error("Can't delete User - User got statusflags 32.");
    } else {
        /**
         *	Delete the user
         */
        $database->query("DELETE FROM `" . TABLE_PREFIX . "users` WHERE `user_id`= '" . $_POST['user_id'] . "'");
        if ($database->is_error()) {
            $admin->print_error($database->get_error());
        } else {
            $admin->print_success($MESSAGE['USERS_DELETED']);
        }
    }
}
// Print admin footer
$admin->print_footer();
Exemple #24
0
    }
    $section = $query_section->fetchRow(MYSQL_ASSOC);
    // Include the modules delete file if it exists
    if (file_exists(LEPTON_PATH . '/modules/' . $section['module'] . '/delete.php')) {
        require LEPTON_PATH . '/modules/' . $section['module'] . '/delete.php';
    }
    $sql = 'DELETE FROM `' . TABLE_PREFIX . 'sections` ';
    $sql .= 'WHERE `section_id` =' . $section_id . ' LIMIT 1';
    $query_section = $database->query($sql);
    if ($database->is_error()) {
        $admin->print_error($database->get_error());
    } else {
        require LEPTON_PATH . '/framework/class.order.php';
        $order = new order(TABLE_PREFIX . 'sections', 'position', 'section_id', 'page_id');
        $order->clean($page_id);
        $admin->print_success($TEXT['SUCCESS'], ADMIN_URL . '/pages/sections.php?page_id=' . $page_id);
        $admin->print_footer();
        exit;
    }
} elseif (isset($_POST['module']) && $_POST['module'] != '') {
    // Get section info
    $module = preg_replace("/\\W/", "", addslashes($_POST['module']));
    // fix secunia 2010-91-4
    /**
     *	Is the module-name valide? Or in other words: does the module(-name) exists?
     *
     */
    $temp_result = $database->query("SELECT `name` from `" . TABLE_PREFIX . "addons` where `directory`='" . $module . "'");
    if (!$temp_result) {
        $admin->print_error($database->get_error());
    } else {
        $values = array('type' => 'Template', 'type_name' => $file, 'pages' => $add);
        $msg = replace_all($msg_template_str, $values);
        $page_names = "";
        while ($data = $info->fetchRow()) {
            $page_info = array('id' => $data['page_id'], 'title' => $data['page_title']);
            $page_names .= replace_all($page_template_str, $page_info);
        }
        /**
         *    Printing out the error-message and die().
         */
        $admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE'] . $msg . $page_names);
    }
}
// Check if we have permissions on the directory
if (!is_writable(WB_PATH . '/templates/' . $file)) {
    $admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL'] . WB_PATH . '/templates/' . $file);
}
// Try to delete the template dir
if (!rm_full_dir(WB_PATH . '/templates/' . $file)) {
    $admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL']);
} else {
    // Remove entry from DB
    $database->query("DELETE FROM " . TABLE_PREFIX . "addons WHERE directory = '" . $file . "' AND type = 'template'");
}
// Update pages that use this template with default template
// $database = new database();
$database->query("UPDATE " . TABLE_PREFIX . "pages SET template = '" . DEFAULT_TEMPLATE . "' WHERE template = '{$file}'");
// Print success message
$admin->print_success($MESSAGE['GENERIC_UNINSTALLED']);
// Print admin footer
$admin->print_footer();
                if (trim($_POST['start_date' . $section_id]) == '0' || trim($_POST['start_date' . $section_id]) == '') {
                    $publ_start = 0;
                } else {
                    $publ_start = jscalendar_to_timestamp($_POST['start_date' . $section_id]);
                }
                if (trim($_POST['end_date' . $section_id]) == '0' || trim($_POST['end_date' . $section_id]) == '') {
                    $publ_end = 0;
                } else {
                    $publ_end = jscalendar_to_timestamp($_POST['end_date' . $section_id], $publ_start);
                }
                if ($sql != '') {
                    $sql .= ",";
                }
                $sql .= " publ_start = '" . $admin->add_slashes($publ_start) . "'";
                $sql .= ", publ_end = '" . $admin->add_slashes($publ_end) . "'";
            }
            $query = "UPDATE " . TABLE_PREFIX . "sections SET {$sql} WHERE section_id = '{$section_id}' LIMIT 1";
            if ($sql != '') {
                $database->query($query);
            }
        }
    }
}
// Check for error or print success message
if ($database->is_error()) {
    $admin->print_error($database->get_error(), ADMIN_URL . '/pages/sections.php?page_id=' . $page_id);
} else {
    $admin->print_success($MESSAGE['PAGES_SECTIONS_PROPERTIES_SAVED'], ADMIN_URL . '/pages/sections.php?page_id=' . $page_id);
}
// Print admin footer
$admin->print_footer();
<?php

require '../../../config.php';
require_once WB_PATH . '/framework/class.admin.php';
$admin = new admin('Pages', 'pages');
if (!isset($_GET['dd']) || !is_numeric($_GET['dd'])) {
    exit;
}
$query_order_pages = sprintf("UPDATE `" . TABLE_PREFIX . "mod_jsadmin` \n\t\t\t\t\t\t\t\tSET `value` = '%d' \n\t\t\t\t\t\t\t\tWHERE `name` = 'mod_jsadmin_ajax_order_pages'", $_GET['dd']);
$database->query($query_order_pages);
if ($database->is_error()) {
    $admin->print_error($database->get_error(), ADMIN_URL . '/pages/index.php');
} else {
    $admin->print_success($TEXT['SUCCESS'], ADMIN_URL . '/pages/index.php');
}
$admin->print_footer();
?>

/**
 * WebsiteBaker Community Edition (WBCE)
 * Way Better Content Editing.
 * Visit http://wbce.org to learn more and to join the community.
 *
 * @copyright Ryan Djurovich (2004-2009)
 * @copyright WebsiteBaker Org. e.V. (2009-2015)
 * @copyright WBCE Project (2015-)
 * @license GNU GPL2 (or any later version)
 */
require_once '../../config.php';
$admin = new admin('admintools', 'admintools', true, false);
if ($admin->get_permission('admintools') == true) {
    $admintool_link = ADMIN_URL . '/admintools/index.php';
    $module_edit_link = ADMIN_URL . '/admintools/tool.php?tool=droplets';
    $modified_when = time();
    $modified_by = intval($admin->get_user_id());
    $query = 'INSERT INTO `%smod_droplets` SET `name`="", `code`="", `description`="", `comments`="", `active`=1, `modified_when`="%s", `modified_by`="%s"';
    $database->query(sprintf($query, TABLE_PREFIX, $modified_when, $modified_by));
    if ($database->is_error()) {
        $admin->print_error($database->get_error(), $module_edit_link);
    } else {
        $droplet_id = intval($database->get_one("SELECT LAST_INSERT_ID()"));
        $admin->print_success($TEXT['SUCCESS'], ADMIN_URL . '/admintools/tool.php?tool=droplets&do=modify&droplet_id=' . $droplet_id);
    }
} else {
    die(header('Location: ' . WB_URL));
}
// Print admin footer
$admin->print_footer();
Exemple #29
0
                            $sql = 'DELETE FROM  `' . TABLE_PREFIX . 'addons`  WHERE `type` = \'language\'';
                            $database->query($sql);
                            // Reload all languages
                            foreach ($languages['filename'] as &$file) {
                                load_language(LEPTON_PATH . '/languages/' . $file);
                            }
                            //  Reload the current language file - otherwise wie've got the last message in e.g. russian.
                            require LEPTON_PATH . '/languages/' . LANGUAGE . '.php';
                            // Add success message
                            $msg[] = '<span class="normal bold green">' . $MESSAGE['ADDON_LANGUAGES_RELOADED'] . '</span>';
                        } else {
                            // Add error message
                            $error_msg[] = '<span class="normal bold red">' . $MESSAGE['ADDON_ERROR_RELOAD'] . ' - No languages found!</span>';
                        }
                        break;
                }
            }
        }
    }
} else {
    $error_msg[] = '<span class="big bold red">' . $MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES'] . '</span> ';
}
//
if (sizeof($error_msg) > 0) {
    $error_msg = array_merge($error_msg, $msg);
    $admin->print_error(implode($error_msg, '<br />'), $backlink);
} else {
    // output success message
    $admin->print_success(implode($msg, '<br />'), $backlink);
}
// $admin->print_footer();
} else {
    $admin->print_header();
    $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL . '/admintools/tool.php?tool=droplets');
    $admin->print_footer();
    exit;
}
// Validate all fields
if ($admin->get_post('title') == '') {
    $admin->print_error($MESSAGE['GENERIC_FILL_IN_ALL'], ADMIN_URL . '/admintools/tool.php?tool=droplets&amp;do=modify&amp;droplet_id=' . $droplet_id);
} else {
    $title = $admin->add_slashes($admin->get_post('title'));
    $active = (int) $admin->get_post('active');
    $admin_view = (int) $admin->get_post('admin_view');
    $admin_edit = (int) $admin->get_post('admin_edit');
    $show_wysiwyg = (int) $admin->get_post('show_wysiwyg');
    $description = $admin->add_slashes($admin->get_post('description'));
    $tags = array('<?php', '?' . '>', '<?');
    $content = $admin->add_slashes(str_replace($tags, '', $_POST['savecontent']));
    $comments = $admin->add_slashes($admin->get_post('comments'));
    $modified_when = time();
    $modified_by = (int) $admin->get_user_id();
}
// Update row
$database->query(sprintf("UPDATE `%smod_droplets` SET `name` = '%s', active = '%s', admin_view = '%s', " . "admin_edit = '%s', show_wysiwyg = '%s', description = '%s', code = '%s', " . "comments = '%s', modified_when = '%s', modified_by = '%s' WHERE id = '%d'", TABLE_PREFIX, $title, $active, $admin_view, $admin_edit, $show_wysiwyg, $description, $content, $comments, $modified_when, $modified_by, $droplet_id));
if ($database->is_error()) {
    $admin->print_error($database->get_error(), ADMIN_URL . '/admintools/tool.php?tool=droplets');
} else {
    $admin->print_success($TEXT['SUCCESS'], ADMIN_URL . '/admintools/tool.php?tool=droplets');
}
// Print admin footer
$admin->print_footer();