예제 #1
0
        <FORM action="?" method="POST">
        <INPUT TYPE="HIDDEN" NAME="action" VALUE="delete">
        <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="<?php 
        print $row_grp['group_id'];
        ?>
">
        <INPUT type="submit" name="submit" class="btn" value="<?php 
        echo $Language->getText('admin_approve_pending', 'delete');
        ?>
">
        </FORM>
            </TD>
            </TR>
            </TABLE>
        </fieldset><br />
        <?php 
    }
    //list of group_id's of pending projects
    $arr = result_column_to_array($res_grp, 0);
    $group_list = implode($arr, ',');
    echo '
        <CENTER>
        <FORM action="?" method="POST">
        <INPUT TYPE="HIDDEN" NAME="action" VALUE="activate">
        <INPUT TYPE="HIDDEN" NAME="list_of_groups" VALUE="' . $group_list . '">
        <INPUT type="submit" name="submit" class="btn btn-primary" value="' . $Language->getText('admin_approve_pending', 'approve_all') . '">
        </FORM>
        </center>
        ';
}
site_admin_footer(array());
예제 #2
0
     echo $hp->purify($row['register_purpose'], CODENDI_PURIFIER_CONVERT_HTML);
     ?>
 
     <br>
     &nbsp;
     <?php 
     // ########################## OTHER INFO
     print "<P><B>" . $Language->getText('admin_approve_pending_users', 'other_info') . "</B>";
     print "<br>&nbsp;&nbsp;" . $Language->getText('admin_approve_pending_users', 'name') . ": {$row['user_name']}";
     print "<br>&nbsp;&nbsp;" . $Language->getText('admin_approve_pending_users', 'id') . ":  {$row['user_id']}";
     print "<br>&nbsp;&nbsp;" . $Language->getText('admin_approve_pending_users', 'email') . ":  <a href=\"mailto:{$row['email']}\">{$row['email']}</a>";
     print "<br>&nbsp;&nbsp;" . $Language->getText('admin_approve_pending_users', 'reg_date') . ":  " . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $row['add_date']);
     echo "<P><HR><P>";
 }
 //list of user_id's of pending users
 $arr = result_column_to_array($res, 0);
 $user_list = implode(',', $arr);
 echo '
     <CENTER>
         <TABLE WIDTH="70%">
         <TR>';
 if ($GLOBALS['sys_user_approval'] != 1 || $page != 'pending') {
     echo '<TD>
         <FORM action="' . $PHP_SELF . '?page=' . $page . '" method="POST">
         ' . $Language->getText('admin_approve_pending_users', 'activate') . '
         ' . $Language->getText('admin_approve_pending_users', 'all_accounts') . ' ';
     if ($GLOBALS['sys_allow_restricted_users'] == 1) {
         echo $Language->getText('admin_approve_pending_users', 'status') . '
         <select name="status" size="1">
             <option value="standard" selected>' . $Language->getText('admin_approve_pending_users', 'status_standard') . '
             <option value="restricted" >' . $Language->getText('admin_approve_pending_users', 'status_restricted') . '        
예제 #3
0
function stats_sf_stats()
{
    global $sys_datefmt;
    /*
    	pages/day
    */
    $sql = "SELECT * FROM stats_agg_pages_by_day";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        echo '<H1>Stats Problem</H1>';
        echo db_error();
    } else {
        $j = 0;
        for ($i = 0; $i < $rows; $i++) {
            //echo $i." - ".($i%7)."<BR>";
            if ($i % 7 == 0) {
                //echo $i."<BR>";
                //increment the new weekly array
                //and set the beginning date for this week
                $j++;
                $name_string[$j] = db_result($result, $i, 'day');
                $vals[$j] = 0;
            }
            //add today to the week
            $vals[$j] += db_result($result, $i, 'count');
        }
        $j++;
        $vals[$j] = '';
        $name_string[$j] = '';
        GraphIt($name_string, $vals, 'Page Views By Week');
    }
    echo '<P>';
    /*
    	pages/hour
    * /
    	$sql="SELECT * FROM stats_agg_pages_by_hour";
    
    	$result = db_query ($sql);
    	$rows = db_numrows($result);
    
    	if (!$result || $rows < 1) {
    		echo '<H1>Stats Problem</H1>';
    		echo db_error();
    	} else {
    		GraphResult($result,'Page Views By Hour');
    	}
    	echo '<P>';
    */
    /*
    	Groups added by week
    */
    $sql = "select (round((register_time/604800),0)*604800) AS time ,count(*) from groups group by time";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        echo '<H1>Stats Problem</H1>';
        echo db_error();
    } else {
        $count = array();
        $dates = array();
        $count = result_column_to_array($result, 1);
        for ($i = 0; $i < $rows; $i++) {
            //convert the dates and add to an array
            $dates[$i] = date($sys_datefmt, db_result($result, $i, 0));
        }
        GraphIt($dates, $count, 'New Projects Added Each Week');
    }
    echo '<P>';
    /*
    	Users added by week
    */
    $sql = "select (round((add_date/604800),0)*604800) AS time ,count(*) from users group by time";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        echo '<H1>Stats Problem</H1>';
        echo db_error();
    } else {
        $count = array();
        $dates = array();
        $count = result_column_to_array($result, 1);
        for ($i = 0; $i < $rows; $i++) {
            //convert the dates and add to an array
            $dates[$i] = date($sys_datefmt, db_result($result, $i, 0));
        }
        GraphIt($dates, $count, 'New Users Added Each Week');
    }
    echo '<P>';
}
예제 #4
0
function stats_sf_stats()
{
    global $Language;
    /*
    	pages/day
    */
    $sql = "SELECT * FROM stats_agg_pages_by_day";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        echo '<H1>' . $Language->getText('include_stats_function', 'stats_problem') . '</H1>';
        echo db_error();
    } else {
        $j = 0;
        for ($i = 0; $i < $rows; $i++) {
            //echo $i." - ".($i%7)."<BR>";
            if ($i % 7 == 0) {
                //echo $i."<BR>";
                //increment the new weekly array
                //and set the beginning date for this week
                $j++;
                $name_string[$j] = db_result($result, $i, 'day');
                $vals[$j] = 0;
            }
            //add today to the week
            $vals[$j] += db_result($result, $i, 'count');
        }
        $j++;
        $vals[$j] = '';
        $name_string[$j] = '';
        GraphIt($name_string, $vals, $Language->getText('include_stats_function', 'view_by_week'));
    }
    echo '<P>';
    /*
    	pages/hour
    * /
    	$sql="SELECT * FROM stats_agg_pages_by_hour";
    
    	$result = db_query ($sql);
    	$rows = db_numrows($result);
    
    	if (!$result || $rows < 1) {
    		echo '<H1>'.$Language->getText('include_stats_function','stats_problem').'</H1>';
    		echo db_error();
    	} else {
    		GraphResult($result,$Language->getText('include_stats_function','view_by_hour'));
    	}
    	echo '<P>';
    */
    /*
    	Groups added by week
    */
    $sql = "select (round((register_time/604800),0)*604800) AS time ,count(*) from groups group by time";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        echo '<H1>' . $Language->getText('include_stats_function', 'stats_problem') . '</H1>';
        echo db_error();
    } else {
        $count = array();
        $dates = array();
        $count = result_column_to_array($result, 1);
        for ($i = 0; $i < $rows; $i++) {
            //convert the dates and add to an array
            $dates[$i] = format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 0));
        }
        GraphIt($dates, $count, $Language->getText('include_stats_function', 'new_proj_added'));
    }
    echo '<P>';
    /*
    	Users added by week
    */
    $sql = "select (round((add_date/604800),0)*604800) AS time ,count(*) from user group by time";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        echo '<H1>' . $Language->getText('include_stats_function', 'stats_problem') . '</H1>';
        echo db_error();
    } else {
        $count = array();
        $dates = array();
        $count = result_column_to_array($result, 1);
        for ($i = 0; $i < $rows; $i++) {
            //convert the dates and add to an array
            $dates[$i] = format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 0));
        }
        GraphIt($dates, $count, $Language->getText('include_stats_function', 'new_user_added'));
    }
    echo '<P>';
}
예제 #5
0
    /**
     * Display forms to synchronize projects (site admin view)
     */
    private function _admin_synchronize_muc_and_grp()
    {
        $action = '';
        $nb_grp = 0;
        $nb_muc = 0;
        $im_dao = new IMDao(IMDataAccess::instance($this->getControler()));
        $res_grp = $im_dao->search_group_without_shared_group();
        $res_grp = $res_grp->query;
        $res_muc = $im_dao->search_group_without_muc();
        $res_muc = $res_muc->query;
        // number of shared group to synchronize
        $nb_grp = db_numrows($res_grp);
        // number of muc room to synchronize
        $nb_muc = db_numrows($res_muc);
        $array_grp = array();
        if ($nb_grp > 0) {
            $array_grp = result_column_to_array($res_grp, 0);
        }
        $array_muc = array();
        if ($nb_muc > 0) {
            $array_muc = result_column_to_array($res_muc, 0);
        }
        $array_muc_and_grp = array_intersect($array_grp, $array_muc);
        if (sizeof($array_muc_and_grp)) {
            $array_muc_only = array_diff($array_muc, $array_muc_and_grp);
            $array_grp_only = array_diff($array_grp, $array_muc_and_grp);
        } else {
            $array_muc_only = $array_muc;
            $array_grp_only = $array_grp;
        }
        $pm = ProjectManager::instance();
        $purifier = Codendi_HTMLPurifier::instance();
        echo '<fieldset>';
        echo '<legend class="im_synchronize">' . $GLOBALS["Language"]->getText('plugin_im_admin', 'projects_to_sync') . '</legend>';
        if ($nb_grp != 0 || $nb_muc) {
            //************form
            if (sizeof($array_muc_and_grp)) {
                foreach ($array_muc_and_grp as $key => $val) {
                    $project = $pm->getProject($val);
                    $unix_group_name = $purifier->purify(strtolower($project->getUnixName()));
                    $group_name = $purifier->purify($project->getPublicName());
                    $group_description = $purifier->purify($project->getDescription());
                    $grp = $pm->getProject($val);
                    // $val = group_id;
                    $group_id = $grp->getID();
                    $project_members_ids = $grp->getMembersId();
                    foreach ($project_members_ids as $key => $id) {
                        $group_Owner_object = UserManager::instance()->getUserById($id);
                        if ($group_Owner_object->isMember($val, 'A')) {
                            $group_Owner_name = $purifier->purify(trim($group_Owner_object->getName()));
                        }
                    }
                    //field label
                    $unix_group_name_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'unix_group_name_label');
                    $group_description_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'group_description_label');
                    $group_Owner_name_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'group_Owner_name_label');
                    $action_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'action_label');
                    //plugin_im_admin - unix_group_name_label
                    $action_on = $GLOBALS["Language"]->getText('plugin_im_admin', 'action_on_muc_and_grp');
                    echo '<fieldset>';
                    echo '<legend class="project_sync">' . $group_name . '</legend>';
                    echo $unix_group_name_label . $unix_group_name . '<br>';
                    echo $group_description_label . $group_description . '<br>';
                    echo $group_Owner_name_label . $group_Owner_name . '<br>';
                    echo $action_label . $action_on . '<br>';
                    echo '
					        <FORM class="project_sync" action="/plugins/IM/?action=codendi_im_admin" method="POST">
					         <INPUT TYPE="HIDDEN" NAME="action" VALUE="synchronize_muc_and_grp">
                             <INPUT TYPE="HIDDEN" NAME="unix_group_name" VALUE="' . $unix_group_name . '">
					         <INPUT TYPE="HIDDEN" NAME="group_name" VALUE="' . $group_name . '">
					         <INPUT TYPE="HIDDEN" NAME="group_id" VALUE=' . $group_id . '>
					         <INPUT TYPE="HIDDEN" NAME="group_description" VALUE="' . $group_description . '">
					       	 <INPUT TYPE="HIDDEN" NAME="group_Owner_name" VALUE="' . $group_Owner_name . '">
					       	 <INPUT type="submit" name="submit" value="' . $GLOBALS["Language"]->getText('plugin_im_admin', 'im_admin_synchro_muc') . '">
					        </FORM>
					        ';
                    echo '</fieldset>';
                }
            }
            if (sizeof($array_grp_only)) {
                $pm = ProjectManager::instance();
                foreach ($array_grp_only as $key => $val) {
                    $project = $pm->getProject($val);
                    $unix_group_name = $purifier->purify(strtolower($project->getUnixName()));
                    $group_name = $purifier->purify($project->getPublicName());
                    $group_description = $purifier->purify($project->getDescription());
                    $grp = $pm->getProject($val);
                    // $val = group_id;
                    $group_id = $grp->getID();
                    $project_members_ids = $grp->getMembersId();
                    foreach ($project_members_ids as $key => $id) {
                        $group_Owner_object = UserManager::instance()->getUserById($id);
                        if ($group_Owner_object->isMember($val, 'A')) {
                            $group_Owner_name = $purifier->purify($group_Owner_object->getName());
                        }
                    }
                    //field label
                    $unix_group_name_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'unix_group_name_label');
                    $group_description_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'group_description_label');
                    $group_Owner_name_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'group_Owner_name_label');
                    $action_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'action_label');
                    $action_on = $GLOBALS["Language"]->getText('plugin_im_admin', 'action_on_grp');
                    echo '<fieldset>';
                    echo '<legend class="project_sync">' . $group_name . '</legend>';
                    echo $unix_group_name_label . $unix_group_name . '<br>';
                    echo $group_description_label . $group_description . '<br>';
                    echo $group_Owner_name_label . $group_Owner_name . '<br>';
                    echo $action_label . $action_on . '<br>';
                    echo '
					        <FORM class="project_sync" action="/plugins/IM/?action=codendi_im_admin" method="POST">
					         <INPUT TYPE="HIDDEN" NAME="action" VALUE="synchronize_grp_only">
                             <INPUT TYPE="HIDDEN" NAME="unix_group_name" VALUE="' . $unix_group_name . '">
					         <INPUT TYPE="HIDDEN" NAME="group_name" VALUE="' . $group_name . '">
					         <INPUT TYPE="HIDDEN" NAME="group_id" VALUE=' . $group_id . '>
					         <INPUT TYPE="HIDDEN" NAME="group_description" VALUE="' . $group_description . '">
					      	 <INPUT TYPE="HIDDEN" NAME="group_Owner_name" VALUE="' . $group_Owner_name . '">
					     	 <INPUT type="submit" name="submit" value="' . $GLOBALS["Language"]->getText('plugin_im_admin', 'im_admin_synchro_muc') . '">
					        </FORM>
					        ';
                    echo '</fieldset>';
                }
            }
            if (sizeof($array_muc_only)) {
                $pm = ProjectManager::instance();
                foreach ($array_muc_only as $key => $val) {
                    $project = $pm->getProject($val);
                    $unix_group_name = $purifier->purify(strtolower($project->getUnixName()));
                    $group_name = $purifier->purify($project->getPublicName());
                    $group_description = $purifier->purify($project->getDescription());
                    $grp = $pm->getProject($val);
                    // $val = group_id;
                    $group_id = $grp->getID();
                    $project_members_ids = $grp->getMembersId();
                    foreach ($project_members_ids as $key => $id) {
                        $group_Owner_object = UserManager::instance()->getUserById($id);
                        if ($group_Owner_object->isMember($val, 'A')) {
                            $group_Owner_name = $purifier->purify($group_Owner_object->getName());
                        }
                    }
                    //field label
                    $unix_group_name_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'unix_group_name_label');
                    $group_description_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'group_description_label');
                    $group_Owner_name_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'group_Owner_name_label');
                    $action_label = $GLOBALS["Language"]->getText('plugin_im_admin', 'action_label');
                    $action_on = $GLOBALS["Language"]->getText('plugin_im_admin', 'action_on_muc');
                    echo '<fieldset>';
                    echo '<legend class="project_sync">' . $group_name . '</legend>';
                    echo $unix_group_name_label . $unix_group_name . '<br>';
                    echo $group_description_label . $group_description . '<br>';
                    echo $group_Owner_name_label . $group_Owner_name . '<br>';
                    echo $action_label . $action_on . '<br>';
                    echo '
					     <FORM class="project_sync" action="/plugins/IM/?action=codendi_im_admin" method="POST">
					      <INPUT TYPE="HIDDEN" NAME="action" VALUE="synchronize_muc_only">
                          <INPUT TYPE="HIDDEN" NAME="unix_group_name" VALUE="' . $unix_group_name . '">
					      <INPUT TYPE="HIDDEN" NAME="group_name" VALUE="' . $group_name . '">
					      <INPUT TYPE="HIDDEN" NAME="group_id" VALUE=' . $group_id . '>
					      <INPUT TYPE="HIDDEN" NAME="group_description" VALUE="' . $group_description . '">
					   	  <INPUT TYPE="HIDDEN" NAME="group_Owner_name" VALUE="' . $group_Owner_name . '">
					   	  <INPUT type="submit" name="submit" value="' . $GLOBALS["Language"]->getText('plugin_im_admin', 'im_admin_synchro_muc') . '">
					     </FORM>
					     ';
                    echo '</fieldset>';
                }
            }
            echo '
				 <FORM class="project_sync" action="/plugins/IM/?action=codendi_im_admin" method="POST">
				  <INPUT TYPE="HIDDEN" NAME="action" VALUE="synchronize_all"> 
				  <INPUT type="submit" name="submit" value="' . $GLOBALS["Language"]->getText('plugin_im_admin', 'im_admin_synchro_all') . '">
				 </FORM>';
        } else {
            echo $GLOBALS["Language"]->getText('plugin_im_admin', 'no_project_to_synchronized');
        }
        echo '</fieldset>';
    }
