| [ PHPXref.com ] | [ Generated: Sun Jul 20 16:35:25 2008 ] | [ bBlog 0.7.6 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 // admin.post.php - Handles posting an entry 3 /* 4 ** bBlog Weblog http://www.bblog.com/ 5 ** Copyright (C) 2003 Eaden McKee <email@eadz.co.nz> 6 ** 7 ** This program is free software; you can redistribute it and/or modify 8 ** it under the terms of the GNU General Public License as published by 9 ** the Free Software Foundation; either version 2 of the License, or 10 ** (at your option) any later version. 11 ** 12 ** This program is distributed in the hope that it will be useful, 13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 ** GNU General Public License for more details. 16 ** 17 ** You should have received a copy of the GNU General Public License 18 ** along with this program; if not, write to the Free Software 19 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21 22 23 function identify_admin_post () { 24 return array ( 25 'name' =>'post', 26 'type' =>'builtin', 27 'nicename' =>'Post', 28 'description' =>'Post in your blog', 29 'authors' =>'Eaden McKee <eadz@bblog.com>', 30 'licence' =>'GPL', 31 'help' =>'' 32 ); 33 } 34 35 36 $bBlog->assign('form_type','post'); // used in the template post_edit.html 37 $bBlog->assign('commentsallowvalue', " checked='checked' "); 38 if((isset($_POST['newpost'])) && ($_POST['newpost'] == 'true')) { // we have a poster 39 // make the data sql save 40 $post = prep_new_post(); 41 $res = $bBlog->new_post($post); 42 if(is_numeric($res)) { 43 $bBlog->assign('post_message',"Post #$res Added :)"); 44 45 if(strlen(C_PING)>0) { 46 include BBLOGROOT.'libs/rpc.php'; // include stuff needed to ping 47 register_shutdown_function('ping'); // who wants to wait for 4 48 // requests before the page loads ? 49 } 50 51 if ((isset($_POST['send_trackback'])) && ($_POST['send_trackback'] == "TRUE")) { 52 // send a trackback 53 include "./trackback.php"; 54 send_trackback($bBlog->_get_entry_permalink($res), $_POST['title_text'], $_POST['excerpt'], $_POST['tburl']); 55 } 56 57 } else $bBlog->assign('post_message',"Sorry, error adding post: $res"); 58 } 59 60 // get modifiers 61 $bBlog->get_modifiers(); 62 $bBlog->assign('selected_modifier',C_DEFAULT_MODIFIER); 63 64 if(C_DEFAULT_STATUS == 'draft') $bBlog->assign('statusdraft','checked="checked"'); 65 else $bBlog->assign('statuslive','checked="checked"'); 66 67 if ((isset($_REQUEST['popup']) && ($_REQUEST['popup'] == 'true'))) { 68 include 'inc/bookmarkletstuff.php'; 69 $bBlog->display('popuppost.html'); 70 } else { 71 $bBlog->display('post.html'); 72 } 73 74 //// 75 // !makes sure post data is sql safe 76 // and in a nice format 77 function prep_new_post () { 78 $post->title = my_addslashes($_POST['title_text']); 79 $post->body = my_addslashes($_POST['body_text']); 80 81 // there has to be abetter way that this but i'm tired. 82 if(!isset($_POST['modifier'])) $post->modifier = C_DEFAULT_MODIFIER; 83 else $post->modifier = my_addslashes($_POST['modifier']); 84 85 if(!isset($_POST['pubstatus'])) $post->status = C_DEFAULT_STATUS; 86 else $post->status = my_addslashes($_POST['pubstatus']); 87 88 if (isset($_POST['sections'])) 89 { 90 $_tmp_sections = (array) $_POST['sections']; 91 } 92 else 93 { 94 $_tmp_sections = null; 95 } 96 97 $post->sections = array(); 98 $post->providing_sections = TRUE; // this is so that bBlog knows to delete sections if there are none. 99 100 if (!is_null($_tmp_sections)) foreach ($_tmp_sections as $_tmp_section) if(is_numeric($_tmp_section)) $post->sections[] = $_tmp_section; 101 102 if ((isset($_POST['hidefromhome'])) && ($_POST['hidefromhome'] == 'hide')) { $hidefromhome='hide'; } 103 else { $hidefromhome='donthide'; } 104 105 $post->hidefromhome = $hidefromhome; 106 $post->allowcomments = $_POST['commentoptions']; 107 108 if (isset($_POST['disallowcommentsdays'])) { $disdays = (int) $_POST['disallowcommentsdays']; } else { $disdays = 0; } 109 110 $time = (int) time(); 111 $autodisabledate = $time + $disdays * 3600 * 24; 112 113 $post->autodisabledate = $autodisabledate; 114 115 return $post; 116 } 117 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |