1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-23 23:20:57 +01:00

Error handling

This commit is contained in:
Savetheinternet 2010-11-02 22:54:08 +11:00
parent c645e6ae6f
commit 494387589c

View File

@ -76,12 +76,12 @@
$page = 1;
while($page <= MAX_PAGES && $content = index($page)) {
$filename = $page==1 ? FILE_INDEX : sprintf(FILE_PAGE, $page);
$md5 = md5_file($filename);
if(file_exists($filename)) $md5 = md5_file($filename);
$content['pages'] = $pages;
file_put_contents($filename, Element('index.html', $content));
file_put_contents($filename, Element('index.html', $content)) or error("Couldn't write to file.");
if($md5 == md5_file($filename)) {
if(isset($md5) && $md5 == md5_file($filename)) {
break;
}
$page++;
@ -89,7 +89,7 @@
if($page < MAX_PAGES) {
for(;$page<=MAX_PAGES;$page++) {
$filename = $page==1 ? FILE_INDEX : sprintf(FILE_PAGE, $page);
unlink($filename);
@unlink($filename);
}
}
}
@ -189,7 +189,7 @@
} else {
$thread->add(new Post($post['id'], $thread->id, $post['subject'], $post['email'], $post['name'], $post['trip'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename']));
}
file_put_contents(DIR_RES . $id . '.html', Element('thread.html', Array('button'=>BUTTON_REPLY, 'board'=>$board, 'body'=>$thread->build(), 'post_url' => POST_URL, 'index' => ROOT, 'id' => $id)));
file_put_contents(DIR_RES . $id . '.html', Element('thread.html', Array('button'=>BUTTON_REPLY, 'board'=>$board, 'body'=>$thread->build(), 'post_url' => POST_URL, 'index' => ROOT, 'id' => $id))) or error("Couldn't write to file.");
}
mysql_free_result($query);
}