- Files:
-
- /trunk/pici-proxy/index.php (modified) (1 diff)
- /trunk/pici-server/external/class.rFastTemplate.php (modified) (17 diffs)
- /trunk/pici-server/G/error_download.png (modified) (previous)
- /trunk/pici-server/G/error_email.png (modified) (previous)
- /trunk/pici-server/G/error_notresponding.png (modified) (previous)
- /trunk/pici-server/G/error_unhandled.png (modified) (previous)
- /trunk/pici-server/ADMIN/setup.php (modified) (3 diffs)
- /trunk/pici-server/ADMIN/get_picture.php (modified) (1 diff)
- /trunk/pici-server/ADMIN/mkpicture.sh (modified) (1 diff)
- /trunk/pici-server/ADMIN/common.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
/trunk/pici-proxy/index.php
r3 r23 50 50 'basic_auth_var_name' => '____pbavn', 51 51 'max_file_size' => -1, 52 'allow_hotlinking' => 0,52 'allow_hotlinking' => 1, 53 53 'upon_hotlink' => 1, 54 54 'compress_output' => 0 /trunk/pici-server/external/class.rFastTemplate.php
r1 r29 4 4 // 2001 Alister Bulman <alister@minotaur.nu> Re-Port multi template-roots + more 5 5 // PHP3 Port: Copyright 1999 CDI <cdi@thewebmasters.net>, All Rights Reserved. 6 // PHP5 Port: Copyright 2008 Marguerie Jérémie <jiem78@homail.com>, All Rights Reserved. 6 7 // Perl Version: Copyright 1998 Jason Moore <jmoore@sober.com>, All Rights Reserved. 7 8 // … … 311 312 reset ($fileList); 312 313 while (list ($tpl, $file) = each ($fileList)) { 313 $this->TEMPLATE[$tpl] = array ( file => $file, dynamic=> $dynamic);314 $this->TEMPLATE[$tpl] = array ('file' => $file, 'dynamic' => $dynamic); 314 315 } 315 316 return true; … … 320 321 reset ($tplList); 321 322 while (list ($tpl, $parent) = each ($tplList)) { 322 $this->TEMPLATE[$tpl][ parent] = $parent;323 $this->TEMPLATE[$tpl][ dynamic] = true;323 $this->TEMPLATE[$tpl]['parent'] = $parent; 324 $this->TEMPLATE[$tpl]['dynamic'] = true; 324 325 } 325 326 } else { 326 327 // $tplList is not an array, but a single child/parent pair. 327 $this->TEMPLATE[$tplList][ parent] = $parent;328 $this->TEMPLATE[$tplList][ dynamic] = true;328 $this->TEMPLATE[$tplList]['parent'] = $parent; 329 $this->TEMPLATE[$tplList]['dynamic'] = true; 329 330 } 330 331 } … … 362 363 // 363 364 function &load ($file) { 364 $debug = $this->DEBUGALL || $this->DEBUG[load]; 365 $debug = $this->DEBUGALL || $this->DEBUG['load']; 366 367 $debug = FALSE; 368 369 if(isset($this->DEBUGALL) AND $this->DEBUGALL) 370 371 $debug = $this->DEBUGALL; 372 373 elseif(isset($this->DEBUG['load']) AND $this->DEBUG['load']) 374 375 $debug = $this->DEBUG['load']; 376 365 377 if (! count($this->ROOT)) { 366 378 if ($debug) … … 394 406 // 395 407 function &parse_internal_1 ($tag, $rest = '') { 396 $debug = $this->DEBUGALL || $this->DEBUG[parse_internal_1]; 408 $debug = $this->DEBUGALL || $this->DEBUG['parse_internal_1']; 409 $debug = FALSE; 410 411 if(isset($this->DEBUGALL) AND $this->DEBUGALL) 412 413 $debug = $this->DEBUGALL; 414 415 elseif(isset($this->DEBUG['parse_internal_1']) AND $this->DEBUG['parse_internal_1']) 416 417 $debug = $this->DEBUG['parse_internal_1']; 418 419 420 421 397 422 if (empty($tag)) { 398 423 $this->error ("parse_internal_1: empty tag invalid", true); … … 568 593 // 569 594 function parse_internal ($tag) { 570 $debug = $this->DEBUGALL || $this->DEBUG[parse_internal]; 595 596 $debug = $this->DEBUGALL || $this->DEBUG['parse_internal']; 597 598 $debug = FALSE; 599 600 if(isset($this->DEBUGALL) AND $this->DEBUGALL) 601 602 $debug = $this->DEBUGALL; 603 604 elseif(isset($this->DEBUG['parse_internal']) AND $this->DEBUG['parse_internal']) 605 606 $debug = $this->DEBUG['parse_internal']; 607 608 571 609 $append = false; 572 610 if ($debug) … … 589 627 // complicated and only makes sense if we start keeping it floating 590 628 // around between page loads as a persistent variable. 591 if (!isset($this->TEMPLATE[$tag][ loaded])) {592 if ($this->TEMPLATE[$tag][ dynamic]) {629 if (!isset($this->TEMPLATE[$tag]['loaded'])) { 630 if ($this->TEMPLATE[$tag]['dynamic']) { 593 631 // Template was declared via define_dynamic(). 594 if ($this->TEMPLATE[$tag][ parent])595 $tag = $this->TEMPLATE[$tag][ parent];632 if ($this->TEMPLATE[$tag]['parent']) 633 $tag = $this->TEMPLATE[$tag]['parent']; 596 634 else { 597 635 // Try to find a non-dynamic template with the same file. … … 600 638 foreach (array_keys($this->TEMPLATE) as $ptag) { 601 639 $this->logwrite ("parse_internal: looking for non-dynamic parent, $ptag"); 602 if (!$this->TEMPLATE[$ptag][ dynamic]603 && ($this->TEMPLATE[$ptag][ file] == $this->TEMPLATE[$tag][file])) {640 if (!$this->TEMPLATE[$ptag]['dynamic'] 641 && ($this->TEMPLATE[$ptag]['file'] == $this->TEMPLATE[$tag]['file'])) { 604 642 $tag = $ptag; 605 643 break; … … 608 646 } 609 647 } 610 $this->TEMPLATE[$tag][ string] = &$this->load($this->TEMPLATE[$tag][file]);611 $this->TEMPLATE[$tag][ loaded] = 1;648 $this->TEMPLATE[$tag]['string'] = &$this->load($this->TEMPLATE[$tag]['file']); 649 $this->TEMPLATE[$tag]['loaded'] = 1; 612 650 } 613 651 … … 616 654 // markers have a very rigid syntax as HTML comments.... 617 655 if ($this->DYNAMIC) { 618 $this->TEMPLATE[$tag][ tag] = $tag;619 if (! $this->TEMPLATE[$tag][parsed]) {620 $this->TEMPLATE[$tag][ part] = $this->parse_internal_1 ($tag, $this->TEMPLATE[$tag][string]);621 $this->TEMPLATE[$tag][ parsed] = true;656 $this->TEMPLATE[$tag]['tag'] = $tag; 657 if (!isset($this->TEMPLATE[$tag]['parsed']) OR !$this->TEMPLATE[$tag]['parsed']) { 658 $this->TEMPLATE[$tag]['part'] = $this->parse_internal_1 ($tag, $this->TEMPLATE[$tag]['string']); 659 $this->TEMPLATE[$tag]['parsed'] = true; 622 660 } 623 661 } … … 650 688 function subst ($handle, $tag, $autoload = true) { 651 689 $append = false; 652 $debug = $this->DEBUGALL || $this->DEBUG[subst]; 690 $debug = $this->DEBUGALL || $this->DEBUG['subst']; 691 692 $debug = FALSE; 693 694 if(isset($this->DEBUGALL) AND $this->DEBUGALL) 695 696 $debug = $this->DEBUGALL; 697 698 elseif(isset($this->DEBUG['subst']) AND $this->DEBUG['subst']) 699 700 $debug = $this->DEBUG['subst']; 701 702 653 703 $this->LAST = $handle; 654 704 … … 680 730 // entry. 681 731 if (isset($this->TEMPLATE[$tag])) { 682 if (! $this->TEMPLATE[$tag][parsed])732 if (!isset($this->TEMPLATE[$tag]['parsed']) OR !$this->TEMPLATE[$tag]['parsed']) 683 733 $this->parse_internal ($tag); 684 734 } else { … … 707 757 } 708 758 if (!$append) { 709 $this->TEMPLATE[$tag][ result] = '';759 $this->TEMPLATE[$tag]['result'] = ''; 710 760 if ($debug) 711 761 $this->logwrite ("subst (handle=$handle, tag=$tag, autoload=$autoload) in overwrite mode"); … … 713 763 if ($debug) 714 764 $this->logwrite ("subst: type(this->TEMPLATE[$tag][part]) => " . 715 gettype($this->TEMPLATE[$tag][ part]));765 gettype($this->TEMPLATE[$tag]['part'])); 716 766 // Hmmm, clear() called before subst() seems to result in this not 717 767 // being defined which leaves me a bit confused.... 718 768 $result = ''; 719 if (isset($this->TEMPLATE[$tag][ part])) {720 reset ($this->TEMPLATE[$tag][ part]);721 foreach (array_keys($this->TEMPLATE[$tag][ part]) as $p) {769 if (isset($this->TEMPLATE[$tag]['part'])) { 770 reset ($this->TEMPLATE[$tag]['part']); 771 foreach (array_keys($this->TEMPLATE[$tag]['part']) as $p) { 722 772 $this->logwrite ("subst: looking at TEMPLATE[$tag][part][$p]"); 723 $tmp = $this->TEMPLATE[$tag][ part][$p];773 $tmp = $this->TEMPLATE[$tag]['part'][$p]; 724 774 // Don't try if ($p == 'parent').... 725 775 if (strcmp ($p, 'parent') == 0) { 726 776 $this->logwrite ("subst: skipping part $p"); 727 777 $tmp = ''; 728 } else if (gettype($this->TEMPLATE[$tag][ part][$p]) == 'string') {778 } else if (gettype($this->TEMPLATE[$tag]['part'][$p]) == 'string') { 729 779 $this->logwrite ("subst: using part $p"); 730 780 reset ($this->VAR); … … 747 797 $result .= $tmp; 748 798 } else { 749 $xtag = $this->TEMPLATE[$tag][ part][$p][tag];799 $xtag = $this->TEMPLATE[$tag]['part'][$p]['tag']; 750 800 if ($this->debug) { 751 801 $this->logwrite ("subst: substituting other tag $xtag result in $tag"); … … 779 829 $this->logwrite ("subst: setting TEMPLATE[$tag][result] = $result"); 780 830 $this->HANDLE[$handle] = $result; 781 $this->TEMPLATE[$tag][ result] = $result;831 $this->TEMPLATE[$tag]['result'] = $result; 782 832 } 783 833 return $this->HANDLE[$handle]; … … 936 986 } 937 987 } 988 ?> /trunk/pici-server/ADMIN/setup.php
r11 r24 55 55 .'</small> seems not to be correct.<br/>Edit your configuration-file and insert the correct path to your 56 56 pici-server for the variable $path2site. 57 </div>'; 58 $return = false; 59 } 60 // check whether the Server Variable was set 61 elseif (!isset ($server)) 62 { 63 $message .= '<div class="problem"> 64 <strong>$server variable is not set</strong><br/> 65 Uncomment the line 53 or 54 in your configuration-file.<br/> 66 Set the variable to "darwin" for Mac OSX and to "linux" for a Linux system. 57 67 </div>'; 58 68 $return = false; … … 100 110 Change file permissions<br/> 101 111 via shell: 102 <pre>chmod 777 '112 <pre>chmod -R 777 ' 103 113 .$path2CACHE 104 114 .'</pre> … … 238 248 `created` double default NULL, 239 249 `loading` int(11) NOT NULL default '1', 240 `display ` int(11) default NULL,250 `displaynr` int(11) default NULL, 241 251 PRIMARY KEY (`idx`), 242 252 KEY `url` (`url`), /trunk/pici-server/ADMIN/get_picture.php
r18 r26 178 178 mysql_query(sprintf($addStmt), $DB_link); 179 179 180 if ($debug) echo ("export url=$url ; export imgnr=$idx ; export path2site=$path2site ; export path2python=$path2python ; export path2WebKit=$path2WebKit ; export path2CACHE=$path2CACHE; /usr/bin/sudo -u $pici_user $path2mkpicture/mkpicture.sh <br/>\n"); 181 $shell = shell_exec ("export url=$url ; export imgnr=$idx ; export path2site=$path2site ; export path2python=$path2python ; export path2WebKit=$path2WebKit ; export path2CACHE=$path2CACHE; /usr/bin/sudo -u $pici_user $path2mkpicture/mkpicture.sh"); 180 if ($debug) echo ("/usr/bin/sudo -u $pici_user $path2mkpicture/mkpicture.new.sh \"$url\" \"$idx\" \"$path2site\" \"$path2python\" \"$path2WebKit\" \"$path2CACHE\" <br/>\n"); 181 $shell = shell_exec ("/usr/bin/sudo -u $pici_user $path2mkpicture/mkpicture.sh $url \"$idx\" \"$path2site\" \"$path2python\" \"$path2WebKit\" \"$path2CACHE\" "); 182 182 183 if ($debug) echo ("shell = $shell <br/>\n"); 183 184 } /trunk/pici-server/ADMIN/mkpicture.sh
r4 r26 1 1 #!/bin/sh 2 export DYLD_FRAMEWORK_PATH=$path2WebKit.app/Contents/Resources/ 2 3 export DYLD_FRAMEWORK_PATH=$5.app/Contents/Resources/ 3 4 export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/PyObjC 4 $ path2python $path2site/ADMIN/picidae.py -F -o $path2CACHE/$imgnr $url5 chmod 664 $ path2CACHE/$imgnr.png5 $4 $3/ADMIN/picidae.py -F -o $6/$2 $1 6 chmod 664 $6/$2.png 6 7 /trunk/pici-server/ADMIN/common.php
r4 r30 23 23 24 24 25 // ---------------------------------------------------------- 26 // set local timezone (patch by jeremie78) 27 // ---------------------------------------------------------- 28 if(function_exists('date_default_timezone_set')) 29 date_default_timezone_set(date_default_timezone_get()); 30 25 31 26 32 // ---------------------------------------------------------- … … 29 35 function pici_decrypt ($key, $str) 30 36 { 37 global $debug; 38 31 39 $str1 = base64_decode($str); 32 if (function_exists ('mdecrypt_generic')) 40 if ($str1 =='') 41 { 42 $str2 = ''; 43 } 44 elseif (function_exists ('mdecrypt_generic')) 33 45 { 34 46 $td = mcrypt_module_open('des', '', 'ecb', ''); … … 36 48 $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); 37 49 mcrypt_generic_init($td, $key, $iv); 38 $str2 = mdecrypt_generic($td, $str1); 50 $str2 = trim(mdecrypt_generic($td, $str1)); 51 mcrypt_generic_deinit($td); 52 53 if ($debug) echo ("decrypted with mcrypt: $str2 <br/>\n"); 39 54 } 40 55 else 41 56 { 42 57 $str2 = des ($key,$str1,0,0,null); 58 59 if ($debug) echo ("decrypted with des.php: $str2 <br/>\n"); 43 60 } 44 61