function createAttributeSetWithGroup($setName, $inheritedAttributeSetId, $entityTypeId, $attributes) { try { $attributeSet = createAttributeSet($setName, $inheritedAttributeSetId, $entityTypeId); if (($setId = $attributeSet->getId()) === false) { Mage::log('Could not get ID from new attribute set ' . $setName); return false; } $groupName = $setName . ' Details'; $group = createGroup($groupName, $attributeSet); if (($groupId = $group->getId()) === false) { Mage::log('Could not get ID from new group ' . $groupName); return false; } createAttributes($attributes, $entityTypeId, $attributeSet, $group); } catch (Exception $ex) { Mage::log('Problem creating attribute set ' . $setName . ': ' . $ex->getMessage()); return false; } return true; }
function createUser($name, $username, $password, $email, $groups, $create_home = true) { if (!isAdmin) return ucf(i18n("not enough rights to create new user")); if (empty($name)) return ucf(i18n("a name must be specified")); if (empty($username)) return ucf(i18n("a username must be specified")); $user = new mUser(); $user->setByUsername($username); if ($user->id > 0) return ucf(i18n("a user with that username already exists")); $group = new mGroup(); $group->setByName($username); if ($group->id > 0) $group_id = $group->id; else $group_id = createGroup($username, "This is the group of $name", false); $group = new mGroup($group_id); $groups = $group->name." $groups"; $groups = trim($groups); $user->name = $name; $user->username = $username; $user->password = md5($password); $user->groups = $groups; $user->email = $email; $ret = $user->save(); if ($create_home && getNode("/root/home/users/".$username) <= 0) { $home = new mObject(); $home->setClassName("folder"); $home->loadVars(); $home->name = $username; $home->language = $_SESSION['murrix']['language']; $home->rights = "$username=rc"; $home->setVarValue("description", "This is the home of $name"); if ($home->save()) { $home->setMeta("initial_rights", "$username=rwc"); $home_folder = new mObject(getNode("/root/home/users")); $home->linkWithNode($home_folder->getNodeId()); } else { $message = "Operation unsuccessfull.<br/>"; $message .= "Error output:<br/>"; $message .= $home->getLastError(); return $message; } $user->home_id = $home->getNodeId(); $user->save(); } return $ret; }
var_dump($cursor); var_dump(getGroupsForPage(2, $cursor)); break; case 43: //获取一个或多个群组的详情 $group_ids = array("1445830526109", "1445833238210"); var_dump(getGroupDetail($group_ids)); break; case 44: //创建一个群组 $options['groupname'] = "group001"; $options['desc'] = "this is a love group"; $options['public'] = true; $options['owner'] = "zhangsan"; $options['members'] = array("wangwu", "lisi"); var_dump(createGroup($options)); break; case 45: //修改群组信息 $group_id = "124113058216804760"; $options['groupname'] = "group002"; $options['description'] = "修改群描述"; $options['maxusers'] = 300; var_dump(modifyGroupInfo($group_id, $options)); break; case 46: //删除群组 $group_id = "124113058216804760"; var_dump(deleteGroup($group_id)); break; case 47:
register(); break; case 'update': update(); break; case 'updatePassword': updatePassword(); break; case 'addImage': addImage(); break; case 'updateGroupImage': updateGroupImage(); break; case 'createGroup': createGroup(); break; case 'acceptGroupRequest': acceptGroupRequest(); break; case 'declineGroupRequest': declineGroupRequest(); break; case 'acceptChatRequest': acceptChatRequest(); break; case 'declineChatRequest': declineChatRequest(); break; case 'acceptDateRequest': acceptDateRequest();
<?php // configuration require_once "../includes/config.php"; require "../includes/interactionService.php"; if (!isset($_SESSION["username"])) { header('Location: index.php'); } $db = new mysql_db(SERVER, USERNAME, PASSWORD, DATABASE); if (isset($_POST["groupname"])) { $groupname = $_POST["groupname"]; $topic = $_POST["topic"]; createGroup($groupname, $topic, ""); } $groups = showGroups(); render("group_template.php", ["title" => "Group", "groups" => $groups]); $db->sql_close(); ?>
public function createGroup($params) { $res = createGroup($params["name"], $params["Inputf_grouptype"], $params["Inputf_district"], isset($params["force"]) ? $params["force"] : null); $this->logGroup($params, 2); return $res; }
function civicrm_api3_speakcivi_remind($params) { // how old not confirmed petitions $start = microtime(true); $days = $params['days']; $daysContact = $params['days_contact']; if ($daysContact < $days) { $daysContact = $days; } $groupId = CRM_Core_BAO_Setting::getItem('Speakcivi API Preferences', 'group_id'); $activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', 'Petition', 'name', 'String', 'value'); $adminId = 1; $query = "SELECT acp.activity_id, ap.campaign_id, acp.contact_id\n FROM civicrm_activity ap\n JOIN civicrm_activity_contact acp ON acp.activity_id = ap.id\n JOIN civicrm_contact c ON c.id = acp.contact_id\n LEFT JOIN civicrm_group_contact gc ON gc.contact_id = acp.contact_id AND gc.group_id = %1 AND gc.status = 'Added'\n WHERE ap.activity_type_id = %2 AND ap.status_id = 1 AND ap.activity_date_time <= date_add(current_date, INTERVAL -%3 DAY)\n AND c.created_date >= date_add(current_date, INTERVAL -%4 DAY)\n AND c.is_opt_out = 0 AND c.is_deleted = 0 AND c.is_deceased = 0 AND c.do_not_email = 0 AND gc.id IS NULL"; $params = array(1 => array($groupId, 'Integer'), 2 => array($activityTypeId, 'Integer'), 3 => array($days, 'Integer'), 4 => array($daysContact, 'Integer')); $dao = CRM_Core_DAO::executeQuery($query, $params); $contacts = array(); $campaigns = array(); while ($dao->fetch()) { $contacts[$dao->campaign_id][$dao->contact_id] = $dao->contact_id; $campaigns[$dao->campaign_id] = $dao->campaign_id; } $message = array(); $subject = array(); $utmCampaign = array(); $locale = array(); $language = array(); $email = array(); foreach ($campaigns as $cid) { $campaignObj = new CRM_Speakcivi_Logic_Campaign($cid); $message[$cid] = $campaignObj->getMessageNew(); $subject[$cid] = substr(removeSmartyIfClause(convertTokens($campaignObj->getSubjectNew())), 0, 128); $utmCampaign[$cid] = $campaignObj->getUtmCampaign(); $locale[$cid] = $campaignObj->getLanguage(); $language[$cid] = strtoupper(substr($locale[$cid], 0, 2)); $email[$cid] = parseSenderEmail($campaignObj->getSenderMail()); } // fetch confirmation block $messageHtml = array(); $messageText = array(); foreach ($message as $cid => $msg) { $url_confirm_and_keep = CRM_Utils_System::url('civicrm/speakcivi/confirm', null, true) . "?id={contact.contact_id}&cid={$cid}&hash={speakcivi.confirmation_hash}&utm_source=civicrm&utm_medium=email&utm_campaign=" . $utmCampaign[$cid]; $url_confirm_and_not_receive = CRM_Utils_System::url('civicrm/speakcivi/optout', null, true) . "?id={contact.contact_id}&cid={$cid}&hash={speakcivi.confirmation_hash}&utm_source=civicrm&utm_medium=email&utm_campaign=" . $utmCampaign[$cid]; $locales = getLocale($locale[$cid]); $confirmationBlockHtml = implode('', file(dirname(__FILE__) . '/../../templates/CRM/Speakcivi/Page/ConfirmationBlock.' . $locales['html'] . '.html.tpl')); $confirmationBlockText = implode('', file(dirname(__FILE__) . '/../../templates/CRM/Speakcivi/Page/ConfirmationBlock.' . $locales['text'] . '.text.tpl')); $confirmationBlockHtml = str_replace('{$url_confirm_and_keep}', $url_confirm_and_keep, $confirmationBlockHtml); $confirmationBlockHtml = str_replace('{$url_confirm_and_not_receive}', $url_confirm_and_not_receive, $confirmationBlockHtml); $confirmationBlockText = str_replace('{$url_confirm_and_keep}', $url_confirm_and_keep, $confirmationBlockText); $confirmationBlockText = str_replace('{$url_confirm_and_not_receive}', $url_confirm_and_not_receive, $confirmationBlockText); $messageHtml[$cid] = removeSmartyIfClause(convertTokens(removeDelim(str_replace("#CONFIRMATION_BLOCK", $confirmationBlockHtml, $msg)))); $messageText[$cid] = convertHtmlToText(removeSmartyIfClause(convertTokens(removeDelim(str_replace("#CONFIRMATION_BLOCK", $confirmationBlockText, $msg))))); } foreach ($campaigns as $cid) { $sentContacts = findSentContacts($cid); $contacts[$cid] = excludeContacts($contacts[$cid], $sentContacts); if (is_array($contacts[$cid]) && count($contacts[$cid]) > 0) { if ($mailingId = findNotCompletedMailing($cid)) { if ($linkedGroupId = findLinkedGroup($mailingId)) { addContactsToGroup($contacts[$cid], $linkedGroupId); } else { $includeGroupId = createGroup($cid, $language[$cid]); addContactsToGroup($contacts[$cid], $includeGroupId); includeGroup($mailingId, $includeGroupId); } } else { $name = determineMailingName($cid, $language[$cid]); $params = array('name' => $name, 'subject' => $subject[$cid], 'body_text' => $messageText[$cid], 'body_html' => $messageHtml[$cid], 'created_id' => $adminId, 'created_date' => date('YmdHis'), 'campaign_id' => $cid, 'mailing_type' => 'standalone', 'unsubscribe_id' => 5, 'resubscribe_id' => 6, 'optout_id' => 7, 'reply_id' => 8, 'open_tracking' => 1, 'url_tracking' => 1, 'dedupe_email' => 1, 'from_name' => $email[$cid]['from_name'], 'from_email' => $email[$cid]['from_email'], 'footer_id' => chooseFooter($language[$cid])); $mailing = new CRM_Mailing_BAO_Mailing(); $mm = $mailing->add($params); excludeGroup($mm->id, $groupId); if ($existingGroupId = findExistingGroup($cid)) { cleanGroup($existingGroupId); addContactsToGroup($contacts[$cid], $existingGroupId); includeGroup($mm->id, $existingGroupId); } else { $includeGroupId = createGroup($cid, $language[$cid]); addContactsToGroup($contacts[$cid], $includeGroupId); includeGroup($mm->id, $includeGroupId); } } } } $results = array('time' => microtime(true) - $start); return civicrm_api3_create_success($results, $params); }
addAlert("danger", "You must be logged in to access this resource."); echo json_encode(array("errors" => 1, "successes" => 0)); exit; } // Create a new group with the specified name and home page id // POST: group_name, home_page_id $validator = new Validator(); $group_name = $validator->requiredPostVar('group_name'); $home_page_id = $validator->requiredPostVar('home_page_id'); // Add alerts for any failed input validation foreach ($validator->errors as $error) { addAlert("danger", $error); } //Forms posted if ($group_name) { if (!createGroup($group_name, $home_page_id)) { echo json_encode(array("errors" => 1, "successes" => 0)); exit; } } else { addAlert("danger", lang("PERMISSION_CHAR_LIMIT", array(1, 50))); echo json_encode(array("errors" => 1, "successes" => 0)); exit; } restore_error_handler(); if (isset($_POST['ajaxMode']) and $_POST['ajaxMode'] == "true") { echo json_encode(array("errors" => 0, "successes" => 1)); } else { header('Location: ' . getReferralPage()); exit; }
<?php $testSuite->createGroup('Requests / Admin / Groups', function ($g) { $admin = createAdmin(); $group = createGroup(); $g->test('List groups', function ($t) use($admin, $group) { $resp = $t->visit('admin_groups', ['cookie' => ['traq' => $admin['session_hash']]]); $t->assertEquals(200, $resp->status); $t->assertContains($group['name'], $resp->body); }); $g->test('New group form', function ($t) use($admin) { $resp = $t->visit('admin_new_group', ['cookie' => ['traq' => $admin['session_hash']]]); $t->assertEquals(200, $resp->status); $t->assertContains('<h1 class="page-header">New Group</h1>', $resp->body); }); $g->test('Create group', function ($t) use($admin) { $resp = $t->visit('admin_create_group', ['method' => 'POST', 'post' => ['name' => 'My Group'], 'cookie' => ['traq' => $admin['session_hash']]]); $t->assertRedirectTo($t->generateUrl('admin_groups'), $resp); }); $g->test('Name in use', function ($t) use($admin) { $resp = $t->visit('admin_create_group', ['method' => 'POST', 'post' => ['name' => 'Admin'], 'cookie' => ['traq' => $admin['session_hash']]]); $t->assertContains('Name is already in use', $resp->body); }); $g->test('Edit group form', function ($t) use($admin, $group) { $resp = $t->visit('admin_edit_group', ['routeTokens' => ['id' => $group['id']], 'cookie' => ['traq' => $admin['session_hash']]]); $t->assertContains('<h1 class="page-header">Edit Group</h1>', $resp->body); }); $g->test('Update group', function ($t) use($admin, $group) { $resp = $t->visit('admin_save_group', ['method' => 'PATCH', 'routeTokens' => ['id' => $group['id']], 'post' => ['name' => 'Just Another Group'], 'cookie' => ['traq' => $admin['session_hash']]]); $t->assertRedirectTo($t->generateUrl('admin_groups'), $resp); });
header("Location: login.php"); die; } if (!empty($_POST)) { $errors = array(); $successes = array(); $name = $_POST["name"]; $description = $_POST["description"]; if (empty($name)) { $errors[] = lang("GROUP_SPECIFY_NAME"); } if (empty($description)) { $errors[] = lang("GROUP_SPECIFY_DESCRIPTION"); } if (count($errors) == 0) { $id = createGroup($loggedInUser->user_id, $name, $description); if ($id) { $successes[] = lang("GROUP_CREATED"); } else { $errors[] = lang("GROUP_CREATION_FAILED"); } } if (count($errors) == 0 and count($successes) == 0) { $errors[] = lang("NOTHING_TO_UPDATE"); } } require_once "{$path}/models/header.php"; ?> <body> <div id='wrapper'>
<?php // You get automatic membership in created group. session_start(); require_once '../db.php'; if (!isset($_POST['groupName']) || !isset($_POST['groupDescription'])) { die('group name and desc must be present'); return; } // Require that someone is logged in first. if (!isset($_SESSION['userId'])) { die('Not logged in'); return; } createGroup(mongoIdSanitize($_SESSION['userId']), mongoUserSanitize($_SESSION['userName']), mongoGroupSanitize($_POST['groupName']), mongoTextSanitize($_POST['groupDescription']));
$response = saveGroups($json["data"]); } else { if ($request == "removeUserFromGroup") { $response = removeUserFromGroup($json["data"]); } else { if ($request == "addUserToGroup") { $response = addUserToGroup($json["data"]); } else { if ($request == "getUsersUngroup") { $response = getUsersUngroup($json["data"]); } else { if ($request == "removeGroup") { $response = removeGroup($json["data"]); } else { if ($request == "createGroup") { $response = createGroup($json["data"]); } else { $response = getJSONFromCodeError(202); } } } } } } } } } } echo json_encode($response); /* ########################### * FUNCTIONS
} $form["status"] = $_POST["status"]; $form["comment"] = $_POST["comment"]; if (isset($id)) { // this is an update operation $pageTitle = "Unable to update Group"; // update the data base accordingly $rs = true; // update the org values $rs = updateGroup($id, $form); if ($rs) { header("Location: editgroup.php?id={$id}"); return; } $pageInfo = "<b>Update operation failed</b>"; } else { // this is a group creation request; fill in fields $pageTitle = "Unable to create Group"; $form["name"] = $_POST["name"]; $id = createGroup($form); // redirect to edit group with the new id if ($id) { header("Location: editgroup.php?id={$id}"); return; } $pageInfo = $lastError; } ?> <?php include "errorframe.php";
function actionFinish(&$system, $args) { global $abspath, $db_prefix, $root_id, $anonymous_id; $db_prefix = $this->db['prefix']; if (empty($args['theme'])) { $system->addAlert("You must enter select a theme"); return; } if (empty($args['imgsize'])) { $system->addAlert("You must enter a imagesize"); return; } if (empty($args['thumbsize'])) { $system->addAlert("You must enter a thumbnailsize"); return; } if (empty($args['default_lang'])) { $system->addAlert("You must enter a default language"); return; } if (empty($args['default_path'])) { $system->addAlert("You must enter a default path"); return; } if (empty($args['password'])) { $system->addAlert("You must enter a password"); return; } unset($args['action']); $this->config = $args; $logtext = ""; if (!$db_conn = mysql_pconnect($this->db['adress'], $this->db['username'], $this->db['password'])) { $system->addAlert("Error connecting to MySQL: " . mysql_errno() . " " . mysql_error()); return; } if (!mysql_select_db($this->db['name'])) { if (mysql_query("CREATE DATABASE `".$this->db['name']."`")) $logtext .= "Database ".$this->db['name']." created.<br/>"; else { $system->addAlert("Failed to create database ".$this->db['name'].". Error: " . mysql_errno() . " " . mysql_error()); return; } } mysql_select_db($this->db['name']); $files = GetSubfiles("$abspath/scripts/install/db"); foreach ($files as $file) { $query = "DROP TABLE IF EXISTS `".$this->db['prefix'].basename($file, ".sql")."`"; mysql_query($query); $query = str_replace("%PREFIX%", $this->db['prefix'], implode("", file("$abspath/scripts/install/db/$file"))); if (mysql_query($query)) $logtext .= "Imported $file successfully.<br/>"; else { $system->addAlert("Failed to import $file. Error: " . mysql_errno() . " " . mysql_error()."\n$query"); return; } } $xml = new mXml(); $files = GetSubfiles("$abspath/scripts/install/classes"); foreach ($files as $file) { $filedata = getFileData($file, "$abspath/scripts/install/classes/$file"); $msgid = $xml->parseXML(array("node_id" => 0, "data" => $filedata)); $logtext .= mMsg::getText($msgid); if (mMsg::isError($msgid)) { $system->addAlert(mMsg::getError($msgid)); return; } else $logtext .= "Imported $file successfully.<br/>"; } $files = GetSubfiles("$abspath/scripts/install/objects"); foreach ($files as $file) { $filedata = getFileData($file, "$abspath/scripts/install/objects/$file"); $msgid = $xml->parseXML(array("node_id" => 0, "data" => $filedata)); $logtext .= mMsg::getText($msgid); if (mMsg::isError($msgid)) { $system->addAlert(mMsg::getError($msgid)); return; } else $logtext .= "Imported $file successfully.<br/>"; } $root_id = 1; $admin_group_id = createGroup("admins", "Administrators group", true); $anon_group_id = createGroup("anonymous", "Anonymous group", false); $anon_user_id = createUserSimple("Anonymous", "anonymous", "", "", "anonymous", false); $anonymous_id = $anon_user_id; $admin_user_id = createUserSimple("Administrator", "admin", $this->config['password'], "", "admins", true); $files = GetSubfiles("$abspath/cache"); foreach ($files as $file) unlink("$abspath/cache/$file"); $files = GetSubfiles("$abspath/files"); foreach ($files as $file) unlink("$abspath/files/$file"); $files = GetSubfiles("$abspath/thumbnails"); foreach ($files as $file) unlink("$abspath/thumbnails/$file"); // Insert initial objects /* $root_obj = new mObject(); $root_obj->setClassName("folder"); $root_obj->loadVars(); $root_obj->setLanguage("eng"); $root_obj->setName("root"); $root_obj->setIcon("murrix"); $root_obj->setRights("all=r"); $root_obj->setVarValue("description", "This is the root node"); if ($root_obj->save()) { $root_obj->setMeta("initial_rights", "admins=rwc"); $logtext .= "Created ".$root_obj->getName().".<br/>"; } else { $logtext .= "Failed to create ".$root_obj->getName().".<br/>"; $logtext .= $root_obj->error; $this->done = false; } $home_obj = new mObject(); $home_obj->setClassName("folder"); $home_obj->loadVars(); $home_obj->setLanguage("eng"); $home_obj->setName("home"); $home_obj->setIcon("home"); $home_obj->setRights("all=r"); $home_obj->setVarValue("description", "This folder contain home folders"); if ($home_obj->save()) { $home_obj->linkWithNode($root_obj->getNodeId()); $logtext .= "Created ".$home_obj->getName().".<br/>"; } else { $logtext .= "Failed to create ".$home_obj->getName().".<br/>"; $logtext .= $home_obj->error; $this->done = false; } $users_home_obj = new mObject(); $users_home_obj->setClassName("folder"); $users_home_obj->loadVars(); $users_home_obj->setLanguage("eng"); $users_home_obj->setName("users"); $users_home_obj->setIcon("user"); $users_home_obj->setRights("all=r"); $users_home_obj->setVarValue("description", "This folder contain home folders"); if ($users_home_obj->save()) { $users_home_obj->linkWithNode($home_obj->getNodeId()); $logtext .= "Created ".$users_home_obj->getName().".<br/>"; } else { $logtext .= "Failed to create ".$users_home_obj->getName().".<br/>"; $logtext .= $users_home_obj->error; $this->done = false; } $group_home_obj = new mObject(); $group_home_obj->setClassName("folder"); $group_home_obj->loadVars(); $group_home_obj->setLanguage("eng"); $group_home_obj->setName("groups"); $group_home_obj->setIcon("group2"); $group_home_obj->setRights("all=r"); $users_home_obj->setVarValue("description", "This folder contain group folders"); if ($group_home_obj->save()) { $group_home_obj->linkWithNode($home_obj->getNodeId()); $logtext .= "Created ".$group_home_obj->getName().".<br/>"; } else { $logtext .= "Failed to create ".$group_home_obj->getName().".<br/>"; $logtext .= $group_home_obj->error; $this->done = false; } $adminhome_obj = new mObject(); $adminhome_obj->setClassName("folder"); $adminhome_obj->loadVars(); $adminhome_obj->setLanguage("eng"); $adminhome_obj->setName($this->admin_username); $adminhome_obj->setRights("admins=rwc"); $adminhome_obj->setVarValue("description", "This is the home for ".$this->admin_username); if ($adminhome_obj->save()) { $adminhome_obj->linkWithNode($users_home_obj->getNodeId()); $logtext .= "Created ".$adminhome_obj->getName().".<br/>"; $administrator->home_id = $adminhome_obj->getNodeId(); $administrator->save(); } else { $logtext .= "Failed to create ".$adminhome_obj->getName().".<br/>"; $logtext .= $adminhome_obj->error; $this->done = false; } $adminshome_obj = new mObject(); $adminshome_obj->setClassName("folder"); $adminshome_obj->loadVars(); $adminshome_obj->setLanguage("eng"); $adminshome_obj->setName("admins"); $adminshome_obj->setRights("admins=rwc"); $adminshome_obj->setVarValue("description", "This is the home for admins"); if ($adminshome_obj->save()) { $adminshome_obj->linkWithNode($group_home_obj->getNodeId()); $logtext .= "Created ".$adminshome_obj->getName().".<br/>"; $administrator_group->home_id = $adminshome_obj->getNodeId(); $administrator_group->save(); } else { $logtext .= "Failed to create ".$adminshome_obj->getName().".<br/>"; $logtext .= $adminshome_obj->error; $this->done = false; } $public_obj = new mObject(); $public_obj->setClassName("folder"); $public_obj->loadVars(); $public_obj->setLanguage("eng"); $public_obj->setName("public"); $public_obj->setRights("all=r"); $public_obj->setVarValue("description", "This folder is readable by anyone"); if ($public_obj->save()) { $public_obj->linkWithNode($root_obj->getNodeId()); $logtext .= "Created ".$public_obj->getName().".<br/>"; } else { $logtext .= "Failed to create ".$public_obj->getName().".<br/>"; $logtext .= $public_obj->error; $this->done = false; } */ setSetting("ROOT_NODE_ID", 1, "any"); setSetting("ANONYMOUS_ID", $anonymous->id, "any"); setSetting("TRANSPORT", $this->config['transport'], "any"); setSetting("DEFAULT_THEME", $this->config['theme'], "any"); setSetting("IMGSIZE", $this->config['imgsize'], $this->config['theme']); setSetting("THUMBSIZE", $this->config['thumbsize'], $this->config['theme']); setSetting("INSTANTTHUMBS", $this->config['instantthumbs'], $this->config['theme']); setSetting("DEFAULT_PATH", $this->config['default_path'], $this->config['theme']); setSetting("DEFAULT_LANG", $this->config['default_lang'], $this->config['theme']); $confdata = "<?\n"; $confdata .= "\$mysql_address = \"".$this->db['adress']."\";\n"; $confdata .= "\$mysql_user = \"".$this->db['username']."\";\n"; $confdata .= "\$mysql_pass = \"".$this->db['password']."\";\n"; $confdata .= "\$mysql_db = \"".$this->db['name']."\";\n"; $confdata .= "\$db_prefix = \"".$this->db['prefix']."\";\n"; $confdata .= "?>"; if (is_writable($abspath)) { $conffile = fopen("$abspath/config.inc.php", "w"); fwrite($conffile, $confdata); fclose($conffile); chmod("$abspath/config.inc.php", 0600); $logtext .= "Wrote config, $abspath/config.inc.php.<br/>"; } else { $logtext .= "Unable to write config file.<br/>"; $logtext .= "Please put the folowing into \"config.inc.php\" and place it in MURRiXs rootpath:<br/>"; $logtext .= "<br/>"; $logtext .= nl2br(htmlentities($confdata)); $logtext .= "<br/>"; } $logtext .= "Installation complete!<br/>"; $data = compiletpl("finish", array("logtext"=>$logtext)); $system->setZoneData($this->zone, utf8e($data)); $data = compiletpl("menu", array("action"=>"finish")); $system->setZoneData("zone_menu", utf8e($data)); }
if ($memSubArray[0] == 'users') { $userArray[] = $memSubArray[1]; } } $groupMemberArray['groups'] = $groupArray; $groupMemberArray['roles'] = $roleArray; $groupMemberArray['rs'] = $roleSubordinateArray; $groupMemberArray['users'] = $userArray; return $groupMemberArray; } if (isset($_REQUEST['returnaction']) && $_REQUEST['returnaction'] != '') { $returnaction = $_REQUEST['returnaction'] . '&roleid=' . $_REQUEST['roleid']; } else { $returnaction = 'GroupDetailView'; } //Inserting values into Role Table if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'edit') { $groupId = vtlib_purify($_REQUEST['groupId']); $selected_col_string = vtlib_purify($_REQUEST['selectedColumnsString']); $member_array = explode(';', $selected_col_string); $groupMemberArray = constructGroupMemberArray($member_array); updateGroup($groupId, $groupName, $groupMemberArray, $description); $loc = "Location: index.php?action=" . vtlib_purify($returnaction) . "&module=Settings&parenttab=Settings&groupId=" . vtlib_purify($groupId); } elseif (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'create') { $selected_col_string = vtlib_purify($_REQUEST['selectedColumnsString']); $member_array = explode(';', $selected_col_string); $groupMemberArray = constructGroupMemberArray($member_array); $groupId = createGroup($groupName, $groupMemberArray, $description); $loc = "Location: index.php?action=" . vtlib_purify($returnaction) . "&parenttab=Settings&module=Settings&groupId=" . vtlib_purify($groupId); } header($loc);
//Added on 06-06-06 $query10 = "CREATE TABLE vtiger_group2rs (\n\t `groupid` int(19) NOT NULL,\n\t `roleandsubid` varchar(255) NOT NULL,\n\t PRIMARY KEY (`groupid`,`roleandsubid`)\n ) ENGINE=InnoDB"; /* $query10 = "CREATE TABLE vtiger_group2rs ( `groupid` int(19) NOT NULL default '0', `roleandsubid` varchar(255) NOT NULL default '', PRIMARY KEY (`groupid`,`roleandsubid`), CONSTRAINT `fk_group2rs1` FOREIGN KEY (`groupid`) REFERENCES `vtiger_groups` (`groupid`) ON DELETE CASCADE ) TYPE=InnoDB"; */ Execute($query10); //Insert all the retrieved old values to the new vtiger_groups table ie., create new vtiger_groups foreach ($group_map_array as $groupname => $description) { $empty_array = array("groups" => array("" => ""), "roles" => array("" => ""), "rs" => array("" => ""), "users" => array("" => "")); $groupid = createGroup($groupname, $empty_array, $description); $group_name_id_mapping[$groupname] = $groupid; } $conn->println("List of Groups Created (groupname => groupid) ==> "); $conn->println($group_name_id_mapping); //Copy all mappings in a user2grop table in a array; //Step 4 : Drop and again create users2group $query6 = "drop table vtiger_users2group"; Execute($query6); //Added on 06-06-06 $query7 = "CREATE TABLE vtiger_users2group (\n\t `groupid` int(19) NOT NULL,\n\t `userid` int(19) NOT NULL,\n\t PRIMARY KEY (`groupid`,`userid`),\n\t KEY `users2group_groupname_uerid_idx` (`groupid`,`userid`)\n\t) ENGINE=InnoDB"; /* $query7 = "CREATE TABLE vtiger_users2group ( `groupid` int(19) NOT NULL default '0', `userid` int(19) NOT NULL default '0',
<?php include_once '../functions.php'; include_once '../db_connect.php'; sec_session_start(); if (isset($_SESSION["user_id"], $_POST["name"], $_POST["school_id"])) { $id = createGroup($mysqli, $_SESSION["user_id"], $_POST["name"], $_POST["school_id"]); header('Location: ../../group.php?id=' . $id); } else { echo "Missing POST Variables"; header('Location: ../../school.php?error=Faulty Post Variables'); }
function exec($args, $stdin, &$stdout, &$stderr, &$system) { if (!isAdmin()) { $stderr = ucf(i18n("not enough rights to create group")); return true; } switch ($this->stage) { case 1: $this->name = $args; $stdout = "$args\n"; $stdout .= ucf(i18n("enter description:")); $this->stage = 2; return false; case 2: $this->description = $args; $stdout = "$args\n".ucf(i18n("create home"))." (Y/n)?"; $this->stage = 3; return false; case 3: $this->create_home = (empty($args) || strtolower($args) == "y" || strtolower($args) == "yes"); if ($this->create_home) $stdout = "yes\n"; else $stdout = "no\n"; $stdout .= ucf(i18n("are you sure you want to create this group"))." (Y/n)?"; $this->stage = 4; return false; case 4: if (empty($args) || strtolower($args) == "y" || strtolower($args) == "yes") { $result = createGroup($this->name, $this->description, $this->create_home); if (is_numeric($result)) { $stdout = ucf(i18n("created new group successfully")); $this->stage = 0; return true; } $stderr = $result; $this->stage = 0; return true; } $stdout = ucf(i18n("aborted by user")); $this->stage = 0; return true; } if (empty($args)) { $stdout = ucf(i18n("enter name:")); $this->stage = 1; } else { $this->name = $args; $stdout .= ucf(i18n("enter description:")); $this->stage = 2; } return false; }
<?php if (!defined('includeConst')) { die('Direct access not permitted'); } if (isset($_GET['error']) && $_GET['error'] == 'db') { echo 'some sort of db error, try again maybe?'; echo $_POST['error']; } if (isset($_GET['action']) && $_GET['action'] == "create") { createGroup($_POST['name'], $_POST['description'], $_POST['type'], $userId, $db); } else { ?> <body> <main> <?php include "header.inc"; ?> <div class="content"> <h1>Create a Group</h1> <form id="mainForm" name="regoForm" action="/?page=createGroup&action=create" method="post"> <label for="name">Name your Group</label> <input type="text" name="name" id="name" placeholder="Group Name" required /> <label for="type">Project Type</label> <select name="type" id="typeSelect"> <option value="Web Development">Web Development</option> <option value="Programming">Programming</option> <option value="Project Leadership">Design</option> <option value="Business">Business</option> </select><br> <label for="grade">Grade Aim</label>