return false;
}
$inserted = array();
- $tags_array = explode('[;,]', $tags);
+ $tags_array = preg_split('/[;,]/', $tags);
foreach ($tags_array as $tag) {
- $tag = stripslashes($tag);
$tag = preg_replace('/[\t\r\n]/', ' ', $tag);
// Allowed caracteres: [A-Z][a-z][0-9] -_&'#+.
if (preg_match('/[^[:alnum:]| |\-|_|\&|\'|#|\+|\.]/', $tag)) {
return false;
}
$tag = trim($tag);
- $tag = addslashes($tag);
if ($tag == '' || array_search($tag, $inserted) !== false) continue;
$sql='INSERT INTO project_tags (group_id,name) VALUES ($1, $2)';
$res=db_query_params($sql, array($this->getID(), $tag));
continue;
}
$f_arr[$i]->delete(1,1);
-//echo 'ForumFactory'.db_error();
}
//
// Delete Subprojects
continue;
}
$pg_arr[$i]->delete(1,1);
-//echo 'ProjectGroupFactory'.db_error();
}
//
// Delete FRS Packages
$news_group=&group_get_object(forge_get_config('news_group'));
$res = db_query_params ('SELECT forum_id FROM news_bytes WHERE group_id=$1',
array ($this->getID())) ;
+ if (!$res) {
+ $this->setError(_('Error Deleting News: ').db_error());
+ db_rollback();
+ return false;
+ }
+
for ($i=0; $i<db_numrows($res); $i++) {
$Forum = new Forum($news_group,db_result($res,$i,'forum_id'));
if (!$Forum->delete(1,1)) {
}
$res = db_query_params ('DELETE FROM news_bytes WHERE group_id=$1',
array ($this->getID())) ;
+ if (!$res) {
+ $this->setError(_('Error Deleting News: ').db_error());
+ db_rollback();
+ return false;
+ }
//
// Delete docs
//
$res = db_query_params ('DELETE FROM doc_data WHERE group_id=$1',
array ($this->getID())) ;
-//echo 'doc_data'.db_error();
+ if (!$res) {
+ $this->setError(_('Error Deleting Documents: ').db_error());
+ db_rollback();
+ return false;
+ }
+
$res = db_query_params ('DELETE FROM doc_groups WHERE group_id=$1',
array ($this->getID())) ;
-//echo 'doc_groups'.db_error();
+ if (!$res) {
+ $this->setError(_('Error Deleting Documents: ').db_error());
+ db_rollback();
+ return false;
+ }
//
// Delete Tags
//
$res=db_query_params('DELETE FROM project_tags WHERE group_id=$1', array($this->getID()));
+ if (!$res) {
+ $this->setError(_('Error Deleting Tags: ').db_error());
+ db_rollback();
+ return false;
+ }
//
// Delete group history
//
$res = db_query_params ('DELETE FROM group_history WHERE group_id=$1',
array ($this->getID())) ;
-//echo 'group_history'.db_error();
+ if (!$res) {
+ $this->setError(_('Error Deleting Project History: ').db_error());
+ db_rollback();
+ return false;
+ }
+
//
// Delete group plugins
//
$res = db_query_params ('DELETE FROM group_plugin WHERE group_id=$1',
array ($this->getID())) ;
-//echo 'group_plugin'.db_error();
+ if (!$res) {
+ $this->setError(_('Error Deleting Project Plugins: ').db_error());
+ db_rollback();
+ return false;
+ }
+
//
// Delete group cvs stats
//
$res = db_query_params ('DELETE FROM stats_cvs_group WHERE group_id=$1',
array ($this->getID())) ;
-//echo 'stats_cvs_group'.db_error();
+ if (!$res) {
+ $this->setError(_('Error Deleting SCM Statistics: ').db_error());
+ db_rollback();
+ return false;
+ }
+
//
// Delete Surveys
//
continue;
}
$s_arr[$i]->delete();
-//echo 'SurveyFactory'.db_error();
}
//
// Delete SurveyQuestions
continue;
}
$sq_arr[$i]->delete();
-//echo 'SurveyQuestionFactory'.db_error();
}
//
// Delete Mailing List Factory
if (!$ml_arr[$i]->delete(1,1)) {
$this->setError(_('Could not properly delete the mailing list'));
}
-//echo 'MailingListFactory'.db_error();
}
//
// Delete trove
//
$res = db_query_params ('DELETE FROM trove_group_link WHERE group_id=$1',
array ($this->getID())) ;
+ if (!$res) {
+ $this->setError(_('Error Deleting Trove: ').db_error());
+ db_rollback();
+ return false;
+ }
+
$res = db_query_params ('DELETE FROM trove_agg WHERE group_id=$1',
array ($this->getID())) ;
+ if (!$res) {
+ $this->setError(_('Error Deleting Trove: ').db_error());
+ db_rollback();
+ return false;
+ }
+
//
// Delete counters
//
$res = db_query_params ('DELETE FROM project_sums_agg WHERE group_id=$1',
array ($this->getID())) ;
-//echo 'project_sums_agg'.db_error();
+ if (!$res) {
+ $this->setError(_('Error Deleting Counters: ').db_error());
+ db_rollback();
+ return false;
+ }
+
$res = db_query_params ('INSERT INTO deleted_groups (unix_group_name,delete_date,isdeleted) VALUES ($1, $2, $3)',
array ($this->getUnixName(),
time(),
0)) ;
-//echo 'InsertIntoDeleteQueue'.db_error();
+ if (!$res) {
+ $this->setError(_('Error Deleting Project: ').db_error());
+ db_rollback();
+ return false;
+ }
+
$res = db_query_params ('DELETE FROM groups WHERE group_id=$1',
array ($this->getID())) ;
-//echo 'DeleteGroup'.db_error();
+ if (!$res) {
+ $this->setError(_('Error Deleting Project: ').db_error());
+ db_rollback();
+ return false;
+ }
+
db_commit();
if (!$res) {
return false;
for ($i=0; $i<$rows; $i++) {
- $member =& user_get_object(db_result($member_res,$i,'user_id'));
+ $member = user_get_object(db_result($member_res,$i,'user_id'));
$roleId = db_result($member_res,$i,'role_id');
if (!$member || !is_object($member)) {