Browse Source

Fix edit bio for new user

Fix edit bio for new user due to the author.md doesnt exist.
pull/31/merge
Danang Probo Sayekti 12 years ago
parent
commit
9a8397d78f
1 changed files with 13 additions and 7 deletions
  1. +13
    -7
      admin/action/edit_bio.php

+ 13
- 7
admin/action/edit_bio.php View File

@ -14,15 +14,21 @@
$filename = '../../content/' . $user . '/author.md';
if(file_exists($filename)) {
$content = file_get_contents($filename);
$arr = explode('t-->', $content);
if(isset($arr[1])) {
$oldtitle = ltrim(rtrim(str_replace('<!--t','',$arr[0]), ' '));
$oldcontent = ltrim($arr[1]);
$arr = explode('t-->', $content);
if(isset($arr[1])) {
$oldtitle = ltrim(rtrim(str_replace('<!--t','',$arr[0]), ' '));
$oldcontent = ltrim($arr[1]);
}
else {
$oldtitle = $user;
$oldcontent = ltrim($arr[0]);
}
}
else {
$oldtitle = 'Untitled';
$oldcontent = ltrim($arr[0]);
$oldtitle = $user;
$oldcontent = 'Just another HTMLy user.';
}
if(isset($_POST['submit'])) {
@ -74,7 +80,7 @@
<form method="POST">
Title: <br><input type="text" name="title" size="60" maxlength="60" value="<?php echo $oldtitle?>"/><br><br>
<div id="wmd-button-bar" class="wmd-button-bar"></div>
<textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"><?php if(file_exists($filename)) { echo $oldcontent;} ?></textarea><br>
<textarea id="wmd-input" class="wmd-input" name="content" cols="20" rows="10"><?php echo $oldcontent; ?></textarea><br>
<input type="submit" name="submit" value="Submit"/>
</form>
</div>


Loading…
Cancel
Save