Пример #1
0
 public function quickfind($client_name)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::NAME, "%{$client_name}%", Criteria::DB_LIKE);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     return $this->select($crit);
 }
Пример #2
0
 public function getByID($id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $row = $this->doSelectById($id, $crit, false);
     return $row;
 }
Пример #3
0
 public function getAll()
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addOrderBy(self::ID, Criteria::SORT_ASC);
     return $this->select($crit);
 }
Пример #4
0
 public function do_execute()
 {
     $this->cliEcho("Importing articles ... \n", 'white', 'bold');
     \thebuggenie\core\framework\Event::listen('publish', 'fixture_article_loaded', array($this, 'listenPublishFixtureArticleCreated'));
     $overwrite = (bool) ($this->getProvidedArgument('overwrite', 'no') == 'yes');
     \thebuggenie\core\framework\Context::getModule('publish')->loadFixturesArticles(\thebuggenie\core\framework\Context::getScope()->getID(), $overwrite);
 }
Пример #5
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());
 }
Пример #6
0
 public function do_execute()
 {
     $this->cliEcho('Authenticating with server: ');
     $this->cliEcho($this->getProvidedArgument('server_url'), 'white', 'bold');
     $this->cliEcho("\n");
     $path = THEBUGGENIE_CONFIG_PATH;
     try {
         file_put_contents($path . '.remote_server', $this->getProvidedArgument('server_url'));
     } catch (\Exception $e) {
         $path = getenv('HOME') . DS;
         file_put_contents($path . '.remote_server', $this->getProvidedArgument('server_url'));
     }
     $this->cliEcho('Authenticating as user: '******'username', \thebuggenie\core\framework\Context::getCurrentCLIusername());
     $this->cliEcho($username, 'white', 'bold');
     $this->cliEcho("\n");
     file_put_contents($path . '.remote_username', $username);
     $this->_current_remote_server = file_get_contents($path . '.remote_server');
     $this->cliEcho("\n");
     $this->cliEcho('You need to authenticate using an application-specific password.');
     $this->cliEcho("\n");
     $this->cliEcho("Create an application password from your account's 'Security' tab.");
     $this->cliEcho("\n");
     $this->cliEcho("Enter the application-specific password: "******"Authentication successful!\n", 'white', 'bold');
 }
Пример #7
0
 public function countWorkflows($scope = null)
 {
     $scope = $scope === null ? framework\Context::getScope()->getID() : $scope;
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, $scope);
     return $this->doCount($crit);
 }
Пример #8
0
 public function markUserNotificationsReadByTypesAndId($types, $id, $user_id)
 {
     if (!is_array($types)) {
         $types = array($types);
     }
     $crit = $this->getCriteria();
     $crit->addWhere(self::USER_ID, $user_id);
     if (count($types)) {
         if (is_array($id)) {
             $crit->addWhere(self::TARGET_ID, $id, Criteria::DB_IN);
         } else {
             $crit->addWhere(self::TARGET_ID, $id);
         }
         $crit->addWhere(self::NOTIFICATION_TYPE, $types, Criteria::DB_IN);
     }
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addUpdate(self::IS_READ, true);
     $this->doUpdate($crit);
     $crit = $this->getCriteria();
     $crit->addWhere(self::USER_ID, $user_id);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::IS_READ, true);
     $crit->addWhere('notifications.created_at', NOW - 86400 * 30, Criteria::DB_LESS_THAN_EQUAL);
     $this->doDelete($crit);
 }
Пример #9
0
 public function deleteProcessedMessages($ids)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::ID, (array) $ids, Criteria::DB_IN);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $res = $this->doDelete($crit);
 }
Пример #10
0
 public function getAbbreviation()
 {
     if ($this->_abbreviation === null) {
         $this->_abbreviation = mb_substr(framework\Context::getI18n()->__($this->getName()), 0, 1);
     }
     return $this->_abbreviation;
 }
Пример #11
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);
 }
Пример #12
0
 public function countTeams()
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::ONDEMAND, false);
     return $this->doCount($crit);
 }
Пример #13
0
 public function doesGroupNameExist($group_name)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::NAME, $group_name);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     return (bool) $this->doCount($crit);
 }
 public function getByTransitionID($transition_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::TRANSITION_ID, $transition_id);
     return $this->select($crit);
 }
Пример #15
0
 public function deleteBySearchID($saved_search_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::SEARCH_ID, $saved_search_id);
     $this->doDelete($crit);
 }
