function make_doc($docParams, $projectParams) { /** * comnines all the html strings into an index.php file * creates a sub directory * returns the path * * @since 1.0 * * @caller user action * @calls make_content, * make_editor_article, * make_new_dir, * add_piece, * add_index_file * make_the_toolbar * @ingroup make doc * * @param object $docParams all the params to make a doc * @param object $projectParams extra params to make a new project * @return object $return the new content with meta data sent back to the client */ $newDocLocation = $docParams['newDocLocation']; $amInASubDir = filter_var($projectParams['amInSubDir'], FILTER_VALIDATE_BOOLEAN); $makeProject = filter_var($projectParams['makeProject'], FILTER_VALIDATE_BOOLEAN); $contentObj = make_content($docParams); $editor_article = make_editor_article($contentObj); $dbLogin = db_login(); if ($makeProject) { $password = $projectParams['password']; $password = strlen(trim($password)) > 0 ? $password : null; $dir = make_new_dir(); $title = '<h1 id="articleTitle" tabindex="-1">' . '<i><span style="font-size: 32px;">' . $projectParams['title'] . '</span></i>' . '</h1>'; $islocked = 0; $showinstructions = 1; add_piece($dir . '/subfile' . '.txt', 'user file'); add_index_file($dir); $return = array('makeProject' => true, 'href' => $dir, 'isInNewTab' => $newDocLocation === 'new tab' ? true : false); try { $db = new PDO($dbLogin['dsn'], $dbLogin['user'], $dbLogin['pass']); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = <<<SQL \tINSERT INTO projects( directory, title, password, islocked, pages, showinstructions ) \tVALUES( :directory, :title, :password, :islocked, :pages, :showinstructions ) SQL; $query = $db->prepare($sql); $query->execute(array(':directory' => $dir, ':title' => $title, ':password' => $password, ':islocked' => $islocked, ':pages' => $editor_article, ':showinstructions' => $showinstructions)); } catch (PDOException $e) { die('Could not connect to the database:<br/>' . $e); } } else { $toolbar = make_the_toolbar($contentObj['date_time'], 'notSelected'); $editor_article = $toolbar . $editor_article; $return = array('makeProject' => false, 'editor' => $editor_article, '$Ob' => $newDocLocation); } echo json_encode($return); die; }
if ($elements[0] == "delete" && ADMIN) { $sql->db_Delete("wiki", "page_title='" . $row['page_title'] . "' "); Header("Location: ./"); } } } elseif (!isset($_GET['page'])) { // list of last 10 pages added or modified $title = LAN_W_3; $sql->db_Select("wiki", "*", "page_active = 1 ORDER BY page_datestamp DESC LIMIT 0,10", true); $content = make_links($sql->db_getList()); } else { $page = mysql_real_escape_string($_GET['page']); $count = $sql->db_Select("wiki", "*", "page_title = '" . $page . "' and page_active=1", true); if ($count > 0) { // Page does exists $row = $sql->db_Fetch(); $title = $row['page_title']; $content = make_content($row); $has_page = $row['page_id']; } elseif (check_perm()) { $title = "New Page"; $content = "" . page_form(array()); } else { // Page not found $title = LAN_W_1; $content = LAN_W_2; } } require_once HEADERF; $ns->tablerender($title, $content . make_footer($has_page)); require_once FOOTERF;