Пример #1
0
 public function clearUserScopes($user_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, \thebuggenie\core\framework\Settings::getDefaultScopeID(), Criteria::DB_NOT_EQUALS);
     $crit->addWhere(self::USER_ID, $user_id);
     $this->doDelete($crit);
 }
Пример #2
0
 public function runResolve(framework\Request $request)
 {
     $theme = isset($request['theme_name']) ? $request['theme_name'] : framework\Settings::getThemeName();
     if ($request->hasParameter('css')) {
         $this->getResponse()->setContentType('text/css');
         if (!$request->hasParameter('theme_name')) {
             $basepath = THEBUGGENIE_PATH . 'public' . DS . 'css';
             $asset = THEBUGGENIE_PATH . 'public' . DS . 'css' . DS . $request->getParameter('css');
         } else {
             $basepath = THEBUGGENIE_PATH . 'themes';
             $asset = THEBUGGENIE_PATH . 'themes' . DS . $theme . DS . 'css' . DS . $request->getParameter('css');
         }
     } elseif ($request->hasParameter('js')) {
         $this->getResponse()->setContentType('text/javascript');
         if ($request->hasParameter('theme_name')) {
             $basepath = THEBUGGENIE_PATH . 'themes';
             $asset = THEBUGGENIE_PATH . 'themes' . DS . $theme . DS . 'js' . DS . $request->getParameter('js');
         } elseif ($request->hasParameter('module_name') && framework\Context::isModuleLoaded($request['module_name'])) {
             $module_path = framework\Context::isInternalModule($request['module_name']) ? THEBUGGENIE_INTERNAL_MODULES_PATH : THEBUGGENIE_MODULES_PATH;
             $basepath = $module_path . $request['module_name'] . DS . 'public' . DS . 'js';
             $asset = $module_path . $request['module_name'] . DS . 'public' . DS . 'js' . DS . $request->getParameter('js');
         } else {
             $basepath = THEBUGGENIE_PATH . 'public' . DS . 'js';
             $asset = THEBUGGENIE_PATH . 'public' . DS . 'js' . DS . $request->getParameter('js');
         }
     } else {
         throw new \Exception('The expected theme Asset type is not supported.');
     }
     $fileAsset = new AssetCollection(array(new FileAsset($asset, array(), $basepath)));
     $fileAsset->load();
     // Do not decorate the asset with the theme's header/footer
     $this->getResponse()->setDecoration(framework\Response::DECORATE_NONE);
     return $this->renderText($fileAsset->dump());
 }
Пример #3
0
 public function do_execute()
 {
     /* Prepare variables */
     try {
         $project_id = $this->getProvidedArgument('projectid');
         $project_row = \thebuggenie\core\entities\tables\Projects::getTable()->getById($project_id, false);
         \thebuggenie\core\framework\Context::setScope(new \thebuggenie\core\entities\Scope($project_row[\thebuggenie\core\entities\tables\Projects::SCOPE]));
         $project = new \thebuggenie\core\entities\Project($project_id, $project_row);
     } catch (\Exception $e) {
         $this->cliEcho("The project with the ID " . $this->getProvidedArgument('projectid') . " does not exist\n", 'red', 'bold');
         exit;
     }
     $author = $this->getProvidedArgument('author');
     $new_rev = $this->getProvidedArgument('revno');
     $commit_msg = $this->getProvidedArgument('log');
     $changed = $this->getProvidedArgument('changed');
     $old_rev = $this->getProvidedArgument('oldrev', null);
     $date = $this->getProvidedArgument('date', null);
     $branch = $this->getProvidedArgument('branch', null);
     if (\thebuggenie\core\framework\Settings::get('access_method_' . $project->getKey()) == Vcs_integration::ACCESS_HTTP) {
         $this->cliEcho("This project uses the HTTP access method, and so access via the CLI has been disabled\n", 'red', 'bold');
         exit;
     }
     if ($old_rev === null && !ctype_digit($new_rev)) {
         $this->cliEcho("Error: if only the new revision is specified, it must be a number so that old revision can be calculated from it (by substracting 1 from new revision number).");
     } else {
         if ($old_rev === null) {
             $old_rev = $new_rev - 1;
         }
     }
     $output = Vcs_integration::processCommit($project, $commit_msg, $old_rev, $new_rev, $date, $changed, $author, $branch);
     $this->cliEcho($output);
 }
Пример #4
0
 public function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     foreach (IssueTypes::getTable()->getAllIDsByScopeID($scope->getID()) as $issuetype_id) {
         $crit = $this->getCriteria();
         $crit->addInsert(self::SCOPE, $scope->getID());
         $crit->addInsert(self::WORKFLOW_ID, \thebuggenie\core\framework\Settings::getCoreWorkflow()->getID());
         $crit->addInsert(self::WORKFLOW_SCHEME_ID, \thebuggenie\core\framework\Settings::getCoreWorkflowScheme()->getID());
         $crit->addInsert(self::ISSUETYPE_ID, $issuetype_id);
         $this->doInsert($crit);
     }
 }
Пример #5
0
 /**
  * Logs the user out
  *
  * @param \thebuggenie\core\framework\Request $request
  *
  * @return bool
  */
 public function runLogout(framework\Request $request)
 {
     if ($this->getUser() instanceof entities\User) {
         framework\Logging::log('Setting user logout state');
         $this->getUser()->setOffline();
     }
     framework\Context::logout();
     if ($request->isAjaxCall()) {
         return $this->renderJSON(array('status' => 'logout ok', 'url' => framework\Context::getRouting()->generate(framework\Settings::getLogoutReturnRoute())));
     }
     $this->forward(framework\Context::getRouting()->generate(framework\Settings::getLogoutReturnRoute()));
 }
Пример #6
0
 /**
  * @covers \thebuggenie\core\framework\Context::isInstallmode
  * @covers \thebuggenie\core\framework\Context::checkInstallMode
  */
 public function testInstallMode()
 {
     $installed_file = THEBUGGENIE_PATH . 'installed';
     if (file_exists($installed_file)) {
         unlink($installed_file);
     }
     \thebuggenie\core\framework\Context::checkInstallMode();
     $this->assertTrue(\thebuggenie\core\framework\Context::isInstallmode());
     file_put_contents($installed_file, \thebuggenie\core\framework\Settings::getMajorVer() . "." . \thebuggenie\core\framework\Settings::getMinorVer() . "." . \thebuggenie\core\framework\Settings::getRevision() . ", installed today");
     \thebuggenie\core\framework\Context::checkInstallMode();
     $this->assertFalse(\thebuggenie\core\framework\Context::isInstallmode());
 }
