public function create() { $model = new group(); $model->addgroup($_POST["lakeHostGroup"]); /*** Redirect User to Group/Index ***/ header("location: index.php?rt=group/index"); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $group = new group(); $group->name = $request->input('name'); $group->body = $request->input('body'); $group->group_type = $request->input('group_type'); if ($request->get('address')) { $group->address = $request->input('address'); if (!$group->geocode()) { flash()->error(trans('messages.address_cannot_be_geocoded')); } else { flash()->info(trans('messages.ressource_geocoded_successfully')); } } if ($group->isInvalid()) { // Oops. return redirect()->action('GroupController@create')->withErrors($group->getErrors())->withInput(); } $group->save(); // handle cover if ($request->hasFile('cover')) { Storage::disk('local')->makeDirectory('groups/' . $group->id); Image::make($request->file('cover'))->widen(800)->save(storage_path() . '/app/groups/' . $group->id . '/cover.jpg'); Image::make($request->file('cover'))->fit(300, 200)->save(storage_path() . '/app/groups/' . $group->id . '/thumbnail.jpg'); } // make the current user a member of the group $membership = \App\Membership::firstOrNew(['user_id' => $request->user()->id, 'group_id' => $group->id]); $membership->notification_interval = 60 * 24; // default to daily interval $membership->membership = \App\Membership::MEMBER; $membership->save(); return redirect()->action('MembershipController@settings', [$group->id]); }
function person_rm_groups($groups) { foreach ($groups as $i => $groupdata) { $group = new group($groupdata['id']); $group->delete(); } }
function getGroup() { $groupid = $this->getGroupID(); if ($groupid != false) { $group = new group($this->getGroupID()); if ($group->getID() != false) { //valid group return $group; } } return false; }
private static function save($group_id, $group_name) { if ($group_id * 1 === -1) { $group = new group(); $group->name = $group_name; $group->insert(); } else { $group = new group(); $group->id = $group_id; $group->name = $group_name; $group->update(); } }
public function search($params) { $query = group::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $dataProvider->setSort(['defaultOrder' => ['parentId' => SORT_ASC, 'name' => SORT_ASC]]); $query->andFilterWhere([group::tableName() . '.status' => '1']); if (!($this->load($params) && $this->validate())) { $query->joinWith(['parent']); return $dataProvider; } /*$query->andFilterWhere([ 'Id' => $this->Id, 'createdon' => $this->createdon, ]);//*/ $query->andFilterWhere(['like', group::tableName() . '.name', $this->name]); //->andFilterWhere(['like', 'parentId', $this->ParentGroup]) //->andFilterWhere(['like', 'status', $this->status]); if ($this->parentGroup != '' && strtolower($this->parentGroup) != 'root') { $query->joinWith(['parent' => function ($q) { $q->where('parent.name LIKE "%' . $this->parentGroup . '%" '); }]); } else { if (strtolower($this->parentGroup) == 'root') { $query->andFilterWhere([group::tableName() . '.parentId' => 0]); } } return $dataProvider; }
static function install() { $db = Database::instance(); $version = module::get_version("user"); if ($version == 0) { $db->query("CREATE TABLE IF NOT EXISTS {users} (\n `id` int(9) NOT NULL auto_increment,\n `name` varchar(32) NOT NULL,\n `full_name` varchar(255) NOT NULL,\n `password` varchar(64) NOT NULL,\n `login_count` int(10) unsigned NOT NULL DEFAULT 0,\n `last_login` int(10) unsigned NOT NULL DEFAULT 0,\n `email` varchar(64) default NULL,\n `admin` BOOLEAN default 0,\n `guest` BOOLEAN default 0,\n `hash` char(32) default NULL,\n `url` varchar(255) default NULL,\n `locale` char(10) default NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY(`hash`),\n UNIQUE KEY(`name`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE IF NOT EXISTS {groups} (\n `id` int(9) NOT NULL auto_increment,\n `name` char(64) default NULL,\n `special` BOOLEAN default 0,\n PRIMARY KEY (`id`),\n UNIQUE KEY(`name`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE IF NOT EXISTS {groups_users} (\n `group_id` int(9) NOT NULL,\n `user_id` int(9) NOT NULL,\n PRIMARY KEY (`group_id`, `user_id`),\n UNIQUE KEY(`user_id`, `group_id`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $everybody = group::create("Everybody"); $everybody->special = true; $everybody->save(); $registered = group::create("Registered Users"); $registered->special = true; $registered->save(); $guest = user::create("guest", "Guest User", ""); $guest->guest = true; $guest->remove($registered); $guest->save(); $admin = user::create("admin", "Gallery Administrator", "admin"); $admin->admin = true; $admin->save(); // Let the admin own everything $db->update("items", array("owner_id" => $admin->id), array("owner_id" => "IS NULL")); module::set_version("user", 1); $root = ORM::factory("item", 1); access::allow($everybody, "view", $root); access::allow($everybody, "view_full", $root); access::allow($registered, "view", $root); access::allow($registered, "view_full", $root); } }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show(Request $request) { $groups = group::lists('name', 'group_id'); $locations = location::orderBy('location_id')->lists('location', 'location_id'); //$locations = array_merge($locations, array('0', 'National')); $group_id = $request->input('group_id'); $location_id = $request->input('location_id'); if (!isset($group_id)) { $group_id = 1; } if (!isset($location_id)) { $location_id = 0; } /* $rankings = \DB::table('rankings') ->join('players', 'rankings.player_id', '=', 'players.player_id') ->join('groups', 'rankings.group_id', '=', 'groups.group_id') ->join('locations', 'rankings.location_id', '=', 'locations.location_id') ->where('ranking_date', '=', $latest_date) ->where('rankings.group_id', '=', $group_id) ->where('rankings.location_id', '=', $location_id) ->distinct() ->get(); */ $ranking = new Ranking(); $rankings = $ranking->getlatestRankings($group_id, $location_id); return view('pages/rankings', compact('rankings', 'groups', 'locations')); }
function pg_new_edit($pg) { $group = new group(); foreach ($pg as $gid => $persons) { $group->load($gid); if (!$group->is_head()) { continue; } foreach ($persons as $pid => $decision) { if ($decision == 0) { continue; } $group->del_member_request($pid); if ($decision == 1) { continue; } $group->add_member($pid); } } }
function superuser($id = "") { if (!$id and $id = user::id()) { $id = user::id(); } $userArray = user::get($id); if (group::superuser($userArray[group])) { return TRUE; } else { return FALSE; } }
public function cant_view_comments_for_unviewable_items_test() { $root = ORM::factory("item", 1); $album = album::create($root, rand(), rand(), rand()); $comment = comment::create($album, user::guest(), "text", "name", "email", "url"); user::set_active(user::guest()); // We can see the comment when permissions are granted on the album access::allow(group::everybody(), "view", $album); $this->assert_equal(1, ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all()); // We can't see the comment when permissions are denied on the album access::deny(group::everybody(), "view", $album); $this->assert_equal(0, ORM::factory("comment")->viewable()->where("comments.id", $comment->id)->count_all()); }
public function viewable_test() { $root = ORM::factory("item", 1); $album = album::create($root, rand(), rand(), rand()); $item = self::_create_random_item($album); user::set_active(user::guest()); // We can see the item when permissions are granted access::allow(group::everybody(), "view", $album); $this->assert_equal(1, ORM::factory("item")->viewable()->where("id", $item->id)->count_all()); // We can't see the item when permissions are denied access::deny(group::everybody(), "view", $album); $this->assert_equal(0, ORM::factory("item")->viewable()->where("id", $item->id)->count_all()); }
/** * Create a new user. * * @param string $name * @param string $full_name * @param string $password * @return User_Model */ static function create($name, $full_name, $password) { $user = ORM::factory("user")->where("name", $name)->find(); if ($user->loaded) { throw new Exception("@todo USER_ALREADY_EXISTS {$name}"); } $user->name = $name; $user->full_name = $full_name; $user->password = $password; // Required groups $user->add(group::everybody()); $user->add(group::registered_users()); $user->save(); return $user; }
public function change_photo_no_csrf_fails_test() { $controller = new Photos_Controller(); $root = ORM::factory("item", 1); $photo = photo::create($root, MODPATH . "gallery/tests/test.jpg", "test", "test", "test"); $_POST["name"] = "new name"; $_POST["title"] = "new title"; $_POST["description"] = "new description"; access::allow(group::everybody(), "edit", $root); try { $controller->_update($photo); $this->assert_true(false, "This should fail"); } catch (Exception $e) { // pass } }
public function change_album_no_csrf_fails_test() { $controller = new Albums_Controller(); $root = ORM::factory("item", 1); $this->_album = album::create($root, "test", "test", "test"); $_POST["name"] = "new name"; $_POST["title"] = "new title"; $_POST["description"] = "new description"; access::allow(group::everybody(), "edit", $root); try { $controller->_update($this->_album); $this->assert_true(false, "This should fail"); } catch (Exception $e) { // pass } }
/** * Handle any business logic necessary to create or update a user. * @see ORM::save() * * @return ORM User_Model */ public function save() { if (!$this->loaded()) { // New user $this->add(group::everybody()); if (!$this->guest) { $this->add(group::registered_users()); } parent::save(); module::event("user_created", $this); } else { // Updated user $original = ORM::factory("user", $this->id); parent::save(); module::event("user_updated", $original, $this); } return $this; }
public function print_photo($id) { access::verify_csrf(); $item = ORM::factory("item", $id); access::required("view", $item); if (access::group_can(group::everybody(), "view_full", $item)) { $full_url = $item->file_url(true); $thumb_url = $item->thumb_url(true); } else { $proxy = ORM::factory("digibug_proxy"); $proxy->uuid = md5(rand()); $proxy->item_id = $item->id; $proxy->save(); $full_url = url::abs_site("digibug/print_proxy/full/{$proxy->uuid}"); $thumb_url = url::abs_site("digibug/print_proxy/thumb/{$proxy->uuid}"); } $v = new View("digibug_form.html"); $v->order_parms = array("digibug_api_version" => "100", "company_id" => module::get_var("digibug", "company_id"), "event_id" => module::get_var("digibug", "event_id"), "cmd" => "addimg", "partner_code" => "69", "return_url" => url::abs_site("digibug/close_window"), "num_images" => "1", "image_1" => $full_url, "thumb_1" => $thumb_url, "image_height_1" => $item->height, "image_width_1" => $item->width, "thumb_height_1" => $item->thumb_height, "thumb_width_1" => $item->thumb_width, "title_1" => html::purify($item->title)); print $v; }
function grouppable($data, $group) { // Creamos un nuevo grupo. $group = new group(array(data_field => $group[data_field], count_field => $group[count_field], order => $group[order])); // Asociamos el contenido ($data) con el grupo ($group) foreach ($data as $el) { /* elm -> el identificador. /!\ Lo pasamos a minusculas para poder agrupar correctamente. Ej. cosa,COSA deberian ser un mismo elm.*/ $elm = strtolower($el[$group->dataField()]); // elm_qty -> cantidad $elm_qty = $el[$group->countField()]; // Si existe este elemento, lo incrementamos if ($group->exist($elm)) { $group->increment($elm, $elm_qty); } else { $group->setData($elm, $elm_qty); } } return $group->getItems(); }
static function install() { $db = Database::instance(); $db->query("CREATE TABLE IF NOT EXISTS {users} (\n `id` int(9) NOT NULL auto_increment,\n `name` varchar(32) NOT NULL,\n `full_name` varchar(255) NOT NULL,\n `password` varchar(64) NOT NULL,\n `login_count` int(10) unsigned NOT NULL DEFAULT 0,\n `last_login` int(10) unsigned NOT NULL DEFAULT 0,\n `email` varchar(64) default NULL,\n `admin` BOOLEAN default 0,\n `guest` BOOLEAN default 0,\n `hash` char(32) default NULL,\n `url` varchar(255) default NULL,\n `locale` char(10) default NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY(`hash`),\n UNIQUE KEY(`name`))\n DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE IF NOT EXISTS {groups} (\n `id` int(9) NOT NULL auto_increment,\n `name` char(64) default NULL,\n `special` BOOLEAN default 0,\n PRIMARY KEY (`id`),\n UNIQUE KEY(`name`))\n DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE IF NOT EXISTS {groups_users} (\n `group_id` int(9) NOT NULL,\n `user_id` int(9) NOT NULL,\n PRIMARY KEY (`group_id`, `user_id`),\n UNIQUE KEY(`user_id`, `group_id`))\n DEFAULT CHARSET=utf8;"); $everybody = group::create("Everybody"); $everybody->special = true; $everybody->save(); $registered = group::create("Registered Users"); $registered->special = true; $registered->save(); $guest = user::create("guest", "Guest User", ""); $guest->guest = true; $guest->remove($registered); $guest->save(); $admin = user::create("admin", "Gallery Administrator", "admin"); $admin->admin = true; $admin->save(); $current_provider = module::get_var("gallery", "identity_provider"); if (empty($current_provider)) { // If there is no provider defined then we are doing an initial install // so we need to set the provider and make the administrator own everything // If the installer is called and there is an identity provider, then we // are switching identity providers and and the event handlers will do the // right things module::set_var("gallery", "identity_provider", "user"); // Let the admin own everything $db->query("update {items} set owner_id = {$admin->id}"); } $root = ORM::factory("item", 1); access::allow($everybody, "view", $root); access::allow($everybody, "view_full", $root); access::allow($registered, "view", $root); access::allow($registered, "view_full", $root); module::set_var("user", "mininum_password_length", 5); module::set_version("user", 2); }
public function edit_group_form($id) { $group = group::lookup($id); if (empty($group)) { throw new Kohana_404_Exception(); } print $this->_get_group_edit_form_admin($group); }
// page specific settings $pagetitle = ' - Member Fleets'; // header include 'includes/header_html.inc.php'; include 'includes/header.inc.php'; // open main table and include sidebar echo "<table class=\"main\"><tr><td class=\"sidebar\">"; include 'includes/sidebar.inc.php'; echo "</td><td class=\"content\">"; // main content title echo "<div class=\"content_header\">MEMBER FLEETS <strong>«</strong></div>"; /* * MAIN CONTENT STARTS HERE *************************************************** */ echo "<div class=\"content_subheader\">SELECT MEMBER <strong>«</strong></div>"; $tools_group = new group(TOOLS_GROUP); $tools_members = $tools_group->get_members(); echo "<div class=\"content_item\" style=\"text-align: center;\">"; echo "<form action=\"\" method=\"get\">"; //echo "<input type=\"hidden\" name=\"do\" value=\"member_fleet\">"; echo "<select name=\"user_id\">"; foreach ($tools_members as $key => $user_id) { $member = new member($user_id); if ($user_id == $_GET['user_id']) { echo "<option value=\"" . $user_id . "\" selected>" . $member->get_username() . "</option>"; } else { echo "<option value=\"" . $user_id . "\">" . $member->get_username() . "</option>"; } } echo "</select> "; /*
/** * Import a single group. */ static function import_group(&$queue) { $g2_group_id = array_shift($queue); if (self::map($g2_group_id)) { return t("Group with id: %id already imported, skipping", array("id" => $g2_group_id)); } try { $g2_group = g2(GalleryCoreApi::loadEntitiesById($g2_group_id)); } catch (Exception $e) { return t("Failed to import Gallery 2 group with id: %id\n%exception", array("id" => $g2_group_id, "exception" => $e->__toString())); } switch ($g2_group->getGroupType()) { case GROUP_NORMAL: try { $group = group::create($g2_group->getGroupName()); } catch (Exception $e) { // @todo For now we assume this is a "duplicate group" exception $group = group::lookup_by_name($g2_group->getGroupname()); } $message = t("Group '%name' was imported", array("name" => $g2_group->getGroupname())); break; case GROUP_ALL_USERS: $group = group::registered_users(); $message = t("Group 'Registered' was converted to '%name'", array("name" => $group->name)); break; case GROUP_SITE_ADMINS: $message = t("Group 'Admin' does not exist in Gallery 3, skipping"); break; // This is not a group in G3 // This is not a group in G3 case GROUP_EVERYBODY: $group = group::everybody(); $message = t("Group 'Everybody' was converted to '%name'", array("name" => $group->name)); break; } if (isset($group)) { self::set_map($g2_group->getId(), $group->id); } return $message; }
<?php defined('DT_ADMIN') or exit('Access Denied'); require MD_ROOT . '/group.class.php'; $do = new group($moduleid); $menus = array(array('添加' . $MOD['name'], '?moduleid=' . $moduleid . '&action=add'), array($MOD['name'] . '列表', '?moduleid=' . $moduleid), array('审核' . $MOD['name'], '?moduleid=' . $moduleid . '&action=check'), array('过期' . $MOD['name'], '?moduleid=' . $moduleid . '&action=expire'), array('未通过' . $MOD['name'], '?moduleid=' . $moduleid . '&action=reject'), array('回收站', '?moduleid=' . $moduleid . '&action=recycle'), array('移动分类', '?moduleid=' . $moduleid . '&action=move')); if (in_array($action, array('add', 'edit'))) { $FD = cache_read('fields-' . substr($table, strlen($DT_PRE)) . '.php'); if ($FD) { require DT_ROOT . '/include/fields.func.php'; } isset($post_fields) or $post_fields = array(); $CP = $MOD['cat_property']; if ($CP) { require DT_ROOT . '/include/property.func.php'; } isset($post_ppt) or $post_ppt = array(); } if ($_catids || $_areaids) { require DT_ROOT . '/admin/admin_check.inc.php'; } if (in_array($action, array('', 'check', 'expire', 'reject', 'recycle'))) { $sfields = array('模糊', '标题', '简介', '公司名', '联系人', '联系电话', '联系地址', '电子邮件', '联系MSN', '联系QQ', '会员名', '编辑', 'IP', '文件路径', '内容模板'); $dfields = array('keyword', 'title', 'introduce', 'company', 'truename', 'telephone', 'address', 'email', 'msn', 'qq', 'username', 'editor', 'ip', 'filepath', 'template'); $sorder = array('结果排序方式', '订单数量降序', '订单数量升序', '销售量降序', '销售量升序', '团购价降序', '团购价升序', '市场价降序', '市场价升序', '节省费用降序', '节省费用升序', '享受折扣降序', '享受折扣升序', '最多人数降序', '最多人数升序', '最低人数降序', '最低人数升序', '浏览人次降序', '浏览人次升序', '更新时间降序', '更新时间升序', VIP . '级别降序', VIP . '级别升序', '添加时间降序', '添加时间升序', '结束时间降序', '结束时间升序', '信息ID降序', '信息ID升序'); $dorder = array($MOD['order'], 'orders DESC', 'orders ASC', 'sales DESC', 'sales ASC', 'price DESC', 'price ASC', 'marketprice DESC', 'marketprice ASC', 'savemoney DESC', 'savemoney ASC', 'discount DESC', 'discount ASC', 'amount DESC', 'amount ASC', 'minamount DESC', 'minamount ASC', 'hits DESC', 'hits ASC', 'edittime DESC', 'edittime ASC', 'vip DESC', 'vip ASC', 'addtime DESC', 'addtime ASC', 'endtime DESC', 'endtime ASC', 'itemid DESC', 'itemid ASC'); $_process = array('<span style="color:#008000;">[成团中]</span>', '<span style="color:#0000FF;">[团购中]</span>', '<span style="color:#FF0000;">[已结束]</span>'); $level = isset($level) ? intval($level) : 0; isset($fields) && isset($dfields[$fields]) or $fields = 0; isset($order) && isset($dorder[$order]) or $order = 0; isset($datetype) && in_array($datetype, array('edittime', 'addtime', 'totime', 'endtime')) or $datetype = 'addtime';
function form($object) { global $db; $tag_collections = $db->selectObjects("tag_collections"); foreach ($tag_collections as $tag_collections => $collection) { $tc_list[$collection->id] = $collection->name; } //eDebug($all_calendars); $form = new form(); if (!isset($object->id)) { // $object->enable_categories = 0; $object->enable_feedback = 0; $object->reminder_notify = serialize(array()); $object->email_title_reminder = "Calendar Reminder"; $object->email_from_reminder = "Calendar Manager"; $object->email_address_reminder = "calendar@" . HOSTNAME; $object->email_reply_reminder = "calendar@" . HOSTNAME; $object->email_showdetail = 0; $object->email_signature = "--\nThanks, Webmaster"; $object->aggregate = array(); $object->enable_rss = false; $object->enable_ical = true; $object->feed_title = ""; $object->feed_desc = ""; $object->rss_limit = 365; $object->rss_cachetime = 60; // $object->enable_tags = false; // $object->collections = array(); // $object->group_by_tags = false; // $object->show_tags = array(); } else { $form->meta('id', $object->id); // $cols = unserialize($object->collections); // $object->collections = array(); // $available_tags = array(); // if (!empty($cols)) { // foreach ($cols as $col_id) { // $collection = $db->selectObject('tag_collections', 'id='.$col_id); // $object->collections[$collection->id] = $collection->name; // //while we're here we will get the list of available tags. // $tmp_tags = $db->selectObjects('tags', 'collection_id='.$col_id); // foreach ($tmp_tags as $tag) { // $available_tags[$tag->id] = $tag->name; // } // } // } // //Get the tags the user chose to show in the group by views // $stags = unserialize($object->show_tags); // $object->show_tags = array(); // // if (is_array($stags)) { // if (!empty($stags)) { // foreach ($stags as $stag_id) { // $show_tag = $db->selectObject('tags', 'id='.$stag_id); // $object->show_tags[$show_tag->id] = $show_tag->name; // } // } } // setup the listbuilder arrays for calendar aggregation. $loc = unserialize($object->location_data); $calendars = expModules::listInstalledControllers('calendarmodule'); $saved_aggregates = empty($object->aggregate) ? array() : unserialize($object->aggregate); $all_calendars = array(); $selected_calendars = array(); foreach ($calendars as $src => $cal) { $calendar_name = (empty($cal->title) ? 'Untitled' : $cal->title) . ' on page ' . $cal->section; if ($src != $loc->src) { if (in_array($src, $saved_aggregates)) { $selected_calendars[$src] = $calendar_name; } else { $all_calendars[$src] = $calendar_name; } } } // setup the config form $form->register(null, '', new htmlcontrol('<h3>' . gt('General Configuration') . '</h3><hr size="1" />')); // $form->register('enable_categories',gt('Enable Categories'),new checkboxcontrol($object->enable_categories,true)); $form->register('enable_feedback', gt('Enable Feedback'), new checkboxcontrol($object->enable_feedback, true)); $form->register(null, '', new htmlcontrol('<h3>' . gt('Events Reminder Email') . '</h3><hr size="1" />')); // Get original style user lists // $selected_users = array(); // foreach(unserialize($object->reminder_notify) as $i) { // $selected_users[$i] = $db->selectValue('user', 'firstname', 'id='.$i) . ' ' . $db->selectValue('user', 'lastname', 'id='.$i) . ' (' . $db->selectValue('user', 'username', 'id='.$i) . ')'; // } // $userlist = array(); // $list = user::getAllUsers(); // foreach ($list as $i) { // if(!array_key_exists($i->id, $selected_users)) { // $userlist[$i->id] = $i->firstname . ' ' . $i->lastname . ' (' . $i->username . ')'; // } // } // $form->register('reminder_notify',gt('Who should be reminded of events?'),new listbuildercontrol($selected_users, $userlist)); // Get User list $defaults = array(); $userlist = array(); $users = user::getAllUsers(); foreach ($db->selectObjects('calendar_reminder_address', 'calendar_id=' . $object->id . ' and user_id != 0') as $address) { $locuser = user::getUserById($address->user_id); $defaults[$locuser->id] = $locuser->firstname . ' ' . $locuser->lastname . ' (' . $locuser->username . ')'; } foreach ($users as $locuser) { if (!array_key_exists($locuser->id, $defaults)) { $userlist[$locuser->id] = $locuser->firstname . ' ' . $locuser->lastname . ' (' . $locuser->username . ')'; } } $form->register('users', gt('Users'), new listbuildercontrol($defaults, $userlist)); // Get Group list $defaults = array(); $grouplist = array(); $groups = group::getAllGroups(); if ($groups != null) { foreach ($db->selectObjects('calendar_reminder_address', 'calendar_id=' . $object->id . ' and group_id != 0') as $address) { $group = group::getGroupById($address->group_id); $defaults[$group->id] = $group->name; } foreach ($groups as $group) { if (!array_key_exists($group->id, $defaults)) { $grouplist[$group->id] = $group->name; } } $form->register('groups', gt('Groups'), new listbuildercontrol($defaults, $grouplist)); } // Get Freeform list $defaults = array(); foreach ($db->selectObjects('calendar_reminder_address', 'calendar_id=' . $object->id . " and email != ''") as $address) { $defaults[$address->email] = $address->email; } $form->register('addresses', gt('Other Addresses'), new listbuildercontrol($defaults, null)); $form->register('email_title_reminder', gt('Message Subject Prefix'), new textcontrol($object->email_title_reminder, 45)); $form->register('email_from_reminder', gt('From (Display)'), new textcontrol($object->email_from_reminder, 45)); $form->register('email_address_reminder', gt('From (Email)'), new textcontrol($object->email_address_reminder, 45)); $form->register('email_reply_reminder', gt('Reply-to'), new textcontrol($object->email_reply_reminder, 45)); $form->register('email_showdetail', gt('Show detail in message?'), new checkboxcontrol($object->email_showdetail)); $form->register('email_signature', gt('Email Signature'), new texteditorcontrol($object->email_signature, 5, 30)); $form->register(null, '', new htmlcontrol('<h3>' . gt('Merge Calendars') . '</h3><hr size="1" />')); $form->register('aggregate', gt('Pull Events from These Other Calendars'), new listbuildercontrol($selected_calendars, $all_calendars)); $form->register(null, '', new htmlcontrol('<h3>' . gt('RSS/iCalendar Configuration') . '</h3><hr size="1" />')); $form->register('enable_rss', gt('Enable RSS'), new checkboxcontrol($object->enable_rss)); $form->register('enable_ical', gt('Enable iCalendar'), new checkboxcontrol($object->enable_ical)); $form->register('feed_title', gt('Title for this RSS feed'), new textcontrol($object->feed_title, 35, false, 75)); $form->register('feed_desc', gt('Description for this RSS feed'), new texteditorcontrol($object->feed_desc)); $form->register('rss_cachetime', gt('Recommended RSS/iCal feed update interval in minutes (1440 = 1 day)'), new textcontrol($object->rss_cachetime)); $form->register('rss_limit', gt('Maximum days of RSS/iCal items to publish (0 = all)'), new textcontrol($object->rss_limit)); // $form->register(null,'',new htmlcontrol('<h3>'.gt('Tagging').'</h3><hr size="1" />')); // $form->register('enable_tags',gt('Enable Tags'), new checkboxcontrol($object->enable_tags)); // $form->register('collections',gt('Tag Collections'),new listbuildercontrol($object->collections,$tc_list)); // $form->register('group_by_tags',gt('Filter events by tags'), new checkboxcontrol($object->group_by_tags)); // $form->register(null,'',new htmlcontrol(gt('Tags to show'))); // $form->register('show_tags','',new listbuildercontrol($object->show_tags,$available_tags)); $form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel'))); return $form; }
</tr> <tr class="Ls2"> <td class="N_title">密碼:</td><td class="N_title"> <input type="password" name="login_pass" value="" class="N_input"> </td> </tr> <tr> <td class="N_title">確認密碼:</td><td class="N_title"> <input type="password" name="password" value="" class="N_input"> </td> </tr> <tr class="Ls2"> <td class="N_title">群組:</td><td class="N_title"> <select name="gpid"> <?php $group = new group(); $group->setLimit(0, 1000); $group = $group->getArray(); foreach ($group as $g) { $selected = $g['id'] == $uinfo['gpid'] ? 'selected' : ''; echo '<option ' . $selected . ' value="' . $g['id'] . '">' . $g['name'] . '</option>'; } ?> </select> </td> </tr> <tr> <td class="N_title">真實姓名:</td><td class="N_title"> <input name="real_name" value="<?php echo $uinfo['real_name']; ?>
* Lookup a student in userlookup ******************************************************************************/ if ($_REQUEST[n]) { //include("config.inc.php"); //include("functions.inc.php"); $usernames = userlookup($_REQUEST[n], LDAP_BOTH, LDAP_WILD, LDAP_LASTNAME, 0); } /****************************************************************************** * Site Owner add student UI: get students in the class ******************************************************************************/ if (isset($_REQUEST[name])) { //$ugroup_name = $_REQUEST[name]; $ugroup_id = db_get_value("ugroup", "ugroup_id", "ugroup_name = '" . addslashes($_REQUEST[name]) . "'"); // if the slot name has no group id then must be a grouped site if (!isset($ugroup_id)) { $classlist = group::getClassesFromName($_REQUEST[name]); if (is_array($classlist)) { $list = implode(", ", $classlist); $ugroup_id = db_get_value("ugroup", "ugroup_id", "ugroup_name = '" . $classlist[0] . "'"); $class_id = $_REQUEST[name]; } else { $ugroup_name = $_REQUEST[name]; $class_id = $ugroup_name; } } else { $ugroup_name = $_REQUEST[name]; $class_id = $ugroup_name; } $_REQUEST[ugroup_id] = $ugroup_id; $participants = getclassstudents($class_id); /******************************************************************************
/** * Import a single group. */ static function import_group(&$queue) { $g2_group_id = array_shift($queue); if (self::map($g2_group_id)) { return; } try { $g2_group = g2(GalleryCoreApi::loadEntitiesById($g2_group_id)); } catch (Exception $e) { g2_import::log(t("Failed to import Gallery 2 group with id: %id", array("id" => $g2_group_id))); return; } switch ($g2_group->getGroupType()) { case GROUP_NORMAL: try { $group = group::create($g2_group->getGroupName()); } catch (Exception $e) { // @todo For now we assume this is a "duplicate group" exception $group = group::lookup_by_name($g2_group->getGroupname()); } break; case GROUP_ALL_USERS: $group = group::registered_users(); break; case GROUP_SITE_ADMINS: break; // This is not a group in G3 // This is not a group in G3 case GROUP_EVERYBODY: $group = group::everybody(); break; } if (isset($group)) { self::set_map($g2_group->getId(), $group->id); } }
<?php defined('IN_DESTOON') or exit('Access Denied'); login(); require DT_ROOT . '/module/' . $module . '/common.inc.php'; $MG['group_limit'] > -1 or dalert(lang('message->without_permission_and_upgrade'), 'goback'); require DT_ROOT . '/include/post.func.php'; include load($module . '.lang'); include load('my.lang'); require MD_ROOT . '/group.class.php'; $do = new group($moduleid); if (in_array($action, array('add', 'edit'))) { $FD = cache_read('fields-' . substr($table, strlen($DT_PRE)) . '.php'); if ($FD) { require DT_ROOT . '/include/fields.func.php'; } isset($post_fields) or $post_fields = array(); $CP = $MOD['cat_property']; if ($CP) { require DT_ROOT . '/include/property.func.php'; } isset($post_ppt) or $post_ppt = array(); } $sql = $_userid ? "username='******'" : "ip='{$DT_IP}'"; $limit_used = $limit_free = $need_password = $need_captcha = $need_question = $fee_add = 0; if (in_array($action, array('', 'add'))) { $r = $db->get_one("SELECT COUNT(*) AS num FROM {$table} WHERE {$sql} AND status>1"); $limit_used = $r['num']; $limit_free = $MG['group_limit'] > $limit_used ? $MG['group_limit'] - $limit_used : 0; } if (check_group($_groupid, $MOD['group_refresh'])) {
public function everybody_view_full_permission_maintains_htaccess_files_test() { $root = ORM::factory("item", 1); $album = album::create($root, rand(), "test album"); $this->assert_false(file_exists($album->file_path() . "/.htaccess")); $this->assert_false(file_exists($album->resize_path() . "/.htaccess")); $this->assert_false(file_exists($album->thumb_path() . "/.htaccess")); access::deny(group::everybody(), "view_full", $album); $this->assert_true(file_exists($album->file_path() . "/.htaccess")); $this->assert_false(file_exists($album->resize_path() . "/.htaccess")); $this->assert_false(file_exists($album->thumb_path() . "/.htaccess")); access::allow(group::everybody(), "view_full", $album); $this->assert_false(file_exists($album->file_path() . "/.htaccess")); $this->assert_false(file_exists($album->resize_path() . "/.htaccess")); $this->assert_false(file_exists($album->thumb_path() . "/.htaccess")); access::deny(group::everybody(), "view_full", $album); $this->assert_true(file_exists($album->file_path() . "/.htaccess")); $this->assert_false(file_exists($album->resize_path() . "/.htaccess")); $this->assert_false(file_exists($album->thumb_path() . "/.htaccess")); access::reset(group::everybody(), "view_full", $album); $this->assert_false(file_exists($album->file_path() . "/.htaccess")); $this->assert_false(file_exists($album->resize_path() . "/.htaccess")); $this->assert_false(file_exists($album->thumb_path() . "/.htaccess")); }
*/ //смещение, всегда 0 (затем берется из $_GET) $offset = isset($_GET['offset']) && (int) $_GET['offset'] > 0 ? (int) $_GET['offset'] : 0; //текущий обработанный URL $path = CONF_ADMIN_FILE . '?m=users&s=manager&action=filter&id=' . $returnData['id'] . '&' . 'email=' . $returnData['email'] . '&alias=' . $returnData['alias'] . '&reg_ip=' . $returnData['reg_ip'] . '&' . 'user_type=' . $returnData['user_type'] . '&user_group=' . $returnData['user_group'] . '&token=' . $returnData['token'] . '&'; // получаем данные пользователя $usersData = $user->getCombinedUsersData(false, $strWhere, array($order => $by), $offset . ',' . CONF_USERS_STRINGS_PERPAGE_ADMIN_PANEL); $allRecords = $user->cntUsers(); // получаем общее количество записей $smarty->assignByRef('users', $usersData); $smarty->assignByRef('allRecords', $allRecords); //передаем в шаблон строку сформированных страниц $smarty->assign('strPages', strings::generatePage($allRecords, $offset, CONF_USERS_STRINGS_PERPAGE_ADMIN_PANEL, $path, true)); $smarty->assignByRef('return_data', $returnData); } $group = new group(); $smarty->assign('user_types', $group->arrTypes); $smarty->assign('user_groups', $group->getAllGroups("token IN ('active')", false, array('id'))); $arrActions['filter'] = true; } } else { // инициируем "Наименование страницы" отображаемое в форме $arrNamePage[] = array('name' => MENU_MANAGER_USERS, 'link' => false); /** * удаление пользователей */ if (isset($_POST['action'])) { if ('del' === $_POST['action'] && isset($_POST['users'])) { $user->deleteUsers(array_keys($_POST['users']), true, true, true, true, true); messages::messageChangeSaved(MESSAGE_CHANGE_SAVED, false, CONF_ADMIN_FILE . '?m=users&s=manager'); }