requireUser(WEB_ROOT . '/login.' . SITE_CONFIG_PAGE_EXTENSION); /* setup page */ define("PAGE_NAME", t("add_page_name", "Add")); define("PAGE_DESCRIPTION", t("add_meta_description", "Add existing item")); define("PAGE_KEYWORDS", t("add_meta_keywords", "add, existing, item")); // load folder structure as array $folderListing = fileFolder::loadAllForSelect($Auth->id); // initial parent folder $parentId = '-1'; if (isset($_REQUEST['p'])) { $parentId = (int) $_REQUEST['p']; } /* handle submission */ if (((int) $_REQUEST['submitme']) && (coreFunctions::getUsersAccountLockStatus($Auth->id) == 0)) { // validation $folderName = trim($_REQUEST['folderName']); $isPublic = (int) trim($_REQUEST['isPublic']); $accessPassword = trim($_REQUEST['accessPassword']); $parentId = (int) $_REQUEST['parentId']; if (!strlen($folderName)) { notification::setError(t("please_enter_the_foldername", "Please enter the folder name")); } elseif (_CONFIG_DEMO_MODE == true) { notification::setError(t("no_changes_in_demo_mode")); } elseif(coreFunctions::getUsersAccountLockStatus($Auth->id) == 1) { notification::setError(t('account_locked_error_message', 'This account has been locked, please unlock the account to regain full functionality.')); } else { // check for existing folder $rs = $db->getRow('SELECT id FROM file_folder WHERE folderName = ' . $db->quote($folderName) . ' AND userId = ' . (int) $Auth->id); if ($rs) { if (COUNT($rs)) { notification::setError(t("already_a_folder_with_that_name", "You already have a folder with that name, please use another")); } } } if ($isPublic == 0) { $accessPassword = ''; } // create the account if (!notification::isErrors()) { // make sure the user owns the parent folder to stop tampering if (!isset($folderListing[$parentId])) { $parentId = 0; } // prepare password if (strlen($accessPassword)) { $accessPassword = MD5($accessPassword); } if ($parentId == 0) { $parentId = NULL; } // update folder $db = Database::getDatabase(true); $rs = $db->query('INSERT INTO file_folder (folderName, isPublic, userId, parentId, accessPassword, date_added) VALUES (:folderName, :isPublic, :userId, :parentId, :accessPassword, NOW())', array('folderName' => $folderName, 'isPublic' => $isPublic, 'userId' => $Auth->id, 'parentId' => $parentId, 'accessPassword' => $accessPassword)); if ($rs) { // redirect coreFunctions::redirect(WEB_ROOT . "/account_home." . SITE_CONFIG_PAGE_EXTENSION); } else { notification::setError(t("problem_updating_item", "There was a problem updating the item, please try again later.")); } } } // include header require_once(SITE_TEMPLATES_PATH . '/partial/_header.inc.php'); ?>



  • " class="submitInput" />