public function actionView() { global $sourceFolder; require_once "{$sourceFolder}/common.lib.php"; $pageid = getPageIdFromModuleComponentId("pagelist", $this->moduleComponentId); $pageid = getParentPage($pageid); $query = "SELECT `depth` FROM `list_prop` WHERE `page_modulecomponentid`='{$this->moduleComponentId}'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($result); $reqdepth = $row['depth']; $out = $this->generatePagelist($pageid, $this->userId, 0, 'view', $reqdepth + 1); return $out; }
public function getHTML($guid, $gmoduleComponentId, $gaction) { $this->userId = $guid; $this->moduleComponentId = $gmoduleComponentId; $this->action = $gaction; $this->pageId = getPageIdFromModuleComponentId("form2", $gmoduleComponentId); switch ($this->action) { case "edit": return $this->actionEdit(); break; default: return $this->actionView(); } }
/** * function getHtml: * Gateway through which CMS interacts with module * This function will be called from getContent function of cms/content.lib.php */ public function getHtml($gotuid, $gotmoduleComponentId, $gotaction) { $this->userId = $gotuid; $this->moduleComponentId = $gotmoduleComponentId; $this->action = $gotaction; $this->pageId = getPageIdFromModuleComponentId("book", $gotmoduleComponentId); $this->bookProps = mysql_fetch_assoc(mysql_query("SELECT * FROM `book_desc` WHERE `page_modulecomponentid` = '{$this->moduleComponentId}'")); $page_title = mysql_fetch_row(mysql_query("SELECT `page_title` FROM `" . MYSQL_DATABASE_PREFIX . "pages` WHERE `page_id` = '{$this->pageId}'")); $this->bookProps['page_title'] = $page_title[0]; $this->hideInMenu(); if ($this->action == "edit") { return $this->actionEdit(); } return $this->actionView(); }
public function actionView() { global $sourceFolder, $cmsFolder, $templateFolder, $moduleFolder, $urlRequestRoot; require_once "{$sourceFolder}/{$moduleFolder}/faculty/template_edit.php"; $viewDetail = ""; $templateId = getTemplateId($this->moduleComponentId); $sectionDetail = getTemplateDataFromModuleComponentId($this->moduleComponentId); $title = getPageTitle(getPageIdFromModuleComponentId("faculty", $this->moduleComponentId)); $getImage = "SELECT * FROM `faculty_module` WHERE `page_moduleComponentId`={$this->moduleComponentId}"; $getImageQuery = mysql_query($getImage); $isExistPh = mysql_fetch_assoc($getImageQuery); $viewDetail .= <<<IMG \t <div style="text-align:center;"> \t <img src="{$isExistPh['photo']}" /> \t </div> IMG; require_once $sourceFolder . "/pngRender.class.php"; $render = new pngrender(); $emailId = getEmailForFaculty($this->moduleComponentId); $ret = $render->transform("[tex]" . $emailId . "[/tex]"); $viewDetail .= "<h3 style='text-align:center;'>Email:{$ret}</h3>"; while ($sectionDetailArray = mysql_fetch_assoc($sectionDetail)) { $sectionId = $sectionDetailArray['template_sectionId']; $printFacData = printFacultyData($sectionId, $this->moduleComponentId, 0); if ($printFacData != "") { $viewDetail .= <<<facultyName \t\t<h2>{$sectionDetailArray['template_sectionName']}</h2><hr> facultyName; } $viewDetail .= "<br/><br/>"; $sectionChildNode1DetailQuery = "SELECT * FROM `faculty_template` WHERE `template_id`={$templateId} AND "; $sectionChildNode1DetailQuery .= "`template_sectionParentId`={$sectionDetailArray['template_sectionId']}"; $sectionChildNode1DetailResult = mysql_query($sectionChildNode1DetailQuery); $viewDetail .= $printFacData; while ($sectionChildNode1DetailArray = mysql_fetch_assoc($sectionChildNode1DetailResult)) { $facultyData = printFacultyData($sectionChildNode1DetailArray['template_sectionId'], $this->moduleComponentId, 1); $viewDetail .= <<<facultyName \t\t<h3>{$facultyData}</h3> facultyName; $sectionChildNode2DetailQuery = "SELECT * FROM `faculty_template` WHERE `template_id`={$templateId} AND "; $sectionChildNode2DetailQuery .= "`template_sectionParentId`={$sectionChildNode1DetailArray['template_sectionId']}"; $sectionChildNode2DetailResult = mysql_query($sectionChildNode2DetailQuery); while ($sectionChildNode2DetailArray = mysql_fetch_assoc($sectionChildNode2DetailResult)) { $facultyDataChild = printFacultyData($sectionChildNode2DetailArray['template_sectionId'], $this->moduleComponentId, 1); $viewDetail .= <<<facultyName \t\t <h4>{$facultyDataChild}</h4> facultyName; } $viewDetail .= "<br/>"; } } return $viewDetail; }
function getProfileGroupsAndFormsList($userId) { global $sourceFolder; require_once "{$sourceFolder}/group.lib.php"; $groupRows = getGroupsFromUserId($userId); $groupRowsCount = count($groupRows); $associatedGroups = array(); $unassociatedGroups = array(); for ($i = 0; $i < $groupRowsCount; $i++) { if ($groupRows[$i]['form_id'] == 0) { $unassociatedGroups[] = '<tr><td>' . $groupRows[$i]['group_name'] . '</td><td>' . $groupRows[$i]['group_description'] . '</td></tr>'; } else { $formPath = getPagePath(getPageIdFromModuleComponentId('form', $groupRows[$i]['form_id'])); global $urlRequestRoot; $formPathLink = $urlRequestRoot . $formPath; $associatedGroups[] = '<tr><td><a href="' . $formPathLink . '">' . $formPath . '</a></td><td>' . $groupRows[$i]['group_name'] . '</td><td><a href="' . $formPathLink . '&subaction=unregister" onclick="return confirm(\'Are you sure you wish to unregister from this form?\')">Unregister</a></td></tr>'; } } if (count($associatedGroups) == 0 && count($unassociatedGroups) == 0) { return false; } global $ICONS; $retVal = "<fieldset style=\"padding: 8px\"><legend>{$ICONS['User Groups']['small']}Groups I Belong To</legend>"; if (count($associatedGroups) > 0) { $retVal .= '<strong>Groups associated with forms:</strong><br /><br /><table style="margin-left: 8px" border="1" cellpadding="4px" cellspacing="4px">' . '<tr><th>Form Path</th><th>Group Name</th><th>Unregister</th></tr>' . implode("\n", $associatedGroups) . '</table><br /><br />'; } if (count($unassociatedGroups) > 0) { $retVal .= '<strong>Groups not associated with any form:</strong><br /><table style="margin-left: 8px" border="1" cellpadding="4px" cellspacing="4px">' . '<tr><th>Group Name</th><th>Group Description</th></tr>' . implode("\n", $unassociatedGroups) . '</table><br />'; } $retVal .= '</fieldset>'; return $retVal; }
function emptyGroup($groupName, $silent = false) { $groupRow = getGroupRow($groupName); if (!$groupRow) { return false; } $groupId = $groupRow['group_id']; $formId = $groupRow['form_id']; if ($formId == 0) { $groupQuery = 'DELETE FROM `' . MYSQL_DATABASE_PREFIX . 'usergroup` WHERE `group_id` = \'' . $groupId . "'"; if (!mysql_query($groupQuery)) { displayerror('Error running MySQL query. The given group could not be emptied.'); return false; } if (!$silent) { displayinfo("Group '{$groupName}' Emptied Successfully"); } } else { displayinfo('This group is associated with a form. You must unassociate the group from the form before you can empty it.' . '<a href="' . getPagePath(getPageIdFromModuleComponentId('form', $groupRow['form_id'])) . '">Click Here</a> to visit the form\'s edit page.'); return false; } return true; }
private function forumHtml($data, $type = 'thread', $post = 0, $count = 0) { global $urlRequestRoot, $moduleFolder, $cmsFolder, $templateFolder, $sourceFolder, $userId; require_once "{$sourceFolder}/{$moduleFolder}/forum/bbeditor.php"; require_once "{$sourceFolder}/{$moduleFolder}/forum/bbparser.php"; $js = $urlRequestRoot . "/" . $cmsFolder . "/" . $moduleFolder . "/forum/images/jscript.js"; $table_name = "forum_threads"; $table1_name = "forum_posts"; $templatesImageFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/" . TEMPLATE; $temp = $urlRequestRoot . "/" . $cmsFolder . "/" . $moduleFolder . "/forum/images"; if (isset($_GET['thread_id'])) { $thread_id = escape($_GET['thread_id']); } $forumHtml = ''; $forum_threads = ''; $rows = $data; $action = "+post&subaction=create_thread"; $forum_lastVisit = $this->forumLastVisit(); if ($type == 'threadRow') { if ($userId > 0 && $forum_lastVisit < $rows['forum_thread_lastpost_date']) { $img_src = "thread_new.gif"; } else { $img_src = "thread_hot.gif"; } $topic = ucfirst(parseubb(parsesmileys($rows['forum_thread_topic']))); $name = ucfirst(getUserName($rows['forum_thread_user_id'])); $last_post_author = ucfirst(getUserName($rows['forum_thread_last_post_userid'])); if ($rows['forum_thread_category'] == 'sticky') { $img_src = 'sticky.gif'; } $query1 = "SELECT `forum_post_id` FROM `{$table1_name}` WHERE `forum_thread_id`='" . $rows['forum_thread_id'] . "' AND `forum_post_approve`='1' AND `page_modulecomponentid`='{$this->moduleComponentId}' "; $result1 = mysql_query($query1); $reply_count = mysql_num_rows($result1); $forum_threads .= <<<PRE1 \t\t\t <tr class="forumThreadRow"> \t\t\t <td class="forumThreadRow forumTableIcon" width="3%"><img src="{$temp}/{$img_src}" /></td> \t\t\t <td class="forumThreadRow" width="51%"><a class="threadRow" href="+view&thread_id={$rows['forum_thread_id']}"> {$topic} </a><br /><small>by <b> {$name} </b> \t\t\t on {$rows['forum_thread_datetime']} </small></td> \t\t\t <td class="forumThreadRow" width="8%" style="text-align:center;"> {$rows['forum_thread_viewcount']} </td> \t\t\t <td class="forumThreadRow" width="8%" style="text-align:center;"> {$reply_count} </td> \t\t\t <td class="forumThreadRow" width="30%"><small>by <b> {$last_post_author} </a></b> on {$rows['forum_thread_lastpost_date']} </small></td> \t\t\t </tr> PRE1; $forumHtml .= $forum_threads; } if ($type == 'threadHead') { $thread_Header = '<p align="left">'; if ($rows['forum_thread_category'] != 'sticky') { $thread_Header .= '<a href="+post&subaction=post_reply&thread_id=' . $thread_id . '"><img alt="Reply" title="Reply" src="' . $temp . '/reply.gif" /></a>  '; } $thread_Header .= <<<PRE \t\t\t\t<link rel="stylesheet" href="{$temp}/styles.css" type="text/css" /> \t\t\t\t <a href="+post&subaction=create_thread"><img title="New Thread" src="{$temp}/newthread.gif" /></a> <a href="+view"> <img title="Go Back to Forum" src="{$temp}/go_back.gif" /></a> \t\t\t\t<table width="100%" cellpadding="4" cellspacing="2" id="forum" > PRE; $forumHtml = $thread_Header; } if ($type == 'threadMain') { $q = "SELECT * FROM `forum_module` WHERE `page_modulecomponentid`='{$this->moduleComponentId}' LIMIT 1"; $r = mysql_query($q) or displayerror(mysql_error() . "View of Thread failed L:962"); $r = mysql_fetch_array($r); if ($post == 0) { $topic = censor_words(ucfirst(parseubb(parsesmileys($rows['forum_thread_topic'])))); $name = ucfirst(getUserName($rows['forum_thread_user_id'])); $last_post_author = ucfirst(getUserName($rows['forum_thread_last_post_userid'])); $threadUserId = $rows['forum_thread_user_id']; $detail = censor_words(parseubb(parsesmileys($rows['forum_detail']))); $posts = $this->getTotalPosts($rows['forum_thread_user_id']); $reg_date = $this->getRegDateFromUserID($rows['forum_thread_user_id']); $postTime = $rows['forum_thread_datetime']; } if ($post == 1) { $postUserId = $rows['forum_post_user_id']; $topic = censor_words(ucfirst(parseubb(parsesmileys($rows['forum_post_title'])))); $detail = censor_words(parseubb(parsesmileys($rows['forum_post_content']))); $name = ucfirst(getUserName($rows['forum_post_user_id'])); $posts = $this->getTotalPosts($rows['forum_post_user_id']); $reg_date = $this->getRegDateFromUserID($rows['forum_post_user_id']); $postTime = $rows['forum_post_datetime']; $threadUserId = $postUserId; } $datetime = date("Y-m-d H:i:s") - $postTime; $threadHtml = '<tr class="ThreadHeadRow" cellspacing="10"> <td class="forumThreadRow"><strong> ' . $topic . ' </strong><br />' . '<img src="' . $temp . '/post_icon.gif" /><small>   by ' . $name . ' </a>' . ' on ' . $postTime . ' </small>'; if ($post == 1) { if ($r['allow_like_posts'] == 1) { $likequery = "SELECT * from `forum_like` WHERE `forum_thread_id`='{$thread_id}' AND `forum_post_id`='" . $rows['forum_post_id'] . "' AND `like_status`='1' AND `page_modulecomponentid`='{$this->moduleComponentId}' "; $likeres = mysql_query($likequery); $likeres = mysql_num_rows($likeres); $dlikequery = "SELECT * from `forum_like` WHERE `forum_thread_id`='{$thread_id}' AND `forum_post_id`='" . $rows['forum_post_id'] . "' AND `like_status`='0' AND `page_modulecomponentid`='{$this->moduleComponentId}' "; $dlikeres = mysql_query($dlikequery); $dlikeres = mysql_num_rows($dlikeres); $threadHtml .= '<br /><small> ' . $likeres . ' people like this post</small>    '; $threadHtml .= '<small> ' . $dlikeres . ' people dislike this post</small><br />'; } } $threadHtml .= '</td> <td class="forumThreadRow" width="25%" rowspan="2"><strong> ' . $name . ' </a><br />'; if ($threadUserId > 0) { if ($threadUserId == $userId) { $lastLogin = $_SESSION['last_to_last_login_datetime']; } else { $lastLogin = $this->getLastLogin($threadUserId); } $moderator = getPermissions($threadUserId, getPageIdFromModuleComponentId("forum", $this->moduleComponentId), "moderate"); if ($moderator) { $threadHtml .= "Moderator"; } else { $threadHtml .= "Member"; } $content = 'content' . $count; $text = 'text' . $count; $threadHtml .= <<<PRE \t\t\t\t\t\t</strong><br /><br /> \t\t\t\t\t\t<script type="text/javascript" languauge="javascript" src="{$js}"></script> \t\t\t\t\t\t<a id="{$text}" href="javascript:toggle('{$content}','{$text}');" >Show Details</a><br /> \t\t\t\t\t\t<div id="{$content}" style="display: none;"><small>Posts: {$posts} <br />Joined: {$reg_date} <br />Last Visit: \t\t\t\t\t\t{$lastLogin} </small></div> PRE; if ($post == 1 && $userId > 0 && ($r['allow_delete_posts'] == 1 || $r['allow_like_posts'] == 1)) { //$threadHtml .= '<tr><td colspan="2" align="right">'; if ($r['allow_delete_posts'] == 1) { if ($post == 1 && $userId > 0 && $userId == $rows['forum_post_user_id']) { $threadHtml .= '<br /><a href="+view&subaction=delete_post&thread_id=' . $thread_id . '&post_id=' . $rows['forum_post_id'] . '">' . '<img src="' . $temp . '/delete1.gif"></a></span>'; } } if ($r['allow_like_posts'] == 1) { if ($userId > 0 && $post == 1) { $postId = $rows['forum_post_id']; $qu = " SELECT * FROM `forum_like` WHERE `forum_like_user_id` = '{$userId}' AND`forum_thread_id` = '{$thread_id}' AND `forum_post_id` = '{$postId}' AND `page_modulecomponentid`='{$this->moduleComponentId}' AND `like_status`='1'"; $re = mysql_query($qu); $qu1 = " SELECT * FROM `forum_like` WHERE `forum_like_user_id` = '{$userId}' AND`forum_thread_id` = '{$thread_id}' AND `forum_post_id` = '{$postId}' AND `page_modulecomponentid`='{$this->moduleComponentId}' AND `like_status`='0'"; $re1 = mysql_query($qu1); if (mysql_num_rows($re) == 0 && mysql_num_rows($re1) == 0) { $threadHtml .= ' <a href="+view&subaction=like_post&thread_id=' . $thread_id . '&post_id=' . $rows['forum_post_id'] . '">' . ' <img title="Like this post" src="' . $temp . '/like.gif"></a></span>'; $threadHtml .= ' <a href="+view&subaction=dislike_post&thread_id=' . $thread_id . '&post_id=' . $rows['forum_post_id'] . '">' . ' <img title="Dislike this post" src="' . $temp . '/unlike.gif"></a></span>'; } else { if (mysql_num_rows($re) > 0) { $threadHtml .= '<br /> You Like this post'; } else { $threadHtml .= '<br /> You Dislike this post'; } } } } //$threadHtml .= '</td></tr>'; } } $threadHtml .= <<<PRE \t </td> \t </tr> \t <tr> \t <td class="forumThreadRow"> <br />{$detail} </td> \t </tr> PRE; $threadHtml .= '<tr><td class="blank" colspan="2"></td></tr>'; $forumHtml .= $threadHtml; } return $forumHtml; }
public function actionEdit($moduleComponentId) { global $urlRequestRoot; global $sourceFolder, $cmsFolder; global $templateFolder; $scriptsFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/scripts"; $imagesFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/images"; if (isset($_GET['subaction'])) { if ($_GET['subaction'] == 'addteam') { if (isset($_POST['btnAddTeam'])) { $query = "SELECT MAX(`qaos_team_id`) AS max FROM `qaos_teams`"; $result = mysql_query($query); $resultArray = mysql_fetch_assoc($result); $max = $resultArray['max']; for ($i = 1; $i < 6; $i++) { if ($teamName = $_POST["qaos_team" . $i . ""]) { $query = "SELECT * FROM `qaos_teams` WHERE `qaos_team_name` LIKE '{$teamName}%'"; $result = mysql_query($query); if (mysql_num_rows($result) > 1) { displayerror("The {$teamName} team already exists in the database."); continue; } $teamId = $max + $i; $teamDesc = $_POST["team_desc" . $i . ""]; $query = "INSERT INTO `qaos_teams` (`page_modulecomponentid`,`qaos_team_id`,`qaos_team_name`,`qaos_team_description`) VALUES ('{$moduleComponentId}','{$teamId}','{$teamName}','{$teamDesc}')"; $result = mysql_query($query); if (!$result) { displayerror("The team '{$teamName}' could not be added. Please try again."); } } } } } elseif ($_GET['subaction'] == 'changeversion') { if (isset($_POST['btnSubmitVersion'])) { $query = "UPDATE `qaos_version` SET `qaos_version` = '" . escape($_POST[qaos_version]) . "' WHERE `page_modulecomponentid` = '{$moduleComponentId}'"; $result = mysql_query($query); if (mysql_query($query)) { displayinfo("The version has been successfully updated."); } else { displayinfo("There was some error while updating the version. Please check your query once."); } } } elseif ($_GET['subaction'] == 'addteammember') { if (isset($_POST['btnAddTeamMember'])) { $emailName = $_POST['useremail']; $input = explode(" - ", $emailName); $email = $input[0]; $designation = $_POST['userdesignation']; $team = $_POST['userteam']; $parentTeam = $_POST['userparentteam']; $parentDesignation = $_POST['userparentdesignation']; $name = $this->addTeamMember($email, $designation, $team, $parentTeam, $parentDesignation); if ($team = "Qaos") { $this->addQaosTeamMember(getUserIdFromEmail($email), $_POST['qaosteam1'], $_POST['qaosteam2'], $_POST['qaosteam3'], $_POST['qaosteam4']); } } } elseif ($_GET['subaction'] == 'getsuggestions' && isset($_GET['forwhat'])) { echo $this->getSuggestions($_GET['forwhat'], $_GET['suggestiontype']); exit; } } $queryVersion = "SELECT `qaos_version` FROM `qaos_version` WHERE `page_modulecomponentid` = '{$moduleComponentId}'"; $resultVersion = mysql_query($queryVersion); $row = mysql_fetch_row($resultVersion); $version = $row[0]; $html .= "<h2>{$version}</h2>\t<br />"; if (getPermissions($this->userId, getPageIdFromModuleComponentId("qaos", $this->moduleComponentId), "create")) { $html .= <<<EDITQAOS \t\t\t<div class="changeqaosversion"> \t\t\t\t<form id="changeqaosversion" method="POST" onsubmit="return checkProfileForm(this)" action="./+edit&subaction=changeversion"> \t\t\t\t\t<fieldset style="width:80%"> \t\t\t\t\t\t<legend><b>Change the Version</b></legend> \t\t\t\t\t\t<table> \t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\tChanger Qaos version: \t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t<input name="qaos_version" id="qaos_version" value="{$version}" type="text"> \t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t<td><input type="submit" name="btnSubmitVersion" id="submitbutton" value="Save Version"></td> \t\t\t\t\t\t\t</tr> \t\t\t\t\t\t</table> \t\t\t\t\t</fieldset> \t\t\t\t</form> \t\t\t</div> EDITQAOS; } $html .= "<br /><h3>Teams in Pragyan 2008: </h3><br />"; $queryTeam = "SELECT * FROM `qaos_teams` WHERE `page_modulecomponentid`='{$moduleComponentId}' ORDER BY `qaos_team_name`"; $resultTeam = mysql_query($queryTeam); $html .= "<table border=\"1\"><tr><td><b>Team Name</b></td><td><b>Team Description</b></td><td><b>Team Representative</b></td></tr>"; while ($row = mysql_fetch_row($resultTeam)) { $team = $row[2]; $desc = $row[3]; $repr = $row[4]; $html .= "<tr><td>{$team}</td><td>{$desc}</td><td>{$repr}</td></tr>"; } $html .= "</table><br /><br />"; $userTeamId = $this->getTeamId($this->userId); if ($userTeamId == 1) { $html .= <<<ADDTEAMS \t\t<div class="registrationform"> \t\t\t<div class="addteam"> \t\t\t\t<form id="addteam" method="POST" onsubmit="return checkProfileForm(this)" action="./+edit&subaction=addteam"> \t\t\t\t\t<fieldset style="width:80%"> \t\t\t\t\t\t<legend><b>Add Teams</b></legend> \t\t\t\t\t\t<table> \t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\tEnter the Team Name: \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\t<input name="qaos_team1" id="qaos_team" type="text"> \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\tEnter the Team Description: \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\t<input name="team_desc1" id="team_desc" type="text"> \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t</tr> \t\t\t\t\t\t</table> \t\t\t\t\t\t<input value="Add more teams" onclick="javascript:toggleuploadfiles(this);" type="button"> \t\t\t\t\t<span class="hiddenteams"><table> \t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\tEnter the Team Name: \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\t<input name="qaos_team2" id="qaos_team" type="text"> \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\tEnter the Team Description: \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\t<input name="team_desc2" id="team_desc" type="text"> \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t\t<tr><td><br /></td></tr> \t\t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\tEnter the Team Name: \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\t<input name="qaos_team3" id="qaos_team" type="text"> \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\tEnter the Team Description: \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\t<input name="team_desc3" id="team_desc" type="text"> \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t</tr> \t\t<tr><td><br /></td></tr> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\tEnter the Team Name: \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\t<input name="qaos_team4" id="qaos_team" type="text"> \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\tEnter the Team Description: \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\t<input name="team_desc4" id="team_desc" type="text"> \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t</tr> \t\t<tr><td><br /></td></tr> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\tEnter the Team Name: \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\t<input name="qaos_team5" id="qaos_team" type="text"> \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\tEnter the Team Description: \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t\t<input name="team_desc5" id="team_desc" type="text"> \t\t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t</table> \t\t\t\t\t</span> \t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t<input type="submit" name="btnAddTeam" id="submitbutton" value="Submit"> \t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t</tr> \t\t\t\t\t</fieldset> \t\t\t\t</form> \t\t\t</div> \t\t</div> \t\t<style type="text/css"> \t\t\t.hiddenteams{display:none;} \t\t\t.shownteams{display:block;} \t\t</style> \t\t<script language="javascript" type="text/javascript"> \t\t\tfunction toggleuploadfiles(gett) { \t\t\t\tif(gett.nextSibling.nextSibling.className != "shownteams") \t\t\t\t{ \t\t\t\t\tgett.nextSibling.nextSibling.className = "shownteams"; \t\t\t\t\tgett = gett.nextSibling.nextSibling; \t\t\t\t} \t\t\t\telse \t\t\t\t{ \t\t\t\t\tgett.nextSibling.nextSibling.className = "hiddenteams"; \t\t\t\t\tgett = gett.nextSibling.nextSibling; \t\t\t\t} \t\t\t} \t\t</script> ADDTEAMS; } $html .= "<br />"; $html .= <<<ADDPERSON \t\t<script type="text/javascript" language="javascript"> \t\t<!-- \t\t\timgAjaxLoading = new Image(); \t\t\timgAjaxLoading.src = '{$imagesFolder}/ajaxloading.gif'; \t\t--> \t\t</script> \t\t<style type="text/css"> \t\t<!-- \t\t\tspan.suggestion { \t\t\t\tpadding: 2px 4px 2px 4px; \t\t\t\tdisplay: block; \t\t\t\tbackground-color: white; \t\t\t\tcursor: pointer; \t\t\t} \t\t\tspan.suggestion:hover { \t\t\t\tbackground-color: #DEDEDE; \t\t\t} \t\t--> \t\t</style> \t\t<script type="text/javascript" language="javascript" src="{$scriptsFolder}/ajaxsuggestionbox.js"></script> \t\t<div class="registrationform"> \t\t\t<div class="addteammember"> \t\t\t\t<form id="addteammember" method="POST" onsubmit="return checkProfileForm(this)" action="./+edit&subaction=addteammember"> \t\t\t\t\t<fieldset style="width:80%"> \t\t\t\t\t\t<legend><b>Add Team Members</b></legend> \t\t\t\t\t\t\t<table> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\tEnter the Team Member Name: \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t<input type="text" name="useremail" id="userEmail" autocomplete="off" style="width: 256px" /> \t\t\t\t\t\t\t\t\t\t<div id="suggestionsName" class="suggestionbox"></div> \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\tEnter the User Designation: \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t<input type="text" name="userdesignation" id="userDesignation" autocomplete="off" style="width: 256px" /> \t\t\t\t\t\t\t\t\t<div id="suggestionsDesignation" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div> \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\tEnter the Team Name: \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t<input type="text" name="userteam" id="userTeam" autocomplete="off" style="width: 256px" /> \t\t\t\t\t\t\t\t\t\t<div id="suggestionsTeam" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div> \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\tEnter the Parent Team Name: \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t<input type="text" name="userparentteam" id="userParentTeam" autocomplete="off" style="width: 256px" /> \t\t\t\t\t\t\t\t\t\t<div id="suggestionsParentTeam" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div> \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\tEnter the Parent Designation: \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t<input type="text" name="userparentdesignation" id="userParentDesignation" autocomplete="off" style="width: 256px" /> \t\t\t\t\t\t\t\t\t\t<div id="suggestionsParentDesignation" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div> \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\tEnter Qaos Team1: \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t<input type="text" name="qaosteam1" id="qaosTeam1" autocomplete="off" style="width: 256px" /> \t\t\t\t\t\t\t\t\t\t<div id="suggestionsQaosTeam1" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div> \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\tEnter Qaos Team2: \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t<input type="text" name="qaosteam2" id="qaosTeam2" autocomplete="off" style="width: 256px" /> \t\t\t\t\t\t\t\t\t\t<div id="suggestionsQaosTeam2" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div> \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\tEnter Qaos Team3: \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t<input type="text" name="qaosteam3" id="qaosTeam3" autocomplete="off" style="width: 256px" /> \t\t\t\t\t\t\t\t\t\t<div id="suggestionsQaosTeam3" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div> \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\tEnter Qaos Team4: \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t\t<td> \t\t\t\t\t\t\t\t\t\t<input type="text" name="qaosteam4" id="qaosTeam4" autocomplete="off" style="width: 256px" /> \t\t\t\t\t\t\t\t\t\t<div id="suggestionsQaosTeam4" style="background-color: white; width: 260px; border: 1px solid black; position: absolute; overflow-y: scroll; max-height: 180px; display: none"></div> \t\t\t\t\t\t\t\t\t</td> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t\t \t\t\t\t\t\t\t\t<tr> \t\t\t\t\t\t\t\t\t<td><input type="submit" name="btnAddTeamMember" id="submitbutton" value="Add Team Member"></td> \t\t\t\t\t\t\t\t</tr> \t\t\t\t\t\t\t<script language="javascript" type="text/javascript"> \t\t\t\t\t\t\t<!-- \t\t\t\t\t\t\t\tnameSuggestionBox = new SuggestionBox(document.getElementById('userEmail'), document.getElementById('suggestionsName'), './+edit&subaction=getsuggestions&forwhat=%pattern%&suggestiontype=username'); \t\t\t\t\t\t\t\tnameSuggestionBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t\t\t\t\tdesignationSuggestionBox = new SuggestionBox(document.getElementById('userDesignation'), document.getElementById('suggestionsDesignation'), './+edit&subaction=getsuggestions&forwhat=%pattern%&suggestiontype=designation'); \t\t\t\t\t\t\t\tdesignationSuggestionBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t\t\t\t\tdesignationSuggestionBox = new SuggestionBox(document.getElementById('userTeam'), document.getElementById('suggestionsTeam'), './+edit&subaction=getsuggestions&forwhat=%pattern%&suggestiontype=team'); \t\t\t\t\t\t\t\tdesignationSuggestionBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t\t\t\t\tdesignationSuggestionBox = new SuggestionBox(document.getElementById('userParentTeam'), document.getElementById('suggestionsParentTeam'), './+edit&subaction=getsuggestions&forwhat=%pattern%&suggestiontype=team'); \t\t\t\t\t\t\t\tdesignationSuggestionBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t\t\t\t\tdesignationSuggestionBox = new SuggestionBox(document.getElementById('userParentDesignation'), document.getElementById('suggestionsParentDesignation'), './+edit&subaction=getsuggestions&forwhat=%pattern%&suggestiontype=designation'); \t\t\t\t\t\t\t\tdesignationSuggestionBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t\t\t\t\tdesignationSuggestionBox = new SuggestionBox(document.getElementById('qaosTeam1'), document.getElementById('suggestionsQaosTeam1'), './+edit&subaction=getsuggestions&forwhat=%pattern%&suggestiontype=team'); \t\t\t\t\t\t\t\tdesignationSuggestionBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t\t\t\t\tdesignationSuggestionBox = new SuggestionBox(document.getElementById('qaosTeam2'), document.getElementById('suggestionsQaosTeam2'), './+edit&subaction=getsuggestions&forwhat=%pattern%&suggestiontype=team'); \t\t\t\t\t\t\t\tdesignationSuggestionBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t\t\t\t\tdesignationSuggestionBox = new SuggestionBox(document.getElementById('qaosTeam3'), document.getElementById('suggestionsQaosTeam3'), './+edit&subaction=getsuggestions&forwhat=%pattern%&suggestiontype=team'); \t\t\t\t\t\t\t\tdesignationSuggestionBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t\t\t\t\tdesignationSuggestionBox = new SuggestionBox(document.getElementById('qaosTeam4'), document.getElementById('suggestionsQaosTeam4'), './+edit&subaction=getsuggestions&forwhat=%pattern%&suggestiontype=team'); \t\t\t\t\t\t\t\tdesignationSuggestionBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t\t\t\t\t \t\t\t\t\t\t\t--> \t\t\t\t\t\t\t</script> \t\t\t\t\t\t\t</table> \t\t\t\t\t</fieldset> \t\t\t\t</form> \t\t\t</div> \t\t</div> ADDPERSON; // if the user team is core, then display the parent team name and designation field, otherwise disable it! if ($userTeamId == $this->getTeamIdFromTeamName("Core")) { $html .= <<<DISABLEPARENTFIELD \t\t\t\t<script language="javascript" type="text/javascript"> \t\t\t\t\tdocument.getElementById("userParentTeam").disabled=false; \t\t\t\t\tdocument.getElementById("userParentDesignation").disabled=false; \t\t\t\t</script> DISABLEPARENTFIELD; } else { if ($userTeamId == $this->getTeamIdFromTeamName("Qaos")) { $html .= <<<DISABLEPARENTFIELD \t\t\t\t<script language="javascript" type="text/javascript"> \t\t\t\t\tdocument.getElementById("qaosTeam1").disabled=false; \t\t\t\t\tdocument.getElementById("qaosTeam2").disabled=false; \t\t\t\t\tdocument.getElementById("qaosTeam3").disabled=false; \t\t\t\t\tdocument.getElementById("qaosTeam4").disabled=false; \t\t\t\t</script> DISABLEPARENTFIELD; } else { $html .= <<<DISABLEPARENTFIELD \t\t\t\t<script language="javascript" type="text/javascript"> \t\t\t\t\t\tdocument.getElementById("userParentTeam").disabled=true; \t\t\t\t\t\tdocument.getElementById("userParentDesignation").disabled=true; \t\t\t\t\t\tdocument.getElementById("qaosTeam1").disabled=true; \t\t\t\t\t\tdocument.getElementById("qaosTeam2").disabled=true; \t\t\t\t\t\tdocument.getElementById("qaosTeam3").disabled=true; \t\t\t\t\t\tdocument.getElementById("qaosTeam4").disabled=true; \t\t\t\t</script> DISABLEPARENTFIELD; } } return $html; }
public function deleteModule($moduleComponentId) { /* Remove the indexing from sphider // Abhishek */ $pageId = getPageIdFromModuleComponentId("article", $moduleComponentId); $path = getPagePath($pageId); global $urlRequestRoot; $delurl = "http://" . $_SERVER['HTTP_HOST'] . $urlRequestRoot . "/home" . $path; $query = "SELECT link_id FROM `links` WHERE url='{$delurl}'"; $result = mysql_query($query); if (mysql_num_rows($result) == 0) { return true; } //Nothing to delete $delids = ""; while ($row = mysql_fetch_row($result)) { $delids .= $row[0] . ","; } $delids = rtrim($delids, ","); $query = "DELETE FROM `links` WHERE url='{$delurl}'"; mysql_query($query); for ($i = 0; $i <= 15; $i++) { $char = dechex($i); $query = "DELETE FROM `link_keyword{$char}` WHERE link_id IN ({$delids})"; mysql_query($query) or die(mysql_error() . " article.lib.php L:441"); } return true; }
function groupManagementForm($currentUserId, $modifiableGroups, &$pagePath) { require_once "group.lib.php"; global $ICONS; global $urlRequestRoot, $cmsFolder, $templateFolder, $moduleFolder, $sourceFolder; $scriptsFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/scripts"; $imagesFolder = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/images"; /// Parse any get variables, do necessary validation and stuff, so that we needn't check inside every if $groupRow = $groupId = $userId = null; $subAction = ''; //isset($_GET['subaction']) ? $_GET['subaction'] : ''; if (isset($_GET['subsubaction']) && $_GET['subsubaction'] == 'editgroup' && isset($_GET['groupname']) || isset($_POST['btnEditGroup']) && isset($_POST['selEditGroups'])) { $subAction = 'showeditform'; } elseif (isset($_GET['subsubaction']) && $_GET['subsubaction'] == 'associateform') { $subAction = 'associateform'; } elseif (isset($_GET['subsubaction']) && $_GET['subsubaction'] == 'deleteuser' && isset($_GET['groupname']) && isset($_GET['useremail'])) { $subAction = 'deleteuser'; } elseif (isset($_POST['btnAddUserToGroup'])) { $subAction = 'addusertogroup'; } elseif (isset($_POST['btnSaveGroupProperties'])) { $subAction = 'savegroupproperties'; } elseif (isset($_POST['btnEditGroupPriorities']) || isset($_GET['subsubaction']) && $_GET['subsubaction'] == 'editgrouppriorities') { $subAction = 'editgrouppriorities'; } if (isset($_POST['selEditGroups']) || isset($_GET['groupname'])) { $groupRow = getGroupRow(isset($_POST['selEditGroups']) ? escape($_POST['selEditGroups']) : escape($_GET['groupname'])); $groupId = $groupRow['group_id']; if ($subAction != 'editgrouppriorities' && (!$groupRow || !$groupId || $groupId < 2)) { displayerror('Error! Invalid group requested.'); return; } if (!is_null($groupId)) { if ($modifiableGroups[count($modifiableGroups) - 1]['group_priority'] < $groupRow['group_priority']) { displayerror('You do not have the permission to modify the selected group.'); return ''; } } } if (isset($_GET['useremail'])) { $userId = getUserIdFromEmail($_GET['useremail']); } if ($subAction != 'editgrouppriorities' && (isset($_GET['subaction']) && $_GET['subaction'] == 'editgroups' && !is_null($groupId))) { if ($subAction == 'deleteuser') { if ($groupRow['form_id'] != 0) { displayerror('The group is associated with a form. To remove a user, use the edit registrants in the assoicated form.'); } elseif (!$userId) { displayerror('Unknown E-mail. Could not find a registered user with the given E-mail Id'); } else { $deleteQuery = 'DELETE FROM `' . MYSQL_DATABASE_PREFIX . 'usergroup` WHERE `user_id` = \'' . $userId . '\' AND `group_id` = ' . $groupId; $deleteResult = mysql_query($deleteQuery); if (!$deleteResult || mysql_affected_rows() != 1) { displayerror('Could not delete user with the given E-mail from the given group.'); } else { displayinfo('Successfully removed user from the current group'); if ($userId == $currentUserId) { $virtue = ''; $maxPriorityGroup = getMaxPriorityGroup($pagePath, $currentUserId, array_reverse(getGroupIds($currentUserId)), $virtue); $modifiableGroups = getModifiableGroups($currentUserId, $maxPriorityGroup, $ordering = 'asc'); } } } } elseif ($subAction == 'savegroupproperties' && isset($_POST['txtGroupDescription'])) { $updateQuery = "UPDATE `" . MYSQL_DATABASE_PREFIX . "groups` SET `group_description` = '" . escape($_POST['txtGroupDescription']) . "' WHERE `group_id` = '{$groupId}'"; $updateResult = mysql_query($updateQuery); if (!$updateResult) { displayerror('Could not update database.'); } else { displayinfo('Changes to the group have been successfully saved.'); } $groupRow = getGroupRow($groupRow['group_name']); } elseif ($subAction == 'addusertogroup' && isset($_POST['txtUserEmail']) && trim($_POST['txtUserEmail']) != '') { if ($groupRow['form_id'] != 0) { displayerror('The selected group is associated with a form. To add a user, register the user to the form.'); } else { $passedEmails = explode(',', escape($_POST['txtUserEmail'])); for ($i = 0; $i < count($passedEmails); $i++) { $hyphenPos = strpos($passedEmails[$i], '-'); if ($hyphenPos >= 0) { $userEmail = trim(substr($passedEmails[$i], 0, $hyphenPos - 1)); } else { $userEmail = escape($_POST['txtUserEmail']); } $userId = getUserIdFromEmail($userEmail); if (!$userId || $userId < 1) { displayerror('Unknown E-mail. Could not find a registered user with the given E-mail Id'); } if (!addUserToGroupName($groupRow['group_name'], $userId)) { displayerror('Could not add the given user to the current group.'); } else { displayinfo('User has been successfully inserted into the given group.'); } } } } elseif ($subAction == 'associateform') { if (isset($_POST['btnAssociateGroup'])) { $pageIdArray = array(); $formPageId = parseUrlReal(escape($_POST['selFormPath']), $pageIdArray); if ($formPageId <= 0 || getPageModule($formPageId) != 'form') { displayerror('Invalid page selected! The page you selected is not a form.'); } elseif (!getPermissions($currentUserId, $formPageId, 'editregistrants', 'form')) { displayerror('You do not have the permissions to associate the selected form with a group.'); } else { $formModuleId = getModuleComponentIdFromPageId($formPageId, 'form'); require_once "{$sourceFolder}/{$moduleFolder}/form.lib.php"; if (isGroupEmpty($groupId) || form::getRegisteredUserCount($formModuleId) == 0) { associateGroupWithForm($groupId, $formModuleId); $groupRow = getGroupRow($groupRow['group_name']); } else { displayerror('Both the group and the form already contain registered users, and the group cannot be associated with the selected form.'); } } } elseif (isset($_POST['btnUnassociateGroup'])) { if ($groupRow['form_id'] <= 0) { displayerror('The selected group is currently not associated with any form.'); } elseif (!getPermissions($currentUserId, getPageIdFromModuleComponentId('form', $groupRow['form_id']), 'editregistrants', 'form')) { displayerror('You do not have the permissions to unassociate the form from this group.'); } else { unassociateFormFromGroup($groupId); $virtue = ''; $maxPriorityGroup = getMaxPriorityGroup($pagePath, $currentUserId, array_reverse(getGroupIds($currentUserId)), $virtue); $modifiableGroups = getModifiableGroups($currentUserId, $maxPriorityGroup, $ordering = 'asc'); $groupRow = getGroupRow($groupRow['group_name']); } } } if ($modifiableGroups[count($modifiableGroups) - 1]['group_priority'] < $groupRow['group_priority']) { displayerror('You do not have the permission to modify the selected group.'); return ''; } $usersTable = '`' . MYSQL_DATABASE_PREFIX . 'users`'; $usergroupTable = '`' . MYSQL_DATABASE_PREFIX . 'usergroup`'; $userQuery = "SELECT `user_email`, `user_fullname` FROM {$usergroupTable}, {$usersTable} WHERE `group_id` = '{$groupId}' AND {$usersTable}.`user_id` = {$usergroupTable}.`user_id` ORDER BY `user_email`"; $userResult = mysql_query($userQuery); if (!$userResult) { displayerror('Error! Could not fetch group information.'); return ''; } $userEmails = array(); $userFullnames = array(); while ($userRow = mysql_fetch_row($userResult)) { $userEmails[] = $userRow[0]; $userFullnames[] = $userRow[1]; } $groupEditForm = <<<GROUPEDITFORM \t\t\t<h2>Group '{$groupRow['group_name']}' - '{$groupRow['group_description']}'</h2><br /> \t\t\t<fieldset style="padding: 8px"> \t\t\t\t<legend>{$ICONS['User Groups']['small']}Group Properties</legend> \t\t\t\t<form name="groupeditform" method="POST" action="./+admin&subaction=editgroups&groupname={$groupRow['group_name']}"> \t\t\t\t\tGroup Description: <input type="text" name="txtGroupDescription" value="{$groupRow['group_description']}" /> \t\t\t\t\t<input type="submit" name="btnSaveGroupProperties" value="Save Group Properties" /> \t\t\t\t</form> \t\t\t</fieldset> \t\t\t<br /> \t\t\t<fieldset style="padding: 8px"> \t\t\t\t<legend>{$ICONS['User Groups']['small']}Existing Users in Group:</legend> GROUPEDITFORM; $userCount = mysql_num_rows($userResult); global $urlRequestRoot, $cmsFolder, $templateFolder, $sourceFolder; $deleteImage = "<img src=\"{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/actions/edit-delete.png\" alt=\"Remove user from the group\" title=\"Remove user from the group\" />"; for ($i = 0; $i < $userCount; $i++) { $isntAssociatedWithForm = $groupRow['form_id'] == 0; if ($isntAssociatedWithForm) { $groupEditForm .= '<a onclick="return confirm(\'Are you sure you wish to remove this user from this group?\')" href="./+admin&subaction=editgroups&subsubaction=deleteuser&groupname=' . $groupRow['group_name'] . '&useremail=' . $userEmails[$i] . '">' . $deleteImage . "</a>"; } $groupEditForm .= " {$userEmails[$i]} - {$userFullnames[$i]}<br />\n"; } $associateForm = ''; if ($groupRow['form_id'] == 0) { $associableForms = getAssociableFormsList($currentUserId, !isGroupEmpty($groupId)); $associableFormCount = count($associableForms); $associableFormsBox = '<select name="selFormPath">'; for ($i = 0; $i < $associableFormCount; ++$i) { $associableFormsBox .= '<option value="' . $associableForms[$i][2] . '">' . $associableForms[$i][1] . ' - ' . $associableForms[$i][2] . '</option>'; } $associableFormsBox .= '</select>'; $associateForm = <<<GROUPASSOCIATEFORM \t\t\tSelect a form to associate the group with: {$associableFormsBox} \t\t\t<input type="submit" name="btnAssociateGroup" value="Associate Group with Form" /> GROUPASSOCIATEFORM; } else { $associatedFormPageId = getPageIdFromModuleComponentId('form', $groupRow['form_id']); $associateForm = 'This group is currently associated with the form: ' . getPageTitle($associatedFormPageId) . ' (' . getPagePath($associatedFormPageId) . ')<br />' . '<input type="submit" name="btnUnassociateGroup" value="Unassociate" />'; } $groupEditForm .= '</fieldset>'; if ($groupRow['form_id'] == 0) { $groupEditForm .= <<<GROUPEDITFORM \t\t\t\t<br /> \t\t\t\t<fieldset style="padding: 8px"> \t\t\t\t\t<legend>{$ICONS['Add']['small']}Add Users to Group</legend> \t\t\t\t\t<form name="addusertogroup" method="POST" action="./+admin&subaction=editgroups&groupname={$groupRow['group_name']}"> \t\t\t\t\t\tEmail ID: <input type="text" name="txtUserEmail" id="txtUserEmail" value="" style="width: 256px" autocomplete="off" /> \t\t\t\t\t\t<div id="suggestionDiv" class="suggestionbox"></div> \t\t\t\t\t\t<script language="javascript" type="text/javascript" src="{$scriptsFolder}/ajaxsuggestionbox.js"></script> \t\t\t\t\t\t<script language="javascript" type="text/javascript"> \t\t\t\t\t\t<!-- \t\t\t\t\t\t\tvar addUserBox = new SuggestionBox(document.getElementById('txtUserEmail'), document.getElementById('suggestionDiv'), "./+admin&doaction=getsuggestions&forwhat=%pattern%"); \t\t\t\t\t\t\taddUserBox.loadingImageUrl = '{$imagesFolder}/ajaxloading.gif'; \t\t\t\t\t\t--> \t\t\t\t\t\t</script> \t\t\t\t\t\t<input type="submit" name="btnAddUserToGroup" value="Add User to Group" /> \t\t\t\t\t</form> \t\t\t\t</fieldset> GROUPEDITFORM; } $groupEditForm .= <<<GROUPEDITFORM \t\t\t<br /> \t\t\t<fieldset style="padding: 8px"> \t\t\t\t<legend>{$ICONS['Group Associate Form']['small']}Associate With Form</legend> \t\t\t\t<form name="groupassociationform" action="./+admin&subaction=editgroups&subsubaction=associateform&groupname={$groupRow['group_name']}" method="POST"> \t\t\t\t\t{$associateForm} \t\t\t\t</form> \t\t\t</fieldset> GROUPEDITFORM; return $groupEditForm; } if ($subAction == 'editgrouppriorities') { $modifiableCount = count($modifiableGroups); $userMaxPriority = $maxPriorityGroup = 1; if ($modifiableCount != 0) { $userMaxPriority = max($modifiableGroups[0]['group_priority'], $modifiableGroups[$modifiableCount - 1]['group_priority']); $maxPriorityGroup = $modifiableGroups[0]['group_priority'] > $modifiableGroups[$modifiableCount - 1]['group_priority'] ? $modifiableGroups[0]['group_id'] : $modifiableGroups[$modifiableCount - 1]['group_id']; } if (isset($_GET['dowhat']) && !is_null($groupId)) { if ($_GET['dowhat'] == 'incrementpriority' || $_GET['dowhat'] == 'decrementpriority') { shiftGroupPriority($currentUserId, $groupRow['group_name'], $_GET['dowhat'] == 'incrementpriority' ? 'up' : 'down', $userMaxPriority, true); } elseif ($_GET['dowhat'] == 'movegroupup' || $_GET['dowhat'] == 'movegroupdown') { shiftGroupPriority($currentUserId, $groupRow['group_name'], $_GET['dowhat'] == 'movegroupup' ? 'up' : 'down', $userMaxPriority, false); } elseif ($_GET['dowhat'] == 'emptygroup') { emptyGroup($groupRow['group_name']); } elseif ($_GET['dowhat'] == 'deletegroup') { if (deleteGroup($groupRow['group_name'])) { $virtue = ''; $maxPriorityGroup = getMaxPriorityGroup($pagePath, $currentUserId, array_reverse(getGroupIds($currentUserId)), $virtue); $modifiableGroups = getModifiableGroups($currentUserId, $maxPriorityGroup, $ordering = 'asc'); } } $modifiableGroups = reevaluateGroupPriorities($modifiableGroups); } elseif (isset($_GET['dowhat']) && $_GET['dowhat'] == 'addgroup') { if (isset($_POST['txtGroupName']) && isset($_POST['txtGroupDescription']) && isset($_POST['selGroupPriority'])) { $existsQuery = 'SELECT `group_id` FROM `' . MYSQL_DATABASE_PREFIX . "groups` WHERE `group_name` = '" . escape($_POST['txtGroupName']) . "'"; $existsResult = mysql_query($existsQuery); if (trim($_POST['txtGroupName']) == '') { displayerror('Cannot create a group with an empty name. Please type in a name for the new group.'); } elseif (mysql_num_rows($existsResult) >= 1) { displayerror('A group with the name you specified already exists.'); } else { $idQuery = 'SELECT MAX(`group_id`) FROM `' . MYSQL_DATABASE_PREFIX . 'groups`'; $idResult = mysql_query($idQuery); $idRow = mysql_fetch_row($idResult); $newGroupId = 2; if (!is_null($idRow[0])) { $newGroupId = $idRow[0] + 1; } $newGroupPriority = 1; if ($_POST['selGroupPriority'] <= $userMaxPriority && $_POST['selGroupPriority'] > 0) { $newGroupPriority = escape($_POST['selGroupPriority']); } $addGroupQuery = 'INSERT INTO `' . MYSQL_DATABASE_PREFIX . 'groups` (`group_id`, `group_name`, `group_description`, `group_priority`) ' . "VALUES({$newGroupId}, '" . escape($_POST['txtGroupName']) . "', '" . escape($_POST['txtGroupDescription']) . "', '{$newGroupPriority}')"; $addGroupResult = mysql_query($addGroupQuery); if ($addGroupResult) { displayinfo('New group added successfully.'); if (isset($_POST['chkAddMe'])) { $insertQuery = 'INSERT INTO `' . MYSQL_DATABASE_PREFIX . "usergroup`(`user_id`, `group_id`) VALUES ('{$currentUserId}', '{$newGroupId}')"; if (!mysql_query($insertQuery)) { displayerror('Error adding user to newly created group: ' . $insertQuery . '<br />' . mysql_query()); } } $virtue = ''; $maxPriorityGroup = getMaxPriorityGroup($pagePath, $currentUserId, array_reverse(getGroupIds($currentUserId)), $virtue); $modifiableGroups = getModifiableGroups($currentUserId, $maxPriorityGroup, $ordering = 'asc'); } else { displayerror('Could not run MySQL query. New group could not be added.'); } } } $modifiableGroups = reevaluateGroupPriorities($modifiableGroups); } $modifiableCount = count($modifiableGroups); if ($modifiableGroups[0]['group_priority'] < $modifiableGroups[$modifiableCount - 1]['group_priority']) { $modifiableGroups = array_reverse($modifiableGroups); } $previousPriority = $modifiableGroups[0]['group_priority']; global $cmsFolder, $urlRequestRoot, $moduleFolder, $templateFolder, $sourceFolder; $iconsFolderUrl = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16"; $moveUpImage = '<img src="' . $iconsFolderUrl . '/actions/go-up.png" title="Increment Group Priority" alt="Increment Group Priority" />'; $moveDownImage = '<img src="' . $iconsFolderUrl . '/actions/go-down.png" alt="Decrement Group Priority" title="Decrement Group Priority" />'; $moveTopImage = '<img src="' . $iconsFolderUrl . '/actions/go-top.png" alt="Move to next higher priority level" title="Move to next higher priority level" />'; $moveBottomImage = '<img src="' . $iconsFolderUrl . '/actions/go-bottom.png" alt="Move to next lower priority level" title="Move to next lower priority level" />'; $emptyImage = '<img src="' . $iconsFolderUrl . '/actions/edit-clear.png" alt="Empty Group" title="Empty Group" />'; $deleteImage = '<img src="' . $iconsFolderUrl . '/actions/edit-delete.png" alt="Delete Group" title="Delete Group" />'; $groupsForm = '<h3>Edit Group Priorities</h3><br />'; for ($i = 0; $i < $modifiableCount; $i++) { if ($modifiableGroups[$i]['group_priority'] != $previousPriority) { $groupsForm .= '<br /><br /><hr /><br />'; } $groupsForm .= '<span style="margin: 4px;" title="' . $modifiableGroups[$i]['group_description'] . '">' . '<a href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=incrementpriority&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $moveUpImage . '</a>' . '<a href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=decrementpriority&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $moveDownImage . '</a>' . '<a href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=movegroupup&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $moveTopImage . '</a>' . '<a href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=movegroupdown&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $moveBottomImage . '</a>' . '<a onclick="return confirm(\'Are you sure you want to empty this group?\')" href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=emptygroup&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $emptyImage . '</a>' . '<a onclick="return confirm(\'Are you sure you want to delete this group?\')" href="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=deletegroup&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $deleteImage . '</a>' . '<a href="./+admin&subaction=editgroups&groupname=' . $modifiableGroups[$i]['group_name'] . '">' . $modifiableGroups[$i]['group_name'] . "</a></span>\n"; $previousPriority = $modifiableGroups[$i]['group_priority']; } $priorityBox = '<option value="1">1</option>'; for ($i = 2; $i <= $userMaxPriority; ++$i) { $priorityBox .= '<option value="' . $i . '">' . $i . '</option>'; } $groupsForm .= <<<GROUPSFORM \t\t<br /><br /> \t\t<fieldset style="padding: 8px"> \t\t\t<legend>Create New Group:</legend> \t\t\t<form name="groupaddform" method="POST" action="./+admin&subaction=editgroups&subsubaction=editgrouppriorities&dowhat=addgroup"> \t\t\t\t<label>Group Name: <input type="text" name="txtGroupName" value="" /></label><br /> \t\t\t\t<label>Group Description: <input type="text" name="txtGroupDescription" value="" /></label><br /> \t\t\t\t<label>Group Priority: <select name="selGroupPriority">{$priorityBox}</select><br /> \t\t\t\t<label><input type="checkbox" name="chkAddMe" value="addme" /> Add me to group</label><br /> \t\t\t\t<input type="submit" name="btnAddNewGroup" value="Add Group" /> \t\t\t</form> \t\t</fieldset> GROUPSFORM; return $groupsForm; } $modifiableCount = count($modifiableGroups); $groupsBox = '<select name="selEditGroups">'; for ($i = 0; $i < $modifiableCount; ++$i) { $groupsBox .= '<option value="' . $modifiableGroups[$i]['group_name'] . '">' . $modifiableGroups[$i]['group_name'] . ' - ' . $modifiableGroups[$i]['group_description'] . "</option>\n"; } $groupsBox .= '</select>'; $groupsForm = <<<GROUPSFORM \t\t<form name="groupeditform" method="POST" action="./+admin&subaction=editgroups"> \t\t\t{$groupsBox} \t\t\t<input type="submit" name="btnEditGroup" value="Edit Selected Group" /><br /><br /> \t\t\t<input type="submit" name="btnEditGroupPriorities" value="Add/Shuffle/Remove Groups" /> \t\t</form> GROUPSFORM; return $groupsForm; }
function submitRegistrationForm($moduleCompId, $userId, $silent = false, $disableCaptcha = false) { ///-------------------------Get anonymous unique negative user id--------------- if ($userId == 0) { $useridQuery = "SELECT MIN(`user_id`) - 1 AS MIN FROM `form_regdata` WHERE 1"; $useridResult = mysql_query($useridQuery); if (mysql_num_rows($useridResult) > 0) { $useridRow = mysql_fetch_assoc($useridResult); $userId = $useridRow['MIN']; } else { $userId = -1; } } ///-----------------------------Anonymous user id ends------------------------------- ///---------------------------- CAPTCHA Validation ---------------------------------- if (!$disableCaptcha) { $captchaQuery = 'SELECT `form_usecaptcha` FROM `form_desc` WHERE `page_modulecomponentid` = \'' . $moduleCompId . "'"; $captchaResult = mysql_query($captchaQuery); $captchaRow = mysql_fetch_row($captchaResult); if ($captchaRow[0] == 1) { if (!submitCaptcha()) { return false; } } } ///------------------------ CAPTCHA Validation Ends Here ---------------------------- $query = "SELECT `form_elementid`,`form_elementtype` FROM `form_elementdesc` WHERE `page_modulecomponentid`='{$moduleCompId}'"; $result = mysql_query($query); $allFieldsUpdated = true; while ($elementRow = mysql_fetch_assoc($result)) { $type = $elementRow['form_elementtype']; $elementId = $elementRow['form_elementid']; $postVarName = "form_" . $moduleCompId . "_element_" . $elementRow['form_elementid']; $functionName = "submitRegistrationForm" . ucfirst(strtolower($type)); $elementDescQuery = "SELECT `form_elementname`,`form_elementsize`,`form_elementtypeoptions`,`form_elementmorethan`," . "`form_elementlessthan`,`form_elementcheckint`,`form_elementisrequired` FROM `form_elementdesc` " . "WHERE `page_modulecomponentid`='{$moduleCompId}' AND `form_elementid` ='{$elementId}'"; $elementDescResult = mysql_query($elementDescQuery); if (!$elementDescResult) { displayerror('E69 : Invalid query: ' . mysql_error()); return false; } $elementDescRow = mysql_fetch_assoc($elementDescResult); $elementName = $elementDescRow['form_elementname']; $elementSize = $elementDescRow['form_elementsize']; $elementTypeOptions = $elementDescRow['form_elementtypeoptions']; $elementMoreThan = $elementDescRow['form_elementmorethan']; $elementLessThan = $elementDescRow['form_elementlessthan']; $elementCheckInt = $elementDescRow['form_elementcheckint'] == 1 ? true : false; $elementIsRequired = $elementDescRow['form_elementisrequired'] == 1 ? true : false; if ($functionName($moduleCompId, $elementId, $userId, $postVarName, $elementName, $elementSize, $elementTypeOptions, $elementMoreThan, $elementLessThan, $elementCheckInt, $elementIsRequired) == false) { // displayerror("Error in inputting data in function $functionName."); $allFieldsUpdated = false; break; } } if (!$allFieldsUpdated) { if ($userId < 0) { unregisterUser($moduleCompId, $userId); } else { if (!verifyUserRegistered($moduleCompId, $userId)) { $deleteelementdata_query = "DELETE FROM `form_elementdata` WHERE `user_id` = '{$userId}' AND `page_modulecomponentid` ='{$moduleCompId}' "; $deleteelementdata_result = mysql_query($deleteelementdata_query); } return false; } } else { if (!verifyUserRegistered($moduleCompId, $userId)) { registerUser($moduleCompId, $userId); } else { updateUser($moduleCompId, $userId); } if (!$silent) { $footerQuery = "SELECT `form_footertext`, `form_sendconfirmation` FROM `form_desc` WHERE `page_modulecomponentid` = '{$moduleCompId}'"; $footerResult = mysql_query($footerQuery); $footerRow = mysql_fetch_row($footerResult); $footerText = $footerRow[0]; $footerTextLength = strlen($footerText); if ($footerTextLength > 7) { if (substr($footerText, 0, 4) == '<!--' && substr($footerText, $footerTextLength - 3) == '-->') { $footerText = substr($footerText, 4, $footerTextLength - 7); } else { $footerText = ''; } } else { $footerText = ''; } displayinfo($footerText == '' ? "User successfully registered!" : $footerText); // send mail code starts here - see common.lib.php for more if ($footerRow[1]) { $from = ''; // Default CMS email will be added automatically if this is left blank $to = getUserEmail($userId); $pageId = getPageIdFromModuleComponentId('form', $moduleCompId); $parentPage = getParentPage($pageId); $formname = getPageTitle($parentPage); $keyid = $finalName = str_pad($userId, 5, '0', STR_PAD_LEFT); $key = ''; $mailtype = "form_registration_mail"; $messenger = new messenger(false); global $onlineSiteUrl; $messenger->assign_vars(array('FORMNAME' => "{$formname}", 'KEY' => "{$key}", 'WEBSITE' => CMS_TITLE, 'DOMAIN' => $onlineSiteUrl, 'NAME' => getUserFullName($userId))); if ($messenger->mailer($to, $mailtype, $key, $from)) { displayinfo("You have been succesfully registered to {$formname} and a registration confirmation mail has been sent. Kindly check your e-mail."); } else { displayerror("Registration confirmation mail sending failure. Kindly contact webadmin@pragyan.org"); } } // send mail code ends here } } return true; }
function getPagePathFromModule($moduleName, $moduleComponentId) { return getPagePath(getPageIdFromModuleComponentId($moduleName, $moduleComponentId)); }