|
1 | 1 | <?php
|
2 | 2 | /**
|
3 | 3 | * @package TinyPortal
|
4 |
| - * @version 1.0.0 |
| 4 | + * @version 1.0.0 RC1 |
5 | 5 | * @author TinyPortal - http://www.tinyportal.net
|
6 | 6 | * @license BSD 3.0 http://opensource.org/licenses/BSD-3-Clause/
|
7 | 7 | *
|
|
10 | 10 | */
|
11 | 11 | use \TinyPortal\Article as TPArticle;
|
12 | 12 | use \TinyPortal\Block as TPBlock;
|
| 13 | +use \TinyPortal\Category as TPCategory; |
13 | 14 | use \TinyPortal\Database as TPDatabase;
|
14 | 15 | use \TinyPortal\Util as TPUtil;
|
15 | 16 |
|
@@ -169,8 +170,21 @@ function getBlocks() {{{
|
169 | 170 | foreach($categories as $row) {
|
170 | 171 | if(empty($row['author'])) {
|
171 | 172 | global $memberContext;
|
172 |
| - loadMemberData($row['author_id'], false, 'minimal'); |
173 |
| - loadMemberContext($row['author_id']); |
| 173 | + // Load their context data. |
| 174 | + if(!array_key_exists('admin_features', $context)) { |
| 175 | + $context['admin_features'] = array(); |
| 176 | + $adminFeatures = true; |
| 177 | + } |
| 178 | + else { |
| 179 | + $adminFeatures = false; |
| 180 | + } |
| 181 | + |
| 182 | + \loadMemberData($row['author_id'], false, 'normal'); |
| 183 | + \loadMemberContext($row['author_id']); |
| 184 | + |
| 185 | + if($adminFeatures == true) { |
| 186 | + unset($context['admin_features']); |
| 187 | + } |
174 | 188 | $row['real_name'] = $memberContext[$row['author_id']]['username'];
|
175 | 189 | }
|
176 | 190 | else {
|
@@ -517,27 +531,22 @@ function editBlock( $block_id = 0 ) {{{
|
517 | 531 | }
|
518 | 532 | // collect all available PHP block snippets
|
519 | 533 | $context['TPortal']['blockcodes'] = TPcollectSnippets();
|
520 |
| - get_catnames(); |
| 534 | + |
| 535 | + // Get the category names |
| 536 | + $categories = TPCategory::getInstance()->getCategoryData(array('id', 'display_name'), array('item_type' => 'category')); |
| 537 | + if(is_array($categories)) { |
| 538 | + foreach($categories as $k => $v) { |
| 539 | + $context['TPortal']['catnames'][$v['id']] = $v['display_name']; |
| 540 | + $context['TPortal']['article_categories'][] = array( 'id' => $v['id'], 'name' => $v['display_name'] ); |
| 541 | + } |
| 542 | + } |
| 543 | + |
521 | 544 | get_grps();
|
522 | 545 | get_langfiles();
|
523 | 546 | get_boards();
|
524 | 547 | get_articles();
|
525 | 548 | $context['TPortal']['edit_categories'] = array();
|
526 |
| - $request = $db->query('', ' |
527 |
| - SELECT id, display_name as name |
528 |
| - FROM {db_prefix}tp_categories |
529 |
| - WHERE item_type = {string:type} |
530 |
| - ORDER BY display_name', |
531 |
| - array( |
532 |
| - 'type' => 'category' |
533 |
| - ) |
534 |
| - ); |
535 | 549 |
|
536 |
| - if($db->num_rows($request) > 0) { |
537 |
| - while($row = $db->fetch_assoc($request)) |
538 |
| - $context['TPortal']['article_categories'][] = $row; |
539 |
| - $db->free_result($request); |
540 |
| - } |
541 | 550 | // get all themes for selection
|
542 | 551 | $context['TPthemes'] = array();
|
543 | 552 | $request = $db->query('', '
|
|
0 commit comments