/[pliva-si]/back/news/index.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /back/news/index.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Fri Nov 9 15:53:24 2001 UTC (22 years, 5 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
ignore more, fix

1 <?
2 include_once( "global.php" );
3 include_once( "dbconnect.php" );
4 include_once( "$phormationdir/displaytable.php" );
5
6
7 $params["query"] = "select id,visible,priority,title,town_date,date,body,pic,more,pdf,type from news";
8 $params["defaultsort"] = "date desc";
9 $params["editlink"] = "detail.php";
10 $params["newlink"] = "detail.php";
11 $params["addmultiplelink"] = "multi.php";
12 $params["delquery"] = "delete from news where id = ";
13 $params["predelete_hook"] = "my_predelete_fcn";
14 $params["key"] = "id";
15 $params["back"] = "../";
16
17 function my_predelete_fcn( $record_id )
18 {
19 // since we also have to delete a photo when we delete this record,
20 // we write a short function to do this. We pass the name of the function
21 // to Phormation in the "params" array, so that it will call this
22 // function just before deleting a record from the database.
23 $query = "select pic from news where id = $record_id";
24 $result = pg_exec( $query );
25 if( $result ) {
26 $array = pg_fetch_array( $result, 0 );
27 $filename = "$dir/".trim( $array[0] );
28 @unlink( $filename );
29 }
30 }
31
32 table_index( $fields, $names, $params );
33 ?>

  ViewVC Help
Powered by ViewVC 1.1.26