</div>
	<div class="content">
		<?php 
if (count($latest_articles)) {
    ?>
			<ul class="article_list">
				<?php 
    foreach ($latest_articles as $article) {
        ?>
					<li>
						<div>
							<?php 
        echo image_tag('news_item_medium.png', array('style' => 'float: left;'), false, 'publish');
        ?>
							<?php 
        echo link_tag(make_url('publish_article', array('article_name' => $article->getName())), get_spaced_name($article->getTitle()));
        ?>
							<br>
							<span><?php 
        echo __('%time, by %user', array('%time' => tbg_formatTime($article->getPostedDate(), 3), '%user' => '<b>' . ($article->getAuthor() instanceof TBGIdentifiable ? '<a href="javascript:void(0);" onclick="TBG.Main.Helpers.Backdrop.show(\'' . make_url('get_partial_for_backdrop', array('key' => 'usercard', 'user_id' => $article->getAuthor()->getID())) . '\');">' . $article->getAuthor()->getName() . '</a>' : __('System')) . '</b>'));
        ?>
</span>
						</div>
					</li>
				<?php 
    }
    ?>
			</ul>
		<?php 
} else {
    ?>
    }
    ?>
    </div>
    <br style="clear: both;">
<?php 
}
if (!$embedded && $show_article && count($article->getCategories()) > 0 && $article->getContentSyntax() == \thebuggenie\core\framework\Settings::SYNTAX_MW) {
    ?>
    <br style="clear: both;">
    <div class="greybox categories">
        <?php 
    echo __('Categories:');
    ?>
        <?php 
    $category_links = array();
    ?>
        <?php 
    foreach ($article->getCategories() as $category) {
        ?>
            <?php 
        $category_links[] = link_tag(make_url('publish_article', array('article_name' => 'Category:' . $category)), get_spaced_name($category));
        ?>
        <?php 
    }
    ?>
        <?php 
    echo join(', ', $category_links);
    ?>
    </div>
<?php 
}
Example #3
0
} else {
    ?>
    <?php 
    if ($article->getArticleType() == \thebuggenie\modules\publish\entities\Article::TYPE_MANUAL) {
        echo get_spaced_name($article->getManualName());
    } else {
        $namespaces = explode(':', $article_name);
        if (count($namespaces) > 1 && $namespaces[0] == 'Category') {
            array_shift($namespaces);
            echo '<span class="faded_out blue">Category:</span>';
        }
        if (\thebuggenie\core\framework\Context::isProjectContext() && count($namespaces) > 1 && mb_strtolower($namespaces[0]) == \thebuggenie\core\framework\Context::getCurrentProject()->getKey()) {
            array_shift($namespaces);
            echo '<span>', \thebuggenie\core\framework\Context::getCurrentProject()->getName(), ':</span>';
        }
        echo \thebuggenie\core\framework\Settings::get('allow_camelcase_links', 'publish', \thebuggenie\core\framework\Context::getScope()->getID(), 0) ? get_spaced_name(implode(':', $namespaces)) : implode(':', $namespaces);
    }
    ?>
    <?php 
}
?>
    <?php 
