Changeset 815 for trunk/Modules
- Timestamp:
- Feb 22, 2015, 11:05:49 PM (10 years ago)
- Location:
- trunk/Modules
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/AoWoW/AoWoW.php
r626 r815 13 13 $this->Dependencies = array(); 14 14 } 15 15 16 16 function Start() 17 17 { -
trunk/Modules/Import/generatecodeXML.php
r565 r815 3 3 //$xml_buffer = array(); 4 4 5 function startElement($parser, $name, $attrs) 5 function startElement($parser, $name, $attrs) 6 6 { 7 7 global $depth, $xml_buffer; 8 9 for ($i = 0; $i < $depth[$parser]; $i++) 8 9 for ($i = 0; $i < $depth[$parser]; $i++) 10 10 { 11 11 echo " "; … … 14 14 // print_r( $attrs); 15 15 // generování proměných 16 16 17 17 $xml_buffer[count($xml_buffer)+1] = array($depth[$parser],$attrs); 18 18 // print_r($xml_buffer); … … 20 20 } 21 21 22 function endElement($parser, $name) 22 function endElement($parser, $name) 23 23 { 24 24 global $depth; 25 25 26 26 $depth[$parser]--; 27 27 } … … 30 30 31 31 $files = scandir($verze); 32 foreach($files as $file) 32 foreach($files as $file) 33 33 { 34 34 $end = substr($file, strlen($file) - 3); … … 36 36 { 37 37 echo('<br />--'.$file.'<br /><br />'); 38 $file = $verze.'/'.$file; 38 $file = $verze.'/'.$file; 39 39 $xml_buffer = array(); //mazání 40 40 41 41 $xml_parser = xml_parser_create(); 42 42 xml_set_element_handler($xml_parser, 'startElement', 'endElement'); 43 if (!($fp = fopen($file, 'r'))) 43 if (!($fp = fopen($file, 'r'))) 44 44 { 45 45 die('could not open XML input'); 46 46 } 47 47 48 while ($data = fread($fp, 4096)) 48 while ($data = fread($fp, 4096)) 49 49 { 50 if (!xml_parse($xml_parser, $data, feof($fp))) 50 if (!xml_parse($xml_parser, $data, feof($fp))) 51 51 { 52 52 die(sprintf("XML error: %s at line %d", … … 56 56 } 57 57 xml_parser_free($xml_parser); 58 59 for ($i = 0; $i < count($xml_buffer); $i++) 58 59 for ($i = 0; $i < count($xml_buffer); $i++) 60 60 { 61 61 $line = $xml_buffer[$i]; 62 if (isset($line[1]['TEXT'])) 62 if (isset($line[1]['TEXT'])) 63 63 { 64 64 $name = $line[1]['NAME']; 65 65 66 if ($name == '') 66 if ($name == '') 67 67 { //u FontString 68 68 $j = 1; 69 while (substr($name,0,1) == '') 69 while (substr($name,0,1) == '') 70 70 { 71 if (isset($xml_buffer[$i-$j][1]['NAME'])) 71 if (isset($xml_buffer[$i-$j][1]['NAME'])) 72 72 { 73 $name = $xml_buffer[$i-$j][1]['NAME'].$name; 73 $name = $xml_buffer[$i-$j][1]['NAME'].$name; 74 74 } 75 $j++; 75 $j++; 76 76 } 77 77 } 78 78 79 if (substr($name,0,1) == '$') 79 if (substr($name,0,1) == '$') 80 80 { //zjišťování potomků 81 81 $j = 1; 82 while (substr($name,0,1) == '$') 82 while (substr($name,0,1) == '$') 83 83 { 84 if (($xml_buffer[$i-$j][0] < $line[0]) and (isset($xml_buffer[$i-$j][1]['NAME']))) 84 if (($xml_buffer[$i-$j][0] < $line[0]) and (isset($xml_buffer[$i-$j][1]['NAME']))) 85 85 { 86 86 $name = substr($name,strlen('$parent')); 87 $name = $xml_buffer[$i-$j][1]['NAME'].$name; 87 $name = $xml_buffer[$i-$j][1]['NAME'].$name; 88 88 } 89 $j++; 89 $j++; 90 90 } 91 91 } -
trunk/Modules/News/News.php
r765 r815 6 6 { 7 7 var $RSSChannels; 8 8 9 9 function __construct($System) 10 10 { … … 17 17 $this->Dependencies = array(); 18 18 } 19 19 20 20 function Start() 21 21 { 22 22 $this->System->RegisterPage('news', 'PageNews'); 23 23 $this->System->RegisterPage('rss', 'PageRSS'); 24 $this->RegisterRSS(array('Title' => T('News'), 'Channel' => 'news', 24 $this->RegisterRSS(array('Title' => T('News'), 'Channel' => 'news', 25 25 'Callback' => array('PageNews', 'ShowRSS'), 'Permission' => LICENCE_ANONYMOUS)); 26 26 } 27 27 28 28 function ShowBox() 29 29 { … … 37 37 return($Output); 38 38 } 39 39 40 40 function RegisterRSS($Channel, $Pos = NULL, $Callback = NULL) 41 41 { … … 47 47 } 48 48 } 49 49 50 50 function ShowRSSHeader() 51 51 { 52 $Output = ''; 52 $Output = ''; 53 53 foreach($this->RSSChannels as $Channel) 54 54 { … … 56 56 $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'. 57 57 $this->System->Link('/rss/?channel='.$Channel['Channel']).'" type="application/rss+xml" />'; 58 } 58 } 59 59 return($Output); 60 60 } … … 74 74 return($Output); 75 75 } 76 76 77 77 function ShowList() 78 78 { … … 82 82 83 83 $Output = '<h3>'.T('News').'</h3>'.$PageList['Output']; 84 if($this->System->User->Licence(LICENCE_ADMIN)) 84 if($this->System->User->Licence(LICENCE_ADMIN)) 85 85 $Output .= ' <a href="?a=add">'.T('Add').'</a>'; 86 86 $Output .= '<div class="shoutbox">'; … … 90 90 $Output .= '<div><strong>'.$Line['Title'].' ('.HumanDate($Line['Time']).')</strong><br/> '.$Line['Text'].' ('.$Line['User'].')</div>'; 91 91 $Output .= '</div>'.$PageList['Output']; 92 return($Output); 92 return($Output); 93 93 } 94 94 95 95 function ShowAddForm() 96 96 { … … 124 124 return($Output); 125 125 } 126 126 127 127 function ShowRSS() 128 128 { … … 149 149 'Items' => $Items, 150 150 )); 151 return($Output); 151 return($Output); 152 152 } 153 153 } -
trunk/Modules/ShoutBox/ShoutBox.php
r805 r815 13 13 $this->Dependencies = array('News'); 14 14 } 15 15 16 16 function Start() 17 17 { 18 18 $this->System->RegisterPage('shoutbox', 'PageShoutBox'); 19 19 $this->System->ModuleManager->Modules['News']->RegisterRSS(array( 20 'Title' => T('Shoutbox'), 'Channel' => 'shoutbox', 'Callback' => array('PageShoutBox', 'ShowRSS'), 21 'Permission' => LICENCE_ANONYMOUS)); 20 'Title' => T('Shoutbox'), 'Channel' => 'shoutbox', 'Callback' => array('PageShoutBox', 'ShowRSS'), 21 'Permission' => LICENCE_ANONYMOUS)); 22 22 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 23 23 $this->System->ModuleManager->Modules['Search']->RegisterSearch('shoutbox', 24 24 T('Shoutbox'), array('UserName', 'Text'), '`ShoutBox`', $this->System->Link('/shoutbox/?search=')); 25 25 } 26 26 27 27 function ShowBox() 28 28 { … … 37 37 $Output .= '</table></div>'; 38 38 return($Output); 39 } 39 } 40 40 } 41 41 … … 53 53 return($Output); 54 54 } 55 55 56 56 function ShowList() 57 57 { … … 64 64 $SearchQuery = ' AND (`Text` LIKE "%'.$_SESSION['search'].'%")'; 65 65 $Output .= '<div><a href="?search=">'.sprintf(T('Disable filter "%s"'), $_SESSION['search']).'</a></div>'; 66 } else $SearchQuery = ''; 66 } else $SearchQuery = ''; 67 67 68 68 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ShoutBox` WHERE 1'.$SearchQuery); … … 71 71 72 72 $Output .= '<h3>'.T('Shoutbox').'</h3>'.$PageList['Output']; 73 if($this->System->User->Licence(LICENCE_USER)) 73 if($this->System->User->Licence(LICENCE_USER)) 74 74 $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>'; 75 75 $Output .= '<div class="shoutbox">'; … … 80 80 return($Output); 81 81 } 82 82 83 83 function ShowAddForm() 84 84 { … … 98 98 } else $Output .= ShowMessage('Pro vkládaní zpráv musíte byt registrováni.', MESSAGE_CRITICAL); 99 99 $Output .= $this->ShowList(); 100 return($Output); 100 return($Output); 101 101 } 102 102 103 103 function AddFinish() 104 104 { … … 134 134 $Output .= $this->ShowList(); 135 135 return($Output); 136 } 137 136 } 137 138 138 function ShowRSS() 139 139 { -
trunk/Modules/Translation/Translation.php
r806 r815 20 20 $this->Dependencies = array('News'); 21 21 } 22 22 23 23 function Start() 24 24 { 25 25 global $TranslationTree; 26 26 27 27 $this->System->RegisterPage('comparison.php', 'PageTranslationComparison'); 28 28 $this->System->RegisterPage('form.php', 'PageTranslationForm'); … … 31 31 $this->System->RegisterPage('TranslationList.php', 'PageTranslationList'); 32 32 $this->System->RegisterPage('LoadNames.php', 'PageLoadNames'); 33 $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => T('Last translations'), 33 $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => T('Last translations'), 34 34 'Channel' => 'translation', 'Callback' => array($this, 'ShowRSS'), 'Permission' => LICENCE_ANONYMOUS)); 35 35 $this->System->RegisterMenuItem(array( … … 39 39 'Permission' => LICENCE_ANONYMOUS, 40 40 'Icon' => '', 41 ), 1); 41 ), 1); 42 42 if(array_key_exists('Search', $this->System->ModuleManager->Modules)) 43 43 { … … 45 45 { 46 46 $Table = $Group['TablePrefix']; 47 47 48 48 $Columns = array('ID', 'Entry'); 49 49 foreach($Group['Items'] as $Item) 50 50 { 51 51 if($Item['Column'] != '') $Columns[] = $Item['Column']; 52 } 52 } 53 53 54 54 $this->System->ModuleManager->Modules['Search']->RegisterSearch('group'.$Group['Id'], 55 55 sprintf(T('Translation group "%s"'), $Group['Name']), $Columns, '`'.$Table.'`', $this->System->Link('/TranslationList.php?group='. 56 $Group['Id'].'&user=0&state=0&entry=&text=')); 56 $Group['Id'].'&user=0&state=0&entry=&text=')); 57 57 } 58 } 58 } 59 59 } 60 60 61 61 function ShowRSS() 62 62 {
Note:
See TracChangeset
for help on using the changeset viewer.