Example #1
0
/**
 * Module of support routines for Site Admin
 *
 * Copyright 1999-2001 (c) VA Linux Systems
 *
 * @version   $Id$
 *
 * This file is part of GForge.
 *
 * GForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GForge is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
function site_admin_header($params)
{
    global $feedback, $HTML;
    session_require(array('group' => '1', 'admin_flags' => 'A'));
    $HTML->header($params);
    echo html_feedback_top($feedback);
}
Example #2
0
function site_admin_header($params)
{
    global $HTML, $Language;
    global $feedback;
    $HTML->header($params);
    echo html_feedback_top($feedback);
    $version = trim(file_get_contents($GLOBALS['codendi_dir'] . '/VERSION'));
    echo '<H2>' . $Language->getText('admin_utils', 'title', array($GLOBALS['sys_name'])) . ' (' . $version . ')' . '</H2>';
}
Example #3
0
/**
 * FusionForge reporting system
 *
 * Copyright 2003-2004, Tim Perdue/GForge, LLC
 *
 * This file is part of FusionForge.
 *
 * FusionForge is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 * 
 * FusionForge is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with FusionForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */
function report_header($title)
{
    global $HTML, $sys_name;
    echo $HTML->header(array('title' => " " . _('Reporting') . ": " . $title));
    if (isset($GLOBALS['feedback'])) {
        echo html_feedback_top($GLOBALS['feedback']);
    }
    echo "<h2>" . sprintf(_('%1$s Reporting'), $sys_name) . "</h2><p>";
}
Example #4
0
/**
 *  goodbye - Just prints a message and a close button.
 *
 *  @param  string	 The message.
 */
function goodbye($msg)
{
    site_header(array('title' => _('Attachments')));
    html_feedback_top($msg);
    echo '<p><p><center><form method="post"><input type="button" value="Close Window" onclick="window.close()"></form></center>';
    site_footer(array());
    exit;
    /*echo "<center>" . $msg . "</center><p>";
    	die ('<center><form method="post"><input type="button" value="Close Window" onclick="window.close()"></form></center>');*/
}
Example #5
0
function site_admin_header($params)
{
    global $HTML;
    global $feedback;
    $HTML->header($params);
    echo html_feedback_top($feedback);
    echo '<H2>' . $GLOBALS['sys_default_name'] . ' Site Admin</H2>
	<P><A HREF="/admin/">Site Admin Home</A>
	<P>';
}
Example #6
0
function snippet_header($params)
{
    global $is_snippet_page, $HTML, $feedback, $Language;
    if ($GLOBALS['sys_use_snippet'] == 0) {
        exit_permission_denied();
    }
    // LJ used so the search box will add the necessary element to the pop-up box
    // Codendi Specific
    $is_snippet_page = 1;
    $HTML->header($params);
    /*
    	Show horizontal links
    */
    echo '<H2>' . $params['title'] . '</H2>';
    echo '<P><B>';
    echo '<A HREF="/snippet/">' . $Language->getText('snippet_utils', 'browse') . '</A>
		 | <A HREF="/snippet/submit.php">' . $Language->getText('snippet_utils', 'create_s') . '</A>
		 | <A HREF="/snippet/package.php">' . $Language->getText('snippet_utils', 'create_p') . '</A></B>';
    if (isset($params['help']) && $params['help']) {
        echo ' | ' . help_button($params['help'], false, $Language->getText('global', 'help'));
    }
    echo '<P>';
    html_feedback_top($feedback);
}
Example #7
0
function site_header($params)
{
    global $HTML;
    /*
                Check to see if active user
                Check to see if logged in
    */
    if (isset($params['group'])) {
        $pm = ProjectManager::instance();
        $project = $pm->getProject($params['group']);
        if ($project->isTemplate()) {
            $GLOBALS['Response']->addFeedback('warning', $GLOBALS['Language']->getText('include_layout', 'template_warning'));
        }
    }
    echo $HTML->header($params);
    echo html_feedback_top($GLOBALS['feedback']);
}
Example #8
0
/**
 *	site_user_header() - everything required to handle security and
 *	add navigation for user pages like /my/ and /account/
 *
 *	@param params array() must contain $user_id
 */
function site_user_header($params)
{
    global $HTML;
    /*
    	Check to see if active user
    	Check to see if logged in
    */
    echo $HTML->header($params);
    echo html_feedback_top(isset($GLOBALS['feedback']) ? $GLOBALS['feedback'] : '');
    echo $HTML->beginSubMenu();
    echo $HTML->printSubMenu(array(_('My Personal Page'), _('Diary &amp; Notes'), _('Account Maintenance'), _('Register Project')), array('/my/', '/my/diary.php', '/account/', '/register/'));
    plugin_hook("usermenu", false);
    echo $HTML->endSubMenu();
}
Example #9
0
                        echo '<input type="hidden" name="skill_delete[]" value="' . $skill_delete[$i] . '">';
                    }
                    echo '<input type="hidden" name="confirmMultiDelete" value="1" />';
                    echo '<input type="submit" name="MultiDelete" value="' . _('Confirm') . '" />';
                    echo '<input type="submit" name="MultiDeleteCancel" value="' . _('Cancel') . '" />';
                    echo '</form>';
                    people_footer(array());
                }
                return;
            }
        }
    } elseif (getStringFromRequest('MultiDeleteCancel')) {
        $feedback .= _('Skill deletion cancelled');
    }
    people_header(array('title' => _('Edit Your Profile')));
    html_feedback_top($feedback);
    //for security, include group_id
    $sql = "SELECT * FROM users WHERE user_id='" . user_getid() . "'";
    $result = db_query($sql);
    if (!$result || db_numrows($result) < 1) {
        echo db_error();
        $feedback .= _('User fetch FAILED');
        echo '<h2>' . _('No Such User') . '<h2>';
    } else {
        echo '
		<h2>' . _('Edit Public Permissions') . '<h2>
		<form action="' . getStringFromServer('PHP_SELF') . '" method="post">
		' . _('The following option determines if others can see your skills. If they can\'t, you can still enter your skills.') . '
		<p>
		<strong>' . _('Publicly Viewable') . ':</strong><br />
		<input type="hidden" name="form_key" value="' . form_generate_key() . '"> 
Example #10
0
function site_user_header($params)
{
    global $HTML;
    /*
    	Check to see if active user
    	Check to see if logged in
    */
    echo $HTML->header($params);
    echo html_feedback_top($GLOBALS['feedback']);
    echo '
	<P>
	<A HREF="/my/">My Personal Page</A> | <A HREF="/my/diary.php">Diary &amp; Notes</A> | <A HREF="/account/">Account Options</A> | <A HREF="/my/donation_admin.php">Donations</A>
	<P>';
}
Example #11
0
    /**
     *  ExecuteAction - Executes the action passed as parameter
     *
     *  @param  string	 action to execute.
     */
    function ExecuteAction($action)
    {
        global $HTML;
        if ($action == "change_status") {
            //change a forum
            $forum_name = getStringFromRequest('forum_name');
            $description = getStringFromRequest('description');
            $send_all_posts_to = getStringFromRequest('send_all_posts_to');
            $allow_anonymous = getIntFromRequest('allow_anonymous');
            $is_public = getIntFromRequest('is_public');
            $moderation_level = getIntFromRequest('moderation_level');
            $group_forum_id = getIntFromRequest('group_forum_id');
            /*
            	Change a forum
            */
            $f = new Forum($this->g, $group_forum_id);
            if (!$f || !is_object($f)) {
                exit_error(_('Error'), _('Error getting Forum'));
            } elseif ($f->isError()) {
                exit_error(_('Error'), $f->getErrorMessage());
            }
            if (!$f->userIsAdmin()) {
                exit_permission_denied();
            }
            if (!$f->update($forum_name, $description, $allow_anonymous, $is_public, $send_all_posts_to, $moderation_level)) {
                exit_error(_('Error'), $f->getErrorMessage());
            } else {
                $feedback = _('Forum Info Updated Successfully');
            }
            return $feedback;
        }
        if ($action == "add_forum") {
            //add forum
            $forum_name = getStringFromRequest('forum_name');
            $description = getStringFromRequest('description');
            $is_public = getStringFromRequest('is_public');
            $send_all_posts_to = getStringFromRequest('send_all_posts_to');
            $allow_anonymous = getStringFromRequest('allow_anonymous');
            $moderation_level = getIntFromRequest('moderation_level');
            /*
            	Adding forums to this group
            */
            if (!$this->p->isForumAdmin()) {
                form_release_key(getStringFromRequest("form_key"));
                exit_permission_denied();
            }
            $f = new Forum($this->g);
            if (!$f || !is_object($f)) {
                form_release_key(getStringFromRequest("form_key"));
                exit_error(_('Error'), _('Error getting Forum'));
            } elseif ($f->isError()) {
                form_release_key(getStringFromRequest("form_key"));
                exit_error(_('Error'), $f->getErrorMessage());
            }
            if (!$f->create($forum_name, $description, $is_public, $send_all_posts_to, 1, $allow_anonymous, $moderation_level)) {
                form_release_key(getStringFromRequest("form_key"));
                exit_error(_('Error'), $f->getErrorMessage());
            } else {
                $feedback = _('Forum created successfully');
            }
            return $feedback;
        }
        if ($action == "delete") {
            //Deleting messages or threads
            $msg_id = getStringFromRequest('deletemsg');
            $forum_id = getIntFromRequest('forum_id');
            $f = new Forum($this->g, $forum_id);
            if (!$f || !is_object($f)) {
                exit_error(_('Error'), _('Error getting Forum'));
            } elseif ($f->isError()) {
                exit_error(_('Error'), $f->getErrorMessage());
            }
            if (!$f->userIsAdmin()) {
                exit_permission_denied();
            }
            $fm = new ForumMessage($f, $msg_id);
            if (!$fm || !is_object($fm)) {
                exit_error(_('Error'), _('Error Getting ForumMessage'));
            } elseif ($fm->isError()) {
                exit_error(_('Error'), $fm->getErrorMessage());
            }
            $count = $fm->delete();
            if (!$count || $fm->isError()) {
                exit_error(_('Error'), $fm->getErrorMessage());
            } else {
                $feedback = sprintf(ngettext('%1$s message deleted', '%1$s messages deleted', $count), $count);
            }
            return $feedback;
        }
        if ($action == "delete_forum") {
            //delete the forum
            /*
            	Deleting entire forum
            */
            $group_forum_id = getIntFromRequest('group_forum_id');
            $f = new Forum($this->g, $group_forum_id);
            if (!$f || !is_object($f)) {
                exit_error(_('Error'), _('Error getting Forum'));
            } elseif ($f->isError()) {
                exit_error(_('Error'), $f->getErrorMessage());
            }
            if (!$f->userIsAdmin()) {
                exit_permission_denied();
            }
            if (!$f->delete(getStringFromRequest('sure'), getStringFromRequest('really_sure'))) {
                exit_error(_('Error'), $f->getErrorMessage());
            } else {
                $feedback = _('Successfully Deleted');
            }
            return $feedback;
        }
        if ($action == "view_pending") {
            //show the pending messages, awaiting moderation
            $group_id = $this->group_id;
            $forum_id = getStringFromRequest("forum_id");
            if ($this->isGroupAdmin()) {
                $this->PrintAdminOptions();
            }
            $sql = "SELECT forum_name, group_forum_id FROM forum_group_list WHERE group_id='{$group_id}' and moderation_level > 0";
            $res = db_query($sql);
            if (!$res) {
                echo db_error();
                return;
            }
            global $sys_db_row_pointer;
            $moderated_forums = array();
            for ($i = 0; $i < db_numrows($res); $i++) {
                $aux = db_fetch_array($res);
                $moderated_forums[$aux[1]] = $aux[0];
            }
            if (count($moderated_forums) == 0) {
                echo $HTML->feedback(_('No forums are moderated for this group'));
                forum_footer(array());
                exit;
            }
            if (!$forum_id) {
                //get the first one
                $keys = array_keys($moderated_forums);
                $forum_id = $keys[0];
            }
            echo '
			<script language="JavaScript" type="text/javascript">
		
			function confirmDel() {
				var agree=confirm("Proceed? Actions are permanent!");
				if (agree) {
					return true;
				} else {
					return false;
				}
			}
			</script>
			<p><form name="pending" action="pending.php" method="post">
			<input type="hidden" name="action" value="update_pending" />
			<input type="hidden" name="form_key" value="' . form_generate_key() . '">
			<input type="hidden" name="group_id" value="' . getIntFromRequest("group_id") . '" />
			<input type="hidden" name="forum_id" value="' . $forum_id . '" />

			';
            //$moderated_forums["A"] = "All Forums for this group"; // to show all
            echo html_build_select_box_from_assoc($moderated_forums, forum_id, $forum_id);
            echo '    <input name="Go" type="submit" value="Go"><p>';
            $title = array();
            $title[] = _('Forum Name');
            $title[] = _('Message');
            $title[] = "Action";
            $sql = "SELECT msg_id,subject,pm.group_forum_id,gl.forum_name FROM forum_pending_messages pm, forum_group_list gl WHERE pm.group_forum_id='{$forum_id}' AND pm.group_forum_id=gl.group_forum_id AND gl.group_forum_id='{$forum_id}'";
            $res = db_query($sql);
            if (!$res) {
                echo db_error();
                return;
            }
            $options = array("1" => "No action", "2" => "Delete", "3" => "Release");
            //array with the supported actions
            //i�ll make a hidden variable, helps to determine when the user updates the info, which action corresponds to which msgID
            for ($i = 0; $i < db_numrows($res); $i++) {
                $ids .= db_result($res, $i, 'msg_id') . ",";
            }
            $i = 2;
            echo $HTML->listTableTop($title);
            while ($onemsg = db_fetch_array($res)) {
                //$url = 'pendingmsgdetail.php?msg_id=' . $onemsg[msg_id];
                //<a href=\"javascript:msgdetail('$url');\">$onemsg[subject]</a>
                $url = "http://www.google.com";
                echo "\n\t\t\t\t<tr" . $HTML->boxGetAltRowStyle($i++) . ">\n\t\t\t\t\t<td>{$onemsg['forum_name']}</td>\t\n\t\t\t\t\t<td><a href=\"#\" OnClick=\"window.open('pendingmsgdetail.php?msg_id={$onemsg['msg_id']}&forum_id={$onemsg['group_forum_id']}&group_id={$group_id}','PendingMessageDetail','width=800,height=600,status=no,resizable=yes');\">{$onemsg['subject']}</a></td>\n\t\t\t\t\t<td><div align=\"right\">" . html_build_select_box_from_assoc($options, "doaction[]", 1) . "</div></td>\n\t\t\t\t</tr>";
            }
            echo $HTML->listTableBottom();
            echo '
			<p>
			<input type="hidden" name="msgids" value="' . $ids . '">
			<div align="right"><input type="submit" onClick="return confirmDel();" name="update" value="' . _('Update') . '"></div>
			</form>
			';
        }
        if ($action == "update_pending") {
            $group_id = getIntFromRequest("group_id");
            $forum_id = getIntFromRequest("forum_id");
            $msgids = getStringFromRequest("msgids");
            //the message ids to update
            $doaction = getArrayFromRequest("doaction");
            //the actions for the messages
            $msgids = split(",", $msgids);
            array_pop($msgids);
            //this last one is empty
            /*if ($this->isGroupAdmin()) {
            			$this->PrintAdminOptions();
            		}*/
            $results = array();
            //messages
            for ($i = 0; $i < count($msgids); $i++) {
                switch ($doaction[$i]) {
                    case 1:
                        //no action
                        break;
                    case 2:
                        //delete
                        db_begin();
                        $sql = "DELETE FROM forum_pending_attachment WHERE msg_id='{$msgids[$i]}'";
                        if (!db_query($sql)) {
                            $feedback .= "DB Error ";
                            $feedback .= db_error() . "<br>";
                            db_rollback();
                            break;
                        }
                        $sql = "DELETE FROM forum_pending_messages WHERE msg_id='{$msgids[$i]}'";
                        if (!db_query($sql)) {
                            $feedback .= "DB Error ";
                            $feedback .= db_error() . "<br>";
                            db_rollback();
                            break;
                        }
                        db_commit();
                        $feedback .= _('Forum deleted');
                        break;
                    case 3:
                        //release
                        $sql = "SELECT * FROM forum_pending_messages WHERE msg_id='{$msgids[$i]}'";
                        $res1 = db_query($sql);
                        if (!$res1) {
                            $feedback .= "DB Error " . db_error() . "<br>";
                            break;
                        }
                        $sql = "SELECT * FROM forum_pending_attachment WHERE msg_id='{$msgids[$i]}'";
                        $res2 = db_query($sql);
                        if (!$res2) {
                            $feedback .= "DB Error " . db_error() . "<br>";
                            break;
                        }
                        $f = new Forum($this->g, $forum_id);
                        if (!$f || !is_object($f)) {
                            exit_error(_('Error'), _('Error getting new Forum'));
                        } elseif ($f->isError()) {
                            exit_error(_('Error'), $f->getErrorMessage());
                        }
                        $fm = new ForumMessage($f);
                        // pending = false
                        if (!$fm || !is_object($fm)) {
                            exit_error(_('Error'), "Error getting new ForumMessage");
                        } elseif ($fm->isError()) {
                            exit_error(_('Error'), "Error getting new ForumMessage: " . $fm->getErrorMessage());
                        }
                        $group_forum_id = db_result($res1, 0, "group_forum_id");
                        $subject = db_result($res1, 0, "subject");
                        $body = db_result($res1, 0, "body");
                        $post_date = db_result($res1, 0, "post_date");
                        $thread_id = db_result($res1, 0, "thread_id");
                        $is_followup_to = db_result($res1, 0, "is_followup_to");
                        $posted_by = db_result($res1, 0, "posted_by");
                        $has_followups = db_result($res1, 0, "has_followups");
                        $most_recent_date = db_result($res1, 0, "most_recent_date");
                        if ($fm->insertreleasedmsg($group_forum_id, $subject, $body, $post_date, $thread_id, $is_followup_to, $posted_by, $has_followups, time())) {
                            $feedback .= "( {$subject} ) " . _('Pending forum released') . "<br>";
                            if (db_numrows($res2) > 0) {
                                //if there�s an attachment
                                $am = new AttachManager();
                                //object that will handle and insert the attachment into the db
                                $am->SetForumMsg($fm);
                                $userid = db_result($res2, 0, "userid");
                                $dateline = db_result($res2, 0, "dateline");
                                $filename = db_result($res2, 0, "filename");
                                $filedata = db_result($res2, 0, "filedata");
                                $filesize = db_result($res2, 0, "filesize");
                                $visible = db_result($res2, 0, "visible");
                                $msg_id = db_result($res2, 0, "msg_id");
                                $filehash = db_result($res2, 0, "filehash");
                                $mimetype = db_result($res2, 0, "mimetype");
                                $am->AddToDBOnly($userid, $dateline, $filename, $filedata, $filesize, $visible, $filehash, $mimetype);
                                foreach ($am->Getmessages() as $item) {
                                    $feedback .= "{$msg_id} - " . $item . "<br>";
                                }
                            }
                            $deleteok = true;
                        } else {
                            if ($fm->isError()) {
                                if ($fm->getErrorMessage() == _('Couldn\'t Update Master Thread parent with current time')) {
                                    //the thread which the message was replying to doesn�t exist any more
                                    $feedback .= "( " . $subject . " ) " . _('The thread which the message was posted to doesn\'t exist anymore, please delete the message.') . "<br>";
                                } else {
                                    $feedback .= "{$msg_id} - " . $fm->getErrorMessage() . "<br>";
                                }
                                $deleteok = false;
                            }
                        }
                        if (isset($am) && is_object($am)) {
                            //if there was an attach, check if it was uploaded ok
                            if (!$am->isError()) {
                                $deleteok = true;
                            } else {
                                //undo the changes to the forum table
                                db_begin();
                                $sql = "DELETE FROM forum WHERE msg_id='{$fm->getID}()'";
                                if (!db_query($sql)) {
                                    $feedback .= "DB Error ";
                                    $feedback .= db_error() . "<br>";
                                    db_rollback();
                                    break;
                                }
                                db_commit();
                                $deleteok = false;
                            }
                        }
                        if ($deleteok) {
                            //delete the message and attach
                            db_begin();
                            $sql = "DELETE FROM forum_pending_attachment WHERE msg_id='{$msgids[$i]}'";
                            if (!db_query($sql)) {
                                $feedback .= "DB Error ";
                                $feedback .= db_error() . "<br>";
                                db_rollback();
                                break;
                            }
                            $sql = "DELETE FROM forum_pending_messages WHERE msg_id='{$msgids[$i]}'";
                            if (!db_query($sql)) {
                                $feedback .= "DB Error ";
                                $feedback .= db_error() . "<br>";
                                db_rollback();
                                break;
                            }
                            db_commit();
                        }
                }
            }
            html_feedback_top($feedback);
            $page = 0;
            $this->ExecuteAction("view_pending");
        }
    }
Example #12
0
    /**
     * Function showPendingMessage
     *
     * @param 	object	The message.
     *
     * @return 	returns the html output
     */
    function showPendingMessage(&$msg)
    {
        global $HTML, $group_id;
        $am = new AttachManager();
        $ret_val = $am->PrintHelperFunctions();
        html_feedback_top(_('This is the content of the pending message'));
        $ret_val .= '
		<table border="0">
			<tr>
				<td class="tablecontent" nowrap="nowrap">' . _('By:') . $msg->getPosterRealName() . '<br />
					';
        $msgforum =& $msg->getForum();
        $ret_val .= $am->PrintAttachLink($msg, $group_id, $msgforum->getID()) . '
					<br />
					' . html_image('ic/msg.png', "10", "12", array("border" => "0")) . $bold_begin . $msg->getSubject() . $bold_end . '&nbsp; ' . '<br />' . date(_('Y-m-d H:i'), $msg->getPostDate()) . '
				</td>
			</tr>
			<tr>
				<td>
					' . $msg->getBody() . '
				</td>
			</tr>
		</table>';
        return $ret_val;
    }