} # / ACCESS allowed/denied ########################### # / PERMISSIONS CHECK #################################### ######### GO ON WITH REAL WORK ################# # STEP2: SAVE DATA if ($op2 && !$site->fdat['refresh']) { $form_error = array(); verify_form_token(); ############## # SAVE GROUP TAB if ($site->fdat['tab'] == 'group') { ################## GET profile $profile_def = $site->get_profile(array("id" => $site->fdat['profile_id'])); ################## CHECK & CHANGE profile values (required, date formats, arrays, etc) $sql_field_values = check_profile_values(array("profile_def" => &$profile_def, "skip_fields" => "group_id,name,parent_group_id")); #printr($sql_field_values); ############ NEW OR COPY if ($op == 'new' || $op == 'copy') { $parent_id = $site->fdat['group_id']; $sql = $site->db->prepare("INSERT INTO groups (profile_id, name, parent_group_id, auth_type " . (count($update_fields) ? ',' . join(",", array_keys($sql_field_values)) : '') . ") VALUES (?,?,?,? " . (count($update_fields) ? ",'" . join("','", array_values($sql_field_values)) . "'" : "") . " )", $site->fdat['profile_id'] ? $site->fdat['profile_id'] : 0, trim($site->fdat['name']) == '' ? 'undefined' : $site->fdat['name'], $site->fdat['parent_group_id'], $site->fdat['auth_type']); #print $sql; $sth = new SQL($sql); $site->debug->msg($sth->debug->get_msgs()); $site->fdat['group_id'] = $sth->insert_id; ######################## # INSERT PERMISSIONS # lisame uuele grupile t�pselt samad �igused nagu on tema parent grupil: # leia k�ik parenti �igused userite/gruppide kohta:
$sql = $site->db->prepare("UPDATE object_profiles SET data=? WHERE profile_id=?", $update_data, $site->fdat['profile_id']); $sth = new SQL($sql); $site->debug->msg($sth->debug->get_msgs()); $site->fdat['profile_id'] = $site->fdat['profile_id']; } # / MOVE UP/DOWN ################## ################## # SYNC with real TABLE in database if ($site->fdat['op'] == "sync" && is_numeric($site->fdat['profile_id'])) { $tbl_fields = array(); $system_fields = array(); $existing_fields = array(); $missing_fields = array(); ## Get existing profile $prof_row = $site->get_profile(array(id => $site->fdat['profile_id'])); $existing_data = unserialize($prof_row['data']); if (sizeof($existing_data) > 0 && is_array($existing_data)) { $existing_fields = array_keys($existing_data); } # if fields found if ($prof_row['source_table']) { # get table fields $tbl_fields = split(",", $site->db->get_fields(array(tabel => $prof_row['source_table']))); # get system_fields - fields that doesn't have to be visible to user after sync operation if ($prof_row['source_table'] == 'users') { $system_fields = array('user_id', 'group_id', 'email', 'is_predefined', 'profile_id', 'username', 'password', 'firstname', 'lastname', 'image', 'created_date', 'session_id', 'last_access_time', 'is_locked', 'pass_expires', 'autologin_ip', 'last_ip'); } elseif ($prof_row['source_table'] == 'groups') { $system_fields = array('group_id', 'name', 'parent_group_id', 'is_predefined', 'auth_type', 'auth_params', 'profile_id'); } elseif ($prof_row['source_table'] == 'obj_dokument') { $system_fields = array('fail', 'size', 'tyyp', 'objekt_id', 'mime_tyyp', 'sisu_blob', 'profile_id', 'repl_last_modified', 'download_type');
</head> <body onLoad="this.focus();"> <!-- Scrollable area --> <div id=listing class="scms_scroll_div"> <? if($form_def['profile_id']){ ?> <table width="100%" border="0" cellspacing="3" cellpadding="0" class="scms_table"> <tr class="scms_pane_header"> <td colspan=2><?=$form_def['name']?></td> </tr> <? # get profile $profile_def = $site->get_profile(array("id"=>$form_def['profile_id'])); $profile_fields = unserialize($profile_def['data']); # profile_fields is now array of ALL fields, indexes are fieldnames ################### # print profile fields rows print_profile_fields(array( 'profile_fields' => $profile_fields, 'field_values' => $objekt->all, )); ?> </table> <? } ### error: no profile id else { echo "Error! no profile found"; }
return !$drop_denied; } ############################### # PROFILE: Save profile name & close if($site->fdat['op2'] == 'save_profile_name' || $site->fdat['op2'] == 'saveclose_profile_name') { if($site->fdat['profile_name']) { $site->fdat['profile_name'] = strtolower($site->fdat['profile_name']); // #2743 $site->fdat['source_table'] = strtolower($site->fdat['source_table']); // #2743 ###### check if profile name exists $check_profile_def = $site->get_profile(array("name"=>$site->fdat['profile_name'])); ## if not found OR itself found, go on with saving if(($check_profile_def['name'] != $site->fdat['profile_name']) || $check_profile_def['profile_id'] == $site->fdat['pid']) { ##### if is_default is set to "1" then set all other profiles (with same type) to "is_default => 0". if($site->fdat['is_default'] == 1){ $sql = $site->db->prepare("UPDATE object_profiles SET is_default=? WHERE source_table=?",0,$site->fdat['source_table']); $sth = new SQL($sql); } if($op=='new') { ## New if($site->fdat['source_table'] == 'obj_asset') // create default content $data = 'a:1:{s:8:"pealkiri";a:9:{s:4:"name";s:8:"pealkiri";s:4:"type";s:4:"TEXT";s:13:"source_object";s:0:"";s:13:"default_value";s:0:"";s:7:"db_type";s:7:"varchar";s:11:"is_required";i:0;s:9:"is_active";i:0;s:13:"is_predefined";i:1;s:10:"is_general";i:1;}}';