function getUserGroupNames($valid_user) { $groupNames = array(); $groups = unserialize(groups::getUserGroups($valid_user)); for ($index = 0; $index < sizeof($groups); $index++) { array_push($groupNames, groups::getgroupname($groups[$index])); } return $groupNames; }
public function timeline($category_ids = "0,") { $group_where = " AND ( " . $this->table_prefix . "simplegroups_groups_incident.simplegroups_groups_id = " . $this->group->id . ") "; $category_ids_array = explode(",", $category_ids, -1); //get rid of that trailing ";" $joins = groups::get_joins_for_groups($category_ids_array); $sg_category_to_table_mapping = groups::get_category_to_table_mapping(); adminmap_helper::json_timeline($this, $category_ids, true, $group_where, $joins = $joins, $sg_category_to_table_mapping); }
function listar($tpl) { $tabla_listado = new table(true); //Empieza comentado if ($_SESSION['super'] || $_SESSION['admin']) { $my_group = new groups(); $my_group->get_list_groups(); $cadena = '' . $tabla_listado->make_tables('user_groups', $my_group->groups_list, array('Nombre', 50), array('id_group', 'name'), 10, array('select'), false); $variables = $tabla_listado->nombres_variables; $tpl->assign('variables', $variables); $tpl->assign('cadena', $cadena); return $tpl; } //Fin comentado $cadena = '' . $tabla_listado->make_tables('user_groups', $this->emp->groups_list, array('Nombre', 50), array('id_group', 'name'), 10, array('select'), false); $variables = $tabla_listado->nombres_variables; $tpl->assign('variables', $variables); $tpl->assign('cadena', $cadena); return $tpl; }
public static function getGroupsForGame($pack) { $sql_groups = dbconnection::queryArray("SELECT * FROM groups WHERE game_id = '{$pack->game_id}'"); $groups = array(); for ($i = 0; $i < count($sql_groups); $i++) { if ($ob = groups::groupObjectFromSQL($sql_groups[$i])) { $groups[] = $ob; } } return new return_package(0, $groups); }
function moveuser() { $u = new user($_POST["userid"]); $dn = $u->dn; $gplist = $u->Groups_list(); if (preg_match("#^(.+?),#", $dn, $re)) { $newRdn = $re[1]; } else { $newRdn = "cn={$_POST["userid"]}"; } $ldap = new clladp(); $newParent = "ou=users,ou={$_POST["nextou"]},dc=organizations,{$ldap->suffix}"; if (!ldap_rename($ldap->ldap_connection, $dn, $newRdn, $newParent, true)) { echo 'Error number ' . ldap_errno($ldap->ldap_connection) . "\nAction:LDAP Ldap_rename\ndn:{$dn} -> {$newRdn},{$newParent}\n" . ldap_err2str(ldap_errno($ldap->ldap_connection)); return; } while (list($gid, $name) = each($gplist)) { $gp = new groups($gid); $gp->DeleteUserFromThisGroup($_POST["userid"]); } }
function Confirm() { $group = new groups($_GET["gpid"]); if ($_GET["delete-mailbox"] == 1) { if (is_array($gp->members_array)) { $members_array = $gp->members_array; while (list($num, $ligne) = each($members_array)) { if (trim($num) == null) { continue; } $sock = new sockets(); $sock->getFrameWork("cmd.php?DelMbx={$num}"); } } } if ($_GET["DeleteUsers"] == 1) { if (is_array($gp->members_array)) { $members_array = $gp->members_array; while (list($num, $ligne) = each($members_array)) { if (trim($num) == null) { continue; } $user = new user($num); $user->DeleteUser(); } } } else { $ldap = new clladp(); $default_dn_nogroup = "cn=nogroup,ou=groups,ou={$ou},dc=organizations,{$ldap->suffix}"; if (!$ldap->ExistsDN($default_dn_nogroup)) { $ldap->AddGroup("nogroup", $group->ou); } $nogroup_id = $ldap->GroupIDFromName($group->ou, "nogroup"); if (is_array($gp->members_array)) { $members_array = $gp->members_array; while (list($num, $val) = each($members_array)) { $ldap->AddUserToGroup($nogroup_id, $num); $group->DeleteUserFromThisGroup($num); } } } $group->Delete(); }
function USER_CHANGE_UID_SAVE() { $uid = $_GET["changeuidFrom"]; $uidnext = $_GET["changeuidTo"]; $user = new user($uid); $array["uid"][0] = $uidnext; $ldap = new clladp(); if (!$ldap->Ldap_modify($user->dn, $array)) { echo $ldap->ldap_last_error; exit; } $groups = $user->GetGroups($uid); $hash = $user->Groups_list($uid); if (is_array($hash)) { while (list($num, $val) = each($hash)) { $group = new groups($num); writelogs("Delete user ({$uid}) from {$val}", __CLASS__ . '/' . __FUNCTION__, __FILE__, __LINE__); $group->DeleteUserFromThisGroup($uid); $group->AddUsertoThisGroup($uidnext); } } $users = new usersMenus(); if ($users->POSTFIX_INSTALLED) { $sock = new sockets(); $sock->getFrameWork("cmd.php?postfix-hash-aliases=yes"); } }
function GROUP_ADD($value) { include_once dirname(__FILE__) . '/ressources/class.user.inc'; include_once dirname(__FILE__) . '/ressources/class.groups.inc'; $array = unserialize(base64_decode($value)); if (!is_array($array)) { send_email_events("Failed to add group, not an array", "", "CLOUD"); return true; } $guid = $array["gid"]; $ou = $array["ou"]; $groupname = $array["groupname"]; events("Adding new group \"{$ou}\" gid:{$guid} Ou:{$ou} ", __FUNCTION__, __FILE__, __LINE__); $group = new groups(); if ($group->add_new_group($groupname, $ou, $guid)) { send_email_events("Success to add group {$groupname}", "", "CLOUD"); events("Adding new group success", __FUNCTION__, __FILE__, __LINE__); } else { send_email_events("Failed to add group {$groupname}", "", "CLOUD"); events("Adding new group Failed", __FUNCTION__, __FILE__, __LINE__); } sys_THREAD_COMMAND_SET(LOCATE_PHP5_BIN2() . " /usr/share/artica-postfix/exec.artica.meta.users.php --export-all-groups"); return true; }
* http://www.gnu.org/copyleft/lesser.html * @author Ushahidi Team <*****@*****.**> * @package Ushahidi - http://source.ushahididev.com * @module API Controller * @copyright Ushahidi - http://www.ushahidi.com * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL) */ ?> <div class="bg"> <h2> <?php groups::messages_subtabs($service_id); ?> </h2> <?php Event::run('ushahidi_action.admin_messages_custom_layout'); // Kill the rest of the page if this event has been utilized by a plugin if (!Event::has_run('ushahidi_action.admin_messages_custom_layout')) { ?> <!-- tabs --> <div class="tabs"> <!-- tabset --> <ul class="tabset"> <li><a href="#" id="inbox_tab" onclick="filterTabClick('inbox_tab'); return false;" <?php if ($type == '1') {
function SHARED_FOLDERS_DEL() { $g = new groups($_GET["shared-delete"]); $g->del_sharedfolder($_GET["shared-path"]); }
/** * Lists the reports. * @param int $page */ function index($page = 1, $group_id = false) { // Cacheable Controller $this->is_cachable = TRUE; $this->template->header->this_page = 'reports'; $this->template->content = new View('reports'); $this->themes->js = new View('reports_js'); // Get locale $l = Kohana::config('locale.language.0'); $db = new Database(); if (!empty($_GET['status'])) { $status = strtolower($_GET['status']); if ($status == 'a') { $filter = 'incident.incident_active = 0'; } elseif ($status == 'v') { $filter = 'incident.incident_verified = 0'; } elseif ($status == 't') { $filter = 'incident.incident_verified = 1'; } elseif ($status == 'f') { $filter = 'incident.incident_assigned = 1'; } elseif ($status == 'd') { $filter = 'incident.incident_disputed = 0'; } else { $status = "0"; $filter = '1=1'; } } else { $status = "0"; $filter = "1=1"; } // check, has the form been submitted? $form_error = FALSE; $form_saved = FALSE; $form_action = ""; $db = new Database(); // Category ID $category_ids = array(); if (isset($_GET['c']) and !empty($_GET['c'])) { $category_ids = explode(",", $_GET['c']); //get rid of that trailing "," } else { $category_ids = array("0"); } // logical operator $logical_operator = "or"; if (isset($_GET['lo']) and !empty($_GET['lo'])) { $logical_operator = $_GET['lo']; } $approved_text = " incident.incident_active = 1 "; $location_where = ""; // Break apart location variables, if necessary $southwest = array(); if (isset($_GET['sw'])) { $southwest = explode(",", $_GET['sw']); } $northeast = array(); if (isset($_GET['ne'])) { $northeast = explode(",", $_GET['ne']); } if (count($southwest) == 2 and count($northeast) == 2) { $lon_min = (double) $southwest[0]; $lon_max = (double) $northeast[0]; $lat_min = (double) $southwest[1]; $lat_max = (double) $northeast[1]; $location_where = ' AND (location.latitude >=' . $lat_min . ' AND location.latitude <=' . $lat_max . ' AND location.longitude >=' . $lon_min . ' AND location.longitude <=' . $lon_max . ') '; } $group_where = " AND ( " . $this->table_prefix . "simplegroups_groups_incident.simplegroups_groups_id = " . $group_id . ") "; $joins = groups::get_joins_for_groups($category_ids); $sg_category_to_table_mapping = groups::get_category_to_table_mapping(); $reports_count = adminmap_reports::get_reports_count($category_ids, $approved_text, $location_where . " AND " . $filter . $group_where, $logical_operator, $joins, $sg_category_to_table_mapping); echo $reports_count . " " . Kohana::config('settings.items_per_page'); // Pagination $pagination = new Pagination(array('query_string' => 'page', 'items_per_page' => (int) Kohana::config('settings.items_per_page'), 'total_items' => $reports_count)); $incidents = adminmap_reports::get_reports($category_ids, $approved_text, $location_where . " AND " . $filter . $group_where, $logical_operator, "incident.incident_date", "asc", (int) Kohana::config('settings.items_per_page'), $pagination->sql_offset, $joins, $sg_category_to_table_mapping); //Set default as not showing pagination. Will change below if necessary. $this->template->content->pagination = ""; // Pagination and Total Num of Report Stats if ($pagination->total_items == 1) { $plural = ""; } else { $plural = "s"; } if ($pagination->total_items > 0) { $current_page = $pagination->sql_offset / (int) Kohana::config('settings.items_per_page') + 1; $total_pages = ceil($pagination->total_items / (int) Kohana::config('settings.items_per_page')); if ($total_pages > 1) { // If we want to show pagination $this->template->content->pagination_stats = Kohana::lang('ui_admin.showing_page') . ' ' . $current_page . ' ' . Kohana::lang('ui_admin.of') . ' ' . $total_pages . ' ' . Kohana::lang('ui_admin.pages'); $this->template->content->pagination = $pagination; } else { // If we don't want to show pagination $this->template->content->pagination_stats = $pagination->total_items . ' ' . Kohana::lang('ui_admin.reports'); } } else { $this->template->content->pagination_stats = '(' . $pagination->total_items . ' report' . $plural . ')'; } //locations $location_in = array(); foreach ($incidents as $incident) { $location_in[] = $incident->location_id; } //check if location_in is not empty if (count($location_in) > 0) { // Get location names $query = 'SELECT id, location_name FROM ' . $this->table_prefix . 'location WHERE id IN (' . implode(',', $location_in) . ')'; $locations_query = $db->query($query); $locations = array(); foreach ($locations_query as $loc) { $locations[$loc->id] = $loc->location_name; } } else { $locations = array(); } $this->template->content->locations = $locations; //categories $localized_categories = array(); foreach ($incidents as $incident) { foreach ($incident->category as $category) { $ct = (string) $category->category_title; if (!isset($localized_categories[$ct])) { $translated_title = Category_Lang_Model::category_title($category->id, $l); $localized_categories[$ct] = $category->category_title; if ($translated_title) { $localized_categories[$ct] = $translated_title; } } } } $this->template->content->localized_categories = $localized_categories; // Category Title, if Category ID available $category_title = "All Categories"; $count = 0; foreach ($category_ids as $cat_id) { $category = ORM::factory('category')->find($cat_id); if ($category->loaded) { $count++; if ($count > 1) { $category_title = $category_title . " " . strtoupper($logical_operator) . " "; } $category_title = $category_title . $category->category_title; } } $this->template->content->category_title = $category_title . ": "; //GET countries $countries = array(); foreach (ORM::factory('country')->orderby('country')->find_all() as $country) { // Create a list of all categories $this_country = $country->country; if (strlen($this_country) > 35) { $this_country = substr($this_country, 0, 35) . "..."; } $countries[$country->id] = $this_country; } $this->template->content->countries = $countries; $this->template->content->incidents = $incidents; $this->template->content->pagination = $pagination; $this->template->content->form_error = $form_error; $this->template->content->form_saved = $form_saved; $this->template->content->form_action = $form_action; // Total Reports $this->template->content->total_items = $pagination->total_items; // Status Tab $this->template->content->status = $status; $this->template->header->header_block = $this->themes->header_block(); }
$usersClass->editExclusiveAuthor('false', $_GET['id']); } elseif (isset($_POST['exclusive_true'])) { $usersClass = new users(); $usersClass->editExclusiveAuthor('true', $_GET['id']); } $_POST = $cms->get($_GET['id']); $badges = explode(',', $_POST['badges']); $_POST['badges'] = array(); foreach ($badges as $badge) { $_POST['badges'][] = $badge; } } $users = $cms->get($_GET['id']); $users['stats'] = $cms->getStatistic($_GET['id']); abr('user', $users); require_once ROOT_PATH . '/apps/' . $_GET['m'] . '/models/groups.class.php'; $g = new groups(); $groups = $g->getAll(); abr('groups', $groups); require_once ROOT_PATH . '/apps/system/models/badges.class.php'; $badges = new badges(); $badges_data = $badges->getAll(0, 0, "`type` = 'other'"); abr('badges', $badges_data); if (isset($_POST['badges'])) { if (!is_array($_POST['badges'])) { $_POST['badges'] = explode(',', $_POST['badges']); } } else { $_POST['badges'] = array(); } require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';
<div class="bg"> <h2> <?php echo groups::manage_subtabs("view"); ?> </h2> </div> <?php if ($form_action) { ?> <!-- green-box --> <div class="green-box" id="submitStatus"> <h3> <?php echo $form_action; ?> </h3> </div> <?php } ?> <div class="table-holder"> <table class="table"> <thead> <tr> <th><?php echo Kohana::lang('simplegroups.group_name'); ?> </th>
function SMBGROUPS() { $gp = new groups(null); $gp->ChangeSMBGroupsSID(); $tpl = new templates(); if (posix_getuid() != 0) { echo $tpl->_ENGINE_parse_body("{success}<hr>{CHANGE_SID_COMPUTERS}", "samba.index.php"); } }
function create_group() { $ldap = new clladp(); $tpl = new templates(); $sock = new sockets(); $page = CurrentPageName(); $q = new mysql(); $sql = "SELECT * FROM register_orgs WHERE `zmd5`='{$_GET["key"]}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); $ou = $ligne["ou"]; if ($ligne["ou"] == null) { echo $tpl->_ENGINE_parse_body("{please_register_first}"); return; } $domain = $ligne["domain"]; $user = $ligne["username"]; $password = $ligne["password"]; $gp = new groups(); if (!$gp->add_new_group("administrators", $ou)) { $html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/42-red.png'></td>\n\t\t\t<td valign='top' style='font-size:16px'>{group}: administrators {failed} {$gp->ldap_error}</td>\n\t\t</tr>\n\t\t</table>"; echo $tpl->_ENGINE_parse_body($html); return; } $update_array = array(); $values[] = "[AllowEditOuSecurity]=\"yes\""; $values[] = "[AsOrgPostfixAdministrator]=\"yes\""; $values[] = "[AsQuarantineAdministrator]=\"yes\""; $values[] = "[AsOrgStorageAdministrator]=\"yes\""; $values[] = "[AsMessagingOrg]=\"yes\""; $values[] = "[AsOrgAdmin]=\"yes\""; $gppid = $gp->GroupIDFromName($ou, "administrators"); $gp = new groups($gppid); $update_array["ArticaGroupPrivileges"][0] = @implode("\n", $values); $ldap->Ldap_modify($gp->dn, $update_array); if ($ldap->ldap_last_error != null) { $html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/42-red.png'></td>\n\t\t\t<td valign='top' style='font-size:16px'>{group}: administrators ({$gppid}) {permissions} {failed} {$ldap->ldap_last_error}</td>\n\t\t</tr>\n\t\t</table>"; echo $tpl->_ENGINE_parse_body($html); return; } $EnableVirtualDomainsInMailBoxes = $sock->GET_INFO("EnableVirtualDomainsInMailBoxes"); $uid = $user; if ($EnableVirtualDomainsInMailBoxes == 1) { $uid = "{$user}@{$domain}"; } if (!$gp->AddUsertoThisGroup($uid)) { $html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/42-red.png'></td>\n\t\t\t<td valign='top' style='font-size:16px'>{group}: administrators ({$gppid}) {affect} {$uid} {$ldap->ldap_last_error}</td>\n\t\t</tr>\n\t\t</table>"; echo $tpl->_ENGINE_parse_body($html); return; } $html = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/42-green.png'></td>\n\t\t\t<td valign='top' style='font-size:16px'>{group}: administrators » {$uid} {success}</td>\n\t\t</tr>\n\t\t</table>\n\t\t<div id='step-5'></div>\n\t\t<script>\n\t\t\tLoadAjax('step-5','{$page}?create-groupwares=yes&key={$_GET["key"]}');\n\t\t</script>\t\t\n\t\t"; echo $tpl->_ENGINE_parse_body($html); return; }
public function restore() { //set the variables $db = $this->db; //get the $apps array from the installed apps from the core and mod directories $config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_menu.php"); $x = 0; foreach ($config_list as &$config_path) { $y = 0; try { //echo "[".$x ."] ".$config_path."\n"; include $config_path; $x++; } catch (Exception $e) { echo 'exception caught: ' . $e->getMessage() . "\n"; exit; } } //begin the transaction if ($db_type == "sqlite") { $db->beginTransaction(); } //use the app array to restore the default menu foreach ($apps as $row) { foreach ($row['menu'] as $menu) { //set the variables if (strlen($menu['title'][$this->menu_language]) > 0) { $menu_item_title = $menu['title'][$this->menu_language]; } else { $menu_item_title = $menu['title']['en-us']; } $menu_item_uuid = $menu['uuid']; $menu_item_parent_uuid = $menu['parent_uuid']; $menu_item_category = $menu['category']; $menu_item_icon = $menu['icon']; $menu_item_path = $menu['path']; $menu_item_order = $menu['order']; $menu_item_description = $menu['desc']; //if the item uuid is not currently in the db then add it $sql = "select * from v_menu_items "; $sql .= "where menu_uuid = '" . $this->menu_uuid . "' "; $sql .= "and menu_item_uuid = '" . $menu_item_uuid . "' "; $prep_statement = $db->prepare(check_sql($sql)); if ($prep_statement) { $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); if (count($result) == 0) { //insert the default menu into the database $sql = "insert into v_menu_items "; $sql .= "("; $sql .= "menu_item_uuid, "; $sql .= "menu_uuid, "; $sql .= "menu_item_title, "; $sql .= "menu_item_link, "; $sql .= "menu_item_category, "; $sql .= "menu_item_icon, "; if (strlen($menu_item_order) > 0) { $sql .= "menu_item_order, "; } if (strlen($menu_item_parent_uuid) > 0) { $sql .= "menu_item_parent_uuid, "; } $sql .= "menu_item_description "; $sql .= ") "; $sql .= "values "; $sql .= "("; $sql .= "'" . $menu_item_uuid . "', "; $sql .= "'" . $this->menu_uuid . "', "; $sql .= "'" . check_str($menu_item_title) . "', "; $sql .= "'{$menu_item_path}', "; $sql .= "'{$menu_item_category}', "; $sql .= "'{$menu_item_icon}', "; if (strlen($menu_item_order) > 0) { $sql .= "'{$menu_item_order}', "; } if (strlen($menu_item_parent_uuid) > 0) { $sql .= "'{$menu_item_parent_uuid}', "; } $sql .= "'{$menu_item_description}' "; $sql .= ")"; if ($menu_item_uuid == $menu_item_parent_uuid) { //echo $sql."<br />\n"; } else { $db->exec(check_sql($sql)); } unset($sql); //set the menu languages foreach ($menu["title"] as $menu_language => $menu_item_title) { $menu_language_uuid = uuid(); $sql = "insert into v_menu_languages "; $sql .= "("; $sql .= "menu_language_uuid, "; $sql .= "menu_item_uuid, "; $sql .= "menu_uuid, "; $sql .= "menu_language, "; $sql .= "menu_item_title "; $sql .= ") "; $sql .= "values "; $sql .= "("; $sql .= "'" . $menu_language_uuid . "', "; $sql .= "'" . $menu_item_uuid . "', "; $sql .= "'" . $this->menu_uuid . "', "; $sql .= "'" . $menu_language . "', "; $sql .= "'" . check_str($menu_item_title) . "' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); } } } } } //make sure the default user groups exist $group = new groups(); $group->defaults(); //get default global group_uuids $sql = "select group_uuid, group_name from v_groups "; $sql .= "where domain_uuid is null "; $sql .= "and ( "; $sql .= "\tgroup_name = 'public' "; $sql .= "\tor group_name = 'user' "; $sql .= "\tor group_name = 'admin' "; $sql .= "\tor group_name = 'superadmin' "; $sql .= "\tor group_name = 'agent' "; $sql .= ") "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { $group_uuids[$row['group_name']] = $row['group_uuid']; } unset($sql, $prep_statement, $result); //if there are no groups listed in v_menu_item_groups under menu_item_uuid then add the default groups foreach ($apps as $app) { foreach ($app['menu'] as $sub_row) { if (isset($sub_row['groups'])) { foreach ($sub_row['groups'] as $group) { $sql = "select count(*) as count from v_menu_item_groups "; $sql .= "where menu_item_uuid = '" . $sub_row['uuid'] . "' "; $sql .= "and menu_uuid = '" . $this->menu_uuid . "' "; $sql .= "and group_name = '" . $group . "' "; $sql .= "and group_uuid = '" . $group_uuids[$group] . "' "; //echo $sql."<br>"; $prep_statement = $db->prepare($sql); $prep_statement->execute(); $sub_result = $prep_statement->fetch(PDO::FETCH_ASSOC); unset($prep_statement); if ($sub_result['count'] == 0) { //no menu item groups found add the defaults $sql = "insert into v_menu_item_groups "; $sql .= "( "; $sql .= "menu_item_group_uuid, "; $sql .= "menu_uuid, "; $sql .= "menu_item_uuid, "; $sql .= "group_name, "; $sql .= "group_uuid "; $sql .= ") "; $sql .= "values "; $sql .= "( "; $sql .= "'" . uuid() . "', "; $sql .= "'" . $this->menu_uuid . "', "; $sql .= "'" . $sub_row['uuid'] . "', "; $sql .= "'" . $group . "', "; $sql .= "'" . $group_uuids[$group] . "' "; $sql .= ") "; //echo $sql."<br>"; $db->exec(check_sql($sql)); unset($sql); } } } } } //commit the transaction if ($db_type == "sqlite") { $db->commit(); } }
function ldap_groups(){ $gp=new groups(); $gp->EditSambaGroups(); $gp->SambaGroupsBuild(); $gp->CreateGuestUser(); }
function popup_add() { $uid = base64_decode($_GET["add_already_member_add"]); $group = new groups($_GET["gpid"]); $group->AddUsertoThisGroup($uid); }
for the specific language governing rights and limitations under the License. The Original Code is FusionPBX The Initial Developer of the Original Code is Mark J Crane <*****@*****.**> Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane <*****@*****.**> */ if ($domains_processed == 1) { //if the default groups do not exist add them $group = new groups(); $group->defaults(); //find rows that have a null group_uuid and set the correct group_uuid $sql = "select * from v_group_users "; $sql .= "where group_uuid is null; "; $prep_statement = $db->prepare(check_sql($sql)); if ($prep_statement) { $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $db->beginTransaction(); foreach ($result as $row) { if (strlen($row['group_name']) > 0) { //get the group_uuid $sql = "select group_uuid from v_groups "; $sql .= "where group_name = '" . $row['group_name'] . "' "; $prep_statement_sub = $db->prepare($sql);
* * PHP version 5 * LICENSE: This source file is subject to LGPL license * that is available through the world-wide-web at the following URI: * http://www.gnu.org/copyleft/lesser.html * @author Ushahidi Team <*****@*****.**> * @package Ushahidi - http://source.ushahididev.com * @module API Controller * @copyright Ushahidi - http://www.ushahidi.com * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL) */ ?> <div class="bg"> <h2> <?php groups::reports_subtabs("edit"); ?> </h2> <?php print form::open(NULL, array('enctype' => 'multipart/form-data', 'id' => 'reportForm', 'name' => 'reportForm')); ?> <input type="hidden" name="save" id="save" value=""> <input type="hidden" name="location_id" id="location_id" value="<?php print $form['location_id']; ?> "> <input type="hidden" name="incident_zoom" id="incident_zoom" value="<?php print $form['incident_zoom']; ?> "> <!-- report-form -->
function edit($id = false, $saved = false) { // If user doesn't have access, redirect to dashboard if (!groups::permissions($this->user, "settings")) { url::redirect(url::site() . 'admin/dashboard'); } $this->template->content = new View('simplegroups/simplegroups_editgroups'); $this->template->content->title = "edit group"; $this->template->content->logo_file = false; $this->template->content->users = array(); // setup and initialize form field names $form = array('name' => '', 'description' => '', 'logo' => '', 'own_instance' => '', 'contact_person' => '', 'contact_email' => '', 'contact_phone' => '', 'contact_address' => '', 'group_site' => ''); //initialize this stuff $this->template->content->whitelist = array(); // copy the form as errors, so the errors will be stored with keys corresponding to the form field names $errors = $form; $form_error = FALSE; if ($saved == 'saved') { $form_saved = TRUE; } else { $form_saved = FALSE; } // check, has the form been submitted, if so, setup validation if ($_POST) { // Instantiate Validation, use $post, so we don't overwrite $_POST fields with our own things $post = Validation::factory(array_merge($_POST, $_FILES)); // Add some filters $post->pre_filter('trim', TRUE); // Add some rules, the input field, followed by a list of checks, carried out in order // $post->add_rules('locale','required','alpha_dash','length[5]'); $post->add_rules('name', 'required', 'length[1,100]'); $post->add_rules('description', 'required'); $post->add_rules('own_instance', 'length[3,1000]'); // Validate photo uploads $post->add_rules('logo', 'upload::valid', 'upload::type[gif,jpg,png]', 'upload::size[8M]'); //add validation rules as needed for the contact info stuff $post->add_rules('contact_person', 'length[1,99]'); $post->add_rules('contact_email', 'length[1,99]', 'valid::email'); $post->add_rules('contact_phone', 'length[1,99]'); $post->add_rules('group_site', 'valid::url'); // Test to see if things passed the rule checks if ($post->validate()) { // Save the Group $group = new simplegroups_groups_Model($id); $group->name = $post->name; $group->description = $post->description; $group->own_instance = $post->own_instance; $group->contact_person = $post->contact_person; $group->contact_email = $post->contact_email; $group->contact_phone = $post->contact_phone; $group->contact_address = $post->contact_address; $group->group_site = $post->group_site; $group->save(); //logo $filename = upload::save('logo'); if ($filename) { if (!is_dir(Kohana::config('upload.directory', TRUE) . "groups")) { mkdir(Kohana::config('upload.directory', TRUE) . "groups", 0770, true); } $new_filename = $group->id . "_simple_group_logo"; //Resize original file... make sure its max 408px wide Image::factory($filename)->save(Kohana::config('upload.directory', TRUE) . "groups/" . $new_filename . ".jpg"); // Create thumbnail Image::factory($filename)->save(Kohana::config('upload.directory', TRUE) . "groups/" . $new_filename . "_t.jpg"); // Remove the temporary file unlink($filename); $group->logo = $new_filename; } $group->save(); $id = $group->id; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //now loop over the existing values $ids_still_there = array(); foreach ($_POST as $key => $value) { if (substr($key, 0, 22) == "white_list_number_old_") { $new_id = substr($key, 22); $ids_still_there[] = $new_id; $number_item = ORM::factory('simplegroups_groups_number', $new_id); $number = trim($_POST["white_list_number_old_{$new_id}"]); if (!$this->_check_length($number, 6, 30, "Can't have a phone number with more than 30 characters or less than 6", $form, $post, $id)) { return; } $number_item->number = $number; $name = trim($_POST["white_list_name_old_{$new_id}"]); if (!$this->_check_length($value, 0, 100, "Can't have a phone number name with more than 100 characters", $form, $post, $id)) { return; } $number_item->name = $name; $org = trim($_POST["white_list_org_old_{$new_id}"]); if (!$this->_check_length($org, 0, 100, "Can't have a phone number organization with more than 100 characters", $form, $post, $id)) { return; } $number_item->org = $org; $number_item->simplegroups_groups_id = $id; $number_item->save(); } } //end loop //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Find what IDs weren't included above and delete them //but first check and see if there are any ids in the $ids_still_there variable $number_items = ORM::factory('simplegroups_groups_number')->where("simplegroups_groups_id", $id); if (count($ids_still_there) > 0) { $number_items = $number_items->where("NOT ( `id` IN (" . implode(',', $ids_still_there) . "))"); } $number_items->delete_all(); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //do the white list of numbers for this group //loop through the post variables and find all the ones that start with white_list_number_new_ //We'll make new entries for each one of these foreach ($_POST as $key => $value) { if (substr($key, 0, 22) == "white_list_number_new_") { $new_id = substr($key, 22); $number_item = ORM::factory('simplegroups_groups_number'); $number = trim($_POST["white_list_number_new_{$new_id}"]); if (!$this->_check_length($number, 6, 30, "Can't have a phone number with more than 30 characters or less than 6", $form, $post, $id)) { return; } $number_item->number = $number; $name = trim($_POST["white_list_name_new_{$new_id}"]); if (!$this->_check_length($value, 0, 100, "Can't have a phone number name with more than 100 characters", $form, $post, $id)) { return; } $number_item->name = $name; $org = trim($_POST["white_list_org_new_{$new_id}"]); if (!$this->_check_length($org, 0, 100, "Can't have a phone number organization with more than 100 characters", $form, $post, $id)) { return; } $number_item->org = $org; $number_item->simplegroups_groups_id = $id; $number_item->save(); } } //end loop //update the users //delete everything ORM::factory('simplegroups_groups_users')->where("simplegroups_groups_id", $id)->delete_all(); //put it all backtogether foreach ($_POST as $post_id => $data) { if (substr($post_id, 0, 8) == "user_id_") { //get the user ID number $user_id = substr($post_id, 8); $user_item = ORM::factory('simplegroups_groups_users'); $user_item->simplegroups_groups_id = $id; $user_item->users_id = $user_id; $user_item->save(); } } //end for each //update the users to roles mapping //delete everything $roles = ORM::factory('simplegroups_users_roles')->join('simplegroups_groups_users', 'simplegroups_users_roles.users_id', 'simplegroups_groups_users.users_id', 'LEFT')->where("simplegroups_groups_users.simplegroups_groups_id", $id)->find_all(); foreach ($roles as $role) { $role->delete(); } //put it all backtogether foreach ($_POST as $post_id => $data) { if (substr($post_id, 0, 8) == "role_id_") { //get the user ID number $ids_str = substr($post_id, 8); $position_of_ = strpos($ids_str, "_"); $user_id = substr($ids_str, 0, $position_of_); $role_id = substr($ids_str, $position_of_ + 1); $user_role = ORM::factory('simplegroups_users_roles'); $user_role->roles_id = $role_id; $user_role->users_id = $user_id; $user_role->save(); } } //end for each // SAVE AND CLOSE? if ($post->save == 1) { url::redirect('admin/simplegroups_settings/edit/' . $group->id . '/saved'); } else { url::redirect('admin/simplegroups_settings/'); } } else { // repopulate the form fields $form = arr::overwrite($form, $post->as_array()); // populate the error fields, if any $errors = arr::overwrite($errors, $post->errors('simplegroups')); $form_error = TRUE; } } else { if ($id) { // Retrieve Current group $group = ORM::factory('simplegroups_groups', $id); if ($group->loaded == true) { // Combine Everything $group_arr = array('name' => $group->name, 'description' => $group->description, 'own_instance' => $group->own_instance, 'contact_person' => $group->contact_person, 'contact_email' => $group->contact_email, 'contact_phone' => $group->contact_phone, 'contact_address' => $group->contact_address, 'group_site' => $group->group_site); $this->template->content->logo_file = $group->logo; // Merge To Form Array For Display $form = arr::overwrite($form, $group_arr); $listers = ORM::factory('simplegroups_groups_number')->where("simplegroups_groups_id", $id)->find_all(); $this->template->content->whitelist = $listers; } else { // Redirect //url::redirect('admin/simplegroup_settings/'); } } $this->template->content->users = groups::get_available_users_for_group($id); $this->template->content->group_roles = groups::get_group_roles(); $this->template->content->group_users_roles = groups::get_group_users_to_roles_mapping($id); } $this->template->content->id = $id; $this->template->content->form = $form; $this->template->content->errors = $errors; $this->template->content->form_error = $form_error; $this->template->content->form_saved = $form_saved; // Javascript Header $this->template->editor_enabled = TRUE; $this->template->js = new View('simplegroups/simplegroups_editgroups_js'); }
* PHP version 5 * LICENSE: This source file is subject to LGPL license * that is available through the world-wide-web at the following URI: * http://www.gnu.org/copyleft/lesser.html * @author Ushahidi Team <*****@*****.**> * @package Ushahidi - http://source.ushahididev.com * @module API Controller * @copyright Ushahidi - http://www.ushahidi.com * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL) */ ?> <div class="bg"> <h2> <?php groups::reports_subtabs("upload"); ?> </h2> <h3><?php echo Kohana::lang('ui_main.upload_successful'); ?> </h3> <p><?php echo Kohana::lang('ui_main.successfuly_imported'); ?> <?php echo $imported; ?> of <?php echo $rowcount;
function ApplySingleAcls($directory) { $unix = new unix(); $chmod_bin = $unix->find_program("chmod"); $setfacl_bin = $unix->find_program("setfacl"); $recursive = null; $chmod = null; $q = new mysql(); $dir = $unix->shellEscapeChars($directory); if (!is_dir($directory)) { echo "Starting......: acls {$directory} no such directory\n"; $q->QUERY_SQL("DELETE FROM acl_directories WHERE `directory`='{$directory}'"); if (!$q->ok) { echo $q->mysql_error . "\n"; } return; } $acls = new aclsdirs($directory); echo "Starting......: acls \"{$dir}\" directory\n"; if (!is_numeric($acls->chmod_octal)) { $events[] = "octal is not a numeric value..."; } if (is_numeric($acls->chmod_octal)) { $events[] = "octal \"{$acls->chmod_octal}\""; if (chmod_recursive == 1) { $events[] = "Recursive mode"; $recursive = " -R "; } $chmod = " " . $acls->chmod_octal; } if ($chmod != null) { $cmd = "{$chmod_bin}{$recursive}{$chmod} {$dir}"; $events[] = "{$cmd}"; exec("{$chmod_bin}{$recursive}{$chmod} {$dir} 2>&1", $events); } if (strlen($setfacl_bin) < 3) { $events[] = "ERROR: setfacl no such binary file"; $events_text = @implode("\n", $events); if ($GLOBALS["VERBOSE"]) { echo $events_text . "\n"; } $sql = "UPDATE acl_directories SET events='" . addslashes($events_text) . "' WHERE `md5`='{$acls->md5}'"; if ($GLOBALS["VERBOSE"]) { echo $sql . "\n"; } $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "{$q->mysql_error}\n"; } return; } $cmd = "{$setfacl_bin} -b {$dir} 2>&1"; $events[] = $cmd; exec("{$cmd}", $events); if ($GLOBALS["VERBOSE"]) { if (!is_array($acls->acls_array)) { echo "acls_array not an Array\n"; } } print_r($acls->acls_array); $gp = new groups(); if (is_array($acls->acls_array["GROUPS"])) { while (list($groupname, $array) = each($acls->acls_array["GROUPS"])) { $perms = array(); $perms_strings = null; $recurs = null; if ($array["r"] == 1) { $perms[] = "r"; } if ($array["w"] == 1) { $perms[] = "w"; } if ($array["x"] == 1) { $perms[] = "x"; } $perms_strings = @implode("", $perms); if ($perms_strings == null) { $events[] = "No permissions set for {$groupname}"; continue; } if ($acls->acls_array["recursive"] == 1) { $recurs = "-R "; } $gpid = $gp->GroupIDFromGetEnt($groupname); $groupname = utf8_encode($groupname); if ($GLOBALS["VERBOSE"]) { echo "`{$groupname}` as gidNumber `{$gpid}`\n"; } if (is_numeric($gpid)) { if ($gpid > 0) { $groupname = $gpid; } } $cmd = "{$setfacl_bin} {$recurs}-m g:\"{$groupname}\":{$perms_strings} {$dir} 2>&1"; $events[] = $cmd; exec("{$cmd}", $events); if ($acls->acls_array["default"] == 1) { $groupname = utf8_encode($groupname); $cmd = "{$setfacl_bin} {$recurs}-m d:g:\"{$groupname}\":{$perms_strings} {$dir} 2>&1"; $events[] = $cmd; exec("{$cmd}", $events); } } } else { $events[] = "Groups: No acls\n"; } if (is_array($acls->acls_array["MEMBERS"])) { while (list($member, $array) = each($acls->acls_array["MEMBERS"])) { $perms = array(); $perms_strings = null; $recurs = null; if ($array["r"] == 1) { $perms[] = "r"; } if ($array["w"] == 1) { $perms[] = "w"; } if ($array["x"] == 1) { $perms[] = "x"; } $perms_strings = @implode("", $perms); if ($perms_strings == null) { $events[] = "No permissions set for {$member}"; continue; } if ($acls->acls_array["recursive"] == 1) { $recurs = "R"; } $member = utf8_encode($member); $cmd = "{$setfacl_bin} -m{$recurs} u:\"{$member}\":{$perms_strings} {$dir} 2>&1"; $events[] = $cmd; exec("{$cmd}", $events); if ($acls->acls_array["default"] == 1) { $member = utf8_encode($member); $cmd = "{$setfacl_bin} -m{$recurs} d:u:\"{$member}\":{$perms_strings} {$dir} 2>&1"; $events[] = $cmd; exec("{$cmd}", $events); } } } else { $events[] = "Members: No acls\n"; } $events_text = @implode("\n", $events); if ($GLOBALS["VERBOSE"]) { echo $events_text . "\n"; } $sql = "UPDATE acl_directories SET events='" . addslashes($events_text) . "' WHERE `md5`='{$acls->md5}'"; $q->QUERY_SQL($sql, "artica_backup"); }
/** * End Time English Language file * * This plugin was written for Ushahidi Liberia, by the contractors of Ushahidi Liberia * 2011 * * @package End Time plugin * @author Ushahidi Liberia <*****@*****.**> * */ ?> <div class="bg"> <h2> <?php groups::reports_subtabs("comments"); ?> </h2> <!-- tabs --> <div class="tabs"> <!-- tabset --> <ul class="tabset"> <li><a href="?status=0" <?php if ($status != 'a' && $status != 'p' && $status != 's') { echo "class=\"active\""; } ?> ><?php echo Kohana::lang('ui_main.show_all'); ?> </a></li>
function ChangeGroupDescription_save() { $group = new groups($_POST["gpid"]); if (!$group->SaveDescription($_POST["SaveGrouPdescript"])) { echo $group->ldap_error; } }
// +---------------------------------------------------------------------- // | Email author@demila.org // +---------------------------------------------------------------------- define('USING_LANGUAGE', false); require_once '../../../config.php'; require_once $config['root_path'] . '/core/functions.php'; include_once $config['system_core'] . "/initEngine.php"; admin_login(); if (isset($_POST['deleteUser']) && isset($_POST['id']) && isset($_SESSION['user']['access']['users'])) { require_once ROOT_PATH . "/apps/users/models/users.class.php"; $cms = new users(); $cms->delete(intval($_POST['id'])); die(json_encode(array_merge($_POST, array('status' => 'true')))); } elseif (isset($_POST['deleteUserGroup']) && isset($_POST['id']) && isset($_SESSION['user']['access']['users'])) { require_once ROOT_PATH . "/apps/users/models/groups.class.php"; $cms = new groups(); $cms->delete(intval($_POST['id'])); die(json_encode(array_merge($_POST, array('status' => 'true')))); } elseif (isset($_POST['deleteWithdraw']) && isset($_POST['id']) && isset($_SESSION['user']['access']['users'])) { require_once ROOT_PATH . "/apps/users/models/deposit.class.php"; $cms = new deposit(); $cms->deleteWithdraw(intval($_POST['id'])); die(json_encode(array_merge($_POST, array('status' => 'true')))); } elseif (isset($_POST['deleteComment']) && isset($_POST['id']) && isset($_SESSION['user']['access']['users'])) { require_once ROOT_PATH . "/apps/items/models/comments.class.php"; $cms = new comments(); $cms->delete(intval($_POST['id'])); die(json_encode(array_merge($_POST, array('status' => 'true')))); } elseif (isset($_POST['deleteBalance']) && isset($_POST['id']) && isset($_SESSION['user']['access']['users'])) { require_once ROOT_PATH . "/apps/users/models/balance.class.php"; $cms = new balance();
<?php include_once 'includes/configuration/core_configuration.php'; include_once "includes/commonPages/system_header.php"; $result = prolog::lookupUser($_SESSION['valid_user']); echo 'Knowledge Base data: ' . $result . '<br>'; $groups = groups::getUserGroupNames($_SESSION['valid_user']); echo '<br>'; $xmlParser = new XMLtoArray("jobSpecification.xml"); $xmlTree = $xmlParser->process(); //Package the xml data $xmlPackage = xmlPackage::package($xmlTree); xmlPackage::displayArchiveItem($xmlPackage, $workflowID, 'workflowarchive', 'Archived Workflow', 'archiveView'); include_once "includes/commonPages/system_footer.php";
* * PHP version 5 * LICENSE: This source file is subject to LGPL license * that is available through the world-wide-web at the following URI: * http://www.gnu.org/copyleft/lesser.html * @author Ushahidi Team <*****@*****.**> * @package Ushahidi - http://source.ushahididev.com * @module API Controller * @copyright Ushahidi - http://www.ushahidi.com * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL) */ ?> <div class="bg"> <h2> <?php groups::users_subtabs("users"); ?> </h2> <!-- report-table --> <div class="report-form"> <!-- report-table --> <?php print form::open(); ?> <input type="hidden" name="action" id="action" value=""> <div class="table-holder"> <table class="table"> <thead> <tr> <th class="col-1">
public function timeline($group_id = false, $category_ids = "0,") { if (!$group_id) { echo '{"type": "FeatureCollection", "features"; []}'; return; } //make sure they can't see anything private $_GET['u'] = "1"; $group_where = " AND ( " . $this->table_prefix . "simplegroups_groups_incident.simplegroups_groups_id = " . $group_id . ") "; $category_ids_array = explode(",", $category_ids, -1); //get rid of that trailing ";" $joins = groups::get_joins_for_groups($category_ids_array); $sg_category_to_table_mapping = groups::get_category_to_table_mapping(); adminmap_helper::json_timeline($this, $category_ids, true, $group_where, $joins = $joins, $sg_category_to_table_mapping); }
public function upload() { $permissions = groups::get_permissions_for_user($this->user->id); if (!$permissions["edit_group_settings"]) { url::redirect(url::site() . 'admin/simplegroups/dashboard'); } if ($_SERVER['REQUEST_METHOD'] == 'GET') { $this->template->content = new View('simplegroups/reports_upload'); $this->template->content->title = 'Upload Reports'; $this->template->content->form_error = false; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $errors = array(); $notices = array(); if (!$_FILES['csvfile']['error']) { if (file_exists($_FILES['csvfile']['tmp_name'])) { if ($filehandle = fopen($_FILES['csvfile']['tmp_name'], 'r')) { $importer = new SimpleGroupsReportsImporter(); if ($importer->import($filehandle, $this->group)) { $this->template->content = new View('simplegroups/reports_upload_success'); $this->template->content->title = 'Upload Reports'; $this->template->content->rowcount = $importer->totalrows; $this->template->content->imported = $importer->importedrows; $this->template->content->notices = $importer->notices; } else { $errors = $importer->errors; } } else { $errors[] = Kohana::lang('ui_admin.file_open_error'); } } else { $errors[] = Kohana::lang('ui_admin.file_not_found_upload'); } } else { $errors[] = $_FILES['csvfile']['error']; } if (count($errors)) { $this->template->content = new View('simplegroups/reports_upload'); $this->template->content->title = Kohana::lang('ui_admin.upload_reports'); $this->template->content->errors = $errors; $this->template->content->form_error = 1; } } // _POST }