70 // function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace> |
70 // function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace> |
71 |
71 |
72 function page_Special_CreatePage() |
72 function page_Special_CreatePage() |
73 { |
73 { |
74 global $db, $session, $paths, $template, $plugins; // Common objects |
74 global $db, $session, $paths, $template, $plugins; // Common objects |
|
75 global $lang; |
|
76 |
75 if ( isset($_POST['do']) ) |
77 if ( isset($_POST['do']) ) |
76 { |
78 { |
77 $p = $_POST['pagename']; |
79 $p = $_POST['pagename']; |
78 $k = array_keys($paths->nslist); |
80 $k = array_keys($paths->nslist); |
79 for ( $i = 0; $i < sizeof( $paths->nslist ); $i++ ) |
81 for ( $i = 0; $i < sizeof( $paths->nslist ); $i++ ) |
116 } |
120 } |
117 if ( substr($urlname, 0, 8) == 'Project:' ) |
121 if ( substr($urlname, 0, 8) == 'Project:' ) |
118 { |
122 { |
119 $template->header(); |
123 $template->header(); |
120 |
124 |
121 echo '<h3>The page could not be created.</h3><p>The page title can\'t start with "Project:" because this prefix is reserved for a parser shortcut.</p>'; |
125 echo '<h3>' . $lang->get('pagetools_create_err_title') . '</h3> |
|
126 <p>' . $lang->get('pagetools_create_err_project_shortcut', array('page_name' => htmlspecialchars($p))) . '</p>'; |
122 |
127 |
123 $template->footer(); |
128 $template->footer(); |
124 $db->close(); |
129 $db->close(); |
125 |
130 |
126 exit; |
131 exit; |
127 } |
132 } |
128 |
133 |
129 $tn = $paths->nslist[$_POST['namespace']] . $urlname; |
134 $tn = $paths->nslist[$_POST['namespace']] . $urlname; |
130 if ( isset($paths->pages[$tn]) ) |
135 if ( isset($paths->pages[$tn]) ) |
131 { |
136 { |
132 die_friendly('Error creating page', '<p>The page already exists.</p>'); |
137 die_friendly($lang->get('pagetools_create_err_title'), '<p>' . $lang->get('pagetools_create_err_already_exist') . '</p>'); |
133 } |
138 } |
134 |
139 |
135 if ( $paths->nslist[$namespace] == substr($urlname, 0, strlen($paths->nslist[$namespace]) ) ) |
140 if ( $paths->nslist[$namespace] == substr($urlname, 0, strlen($paths->nslist[$namespace]) ) ) |
136 { |
141 { |
137 $urlname = substr($urlname, strlen($paths->nslist[$namespace]), strlen($urlname)); |
142 $urlname = substr($urlname, strlen($paths->nslist[$namespace]), strlen($urlname)); |
152 $urlname = sanitize_page_id($urlname); |
157 $urlname = sanitize_page_id($urlname); |
153 $urlname = $db->escape($urlname); |
158 $urlname = $db->escape($urlname); |
154 |
159 |
155 $perms = $session->fetch_page_acl($urlname, $namespace); |
160 $perms = $session->fetch_page_acl($urlname, $namespace); |
156 if ( !$perms->get_permissions('create_page') ) |
161 if ( !$perms->get_permissions('create_page') ) |
157 die_friendly('Error creating page', '<p>An access control rule is preventing you from creating pages.</p>'); |
162 die_friendly($lang->get('pagetools_create_err_title'), '<p>An access control rule is preventing you from creating pages.</p>'); |
158 |
163 |
159 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(time_id,date_string,log_type,action,author,page_id,namespace) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'create\', \''.$session->username.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\');'); |
164 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(time_id,date_string,log_type,action,author,page_id,namespace) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'create\', \''.$session->username.'\', \''.$urlname.'\', \''.$_POST['namespace'].'\');'); |
160 if ( !$q ) |
165 if ( !$q ) |
161 { |
166 { |
162 $db->_die('The page log could not be updated.'); |
167 $db->_die('The page log could not be updated.'); |
186 $db->close(); |
191 $db->close(); |
187 |
192 |
188 exit; |
193 exit; |
189 } |
194 } |
190 */ |
195 */ |
191 echo RenderMan::render('Using the form below you can create a page.'); |
196 echo '<p>' . $lang->get('pagetools_create_blurb') . '</p>'; |
192 ?> |
197 ?> |
193 <form action="" method="post"> |
198 <form action="" method="post"> |
194 <p> |
199 <p> |
195 <select name="namespace"> |
200 <select name="namespace"> |
196 <?php |
201 <?php |
197 $k = array_keys($paths->nslist); |
202 $k = array_keys($paths->nslist); |
198 for ( $i = 0; $i < sizeof($k); $i++ ) |
203 for ( $i = 0; $i < sizeof($k); $i++ ) |
199 { |
204 { |
200 if ( $paths->nslist[$k[$i]] == '' ) |
205 if ( $paths->nslist[$k[$i]] == '' ) |
201 { |
206 { |
202 $s = '[No prefix]'; |
207 $s = $lang->get('pagetools_create_namespace_none'); |
203 } |
208 } |
204 else |
209 else |
205 { |
210 { |
206 $s = $paths->nslist[$k[$i]]; |
211 $s = $paths->nslist[$k[$i]]; |
207 } |
212 } |
261 |
266 |
262 function page_Special_AllPages() |
267 function page_Special_AllPages() |
263 { |
268 { |
264 // This should be an easy one |
269 // This should be an easy one |
265 global $db, $session, $paths, $template, $plugins; // Common objects |
270 global $db, $session, $paths, $template, $plugins; // Common objects |
|
271 global $lang; |
|
272 |
266 $template->header(); |
273 $template->header(); |
267 $sz = sizeof( $paths->pages ) / 2; |
274 $sz = sizeof( $paths->pages ) / 2; |
268 echo '<p>Below is a list of all of the pages on this website.</p>'; |
275 echo '<p>' . $lang->get('pagetools_allpages_blurb') . '</p>'; |
269 |
276 |
270 $q = $db->sql_query('SELECT COUNT(urlname) FROM '.table_prefix.'pages WHERE visible!=0;'); |
277 $q = $db->sql_query('SELECT COUNT(urlname) FROM '.table_prefix.'pages WHERE visible!=0;'); |
271 if ( !$q ) |
278 if ( !$q ) |
272 $db->_die(); |
279 $db->_die(); |
273 $row = $db->fetchrow_num(); |
280 $row = $db->fetchrow_num(); |
326 { |
333 { |
327 // This should be an easy one |
334 // This should be an easy one |
328 global $db, $session, $paths, $template, $plugins; // Common objects |
335 global $db, $session, $paths, $template, $plugins; // Common objects |
329 $template->header(); |
336 $template->header(); |
330 $sz = sizeof($paths->pages) / 2; |
337 $sz = sizeof($paths->pages) / 2; |
331 echo '<p>Below is a list of all of the special pages on this website.</p><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">'; |
338 echo '<p>' . $lang->get('pagetools_specialpages_blurb') . '</p><div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">'; |
332 $cclass='row1'; |
339 $cclass='row1'; |
333 for ( $i = 0; $i < $sz; $i = $i) |
340 for ( $i = 0; $i < $sz; $i = $i) |
334 { |
341 { |
335 if ( $cclass == 'row1' ) |
342 if ( $cclass == 'row1' ) |
336 { |
343 { |
384 $template->header(); |
391 $template->header(); |
385 ?> |
392 ?> |
386 <br /> |
393 <br /> |
387 <div class="tblholder"> |
394 <div class="tblholder"> |
388 <table border="0" cellspacing="1" cellpadding="4"> |
395 <table border="0" cellspacing="1" cellpadding="4"> |
389 <tr><th colspan="2" style="text-align: left;">About the Enano Content Management System</th></tr> |
396 <tr><th colspan="2" style="text-align: left;"><?php echo $lang->get('meta_enano_about_th'); ?></th></tr> |
390 <tr><td colspan="2" class="row3"> |
397 <tr><td colspan="2" class="row3"> |
391 <?php |
398 <?php |
392 echo $lang->get('meta_enano_about_poweredby'); |
399 echo $lang->get('meta_enano_about_poweredby'); |
393 $subst = array( |
400 $subst = array( |
394 'gpl_link' => makeUrlNS('Special', 'GNU_General_Public_License') |
401 'gpl_link' => makeUrlNS('Special', 'GNU_General_Public_License') |
499 } |
506 } |
500 |
507 |
501 function page_Special_GNU_General_Public_License() |
508 function page_Special_GNU_General_Public_License() |
502 { |
509 { |
503 global $db, $session, $paths, $template, $plugins; // Common objects |
510 global $db, $session, $paths, $template, $plugins; // Common objects |
|
511 global $lang; |
|
512 |
504 $template->header(); |
513 $template->header(); |
505 if(file_exists(ENANO_ROOT.'/GPL')) |
514 if(file_exists(ENANO_ROOT . '/GPL')) |
506 { |
515 { |
|
516 echo '<p>' . $lang->get('pagetools_gpl_blurb', array('about_url' => makeUrlNS('Special', 'About_Enano'))) . '</p>'; |
|
517 |
|
518 if ( $lang->lang_code != 'eng' ): |
|
519 // Do not remove this block of code. Doing so is a violation of the GPL. (A copy of the GPL in other languages |
|
520 // must be accompanied by a copy of the English GPL.) |
507 echo '<p>The following text represents the license that the <a href="'.makeUrlNS('Special', 'About_Enano').'">Enano</a> content management system is under. To make it easier to read, the text has been wiki-formatted; in no other way has it been changed.</p>'; |
521 echo '<p>The following text represents the license that the <a href="'.makeUrlNS('Special', 'About_Enano').'">Enano</a> content management system is under. To make it easier to read, the text has been wiki-formatted; in no other way has it been changed.</p>'; |
|
522 endif; |
|
523 |
|
524 if ( file_exists(ENANO_ROOT . "/GPL_{$lang->lang_code}") ) |
|
525 { |
|
526 echo '<h2>' . $lang->get('pagetools_gpl_title_native') . '</h2>'; |
|
527 echo '<p><a href="#gpl_english">' . $lang->get('pagetools_gpl_link_to_english') . ' / View the license in English' . '</a></p>'; |
|
528 echo RenderMan::render( file_get_contents ( ENANO_ROOT . "/GPL_{$lang->lang_code}" ) ); |
|
529 echo '<h2>' . $lang->get('pagetools_gpl_title_english') . ' / English version<a name="gpl_english" id="gpl_english"></a></h2>'; |
|
530 } |
|
531 |
508 echo RenderMan::render( file_get_contents ( ENANO_ROOT . '/GPL' ) ); |
532 echo RenderMan::render( file_get_contents ( ENANO_ROOT . '/GPL' ) ); |
509 } |
533 } |
510 else |
534 else |
511 { |
535 { |
512 echo '<p>It appears that the file "GPL" is missing from your Enano installation. You may find a wiki-formatted copy of the GPL at: <a href="http://enanocms.org/GPL">http://enanocms.org/GPL</a>.</p>'; |
536 echo '<p>' . $lang->get('pagetools_gpl_err_file_missing') . '</p>'; |
|
537 if ( $lang->lang_code != 'eng') |
|
538 // Also print out English version |
|
539 // Do not remove the following line of code; doing so would be a violation of the GPL. |
|
540 echo '<p>It appears that the file "GPL" is missing from your Enano installation. You may find a wiki-formatted copy of the GPL at: <a href="http://enanocms.org/GPL">http://enanocms.org/GPL</a>. In the mean time, you may wish to contact the site administration and ask them to replace the GPL file.</p>'; |
513 } |
541 } |
514 $template->footer(); |
542 $template->footer(); |
515 } |
543 } |
516 |
544 |
517 function page_Special_TagCloud() |
545 function page_Special_TagCloud() |
518 { |
546 { |
519 global $db, $session, $paths, $template, $plugins; // Common objects |
547 global $db, $session, $paths, $template, $plugins; // Common objects |
|
548 global $lang; |
520 |
549 |
521 $template->header(); |
550 $template->header(); |
522 |
551 |
523 if ( $tag = $paths->getParam(0) ) |
552 if ( $tag = $paths->getParam(0) ) |
524 { |
553 { |
572 $q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;'); |
601 $q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;'); |
573 if ( !$q ) |
602 if ( !$q ) |
574 $db->_die(); |
603 $db->_die(); |
575 if ( $db->numrows() < 1 ) |
604 if ( $db->numrows() < 1 ) |
576 { |
605 { |
577 echo '<p>No pages are tagged yet.</p>'; |
606 echo '<p>' . $lang->get('pagetools_tagcloud_msg_no_tags') . '</p>'; |
578 } |
607 } |
579 else |
608 else |
580 { |
609 { |
581 echo '<h3>Summary of page tagging</h3>'; |
610 echo '<h3>' . $lang->get('pagetools_tagcloud_blurb') . '</h3>'; |
582 while ( $row = $db->fetchrow() ) |
611 while ( $row = $db->fetchrow() ) |
583 { |
612 { |
584 $cloud->add_word($row['tag_name']); |
613 $cloud->add_word($row['tag_name']); |
585 } |
614 } |
586 echo $cloud->make_html('normal'); |
615 echo $cloud->make_html('normal'); |
587 echo '<p>Hover your mouse over a tag to see how many pages have the tag. Click on a tag to see a list of the pages that have it.</p>'; |
616 echo '<p>' . $lang->get('pagetools_tagcloud_instructions') . '</p>'; |
588 } |
617 } |
589 } |
618 } |
590 |
619 |
591 $template->footer(); |
620 $template->footer(); |
592 } |
621 } |
593 |
622 |
594 // tag cloud sidebar block |
623 // tag cloud sidebar block |
595 function sidebar_add_tag_cloud() |
624 function sidebar_add_tag_cloud() |
596 { |
625 { |
597 global $db, $session, $paths, $template, $plugins; // Common objects |
626 global $db, $session, $paths, $template, $plugins; // Common objects |
|
627 global $lang; |
598 $cloud = new TagCloud(); |
628 $cloud = new TagCloud(); |
599 |
629 |
600 $q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;'); |
630 $q = $db->sql_query('SELECT tag_name FROM '.table_prefix.'tags;'); |
601 if ( !$q ) |
631 if ( !$q ) |
602 $db->_die(); |
632 $db->_die(); |
603 if ( $db->numrows() < 1 ) |
633 if ( $db->numrows() < 1 ) |
604 { |
634 { |
605 $sb_html = 'No pages are tagged yet.'; |
635 $sb_html = $lang->get('pagetools_tagcloud_msg_no_tags'); |
606 } |
636 } |
607 else |
637 else |
608 { |
638 { |
609 while ( $row = $db->fetchrow() ) |
639 while ( $row = $db->fetchrow() ) |
610 { |
640 { |
611 $cloud->add_word($row['tag_name']); |
641 $cloud->add_word($row['tag_name']); |
612 } |
642 } |
613 $sb_html = $cloud->make_html('small', 'justify') . '<br /><a style="text-align: center;" href="' . makeUrlNS('Special', 'TagCloud') . '">Larger version</a>'; |
643 $sb_html = $cloud->make_html('small', 'justify') . '<br /><a style="text-align: center;" href="' . makeUrlNS('Special', 'TagCloud') . '">' . $lang->get('pagetools_tagcloud_sidebar_btn_larger') . '</a>'; |
614 } |
644 } |
615 $template->sidebar_widget('Tag cloud', "<div style='padding: 5px;'>$sb_html</div>"); |
645 $template->sidebar_widget($lang->get('pagetools_tagcloud_sidebar_title'), "<div style='padding: 5px;'>$sb_html</div>"); |
616 } |
646 } |
617 |
647 |
618 $plugins->attachHook('compile_template', 'sidebar_add_tag_cloud();'); |
648 $plugins->attachHook('compile_template', 'sidebar_add_tag_cloud();'); |
619 |
649 |
620 ?> |
650 ?> |