if ($article->getID() && $mode) {
    switch ($mode) {
        /* case 'edit':
           ?><span class="faded_out"><?php echo __('%article_name ~ Edit', array('%article_name' => '')); ?></span><?php
           break; */
        case 'history':
            ?>
<span class="faded_out"><?php 
            echo __('%article_name ~ History', array('%article_name' => ''));
</div>
    <div class="content">
        <?php 
if (count($latest_articles)) {
    ?>
            <ul class="article_list">
                <?php 
    foreach ($latest_articles as $article) {
        ?>
                    <li>
                        <div>
                            <?php 
        echo image_tag('news_item_medium.png', array('style' => 'float: left;'), false, 'publish');
        ?>
                            <?php 
        echo link_tag(make_url('publish_article', array('article_name' => $article->getName())), \thebuggenie\core\framework\Settings::get('allow_camelcase_links', 'publish', \thebuggenie\core\framework\Context::getScope()->getID(), 0) ? get_spaced_name($article->getTitle()) : $article->getTitle());
        ?>
                            <br>
                            <span><?php 
        echo __('%time, by %user', array('%time' => tbg_formatTime($article->getPostedDate(), 3), '%user' => '<b>' . ($article->getAuthor() instanceof \thebuggenie\core\entities\common\Identifiable ? '<a href="javascript:void(0);" onclick="TBG.Main.Helpers.Backdrop.show(\'' . make_url('get_partial_for_backdrop', array('key' => 'usercard', 'user_id' => $article->getAuthor()->getID())) . '\');">' . $article->getAuthor()->getName() . '</a>' : __('System')) . '</b>'));
        ?>
</span>
                        </div>
                    </li>
                <?php 
    }
    ?>
            </ul>
        <?php 
} else {
    ?>
if (isset($resultcount)) {
    ?>
                <?php 
    if ($resultcount) {
        ?>
                    <div class="header_div" style="font-size: 1.3em;"><?php 
        echo __('Found %num article(s)', array('%num' => $resultcount));
        ?>
</div>
                    <ul class="simple_list wiki-find-articles-list">
                        <?php 
        foreach ($articles as $article) {
            ?>
                        <li style="margin-bottom: 0;">
                            <?php 
            echo link_tag(make_url('publish_article', array('article_name' => $article->getName())), get_spaced_name($article->getName()), array('style' => 'font-size: 1.1em;'));
            ?>
<br>
                            <div class="faded_out"><?php 
            echo __('Last updated %updated_at', array('%updated_at' => tbg_formatTime($article->getLastUpdatedDate(), 6)));
            ?>
</div>
                            <div class="article_preview">
                                <?php 
            echo tbg_truncateText($article->getContent());
            ?>
                            </div>
                        </li>
                        <?php 
        }
        ?>
        if ($article instanceof \thebuggenie\modules\publish\entities\Article) {
            ?>
            <li class="issue_open<?php 
            if ($cc == count($articles) && $resultcount == count($articles)) {
                ?>
 last<?php 
            }
            ?>
"><?php 
            echo image_tag('tab_publish.png', array('class' => 'informal'), false, 'publish');
            ?>
<div><a href="<?php 
            echo make_url('publish_article', array('article_name' => $article->getName()));
            ?>
"><?php 
            $article_name = get_spaced_name($article->getName());
            echo mb_strlen($article_name) <= 32 ? $article_name : str_pad(mb_substr($article_name, 0, 32), 35, '...');
            ?>
</div><span class="informal"><?php 
            echo __('Last updated %updated_at', array('%updated_at' => tbg_formatTime($article->getLastUpdatedDate(), 6)));
            ?>
</span><span class="informal url"><?php 
            echo make_url('publish_article', array('article_name' => $article->getName()));
            ?>
</span></li>
        <?php 
        }
        ?>
    <?php 
    }
    ?>
<?php

foreach ($parent_articles as $article_name => $manual_name) {
    ?>
<li><a href="javascript:void(0);" onclick="$('parent_article_name').setValue('<?php 
    echo $article_name;
    ?>
');$('parent_article_name_span').update('<?php 
    echo $manual_name;
    ?>
');$('parent_selector_container').hide();"><?php 
    echo str_replace(':', ' &rArr; ', get_spaced_name($article_name));
    ?>
</li>
<?php 
}
<div class="article">
    <div class="header">Special:WhatLinksHere &rArr; <?php 
echo get_spaced_name($linked_article_name);
?>
</div>
    <p>
        <?php 
echo __('Below is a listing of pages that link to this page.');
?>
    </p>
    <?php 
include_component('publish/articleslist', array('articles' => $articles, 'include_redirects' => false));
?>
</div>
Example #9
0
 public function getSpacedName()
 {
     return get_spaced_name($this->getName());
 }
<?php

$article_name = isset($article_name) ? $article_name : '';
if (!\thebuggenie\core\framework\Context::isProjectContext() || \thebuggenie\core\framework\Context::isProjectContext() && mb_strtolower($article_name) != mb_strtolower(\thebuggenie\core\framework\Context::getCurrentProject()->getKey() . ':mainpage')) {
    if (\thebuggenie\core\framework\Context::isProjectContext()) {
        $tbg_response->addBreadcrumb(\thebuggenie\core\framework\Context::getModule('publish')->getMenuTitle(), make_url('publish_article', array('article_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey() . ':MainPage')));
    } else {
        $tbg_response->addBreadcrumb(\thebuggenie\core\framework\Context::getModule('publish')->getMenuTitle(), make_url('publish_article', array('article_name' => 'MainPage')));
    }
    $items = explode(':', $article_name);
    $bcpath = array_shift($items);
    if (mb_strtolower($bcpath) == 'category') {
        $tbg_response->addBreadcrumb(__('Categories'));
        if (\thebuggenie\core\framework\Context::isProjectContext()) {
            $bcpath .= ":" . array_shift($items);
        }
    } elseif (!\thebuggenie\core\framework\Context::isProjectContext() && mb_strtolower($bcpath) != 'mainpage') {
        $tbg_response->addBreadcrumb(get_spaced_name($bcpath), make_url('publish_article', array('article_name' => $bcpath)));
    }
    foreach ($items as $bc_name) {
        $bcpath .= ":" . $bc_name;
        $tbg_response->addBreadcrumb(get_spaced_name($bc_name), make_url('publish_article', array('article_name' => $bcpath)));
    }
} else {
    $tbg_response->addBreadcrumb(\thebuggenie\core\framework\Context::getModule('publish')->getMenuTitle(), make_url('publish_article', array('article_name' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey() . ':MainPage')));
}
Example #11
0
        echo get_spaced_name($project_article_name);
        ?>
		<?php 
    }
    ?>
	<?php 
} elseif (substr($article_name, 0, 9) == 'Category:') {
    ?>
		<span class="faded_out blue">Category:</span><?php 
    echo get_spaced_name(substr($article_name, 9));
    ?>
	<?php 
} else {
    ?>
		<?php 
    echo get_spaced_name($article_name);
    ?>
	<?php 
}
?>
	<?php 
if ($mode) {
    switch ($mode) {
        case 'edit':
            ?>
<span class="faded_out"><?php 
            echo __('%article_name% ~ Edit', array('%article_name%' => ''));
            ?>
</span><?php 
            break;
        case 'history':
 /**
  * Show an article
  *
  * @param TBGRequest $request
  */
 public function runEditArticle(TBGRequest $request)
 {
     $article_name = $this->article instanceof TBGWikiArticle ? $this->article->getName() : $request->getParameter('article_name');
     if (!TBGContext::getModule('publish')->canUserEditArticle($article_name)) {
         TBGContext::setMessage('publish_article_error', TBGContext::getI18n()->__('You do not have permission to edit this article'));
         $this->forward(TBGContext::getRouting()->generate('publish_article', array('article_name' => $article_name)));
     }
     if ($request->isMethod(TBGRequest::POST)) {
         if ($request->hasParameter('new_article_name') && $request->getParameter('new_article_name') != '') {
             if ($request->hasParameter('change_reason') && trim($request->getParameter('change_reason')) != '') {
                 try {
                     if ($request->getParameter('article_id')) {
                         if (($article = PublishFactory::article($request->getParameter('article_id'))) && $article instanceof TBGWikiArticle) {
                             if ($article->getLastUpdatedDate() != $request->getParameter('last_modified')) {
                                 $this->error = TBGContext::getI18n()->__('The file has been modified since you last opened it');
                             } else {
                                 try {
                                     $article->setName($request->getParameter('new_article_name'));
                                     $article->setContent($request->getRawParameter('new_article_content'));
                                     if ($request->getParameter('preview')) {
                                         $this->article = $article;
                                     } else {
                                         $article->doSave(array(), $request->getParameter('change_reason'));
                                         TBGContext::setMessage('publish_article_message', TBGContext::getI18n()->__('The article was saved'));
                                         $this->forward(TBGContext::getRouting()->generate('publish_article', array('article_name' => $article->getName())));
                                     }
                                 } catch (Exception $e) {
                                     $this->error = $e->getMessage();
                                 }
                             }
                         }
                     }
                 } catch (Exception $e) {
                 }
                 if (($article = TBGWikiArticle::getByName($request->getParameter('new_article_name'))) && $article instanceof TBGWikiArticle && $article->getID() != $request->getParameter('article_id')) {
                     $this->error = TBGContext::getI18n()->__('An article with that name already exists. Please choose a different article name');
                 } elseif (!$article instanceof TBGWikiArticle) {
                     if ($request->getParameter('preview')) {
                         $article = new TBGWikiArticle();
                         $article->setContent($request->getRawParameter('new_article_content'));
                         $article->setName($request->getParameter('new_article_name'));
                         $this->article = $article;
                     } else {
                         $article_id = TBGWikiArticle::createNew($request->getParameter('new_article_name'), $request->getRawParameter('new_article_content', ''), true);
                         $this->forward(TBGContext::getRouting()->generate('publish_article', array('article_name' => $request->getParameter('new_article_name'))));
                     }
                 }
             } else {
                 $this->error = TBGContext::getI18n()->__('You have to provide a reason for the changes');
             }
         } else {
             $this->error = TBGContext::getI18n()->__('You need to specify the article name');
         }
     }
     $this->preview = (bool) $request->getParameter('preview');
     $this->article_title = null;
     $this->article_content = null;
     $this->article_intro = null;
     $this->change_reason = null;
     if ($this->article instanceof TBGWikiArticle) {
         $this->article_title = $this->article->getTitle();
         $this->article_content = $this->article->getContent();
         if ($request->isMethod(TBGRequest::POST)) {
             if ($request->hasParameter('new_article_name')) {
                 $this->article_title = $request->getParameter('new_article_name');
             }
             if ($request->hasParameter('new_article_content')) {
                 $this->article_content = $request->getRawParameter('new_article_content');
             }
             if ($request->hasParameter('change_reason')) {
                 $this->change_reason = $request->getParameter('change_reason');
             }
         }
     } else {
         if ($request->hasParameter('new_article_content')) {
             $this->article_content = $request->getRawParameter('new_article_content');
         }
         TBGContext::loadLibrary('publish');
         $this->article_title = str_replace(array(':', '_'), array(' ', ' '), get_spaced_name($this->article_name));
     }
 }
if ($is_first && $main_article->getArticleType() == \thebuggenie\modules\publish\entities\Article::TYPE_MANUAL) {
    ?>
        <?php 
    echo image_tag('icon-article-type-manual.small.png');
    ?>
    <?php 
} else {
    ?>
        <?php 
    echo !empty($children) ? image_tag('icon_folder.png', array(), false, 'publish') : image_tag('icon_article.png', array(), false, 'publish');
    ?>
    <?php 
}
?>
    <?php 
echo link_tag(make_url('publish_article', array('article_name' => $main_article->getName())), get_spaced_name($main_article->getManualName()));
?>
    <?php 
if ($is_parent || $is_selected) {
    ?>
        <ul>
            <?php 
    foreach ($children as $child_article) {
        ?>
                <?php 
        include_component('publish/manualsidebarlink', array('parents' => $parents, 'first' => $first, 'article' => $article, 'main_article' => $child_article, 'level' => $level + 1));
        ?>
            <?php 
    }
    ?>
        </ul>
Example #14
0
if (!empty($articles)) {
    ?>
    <ul>
        <?php 
    foreach ($articles as $article) {
        ?>
            <li>
                <?php 
        echo link_tag(make_url('publish_article', array('article_name' => $article->getName())), get_spaced_name($article->getName()));
        ?>
                <?php 
        if (!isset($include_redirects) || $include_redirects == true) {
            ?>
                    <?php 
            if ($article->isRedirect()) {
                echo ' &rArr; ' . link_tag(make_url('publish_article', array('article_name' => $article->getRedirectArticleName())), get_spaced_name($article->getRedirectArticleName()));
            }
            ?>
                <?php 
        }
        ?>
            </li>
        <?php 
    }
    ?>
    </ul>
<?php 
} else {
    ?>
    <div class="no_articles"><?php 
    echo __('This list is empty.');
Example #15
0
} else {
    ?>
    <?php 
    if ($article->getArticleType() == \thebuggenie\modules\publish\entities\Article::TYPE_MANUAL) {
        echo $article->getManualName();
    } else {
        $namespaces = explode(':', $article_name);
        if (count($namespaces) > 1 && $namespaces[0] == 'Category') {
            array_shift($namespaces);
            echo '<span class="faded_out blue">Category:</span>';
        }
        if (\thebuggenie\core\framework\Context::isProjectContext() && count($namespaces) > 1 && mb_strtolower($namespaces[0]) == \thebuggenie\core\framework\Context::getCurrentProject()->getKey()) {
            array_shift($namespaces);
            echo '<span>', \thebuggenie\core\framework\Context::getCurrentProject()->getName(), ':</span>';
        }
        echo get_spaced_name(implode(':', $namespaces));
    }
    ?>
    <?php 
}
?>
    <?php 
if ($article->getID() && $mode) {
    switch ($mode) {
        /* case 'edit':
           ?><span class="faded_out"><?php echo __('%article_name ~ Edit', array('%article_name' => '')); ?></span><?php
           break; */
        case 'history':
            ?>
<span class="faded_out"><?php 
            echo __('%article_name ~ History', array('%article_name' => ''));
        for ($i = 0; $i < count($namespaces); $i++) {
            $namespace = $namespaces[$i];
            $cssclass = 'invisible borderless';
            if (is_numeric($namespace) && $namespace == 0) {
                $title = __('Permissions for entire wiki');
                $help = __('These are the default permissions for all wiki articles. They will apply unless overridden by article-specific or namespace permissions.');
            } elseif ($namespace == $article->getName()) {
                $title = __('Permissions for the article %article_name', array('%article_name' => '<span class="namespace">' . get_spaced_name($namespace) . '</span>'));
                $help = __('These permissions override any other permissions for this article. They will also apply to child-articles unless overridden by child-namespace or child-article permissions.');
                $cssclass = 'verylightyellow';
            } elseif ($namespace == "Category") {
                $title = __('Permissions to edit categories');
                $help = __('These permissions determine who can create and edit categories.');
            } else {
                $title = __('Permissions for the %namespace namespace', array('%namespace' => '<span class="namespace">' . get_spaced_name($namespace) . '</span>'));
                $help = __('These permissions apply to the the %namespace namespace. They will also apply to all child-articles of this namespace unless overridden by article-specific or child-namespace permissions.', array('%namespace' => '<i>' . get_spaced_name($namespace) . '</i>'));
            }
            ?>
                            <li class="rounded_box <?php 
            echo $cssclass;
            ?>
" style="padding: 10px;">
                                <div class="namespace_header">
                                    <?php 
            echo $title;
            ?>
                                </div>
                                <?php 
            echo $help;
            ?>
                                <div style="text-align: right; padding: 10px;">