| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisBT - A PHP based bugtracking system 3 # Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 4 # Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 5 # MantisBT is free software: you can redistribute it and/or modify 6 # it under the terms of the GNU General Public License as published by 7 # the Free Software Foundation, either version 2 of the License, or 8 # (at your option) any later version. 9 # 10 # MantisBT is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * Version API 20 * 21 * @package CoreAPI 22 * @subpackage VersionAPI 23 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 24 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 25 * @link http://www.mantisbt.org 26 * 27 * @uses config_api.php 28 * @uses constant_inc.php 29 * @uses database_api.php 30 * @uses date_api.php 31 * @uses error_api.php 32 * @uses helper_api.php 33 * @uses project_api.php 34 * @uses project_hierarchy_api.php 35 */ 36 37 require_api( 'config_api.php' ); 38 require_api( 'constant_inc.php' ); 39 require_api( 'database_api.php' ); 40 require_api( 'date_api.php' ); 41 require_api( 'error_api.php' ); 42 require_api( 'helper_api.php' ); 43 require_api( 'project_api.php' ); 44 require_api( 'project_hierarchy_api.php' ); 45 46 /** 47 * Version Data Structure Definition 48 * @package MantisBT 49 * @subpackage classes 50 */ 51 class VersionData { 52 protected $id = 0; 53 protected $project_id = 0; 54 protected $version = ''; 55 protected $description = ''; 56 protected $released = VERSION_FUTURE; 57 protected $date_order = 1; 58 protected $obsolete = 0; 59 60 /** 61 * @param string $name 62 * @param string $value 63 * @private 64 */ 65 public function __set($name, $value) { 66 switch ($name) { 67 case 'date_order': 68 if( !is_numeric($value) ) { 69 if( $value == '' ) { 70 $value = date_get_null(); 71 } else { 72 $value = strtotime( $value ); 73 if ( $value === false ) { 74 trigger_error( ERROR_INVALID_DATE_FORMAT, ERROR ); 75 } 76 } 77 } 78 } 79 $this->$name = $value; 80 } 81 82 /** 83 * @param string $p_string 84 * @private 85 */ 86 public function __get( $p_name ) { 87 return $this->{$p_name}; 88 } 89 } 90 91 $g_cache_versions = array(); 92 93 /** 94 * Cache a version row if necessary and return the cached copy 95 * If the second parameter is true (default), trigger an error 96 * if the version can't be found. If the second parameter is 97 * false, return false if the version can't be found. 98 * @param int $p_version_id 99 * @param bool $p_trigger_errors 100 * @return array 101 */ 102 function version_cache_row( $p_version_id, $p_trigger_errors = true ) { 103 global $g_cache_versions; 104 105 $c_version_id = db_prepare_int( $p_version_id ); 106 $t_project_version_table = db_get_table( 'project_version' ); 107 108 if( isset( $g_cache_versions[$c_version_id] ) ) { 109 return $g_cache_versions[$c_version_id]; 110 } 111 112 $query = "SELECT * 113 FROM $t_project_version_table 114 WHERE id=" . db_param(); 115 $result = db_query_bound( $query, Array( $c_version_id ) ); 116 117 if( 0 == db_num_rows( $result ) ) { 118 $g_cache_versions[$c_version_id] = false; 119 120 if( $p_trigger_errors ) { 121 error_parameters( $p_version_id ); 122 trigger_error( ERROR_VERSION_NOT_FOUND, ERROR ); 123 } else { 124 return false; 125 } 126 } 127 128 $row = db_fetch_array( $result ); 129 $g_cache_versions[$c_version_id] = $row; 130 131 return $row; 132 } 133 134 /** 135 * Check whether the version exists 136 * $p_project_id : null will use the current project, otherwise the specified project 137 * Returns true if the version exists, false otherwise 138 * @param int $p_version_id 139 * @return bool 140 */ 141 function version_exists( $p_version_id ) { 142 return version_cache_row( $p_version_id, false ) !== false; 143 } 144 145 /** 146 * Check whether the version name is unique 147 * Returns true if the name is unique, false otherwise 148 * @param string $p_version 149 * @param int $p_project_id 150 * @return bool 151 */ 152 function version_is_unique( $p_version, $p_project_id = null ) { 153 return version_get_id( $p_version, $p_project_id ) === false; 154 } 155 156 /** 157 * Check whether the version exists 158 * Trigger an error if it does not 159 * @param int $p_version_id 160 */ 161 function version_ensure_exists( $p_version_id ) { 162 if( !version_exists( $p_version_id ) ) { 163 error_parameters( $p_version_id ); 164 trigger_error( ERROR_VERSION_NOT_FOUND, ERROR ); 165 } 166 } 167 168 /** 169 * Check whether the version is unique within a project 170 * Trigger an error if it is not 171 * @param string $p_version 172 * @param int $p_project_id 173 */ 174 function version_ensure_unique( $p_version, $p_project_id = null ) { 175 if( !version_is_unique( $p_version, $p_project_id ) ) { 176 trigger_error( ERROR_VERSION_DUPLICATE, ERROR ); 177 } 178 } 179 180 /** 181 * Add a version to the project 182 * @param int $p_project_id 183 * @param string $p_version 184 * @param int $p_released 185 * @param string $p_description 186 * @param int $p_date_order 187 * @param bool $p_obsolete 188 * @return int 189 */ 190 function version_add( $p_project_id, $p_version, $p_released = VERSION_FUTURE, $p_description = '', $p_date_order = null, $p_obsolete = false ) { 191 $c_project_id = db_prepare_int( $p_project_id ); 192 $c_released = db_prepare_int( $p_released ); 193 $c_obsolete = db_prepare_bool( $p_obsolete ); 194 195 if( null === $p_date_order ) { 196 $c_date_order = db_now(); 197 } else { 198 $c_date_order = $p_date_order; 199 } 200 201 version_ensure_unique( $p_version, $p_project_id ); 202 203 $t_project_version_table = db_get_table( 'project_version' ); 204 205 $query = "INSERT INTO $t_project_version_table 206 ( project_id, version, date_order, description, released, obsolete ) 207 VALUES 208 (" . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )'; 209 db_query_bound( $query, Array( $c_project_id, $p_version, $c_date_order, $p_description, $c_released, $c_obsolete ) ); 210 211 # db_query errors on failure so: 212 return db_insert_id( $t_project_version_table ); 213 } 214 215 /** 216 * Update the definition of a version 217 * @param VersionData @p_version_info 218 * @return true 219 */ 220 function version_update( $p_version_info ) { 221 version_ensure_exists( $p_version_info->id ); 222 223 $t_old_version_name = version_get_field( $p_version_info->id, 'version' ); 224 225 # check for duplicates 226 if(( utf8_strtolower( $t_old_version_name ) != utf8_strtolower( $p_version_info->version ) ) && !version_is_unique( $p_version_info->version, $p_version_info->project_id ) ) { 227 trigger_error( ERROR_VERSION_DUPLICATE, ERROR ); 228 } 229 230 $c_version_id = db_prepare_int( $p_version_info->id ); 231 $c_version_name = $p_version_info->version; 232 $c_old_version_name = $t_old_version_name; 233 $c_description = $p_version_info->description; 234 $c_released = db_prepare_int( $p_version_info->released ); 235 $c_obsolete = db_prepare_bool( $p_version_info->obsolete ); 236 $c_date_order = $p_version_info->date_order; 237 $c_project_id = db_prepare_int( $p_version_info->project_id ); 238 239 $t_project_version_table = db_get_table( 'project_version' ); 240 $t_bug_table = db_get_table( 'bug' ); 241 $t_history_table = db_get_table( 'bug_history' ); 242 243 $query = "UPDATE $t_project_version_table 244 SET version=" . db_param() . ", 245 description=" . db_param() . ", 246 released=" . db_param() . ", 247 date_order=" . db_param() . ", 248 obsolete=" . db_param() . " 249 WHERE id=" . db_param(); 250 db_query_bound( $query, Array( $c_version_name, $c_description, $c_released, $c_date_order, $c_obsolete, $c_version_id ) ); 251 252 if( $c_version_name != $c_old_version_name ) { 253 $t_project_list = array( $c_project_id ); 254 if ( config_get( 'subprojects_inherit_versions' ) ) { 255 $t_project_list = array_merge( $t_project_list, project_hierarchy_get_all_subprojects( $c_project_id, true ) ); 256 } 257 $t_project_list = implode( ',', $t_project_list ); 258 259 $query = 'UPDATE ' . $t_bug_table . ' SET version=' . db_param() . 260 " WHERE ( project_id IN ( $t_project_list ) ) AND ( version=" . db_param() . ')'; 261 db_query_bound( $query, Array( $c_version_name, $c_old_version_name ) ); 262 263 $query = "UPDATE $t_bug_table 264 SET fixed_in_version=" . db_param() . " 265 WHERE ( project_id IN ( $t_project_list ) ) AND ( fixed_in_version=" . db_param() . ')'; 266 db_query_bound( $query, Array( $c_version_name, $c_old_version_name ) ); 267 268 $query = "UPDATE $t_bug_table 269 SET target_version=" . db_param() . " 270 WHERE ( project_id IN ( $t_project_list ) ) AND ( target_version=" . db_param() . ')'; 271 db_query_bound( $query, Array( $c_version_name, $c_old_version_name ) ); 272 273 $query = "UPDATE $t_history_table 274 SET old_value=".db_param()." 275 WHERE field_name IN ('version','fixed_in_version','target_version') 276 AND old_value=".db_param()." 277 AND bug_id IN (SELECT id FROM $t_bug_table WHERE project_id IN ( $t_project_list ))"; 278 db_query_bound( $query, Array( $c_version_name, $c_old_version_name ) ); 279 280 $query = "UPDATE $t_history_table 281 SET new_value=".db_param()." 282 WHERE field_name IN ('version','fixed_in_version','target_version') 283 AND new_value=".db_param()." 284 AND bug_id IN (SELECT id FROM $t_bug_table WHERE project_id IN ( $t_project_list ))"; 285 db_query_bound( $query, Array( $c_version_name, $c_old_version_name ) ); 286 287 /** 288 * @todo We should consider using ids instead of names for foreign keys. The main advantage of using the names are: 289 * - for history the version history entries will still be valid even if the version is deleted in the future. -- we can ban deleting referenced versions. 290 * - when an issue is copied or moved from one project to another, we can keep the last version with the issue even if it doesn't exist in the new project. Also previous history entries remain valid. 291 * @todo We probably need to update the saved filters too? 292 */ 293 } 294 295 // db_query errors on failure so: 296 return true; 297 } 298 299 /** 300 * Remove a version from the project 301 * @param int $p_version_id 302 * @param string $p_new_version 303 * @return true 304 */ 305 function version_remove( $p_version_id, $p_new_version = '' ) { 306 $c_version_id = db_prepare_int( $p_version_id ); 307 308 version_ensure_exists( $p_version_id ); 309 310 $t_old_version = version_get_field( $p_version_id, 'version' ); 311 $t_project_id = version_get_field( $p_version_id, 'project_id' ); 312 $c_project_id = db_prepare_int( $t_project_id ); 313 314 $t_project_version_table = db_get_table( 'project_version' ); 315 $t_bug_table = db_get_table( 'bug' ); 316 317 $query = "DELETE FROM $t_project_version_table 318 WHERE id=" . db_param(); 319 db_query_bound( $query, Array( $c_version_id ) ); 320 321 $t_project_list = array( $c_project_id ); 322 if ( config_get( 'subprojects_inherit_versions' ) ) { 323 $t_project_list = array_merge( $t_project_list, project_hierarchy_get_all_subprojects( $c_project_id, true ) ); 324 } 325 $t_project_list = implode( ',', $t_project_list ); 326 327 $query = "UPDATE $t_bug_table 328 SET version=" . db_param() . " 329 WHERE project_id IN ( $t_project_list ) AND version=" . db_param(); 330 db_query_bound( $query, Array( $p_new_version, $t_old_version ) ); 331 332 $query = "UPDATE $t_bug_table 333 SET fixed_in_version=" . db_param() . " 334 WHERE ( project_id IN ( $t_project_list ) ) AND ( fixed_in_version=" . db_param() . ')'; 335 db_query_bound( $query, Array( $p_new_version, $t_old_version ) ); 336 337 $query = "UPDATE $t_bug_table 338 SET target_version=" . db_param() . " 339 WHERE ( project_id IN ( $t_project_list ) ) AND ( target_version=" . db_param() . ')'; 340 db_query_bound( $query, array( $p_new_version, $t_old_version ) ); 341 342 # db_query errors on failure so: 343 return true; 344 } 345 346 /** 347 * Remove all versions associated with a project 348 * @param int $p_project_id 349 * @return true 350 */ 351 function version_remove_all( $p_project_id ) { 352 $c_project_id = db_prepare_int( $p_project_id ); 353 354 $t_project_version_table = db_get_table( 'project_version' ); 355 $t_bug_table = db_get_table( 'bug' ); 356 357 # remove all references to versions from verison, fixed in version and target version. 358 $query = "UPDATE $t_bug_table 359 SET version='', fixed_in_version='', target_version='' 360 WHERE project_id=" . db_param(); 361 db_query_bound( $query, array( $c_project_id ) ); 362 363 # remove the actual versions associated with the project. 364 $query = "DELETE FROM $t_project_version_table 365 WHERE project_id=" . db_param(); 366 db_query_bound( $query, array( $c_project_id ) ); 367 368 # db_query errors on failure so: 369 return true; 370 } 371 372 $g_cache_versions_project = null; 373 374 /** 375 * Cache version information for an array of project id's 376 * @param array $p_project_id_array 377 * @return null 378 */ 379 function version_cache_array_rows( $p_project_id_array ) { 380 global $g_cache_versions, $g_cache_versions_project; 381 382 $c_project_id_array = array(); 383 384 foreach( $p_project_id_array as $t_project_id ) { 385 if( !isset( $g_cache_versions_project[(int) $t_project_id] ) ) { 386 $c_project_id_array[] = (int) $t_project_id; 387 $g_cache_versions_project[(int) $t_project_id] = array(); 388 } 389 } 390 391 if( empty( $c_project_id_array ) ) { 392 return; 393 } 394 395 $t_project_version_table = db_get_table( 'project_version' ); 396 397 $query = "SELECT * 398 FROM $t_project_version_table 399 WHERE project_id IN (" . implode( ',', $c_project_id_array ) . ') 400 ORDER BY date_order DESC'; 401 $result = db_query_bound( $query ); 402 403 $rows = array(); 404 while( $row = db_fetch_array( $result ) ) { 405 $g_cache_versions[(int) $row['id']] = $row; 406 407 $rows[ (int)$row[ 'project_id' ] ][] = $row['id']; 408 } 409 410 foreach( $rows as $t_project_id => $t_row ) { 411 $g_cache_versions_project[ (int)$t_project_id ] = $t_row; 412 } 413 return; 414 } 415 416 /** 417 * Return all versions for the specified project 418 * @param int $p_project_id 419 * @param int $p_released 420 * @param bool $p_obsolete 421 * @return array Array of version rows (in array format) 422 */ 423 function version_get_all_rows( $p_project_id, $p_released = null, $p_obsolete = false, $p_inherit = null ) { 424 global $g_cache_versions, $g_cache_versions_project; 425 426 if( isset( $g_cache_versions_project[ (int)$p_project_id ] ) ) { 427 if( !empty( $g_cache_versions_project[ (int)$p_project_id ]) ) { 428 foreach( $g_cache_versions_project[ (int)$p_project_id ] as $t_id ) { 429 $t_versions[] = version_cache_row( $t_id ); 430 } 431 return $t_versions; 432 } else { 433 return array(); 434 } 435 } 436 437 $c_project_id = db_prepare_int( $p_project_id ); 438 $t_project_version_table = db_get_table( 'project_version' ); 439 440 $t_param_count = 0; 441 442 $t_project_where = version_get_project_where_clause( $p_project_id, $p_inherit ); 443 444 $query = "SELECT * 445 FROM $t_project_version_table 446 WHERE $t_project_where"; 447 448 $query_params = array(); 449 450 if( $p_released !== null ) { 451 $c_released = db_prepare_int( $p_released ); 452 $query .= " AND released = " . db_param( $t_param_count++ ); 453 $query_params[] = $c_released; 454 } 455 456 if( $p_obsolete !== null ) { 457 $c_obsolete = db_prepare_bool( $p_obsolete ); 458 $query .= " AND obsolete = " . db_param( $t_param_count++ ); 459 $query_params[] = $c_obsolete; 460 } 461 462 $query .= " ORDER BY date_order DESC"; 463 464 $result = db_query_bound( $query, $query_params ); 465 $count = db_num_rows( $result ); 466 $rows = array(); 467 for( $i = 0;$i < $count;$i++ ) { 468 $row = db_fetch_array( $result ); 469 $g_cache_versions[(int) $row['id']] = $row; 470 471 $rows[] = $row; 472 } 473 return $rows; 474 } 475 476 /** 477 * Return all versions for the specified project, including subprojects 478 * @param int $p_project_id 479 * @param int $p_released 480 * @param bool $p_obsolete 481 * @return array 482 */ 483 function version_get_all_rows_with_subs( $p_project_id, $p_released = null, $p_obsolete = false ) { 484 $t_project_where = helper_project_specific_where( $p_project_id ); 485 486 $t_param_count = 0; 487 $t_query_params = array(); 488 489 if( $p_released === null ) { 490 $t_released_where = ''; 491 } else { 492 $c_released = db_prepare_int( $p_released ); 493 $t_released_where = "AND ( released = " . db_param( $t_param_count++ ) . " )"; 494 $t_query_params[] = $c_released; 495 } 496 497 if( $p_obsolete === null ) { 498 $t_obsolete_where = ''; 499 } else { 500 $c_obsolete = db_prepare_bool( $p_obsolete ); 501 $t_obsolete_where = "AND ( obsolete = " . db_param( $t_param_count++ ) . " )"; 502 $t_query_params[] = $c_obsolete; 503 } 504 505 $t_project_version_table = db_get_table( 'project_version' ); 506 507 $query = "SELECT * 508 FROM $t_project_version_table 509 WHERE $t_project_where $t_released_where $t_obsolete_where 510 ORDER BY date_order DESC"; 511 $result = db_query_bound( $query, $t_query_params ); 512 $count = db_num_rows( $result ); 513 $rows = array(); 514 for( $i = 0;$i < $count;$i++ ) { 515 $row = db_fetch_array( $result ); 516 $rows[] = $row; 517 } 518 return $rows; 519 } 520 521 /** 522 * Get the version_id, given the project_id and $p_version_id 523 * returns false if not found, otherwise returns the id. 524 * @param string $p_version 525 * @param int $p_project_id 526 * @param mixed $p_inherit true to look for version in parent projects, false not to, null to use default configuration. 527 * @return int 528 */ 529 function version_get_id( $p_version, $p_project_id = null, $p_inherit = null ) { 530 global $g_cache_versions; 531 532 if( $p_project_id === null ) { 533 $c_project_id = helper_get_current_project(); 534 } else { 535 $c_project_id = db_prepare_int( $p_project_id ); 536 } 537 538 foreach( $g_cache_versions as $t_version ) { 539 if(( $t_version['version'] === $p_version ) && ( $t_version['project_id'] == $c_project_id ) ) { 540 return $t_version['id']; 541 } 542 } 543 544 $t_project_where = version_get_project_where_clause( $c_project_id, $p_inherit ); 545 546 $t_project_version_table = db_get_table( 'project_version' ); 547 548 $query = "SELECT id FROM $t_project_version_table 549 WHERE " . $t_project_where . " AND 550 version=" . db_param(); 551 552 $result = db_query_bound( $query, Array( $p_version ) ); 553 554 if( 0 == db_num_rows( $result ) ) { 555 return false; 556 } else { 557 return db_result( $result ); 558 } 559 } 560 561 /** 562 * Get the specified field name for the specified version id. 563 * triggers an error if version not found, otherwise returns the field value. 564 * @param int $p_version_id 565 * @param string $p_field_name 566 * @return string 567 */ 568 function version_get_field( $p_version_id, $p_field_name ) { 569 $row = version_cache_row( $p_version_id ); 570 571 if( isset( $row[$p_field_name] ) ) { 572 return $row[$p_field_name]; 573 } else { 574 error_parameters( $p_field_name ); 575 trigger_error( ERROR_DB_FIELD_NOT_FOUND, WARNING ); 576 return ''; 577 } 578 } 579 580 /** 581 * Gets the full name of a version. This may include the project name as a prefix (e.g. '[MantisBT] 1.2.0') 582 * 583 * @param int $p_version_id The version id. 584 * @param bool $p_show_project Whether to include the project or not, null means include the project if different from current. 585 * @param int $p_current_project_id The current project id or null to use the cookie. 586 * @return string The full name of the version. 587 */ 588 function version_full_name( $p_version_id, $p_show_project = null, $p_current_project_id = null ) { 589 if ( 0 == $p_version_id ) { 590 # No Version 591 return ''; 592 } else { 593 $t_row = version_cache_row( $p_version_id ); 594 $t_project_id = $t_row['project_id']; 595 596 $t_current_project_id = is_null( $p_current_project_id ) ? helper_get_current_project() : $p_current_project_id; 597 598 if ( $p_show_project === null ) { 599 $t_show_project = $t_project_id != $t_current_project_id; 600 } else { 601 $t_show_project = $p_show_project; 602 } 603 604 if ( $t_show_project && $t_project_id != $t_current_project_id ) { 605 return '[' . project_get_name( $t_project_id ) . '] ' . $t_row['version']; 606 } 607 608 return $t_row['version']; 609 } 610 } 611 612 /** 613 * get information about a version given its id 614 * @param int $p_version_id 615 * @return VersionData 616 */ 617 function version_get( $p_version_id ) { 618 static $t_vars; 619 620 $row = version_cache_row( $p_version_id ); 621 622 if ($t_vars == null ) { 623 $t_reflection = new ReflectionClass('VersionData'); 624 $t_vars = $t_reflection->getDefaultProperties(); 625 } 626 627 $t_version_data = new VersionData; 628 $t_row_keys = array_keys( $row ); 629 630 # Check each variable in the class 631 foreach( $t_vars as $var => $val ) { 632 # If we got a field from the DB with the same name 633 if( in_array( $var, $t_row_keys, true ) ) { 634 # Store that value in the object 635 $t_version_data->$var = $row[$var]; 636 } 637 } 638 639 return $t_version_data; 640 } 641 642 /** 643 * Return a copy of the version structure with all the instvars prepared for db insertion 644 * @param VersionData $p_version_info 645 * @return VersionData 646 */ 647 function version_prepare_db( $p_version_info ) { 648 $p_version_info->id = db_prepare_int( $p_version_info->id ); 649 $p_version_info->project_id = db_prepare_int( $p_version_info->project_id ); 650 $p_version_info->released = db_prepare_int( $p_version_info->released ); 651 652 return $p_version_info; 653 } 654 655 /** 656 * Checks whether the product version should be shown 657 * (i.e. report, update, view, print). 658 * @param integer $p_project_id The project id. 659 * @return bool true: show, false: otherwise. 660 */ 661 function version_should_show_product_version( $p_project_id ) { 662 return ( ON == config_get( 'show_product_version', /* default */ null, /* user_id */ null, $p_project_id ) ) 663 || ( ( AUTO == config_get( 'show_product_version', /* default */ null, /* user_id */ null, $p_project_id ) ) 664 && ( count( version_get_all_rows( $p_project_id ) ) > 0 ) ); 665 } 666 667 /** 668 * Gets the where clause to use for retrieving versions. 669 * 670 * @param integer $p_project_id The project id to use. 671 * @param bool $p_inherit Include versions from parent projects? true: yes, false: no, null: use default configuration. 672 * @return string The where clause not including WHERE. 673 */ 674 function version_get_project_where_clause( $p_project_id, $p_inherit ) { 675 if ( $p_project_id == ALL_PROJECTS ) { 676 $t_inherit = false; 677 } else { 678 if ( $p_inherit === null ) { 679 $t_inherit = ( ON == config_get( 'subprojects_inherit_versions' ) ); 680 } else { 681 $t_inherit = $p_inherit; 682 } 683 } 684 685 $c_project_id = db_prepare_int( $p_project_id ); 686 687 if ( $t_inherit ) { 688 $t_project_ids = project_hierarchy_inheritance( $p_project_id ); 689 690 $t_project_where = ' project_id IN ( ' . implode( ', ', $t_project_ids ) . ' ) '; 691 } else { 692 $t_project_where = ' project_id=' . $c_project_id . ' '; 693 } 694 695 return $t_project_where; 696 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |