| [ 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.sections.php - administer sections 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 function identify_admin_sections () { 23 $help = '<p>Sections are just a way of organizing posts. This plugin allows you to edit and delete sections. 24 When you make or edit a post, you can choose which sections it goes it.'; 25 return array ( 26 'name' =>'sections', 27 'type' =>'admin', 28 'nicename' =>'Sections', 29 'description' =>'Edit Sections', 30 'template' => 'sections.html', 31 'authors' =>'Eaden McKee <eadz@bblog.com>', 32 'licence' =>'GPL', 33 'help' => $help 34 ); 35 } 36 37 function admin_plugin_sections_run(&$bBlog) { 38 // Again, the plugin API needs work. 39 if(isset($_GET['sectdo'])) { $sectdo = $_GET['sectdo']; } 40 elseif(isset($_POST['sectdo'])) { $sectdo = $_POST['sectdo']; } 41 else { $sectdo = ''; } 42 43 switch($sectdo) { 44 case 'new' : // sections are being editied 45 $bBlog->query("insert into ".T_SECTIONS." 46 set nicename='".my_addslashes($_POST['nicename'])."', 47 name='".my_addslashes($_POST['urlname'])."'"); 48 $insid = $bBlog->insert_id; 49 $bBlog->get_sections(); // update the section cache 50 break; 51 52 case "Delete" : // delete section 53 // have to remove all references to the section in the posts 54 $sect_id = $bBlog->sect_by_name[$_POST['sname']]; 55 if($sect_id > 0) { // 56 $posts_in_section_q = $bBlog->make_post_query(array("sectionid"=>$sect_id)); 57 $posts_in_section = $bBlog->get_posts($posts_in_section_q,TRUE); 58 if($posts_in_section) { 59 foreach($posts_in_section as $post) { 60 unset($tmpr); 61 $tmpr = array(); 62 $tmpsections = explode(":",$post->sections); 63 foreach($tmpsections as $tmpsection) { 64 if($tmpsection != $sect_id) $tmpr[] = $tmpsection; 65 } 66 $newsects = implode(":",$tmpr); 67 // update the posts to remove the section 68 $bBlog->query("update ".T_POSTS." set sections='$newsects' 69 where postid='{$post->postid}'"); 70 71 } // end foreach ($post_in_section as $post) 72 } // end if($posts_in_section) 73 // delete the section 74 //$bBlog->get_results("delete from ".T_SECTIONS." where sectionid='$sect_id'"); 75 $bBlog->query("delete from ".T_SECTIONS." where sectionid='$sect_id'"); 76 //echo "delete from ".T_SECTIONS." where sectionid='$sect_id'"; 77 $bBlog->get_sections(); 78 //$bBlog->debugging=TRUE; 79 80 } // else show error 81 case "Save" : 82 $sect_id = $bBlog->sect_by_name[$_POST['sname']]; 83 if($sect_id < 1) break; 84 $bBlog->query("update ".T_SECTIONS 85 ." set nicename='".my_addslashes($_POST['nicename'])."' 86 where sectionid='$sect_id'"); 87 $bBlog->get_sections(); // update section cache 88 break; 89 90 default : // show form 91 break; 92 } 93 $bBlog->assign('esections',$bBlog->sections); 94 } 95 96 97 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |