/** * Get the tracker name * * @return string */ function getTrackerName() { $group = ProjectManager::instance()->getProject($this->getGroupId()); $at = new ArtifactType($group, $this->getGroupArtifactId()); return $at->getName(); }
/** * @return Tracker (only the structure) */ public function createTV5FromTV3(Project $project, $name, $description, $itemname, ArtifactType $tv3) { $dao = new Tracker_Migration_V3_Dao(); $logger = new BackendLogger(ForgeConfig::get('codendi_log') . '/' . Tracker_Migration_MigrationManager::LOG_FILE); $log_prefix = '[' . uniqid() . ']'; $logger->info("{$log_prefix} Start migration of tracker v3: " . $tv3->getID()); // 010 & 020 if ($id = $dao->create($project->getId(), $name, $description, $itemname, $tv3->getID())) { $logger->info("{$log_prefix} Tracker v5: " . $id); $logger->info("{$log_prefix} 030 Fieldset"); $fieldset_dao = new Tracker_Migration_V3_FieldsetsDao(); $fieldset_dao->create($tv3->getID(), $id); $logger->info("{$log_prefix} 040 Fields"); $field_dao = new Tracker_Migration_V3_FieldsDao(); $field_dao->create($tv3->getID(), $id); $logger->info("{$log_prefix} 045 & 046 Fields Default Values"); $fields_default_values_dao = new Tracker_Migration_V3_FieldsDefaultValuesDao(); $fields_default_values_dao->create($tv3->getID(), $id); $logger->info("{$log_prefix} 050 Reports"); $reports_dao = new Tracker_Migration_V3_ReportsDao(); $reports_dao->create($tv3->getID(), $id, $project->getId()); $logger->info("{$log_prefix} 060 RenderersTable"); $renderers_table_dao = new Tracker_Migration_V3_RenderersTableDao(); $renderers_table_dao->create($tv3->getID(), $id); $logger->info("{$log_prefix} 070 RenderersGraph"); $renderers_graph_dao = new Tracker_Migration_V3_RenderersGraphDao(); $renderers_graph_dao->create($tv3->getID(), $id); $logger->info("{$log_prefix} 075 PermissionsOnArtifactField"); $perms_on_artifact_dao = new Tracker_Migration_V3_PermissionsOnArtifactFieldDao(); $perms_on_artifact_dao->addPermissionsOnArtifactField($id); $logger->info("{$log_prefix} 080 AttachmentField"); $attachment_field_dao = new Tracker_Migration_V3_AttachmentFieldDao(); $attachment_field_dao->addAttachmentField($id); $logger->info("{$log_prefix} 085 ReferenceField"); $reference_dao = new Tracker_Migration_V3_ReferenceFieldDao(); $reference_dao->addReferenceField($id); $logger->info("{$log_prefix} 090 CCField"); $cc_dao = new Tracker_Migration_V3_CcFieldDao(); $cc_dao->addCCField($id); $logger->info("{$log_prefix} 220 Semantic"); $semantic_dao = new Tracker_Migration_V3_SemanticDao(); $semantic_dao->create($id); $logger->info("{$log_prefix} 250 Canned"); $canned_dao = new Tracker_Migration_V3_CannedDao(); $canned_dao->create($tv3->getID(), $id); $logger->info("{$log_prefix} 260 Fieldset stored as field"); $fieldset_dao->nowFieldsetsAreStoredAsField($id); $logger->info("{$log_prefix} 270 & 280 columns"); $columns_dao = new Tracker_Migration_V3_ColumnsDao(); $columns_dao->create($id); // 300 // useless because transitions already have default permissions $logger->info("{$log_prefix} 310 FieldPerms"); $field_perms_dao = new Tracker_Migration_V3_FieldPermsDao(); $field_perms_dao->create($tv3->getID(), $id); $logger->info("{$log_prefix} 320 FieldDependencies"); $field_dependencies_dao = new Tracker_Migration_V3_FieldDependenciesDao(); $field_dependencies_dao->addDependencies($tv3->getID(), $id); $logger->info("{$log_prefix} date reminders"); $reminder_dao = new Tracker_Migration_V3_RemindersDao(); $reminder_dao->create($tv3->getID(), $id); $logger->info("{$log_prefix} Complete"); return $this->tracker_factory->getTrackerById($id); } }
// require_once 'pre.php'; require_once 'common/tracker/ArtifactType.class.php'; require_once 'common/tracker/Artifact.class.php'; require_once 'common/tracker/ArtifactFieldFactory.class.php'; $id = $request->get('id'); $artifact_id = $request->get('artifact_id'); // We have the artifact id, but not the tracker id $sql = "SELECT group_artifact_id, group_id FROM artifact INNER JOIN artifact_group_list USING (group_artifact_id) WHERE artifact_id= " . db_ei($artifact_id); $result = db_query($sql); if (db_numrows($result) > 0) { $row = db_fetch_array($result); $atid = $row['group_artifact_id']; $pm = ProjectManager::instance(); $group = $pm->getProject($row['group_id']); $at = new ArtifactType($group, $atid); if ($at->userCanView()) { $art_field_fact = new ArtifactFieldFactory($at); // Grrr! don't use global >_< $a = new Artifact($at, $artifact_id); if ($a->userCanView()) { $sql = "SELECT description,bin_data,filename,filesize,filetype FROM artifact_file WHERE id='" . db_ei($id) . "' AND artifact_id ='" . db_ei($artifact_id) . "'"; //echo $sql; $result = db_query($sql); if ($result && db_numrows($result) > 0) { if (db_result($result, 0, 'filesize') == 0) { exit_error($Language->getText('global', 'error'), $Language->getText('tracker_download', 'file_is_null')); } else { // Download the patch with the correct filetype require_once 'common/include/Codendi_HTTPPurifier.class.php'; $http = Codendi_HTTPPurifier::instance();
/** * create_project * * Create a new project * * @param data */ function create_project($data, $do_not_exit = false) { srand((double) microtime() * 1000000); $random_num = rand(0, 1000000); // Make sure default project privacy status is defined. If not // then default to "public" if (!isset($GLOBALS['sys_is_project_public'])) { $GLOBALS['sys_is_project_public'] = 1; } if (isset($GLOBALS['sys_disable_subdomains']) && $GLOBALS['sys_disable_subdomains']) { $http_domain = $GLOBALS['sys_default_domain']; } else { $http_domain = $data['project']['form_unix_name'] . '.' . $GLOBALS['sys_default_domain']; } //Verify if the approbation of the new project is automatic or not $auto_approval = ForgeConfig::get('sys_project_approval', 1) ? PROJECT_APPROVAL_BY_ADMIN : PROJECT_APPROVAL_AUTO; if (isset($data['project']['is_public'])) { $access = $data['project']['is_public'] ? Project::ACCESS_PUBLIC : Project::ACCESS_PRIVATE; } else { $access = ForgeConfig::get('sys_is_project_public') ? Project::ACCESS_PUBLIC : Project::ACCESS_PRIVATE; } // make group entry $insert_data = array('group_name' => "'" . htmlspecialchars(mysql_real_escape_string($data['project']['form_full_name'])) . "'", 'access' => "'" . $access . "'", 'unix_group_name' => "'" . db_es($data['project']['form_unix_name']) . "'", 'http_domain' => "'" . db_es($http_domain) . "'", 'status' => "'P'", 'unix_box' => "'shell1'", 'cvs_box' => "'cvs1'", 'license' => "'" . htmlspecialchars(mysql_real_escape_string($data['project']['form_license'])) . "'", 'license_other' => "'" . htmlspecialchars(mysql_real_escape_string($data['project']['form_license_other'])) . "'", 'short_description' => "'" . htmlspecialchars(mysql_real_escape_string($data['project']['form_short_description'])) . "'", 'register_time' => time(), 'rand_hash' => "'" . md5($random_num) . "'", 'built_from_template' => db_ei($data['project']['built_from_template']), 'type' => $data['project']['is_test'] ? 3 : 1); $sql = 'INSERT INTO groups(' . implode(', ', array_keys($insert_data)) . ') VALUES (' . implode(', ', array_values($insert_data)) . ')'; $result = db_query($sql); if (!$result) { exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('register_confirmation', 'upd_fail', array($GLOBALS['sys_email_admin'], db_error()))); } else { $group_id = db_insertid($result); // insert descriptions $descfieldsinfos = getProjectsDescFieldsInfos(); for ($i = 0; $i < sizeof($descfieldsinfos); $i++) { if (isset($data['project']["form_" . $descfieldsinfos[$i]["group_desc_id"]]) && $data['project']["form_" . $descfieldsinfos[$i]["group_desc_id"]] != '') { $sql = "INSERT INTO group_desc_value (group_id, group_desc_id, value) VALUES ('" . db_ei($group_id) . "','" . db_ei($descfieldsinfos[$i]["group_desc_id"]) . "','" . db_escape_string(trim($data['project']["form_" . $descfieldsinfos[$i]["group_desc_id"]])) . "')"; $result = db_query($sql); if (!$result) { list($host, $port) = explode(':', $GLOBALS['sys_default_domain']); exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('register_confirmation', 'ins_desc_fail', array($host, db_error()))); } } } // insert trove categories if (isset($data['project']['trove'])) { foreach ($data['project']['trove'] as $root => $values) { foreach ($values as $value) { db_query("INSERT INTO trove_group_link (trove_cat_id,trove_cat_version," . "group_id,trove_cat_root) VALUES (" . db_ei($value) . "," . time() . "," . db_ei($group_id) . "," . db_ei($root) . ")"); } } } // define a module $project_manager = ProjectManager::instance(); $result = db_query("INSERT INTO filemodule (group_id,module_name) VALUES ('{$group_id}','" . $project_manager->getProject($group_id)->getUnixName() . "')"); if (!$result) { list($host, $port) = explode(':', $GLOBALS['sys_default_domain']); exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('register_confirmation', 'ins_file_fail', array($host, db_error()))); } // make the current user a project admin as well as admin // on all Codendi services $result = db_query("INSERT INTO user_group (user_id,group_id,admin_flags,bug_flags,forum_flags,project_flags,patch_flags,support_flags,doc_flags,file_flags,wiki_flags,svn_flags,news_flags) VALUES (" . user_getid() . "," . $group_id . "," . "'A'," . "2," . "2," . "2," . "2," . "2," . "2," . "2," . "2," . "2," . "2)"); // news_flags if (!$result) { exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('register_confirmation', 'set_owner_fail', array($GLOBALS['sys_email_admin'], db_error()))); } // clear the user data to take into account this new group. $user = UserManager::instance()->getCurrentUser(); $user->clearGroupData(); // Instanciate all services from the project template that are 'active' $group = $project_manager->getProject($group_id); if (!$group || !is_object($group)) { exit_no_group(); } //set up the group_id $_REQUEST['group_id'] = $_GET['group_id'] = $group_id; $request =& HTTPRequest::instance(); $request->params['group_id'] = $_REQUEST['group_id']; $template_id = $group->getTemplate(); $template_group = $project_manager->getProject($template_id); if (!$template_group || !is_object($template_group) || $template_group->isError()) { exit_no_group(); } $system_template = $template_group->getStatus() == 's' || $template_group->getStatus() == 'S'; if (!$system_template) { $template_name = $template_group->getUnixName(); } $sql = "SELECT * FROM service WHERE group_id={$template_id} AND is_active=1"; $result = db_query($sql); while ($arr = db_fetch_array($result)) { if (isset($data['project']['services'][$arr['service_id']]['is_used'])) { $is_used = $data['project']['services'][$arr['service_id']]['is_used']; } else { $is_used = '0'; if ($arr['short_name'] == 'admin' || $arr['short_name'] == 'summary') { $is_used = '1'; } } $server_id = isset($data['project']['services'][$arr['service_id']]['server_id']) && $data['project']['services'][$arr['service_id']]['server_id'] ? $data['project']['services'][$arr['service_id']]['server_id'] : 'null'; if (!service_create_service($arr, $group_id, array('system' => $system_template, 'name' => $system_template ? '' : $template_name, 'id' => $template_id, 'is_used' => $is_used, 'server_id' => $server_id))) { exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('register_confirmation', 'cant_create_service') . '<br>' . db_error()); } } //Add the import of the message to requester from the parent project if defined $dar = $project_manager->getMessageToRequesterForAccessProject($template_id); if ($dar && !$dar->isError() && $dar->rowCount() == 1) { $row = $dar->getRow(); $result = $project_manager->setMessageToRequesterForAccessProject($group_id, $row['msg_to_requester']); } else { $result = $project_manager->setMessageToRequesterForAccessProject($group_id, 'member_request_delegation_msg_to_requester'); } if (!$result) { exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('register_confirmation', 'cant_copy_msg_to_requester')); } //Copy forums from template project $sql = "SELECT forum_name, is_public, description FROM forum_group_list WHERE group_id={$template_id} "; $result = db_query($sql); while ($arr = db_fetch_array($result)) { $fid = forum_create_forum($group_id, $arr['forum_name'], $arr['is_public'], 1, $arr['description'], $need_feedback = false); if ($fid != -1) { forum_add_monitor($fid, user_getid()); } } //copy cvs infos $sql = "SELECT cvs_tracker, cvs_watch_mode, cvs_preamble, cvs_is_private FROM groups WHERE group_id={$template_id} "; $result = db_query($sql); $arr = db_fetch_array($result); $query = "UPDATE groups \n SET cvs_tracker='" . db_ei($arr['cvs_tracker']) . "',\n cvs_watch_mode='" . db_ei($arr['cvs_watch_mode']) . "' ,\n cvs_preamble='" . db_escape_string($arr['cvs_preamble']) . "',\n cvs_is_private = " . db_escape_int($arr['cvs_is_private']) . "\n WHERE group_id = '{$group_id}'"; $result = db_query($query); if (!$result) { exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('register_confirmation', 'cant_copy_cvs_infos')); } //copy svn infos $current_timestamp = db_escape_int($_SERVER['REQUEST_TIME']); $sql = "INSERT INTO svn_accessfile_history (version_number, group_id, version_date)\n VALUES (1, {$group_id}, {$current_timestamp})"; $result = db_query($sql); if (!$result) { exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('register_confirmation', 'cant_copy_svn_infos')); } $sql = "SELECT svn_tracker, svn_preamble, svn_mandatory_ref, svn_commit_to_tag_denied FROM groups WHERE group_id={$template_id} "; $result = db_query($sql); $arr = db_fetch_array($result); $query = "UPDATE groups, svn_accessfile_history\n SET svn_tracker='" . db_ei($arr['svn_tracker']) . "',\n svn_mandatory_ref='" . db_ei($arr['svn_mandatory_ref']) . "',\n svn_preamble='" . db_escape_string($arr['svn_preamble']) . "',\n svn_commit_to_tag_denied='" . db_ei($arr['svn_commit_to_tag_denied']) . "',\n svn_accessfile_version_id = svn_accessfile_history.id\n WHERE groups.group_id = {$group_id}\n AND groups.group_id = svn_accessfile_history.group_id"; $result = db_query($query); if (!$result) { exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('register_confirmation', 'cant_copy_svn_infos')); } // Activate other system references not associated with any service $reference_manager =& ReferenceManager::instance(); $reference_manager->addSystemReferencesWithoutService($template_id, $group_id); //Copy ugroups $ugroup_mapping = array(); ugroup_copy_ugroups($template_id, $group_id, $ugroup_mapping); $sql_ugroup_mapping = ' ugroup_id '; if (is_array($ugroup_mapping) && count($ugroup_mapping)) { $sql_ugroup_mapping = ' CASE ugroup_id '; foreach ($ugroup_mapping as $key => $val) { $sql_ugroup_mapping .= ' WHEN ' . $key . ' THEN ' . $val; } $sql_ugroup_mapping .= ' ELSE ugroup_id END '; } //Copy packages from template project $sql = "SELECT package_id, name, status_id, rank, approve_license FROM frs_package WHERE group_id = {$template_id}"; if ($result = db_query($sql)) { while ($p_data = db_fetch_array($result)) { $template_package_id = $p_data['package_id']; $sql = sprintf("INSERT INTO frs_package(group_id, name, status_id, rank, approve_license) VALUES (%s, '%s', %s, %s, %s)", $group_id, db_escape_string($p_data['name']), db_ei($p_data['status_id']), db_ei($p_data['rank']), db_ei($p_data['approve_license'])); $rid = db_query($sql); if ($rid) { $package_id = db_insertid($rid); $sql = "INSERT INTO permissions(permission_type, object_id, ugroup_id) \n SELECT permission_type, {$package_id}, {$sql_ugroup_mapping}\n FROM permissions\n WHERE permission_type = 'PACKAGE_READ'\n AND object_id = {$template_package_id}"; db_query($sql); } } } //Set up some mailing lists //will be done at some point. needs to communicate with geocrawler // TBD // Generic Trackers Creation $tracker_mapping = array(); $report_mapping = array(); if (TrackerV3::instance()->available()) { $atf = new ArtifactTypeFactory($template_group); //$tracker_error = ""; // Add all trackers from template project (tracker templates) that need to be instanciated for new trackers. $res = $atf->getTrackerTemplatesForNewProjects(); while ($arr_template = db_fetch_array($res)) { $ath_temp = new ArtifactType($template_group, $arr_template['group_artifact_id']); $report_mapping_for_this_tracker = array(); $new_at_id = $atf->create($group_id, $template_id, $ath_temp->getID(), db_escape_string($ath_temp->getName()), db_escape_string($ath_temp->getDescription()), $ath_temp->getItemName(), $ugroup_mapping, $report_mapping_for_this_tracker); if (!$new_at_id) { $GLOBALS['Response']->addFeedback('error', $atf->getErrorMessage()); } else { $report_mapping = $report_mapping + $report_mapping_for_this_tracker; $tracker_mapping[$ath_temp->getID()] = $new_at_id; // Copy all the artifacts from the template tracker to the new tracker $ath_new = new ArtifactType($group, $new_at_id); // not now. perhaps one day //if (!$ath_new->copyArtifacts($ath_temp->getID()) ) { //$GLOBALS['Response']->addFeedback('info', $ath_new->getErrorMessage()); //} // Create corresponding reference $ref = new Reference(0, strtolower($ath_temp->getItemName()), $GLOBALS['Language']->getText('project_reference', 'reference_art_desc_key'), '/tracker/?func=detail&aid=$1&group_id=$group_id', 'P', 'tracker', ReferenceManager::REFERENCE_NATURE_ARTIFACT, '1', $group_id); $result = $reference_manager->createReference($ref, true); // Force reference creation because default trackers use reserved keywords } } } // Clone wiki from the template $clone = new WikiCloner($template_id, $group_id); // check if the template project has a wiki initialised if ($clone->templateWikiExists() and $clone->newWikiIsUsed()) { //clone wiki. $clone->CloneWiki(); } //Create the summary page $lm = new WidgetLayoutManager(); $lm->createDefaultLayoutForProject($group_id, $template_id); //Create project specific references if template is not default site template if (!$system_template) { $reference_manager =& ReferenceManager::instance(); $reference_manager->addProjectReferences($template_id, $group_id); } // Copy Truncated email option $sql = "UPDATE groups AS g1\n JOIN groups AS g2\n ON g2.group_id = " . db_ei($template_id) . "\n SET g1.truncated_emails = g2.truncated_emails\n WHERE g1.group_id = " . db_ei($group_id); db_query($sql); $result = db_query($query); if (!$result) { exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('register_confirmation', 'cant_copy_truncated_emails')); } // Raise an event for plugin configuration $em =& EventManager::instance(); $em->processEvent('register_project_creation', array('reportMapping' => $report_mapping, 'trackerMapping' => $tracker_mapping, 'ugroupsMapping' => $ugroup_mapping, 'group_id' => $group_id, 'template_id' => $template_id)); if ($auto_approval == PROJECT_APPROVAL_AUTO) { $project_manager->activate($group); } return $group_id; } }
private function initTrackerV3ModuleFromTemplate(Group $group, Group $template_group, $ugroup_mapping) { $group_id = $group->getID(); $tracker_mapping = array(); $report_mapping = array(); if (TrackerV3::instance()->available()) { $atf = new ArtifactTypeFactory($template_group); //$tracker_error = ""; // Add all trackers from template project (tracker templates) that need to be instanciated for new trackers. $res = $atf->getTrackerTemplatesForNewProjects(); while ($arr_template = db_fetch_array($res)) { $ath_temp = new ArtifactType($template_group, $arr_template['group_artifact_id']); $report_mapping_for_this_tracker = array(); $new_at_id = $atf->create($group_id, $template_group->getID(), $ath_temp->getID(), db_escape_string($ath_temp->getName()), db_escape_string($ath_temp->getDescription()), $ath_temp->getItemName(), $ugroup_mapping, $report_mapping_for_this_tracker); if (!$new_at_id) { $GLOBALS['Response']->addFeedback('error', $atf->getErrorMessage()); } else { $report_mapping = $report_mapping + $report_mapping_for_this_tracker; $tracker_mapping[$ath_temp->getID()] = $new_at_id; // Copy all the artifacts from the template tracker to the new tracker $ath_new = new ArtifactType($group, $new_at_id); // not now. perhaps one day //if (!$ath_new->copyArtifacts($ath_temp->getID()) ) { //$GLOBALS['Response']->addFeedback('info', $ath_new->getErrorMessage()); //} // Create corresponding reference $ref = new Reference(0, strtolower($ath_temp->getItemName()), $GLOBALS['Language']->getText('project_reference', 'reference_art_desc_key'), '/tracker/?func=detail&aid=$1&group_id=$group_id', 'P', 'tracker', ReferenceManager::REFERENCE_NATURE_ARTIFACT, '1', $group_id); $result = $this->reference_manager->createReference($ref, true); // Force reference creation because default trackers use reserved keywords } } } return array($tracker_mapping, $report_mapping); }
/** * Create a tracker v5 from a tracker v3 * * @param PFUser $user the user who requested the creation * @param int $atid the id of the tracker v3 * @param Project $project the Id of the project to create the tracker * @param string $name the name of the tracker (label) * @param string $description the description of the tracker * @param string $itemname the short name of the tracker * * @throws Tracker_Exception_Migration_GetTv3Exception * * @return Tracker */ public function createFromTV3(PFUser $user, $atid, Project $project, $name, $description, $itemname) { require_once 'common/tracker/ArtifactType.class.php'; $tv3 = new ArtifactType($project, $atid); if ($tv3->isError()) { throw new Tracker_Exception_Migration_GetTv3Exception($tv3->getErrorMessage()); } // Check if this tracker is valid (not deleted) if (!$tv3->isValid()) { throw new Tracker_Exception_Migration_GetTv3Exception($GLOBALS['Language']->getText('tracker_add', 'invalid')); } //Check if the user can view the artifact if (!$tv3->userCanView($user->getId())) { throw new Tracker_Exception_Migration_GetTv3Exception($GLOBALS['Language']->getText('include_exit', 'no_perm')); } $tracker = null; if ($this->validMandatoryInfoOnCreate($name, $description, $itemname, $project->getId())) { $migration_v3 = new Tracker_Migration_V3($this); $tracker = $migration_v3->createTV5FromTV3($project, $name, $description, $itemname, $tv3); $this->postCreateActions($tracker); } return $tracker; }
/** * Display Date Field Notification Settings form * * @param * @return void */ function displayDateFieldNotificationSettings(ArtifactType $at, ArtifactField $field) { //get date field reminder settings from database $tdrArtifactField = new TrackerDateReminder_ArtifactField(); $res = $tdrArtifactField->getDateFieldReminderSettings($field->getID(), $at->getID()); $enabled = db_numrows($res) == 1; $start = db_result($res, 0, 'notification_start'); $frequency = db_result($res, 0, 'frequency'); $recurse = db_result($res, 0, 'recurse'); $notified_people = db_result($res, 0, 'notified_people'); $notified_groups = array(); $notified_users = array(); if (trim($notified_people) != "") { $notif = explode(",", $notified_people); foreach ($notif as $value) { if (preg_match("/^g/", $value)) { array_push($notified_groups, $value); } else { array_push($notified_users, $value); } } } if (count($notified_groups) == 0) { $notified_groups[] = '100'; } if (count($notified_users) == 0) { $notified_users[] = '100'; } $notif_type = db_result($res, 0, 'notification_type'); if ($notif_type == 1) { $after = "selected"; $before = ""; } else { $after = ""; $before = "selected"; } $out = ''; $baseActionUrl = '/tracker/admin/index.php?func=date_field_notification&group_id=' . $at->Group->getID() . '&atid=' . $at->getID() . '&field_id=' . $field->getID(); if ($enabled) { $out .= '<H3>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notif_settings_del_title') . '</H3>'; $out .= '<FORM ACTION="' . $baseActionUrl . '&delete_reminder=true" METHOD="POST">'; $out .= '<P>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notif_settings_del_desc') . '</P>'; $out .= '<INPUT TYPE="SUBMIT" NAME="reminder" VALUE="' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notif_settings_del_button') . '" />'; $out .= '</FORM>'; } $out .= '<FORM ACTION="' . $baseActionUrl . '" METHOD="POST" name="date_field_notification_settings_form"> <INPUT TYPE="HIDDEN" NAME="field_id" VALUE="' . $field->getID() . '"> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $at->Group->getID() . '"> <INPUT TYPE="HIDDEN" NAME="atid" VALUE="' . $at->getID() . '">'; $out .= '<h3>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notif_settings_field', array($field->getLabel())) . '</h3>'; $out .= '<fieldset> <TABLE BORDER="0" WIDTH="930px"><TR height="30"><TD>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part1', array($field->getLabel())) . '</TD><TD> <INPUT TYPE="TEXT" NAME="start" SIZE="5" VALUE="' . $start . '"> ' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'days') . '</TD><TD colspan=3"> <SELECT NAME="notif_type"> <OPTION VALUE="0" ' . $before . '>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notify_before') . ' <OPTION VALUE="1" ' . $after . '>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'notify_after') . ' </SELECT> ' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part2') . '</TD></TR><TR><TD valign="top">' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part3') . ' <INPUT TYPE="TEXT" NAME="recurse" SIZE="5" VALUE="' . $recurse . '"> ' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part4') . '</TD><TD valign="top"> '; $artRoleNames = array(array('value' => '1', 'text' => $GLOBALS['Language']->getText('tracker_common_types', 'role_SUBMITTER_short_desc')), array('value' => '2', 'text' => $GLOBALS['Language']->getText('tracker_common_types', 'role_ASSIGNEE_short_desc')), array('value' => '3', 'text' => $GLOBALS['Language']->getText('tracker_common_types', 'role_CC_short_desc')), array('value' => '4', 'text' => $GLOBALS['Language']->getText('tracker_common_types', 'role_COMMENTER_short_desc'))); $out .= html_build_multiple_select_box_from_array($artRoleNames, 'notified_users[]', $notified_users, 4, true, '', false, '', false, '', false); $out .= '</TD><TD valign="top">' . $GLOBALS['Language']->getText('global', 'and') . ' </TD> <TD valign="top">'; $qry = sprintf('SELECT ugroup_id, name FROM ugroup' . ' WHERE (group_id = %d || group_id = 100)' . ' AND ugroup_id <> 1' . ' AND ugroup_id <> 2' . ' AND ugroup_id <> 100', db_ei($at->Group->getID())); $res = db_query($qry); while ($rows = db_fetch_array($res)) { $groupNames[] = array('value' => 'g' . $rows['ugroup_id'], 'text' => util_translate_name_ugroup($rows['name'])); } $out .= html_build_multiple_select_box_from_array($groupNames, 'notified_groups[]', $notified_groups, 8, true, '', false, '', false, '', false); $out .= '</SELECT></TD><TD valign="top">' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part5') . ' <INPUT TYPE="TEXT" NAME="frequency" SIZE="5" VALUE="' . $frequency . '"> ' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'days') . '.</TD></TR></TABLE><INPUT TYPE="SUBMIT" NAME="submit_notif_settings" value="' . $GLOBALS['Language']->getText('global', 'btn_update') . '"></P></FORM></fieldset><P>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part6', array($field->getLabel())) . '<P>' . $GLOBALS['Language']->getText('plugin_tracker_date_reminder', 'reminder_form_part7', array($field->getLabel())) . '</P>' . '<P>'; echo $out; }
public static function getParentDirectoryForArtifact(ArtifactType $artifact_type) { return self::getParentDirectoryForArtifactTypeId($artifact_type->getID()); }
/** * existArtifactSummary - check if the tracker $group_artifact_id already contains an artifact with the summary $summary * * @param string $sessionKey the session hash associated with the session opened by the person who calls the service * @param int $group_artifact_id the ID of the tracker we want to check * @param string $summary the summary we want to check * @return int the ID of the artifact containing the same summary in the tracker, or * -1 if the summary does not exist in this tracker. */ function existArtifactSummary($sessionKey, $group_artifact_id, $summary) { if (session_continue($sessionKey)) { $res = db_query("SELECT group_id FROM artifact_group_list WHERE group_artifact_id = " . db_ei($group_artifact_id)); if ($res && db_numrows($res) > 0) { $group_id = db_result($res, 0, 'group_id'); } else { return new SoapFault(get_artifact_type_fault, 'Tracker not found.', 'existArtifactSummary'); } try { $pm = ProjectManager::instance(); $grp = $pm->getGroupByIdForSoap($group_id, 'existArtifactSummary'); } catch (SoapFault $e) { return $e; } $at = new ArtifactType($grp, $group_artifact_id); if ($at->userCanView()) { $res = db_query('SELECT artifact_id FROM artifact WHERE group_artifact_id = ' . db_ei($group_artifact_id) . ' AND summary="' . db_es(htmlspecialchars($summary)) . '"'); if ($res && db_numrows($res) > 0) { return db_result($res, 0, 0); } else { return -1; } } else { return new SoapFault(get_artifact_type_fault, 'Permission denied.', 'existArtifactSummary'); } } else { return new SoapFault(invalid_session_fault, 'Invalid Session', 'existArtifactSummary'); } }
/** * Check membership of the user to a specified ugroup * $group_id is necessary for automatic project groups like project member, release admin, etc. * $atid is necessary for trackers since the tracker admin role is different for each tracker. * @return true if user is member of the ugroup, false otherwise. */ function ugroup_user_is_member($user_id, $ugroup_id, $group_id, $atid = 0) { $um =& UserManager::instance(); $user =& $um->getUserById($user_id); // Special Cases if ($ugroup_id == $GLOBALS['UGROUP_NONE']) { // Empty group return false; } else { if ($ugroup_id == $GLOBALS['UGROUP_ANONYMOUS']) { // Anonymous user return true; } else { if ($ugroup_id == $GLOBALS['UGROUP_REGISTERED']) { // Registered user return $user_id != 0; } else { if ($ugroup_id == $GLOBALS['UGROUP_PROJECT_MEMBERS']) { // Project members if ($user->isMember($group_id)) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_FILE_MANAGER_ADMIN']) { // File manager admins if ($user->isMember($group_id, 'R2')) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_DOCUMENT_ADMIN']) { // Document admin if ($user->isMember($group_id, 'D2')) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_DOCUMENT_TECH']) { // Document tech if ($user->isMember($group_id, 'D1')) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_WIKI_ADMIN']) { // Wiki admins if ($user->isMember($group_id, 'W2')) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_PROJECT_ADMIN']) { // Project admins if ($user->isMember($group_id, 'A')) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_TRACKER_ADMIN']) { // Tracker admins $pm = ProjectManager::instance(); $group = $pm->getProject($group_id); $at = new ArtifactType($group, $atid); return $at->userIsAdmin($user_id); } else { // Normal ugroup $sql = "SELECT * from ugroup_user where ugroup_id='{$ugroup_id}' and user_id='{$user_id}'"; $res = db_query($sql); if (db_numrows($res) > 0) { return true; } } } } } } } } } } } return false; }
/** * Check if the current user is allowed to change permissions, depending on the permission_type * * @param Integer $group_id Id of the project * @param String $permission_type Type of the permission * @param Boolean $object_id Object on which permission is applied * * @return Boolean */ function permission_user_allowed_to_change($group_id, $permission_type, $object_id = 0) { // Super-user and project admin has all rights... $user = UserManager::instance()->getCurrentUser(); if (user_is_super_user() || $user->isMember($group_id, 'A')) { return true; } if ($permission_type == 'NEWS_READ') { //special case : if user has write (or admin) perms on News, he can submit news ==> he can submit private news ==> he can define news perms return user_ismember($group_id, 'N1') || user_ismember($group_id, 'N2'); } else { if ($permission_type == 'PACKAGE_READ') { return user_ismember($group_id, 'R2'); } else { if ($permission_type == 'RELEASE_READ') { return user_ismember($group_id, 'R2'); } else { if ($permission_type == 'DOCGROUP_READ') { return user_ismember($group_id, 'D2'); } else { if ($permission_type == 'DOCUMENT_READ') { return user_ismember($group_id, 'D2'); } else { if ($permission_type == 'WIKI_READ') { return user_ismember($group_id, 'W2'); } else { if ($permission_type == 'WIKIPAGE_READ') { return user_ismember($group_id, 'W2'); } else { if ($permission_type == 'WIKIATTACHMENT_READ') { return user_ismember($group_id, 'W2'); } else { if (strpos($permission_type, 'TRACKER') === 0) { // Starts with 'TRACKER' $pm = ProjectManager::instance(); $group = $pm->getProject($group_id); //The object_id stored in the permission table when permission_type ='TRACKER_ARTIFACT_ACCESS' //corresponds to the artifact_id if ($permission_type == 'TRACKER_ARTIFACT_ACCESS') { $sql = 'SELECT group_artifact_id from artifact WHERE artifact_id = ' . db_ei($object_id); $res = db_query($sql); if ($res && db_numrows($res) == 1) { $row = db_fetch_array($res); $object_id = $row['group_artifact_id']; } else { return false; } } $at = new ArtifactType($group, (int) $object_id); return $at->userIsAdmin(); } else { $em =& EventManager::instance(); $allowed = false; $em->processEvent('permission_user_allowed_to_change', array('group_id' => $group_id, 'permission_type' => $permission_type, 'object_id' => $object_id, 'allowed' => &$allowed)); return $allowed; } } } } } } } } } }
var A = function(ab, db, a, d, sp, md, es, s, t, des, ef, set) { this.attack_bonus = ab; this.defence_bonus = db; this.attack = a; this.defence = d; this.spell_power = sp; this.magical_defence = md; this.escape = es; this.survival = s; this.thieving = t; this.destruction = des; this.efficiency = ef; this.set = set; }; this['nothing'] = new A(0,0,0,0,0,0,0,0,0,0,0,''); <?php $artifacts_data = DataTable::constructFromCsvFile(new CsvFile('data/artifacts.csv')); foreach (ArtifactType::values() as $artifact_type) { $artifacts = $artifacts_data->get(array('type' => $artifact_type)); foreach ($artifacts as $artifact_array) { $artifact = Artifact::constructFromArray($artifact_array); echo "\t" . 'this[\'' . $artifact->getId() . '\'] = new A(' . $artifact->getAttack_bonus() . ',' . $artifact->getDefence_bonus() . ',' . $artifact->getAttack() . ',' . $artifact->getDefence() . ',' . $artifact->getSpell_power() . ',' . $artifact->getMagical_defence() . ',' . $artifact->getEscape() . ',' . $artifact->getSurvival() . ',' . $artifact->getThieving() . ',' . $artifact->getDestruction() . ',' . $artifact->getEfficiency() . ',' . '\'' . $artifact->getSet() . '\');' . PHP_EOL; } } ?> }; };
$request = HTTPRequest::instance(); $func = $request->get('func'); switch ($func) { case 'restore': if ($group = $pm->getProject($request->getValidated('group_id', 'GroupId'))) { $ath = new ArtifactType($group, $atid); if (!$ath->restore()) { $feedback = $Language->getText('tracker_admin_restore', 'restore_failed'); } else { $feedback = $Language->getText('tracker_admin_restore', 'tracker_restored'); } } break; case 'delay': if ($group = $pm->getProject($request->getValidated('group_id', 'GroupId'))) { $ath = new ArtifactType($group, $request->getValidated('atid', 'uint')); // just check date >= today if (!$ath->delay($delay_date)) { if ($ath->isError()) { exit_error($Language->getText('global', 'error'), $ath->getErrorMessage() . " | " . $Language->getText('tracker_admin_restore', 'delay_failed')); } exit_error($Language->getText('global', 'error'), $Language->getText('tracker_admin_restore', 'delay_failed')); } else { $feedback = $Language->getText('tracker_admin_restore', 'delayed_deletion'); } } break; case 'delete': // Create field factory if ($group = $pm->getProject($request->getValidated('group_id', 'GroupId'))) { $atid = $request->getValidated('atid', 'uint');
/** * Check membership of the user to a specified ugroup * $group_id is necessary for automatic project groups like project member, release admin, etc. * $atid is necessary for trackers since the tracker admin role is different for each tracker. * @return true if user is member of the ugroup, false otherwise. */ function ugroup_user_is_member($user_id, $ugroup_id, $group_id, $atid = 0) { $um = ugroup_get_user_manager(); $user =& $um->getUserById($user_id); // Special Cases if ($ugroup_id == $GLOBALS['UGROUP_NONE']) { // Empty group return false; } else { if ($ugroup_id == $GLOBALS['UGROUP_ANONYMOUS']) { // Anonymous user return true; } else { if ($ugroup_id == $GLOBALS['UGROUP_AUTHENTICATED']) { // Registered user return $user_id != 0; } else { if ($ugroup_id == $GLOBALS['UGROUP_REGISTERED'] && !ForgeConfig::areRestrictedUsersAllowed()) { // Registered user return $user_id != 0; } else { if ($ugroup_id == $GLOBALS['UGROUP_REGISTERED'] && ForgeConfig::areRestrictedUsersAllowed()) { $user = UserManager::instance()->getUserById($user_id); $called_script_handles_restricted = false; $event_manager = EventManager::instance(); $script = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : ''; $event_manager->processEvent(Event::IS_SCRIPT_HANDLED_FOR_RESTRICTED, array('allow_restricted' => &$called_script_handles_restricted, 'user' => $user, 'uri' => $script)); // Non-restricted user or restricted member in service that doesn't yet handle restricted users independently return !$user->isRestricted() || !$called_script_handles_restricted; } else { if ($ugroup_id == $GLOBALS['UGROUP_PROJECT_MEMBERS']) { // Project members if ($user->isMember($group_id)) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_FILE_MANAGER_ADMIN']) { // File manager admins if ($user->isMember($group_id, 'R2')) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_DOCUMENT_ADMIN']) { // Document admin if ($user->isMember($group_id, 'D2')) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_DOCUMENT_TECH']) { // Document tech if ($user->isMember($group_id, 'D1')) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_WIKI_ADMIN']) { // Wiki admins if ($user->isMember($group_id, 'W2')) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_PROJECT_ADMIN']) { // Project admins if ($user->isMember($group_id, 'A')) { return true; } } else { if ($ugroup_id == $GLOBALS['UGROUP_TRACKER_ADMIN']) { // Tracker admins $pm = ProjectManager::instance(); $group = $pm->getProject($group_id); $at = new ArtifactType($group, $atid); return $at->userIsAdmin($user_id); } else { // Normal ugroup $sql = "SELECT * from ugroup_user where ugroup_id='" . db_ei($ugroup_id) . "' and user_id='" . db_ei($user_id) . "'"; $res = db_query($sql); if (db_numrows($res) > 0) { return true; } } } } } } } } } } } } } return false; }
/** * create - use this to create a new ArtifactType in the database. * * @param group_id: the group id of the new tracker * @param group_id_template: the template group id (used for the copy) * @param atid_template: the template artfact type id * @param name: the name of the new tracker * @param description: the description of the new tracker * @param itemname: the itemname of the new tracker * @return id on success, false on failure. */ function create($group_id, $group_id_template, $atid_template, $name, $description, $itemname, $ugroup_mapping = false, &$report_mapping = array()) { global $Language; if (!$name || !$description || !$itemname || trim($name) == "" || trim($description) == "" || trim($itemname) == "") { $this->setError('ArtifactTypeFactory: ' . $Language->getText('tracker_common_type', 'name_requ')); return false; } // Necessary test to avoid issues when exporting the tracker to a DB (e.g. '-' not supported as table name) if (!eregi("^[a-zA-Z0-9_]+\$", $itemname)) { $this->setError($Language->getText('tracker_common_type', 'invalid_shortname', $itemname)); return false; } $reference_manager = ReferenceManager::instance(); if ($reference_manager->_isKeywordExists($itemname, $group_id)) { $this->setError($Language->getText('tracker_common_type', 'shortname_already_exists', $itemname)); return false; } if ($this->isNameExists($name, $group_id)) { $this->setError($Language->getText('tracker_common_type', 'name_already_exists', $name)); return false; } // get the template Group object $pm = ProjectManager::instance(); $template_group = $pm->getProject($group_id_template); if (!$template_group || !is_object($template_group) || $template_group->isError()) { $this->setError('ArtifactTypeFactory: ' . $Language->getText('tracker_common_type', 'invalid_templ')); } // get the Group object of the new tracker $pm = ProjectManager::instance(); $group = $pm->getProject($group_id); if (!$group || !is_object($group) || $group->isError()) { $this->setError('ArtifactTypeFactory: ' . $Language->getText('tracker_common_type', 'invalid_templ')); } // We retrieve allow_copy from template $at_template = new ArtifactType($template_group, $atid_template); $id_sharing = new TrackerIdSharingDao(); if ($id = $id_sharing->generateTrackerId()) { // First, we create a new ArtifactType into artifact_group_list // By default, set 'instantiate_for_new_projects' to '1', so that a project that is not yet a // template will be able to have its trackers cloned by default when it becomes a template. $sql = "INSERT INTO \n artifact_group_list \n (group_artifact_id, group_id, name, description, item_name, allow_copy,\n submit_instructions,browse_instructions,instantiate_for_new_projects,stop_notification\n ) \n VALUES \n ({$id},\n '" . db_ei($group_id) . "',\n '" . db_es($name) . "',\n '" . db_es($description) . "',\n '" . db_es($itemname) . "',\n '" . db_ei($at_template->allowsCopy()) . "',\n '" . db_es($at_template->getSubmitInstructions()) . "',\n '" . db_es($at_template->getBrowseInstructions()) . "',1,0)"; //echo $sql; $res = db_query($sql); if (!$res || db_affected_rows($res) <= 0) { $this->setError('ArtifactTypeFactory: ' . db_error()); return false; } else { //No need to get the last insert id since we already know the id : $id //$id = db_insertid($res,'artifact_group_list','group_artifact_id'); $at_new = new ArtifactType($group, $id); if (!$at_new->fetchData($id)) { $this->setError('ArtifactTypeFactory: ' . $Language->getText('tracker_common_type', 'load_fail')); return false; } else { //create global notifications $sql = "INSERT INTO artifact_global_notification (tracker_id, addresses, all_updates, check_permissions)\n SELECT " . db_ei($id) . ", addresses, all_updates, check_permissions\n FROM artifact_global_notification\n WHERE tracker_id = " . db_ei($atid_template); $res = db_query($sql); if (!$res || db_affected_rows($res) <= 0) { $this->setError('ArtifactTypeFactory: ' . db_error()); } // Create fieldset factory $art_fieldset_fact = new ArtifactFieldSetFactory($at_template); // Then copy all the field sets. $mapping_field_set_array = $art_fieldset_fact->copyFieldSets($atid_template, $id); if (!$mapping_field_set_array) { $this->setError('ArtifactTypeFactory: ' . $art_fieldset_fact->getErrorMessage()); return false; } // Create field factory $art_field_fact = new ArtifactFieldFactory($at_template); // Then copy all the fields informations if (!$art_field_fact->copyFields($id, $mapping_field_set_array, $ugroup_mapping)) { $this->setError('ArtifactTypeFactory: ' . $art_field_fact->getErrorMessage()); return false; } // Then copy all the reports informations // Create field factory $art_report_fact = new ArtifactReportFactory(); if (!($report_mapping = $art_report_fact->copyReports($atid_template, $id))) { $this->setError('ArtifactTypeFactory: ' . $art_report_fact->getErrorMessage()); return false; } $em =& EventManager::instance(); $pref_params = array('atid_source' => $atid_template, 'atid_dest' => $id); $em->processEvent('artifactType_created', $pref_params); // Copy artifact_notification_event and artifact_notification_role if (!$at_new->copyNotificationEvent($id)) { return false; } if (!$at_new->copyNotificationRole($id)) { return false; } // Create user permissions: None for group members and Admin for group admin if (!$at_new->createUserPerms($id)) { return false; } // Create canned responses $canned_new = new ArtifactCanned($at_new); $canned_template = $at_template->getCannedResponses(); if ($canned_template && db_numrows($canned_template) > 0) { while ($row = db_fetch_array($canned_template)) { $canned_new->create($row['title'], $row['body']); } } //Copy template permission permission_copy_tracker_and_field_permissions($atid_template, $id, $group_id_template, $group_id, $ugroup_mapping); //Copy Rules require_once 'ArtifactRulesManager.class.php'; $arm = new ArtifactRulesManager(); $arm->copyRules($atid_template, $id); } } } return $id; }
/** * TODO : adapt it to the new tracker structure when ready */ function getArtifactKeyword($artifact_id, $group_id) { $sql = "SELECT group_artifact_id FROM artifact WHERE artifact_id= " . db_ei($artifact_id); $result = db_query($sql); if (db_numrows($result) > 0) { $row = db_fetch_array($result); $tracker_id = $row['group_artifact_id']; $project = new Project($group_id); $tracker = new ArtifactType($project, $tracker_id); $tracker_short_name = $tracker->getItemName(); $reference_dao =& $this->_getReferenceDao(); $dar = $reference_dao->searchByKeywordAndGroupId($tracker_short_name, $group_id); if ($dar && $dar->rowCount() >= 1) { return $tracker_short_name; } else { return null; } } else { return null; } }
/** * getArtifactTypes - return an array of ArtifactType objects. * * @return array The array of ArtifactType objects. */ function &getArtifactTypes() { if ($this->ArtifactTypes) { return $this->ArtifactTypes; } if (session_loggedin()) { $perm =& $this->Group->getPermission(session_get_user()); if (!$perm || !is_object($perm) || !$perm->isMember()) { $public_flag = '=1'; $exists = ''; } else { $public_flag = '<3'; if ($perm->isArtifactAdmin()) { $exists = ''; } else { $exists = " AND group_artifact_id IN (SELECT role_setting.ref_id\n\t\t\t\t\tFROM role_setting, user_group\n\t\t\t\t\tWHERE role_setting.value::integer >= 0\n AND role_setting.section_name = 'tracker'\n AND role_setting.ref_id=artifact_group_list_vw.group_artifact_id\n \n \t\t\t\t\t AND user_group.role_id = role_setting.role_id\n\t\t\t\t\t AND user_group.user_id='" . user_getid() . "') "; } } } else { $public_flag = '=1'; $exists = ''; } $sql = "SELECT * FROM artifact_group_list_vw\n\t\t\tWHERE group_id='" . $this->Group->getID() . "'\n\t\t\tAND is_public {$public_flag}\n\t\t\t{$exists}\n\t\t\tORDER BY group_artifact_id ASC"; $result = db_query($sql); $rows = db_numrows($result); if (!$result || $rows < 1) { $this->setError('None Found ' . db_error()); $this->ArtifactTypes = NULL; } else { while ($arr =& db_fetch_array($result)) { $artifactType = new ArtifactType($this->Group, $arr['group_artifact_id'], $arr); if ($artifactType->isError()) { $this->setError($artifactType->getErrorMessage()); } else { $this->ArtifactTypes[] = $artifactType; } } } return $this->ArtifactTypes; }