예제 #6
0
function mail_followup($support_id, $more_addresses = false)
{
    global $sys_datefmt, $feedback;
    /*
    	Send a message to the person who opened this support and the person it is assigned to
    */
    $sql = "SELECT support.priority,support.group_id,support.support_id,support.summary," . "support_status.status_name,support_category.category_name,support.open_date, " . "users.email,user2.email AS assigned_to_email " . "FROM support,users,users user2,support_status,support_category " . "WHERE user2.user_id=support.assigned_to " . "AND support.support_status_id=support_status.support_status_id " . "AND support.support_category_id=support_category.support_category_id " . "AND users.user_id=support.submitted_by " . "AND support.support_id='{$support_id}'";
    $result = db_query($sql);
    if ($result && db_numrows($result) > 0) {
        /*
        	Set up the body
        */
        $body = "\n\nSupport Request #" . db_result($result, 0, 'support_id') . ", was updated on " . date($sys_datefmt, db_result($result, 0, 'open_date')) . "\nYou can respond by visiting: " . "\nhttp://" . $GLOBALS['sys_default_host'] . "/support/?func=detailsupport&support_id=" . db_result($result, 0, "support_id") . "&group_id=" . db_result($result, 0, "group_id") . "\n\nCategory: " . db_result($result, 0, 'category_name') . "\nStatus: " . db_result($result, 0, 'status_name') . "\nPriority: " . db_result($result, 0, 'priority') . "\nSummary: " . util_unconvert_htmlspecialchars(db_result($result, 0, 'summary'));
        $subject = "[Support #" . db_result($result, 0, "support_id") . "] " . util_unconvert_htmlspecialchars(db_result($result, 0, "summary"));
        /*      
        	get all the email addresses that have dealt with this request
        */
        $email_res = db_query("SELECT distinct from_email FROM support_messages WHERE support_id='{$support_id}'");
        $rows = db_numrows($email_res);
        if ($email_res && $rows > 0) {
            $mail_arr = result_column_to_array($email_res, 0);
            $emails = implode($mail_arr, ', ');
        }
        if ($more_addresses) {
            $emails .= ',' . $more_addresses;
        }
        /*
        	Now include the two most recent emails
        */
        $sql = "select * " . "FROM support_messages " . "WHERE support_id='{$support_id}' ORDER BY date DESC";
        $result2 = db_query($sql, 2);
        $rows = db_numrows($result2);
        if ($result && $rows > 0) {
            for ($i = 0; $i < $rows; $i++) {
                //get the first part of the email address
                $email_arr = explode('@', db_result($result2, $i, 'from_email'));
                $body .= "\n\nBy: " . $email_arr[0] . "\nDate: " . date($sys_datefmt, db_result($result2, $i, 'date')) . "\n\nMessage:" . "\n" . util_unconvert_htmlspecialchars(db_result($result2, $i, 'body')) . "\n\n----------------------------------------------------------------------";
            }
            $body .= "\nYou can respond by visiting: " . "\nhttp://{$GLOBALS['sys_default_host']}/support/?func=detailsupport&support_id=" . db_result($result, 0, 'support_id') . "&group_id=" . db_result($result, 0, 'group_id');
        }
        //attach the headers to the body
        $body = "To: noreply@{$GLOBALS['sys_default_domain']}" . "\nBCC: {$emails}" . "\nSubject: {$subject}" . $body;
        /*      
        	Send the email
        */
        exec("/bin/echo \"" . util_prep_string_for_sendmail($body) . "\" | {$GLOBALS['sys_sendmail_path']} -fnoreply@{$GLOBALS['sys_default_domain']} -t &");
        $feedback .= " Support Request Update Emailed ";
    } else {
        $feedback .= " Could Not Send Support Request Update ";
        echo db_error();
    }
}
예제 #7
0
         $feedback .= ' Nothing Updated ';
     }
 } else {
     if ($add) {
         //inserting a new diary entry
         $sql = "INSERT INTO user_diary (user_id,date_posted,summary,details,is_public) VALUES " . "('" . user_getid() . "','" . time() . "','" . htmlspecialchars($summary) . "','" . htmlspecialchars($details) . "','{$is_public}')";
         $res = db_query($sql);
         if ($res && db_affected_rows($res) > 0) {
             $feedback .= ' Item Added ';
             if ($is_public) {
                 //send an email if users are monitoring
                 $sql = "SELECT users.email from user_diary_monitor,users " . "WHERE user_diary_monitor.user_id=users.user_id " . "AND user_diary_monitor.monitored_user='******'";
                 $result = db_query($sql);
                 $rows = db_numrows($result);
                 if ($result && $rows > 0) {
                     $tolist = implode(result_column_to_array($result), ', ');
                     $body = "To: noreply@{$GLOBALS['sys_default_domain']}" . "\nBCC: {$tolist}" . "\nSubject: [ SF User Notes: " . user_getrealname(user_getid()) . "] " . stripslashes($summary) . "\n\n" . util_line_wrap(stripslashes($details)) . "\n\n______________________________________________________________________" . "\nYou are receiving this email because you elected to monitor this user." . "\nTo stop monitoring this user, login to " . $GLOBALS['sys_default_name'] . " and visit: " . "\nhttp://{$GLOBALS['sys_default_host']}/developer/monitor.php?user="******"/bin/echo \"" . util_prep_string_for_sendmail($body) . "\" | {$GLOBALS['sys_sendmail_path']} -fnoreply@{$GLOBALS['sys_default_domain']} -t -i >& /dev/null &");
                     $feedback .= " email sent - ({$rows}) people monitoring ";
                 } else {
                     $feedback .= ' email not sent - no one monitoring ';
                     echo db_error();
                 }
             } else {
                 //don't send an email to monitoring users
                 //since this is a private note
             }
         } else {
             $feedback .= ' Error Adding Item ';
             echo db_error();
         }
예제 #8
0
function handle_monitoring($forum_id, $thread_id, $msg_id)
{
    global $feedback, $sys_lf, $Language;
    /*
    	Checks to see if anyone is monitoring this forum
    	If someone is, it sends them the message in email format
    */
    $res = news_read_permissions($forum_id);
    if (db_numrows($res) < 1) {
        //check if there are users monitoring specific threads
        $sql = sprintf('(SELECT user.email FROM forum_monitored_forums,user' . ' WHERE forum_monitored_forums.user_id=user.user_id' . ' AND forum_monitored_forums.forum_id=%d' . ' AND ( user.status="A" OR user.status="R" ))' . ' UNION (SELECT user.email FROM forum_monitored_threads,user' . ' WHERE forum_monitored_threads.user_id=user.user_id' . ' AND forum_monitored_threads.forum_id=%d' . ' AND forum_monitored_threads.thread_id=%d' . ' AND ( user.status="A" OR user.status="R" ))', db_ei($forum_id), db_ei($forum_id), db_ei($thread_id));
    } else {
        //we are dealing with private news, only project members are allowed to monitor
        $qry1 = "SELECT group_id FROM news_bytes WHERE forum_id=" . db_ei($forum_id);
        $res1 = db_query($qry1);
        $gr_id = db_result($res1, 0, 'group_id');
        $sql = "SELECT user.email from forum_monitored_forums,user_group,user" . " WHERE forum_monitored_forums.forum_id=" . db_ei($forum_id) . " AND user_group.group_id=" . db_ei($gr_id) . " AND forum_monitored_forums.user_id=user_group.user_id AND user_group.user_id=user.user_id";
    }
    $result = db_query($sql);
    $rows = db_numrows($result);
    if ($result && $rows > 0) {
        $tolist = implode(result_column_to_array($result), ', ');
        $sql = "SELECT groups.unix_group_name,user.user_name,user.realname,forum_group_list.forum_name," . "forum.group_forum_id,forum.thread_id,forum.subject,forum.date,forum.body " . "FROM forum,user,forum_group_list,groups " . "WHERE user.user_id=forum.posted_by " . "AND forum_group_list.group_forum_id=forum.group_forum_id " . "AND groups.group_id=forum_group_list.group_id " . "AND forum.msg_id=" . db_ei($msg_id);
        $result = db_query($sql);
        if ($result && db_numrows($result) > 0) {
            list($host, $port) = explode(':', $GLOBALS['sys_default_domain']);
            $mail = new Mail();
            $mail->setFrom($GLOBALS['sys_noreply']);
            $mail->setSubject("[" . db_result($result, 0, 'unix_group_name') . " - " . util_unconvert_htmlspecialchars(db_result($result, 0, 'forum_name')) . " - " . db_result($result, 0, 'user_name') . "] " . util_unconvert_htmlspecialchars(db_result($result, 0, 'subject')));
            $mail->setBcc($tolist);
            $url1 = get_server_url() . "/forum/monitor.php?forum_id=" . $forum_id;
            $url2 = get_server_url() . "/forum/monitor_thread.php?forum_id=" . $forum_id;
            $body = $Language->getText('forum_forum_utils', 'read_and_respond') . ": " . "\n" . get_server_url() . "/forum/message.php?msg_id=" . $msg_id . "\n" . $Language->getText('global', 'by') . ' ' . db_result($result, 0, 'user_name') . ' (' . db_result($result, 0, 'realname') . ')' . "\n\n" . util_unconvert_htmlspecialchars(db_result($result, 0, 'body')) . "\n\n______________________________________________________________________" . "\n" . $Language->getText('forum_forum_utils', 'stop_monitor_explain', array($url1, $url2));
            $mail->setBody($body);
            if ($mail->send()) {
                $feedback .= ' - ' . $Language->getText('forum_forum_utils', 'mail_sent');
            } else {
                //ERROR
                $feedback .= ' - ' . $GLOBALS['Language']->getText('global', 'mail_failed', array($GLOBALS['sys_email_admin']));
            }
            if (forum_is_monitored($forum_id) || forum_thread_is_monitored($thread_id)) {
                $feedback .= ' - ' . $Language->getText('forum_forum_utils', 'people_monitoring');
            }
        } else {
            $feedback .= ' ' . $Language->getText('forum_forum_utils', 'mail_not_sent') . ' ';
            echo db_error();
        }
    } else {
        $feedback .= ' ' . $Language->getText('forum_forum_utils', 'mail_not_sent') . ' - ' . $Language->getText('forum_forum_utils', 'no_one_monitoring') . ' ';
        echo db_error();
    }
}
예제 #9
0
/**
 *	assumes $send_all_posts_to var is set up
 */
function handle_monitoring($forum_id, $msg_id)
{
    global $feedback, $send_all_posts_to;
    /*
    	Checks to see if anyone is monitoring this forum
    	If someone is, it sends them the message in email format
    */
    $sql = "SELECT users.email from forum_monitored_forums,users " . "WHERE forum_monitored_forums.user_id=users.user_id AND forum_monitored_forums.forum_id='{$forum_id}'";
    $result = db_query($sql);
    $rows = db_numrows($result);
    if ($result && $rows > 0 || $send_all_posts_to) {
        $tolist = $send_all_posts_to . ', ' . implode(result_column_to_array($result), ', ');
        $sql = "SELECT groups.unix_group_name,users.user_name,forum_group_list.forum_name," . "forum.group_forum_id,forum.thread_id,forum.subject,forum.date,forum.body " . "FROM forum,users,forum_group_list,groups " . "WHERE users.user_id=forum.posted_by " . "AND forum_group_list.group_forum_id=forum.group_forum_id " . "AND groups.group_id=forum_group_list.group_id " . "AND forum.msg_id='{$msg_id}'";
        $result = db_query($sql);
        if ($result && db_numrows($result) > 0) {
            $body = "To: noreply@{$GLOBALS['sys_default_domain']}" . "\nBCC: {$tolist}" . "\nSubject: [" . db_result($result, 0, 'unix_group_name') . " - " . db_result($result, 0, 'forum_name') . "] " . util_unconvert_htmlspecialchars(db_result($result, 0, 'subject')) . "\n\nRead and respond to this message at: " . "\nhttp://{$GLOBALS['sys_default_host']}/forum/message.php?msg_id=" . $msg_id . "\nBy: " . db_result($result, 0, 'user_name') . "\n\n" . util_line_wrap(util_unconvert_htmlspecialchars(db_result($result, 0, 'body'))) . "\n\n______________________________________________________________________" . "\nYou are receiving this email because you elected to monitor this forum." . "\nTo stop monitoring this forum, login to " . $GLOBALS['sys_default_name'] . " and visit: " . "\nhttp://{$GLOBALS['sys_default_host']}/forum/monitor.php?forum_id={$forum_id}";
            // echo "<pre>/bin/echo \"". util_prep_string_for_sendmail($body) ."\" | $GLOBALS[sys_sendmail_path] -fnoreply@$GLOBALS[sys_default_name] -t</pre>";
            exec("/bin/echo \"" . util_prep_string_for_sendmail($body) . "\" | {$GLOBALS['sys_sendmail_path']} -fnoreply@{$GLOBALS['sys_default_domain']} -t &");
            $feedback .= ' email sent - people monitoring ';
        } else {
            $feedback .= ' email not sent - people monitoring ';
            echo db_error();
        }
    } else {
        $feedback .= ' email not sent - no one monitoring ';
        echo db_error();
    }
}
예제 #10
0
function mail_followup($project_task_id, $group_project_id, $more_addresses = 0, $new_task = 0)
{
    global $sys_datefmt, $feedback;
    /*
    	
    		Send a message to the person who opened this task and the person(s) it is assigned to
    	Accepts the unique id of a task, its group project id and optionally a list of additional addresses to send to
    */
    $sql = "SELECT project_task.*, project_group_list.*, groups.group_name,groups.new_task_address, " . "groups.send_all_tasks,project_status.status_name,users.email, " . "users.user_name AS creator_name " . "FROM project_task,project_group_list,project_status,users,groups " . "WHERE project_task_id='{$project_task_id}' " . "AND project_task.group_project_id='{$group_project_id}' " . "AND project_task.status_id=project_status.status_id " . "AND project_task.group_project_id=project_group_list.group_project_id " . "AND groups.group_id=project_group_list.group_id " . "AND project_task.created_by=users.user_id";
    $result = db_query($sql);
    if ($result && db_numrows($result) > 0) {
        // Send a message to the task creator
        $to = db_result($result, 0, 'email');
        // Build the list of developers assigned this task
        $sql = "SELECT users.email AS Email,users.user_name " . "FROM users,project_assigned_to " . "WHERE project_assigned_to.project_task_id='{$project_task_id}' " . "AND users.user_id=project_assigned_to.assigned_to_id";
        $result3 = db_query($sql);
        $rows = db_numrows($result3);
        if ($result3 && $rows > 0) {
            // 2003-04-10 missing comma in list added by helix
            $to .= ', ' . implode(result_column_to_array($result3), ', ');
        }
        $body = "Task #" . db_result($result, 0, "project_task_id") . " has been updated. " . "\n\nProject: " . db_result($result, 0, 'group_name') . "\nSubproject: " . db_result($result, 0, 'project_name') . "\nSummary: " . util_unconvert_htmlspecialchars(db_result($result, 0, 'summary')) . "\nPercent Complete: " . db_result($result, 0, 'percent_complete') . "%" . "\nStatus: " . db_result($result, 0, 'status_name') . "\nAuthority  : " . db_result($result, 0, 'creator_name') . "\nAssigned to: " . $assignees . "\n\nDescription: " . db_result($result, 0, 'details');
        /*      
        	Now get the followups to this task
        */
        $sql = "SELECT project_history.field_name,project_history.old_value,project_history.date,users.user_name " . "FROM project_history,users " . "WHERE project_history.mod_by=users.user_id AND project_history.field_name = 'details' " . "AND project_task_id='{$project_task_id}' ORDER BY project_history.date DESC";
        $result2 = db_query($sql);
        $rows = db_numrows($result2);
        if ($result2 && $rows > 0) {
            $body .= "\n\nFollow-Ups:";
            for ($i = 0; $i < $rows; $i++) {
                $body .= "\n\n-------------------------------------------------------";
                $body .= "\nDate: " . date($sys_datefmt, db_result($result2, $i, 'date'));
                $body .= "\nBy: " . db_result($result2, $i, 'user_name');
                $body .= "\n\nComment:\n" . util_unconvert_htmlspecialchars(db_result($result2, $i, 'old_value'));
            }
        }
        $body .= "\n\n-------------------------------------------------------" . "\nFor more info, visit:" . "\n\nhttp://{$GLOBALS['sys_default_host']}/pm/task.php?func=detailtask&project_task_id=" . db_result($result, 0, 'project_task_id') . "&group_id=" . db_result($result, 0, 'group_id') . "&group_project_id=" . db_result($result, 0, 'group_project_id');
        $subject = "[Task #" . db_result($result, 0, 'project_task_id') . '] ' . util_unconvert_htmlspecialchars(db_result($result, 0, 'summary'));
        // Append the list of additional receiptients
        if ($more_addresses) {
            $to .= ', ' . $more_addresses;
        }
        // If this is a new task, or if send all tasks == 1,
        // append the new_task_address for the group
        // 2003-04-10 append only if new_task_address exists by helix
        if ($new_task || db_result($result, 0, 'send_all_tasks')) {
            if (db_result($result, 0, 'new_task_address')) {
                $to .= ', ' . db_result($result, 0, 'new_task_address');
            }
        }
        $more = 'From: noreply@' . $GLOBALS['sys_default_domain'];
        mail($to, $subject, $body, $more);
        $feedback .= " Task Update Sent ";
    } else {
        $feedback .= " Could Not Send Task Update ";
        echo db_error();
    }
}