Exemplo n.º 1
0
 /**
  * Method used to simulate array_map()'s functionality in a deeply nested
  * array. The PHP built-in function does not allow that.
  *
  * @access  public
  * @param   array $in_array The array to run the function against
  * @param   string $in_func The function to run
  * @param   array $in_args The array of arguments to pass to the function
  * @param   integer $in_index Internal parameter to specify which index of the array we are currently mapping
  * @return  array The mapped array
  */
 function array_map_deep(&$in_array, $in_func, $in_args = array(), $in_index = 1)
 {
     // fix people from messing up the index of the value
     if ($in_index < 1) {
         $in_index = 1;
     }
     foreach (array_keys($in_array) as $key) {
         // we need a reference, not a copy, normal foreach won't do
         $value =& $in_array[$key];
         // we need to copy args because we are doing
         // manipulation on it farther down
         $args = $in_args;
         if (is_array($value)) {
             Misc::array_map_deep($value, $in_func, $in_args, $in_index);
         } else {
             array_splice($args, $in_index - 1, $in_index - 1, $value);
             $value = call_user_func_array($in_func, $args);
         }
     }
     return $in_array;
 }
Exemplo n.º 2
0
 /**
  * Checks on the status of the MySQL database.
  *
  * @access  public
  */
 function checkDatabase()
 {
     // try to connect to the database
     $dsn = array('phptype' => APP_SQL_DBTYPE, 'hostspec' => APP_SQL_DBHOST, 'database' => APP_SQL_DBNAME, 'username' => APP_SQL_DBUSER, 'password' => APP_SQL_DBPASS);
     $dbh = DB::connect($dsn);
     if (PEAR::isError($dbh)) {
         echo "ERROR: Could not connect to the mysql database. Detailed error message:\n\n";
         echo $dbh->getMessage() . '/' . $dbh->getDebugInfo();
     } else {
         $required_tables = array("custom_field", "custom_field_option", "custom_filter", "customer_account_manager", "customer_note", "email_account", "email_draft", "email_draft_recipient", "email_response", "faq", "faq_support_level", "group", "history_type", "irc_notice", "issue", "issue_association", "issue_attachment", "issue_attachment_file", "issue_checkin", "issue_custom_field", "issue_history", "issue_quarantine", "issue_requirement", "issue_user", "issue_user_replier", "mail_queue", "mail_queue_log", "news", "note", "phone_support", "project", "project_category", "project_custom_field", "project_email_response", "project_group", "project_news", "project_phone_category", "project_priority", "project_release", "project_round_robin", "project_status", "project_status_date", "project_user", "reminder_action", "reminder_action_list", "reminder_action_type", "reminder_field", "reminder_history", "reminder_level", "reminder_level_condition", "reminder_operator", "reminder_priority", "reminder_requirement", "reminder_triggered_action", "resolution", "round_robin_user", "search_profile", "status", "subscription", "subscription_type", "support_email", "support_email_body", "time_tracking", "time_tracking_category", "user");
         // add the table prefix to all of the required tables
         $required_tables = Misc::array_map_deep($required_tables, array('Monitor', '_add_table_prefix'));
         // check if all of the required tables are really there
         $stmt = "SHOW TABLES";
         $table_list = $dbh->getCol($stmt);
         for ($i = 0; $i < count($required_tables); $i++) {
             if (!in_array($required_tables[$i], $table_list)) {
                 echo "ERROR: Could not find required table '" . $required_tables[$i] . "'\n";
             }
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Checks on the status of the MySQL database.
  *
  * @return  integer Number of errors encountered.
  */
 public static function checkDatabase()
 {
     $required_tables = array('custom_field', 'custom_field_option', 'custom_filter', 'customer_account_manager', 'customer_note', 'email_account', 'email_draft', 'email_draft_recipient', 'email_response', 'faq', 'faq_support_level', 'group', 'history_type', 'irc_notice', 'issue', 'issue_association', 'issue_attachment', 'issue_attachment_file', 'issue_checkin', 'issue_custom_field', 'issue_history', 'issue_quarantine', 'issue_requirement', 'issue_user', 'issue_user_replier', 'mail_queue', 'mail_queue_log', 'news', 'note', 'phone_support', 'project', 'project_category', 'project_custom_field', 'project_email_response', 'project_group', 'project_news', 'project_phone_category', 'project_priority', 'project_release', 'project_round_robin', 'project_status', 'project_status_date', 'project_user', 'reminder_action', 'reminder_action_list', 'reminder_action_type', 'reminder_field', 'reminder_history', 'reminder_level', 'reminder_level_condition', 'reminder_operator', 'reminder_priority', 'reminder_requirement', 'reminder_triggered_action', 'resolution', 'round_robin_user', 'search_profile', 'status', 'subscription', 'subscription_type', 'support_email', 'support_email_body', 'time_tracking', 'time_tracking_category', 'user');
     // add the table prefix to all of the required tables
     $required_tables = Misc::array_map_deep($required_tables, array(__CLASS__, 'add_table_prefix'));
     // check if all of the required tables are really there
     $stmt = 'SHOW TABLES';
     $table_list = DB_Helper::getInstance()->getColumn($stmt);
     $errors = 0;
     foreach ($required_tables as $table) {
         if (!in_array($table, $table_list)) {
             echo ev_gettext('ERROR: Could not find required table "%s"', $table), "\n";
             $errors++;
         }
     }
     return $errors;
 }
Exemplo n.º 4
0
// |                                                                      |
// | You should have received a copy of the GNU General Public License    |
// | along with this program; if not, write to:                           |
// |                                                                      |
// | Free Software Foundation, Inc.                                       |
// | 59 Temple Place - Suite 330                                          |
// | Boston, MA 02111-1307, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <*****@*****.**>                             |
// +----------------------------------------------------------------------+
//
// @(#) $Id: s.cvs_ping.php 1.4 03/01/16 01:47:31-00:00 jpm $
//
include_once "config.inc.php";
include_once APP_INC_PATH . "class.misc.php";
include_once APP_INC_PATH . "class.scm.php";
include_once APP_INC_PATH . "class.workflow.php";
include_once APP_INC_PATH . "db_access.php";
$HTTP_GET_VARS = Misc::array_map_deep($HTTP_GET_VARS, 'base64_decode');
foreach ($HTTP_GET_VARS['issue'] as $issue_id) {
    $files = array();
    for ($y = 0; $y < count($HTTP_GET_VARS['files']); $y++) {
        SCM::logCheckin($issue_id, $y);
        $files[] = array('file' => $HTTP_GET_VARS['files'][$y], 'old_version' => $HTTP_GET_VARS['old_versions'][$y], 'new_version' => $HTTP_GET_VARS['new_versions'][$y]);
    }
    $prj_id = Issue::getProjectID($issue_id);
    $module = $HTTP_GET_VARS['module'];
    $username = $HTTP_GET_VARS['username'];
    $commit_msg = $HTTP_GET_VARS['commit_msg'];
    Workflow::handleSCMCheckins($prj_id, $issue_id, $module, $files, $username, $commit_msg);
}