Main Page | Directories | File List | File Members

detail-sober.php

Go to the documentation of this file.
00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: detail.php 4993 2005-11-17 15:13:57Z yeupou $
00006 #
00007 #  Copyright 1999-2000 (c) The SourceForge Crew
00008 #  Copyright 2001-2002 (c) Laurent Julliard, CodeX Team, Xerox
00009 #
00010 #  Copyright 2002-2005 (c) Mathieu Roy <yeupou--gnu.org>
00011 #                          Yves Perrin <yves.perrin--cern.ch>
00012 #
00013 #
00014 # The Savane project is free software; you can redistribute it and/or
00015 # modify it under the terms of the GNU General Public License
00016 # as published by the Free Software Foundation; either version 2
00017 # of the License, or (at your option) any later version.
00018 #
00019 # The Savane project is distributed in the hope that it will be useful,
00020 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 # GNU General Public License for more details.
00023 #
00024 # You should have received a copy of the GNU General Public License
00025 # along with the Savane project; if not, write to the Free Software
00026 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00027 
00028 # This page is supposed to be register_globals_off() valid,
00029 # as inserted in cookbook/index.php that calls it.
00030 
00031 $item_id = sane_all("item_id");
00032 if (defined('PRINTER'))
00033 { $printer = 1; }
00034 
00035 # If we are a comingfrom=$group_id defined, it means that we want to show a
00036 # recipe from the system group as if it were from the current group
00037 $comingfrom = sane_get("comingfrom");
00038 
00039 # Site doc pretending to be project doc: set the group id to the one of the
00040 # system group, so its setup will prevail (private right etc)
00041 if ($comingfrom)
00042 { $group_id = $sys_group_id; }
00043 
00044 $sql="SELECT * FROM ".ARTIFACT." WHERE bug_id='$item_id' AND group_id='$group_id'";
00045 
00046 $result=db_query($sql);
00047 
00048 if (db_numrows($result) == 0)
00049 {
00050   if (!$comingfrom)
00051     {
00052       exit_error(_("Item not found"));
00053     }
00054   else
00055     {
00056       # If comingfrom was set, if we are using site doc pretending to be
00057       # project doc, we may in fact be actually having comingfrom set by
00058       # mistake and wanting to see a project item.
00059       # This kind of "mistakes" happen when we want to pretend an item is
00060       # project wide while it is likely to be site wide but we cannot test
00061       # if this item is site wide because it would be requires to many
00062       # sql checks.
00063       # Typical case:  when recipe #nnn is converted to a link to the recipe
00064       #    in a comment of an item
00065 
00066       # Set the group id to be the comingfrom one
00067       $group_id = $comingfrom;
00068 
00069       # Unset the comingfrom variable because if it works, we are not in case
00070       # were comingfrom was appropriate
00071       unset($comingfrom);
00072 
00073       # See if it works
00074       $sql="SELECT * FROM ".ARTIFACT." WHERE bug_id='$item_id' AND group_id='$group_id'";
00075       $result=db_query($sql);
00076       if (db_numrows($result) == 0)
00077         {
00078           exit_error(_("Item not found"));
00079         }
00080 
00081     }
00082 }
00083 

Generated on Sun Feb 26 13:23:03 2006 for Savane PHP Frontend Developer Reference by  doxygen 1.4.4