Пример #7
0
 protected function _install($scope)
 {
     if ($scope == framework\Settings::getDefaultScopeID()) {
         $mobile_css_path = THEBUGGENIE_PATH . THEBUGGENIE_PUBLIC_FOLDER_NAME . DS . 'css' . DS . 'mobile.css';
         if (!is_writable(pathinfo($mobile_css_path, PATHINFO_DIRNAME))) {
             throw new framework\exceptions\ConfigurationException("Cannot save the file {$mobile_css_path}", framework\exceptions\ConfigurationException::PERMISSION_DENIED);
         }
         if (file_exists($mobile_css_path)) {
             unlink($mobile_css_path);
         }
         symlink(THEBUGGENIE_MODULES_PATH . 'mobile' . DS . 'css' . DS . 'mobile.css', $mobile_css_path);
     }
 }
Пример #8
0
 public function do_execute()
 {
     $hostname = $this->getProvidedArgument('hostname');
     $this->cliEcho('Checking scope availability ...');
     if (tables\ScopeHostnames::getTable()->getScopeIDForHostname($hostname) === null) {
         $this->cliEcho("available!\n");
         $this->cliEcho("Creating scope ...");
         $scope = new entities\Scope();
         $scope->addHostname($hostname);
         $scope->setName($this->getProvidedArgument('shortname'));
         $uploads_enabled = $this->getProvidedArgument('enable_uploads', 'yes') == 'yes';
         $scope->setUploadsEnabled((bool) $uploads_enabled);
         $scope->setMaxUploadLimit($this->getProvidedArgument('upload_limit', 0));
         $scope->setMaxProjects($this->getProvidedArgument('projects', 0));
         $scope->setMaxUsers($this->getProvidedArgument('users', 0));
         $scope->setMaxTeams($this->getProvidedArgument('teams', 0));
         $scope->setMaxWorkflowsLimit($this->getProvidedArgument('workflows', 0));
         $scope->setEnabled();
         $this->cliEcho(".");
         $scope->save();
         $this->cliEcho(".done!\n");
         $admin_user = $this->getProvidedArgument('scope_admin');
         if ($admin_user) {
             $user = entities\User::getByUsername($admin_user);
             if ($user instanceof entities\User) {
                 $this->cliEcho("Adding user {$admin_user} to scope\n");
                 $admin_group_id = (int) framework\Settings::get(framework\Settings::SETTING_ADMIN_GROUP, 'core', $scope->getID());
                 tables\UserScopes::getTable()->addUserToScope($user->getID(), $scope->getID(), $admin_group_id, true);
             } else {
                 $this->cliEcho("Could not add user {$admin_user} to scope (username not found)\n");
             }
         }
         if ($this->getProvidedArgument('remove_admin', 'no') == 'yes') {
             $this->cliEcho("Removing administrator user from scope\n");
             tables\UserScopes::getTable()->removeUserFromScope(1, $scope->getID());
         }
         foreach (framework\Context::getModules() as $module) {
             $module_name = $module->getName();
             if ($module_name == 'publish') {
                 continue;
             }
             if ($this->getProvidedArgument("install_module_{$module_name}", "no") == 'yes') {
                 $this->cliEcho("Installing module {$module_name}\n");
                 entities\Module::installModule($module_name, $scope);
             }
         }
     } else {
         $this->cliEcho("not available\n", 'red');
     }
     $this->cliEcho("\n");
 }
Пример #9
0
 public function do_execute()
 {
     $this->cliEcho("\n");
     $this->cliEcho("Revert authentication backend\n", 'white', 'bold');
     $this->cliEcho("This command is useful if you've managed to lock yourself.\n");
     $this->cliEcho("out due to an authentication backend change gone bad.\n\n");
     if (\thebuggenie\core\framework\Settings::getAuthenticationBackend() == 'tbg' || \thebuggenie\core\framework\Settings::getAuthenticationBackend() == null) {
         $this->cliEcho("You are currently using the default authentication backend.\n\n");
     } else {
         $this->cliEcho("Please type 'yes' if you want to revert to the default authentication backend: ");
         $this->cliEcho("\n");
         if ($this->getInput() == 'yes') {
             \thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_AUTH_BACKEND, 'tbg');
             $this->cliEcho("Authentication backend reverted.\n\n");
         } else {
             $this->cliEcho("No changes made.\n\n");
         }
     }
 }
Пример #10
0
 public function componentLeftmenu()
 {
     $config_sections = framework\Settings::getConfigSections(framework\Context::getI18n());
     $breadcrumblinks = array();
     foreach ($config_sections as $key => $sections) {
         foreach ($sections as $section) {
             if ($key == framework\Settings::CONFIGURATION_SECTION_MODULES) {
                 $url = is_array($section['route']) ? make_url($section['route'][0], $section['route'][1]) : make_url($section['route']);
                 $breadcrumblinks[] = array('url' => $url, 'title' => $section['description']);
             } else {
                 $breadcrumblinks[] = array('url' => make_url($section['route']), 'title' => $section['description']);
             }
         }
     }
     $this->breadcrumblinks = $breadcrumblinks;
     $this->config_sections = $config_sections;
     if ($this->selected_section == framework\Settings::CONFIGURATION_SECTION_MODULES) {
         if (framework\Context::getRouting()->getCurrentRouteName() == 'configure_modules') {
             $this->selected_subsection = 'core';
         } else {
             $this->selected_subsection = framework\Context::getRequest()->getParameter('config_module');
         }
     }
 }
Пример #11
0
 public function setContentSyntax($syntax)
 {
     if (!is_numeric($syntax)) {
         $syntax = framework\Settings::getSyntaxValue($syntax);
     }
     $this->_content_syntax = $syntax;
 }
Пример #12
0
?>
openid_providers.small/openid.ico.png'); }
    #regular-signin-button.persona-button span:after{ background-image: url('<?php 
