tutos-commits Mailing List for TUTOS
Projects / CRM / PLM / Calendar / Tasks / SCRUM / Test / Inventory
Brought to you by:
gokohnert
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(13) |
Aug
(214) |
Sep
(144) |
Oct
(22) |
Nov
(22) |
Dec
(93) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(25) |
Feb
(31) |
Mar
(92) |
Apr
(70) |
May
(103) |
Jun
(130) |
Jul
(265) |
Aug
(325) |
Sep
(233) |
Oct
(244) |
Nov
(261) |
Dec
(157) |
2003 |
Jan
(101) |
Feb
(135) |
Mar
(148) |
Apr
(164) |
May
(53) |
Jun
(116) |
Jul
(149) |
Aug
(126) |
Sep
(45) |
Oct
(109) |
Nov
(36) |
Dec
(61) |
2004 |
Jan
(131) |
Feb
(236) |
Mar
(278) |
Apr
(259) |
May
(92) |
Jun
(110) |
Jul
(150) |
Aug
(64) |
Sep
(141) |
Oct
(141) |
Nov
(146) |
Dec
(65) |
2005 |
Jan
(70) |
Feb
(77) |
Mar
(129) |
Apr
(153) |
May
(161) |
Jun
(63) |
Jul
(42) |
Aug
(16) |
Sep
(30) |
Oct
(3) |
Nov
(8) |
Dec
(40) |
2006 |
Jan
(114) |
Feb
(16) |
Mar
(12) |
Apr
(15) |
May
(4) |
Jun
(9) |
Jul
(69) |
Aug
(27) |
Sep
(12) |
Oct
(80) |
Nov
(62) |
Dec
(41) |
2007 |
Jan
(34) |
Feb
(2) |
Mar
(38) |
Apr
(82) |
May
(61) |
Jun
(37) |
Jul
(16) |
Aug
(64) |
Sep
(7) |
Oct
(52) |
Nov
(18) |
Dec
(28) |
2008 |
Jan
(168) |
Feb
(26) |
Mar
(27) |
Apr
(19) |
May
(10) |
Jun
(58) |
Jul
(58) |
Aug
(91) |
Sep
(14) |
Oct
(23) |
Nov
(56) |
Dec
(38) |
2009 |
Jan
(58) |
Feb
(90) |
Mar
(204) |
Apr
(90) |
May
(27) |
Jun
(177) |
Jul
(116) |
Aug
(53) |
Sep
(42) |
Oct
(120) |
Nov
(51) |
Dec
(58) |
2010 |
Jan
(117) |
Feb
(231) |
Mar
(163) |
Apr
(90) |
May
(40) |
Jun
(139) |
Jul
(49) |
Aug
(118) |
Sep
(25) |
Oct
(80) |
Nov
(102) |
Dec
(99) |
2011 |
Jan
(176) |
Feb
(42) |
Mar
(60) |
Apr
(52) |
May
(30) |
Jun
(29) |
Jul
(27) |
Aug
(16) |
Sep
(51) |
Oct
(70) |
Nov
(63) |
Dec
(58) |
2012 |
Jan
(28) |
Feb
(26) |
Mar
(7) |
Apr
(12) |
May
(41) |
Jun
(61) |
Jul
(59) |
Aug
(38) |
Sep
(30) |
Oct
(28) |
Nov
(14) |
Dec
(31) |
2013 |
Jan
(24) |
Feb
(54) |
Mar
(45) |
Apr
(22) |
May
(35) |
Jun
(8) |
Jul
(18) |
Aug
(38) |
Sep
(11) |
Oct
(8) |
Nov
(19) |
Dec
(20) |
2014 |
Jan
(20) |
Feb
(22) |
Mar
(4) |
Apr
(6) |
May
(13) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(6) |
2015 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
2016 |
Jan
(4) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(2) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(1) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(8) |
Aug
(13) |
Sep
(12) |
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2021 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
14
|
15
(1) |
16
|
17
|
18
|
19
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
27
|
28
|
29
|
30
|
|
|
|
|
|
From: <gok...@us...> - 2015-11-15 12:22:24
|
Revision: 1284 http://sourceforge.net/p/tutos/code/1284 Author: gokohnert Date: 2015-11-15 12:22:21 +0000 (Sun, 15 Nov 2015) Log Message: ----------- added redis cache support Modified Paths: -------------- trunk/php/acl.pinc trunk/php/acl_overview.php trunk/php/admin_show.php trunk/php/base.pinc trunk/php/config_default.pinc trunk/php/db/table_custom_example.pinc trunk/php/db.p3 trunk/php/google_api/gapi.pinc trunk/php/google_api/gapi_config.php trunk/php/layout/mobile_layout.pinc trunk/php/layout/new2_layout.pinc trunk/php/layout/test_layout.pinc trunk/php/permission.p3 Modified: trunk/php/acl.pinc =================================================================== --- trunk/php/acl.pinc 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/acl.pinc 2015-11-15 12:22:21 UTC (rev 1284) @@ -164,7 +164,7 @@ $res->free(); - if($obj->cache_store('_acl'.$id,$obj->acl,$tutos['timetolive']*60)) { + if($obj->cache_store('_acl'.$id,$obj->acl,$tutos[cache_ttl])) { $g_hash['fail3']++; } return; @@ -237,7 +237,7 @@ } } - $obj->cache_update('_acl'.$id,$obj->acl,$tutos['timetolive']*60); + $obj->cache_update('_acl'.$id,$obj->acl,$tutos[cache_ttl]); } /** Modified: trunk/php/acl_overview.php =================================================================== --- trunk/php/acl_overview.php 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/acl_overview.php 2015-11-15 12:22:21 UTC (rev 1284) @@ -131,10 +131,11 @@ continue; } $n2 = count($obj->acl[0]); - foreach ($obj->acl as $f => $p) { - if ($f == 0) continue; - $n2 += count($p); - } + if (is_array($obj->acl)) + foreach ($obj->acl as $f => $p) { + if ($f == 0) continue; + $n2 += count($p); + } loadmodules($obj->getType(),'show'); $line++; @@ -158,7 +159,7 @@ $r .= '<td rowspan="'. max($n2,1) .'" class="over_l">unknown</td>'."\n"; $r .= '<td rowspan="'. max($n2,1) .'" class="over_l"> </td>'."\n"; } - if ( $n2 == 0 ) { + if ( ($n2 == 0) || !is_array($obj->acl[0])) { $r .= "<td colspan=\"2\"> </td>\n"; $r .= $this->MassUpdateField($obj); $r .= $this->OverviewRowEnd($line); @@ -200,7 +201,6 @@ $r .= "? (".$p.")"; } $r .= "</td>\n"; - # $r .= "X |". $this->user->p[$obj->gettypeid()]."| ".$obj->gettypeid(); if ( $b == 0 ) { $r .= $this->MassUpdateField($obj,$n2); } @@ -208,50 +208,51 @@ unset($o); $b++; } - foreach ($obj->acl as $f => $ff) { - if ($f == 0) continue; - foreach ($ff as $h => $p) { - if ( $b > 0 ) { - $r .= $this->OverviewRowStart($line); - } - $r .= "<td>\n"; - if ($h == EVERYBODY) { - $r .= $lang['everybody']; - } else if ($h == NOBODY) { - $r .= 'nobody'; - } else if ($h < 0) { - // virtuell group - $o = $h - ($obj->getTypeId() << ACLSHIFT); - $xx = $obj->getObjectGroups(); - if (isset($xx[$obj->getTypeId()][-$o])) { - $r .= $xx[$obj->getTypeId()][-$o]; + if (is_array($obj->acl)) + foreach ($obj->acl as $f => $ff) { + if ($f == 0) continue; + foreach ($ff as $h => $p) { + if ( $b > 0 ) { + $r .= $this->OverviewRowStart($line); } - } else { - $o = getObject($this->dbconn,$h); - if ( is_object($o) ) { - $r .= myentities($o->getFullName()); + $r .= "<td>\n"; + if ($h == EVERYBODY) { + $r .= $lang['everybody']; + } else if ($h == NOBODY) { + $r .= 'nobody'; + } else if ($h < 0) { + // virtuell group + $o = $h - ($obj->getTypeId() << ACLSHIFT); + $xx = $obj->getObjectGroups(); + if (isset($xx[$obj->getTypeId()][-$o])) { + $r .= $xx[$obj->getTypeId()][-$o]; + } } else { - $r .= "Unknown object ". $h ."\n"; + $o = getObject($this->dbconn,$h); + if ( is_object($o) ) { + $r .= myentities($o->getFullName()); + } else { + $r .= "Unknown object ". $h ."\n"; + } } + $r .= "</td>\n"; + $r .= "<td>\n"; + $r .= acl_link($obj,$lang[$f],$f).': '; + $pre = ''; + if ($p & 2) { + $r .= $pre.$lang['NewEntry']; + $pre = '+'; + } + if ($p & 4) { + $r .= $pre.$lang['ACLread']; + $pre = '+'; + } + $r .= "</td>\n"; + $r .= $this->OverviewRowEnd($line); + unset($o); + $b++; } - $r .= "</td>\n"; - $r .= "<td>\n"; - $r .= acl_link($obj,$lang[$f],$f).': '; - $pre = ''; - if ($p & 2) { - $r .= $pre.$lang['NewEntry']; - $pre = '+'; - } - if ($p & 4) { - $r .= $pre.$lang['ACLread']; - $pre = '+'; - } - $r .= "</td>\n"; - $r .= $this->OverviewRowEnd($line); - unset($o); - $b++; } - } } $a++; unset($obj); Modified: trunk/php/admin_show.php =================================================================== --- trunk/php/admin_show.php 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/admin_show.php 2015-11-15 12:22:21 UTC (rev 1284) @@ -690,6 +690,25 @@ $r .= $this->ContentRowEnd(); $r .= $this->ContentRowStart(); + $r .= $this->showfield('Redis'); + $d = ''; + if($tutos['redis'] != null) { + $dd =$tutos['redis']->info(); + # $d = 'connected '.var_dump($dd); + $d .= ' V:'.$dd['redis_version']; + $d .= ' Mem:'.$dd['used_memory_human']; + if ( ($dd['keyspace_hits']+$dd['keyspace_misses']) != 0) + $ratio = 100.0 * ($dd['keyspace_hits'] / ($dd['keyspace_hits']+$dd['keyspace_misses'])); + else + $ratio = '?'; + $d .= ' (hits:'.$dd['keyspace_hits'].' misses:'.$dd['keyspace_misses'].' ratio '.sprintf('%.2f %%',$ratio).')'; + } else { + $d = 'not enabled'; + } + $r .= $this->showdata($d,9); + $r .= $this->ContentRowEnd(); + + $r .= $this->ContentRowStart(); $r .= $this->showfield('APC'); if (ini_get('apc.enabled')) { if ($tutos['use_apccache']) { Modified: trunk/php/base.pinc =================================================================== --- trunk/php/base.pinc 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/base.pinc 2015-11-15 12:22:21 UTC (rev 1284) @@ -242,7 +242,7 @@ $r->free(); return -1; } - if($obj->cache_store('_'.$this->gettypeid().'_'.$id,$r->getall(0))) { + if($obj->cache_store('_'.$this->gettypeid().'_'.$id,$r->getall(0),$tutos[cache_ttl])) { $g_hash['fail3']++; } } @@ -337,8 +337,8 @@ $rr->free(); // cache it // update cache - $this->cache_store('_r'.$this->id,$this->relations); - $this->cache_store('_br'.$this->id,$this->back_relations); + $this->cache_store('_r'.$this->id,$this->relations,$tutos[cache_ttl]); + $this->cache_store('_br'.$this->id,$this->back_relations,$tutos[cache_ttl]); } // // read custom database fields @@ -1498,8 +1498,8 @@ } } if ($cnt + $cnt2 > 0) { - $this->cache_store('_r'.$this->id,$this->relations); - $this->cache_store('_br'.$this->id,$this->back_relations); + $this->cache_store('_r'.$this->id,$this->relations,$tutos[cache_ttl]); + $this->cache_store('_br'.$this->id,$this->back_relations,$tutos[cache_ttl]); } $msg = addLine($msg,$this->run_postsave_hook()); return $msg; @@ -1528,7 +1528,7 @@ $r->free(); // save for future use - $this->cache_store('_TT'.$x,$this->getTypeId()); + $this->cache_store('_TT'.$x,$this->getTypeId(),$tutos[cache_ttl]); return $msg; } @@ -1980,6 +1980,8 @@ if($tutos['use_memcache']) { return @$tutos['memcache']->get($memid); + } elseif($tutos['use_redis']) { + return @$tutos['redis']->get($memid); } else if ($tutos['use_apccache']) { return apc_fetch($memid); } @@ -2003,6 +2005,8 @@ if($tutos['use_memcache']) { return @$tutos['memcache']->delete($memid,0); + } elseif($tutos['use_redis']) { + return @$tutos['redis']->delete($memid); } else if ($tutos['use_apccache']) { return apc_delete($memid); } @@ -2025,6 +2029,12 @@ if($tutos['use_memcache']) { $tutos['memcache']->replace($memid,$value,0,$ttl); return true; + } else if($tutos['use_redis']) { + if ($ttl != -1) + $tutos['redis']->setex($memid,$ttl,$value); + else + $tutos['redis']->set($memid,$value); + return true; } else if ($tutos['use_apccache']) { $obj->acl = apc_store($memid,$value,$ttl); return true; @@ -2046,6 +2056,12 @@ if($tutos['use_memcache']) { $tutos['memcache']->set($memid,$value,0,$ttl); return true; + } else if($tutos['use_redis']) { + if ($ttl != -1) + $tutos['redis']->setex($memid,$ttl,$value); + else + $tutos['redis']->set($memid,$value); + return true; } else if ($tutos['use_apccache']) { $obj->acl = apc_store($memid,$value,$ttl); return true; Modified: trunk/php/config_default.pinc =================================================================== --- trunk/php/config_default.pinc 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/config_default.pinc 2015-11-15 12:22:21 UTC (rev 1284) @@ -291,6 +291,14 @@ // $tutos[memcache_hosts] = array(); // +// if we use redis for caching database data +// this variable will hold a array of (currently only one) cache host:port +// example $tutos[redis_hosts] = array('localhost:6379'); +// +$tutos[redis_hosts] = array(); +// time to live (sconds) for objects in cache (redis or memcache) +$tutos[cache_ttl] = 3600; +// // Path to freemind java applet (used to display freemind mindmap files in browser) // See http://freemind.sourceforge.net/ // @@ -741,4 +749,4 @@ ### mode:iso-accents *** ### coding:utf-8 *** ### End: *** -?> +?> \ No newline at end of file Modified: trunk/php/db/table_custom_example.pinc =================================================================== --- trunk/php/db/table_custom_example.pinc 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/db/table_custom_example.pinc 2015-11-15 12:22:21 UTC (rev 1284) @@ -431,5 +431,7 @@ $x = preg_split('#,#',trim($obj->parent->$fld)); return $x; } +$table['appointment1']['description'][size] = 101; +$table['appointment1']['visitor']['searchable'] = true; ?> \ No newline at end of file Modified: trunk/php/db.p3 =================================================================== --- trunk/php/db.p3 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/db.p3 2015-11-15 12:22:21 UTC (rev 1284) @@ -167,6 +167,8 @@ define ('smtpport',143); // deprecated define ('help_need_login',144); define ('tcpdfpath',145); +define ('redis_hosts',146); +define ('cache_ttl',147); // Permissions and Object IDS (see also user.pinc) NO CHANGES HERE ! // These are distinct IDS for the different Objcts in TUTOS Modified: trunk/php/google_api/gapi.pinc =================================================================== --- trunk/php/google_api/gapi.pinc 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/google_api/gapi.pinc 2015-11-15 12:22:21 UTC (rev 1284) @@ -135,6 +135,7 @@ global $tutos; if ($ly != null && isset($_GET['code'])) { + dterror_log('code: '.$_GET['code']."\n",3,$tutos[errlog]); $this->client->authenticate($_GET['code']); $this->saveToken(); $ly->redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; Modified: trunk/php/google_api/gapi_config.php =================================================================== --- trunk/php/google_api/gapi_config.php 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/google_api/gapi_config.php 2015-11-15 12:22:21 UTC (rev 1284) @@ -37,7 +37,7 @@ global $lang,$table,$tutos; $r = ''; - $r .= "<form id=\"GAPIconfig\" name=\"GAPIconfig\" action=\"GAPI_config.php\" method=\"post\">\n"; + $r .= "<form id=\"GAPIconfig\" name=\"GAPIconfig\" action=\"gapi_config.php\" method=\"post\">\n"; $r .= $this->DataTableStart(); $line = 0; Modified: trunk/php/layout/mobile_layout.pinc =================================================================== --- trunk/php/layout/mobile_layout.pinc 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/layout/mobile_layout.pinc 2015-11-15 12:22:21 UTC (rev 1284) @@ -745,7 +745,7 @@ $r .= ' dir="ltr"'; $r .= '>'."\n"; - $r .= "<!-- \nCopyright 1999 - 2013 by Gero Kohnert gok...@us... et al\n"; + $r .= "<!-- \nCopyright 1999 - 2015 by Gero Kohnert gok...@us... et al\n"; $r .= "all rights reserved\n-->\n"; $r .= " <head>\n"; $r .= " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=". $lang['content_encoding'] ."\"".$c; Modified: trunk/php/layout/new2_layout.pinc =================================================================== --- trunk/php/layout/new2_layout.pinc 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/layout/new2_layout.pinc 2015-11-15 12:22:21 UTC (rev 1284) @@ -489,7 +489,7 @@ $r .= ' dir="ltr"'; $r .= '>'."\n"; - $r .= "<!-- \nCopyright 1999 - 2014 by Gero Kohnert gok...@us... et al\n"; + $r .= "<!-- \nCopyright 1999 - 2015 by Gero Kohnert gok...@us... et al\n"; $r .= "all rights reserved\n-->\n"; $r .= " <head>\n"; $r .= " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=". $lang['content_encoding'] ."\"".$c; Modified: trunk/php/layout/test_layout.pinc =================================================================== --- trunk/php/layout/test_layout.pinc 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/layout/test_layout.pinc 2015-11-15 12:22:21 UTC (rev 1284) @@ -40,13 +40,14 @@ $r .= $this->PrintHeader($name); $r .= "<table id=\"maintable\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\" border=\"0\"><tr>\n"; - # -# Please do not remove the link to the Copyright note !! -# Honour my work - # - if ( ! isset($tutos['logo']) ) { - $r .= " <td class=\"headline\" height=\"30px\" width=\"16%\" colspan=\"2\" valign=\"middle\" align=\"left\"> <a class=\"nodeco\" rel=\"copyright\" href=\"". $tutos['base'] ."/html/copyright.html\">TUTOS</a></td>\n"; - } else { + // + // Please do not remove the link to the Copyright note ! + // Honour my work + // + if ( !isset( $tutos['logo'] ) ) { + $r .= ' <td class="headline" height="30px" width="16%" colspan="2" valign="middle" align="left"> <a class="nodeco" rel="copyright" href="'; + $r.= $tutos['base'] .'/html/copyright.html">TUTOS</a></td>'"\n"; + } else { $r .= " <td class=\"headline\" width=\"8%\" valign=\"top\" align=\"left\">"; if ( isset($tutos['logolink']) ) { $r .= "<a target=\"url\" href=\"". (ereg("^http",$tutos['logolink']) ? "":$tutos['base']."/" ) . $tutos['logolink'] ."\">"; @@ -73,319 +74,307 @@ } $r .= " </td></tr>\n"; return $r; - } +} /** * start a data table */ function DataTableStart() { return "<table class=\"single\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">\n"; } - /** - * header of a printable page - */ - function PrintHeader($name) { - $r = ''; - $r .= $this->inithtml(); - $r .= "<body marginwidth=\"0\" marginheight=\"0\">\n"; - return $r; +/** + * header of a printable page + */ +function PrintHeader($name = "") { + $r = ''; + $r .= $this->inithtml(); + $r .= "<body marginwidth=\"0\" marginheight=\"0\">\n"; + return $r; +} +/** + * layout part + */ +function HTML_one($msg) { + $r = ''; + $r .= "<tr>\n"; + if ( $this->nomenu == false ) { + $r .= "<td id=\"datafield\" colspan=\"3\" width=\"90%\" align=". ($this->center ? '"center"':'"left"') ." valign=\"top\">\n"; + } else { + $r .= "<td id=\"datafield\" colspan=\"4\" width=\"100%\" align=". ($this->center ? '"center"':'"left"') ." valign=\"top\">\n"; } - /** - * layout part - */ - function HTML_one($msg) { - $r = ''; - $r .= "<tr>\n"; - if ( $this->nomenu == false ) { - $r .= "<td id=\"datafield\" colspan=\"3\" width=\"90%\" align=". ($this->center ? '"center"':'"left"') ." valign=\"top\">\n"; - } else { - $r .= "<td id=\"datafield\" colspan=\"4\" width=\"100%\" align=". ($this->center ? '"center"':'"left"') ." valign=\"top\">\n"; - } - if ($msg != "") { - $r .= "<div class=\"message\">". $this->error(StripSlashes($msg)) ."</div>"; - } - $r .= $this->actionresult; - return $r; + if ($msg != "") { + $r .= "<div class=\"message\">". $this->error(StripSlashes($msg)) ."</div>"; } - /** - * layout part - */ - function HTML_two() { - $r = ''; - $r .= "</td>\n"; - $r .= "<td align=\"right\" colspan=\"1\" width=\"10%\" class=\"navigate\">\n"; - return $r; - } - /** - * Close a Page - */ - Function HTML_Close () { - global $tutos,$g_hash; + $r .= $this->actionresult; + return $r; +} +/** + * layout part + */ +function HTML_two() { + $r = ''; + $r .= "</td>\n"; + $r .= "<td align=\"right\" colspan=\"1\" width=\"10%\" class=\"navigate\">\n"; + return $r; +} +/** + * Close a Page + */ +Function HTML_Close () { + global $tutos,$g_hash; - $r = ''; - list($usec,$sec) = explode(" ",microtime()); - $end = (float)$usec + (float)$sec; - if ( $this->format != "paper" ) { - $r .= "<tr id=\"footline\" valign=\"bottom\">\n"; - $r .= "<td colspan=\"4\" class=\"headline\">\n"; - if ( ($this->format == "html") && ($tutos[debug] != 0) ) { - $r .= "layout demo took about ". sprintf("%.3f",($end - $this->start_ts)) ." seconds\n"; - # $r .= " hits = ". $g_hash['hits']; - # $r .= " hits2 = ". $g_hash['hits2']; - /********* - $r .= " hash size = ". (count($g_hash) -1); - foreach( $g_hash as $i => $f ) { - $r .= "<br>". $i ; - if ( gettype($f) == "object" ) { - $r .= " ". $f->getType() ; - $r .= " ". $f->getFullName() ; - } - } - *********/ - } - $r .= " </td>\n"; - $r .= "</tr>\n"; - $r .= "</table>"; + $r = ''; + list($usec,$sec) = explode(" ",microtime()); + $end = (float)$usec + (float)$sec; + if ( $this->format != "paper" ) { + $r .= "<tr id=\"footline\" valign=\"bottom\">\n"; + $r .= "<td colspan=\"4\" class=\"headline\">\n"; + if ( ($this->format == "html") && ($tutos[debug] != 0) ) { + $r .= "layout demo took about ". sprintf("%.3f",($end - $this->start_ts)) ." seconds\n"; } - $r .= "</body>\n"; - $r .= "</html>\n"; - return $r; + $r .= " </td>\n"; + $r .= "</tr>\n"; + $r .= "</table>"; } - /** - * return a menu part - */ - function getMenuPart($part,$ruler,$headline = "") { - $r = ''; - if ( isset($this->menu[$part]) && count($this->menu[$part]) ) { - if ($headline != "") { - $r .= "<tr><th>". $headline ."</th></tr>\n"; - } - if ($ruler) { - $r .= "<tr><td><hr noshade size=\"1\"></td></tr>\n"; - } - $r .= "<tr><td nowrap>\n"; - foreach ($this->menu[$part] as $i => $m) { - $r .= $this->menulink($m); - $this->removeMenu($this->menu[$part][$i]); - } - $r .= "</td></tr>\n"; + $r .= "</body>\n"; + $r .= "</html>\n"; + return $r; +} +/** + * return a menu part + */ +function getMenuPart($part,$ruler,$headline = "") { + $r = ''; + if ( isset($this->menu[$part]) && count($this->menu[$part]) ) { + if ($headline != "") { + $r .= "<tr><th>". $headline ."</th></tr>\n"; } - return $r; - } - /** - * display the screen - */ - function display () { - global $msg; - - if ( isset($_GET['mark']) && isset($_GET['action']) && ($_GET['action'] != -1) ) { - $this->actionresult = $this->action(); + if ($ruler) { + $r .= "<tr><td><hr noshade size=\"1\"></td></tr>\n"; } - $this->prepare(); - if ( $this->redirect != "" ) { - Header("Status: 302 Moved Temporarily"); - Header("Location: ". getBaseUrl(). addSessionKey($this->redirect,true)); - return; + $r .= "<tr><td nowrap>\n"; + foreach ($this->menu[$part] as $i => $m) { + $r .= $this->menulink($m); + $this->removeMenu($this->menu[$part][$i]); } - $this->buildmenu(); + $r .= "</td></tr>\n"; + } + return $r; +} +/** + * display the screen + */ +function display () { + global $msg; -# if ( $msg != "" ) { + if ( isset($_GET['mark']) && isset($_GET['action']) && ($_GET['action'] != -1) ) { + $this->actionresult = $this->action(); + } + $this->prepare(); + if ( $this->redirect != "" ) { + Header("Status: 302 Moved Temporarily"); + Header("Location: ". getBaseUrl(). addSessionKey($this->redirect,true)); + return; + } + $this->buildmenu(); + + # if ( $msg != "" ) { # $this->format = "html"; # } if ( ($this->format == "html") || ($this->format == "stat") || ($this->format == "checklist")) { - echo $this->PageHeader(); - echo $this->HTML_one($msg); - if ($this->stop == false ) { - echo $this->info(); - } - echo $this->showContent(); - if ( $this->nomenu == false ) { - $this->HTML_two(); - echo "<table width=\"100%\" border=\"0\">"; + echo $this->PageHeader(); + echo $this->HTML_one($msg); + if ($this->stop == false ) { + echo $this->info(); +} + echo $this->showContent(); + if ( $this->nomenu == false ) { + $this->HTML_two(); + echo "<table width=\"100%\" border=\"0\">"; - echo $this->getMenuPart("search",false,"SEARCH"); - echo $this->getMenuPart("overview",false,"OVERVIEW"); - echo $this->getMenuPart("obj",false," "); - echo $this->getMenuPart("view",false,""); + echo $this->getMenuPart("search",false,"SEARCH"); + echo $this->getMenuPart("overview",false,"OVERVIEW"); + echo $this->getMenuPart("obj",false," "); + echo $this->getMenuPart("view",false,""); - echo $this->navigate(); + echo $this->navigate(); - echo $this->getMenuPart("support",false,"useful"); - echo $this->getMenuPart("module",false,"MODULE"); - echo $this->getMenuPart("help",false," "); - echo $this->getMenuPart("admin",false,""); + echo $this->getMenuPart("support",false,"useful"); + echo $this->getMenuPart("module",false,"MODULE"); + echo $this->getMenuPart("help",false," "); + echo $this->getMenuPart("admin",false,""); - if ( isset($this->menu["url"]) && count($this->menu["url"]) ) { - echo "<tr><th>URL</th></tr>\n"; - echo "<tr><td nowrap>\n"; - foreach ($this->menu["url"] as $i => $m) { - echo menulink($m[url],"<li>".$m[text],$m[info]) ."</li>\n"; - $this->removeMenu($this->menu["url"][$i]); - } - echo "</td></tr>\n"; - } + if ( isset($this->menu["url"]) && count($this->menu["url"]) ) { + echo "<tr><th>URL</th></tr>\n"; + echo "<tr><td nowrap>\n"; + foreach ($this->menu["url"] as $i => $m) { + echo menulink($m[url],"<li>".$m[text],$m[info]) ."</li>\n"; + $this->removeMenu($this->menu["url"][$i]); +} + echo "</td></tr>\n"; +} - echo "<tr><td nowrap>\n"; -#the remaining stuff - foreach ($this->menu as $i => $m) { - if ( is_array($this->menu[$i]) ) { - foreach ($this->menu[$i] as $i2 => $m2) { - echo $this->menulink($this->menu[$i][$i2]); - $this->removeMenu($this->menu[$i][$i2]); - } - } + echo "<tr><td nowrap>\n"; + #the remaining stuff + foreach ($this->menu as $i => $m) { + if ( is_array($this->menu[$i]) ) { + foreach ($this->menu[$i] as $i2 => $m2) { + echo $this->menulink($this->menu[$i][$i2]); + $this->removeMenu($this->menu[$i][$i2]); } - echo "</td></tr>\n"; + } + } + echo "</td></tr>\n"; - if ( "help.php" != basename($_SERVER['PHP_SELF']) ) { - if (isset($_SESSION['history'])) { - echo "<tr><th>HISTORY</th></tr>\n"; - echo "<tr><td nowrap>\n"; - foreach($_SESSION['history'] as $x) { - echo $this->menulink($x); - } - echo "</td></tr>\n"; - } - } - echo "</table>\n"; + if ( "help.php" != basename($_SERVER['PHP_SELF']) ) { + if (isset($_SESSION['history'])) { + echo "<tr><th>HISTORY</th></tr>\n"; + echo "<tr><td nowrap>\n"; + foreach($_SESSION['history'] as $x) { + echo $this->menulink($x); } - echo "</td>\n"; - echo "</tr>\n"; - $this->HTML_Close(); - } else if ( $this->format == "paper" ) { + echo "</td></tr>\n"; + } + } + echo "</table>\n"; +} + echo "</td>\n"; +echo "</tr>\n"; +$this->HTML_Close(); +} else if ( $this->format == "paper" ) { echo $this->PrintHeader($this->name); echo $this->info(); echo $this->HTML_Close(); } else { echo $this->info(); } - } - /** - * start a massupdate row - */ - function UpdateRowStart($cols) { - $r = "<tr>\n"; - $r .= "<th align=\"right\" colspan=\"". $cols ."\">\n"; - return $r; - } - /** - * end a massupdate row - */ - function UpdateRowEnd($cols) { - global $lang; - $r = ""; - $r .= "</th>\n"; - $r .= "<th colspan=\"". $cols ."\" align=\"left\">\n"; - $r .= "<input type=\"submit\" value=\"". $lang['Enter'] ."\"></th>\n"; - $r .= "</tr>\n"; - return $r; - } - /** - * sortable header field in overviews - */ - function orderheader($oname,$link,$base,$cols = 1) { - global $tutos, $lang; +} +/** + * start a massupdate row + */ +function UpdateRowStart($cols) { + $r = "<tr>\n"; + $r .= "<th align=\"right\" colspan=\"". $cols ."\">\n"; + return $r; +} +/** + * end a massupdate row + */ +function UpdateRowEnd($cols) { + global $lang; + $r = ""; + $r .= "</th>\n"; + $r .= "<th colspan=\"". $cols ."\" align=\"left\">\n"; + $r .= "<input type=\"submit\" value=\"". $lang['Enter'] ."\"></th>\n"; + $r .= "</tr>\n"; + return $r; +} +/** + * sortable header field in overviews + */ +function orderheader($oname,$link,$base,$cols = 1) { + global $tutos, $lang; - $base = addUrlParameter($base,"xf=".$oname); - if ( $ "" ) { + $base = addUrlParameter($base,"xf=".$oname); + if ( $ "" ) { + $r = "<th nowrap colspan=\"". $cols ."\">\n"; + $r .= $link; + } else { + if (isset ($_GET['xf']) && ($_GET['xf'] == $oname) ) { + $r = "<th nowrap class=\"state2\" colspan=\"". $cols ."\">\n"; + } else { $r = "<th nowrap colspan=\"". $cols ."\">\n"; - $r .= $link; + } + $l = addUrlParameter($base,"xo=1"); + if ( isset ($_GET['xo']) && $_GET['xo'] == 1 && ($_GET['xf'] == $oname) ) { + $r .= "[". makelink($l ,$this->theme->getImage(up,'list'),sprintf($lang['OrderBy'], $link)) ."]"; } else { - if (isset ($_GET['xf']) && ($_GET['xf'] == $oname) ) { - $r = "<th nowrap class=\"state2\" colspan=\"". $cols ."\">\n"; - } else { - $r = "<th nowrap colspan=\"". $cols ."\">\n"; - } - $l = addUrlParameter($base,"xo=1"); - if ( isset ($_GET['xo']) && $_GET['xo'] == 1 && ($_GET['xf'] == $oname) ) { - $r .= "[". makelink($l ,$this->theme->getImage(up,'list'),sprintf($lang['OrderBy'], $link)) ."]"; - } else { - $r .= makelink($l ,$this->theme->getImage(up,'list'),sprintf($lang['OrderBy'], $link)); - } - $r .= $link; - $l = addUrlParameter($base,"xo=2"); - if ( isset ($_GET['xo']) && $_GET['xo'] == 2 && ($_GET['xf'] == $oname) ) { - $r .= "[". makelink($l ,$this->theme->getImage(down,'list'),sprintf($lang['RevOrderBy'],$link)) ."]"; - } else { - $r .= makelink($l ,$this->theme->getImage(down,'list'),sprintf($lang['RevOrderBy'],$link)); - } + $r .= makelink($l ,$this->theme->getImage(up,'list'),sprintf($lang['OrderBy'], $link)); } - $r .= "</th>\n"; - return $r; - } - /** - * create a link in the menu area - * $m = array - */ - function menulink (&$m) { - if ( isset($m[image]) ) { - $m[text] = $m[image].$m[text]; - } - if ( !isset($m[text]) ) { - return; - } - if ( isset($m[confirm]) && ($m[confirm] == true) ) { - return confirmlink($m[url],$m[text],$m[info]) ."<br>\n"; + $r .= $link; + $l = addUrlParameter($base,"xo=2"); + if ( isset ($_GET['xo']) && $_GET['xo'] == 2 && ($_GET['xf'] == $oname) ) { + $r .= "[". makelink($l ,$this->theme->getImage(down,'list'),sprintf($lang['RevOrderBy'],$link)) ."]"; } else { - return menulink($m[url],$m[text],$m[info]) ."<br>\n"; + $r .= makelink($l ,$this->theme->getImage(down,'list'),sprintf($lang['RevOrderBy'],$link)); } } - /** - * remove a menu item in all categories - */ - function removeMenu(&$rm) { - unset($rm[text]); - unset($rm[info]); - unset($rm[category]); - unset($rm[image]); - unset($rm[target]); + $r .= "</th>\n"; + return $r; +} +/** + * create a link in the menu area + * $m = array + */ +function menulink (&$m) { + if ( isset($m[image]) ) { + $m[text] = $m[image].$m[text]; + } + if ( !isset($m[text]) ) { + return; + } + if ( isset($m[confirm]) && ($m[confirm] == true) ) { + return confirmlink($m[url],$m[text],$m[info]) ."<br>\n"; + } else { + return menulink($m[url],$m[text],$m[info]) ."<br>\n"; + } +} +/** + * remove a menu item in all categories + */ +function removeMenu(&$rm) { + unset($rm[text]); + unset($rm[info]); + unset($rm[category]); + unset($rm[image]); + unset($rm[target]); - foreach ($this->menu as $i => $m) { - if ( is_array($m) ) { - foreach ($m as $i2 => $m2) { - if ( $rm[url] == $m2[url] ) { - unset($this->menu[$i][$i2]); -# echo $this->menu[$i][$i2][url] ."<br>"; - } + foreach ($this->menu as $i => $m) { + if ( is_array($m) ) { + foreach ($m as $i2 => $m2) { + if ( $rm[url] == $m2[url] ) { + unset($this->menu[$i][$i2]); + # echo $this->menu[$i][$i2][url] ."<br>"; } - } else { - unset($this->menu[$i]); - } - } - } - /** - * add a menu item - * tarr = a fully defined link including - */ - function addMenu($tarr) { - if ( ! is_Array($tarr) ) { - return; - } - if ( isset($tarr[0][url]) ) { - foreach ($tarr as $i => $f) { - $this->addMenu($tarr[$i]); - } - return; - } - foreach ($tarr[category] as $t ) { - if (isset($this->menu[$t])) { - foreach ($this->menu[$t] as $x ) { + } + } else { + unset($this->menu[$i]); + } + } + } + /** + * add a menu item + * tarr = a fully defined link including + */ + function addMenu($tarr) { + if ( ! is_Array($tarr) ) { + return; + } + if ( isset($tarr[0][url]) ) { + foreach ($tarr as $i => $f) { + $this->addMenu($tarr[$i]); + } + return; + } + foreach ($tarr[category] as $t ) { + if (isset($this->menu[$t])) { + foreach ($this->menu[$t] as $x ) { if ($x[url] == $tarr[url]) { - return; + return; + } + } + } + } + # do not add duplicate entries + foreach ($tarr[category] as $t ) { + $this->menu[$t][] = &$tarr; + } + return; + } + /** + * getLayoutName + */ + function getLayoutName() { + return 'new_layout'; } - } } - } -# do not add duplicate entries - foreach ($tarr[category] as $t ) { - $this->menu[$t][] = &$tarr; - } - return; - } - /** - * getLayoutName - */ - function getLayoutName() { - return 'new_layout'; - } -} -?> + ?> \ No newline at end of file Modified: trunk/php/permission.p3 =================================================================== --- trunk/php/permission.p3 2015-03-14 09:22:19 UTC (rev 1283) +++ trunk/php/permission.p3 2015-11-15 12:22:21 UTC (rev 1284) @@ -99,8 +99,10 @@ require_once 'handler.pinc'; $tutos['memcache'] = null; +$tutos['redis'] = null; $tutos['use_apccache'] = false; $tutos['use_memcache'] = false; +$tutos['use_redis'] = false; if (ini_get('apc.enabled')) { // prefer eaccel for caching code @@ -110,6 +112,7 @@ } $tutos['use_apccache'] = true; $tutos['use_memcache'] = false; + $tutos['use_redis'] = false; } if ( count($tutos[memcache_hosts]) && class_exists("memcache")) { @@ -121,9 +124,21 @@ if (! $tutos['use_apccache']) { $tutos['use_apccache'] = false; $tutos['use_memcache'] = true; + $tutos['use_redis'] = false; } // otherwise use memcache for sessions only } +if ( count($tutos[redis_hosts]) && class_exists('redis')) { + # https://github.com/phpredis/phpredis + $tutos['redis'] = new redis(); + $xxxx = preg_split('#:#',$tutos[redis_hosts][0]); + $tutos['redis']->pconnect($xxxx[0],$xxxx[1]); + if (! $tutos['use_apccache']) { + $tutos['use_apccache'] = false; + $tutos['use_redis'] = true; + $tutos['use_memcache'] = false; + } // otherwise use memcache for sessions only +} if (!extension_loaded('session')) { if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) { @@ -145,17 +160,20 @@ // use files to save session data if ( ($tutos['memcache'] != null) && (MEMCACHE_HAVE_SESSION == 1) ) { @ini_set('session.save_handler','memcache'); - session_save_path("tcp://".$tutos[memcache_hosts][0].":11211?persistent=1&weight=1&timeout=1&retry_interval=15"); + session_save_path("tcp://".$tutos[memcache_hosts][0].':11211?persistent=1&weight=1&timeout=1&retry_interval=15'); +} else if ( ($tutos['redis'] != null) ) { + @ini_set('session.save_handler','redis'); + session_save_path("tcp://".$tutos[redis_hosts][0]); } else { @ini_set('session.save_handler','files'); + // + // On Server Clusters (LoadBalancing) you should + // change savepath to some path all your servers share + // session_save_path($tutos[sessionpath]); } @ini_set('mbstring.func_overload','1'); -// -// On Server Clusters (LoadBalancing) you should -// change savepath to some path all your servers share -// session_name('TUTOS'); include_once 'mail.pinc'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |