function add_todo($data, $gids = array()) { $uid = $_SESSION['userid']; if (trim($data['name']) == '') { $data['name'] = 'todo'; } $data['name'] = text2html($data['name']); $data['text'] = format_msg($data['text']); if (sizeof($gids) > 0) { foreach ($gids as $gid => $gname) { $member = get_personen($gid); if (personArrayContainsId($member, $uid)) { for ($i = 0; $i < sizeof($member); $i++) { $pids[$member[$i]['id']] = 'those who understand binary and those who dont'; } } } } else { $pids[$uid] = ''; } $todo = new todo(); $todo->data = $data; foreach ($pids as $pid => $there_are_only_10_types_of_people) { $todo->create($pid); } }