$value) { $$key = $value; // echo "$key: $value
"; } // includes include("wcs/mysql.inc.php"); include("wcs/functions.inc.php"); include("wcs/template.inc.php"); include("wcs/selects.inc.php"); include "common/require.inc.php"; // definicije prije otvaranja baze if(file_exists("wcr_group/includes/multilang.inc.php")) include "wcr_group/includes/multilang.inc.php"; include("wcs/diehard.inc.php"); include("wcs/azuriraj.inc.php"); include("wcs/show.inc.php"); // za prikaz include("wcs/edit.inc.php"); // za unos // config define("_VALID_WCT", 1); $CMT[HOST] = $HOST; $CMT[DATABASE] = $BAZA; $CMT[USERNAME] = $JUZA; $CMT[PASSWORD] = $LOZA; $CMT[tabtable] = "wct_table"; $CMT[tabtr] = "wct_tr"; $CMT[tabtd] = "wct_td"; $CMT[tabattype] = "wct_attype"; $CMT[tabattribute] = "wct_attribute"; $CMT[tabstrkey] = "wct_strkey"; $CMT[tabfilter] = "wct_filter"; $CMT[tabfield] = "wct_field"; $CMT[tabnavigation] = "wct_navigation"; $CMT[tabfile] = "wct_file"; // ovo sve moze bit u nekoj drugoj tabeli $CMT[login_mess] = "prijavi se"; $CMT[logout_mess] = "odjavi se"; $CMT[submit_mess] = "Prihvati"; $CMT[cancel_mess] = "Odustani"; $CMT[required_mess] = "Obavezno upisati"; $CMT[error_in_form] = convert_uni_2_web("Greąka kod unosa"); $CMT[reenter_form] = "Ponoviti unos"; //$CMT[required_icon] = "ikone/icon_asterix.gif"; $CMT[help_icon] = 'wcs/images/help.gif'; $CMT[submit_upisi] = convert_uni_2_web("Upiši"); $CMT[submit_odustani] = "Odustani"; $CMT[insert_mess] = "dodaj"; $CMT[update_mess] = "izmijeni"; $CMT[delete_mess] = convert_uni_2_web("obriši"); $CMT[insert_img] = "$CMT[insert_mess]"; $CMT[update_img] = "$CMT[update_mess]"; $CMT[delete_img] = "$CMT[delete_mess]"; // za disp=1 $CMT[checked_yes] = "Da"; $CMT[checked_not] = "Ne"; $CMT[noinsert_mess] = "Nemate pravo unosa"; $CMT[noupdate_mess] = "Nemate pravo izmjene"; $CMT[nodelete_mess] = "Nemate pravo brisanja"; $CMT[back_mess] = "Povratak"; $CMT[print_version_icon] = "ikone/print-icon.gif"; // default vrijednosti $CMT[pageitems] = 10; // broj redaka na jednoj strani $CMT[navpages] = 10; // navigacija nudi 10 stranica $CMT[default_template] = "includes/index.php"; // mora postojati $CMT[css] = "css/default.css"; // css // input vrijednosti $CMT[text_default] = 'size="50" maxlength="255"'; $CMT[textarea_default] = 'cols="100" rows="3"'; $CMT[file_default] = 'size="20"'; /* default postavke (trbaju postojati u .css za tabele koje ispljune ovaj program table.wct sama tabela table.wct td.title naslov tablice table.wct td.header nazivi stupaca table.wct tr.item0 podaci u 1. redu table.wct tr.item1 podaci u 2. redu, naizmjenično */ /* id id tabele */ foreach($HTTP_POST_VARS as $key=>$value) { $$key=$value; // echo "_P $key: $value
"; } /* zbog prelaska sa id na wct: ako drugi siteovi imaju poziv sa id prema ponline zamijeni id sa wct */ if(empty($HTTP_GET_VARS[wct]) || !empty($HTTP_GET_VARS[id])) { $HTTP_GET_VARS[wct] = $HTTP_GET_VARS[id]; } if($HTTP_GET_VARS[rid]=="") $HTTP_GET_VARS[rid] = '0'; foreach($HTTP_GET_VARS as $key=>$value) { $$key=$value; // echo "_G $key: $value
"; // počisti nepotrebne varijable if($value="") { unset($HTTP_GET_VARS[$key]); unset($key); } } // die(); /* GET ide nakon POST da ne bi slučajno POST[id] pregazio id koji je najvazniji */ global $VArow; $VArow[ISO] = "UTF-8"; if(empty($CMT[wct_css])) $CMT[wct_css] = ""; include("wcs/db_open.php"); global $rowt; if(isset($wct)) // rowt is needed always $rowt=gimme($CMT[tabtable],$wct); if($rowt[id]!=$wct) die("Wrong URL: $QUERY_STRING

"); if($rowt[tb_login_required]) // preuzmi iz wct_table, naknadno se moze kontrolirati kroz include skriptu $CMT[login_required]="1"; else $CMT[login_required]="0"; // jos neki parametri iz wct_table if($rowt[tb_insert_mess]) $CMT[insert_mess] = $rowt[tb_insert_mess]; if($rowt[tb_update_mess]) $CMT[update_mess] = $rowt[tb_update_mess]; if($rowt[tb_delete_mess]) $CMT[delete_mess] = $rowt[tb_delete_mess]; $VArow[title] = $rowt[tb_caption]; $VArow[preinsert_text] = $rowt[tb_preinsert_text]; $VArow[preupdate_text] = $rowt[tb_preupdate_text]; if(!empty($rowt[tb_include])) // includes file for this table include($rowt[tb_include]); // aditional_includes if(!empty($rowt[tb_includes])) { $inc_array = explode("\n",$rowt[tb_includes]); foreach($inc_array as $i => $inc_file) { $inc_file = chop(trim($inc_file)); //echo "$inc_file
"; if(!empty($inc_file)) include($inc_file); } } tpl_defs(); // template parametri // $function_call = "show_membID"; // die(function_exists($function_call)); // global (for template) $cookuser = cookie_user(); // cookie_user array $CMT[cookie_user] = $cookuser[0]; // user id u $CMT (pa se vidi svuda) $CMT[cookie_nickname] = $cookuser[2]; // user nick u $CMT (pa se vidi svuda) $CMT[user_privileg] = wct_privileg($cookuser[0]); $CMT[template] = $rowt[tb_template]; $CMT[wct_css] = ""; /* if ($run='row') { foreach($VArow as $key=>$value) { $$key=$value; echo "$key: $value
"; } die($VArow[login]); } */ if(empty($CMT[cookie_user]) && ($CMT[login_required]=="1") && ($run!="login")) { if(function_exists("login_form")) $run="login_form"; else $run = "login_form0"; // default (wcs/functions.inc.php) /* foreach($CMT as $key=>$value) { $$key=$value; echo "$key: $value
"; } die("Trebao bi se logirati"); */ } if (function_exists("before_run")) before_run(); // ako nema neke funkcije, mozda ima odgovarajucu include datoteku if(!function_exists($run)) { $call_inc = "includes/".$run.".inc.php"; if(file_exists($call_inc)) include $call_inc; } //die( "$run
"); switch ($run) { case 'tab': // show table if(!empty($wct)) $CMT[maintable] = cmt_table($wct,$filt,"",$HTTP_GET_VARS[start],""); break; case 'row': // show oen row from table (template) // required params // id: table ID // rid: row ID if(empty($wct) || empty($rid)) { } else { $CMT[maintable] = cmt_row($wct,$rid); } break; case 'edt': // edit one row // required params // id: table ID // rid: row ID (0 = new item) // $CMT[editor2header] = editor2header(); // $CMT[editor2body] = editor2body(); if(empty($wct)) { die("empty WCT"); } else { if($rid=='0') // insert { if(function_exists("can_insert")) $can_insert = can_insert($CMT[cookie_user]); else $can_insert = 0; if($can_insert) { if(empty($act)) $CMT[maintable] = cms_row($wct,$rid); else $CMT[maintable] = cms_row_db($wct,$rid); } else { $CMT[maintable] = diehard($CMT[noinsert_mess],"javascript:history.back()",$CMT[back_mess]); } } else // update { if(function_exists("can_edit")) $can_edit = can_edit($wct,$rid); else $can_edit = 0; if($can_edit) { if(empty($act)) $CMT[maintable] = cms_row($wct,$rid); else $CMT[maintable] = cms_row_db($wct,$rid); } else { $CMT[maintable] = diehard($CMT[noupdate_mess],"javascript:history.back()",$CMT[back_mess]); } } } break; case 'del': // delete one row // required params // id: table ID // rid: row ID (0 = new item) if(empty($wct)) { die("empty ID"); } else { if(function_exists("can_delete")) $can_delete = can_delete($wct,$rid); else $can_delete = 0; if($can_delete) { if(empty($act)) $CMT[maintable] = cms_del($wct,$rid); else $CMT[maintable] = cms_del_db($wct,$rid); } else { $CMT[maintable] = diehard($CMT[nodelete_mess],"javascript:history.back()",$CMT[back_mess]); } } break; case 'login': // show table /* foreach($HTTP_POST_VARS as $key=>$value) { $$key=$value; echo "$key: $value
"; } die(); */ if(!empty($wct)) { $CMT[maintable] = cmt_login($wct,$rowt); } break; case 'logout': // show table if(!empty($wct)) { $CMT[maintable] = cmt_logout($wct,$rowt); } break; default: if(function_exists($run)) { $CMT[maintable] = $run(); } else { $CMT[maintable] = "No fun!"; } } // template if(empty($CMT[template])) $CMT[template] = $CMT[default_template]; // die($CMT[wct_index]."
".$CMT[template]); if(!empty($HTTP_GET_VARS[prt])) $CMT[template] = $CMT[print_template]; $tblstat = 'wct_stat'; $stat_id1 = 9; // WCT_INDEX $stat_id2 = $wct; $TZinterval = 1; // include ("wcs/stat.inc.php"); // code snippet, a ne funkcija // registriraj online clanove // die($CMT[maintable]); include $CMT[template]; // postavlja se iz tb_template // parameters: id, filter, order, start, items include("wcs/db_close.php"); ?>