/[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

Contents of /back/multi/global.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Mon Jan 7 14:29:30 2002 UTC (22 years, 3 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +2 -2 lines
display unique ID in overview page

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,type,html,path,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" || !isset($what)) {
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 label,section from menu order by section,num&pkey=num&desc=label";
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[] = "type"; $names[] = "Type of page";
37 $types[]="type=select&map[h]=Html page&map[p]=Path to page&selecttype=horizontal_radio&default=h";
38
39 $fields[] = "html"; $names[] = "Html page";
40 $types[]="type=myfile&targetdir=$multi_dir&showfilename=1&serverdir=multi";
41
42 $fields[] = "path"; $names[] = "Path to page";
43 $types[]="type=text&width=50&length=150";
44
45 //-------------------------------------------------------------------
46
47 $conn = pg_connect( "dbname=plivasi user=dpavlin" );
48 if( !$conn ) {
49 echo "Couldn't connect to database!<BR>";
50 } else {
51 $result=pg_Exec($conn,"set datestyle = 'german'");
52 }
53
54 //-------------------------------------------------------------------
55
56 $opts["delete_hook"] = "my_delete_fcn";
57
58 function my_delete_fcn( $tablename, $tablekey, $record_id ) {
59 $query = "select html from $tablename where $tablekey = $record_id";
60 print "$query";
61 $result = pg_exec( $query );
62 if( $result ) {
63 $array = pg_fetch_array( $result, 0 );
64 $filename = "$multi_dir/".trim( $array[0] );
65 # @unlink( $filename );
66 unlink( $filename );
67 }
68 deleterecord( $tablename, $tablekey, $record_id );
69 }
70
71 ?>

  ViewVC Help
Powered by ViewVC 1.1.26