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

Annotation of /back/multi/global.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Tue Jul 3 12:41:05 2001 UTC (22 years, 10 months ago) by dpavlin
Branch: MAIN
multi-page support

1 dpavlin 1.1 <?
2    
3     $phormationdir = "../phormation";
4     $DB = "pgsql";
5    
6     $multi_dir="/data/pliva-si/multi";
7    
8     //-------------------------------------------------------------------
9    
10     $table="multi";
11    
12     $params["query"] = "select id,menu_num,name,num,html,visible from $table";
13     $params["defaultsort"] = "menu_num,num";
14     $params["key"] = "id";
15     $params["delquery"] = "delete from $table where $params[key] = ";
16    
17     //-------------------------------------------------------------------
18    
19     $fields[] = "visible"; $names[] = "Visible";
20     $types[]="type=boolean&default=1";
21    
22     if ($what == "edit") {
23     $fields[] = "id"; $names[] = "Unique ID";
24     $types[]="type=readonly";
25     }
26    
27     $fields[] = "menu_num"; $names[] = "Menu item";
28     $types[]="type=fkey&table=menu&query=select distinct num,upper(section)||' : '||item as desc,section from menu order by section,num&pkey=num&desc=desc";
29    
30     $fields[] = "name"; $names[] = "Name of page";
31     $types[]="type=text&length=50";
32    
33     $fields[] = "num"; $names[] = "Num (sort)";
34     $types[]="type=text&length=5";
35    
36     $fields[] = "html"; $names[] = "Html page";
37     $types[]="type=myfile&targetdir=$multi_dir&showfilename=1&serverdir=multi";
38    
39     //-------------------------------------------------------------------
40    
41     $conn = pg_connect( "dbname=plivasi user=dpavlin" );
42     if( !$conn ) {
43     echo "Couldn't connect to database!<BR>";
44     } else {
45     $result=pg_Exec($conn,"set datestyle = 'german'");
46     }
47    
48     //-------------------------------------------------------------------
49    
50     $opts["delete_hook"] = "my_delete_fcn";
51    
52     function my_delete_fcn( $tablename, $tablekey, $record_id ) {
53     $query = "select html from $tablename where $tablekey = $record_id";
54     $result = pg_exec( $query );
55     if( $result ) {
56     $array = pg_fetch_array( $result, 0 );
57     $filename = "$multi_dir/".trim( $array[0] );
58     @unlink( $filename );
59     }
60     deleterecord( $tablename, $tablekey, $record_id );
61     }
62    
63     ?>

  ViewVC Help
Powered by ViewVC 1.1.26