Пример #16
0
 public function addStarredIssue($user_id, $issue_id)
 {
     $crit = $this->getCriteria();
     $crit->addInsert(self::ISSUE, $issue_id);
     $crit->addInsert(self::UID, $user_id);
     $crit->addInsert(self::SCOPE, framework\Context::getScope()->getID());
     $this->doInsert($crit);
 }
Пример #17
0
 public function removeEditionComponent($edition_id, $component_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::EDITION, $edition_id);
     $crit->addWhere(self::COMPONENT, $component_id);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $res = $this->doDelete($crit);
 }
Пример #18
0
 public function getTextColor()
 {
     if (!\thebuggenie\core\framework\Context::isCLI()) {
         \thebuggenie\core\framework\Context::loadLibrary('ui');
     }
     $rgb = hex2rgb($this->_itemdata);
     return 0.299 * $rgb['red'] + 0.587 * $rgb['green'] + 0.114 * $rgb['blue'] > 170 ? '#333' : '#FFF';
 }
Пример #19
0
 public function addStarredArticle($user_id, $article_id)
 {
     $crit = $this->getCriteria();
     $crit->addInsert(self::ARTICLE, $article_id);
     $crit->addInsert(self::UID, $user_id);
     $crit->addInsert(self::SCOPE, framework\Context::getScope()->getID());
     $this->doInsert($crit);
 }
Пример #20
0
 /**
  * Get all rows by issue ID
  * @param integer $id
  * @return \b2db\Row
  */
 public function getByIssueID($id, $scope = null)
 {
     $scope = $scope === null ? \thebuggenie\core\framework\Context::getScope()->getID() : $scope;
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, $scope);
     $crit->addWhere(self::ISSUE_NO, $id);
     return $this->select($crit);
 }
Пример #21
0
 public function deleteByIssuetypeID($issuetype_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::ISSUETYPE_ID, $issuetype_id);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $this->doDelete($crit);
     return true;
 }
Пример #22
0
 public function removeFriendByUserID($user_id, $friend_id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::UID, $user_id);
     $crit->addWhere(self::BID, $friend_id);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $this->doDelete($crit);
 }
Пример #23
0
 protected function _uninstall()
 {
     if (framework\Context::getScope()->isDefault()) {
         $filename = THEBUGGENIE_PATH . THEBUGGENIE_PUBLIC_FOLDER_NAME . DS . 'css' . DS . 'mobile.css';
         if (file_exists($filename)) {
             unlink($filename);
         }
     }
 }
Пример #24
0
 public function addByProjectIDAndMilestoneID($project_id, $milestone_id)
 {
     $crit = $this->getCriteria();
     $crit->addInsert(self::PROJECT_ID, $project_id);
     $crit->addInsert(self::MILESTONE_ID, $milestone_id);
     $crit->addInsert(self::SCOPE, framework\Context::getScope()->getID());
     $res = $this->doInsert($crit);
     return true;
 }
Пример #25
0
 public function selectAll()
 {
     $crit = $this->getCriteria();
     $crit->addJoin(Projects::getTable(), Projects::ID, self::PROJECT);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addOrderBy(Projects::NAME, Criteria::SORT_ASC);
     $crit->addOrderBy(self::NAME, Criteria::SORT_ASC);
     return $this->select($crit);
 }
Пример #26
0
 public function getSubCategories($category_name)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::CATEGORY_NAME, $category_name);
     $crit->addWhere(self::ARTICLE_IS_CATEGORY, true);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addOrderBy(self::CATEGORY_NAME, Criteria::SORT_ASC);
     $res = $this->doSelect($crit);
     return $res;
 }
Пример #27
0
 public function getByIDs($ids)
 {
     if (empty($ids)) {
         return array();
     }
     $crit = $this->getCriteria();
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::ID, $ids, Criteria::DB_IN);
     return $this->select($crit);
 }
Пример #28
0
 public function saveOptionOrder($options, $customfield_id)
 {
     foreach ($options as $key => $option_id) {
         $crit = $this->getCriteria();
         $crit->addUpdate(self::SORT_ORDER, $key + 1);
         $crit->addWhere(self::CUSTOMFIELD_ID, $customfield_id);
         $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
         $this->doUpdateById($crit, $option_id);
     }
 }
Пример #29
0
 public function getKeyFromID($id)
 {
     $crit = $this->getCriteria();
     $crit->addWhere(self::ID, $id);
     $crit->addWhere(self::SCOPE, framework\Context::getScope()->getID());
     $row = $this->doSelectOne($crit);
     if ($row instanceof \b2db\Row) {
         return $row->get(self::FIELD_KEY);
     }
     return null;
 }
Пример #30
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()));
 }