Ejemplo n.º 1
0
 /** Send an email to the administrator of the project */
 function SendEmailToAdmin($subject, $body)
 {
     if (!$this->Id) {
         echo "Project SendEmailToAdmin(): Id not set";
         return false;
     }
     include 'cdash/config.php';
     // Check if we should send emails
     $project = pdo_query("SELECT emailadministrator,name FROM project WHERE id =" . qnum($this->Id));
     if (!$project) {
         add_last_sql_error("Project SendEmailToAdmin", $this->Id);
         return false;
     }
     $project_array = pdo_fetch_array($project);
     if ($project_array['emailadministrator'] == 0) {
         return;
     }
     // Find the site maintainers
     include_once 'models/userproject.php';
     include_once 'models/user.php';
     $UserProject = new UserProject();
     $UserProject->ProjectId = $this->Id;
     $userids = $UserProject->GetUsers(2);
     // administrators
     $email = "";
     foreach ($userids as $userid) {
         $User = new User();
         $User->Id = $userid;
         if ($email != "") {
             $email .= ", ";
         }
         $email .= $User->GetEmail();
     }
     if ($email != "") {
         $projectname = $project_array['name'];
         $emailtitle = "CDash [" . $projectname . "] - Administration ";
         $emailbody = "Object: " . $subject . "\n";
         $emailbody .= $body . "\n";
         $serverName = $CDASH_SERVER_NAME;
         if (strlen($serverName) == 0) {
             $serverName = $_SERVER['SERVER_NAME'];
         }
         $emailbody .= "\n-CDash on " . $serverName . "\n";
         if (cdashmail("{$email}", $emailtitle, $emailbody, "From: CDash <" . $CDASH_EMAIL_FROM . ">\nReply-To: " . $CDASH_EMAIL_REPLY . "\nContent-type: text/plain; charset=utf-8\nX-Mailer: PHP/" . phpversion() . "\nMIME-Version: 1.0")) {
             add_log("email sent to: " . $email, "Project::SendEmailToAdmin");
             return;
         } else {
             add_log("cannot send email to: " . $email, "Project::SendEmailToAdmin", LOG_ERR, $this->Id);
         }
     }
     // end if email
 }
Ejemplo n.º 2
0
 /** Send an email to the administrator of the project */
 public function SendEmailToAdmin($subject, $body)
 {
     if (!$this->Id) {
         echo 'Project SendEmailToAdmin(): Id not set';
         return false;
     }
     include 'config/config.php';
     // Check if we should send emails
     $project = pdo_query('SELECT emailadministrator,name FROM project WHERE id =' . qnum($this->Id));
     if (!$project) {
         add_last_sql_error('Project SendEmailToAdmin', $this->Id);
         return false;
     }
     $project_array = pdo_fetch_array($project);
     if ($project_array['emailadministrator'] == 0) {
         return;
     }
     // Find the site maintainers
     $UserProject = new UserProject();
     $UserProject->ProjectId = $this->Id;
     $userids = $UserProject->GetUsers(2);
     // administrators
     $email = '';
     foreach ($userids as $userid) {
         $User = new User();
         $User->Id = $userid;
         if ($email != '') {
             $email .= ', ';
         }
         $email .= $User->GetEmail();
     }
     if ($email != '') {
         $projectname = $project_array['name'];
         $emailtitle = 'CDash [' . $projectname . '] - Administration ';
         $emailbody = 'Object: ' . $subject . "\n";
         $emailbody .= $body . "\n";
         $serverName = $CDASH_SERVER_NAME;
         if (strlen($serverName) == 0) {
             $serverName = $_SERVER['SERVER_NAME'];
         }
         $emailbody .= "\n-CDash on " . $serverName . "\n";
         if (cdashmail("{$email}", $emailtitle, $emailbody)) {
             add_log('email sent to: ' . $email, 'Project::SendEmailToAdmin');
             return;
         } else {
             add_log('cannot send email to: ' . $email, 'Project::SendEmailToAdmin', LOG_ERR, $this->Id);
         }
     }
 }
Ejemplo n.º 3
0
                    $xml .= add_XML_value("name", $User->GetName());
                    $xml .= add_XML_value("id", $authorid);
                    $xml .= "</author>";
                }
                $priority = $CoverageFile2User->GetPriority();
                if ($priority > 0) {
                    $xml .= add_XML_value("priority", $priority);
                }
                $xml .= "</file>";
            }
        }
        // end count(buildids)
        // List all the users of the project
        $UserProject = new UserProject();
        $UserProject->ProjectId = $Project->Id;
        $userIds = $UserProject->GetUsers();
        foreach ($userIds as $userid) {
            $User = new User();
            $User->Id = $userid;
            $xml .= "<user>";
            $xml .= add_XML_value("id", $userid);
            $xml .= add_XML_value("name", $User->GetName());
            $xml .= "</user>";
        }
        $xml .= "</project>";
    }
    $xml .= "</cdash>";
    // Now doing the xslt transition
    generate_XSLT($xml, "manageCoverage");
}
// end session OK
Ejemplo n.º 4
0
     echo 'Projectid or Schedule id not set';
     return;
 }
 if (isset($_GET['projectid'])) {
     $projectid = pdo_real_escape_numeric($_GET['projectid']);
 } else {
     $scheduleid = pdo_real_escape_numeric($_GET['scheduleid']);
     $ClientJobSchedule = new ClientJobSchedule();
     $ClientJobSchedule->Id = $scheduleid;
     $projectid = $ClientJobSchedule->GetProjectId();
 }
 if (!$User->IsAdmin()) {
     // Make sure user has project admin privileges to use this page
     $UserProject = new UserProject();
     $UserProject->ProjectId = $projectid;
     $projectAdmins = $UserProject->GetUsers(2);
     //get project admin users
     if (!in_array($userid, $projectAdmins)) {
         echo 'You are not a project administrator!';
         return;
     }
 }
 $xml = begin_XML_for_XSLT();
 $xml .= add_XML_value('manageclient', $CDASH_MANAGE_CLIENTS);
 $db = pdo_connect("{$CDASH_DB_HOST}", "{$CDASH_DB_LOGIN}", "{$CDASH_DB_PASS}");
 pdo_select_db("{$CDASH_DB_NAME}", $db);
 $xml .= add_XML_value('title', 'CDash - Schedule Build');
 $xml .= add_XML_value('menutitle', 'CDash');
 $xml .= add_XML_value('menusubtitle', 'Schedule Build');
 $xml .= '<hostname>' . $_SERVER['SERVER_NAME'] . '</hostname>';
 $xml .= '<date>' . date('r') . '</date>';