echo $webroot . 'iconsets/' . \thebuggenie\core\framework\Settings::getIconsetName() . '/';
?>
footer_logo.png'); }
    #forgot_password_username { background-image: url('<?php 
echo $webroot . 'iconsets/' . \thebuggenie\core\framework\Settings::getIconsetName() . '/';
?>
user_mono.png'); }
    #planning_filter_title_input { background-image: url('<?php 
echo $webroot . 'iconsets/' . \thebuggenie\core\framework\Settings::getIconsetName() . '/';
?>
icon-mono-search.png'); }
    .login_popup .article h1 { background: url('<?php 
echo $webroot . 'iconsets/' . \thebuggenie\core\framework\Settings::getIconsetName() . '/';
?>
logo_48.png') 0 0 no-repeat; }

    table.results_normal th.sort_asc { background-image: url('<?php 
echo $webroot;
?>
iconsets/oxygen/sort_down.png') !important; padding-left: 25px !important; }
    table.results_normal th.sort_desc { background-image: url('<?php 
echo $webroot;
?>
iconsets/oxygen/sort_up.png') !important; padding-left: 25px !important; }

    .module .rating { background-image:url('<?php 
echo $webroot;
?>
Пример #13
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' => ''));
Пример #14
0
<?php

\thebuggenie\core\framework\Context::loadLibrary('publish/publish');
?>
<div class="article syntax_<?php 
echo \thebuggenie\core\framework\Settings::getSyntaxClass($article->getContentSyntax());
?>
">
    <?php 
if ($show_title) {
    ?>
        <?php 
    include_component('publish/header', array('article_name' => $article->getName(), 'article' => $article, 'show_actions' => $show_actions, 'mode' => $mode, 'embedded' => $embedded));
    ?>
    <?php 
}
?>
    <?php 
if ($show_details && $show_article) {
    ?>
        <div class="details">
            <?php 
    if (isset($redirected_from)) {
        ?>
                <div class="redirected_from">&rarr; <?php 
        echo __('Redirected from %article_name', array('%article_name' => link_tag(make_url('publish_article_edit', array('article_name' => $redirected_from)), get_spaced_name($redirected_from))));
        ?>
</div>
            <?php 
    }
    ?>
Пример #15
0
 public function canUserSet(\thebuggenie\core\entities\User $user)
 {
     $retval = $user->hasPermission($this->getPermissionsKey(), $this->getID(), 'core');
     $retval = $retval === null ? $user->hasPermission($this->getPermissionsKey(), 0, 'core') : $retval;
     return $retval !== null ? $retval : \thebuggenie\core\framework\Settings::isPermissive();
 }
Пример #16
0
 /**
  * Handles an uploaded file, stores it to the correct folder, adds an entry
  * to the database and returns a \thebuggenie\core\entities\File object
  *
  * @param string $key The request parameter the file was sent as
  *
  * @return \thebuggenie\core\entities\File The File object
  */
 public function handleUpload($key)
 {
     $apc_exists = self::CanGetUploadStatus();
     if ($apc_exists && !array_key_exists($this->getParameter('APC_UPLOAD_PROGRESS'), $_SESSION['__upload_status'])) {
         $_SESSION['__upload_status'][$this->getParameter('APC_UPLOAD_PROGRESS')] = array('id' => $this->getParameter('APC_UPLOAD_PROGRESS'), 'finished' => false, 'percent' => 0, 'total' => 0, 'complete' => 0);
     }
     try {
         if ($this->getUploadedFile($key) !== null) {
             $thefile = $this->getUploadedFile($key);
             if (Settings::isUploadsEnabled()) {
                 Logging::log('Uploads enabled');
                 if ($thefile['error'] == UPLOAD_ERR_OK) {
                     Logging::log('No upload errors');
                     if (filesize($thefile['tmp_name']) > Settings::getUploadsEffectiveMaxSize(true)) {
                         throw new \Exception(Context::getI18n()->__('You cannot upload files bigger than %max_size MB', array('%max_size' => Settings::getUploadsEffectiveMaxSize())));
                     }
                     Logging::log('Upload filesize ok');
                     $extension = mb_substr(basename($thefile['name']), mb_strrpos(basename($thefile['name']), '.'));
                     if ($extension == '') {
                         Logging::log('OOps, could not determine upload filetype', 'main', Logging::LEVEL_WARNING_RISK);
                         //throw new \Exception(Context::getI18n()->__('Could not determine filetype'));
                     } else {
                         Logging::log('Checking uploaded file extension');
                         $extension = mb_substr($extension, 1);
                         $upload_extensions = Settings::getUploadsExtensionsList();
                         if (Settings::getUploadsRestrictionMode() == 'blacklist') {
                             Logging::log('... using blacklist');
                             foreach ($upload_extensions as $an_ext) {
                                 if (mb_strtolower(trim($extension)) == mb_strtolower(trim($an_ext))) {
                                     Logging::log('Upload extension not ok');
                                     throw new \Exception(Context::getI18n()->__('This filetype is not allowed'));
                                 }
                             }
                             Logging::log('Upload extension ok');
                         } else {
                             Logging::log('... using whitelist');
                             $is_ok = false;
                             foreach ($upload_extensions as $an_ext) {
                                 if (mb_strtolower(trim($extension)) == mb_strtolower(trim($an_ext))) {
                                     Logging::log('Upload extension ok');
                                     $is_ok = true;
                                     break;
                                 }
                             }
                             if (!$is_ok) {
                                 Logging::log('Upload extension not ok');
                                 throw new \Exception(Context::getI18n()->__('This filetype is not allowed'));
                             }
                         }
                         /*if (in_array(mb_strtolower(trim($extension)), array('php', 'asp')))
                           {
                               Logging::log('Upload extension is php or asp');
                               throw new \Exception(Context::getI18n()->__('This filetype is not allowed'));
                           }*/
                     }
                     if (is_uploaded_file($thefile['tmp_name'])) {
                         Logging::log('Uploaded file is uploaded');
                         $new_filename = Context::getUser()->getID() . '_' . NOW . '_' . basename($thefile['name']);
                         if (Settings::getUploadStorage() == 'files') {
                             $files_dir = Settings::getUploadsLocalpath();
                             $filename = $files_dir . $new_filename;
                         } else {
                             $filename = $thefile['tmp_name'];
                         }
                         Logging::log('Moving uploaded file to ' . $filename);
                         if (Settings::getUploadStorage() == 'files' && !move_uploaded_file($thefile['tmp_name'], $filename)) {
                             Logging::log('Moving uploaded file failed!');
                             throw new \Exception(Context::getI18n()->__('An error occured when saving the file'));
                         } else {
                             Logging::log('Upload complete and ok, storing upload status and returning filename ' . $new_filename);
                             $content_type = File::getMimeType($filename);
                             $file = new File();
                             $file->setRealFilename($new_filename);
                             $file->setOriginalFilename(basename($thefile['name']));
                             $file->setContentType($content_type);
                             $file->setDescription($this->getParameter($key . '_description'));
                             $file->setUploadedBy(Context::getUser());
                             if (Settings::getUploadStorage() == 'database') {
                                 $file->setContent(file_get_contents($filename));
                             }
                             $file->save();
                             if ($apc_exists) {
                                 $_SESSION['__upload_status'][$this->getParameter('APC_UPLOAD_PROGRESS')] = array('id' => $this->getParameter('APC_UPLOAD_PROGRESS'), 'finished' => true, 'percent' => 100, 'total' => 0, 'complete' => 0, 'file_id' => $file->getID());
                             }
                             return $file;
                         }
                     } else {
                         Logging::log('Uploaded file was not uploaded correctly');
                         throw new \Exception(Context::getI18n()->__('The file was not uploaded correctly'));
                     }
                 } else {
                     Logging::log('Upload error: ' . $thefile['error']);
                     switch ($thefile['error']) {
                         case UPLOAD_ERR_INI_SIZE:
                         case UPLOAD_ERR_FORM_SIZE:
                             throw new \Exception(Context::getI18n()->__('You cannot upload files bigger than %max_size MB', array('%max_size' => Settings::getUploadsEffectiveMaxSize())));
                         case UPLOAD_ERR_PARTIAL:
                             throw new \Exception(Context::getI18n()->__('The upload was interrupted, please try again'));
                         case UPLOAD_ERR_NO_FILE:
                             throw new \Exception(Context::getI18n()->__('No file was uploaded'));
                         default:
                             throw new \Exception(Context::getI18n()->__('An unhandled error occured') . ': ' . $thefile['error']);
                     }
                 }
             } else {
                 Logging::log('Uploads not enabled');
                 throw new \Exception(Context::getI18n()->__('Uploads are not enabled'));
             }
         }
         Logging::log('Could not find uploaded file' . $key);
         throw new \Exception(Context::getI18n()->__('Could not find the uploaded file. Please make sure that it is not too big.'));
     } catch (\Exception $e) {
         Logging::log('Upload exception: ' . $e->getMessage());
         if ($apc_exists) {
             $_SESSION['__upload_status'][$this->getParameter('APC_UPLOAD_PROGRESS')]['error'] = $e->getMessage();
             $_SESSION['__upload_status'][$this->getParameter('APC_UPLOAD_PROGRESS')]['finished'] = true;
             $_SESSION['__upload_status'][$this->getParameter('APC_UPLOAD_PROGRESS')]['percent'] = 100;
         }
         throw $e;
     }
 }
Пример #17
0
 public function processIncomingEmailAccount(IncomingEmailAccount $account)
 {
     $count = 0;
     if ($emails = $account->getUnprocessedEmails()) {
         try {
             $current_user = framework\Context::getUser();
             foreach ($emails as $email) {
                 $user = $this->getOrCreateUserFromEmailString($email->from);
                 if ($user instanceof User) {
                     if (framework\Context::getUser()->getID() != $user->getID()) {
                         framework\Context::switchUserContext($user);
                     }
                     $message = $account->getMessage($email);
                     $data = $message->getBodyPlain() ? $message->getBodyPlain() : strip_tags($message->getBodyHTML());
                     if ($data) {
                         if (mb_detect_encoding($data, 'UTF-8', true) === false) {
                             $data = utf8_encode($data);
                         }
                         $new_data = '';
                         foreach (explode("\n", $data) as $line) {
                             $line = trim($line);
                             if ($line) {
                                 $line = preg_replace('/^(_{2,}|-{2,})$/', "<hr>", $line);
                                 $new_data .= $line . "\n";
                             } else {
                                 $new_data .= "\n";
                             }
                         }
                         $data = nl2br($new_data, false);
                     }
                     // Parse the subject, and obtain the issues.
                     $parsed_commit = Issue::getIssuesFromTextByRegex(mb_decode_mimeheader($email->subject));
                     $issues = $parsed_commit["issues"];
                     // If any issues were found, add new comment to each issue.
                     if ($issues) {
                         foreach ($issues as $issue) {
                             $text = preg_replace('#(^\\w.+:\\n)?(^>.*(\\n|$))+#mi', "", $data);
                             $text = trim($text);
                             if (!$this->processIncomingEmailCommand($text, $issue) && $user->canPostComments()) {
                                 $comment = new Comment();
                                 $comment->setContent($text);
                                 $comment->setPostedBy($user);
                                 $comment->setTargetID($issue->getID());
                                 $comment->setTargetType(Comment::TYPE_ISSUE);
                                 $comment->save();
                             }
                         }
                     } else {
                         if ($user->canReportIssues($account->getProject())) {
                             $issue = new Issue();
                             $issue->setProject($account->getProject());
                             $issue->setTitle(mb_decode_mimeheader($email->subject));
                             $issue->setDescription($data);
                             $issue->setPostedBy($user);
                             $issue->setIssuetype($account->getIssuetype());
                             $issue->save();
                             // Append the new issue to the list of affected issues. This
                             // is necessary in order to process the attachments properly.
                             $issues[] = $issue;
                         }
                     }
                     // If there was at least a single affected issue, and mail
                     // contains attachments, add those attachments to related issues.
                     if ($issues && $message->hasAttachments()) {
                         foreach ($message->getAttachments() as $attachment_no => $attachment) {
                             echo 'saving attachment ' . $attachment_no;
                             $name = $attachment['filename'];
                             $new_filename = framework\Context::getUser()->getID() . '_' . NOW . '_' . basename($name);
                             if (framework\Settings::getUploadStorage() == 'files') {
                                 $files_dir = framework\Settings::getUploadsLocalpath();
                                 $filename = $files_dir . $new_filename;
                             } else {
                                 $filename = $name;
                             }
                             Logging::log('Creating issue attachment ' . $filename . ' from attachment ' . $attachment_no);
                             echo 'Creating issue attachment ' . $filename . ' from attachment ' . $attachment_no;
                             $content_type = $attachment['type'] . '/' . $attachment['subtype'];
                             $file = new File();
                             $file->setRealFilename($new_filename);
                             $file->setOriginalFilename(basename($name));
                             $file->setContentType($content_type);
                             $file->setDescription($name);
                             $file->setUploadedBy(framework\Context::getUser());
                             if (framework\Settings::getUploadStorage() == 'database') {
                                 $file->setContent($attachment['data']);
                             } else {
                                 Logging::log('Saving file ' . $new_filename . ' with content from attachment ' . $attachment_no);
                                 file_put_contents($new_filename, $attachment['data']);
                             }
                             $file->save();
                             // Attach file to each related issue.
                             foreach ($issues as $issue) {
                                 $issue->attachFile($file);
                             }
                         }
                     }
                     $count++;
                 }
             }
         } catch (\Exception $e) {
         }
         if (framework\Context::getUser()->getID() != $current_user->getID()) {
             framework\Context::switchUserContext($current_user);
         }
     }
     $account->setTimeLastFetched(time());
     $account->setNumberOfEmailsLastFetched($count);
     $account->save();
     return $count;
 }
Пример #18
0
 protected function _getOrGenerateRssKey()
 {
     static $key;
     $key = $key === null ? framework\Settings::getUserSetting($this->getID(), framework\Settings::USER_RSS_KEY) : $key;
     if ($key === null) {
         $key = $this->regenerateRssKey();
     }
     return $key;
 }
Пример #19
0
 public function isDefaultUserGroup()
 {
     return (bool) (\thebuggenie\core\framework\Settings::getDefaultUser()->getGroupID() == $this->getID());
 }
Пример #20
0
 public static function processCommit(\thebuggenie\core\entities\Project $project, $commit_msg, $old_rev, $new_rev, $date = null, $changed, $author, $branch = null, \Closure $callback = null)
 {
     $output = '';
     framework\Context::setCurrentProject($project);
     if ($project->isArchived()) {
         return;
     }
     if (Commits::getTable()->isProjectCommitProcessed($new_rev, $project->getID())) {
         return;
     }
     try {
         framework\Context::getI18n();
     } catch (\Exception $e) {
         framework\Context::reinitializeI18n(null);
     }
     // Is VCS Integration enabled?
     if (framework\Settings::get('vcs_mode_' . $project->getID(), 'vcs_integration') == self::MODE_DISABLED) {
         $output .= '[VCS ' . $project->getKey() . '] This project does not use VCS Integration' . "\n";
         return $output;
     }
     // Parse the commit message, and obtain the issues and transitions for issues.
     $parsed_commit = \thebuggenie\core\entities\Issue::getIssuesFromTextByRegex($commit_msg);
     $issues = $parsed_commit["issues"];
     $transitions = $parsed_commit["transitions"];
     // Build list of affected files
     $file_lines = preg_split('/[\\n\\r]+/', $changed);
     $files = array();
     foreach ($file_lines as $aline) {
         $action = mb_substr($aline, 0, 1);
         if ($action == "A" || $action == "U" || $action == "D" || $action == "M") {
             $theline = trim(mb_substr($aline, 1));
             $files[] = array($action, $theline);
         }
     }
     // Find author of commit, fallback is guest
     /*
      * Some VCSes use a different format of storing the committer's name. Systems like bzr, git and hg use the format
      * Joe Bloggs <*****@*****.**>, instead of a classic username. Therefore a user will be found via 4 queries:
      * a) First we extract the email if there is one, and find a user with that email
      * b) If one is not found - or if no email was specified, then instead test against the real name (using the name part if there was an email)
      * c) the username or full name is checked against the friendly name field
      * d) and if we still havent found one, then we check against the username
      * e) and if we STILL havent found one, we use the guest user
      */
     // a)
     $user = \thebuggenie\core\entities\tables\Users::getTable()->getByEmail($author);
     if (!$user instanceof \thebuggenie\core\entities\User && preg_match("/(?<=<)(.*)(?=>)/", $author, $matches)) {
         $email = $matches[0];
         // a2)
         $user = \thebuggenie\core\entities\tables\Users::getTable()->getByEmail($email);
         if (!$user instanceof \thebuggenie\core\entities\User) {
             // Not found by email
             preg_match("/(?<=^)(.*)(?= <)/", $author, $matches);
             $author = $matches[0];
         }
     }
     // b)
     if (!$user instanceof \thebuggenie\core\entities\User) {
         $user = \thebuggenie\core\entities\tables\Users::getTable()->getByRealname($author);
     }
     // c)
     if (!$user instanceof \thebuggenie\core\entities\User) {
         $user = \thebuggenie\core\entities\tables\Users::getTable()->getByBuddyname($author);
     }
     // d)
     if (!$user instanceof \thebuggenie\core\entities\User) {
         $user = \thebuggenie\core\entities\tables\Users::getTable()->getByUsername($author);
     }
     // e)
     if (!$user instanceof \thebuggenie\core\entities\User) {
         $user = framework\Settings::getDefaultUser();
     }
     framework\Context::setUser($user);
     framework\Settings::forceSettingsReload();
     framework\Context::cacheAllPermissions();
     $output .= '[VCS ' . $project->getKey() . '] Commit to be logged by user ' . $user->getName() . "\n";
     if ($date == null) {
         $date = NOW;
     }
     // Create the commit data
     $commit = new Commit();
     $commit->setAuthor($user);
     $commit->setDate($date);
     $commit->setLog($commit_msg);
     $commit->setPreviousRevision($old_rev);
     $commit->setRevision($new_rev);
     $commit->setProject($project);
     if ($branch !== null) {
         $data = 'branch:' . $branch;
         $commit->setMiscData($data);
     }
     if ($callback !== null) {
         $commit = $callback($commit);
     }
     $commit->save();
     $output .= '[VCS ' . $project->getKey() . '] Commit logged with revision ' . $commit->getRevision() . "\n";
     // Iterate over affected issues and update them.
     foreach ($issues as $issue) {
         $inst = new IssueLink();
         $inst->setIssue($issue);
         $inst->setCommit($commit);
         $inst->save();
         // Process all commit-message transitions for an issue.
         foreach ($transitions[$issue->getFormattedIssueNo()] as $transition) {
             if (framework\Settings::get('vcs_workflow_' . $project->getID(), 'vcs_integration') == self::WORKFLOW_ENABLED) {
                 framework\Context::setUser($user);
                 framework\Settings::forceSettingsReload();
                 framework\Context::cacheAllPermissions();
                 if ($issue->isWorkflowTransitionsAvailable()) {
                     // Go through the list of possible transitions for an issue. Only
                     // process transitions that are applicable to issue's workflow.
                     foreach ($issue->getAvailableWorkflowTransitions() as $possible_transition) {
                         if (mb_strtolower($possible_transition->getName()) == mb_strtolower($transition[0])) {
                             $output .= '[VCS ' . $project->getKey() . '] Running transition ' . $transition[0] . ' on issue ' . $issue->getFormattedIssueNo() . "\n";
                             // String representation of parameters. Used for log message.
                             $parameters_string = "";
                             // Iterate over the list of this transition's parameters, and
                             // set them.
                             foreach ($transition[1] as $parameter => $value) {
                                 $parameters_string .= "{$parameter}={$value} ";
                                 switch ($parameter) {
                                     case 'resolution':
                                         if (($resolution = \thebuggenie\core\entities\Resolution::getByKeyish($value)) instanceof \thebuggenie\core\entities\Resolution) {
                                             framework\Context::getRequest()->setParameter('resolution_id', $resolution->getID());
                                         }
                                         break;
                                     case 'status':
                                         if (($status = \thebuggenie\core\entities\Status::getByKeyish($value)) instanceof \thebuggenie\core\entities\Status) {
                                             framework\Context::getRequest()->setParameter('status_id', $status->getID());
                                         }
                                         break;
                                 }
                             }
                             // Run the transition.
                             $possible_transition->transitionIssueToOutgoingStepWithoutRequest($issue);
                             // Log an informative message about the transition.
                             $output .= '[VCS ' . $project->getKey() . '] Ran transition ' . $possible_transition->getName() . ' with parameters \'' . $parameters_string . '\' on issue ' . $issue->getFormattedIssueNo() . "\n";
                         }
                     }
                 }
             }
         }
         $issue->addSystemComment(framework\Context::getI18n()->__('This issue has been updated with the latest changes from the code repository.<source>%commit_msg</source>', array('%commit_msg' => $commit_msg)), $user->getID());
         $output .= '[VCS ' . $project->getKey() . '] Updated issue ' . $issue->getFormattedIssueNo() . "\n";
     }
     // Create file links
     foreach ($files as $afile) {
         // index 0 is action, index 1 is file
         $inst = new File();
         $inst->setAction($afile[0]);
         $inst->setFile($afile[1]);
         $inst->setCommit($commit);
         $inst->save();
         $output .= '[VCS ' . $project->getKey() . '] Added with action ' . $afile[0] . ' file ' . $afile[1] . "\n";
     }
     framework\Event::createNew('vcs_integration', 'new_commit')->trigger(array('commit' => $commit));
     return $output;
 }
Пример #21
0
                ?>
');"><?php 
                echo fa_image_tag('link') . __('Attach a link');
                ?>
</a></li>
                <?php 
            }
            ?>
            <?php 
        }
        ?>
            <?php 
        if ($issue->isUpdateable() && \thebuggenie\core\framework\Settings::isUploadsEnabled() && $issue->canAttachFiles()) {
            ?>
                <?php 
            if (\thebuggenie\core\framework\Settings::isUploadsEnabled() && $issue->canAttachFiles()) {
                ?>
                    <li><a href="javascript:void(0);" id="attach_file_button" onclick="TBG.Main.Profile.clearPopupsAndButtons();TBG.Main.showUploader('<?php 
                echo make_url('get_partial_for_backdrop', array('key' => 'uploader', 'mode' => 'issue', 'issue_id' => $issue->getID()));
                ?>
');"><?php 
                echo fa_image_tag('paperclip') . __('Attach a file');
                ?>
</a></li>
                <?php 
            } else {
                ?>
                    <li class="disabled"><a href="javascript:void(0);" id="attach_file_button" onclick="TBG.Main.Helpers.Message.error('<?php 
                echo __('File uploads are not enabled');
                ?>
', '<?php 
Пример #22
0
            </li>
        <?php 
}
?>
        <li><a href="javascript:void(0);" onclick="TBG.Main.Helpers.Backdrop.show('<?php 
echo make_url('get_partial_for_backdrop', array('key' => 'usercard', 'user_id' => $user->getID()));
?>
');$('bud_<?php 
echo $user->getUsername() . "_12";
?>
').hide();"><?php 
echo __('Show user details');
?>
</a></li>
        <?php 
if (!in_array($user->getID(), array(1, (int) \thebuggenie\core\framework\Settings::get(\thebuggenie\core\framework\Settings::SETTING_DEFAULT_USER_ID)))) {
    ?>
            <?php 
    if (\thebuggenie\core\framework\Context::getScope()->isDefault()) {
        ?>
                <li><?php 
        echo javascript_link_tag(__('Delete this user'), array('onclick' => "TBG.Main.Helpers.Dialog.show('" . __e('Permanently delete this user?') . "', '" . __e('Are you sure you want to remove this user? This will remove the users login data, as well as memberships in (and data in) any scopes the user is a member of.') . "', {yes: {click: function() {TBG.Config.User.remove('" . make_url('configure_users_delete_user', array('user_id' => $user->getID())) . "', " . $user->getID() . "); TBG.Main.Helpers.Dialog.dismiss(); } }, no: {click: TBG.Main.Helpers.Dialog.dismiss}});"));
        ?>
</li>
            <?php 
    } elseif ($user->isScopeConfirmed()) {
        ?>
                <li><?php 
        echo javascript_link_tag(__('Remove user from this scope'), array('onclick' => "TBG.Main.Helpers.Dialog.show('" . __e('Remove this user?') . "', '" . __e('Are you sure you want to remove this user from the current scope? The users login is kept, and you can re-add the user later.') . "', {yes: {click: function() {TBG.Config.User.remove('" . make_url('configure_users_delete_user', array('user_id' => $user->getID())) . "', " . $user->getID() . "); TBG.Main.Helpers.Dialog.dismiss(); } }, no: {click: TBG.Main.Helpers.Dialog.dismiss}});"));
        ?>
</li>
Пример #23
0
<?php

$tbg_response->setTitle(__('Dashboard'));
$tbg_response->addBreadcrumb(__('Personal dashboard'), make_url('dashboard'), tbg_get_breadcrumblinks('main_links'));
$tbg_response->addFeed(make_url('my_reported_issues', array('format' => 'rss')), __('Issues reported by me'));
$tbg_response->addFeed(make_url('my_assigned_issues', array('format' => 'rss')), __('Open issues assigned to you'));
$tbg_response->addFeed(make_url('my_teams_assigned_issues', array('format' => 'rss')), __('Open issues assigned to your teams'));
include_component('main/hideableInfoBoxModal', array('key' => 'dashboard_didyouknow', 'title' => __('Get started using The Bug Genie'), 'template' => 'main/profile_dashboard'));
?>
<table style="margin: 0 0 20px 0; table-layout: fixed; width: 100%; height: 100%;" cellpadding=0 cellspacing=0>
    <tr>
        <td id="dashboard_lefthand" class="side_bar<?php 
echo \thebuggenie\core\framework\Settings::getToggle('dashboard_lefthand') ? ' collapsed' : '';
?>
">
            <?php 
\thebuggenie\core\framework\Event::createNew('core', 'dashboard_left_top')->trigger();
?>
            <div class="collapser_link" onclick="TBG.Main.Dashboard.sidebar('<?php 
echo make_url('set_toggle_state', array('key' => 'dashboard_lefthand', 'state' => ''));
?>
', 'dashboard_lefthand');">
                <a href="javascript:void(0);">
                    <?php 
echo image_tag('sidebar_collapse.png', array('class' => 'collapser'));
?>
                    <?php 
echo image_tag('sidebar_expand.png', array('class' => 'expander'));
?>
                </a>
            </div>
Пример #24
0
            <url><?php 
    echo \thebuggenie\core\framework\Context::getUrlHost() . \thebuggenie\core\framework\Context::getWebroot() . 'header.png';
    ?>
</url>
        <?php 
} else {
    ?>
            <url><?php 
    echo image_url('logo_24.png', false, null, false);
    ?>
</url>
        <?php 
}
?>
            <title><?php 
echo \thebuggenie\core\framework\Settings::getSiteHeaderName() . ' ~ ' . $searchtitle;
?>
</title>
            <link><?php 
echo make_url('home', array(), false);
?>
</link>
        </image>
<?php 
if ($issues != false) {
    foreach ($issues as $issue) {
        ?>
        
        <item>
            <title><?php 
        echo $issue->getFormattedIssueNo(true) . ' - ' . strip_tags($issue->getTitle());
    ?>
                        <?php 
    echo javascript_link_tag(image_tag('tabmenu_dropdown.png', array('class' => 'menu_dropdown')));
    ?>
                    </div>
                    <div id="project_information_menu" class="tab_menu_dropdown">
                        <?php 
    include_component('project/projectinfolinks', array('submenu' => true));
    ?>
                    </div>
                </li>
            <?php 
}
?>
        <?php 
if (!$tbg_user->isThisGuest() && !framework\Settings::isSingleProjectTracker() && !framework\Context::isProjectContext()) {
    ?>
                <li<?php 
    if ($tbg_response->getPage() == 'dashboard') {
        ?>
 class="selected"<?php 
    }
    ?>
>
                    <div class="menuitem_container">
                        <?php 
    echo link_tag('javascript:void(0);', image_tag('icon_dashboard_small.png') . __('Dashboard'));
    ?>
                        <?php 
    echo javascript_link_tag(image_tag('tabmenu_dropdown.png', array('class' => 'menu_dropdown')));
    ?>
    ?>
                                </div>
                            </div>
                            <?php 
    if ($issue->isEditable() && $issue->canEditReproductionSteps()) {
        ?>
                                <div id="reproduction_steps_change" style="display: none;" class="editor_container">
                                    <form id="reproduction_steps_form" action="<?php 
        echo make_url('issue_setfield', array('project_key' => $issue->getProject()->getKey(), 'issue_id' => $issue->getID(), 'field' => 'reproduction_steps'));
        ?>
" method="post" onSubmit="TBG.Issues.Field.set('<?php 
        echo make_url('issue_setfield', array('project_key' => $issue->getProject()->getKey(), 'issue_id' => $issue->getID(), 'field' => 'reproduction_steps'));
        ?>
', 'reproduction_steps'); return false;">
                                        <?php 
        include_component('main/textarea', array('area_name' => 'value', 'target_type' => 'issue', 'target_id' => $issue->getID(), 'area_id' => 'reproduction_steps_form_value', 'syntax' => \thebuggenie\core\framework\Settings::getSyntaxClass($issue->getReproductionStepsSyntax()), 'height' => '250px', 'width' => '100%', 'value' => htmlentities($issue->getReproductionSteps(), ENT_COMPAT, \thebuggenie\core\framework\Context::getI18n()->getCharset())));
        ?>
                                        <div class="textarea_save_container">
                                            <?php 
        echo __('%cancel or %save', array('%save' => '<input class="button button-silver" type="submit" value="' . __('Save') . '">', '%cancel' => javascript_link_tag(__('Cancel'), array('onclick' => "\$('reproduction_steps_change').hide();" . ($issue->getReproductionSteps() != '' ? "\$('reproduction_steps_name').show();" : "\$('no_reproduction_steps').show();") . "return false;"))));
        ?>
                                        </div>
                                    </form>
                                    <?php 
        echo image_tag('spinning_16.gif', array('style' => 'display: none; float: left; margin-right: 5px;', 'id' => 'reproduction_steps_spinning'));
        ?>
                                    <div id="reproduction_steps_change_error" class="error_message" style="display: none;"></div>
                                </div>
                            <?php 
    }
    ?>
Пример #27
0
 public function runUpgrade(framework\Request $request)
 {
     $version_info = explode(',', file_get_contents(THEBUGGENIE_PATH . 'installed'));
     $this->current_version = $version_info[0];
     $this->upgrade_available = $this->current_version != framework\Settings::getVersion(false);
     if ($this->upgrade_available) {
         $scope = new \thebuggenie\core\entities\Scope();
         $scope->setID(1);
         $scope->setEnabled();
         framework\Context::setScope($scope);
         if ($this->current_version == '3.2') {
             $this->statuses = \thebuggenie\core\entities\tables\ListTypes::getTable()->getStatusListForUpgrade();
             $this->adminusername = \thebuggenie\core\modules\installation\upgrade_32\TBGUsersTable::getTable()->getAdminUsername();
         }
     }
     $this->upgrade_complete = false;
     if ($this->upgrade_available && $request->isPost()) {
         $this->upgrade_complete = false;
         switch ($this->current_version) {
             case '3.2':
                 $this->_upgradeFrom3dot2($request);
                 break;
             default:
                 $this->upgrade_complete = true;
         }
         if ($this->upgrade_complete) {
             $existing_installed_content = file_get_contents(THEBUGGENIE_PATH . 'installed');
             file_put_contents(THEBUGGENIE_PATH . 'installed', framework\Settings::getVersion(false, false) . ', upgraded ' . date('d.m.Y H:i') . "\n" . $existing_installed_content);
             $this->current_version = framework\Settings::getVersion(false, false);
             $this->upgrade_available = false;
         }
     } elseif ($this->upgrade_available) {
         $this->permissions_ok = false;
         if (is_writable(THEBUGGENIE_PATH . 'installed') && is_writable(THEBUGGENIE_PATH . 'upgrade')) {
             $this->permissions_ok = true;
         }
     } elseif ($this->upgrade_complete) {
         $this->forward(framework\Context::getRouting()->generate('home'));
     }
 }
Пример #28
0
 protected function _geshify($matches)
 {
     if (!(is_array($matches) && count($matches) > 1)) {
         return '';
     }
     $codeblock = $matches[2];
     if (strlen(trim($codeblock))) {
         $params = $matches[1];
         $language = preg_match('/(?<=lang=")(.+?)(?=")/', $params, $matches);
         if ($language !== 0) {
             $language = $matches[0];
         } else {
             $language = \thebuggenie\core\framework\Settings::get('highlight_default_lang');
         }
         $numbering_startfrom = preg_match('/(?<=line start=")(.+?)(?=")/', $params, $matches);
         if ($numbering_startfrom !== 0) {
             $numbering_startfrom = (int) $matches[0];
         } else {
             $numbering_startfrom = 1;
         }
         $geshi = new \GeSHi($codeblock, $language);
         $highlighting = preg_match('/(?<=line=")(.+?)(?=")/', $params, $matches);
         if ($highlighting !== 0) {
             $highlighting = $matches[0];
         } else {
             $highlighting = false;
         }
         $interval = preg_match('/(?<=highlight=")(.+?)(?=")/', $params, $matches);
         if ($interval !== 0) {
             $interval = $matches[0];
         } else {
             $interval = \thebuggenie\core\framework\Settings::get('highlight_default_interval');
         }
         if ($highlighting === false) {
             switch (\thebuggenie\core\framework\Settings::get('highlight_default_numbering')) {
                 case 1:
                     // Line numbering with a highloght every n rows
                     $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, $interval);
                     $geshi->start_line_numbers_at($numbering_startfrom);
                     break;
                 case 2:
                     // Normal line numbering
                     $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS, 10);
                     $geshi->start_line_numbers_at($numbering_startfrom);
                     break;
                 case 3:
                     break;
                     // No numbering
             }
         } else {
             switch ($highlighting) {
                 case 'highlighted':
                 case 'GESHI_FANCY_LINE_NUMBERS':
                     // Line numbering with a highloght every n rows
                     $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, $interval);
                     $geshi->start_line_numbers_at($numbering_startfrom);
                     break;
                 case 'normal':
                 case 'GESHI_NORMAL_LINE_NUMBERS':
                     // Normal line numbering
                     $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS, 10);
                     $geshi->start_line_numbers_at($numbering_startfrom);
                     break;
                 case 3:
                     break;
                     // No numbering
             }
         }
         $codeblock = $geshi->parse_code();
         unset($geshi);
     }
     return '<code>' . $codeblock . '</code>';
 }
Пример #29
0
 protected function _initializeColumns()
 {
     if (!is_array($this->_columns)) {
         if (!strlen($this->_columns)) {
             if ($columns = \thebuggenie\core\framework\Settings::get('search_scs_' . $this->getTemplateName())) {
                 $this->_columns = explode(',', $columns);
             } else {
                 $this->_columns = self::getDefaultVisibleColumns();
             }
         } else {
             $this->_columns = explode(',', $this->_columns);
         }
     }
 }
Пример #30
0
        <script type="text/javascript" src="<?php 
echo make_url('home');
?>
js/HackTimer.min.js"></script>
        <script type="text/javascript" src="<?php 
echo make_url('home');
?>
js/HackTimer.silent.min.js"></script>
        <script type="text/javascript" src="<?php 
echo make_url('home');
?>
js/HackTimerWorker.min.js"></script>
        <script>
            var bust = function (path) {
                return path + '?bust=' + <?php 
echo \thebuggenie\core\framework\Context::isDebugMode() ? ' Math.random()' : "'" . \thebuggenie\core\framework\Settings::getVersion() . "'";
?>
;
            };

            var require = {
                baseUrl: '<?php 
echo make_url('home');
?>
js',
                paths: {
                    jquery: 'jquery-2.1.3.min',
                    'jquery-ui': 'jquery-ui.min',
                    'thebuggenie': bust('thebuggenie.js'),
                    'thebuggenie/tbg': bust('thebuggenie/tbg.js'),
                    'thebuggenie/tools': bust('thebuggenie/tools.js'),