[show modes: view edit news] [begin preamble] if(title2id(_title) != _id) _bestlink = {id=[_id]} else if(strcount(_title, "&")) _bestlink = {id=[_id]} else _bestlink = urlencode(_title); [end preamble] [begin mode css] [ banner = getv("banner"); if(banner) { <style type="text/css"> #site_title { background: url('/pictures/universes/[$_title]/[banner]')[if(getv("text_color") == "white") { black}]; } #site_title a, #site_title { color: [getv("text_color")] !important; } #site_title #title_text img { display: none; } </style> } ] [end mode css] [begin mode create_group] [ if($_group == 0) {[ $g = new_group($_title); set_group(_id, $g); mute set_founder($g, $_author); mute set_group_profile_id($g, $_id); $gr = new_grouping($_author, $g); mute set_grouping_permissions($_author, $g, "cadre"); var hcount = 1; var hsum = 0; while(hcount > 0) {[ command({update entries as A inner join entries as B on A.parent = B.id set A.group = [$g] where B.group = [$g]; }); $remaining = retrieve({ select count(A.id) as e from entries as A inner join entries as B on A.parent = B.id where B.group = [$g] and A.group = 0; }); hcount = $remaining[0]["e"]; debug($remaining); debug("hcount: " & hcount & " children of " & $g); hsum += hcount; ]}; { Group created! [if(hsum > 0) {[hsum] child pages added to the group.}] <a href="/?id=[_id]&mode=edit">Click here to go back to the editor.</a> }; ]} else { This project already has a group! <a href="/?[_bestlink]">Click here to go back.</a> }; ] [end mode create_group] [begin mode delete] <form method="post" action="/"> <input type="hidden" name="id" value="[_id]"> <input type="hidden" name="mode" value="delete_submit"> To obliterate this universe and everything inside of it, type "YES, I'M REALLY, REALLY CERTAIN" into the below field:<br> <input name="remove"> <input type="submit" value="Delete it!"> </form> [end mode delete] [begin mode delete_submit] [ if(_params.remove != "YES, I'M REALLY, REALLY CERTAIN") {You didn't say the magic words.} else {[ $n = delete_page($_id); $m = delete_group($_group); if($m != "1") { <p>Group removal failed. You should probably tell an administrator.</p> }; if($n == "1") { <p><b>[$_title]</b> has been removed from <b>[get_title($_parent)]</b>.</p> } else { <p><b>[$_title]</b> could not be removed from <b>[get_title($_parent)]</b> by you ([$_viewer.name]). If you feel that should be able to do so, now might be a good time to <a href="mailto:[$_globals.ADMIN_EMAIL]?Subject=Can't delete universe">complain</a>.</p> } ]}; ] <p><a href="/?id=[$_parent]">Return to [get_title($_parent)]</a></p> [end mode delete_submit] [begin mode icon] [ if(getv("image") != "") $e = {/pictures/universes/[$_title]/[getv("image")]} else $e = {/pictures/default-avatar.png}; ] <a new href="/?[_bestlink]"><img src="[$e]" height="64px" title="[$_title]" style="vertical-align: middle; border-radius: 5px; box-shadow: rgba(0,0,0,0.2) 1px 2px 3px;"></a> [end mode icon] [begin mode add_news] [ $p = new_page({Untitled Entry}, $_id); set_template($p, title2id("News Post")); set_permissions($p, "cadrecadrec--r-c--r-"); set_group($p, 2); page("edit", $p); ] [end mode add_news] [begin mode news] [if(getv("blog_url") == "") { [ override_title(getv("blog_title"), {[$_title] News}); override_parent({./?[_bestlink]}, $_title); $pagesize = 10; $q = query("news", $pagesize, "id DESC, title", "parent", $_id, "template", title2id("News Post")); query_view("abbr", $q, list("no_icon")); $qc = query_count($q); if($qc > $pagesize) {<center>[ $np = next_page($q); $pp = previous_page($q); if($pp) {<br><br><a href="[$pp]">Previous</a> }; if($np) { <a href="[$np]">Next</a><br>}; page_list($q); ]</center>}; if(can_comment()) {<center><br> <a href="/?id=[$_id]&mode=add_news">Create news post</a> </center>}; ] } else { [suppress_title()] Transferring you to <a href="[getv("blog_url")]">[getv("blog_title")]</a>... [refresh_to(getv("blog_url"), 1)] }] [end mode news] [begin mode admin][ if(is_user_in_group($_viewer.id, $_group)) { [msg_start()] <span style="float: right; display: block; text-align: right"> <a href="/?id=[$_id]&mode=edit">edit</a><br> <a href="/edit_group.star?id=[$_group]">team</a> </span> <h2 style="margin: 0px"> <a href="/?[_bestlink]">[$_title]</a> </h2> <div style="clear: both"></div> [msg_end()] }; ][end mode admin] [begin mode link]<a href="/?[_bestlink]">[$_title]</a>[end mode link] [begin mode table] <tr><th><nobr><a href="/?[_bestlink]">[$_title]</a></nobr> <td>[_wiki_format(getv("summary"), "inline")] [end mode table] [begin mode abbr] [msg_start()] <span style="float: right; font-size: 60%; text-align: right"> [ if(_group > 0) {[ books = query_count(query("books", 0, "id", "group", _group, "template", title2id("Book"))); articles = query_count(query("books", 0, "id", "group", _group, "template", title2id("Recursive Wiki Page"))); languages = query_count(query("books", 0, "id", "group", _group, "template", title2id("Language"))); lfams = query_count(query("books", 0, "id", "group", _group, "template", title2id("Language Family"))); dicts = query_count(query("books", 0, "id", "group", _group, "template", title2id("Dictionary"))); words = query_count(query("books", 0, "id", "group", _group, "template", title2id("Dictionary Entry"))); np = query_count(query("books", 0, "id", "group", _group, "template", title2id("News Post"))); if(books > 1) books & " books<br>" else if(books == 1) "1 book<br>"; if(articles > 1) articles & " articles<br>" else if(articles == 1) "1 article<br>"; if(lfams > 1) lfams & " language families<br>" else if(lfams == 1) "1 language family<br>"; if(languages > 1) languages & " languages<br>" else if(languages == 1) "1 language<br>"; if(dicts > 1) dicts & " dictionaries<br>" else if(dicts == 1) "1 dictionary<br>"; if(dicts > 0) {[ if(words == 1) "1 word<br>" else words & " words<br>" ]}; if(np > 1) np & " news posts<br>" else if(np == 1) "1 news post<br>"; ]}; ] [if(count(_children()) == 0) {no content<br>}] [if(_body == "") {lacks description + synopsis} else if(getv("body") == "") {lacks description}] </span> [if(getv("image") != "") { [$e = {/pictures/universes/[$_title]/[getv("image")]}] <img src="[$e]" style="max-height: 100px; float: left; margin-right: 10px;"> } else if(file_exists({[_globals.VROOT]/avatars/[_owner.id].jpg})) { <img src="/pictures/avatars/[_owner.id].jpg" style="max-height: 100px; float: left; margin-right: 10px;"> } else { <img src="/pictures/default-avatar.png" style="max-height: 100px; float: left; margin-right: 10px;"> }] <div style="font-size: 140%"><a href="/?[_bestlink]">[$_title]</a></div> <div style="font-size: 70%">[ if(_group != 0) groupies = retrieve({select users.name, users.profile_id from groups inner join groupings on groups.id = groupings.group inner join users on groupings.user = users.id where groups.id = [_group] order by users.name asc}); founder = retrieve({select users.id, users.name, users.profile_id from groups inner join users on groups.founder = users.id where groups.id = [_group]}); if(count(groupies) > 1) { contributors: [x = foreach(groupies) (_data = (if(_data.profile_id == 0) _data.name else page("link", _data.profile_id) & ",")); substr(x, 0, -1)]<br> }; if(count(groupies)) { founder: [if(founder.0.profile_id == 0) founder.0.name else page("link", founder.0.profile_id)] [if(_owner.id != founder.0.id) {<br> maintainer: [if(_owner.profile_id == 0) _owner.name else page("link", _owner.profile_id)] }] }; ] </div> [_wiki_format(getv("summary"), "inline")] <div style="clear: both;"></div> [msg_end()] [end mode abbr] [begin mode view] [ _css(); page("view", 278); ] <div style="float: right; margin-left: 10px; font-size: 80%; text-align: right; max-width: 300px;"> [ if(getv("image") != "") { [$e = {/pictures/universes/[$_title]/[getv("image")]}] <img src="[$e]" style="max-width: 100%; margin-bottom: 10px; display: block; margin-left: auto;"> }; if(_group != 0) groupies = retrieve({select users.name, users.profile_id from groups inner join groupings on groups.id = groupings.group inner join users on groupings.user = users.id where groups.id = [_group] order by users.name asc}); founder = retrieve({select users.id, users.name, users.profile_id from groups inner join users on groups.founder = users.id where groups.id = [_group]}); if(getv("hide_stats") < 1) {[ if(count(groupies)) { [if(count(groupies) > 1) {contributors: [x = foreach(groupies) (_data = (if(_data.profile_id == 0) _data.name else page("link", _data.profile_id) & ",")); substr(x, 0, -1)]<br>} ] founder: [if(founder.0.profile_id == 0) founder.0.name else page("link", founder.0.profile_id)]<br> [if(_owner.id != founder.0.id) { maintainer: [if(_owner.profile_id == 0) _owner.name else page("link", _owner.profile_id)]<br> }] }; if(_group > 0) {[ books = query_count(query("books", 0, "id", "group", _group, "template", title2id("Book"))); articles = query_count(query("books", 0, "id", "group", _group, "template", title2id("Recursive Wiki Page"))); languages = query_count(query("books", 0, "id", "group", _group, "template", title2id("Language"))); lfams = query_count(query("books", 0, "id", "group", _group, "template", title2id("Language Family"))); dicts = query_count(query("books", 0, "id", "group", _group, "template", title2id("Dictionary"))); words = query_count(query("books", 0, "id", "group", _group, "template", title2id("Dictionary Entry"))); np = query_count(query("books", 0, "id", "group", _group, "template", title2id("News Post"))); if(books > 1) books & " books<br>" else if(books == 1) "1 book<br>"; if(articles > 1) articles & " articles<br>" else if(articles == 1) "1 article<br>"; if(lfams > 1) lfams & " language families<br>" else if(lfams == 1) "1 language family<br>"; if(languages > 1) languages & " languages<br>" else if(languages == 1) "1 language<br>"; if(dicts > 1) dicts & " dictionaries<br>" else if(dicts == 1) "1 dictionary<br>"; if(dicts > 0) {[ if(words == 1) "1 word<br>" else words & " words<br>" ]}; if(np > 1) np & " news posts<br>" else if(np == 1) "1 news post<br>"; ]}; ]}; ] </div> [bod = getv("body"); if(bod != "") _wiki_format(bod) else if(can_edit()) {<i>This universe doesn't have an introduction yet. <a href="/?id=[_id]&mode=edit">Click here to start editing</a>.</i><br>}; if(can_comment() && not(can_edit())) {<br><i><a href="/?id=[_id]&mode=add">add new book, language, language family, or list</a></i><br>}; ] <br> <table class="front_table"> [ search("table", "parent", $_id, "template", title2id("Book")); ] </table> [ $ss = search("table", "parent", $_id, "template", title2id("Language Family")) & search("table", "parent", $_id, "template", title2id("Language")); if($ss != "") { <br><br> <table class="front_table"> [$ss] </table> } ] [ $ss = search("table", "parent", $_id, "template", title2id("Universe List")); if($ss != "") { <br><br> <table class="front_table"> [$ss] </table> } ] [if(getv("blog_rss") == "") { [ $q = query("blog", 3, "id desc, title", "parent", $_id, "template", title2id("News Post")); if(query_count($q) > 0) {<h1><a href="/?id=[$_id]&mode=news">[iif(getv("blog_title"), getv("blog_title"), "News")]</a></h1>}; query_view("abbr", $q, list("no_icon")); if(can_comment()) {<center> <a href="/?id=[$_id]&mode=add_news">Create news post</a> </center>} ] <center> <a href="/?id=[$_id]&mode=news">More...</a> </center> } else { <h1><a href="[getv("blog_url")]">[iif(getv("blog_title"), getv("blog_title"), "News")]</a></h1> [ show("view", slice(get_rss(title2id("Tumblr Entry"), getv("blog_rss") ), 0, 3)) ] <center> <a href="[getv("blog_url")]">More...</a> </center> }] [ if(can_edit()) { <p style="text-align: right"> <a href="/?id=[_id]&mode=edit">edit this universe...</a> </p> }; ] [end mode view] [begin mode add] [ templates = {Language Language Family Book Universe List}; ] <h2>Create Section</h2> <form method="post" action="/"> <input type="hidden" name="id" value="[$_id]"> <input type="hidden" name="mode" value="add_submit"> <table style="width: 100%"> <tr><th style="width: 80px">Title:<td><input name="title" type="text" style="width: 100%;"> <tr><th style="width: 80px">Type:<td><select name="template">[foreach(templates) _data = { <option value="[title2id(replace(_data, chr(13), ""))]">[_data]</option>}] </select> <tr><td><td><input type="submit" value="Create"> </table> [end mode add] [begin mode add_submit] [ templates = {Language Language Family Book Universe List}; var fail = 1; mute foreach(templates) if(title2id(replace(_data, chr(13), "")) == _params.template) fail = 0; if(fail == 1) { <p>Bad template for creation; try again.</p> } else if($_params.title == "") { <p><b>Couldn't create new [title2id(_params.template)]</b>: you didn't specify a title!</p> } else {[ $p = new_page($_params.title, $_id); if($p != "0") { <p>[get_title(_params.template)] created. Go <a href="/?id=[p]">check it out</a>!</p> [ set_template($p, $_params.template); set_permissions($p, "cadrecadrecadre---r-"); set_group($p, $_group); if(_params.template == title2id("Universe List")) set_body($p, {<!>template=0<!>pagesize=10<!>alpha=}); ] } else { <p>Either something with the same title already exists in this universe, or a permissions failure occurred.</p> } ]}; ] [end mode add_submit] [begin mode edit][ if($_params.submit == "edit") { [ if(_params.universe_title != _title) {[ ut = replace(replace(_params.universe_title, ".", ""), "/", ""); if(not(can_direct())) {[ msg("You don't have permission to rename this universe."); ]} else if(ut == "") {[ msg("You can't rename the universe to an empty title."); ]} else if(search("id", "title", ut, "template", _template) != "") {[ msg("That title is already taken!"); ]} else {[ old_title = _title; upath = _globals.VROOT & "/universes/"; if(not(dir_exists({[$_globals.VROOT]/universes/[$_title]})) || mv(upath & old_title, upath & ut)) {[ msg({Done! [old_title] renamed to [ut].}); _title = ut; set_group_name(_group, ut); if(title2id(_title) != _id) _bestlink = {id=[_id]} else _bestlink = urlencode(_title); ]} else msg("Failure! Time to call the admin."); ]}; ]}; putv("no_mail", $_params.no_mail); putv("hide_stats", $_params.hide_stats); putv("summary", $_params.summary); putv("body", $_params.desc); putv("image", info_display($_params.image)); putv("blog_title", $_params.blog_title); putv("blog_url", $_params.blog_url); putv("blog_rss", $_params.blog_rss); putv("banner", info_display($_params.banner)); if($_params.text_color == "white") putv("text_color", _params.text_color) else if($_params.text_color == "black") putv("text_color", _params.text_color); msg_start(); ] Page updated! <a href="/?[_bestlink]">Click here</a> to see the results. [ msg_end(); ] }; if($_params.create == 1) {[msg_start(); if($_params.title == "") { <p><b>Couldn't create new list</b>: you didn't specify a title!</p> } else {[ $p = new_page($_params.title, $_id); if($p != "0") { <p>List created.</p> [ set_template($p, title2id("Universe List")); set_permissions($p, "cadrecadrecadre---r-"); set_group($p, $_group); set_body($p, {<!>template=0<!>pagesize=10<!>alpha=}); ] } else { <p>Either something with the same title already exists in this universe, or a permissions failure occurred.</p> } ]}; msg_end()]}; if($_params.create == 2) {[msg_start(); if($_params.title == "") { <p><b>Couldn't create new book</b>: you didn't specify a title!</p> } else {[ $p = new_page($_params.title, $_id); if($p != "0") { <p>Book created.</p> [ set_template($p, title2id("Book")); set_permissions($p, "cadrecadrecadre---r-"); set_author($p, $_viewer.id); set_group($p, $_group); ] } else { <p>Either something with the same title already exists in this universe, or a permissions failure occurred.</p> } ]}; msg_end();]}; if($_params.create == 3) {[msg_start(); if($_params.title == "") { <p><b>Couldn't create new language family</b>: you didn't specify a name!</p> } else {[ $p = new_page($_params.title, $_id); if($p != "0") { <p>Language family created.</p> [ set_template($p, title2id("Language Family")); set_permissions($p, "cadrecadrecadre---r-"); set_author($p, $_viewer.id); set_group($p, $_group); ] } else { <p>Either something with the same title already exists in this universe, or a permissions failure occurred.</p> } ]}; msg_end();]}; if($_params.create == 4) {[msg_start(); if($_params.title == "") { <p><b>Couldn't create new language</b>: you didn't specify a name!</p> } else {[ $p = new_page($_params.title, $_id); if($p != "0") { <p>Language family created.</p> [ set_template($p, title2id("Language")); set_permissions($p, "cadrecadrecadre---r-"); set_author($p, $_viewer.id); set_group($p, $_group); ] } else { <p>Either something with the same title already exists in this universe, or a permissions failure occurred.</p> } ]}; msg_end();]}; ] <form method="post" action="/"> <input type="hidden" name="id" value="[$_id]"> <input type="hidden" name="mode" value="edit"> <input type="hidden" name="submit" value="edit"> <table style="width: 100%"> <tr><th>Title: <td><input type="text" name="universe_title" value="[edit_display(_title)]"> <br><small>Any links to universe images or attached files will be broken if you rename the universe. Periods and slashes are not allowed.</small> <tr><th>Summary: <td><textarea name="summary" style="width: 100%;">[edit_display(getv("summary"))]</textarea> <br><small>Displayed on your profile page and the <a href="/?Universes">Universes</a> index.</small> <tr><th>Description: <td><textarea name="desc" style="width: 100%;" rows="7">[edit_display(getv("body"))]</textarea> <br><small>Displayed on the universe's main page.</small> <tr><th>Hide Stats: <td><input type="checkbox" name="hide_stats" id="hs" value="1" [if(getv("hide_stats")) {checked}]><label for="hs">Hide universe statistics</label> <tr><th>Image: <td> [ if(dir_exists({[$_globals.VROOT]/universes/[$_title]})) _select(getv("image"), "<!>(none)" & chr(10) & dirlist({/universes/[$_title]/}), "image", {width: 100%;}) else { <i>No image portfolio defined. </i> } ] <tr><th>Banner Image: <td> [ if(dir_exists({[$_globals.VROOT]/universes/[$_title]})) _select(getv("banner"), "<!>(none)" & chr(10) & dirlist({/universes/[$_title]/}), "banner", {width: 100%;}) else { <i>No image portfolio defined. </i> } ] <a href="/?id=[$_id]&mode=pictures" target="_blank">Manage pictures for this universe...</a> <tr><th valign="top">Banner Text Colour: <td>[ _select(getv("text_color"), {black[chr(10)]white}, "text_color"); ]<br> <tr><th valign="top">Blog Name: <td><input type="text" name="blog_title" value="[edit_display(getv("blog_title"))]"><br> <tr><th valign="top">Blog URL: <td><input type="text" name="blog_url" value="[edit_display(getv("blog_url"))]"><br> <tr><th valign="top">Blog RSS: <td><input type="text" name="blog_rss" value="[edit_display(getv("blog_rss"))]"><br> Input the URL to a blog's front page and RSS feed to use it for your profile. <a href="http://tumblr.com">Tumblr</a> and <a href="http://wordpress.com">Wordpress</a> blogs have been confirmed to work properly. If you prefer, however, you may leave this blank and use a built-in Cadre blog. A Cadre blog will let you automatically limit comments according to the site's controls, but a Tumblr or Wordpress blog may be better for sharing your work with others outside of our community.<br><br>If you provide a name for your blog, it will be used either way. <tr><th>Group: <td>[ if($_group == 0) { <a href="/?id=[$_id]&mode=create_group" target="_blank">Click here to initialize this universe's group</a>. This will let you give others the ability to participate in your project. } else { <a href="/edit_group.star?id=[$_group]" target="_blank">Click here to manage this universe's group</a>. This defines who is allowed to contribute to the universe, and how. } ] <tr><th>Discussion Messages: <td><input type="checkbox" name="no_mail" value="1" [if(getv("no_mail")) {checked}] id="no_mail"> <label for="no_mail">Do not notify group members of posts on discussion pages within this universe.</label> <tr><th>Deletion: <td><a href="/?id=[$_id]&mode=delete">Click here to initiate deletion of the whole universe</a>. (Confirmation is required.) Be careful with this! </table> <br><br> <center><input type="submit" value="Save Changes to Universe"></center> <br> </form> <div> <h1>Books</h1> <table class="front_table"> [ search("table", "parent", $_id, "template", title2id("Book")); ] [ if(can_comment()) { <form method="post" action="/"> <tr> <input type="hidden" name="id" value="[$_id]"> <input type="hidden" name="create" value="2"> <input type="hidden" name="mode" value="edit"> <th><nobr><input type="text" name="title" style="width: 80%;"> <input type="submit" value="+"></nobr> <td>Create a new book. This is the best container for notes about the conworld and other non-linguistic information. </form> }; ] </table> <h1>Language Families</h1> <table class="front_table"> [ search("table", "parent", $_id, "template", title2id("Language Family")); ] [ if(can_comment()) { <form method="post" action="/"> <tr> <input type="hidden" name="id" value="[$_id]"> <input type="hidden" name="create" value="3"> <input type="hidden" name="mode" value="edit"> <th><nobr><input type="text" name="title" style="width: 80%;"> <input type="submit" value="+"></nobr> <td>Create a new language family. This is a special kind of book specially designed for managing languages. </form> }; ] </table> <h1>Languages</h1> <table class="front_table"> [ search("table", "parent", $_id, "template", title2id("Language")); ] [ if(can_comment()) { <form method="post" action="/"> <tr> <input type="hidden" name="id" value="[$_id]"> <input type="hidden" name="create" value="4"> <input type="hidden" name="mode" value="edit"> <th><nobr><input type="text" name="title" style="width: 80%;"> <input type="submit" value="+"></nobr> <td>Create a new language at the root level. Use this section if you have an isolated language or auxiliary language with no lineage. You can also add languages inside language families. </form> }; ] </table> <h1>Lists</h1> <table class="front_table"> [ search("table", "parent", $_id, "template", title2id("Universe List")); if(can_comment()) { <form method="post" action="/"> <tr> <input type="hidden" name="id" value="[$_id]"> <input type="hidden" name="create" value="1"> <input type="hidden" name="mode" value="edit"> <th><nobr><input type="text" name="title" style="width: 80%;"> <input type="submit" value="+"></nobr> <td>Create a new list. You can use lists to manage special appendices such as itemized historical events or individuals. </form> }; ] </table> </div> [end mode edit] [begin mode pictures] [ $fn = {/universes/[$_title]/}; $fullfn = {[$_globals.VROOT][$fn]}; if(dir_exists($fullfn)) {[_gallery({universes/[$_title]}, 150, iif(can_direct(), 1, 0), $_id);]} else {[msg_start({text-align: center; padding-top: 30px; padding-bottom: 30px;})]<i>No image portfolio yet for this universe. [if(can_edit()) {Upload some pictures!};]</i>[msg_end()]}; if(can_edit()) { [ if(dir_exists($fullfn)) {[ $cc = strcount(dirlist({/universes/[$_title]}), chr(10)) + 1; if(dirlist({/universes/[$_title]}) == "") $cc = 0; ]} else {[ $cc = 0; ]}; if($cc < 50) { <form action="/" method="post" enctype="multipart/form-data"> <input type="file" name="ufile"> <input type="hidden" name="id" value="[$_id]"> <input type="hidden" name="mode" value="picture_submit"> <input type="submit" value="Upload" name="button"> <input type="submit" value="Upload and Rename" name="button"> </form> <p>You may not have more than 50 pictures. You have [$cc] picture(s).</p> } else {<p>You have too many ([$cc]) pictures to add more.</p>};] <p><a href="/?id=[$_id]&mode=edit">Return to editing [$_title]</a></p> };] [end mode pictures] [begin mode picture_rename] [ if(can_edit()) {[ $pp = $_params.picture; $pp = replace($pp, "/", ""); if(file_exists({[$_globals.VROOT]/universes/[$_title]/[$pp]})) { [msg_start()] <h3>Rename Image</h3> <center><img src="/pictures/universes/[$_title]/[$pp]"> <form method="post" action="/"> <input type="hidden" name="mode" value="picture_rename_submit"> <input type="hidden" name="id" value="[$_id]"> <input type="hidden" name="from" value="[$pp]"> <table> <tr> <th>From:<td>[substr($pp, 0, strrpos($pp, "."));] <tr> <th>To:<td><input type="text" name="to" value="[ substr($pp, 0, strrpos($pp, ".")); ]"> <tr><td><td> <input type="submit" value="Rename"> <a href="/?id=[$_id]&mode=pictures">Cancel</a> </table> </form> </center> [msg_end()] } else { Bad file name. This renaming has probably already been done. <a href="/?id=[$_id]&mode=pictures">Go back to the gallery.</a> }; ]} else { This is not your universe. <a href="/?id=[$_id]&mode=pictures">Go back to the gallery.</a> }; ] [end mode picture_rename] [begin mode picture_rename_submit] [ if(can_edit()) {[ $pp = $_params.from; $pp = replace($pp, "/", ""); $pt = $_params.to; $pt = replace($pt, "/", "") & substr($pp, strrpos($pp, ".")); if($_params.from == $params.to) { No? Alright...<br><br> <a href="/?id=[$_id]&mode=pictures">Go back to the gallery.</a> } else if(file_exists({[$_globals.VROOT]/universes/[$_title]/[$pt]})) { Destination file already exists. Perhaps you already renamed the file?<br><br> <a href="/?id=[$_id]&mode=pictures">Go back to the gallery.</a> } else if(file_exists({[$_globals.VROOT]/universes/[$_title]/[$pp]})) {[ $fpp = {[$_globals.VROOT]/universes/[$_title]/[$pp]}; $fpt = {[$_globals.VROOT]/universes/[$_title]/[$pt]}; if(mv($fpp, $fpt)) { File renamed! [refresh_to({/?id=[$_id]&mode=pictures}, 0)] <script type="javascript"><!-- document.location = "/?id=[$_id]&mode=pictures"; --></script> } else { File could not be renamed. }] <br><br> <a href="/?id=[$_id]&mode=pictures">Go back to the gallery.</a> } else { Bad file name. The source file was deleted.<br><br> <a href="/?id=[$_id]&mode=pictures">Go back to the gallery.</a> }; ]} else { This is not your universe. <a href="/?id=[$_id]&mode=pictures">Go back to the gallery.</a> }; ] [end mode picture_rename_submit] [begin mode picture_submit] <p> [ $fn = {/universes/[$_title]/}; $fullfn = {[$_globals.VROOT][$fn]}; if(dir_exists($fullfn)) {} else {[ if(mkdir($fullfn)) { Creating the universe's image portfolio for the first time. } else { Could not create the image portfolio. Expect a bunch of horrible error messages. }; ]}; $na = file_upload("ufile", $fn, 10485760); $fn = slice($na, 2, 1); if($fn != "null") { [// file_crop($fn, 150, 150);] Done. Upload successful! <br><br> Now that the image is uploaded, please go and make sure it has a name that will be easy to remember. [if($_params.button == "Upload") { [refresh_to({/?id=[$_id]&mode=pictures}, 2)] <script type="javascript"><!-- document.location = "/?id=[$_id]&mode=pictures"; --></script> } else { [refresh_to({/?id=[$_id]&mode=picture_rename&picture=[basename($fn)]}, 2)] <script type="javascript"><!-- document.location = "/?id=[$_id]&mode=picture_rename&picture=[basename($fn)]"; --></script> }] } else { File upload failed. Why is anyone's guess. Contact <a href="mailto:hexadecima@gmail.com">an administrator</a> if you want it fixed. }; ] <a href="/?id=[$_id]&mode=pictures">Go back</a>.</p> <p><a href="/?Settings">Or, return to Settings</a>.</p> [end mode picture_submit] [begin mode picture_delete] <p> [if(can_edit()) {[ $fn = {[$_globals.VROOT]/universes/[$_title]/[$_params.picture]}; if(file_exists($fn)) { [if(rm($fn)) {Deleted!} else {Not deleted! Oh no!}] } else { Not deleted because it doesn't exist! What's up with that? }; ]} else { This isn't your universe. Where did your life go so wrong? };] </p> <p><a href="/?id=[$_id]&mode=pictures">Go back</a>.</p> [end mode picture_delete]