$categorykey1 = array('categoryKey' => $categoria1);
 $categorykey2 = array('categoryKey' => $categoria2);
 //$categorykey3=array('categoryKey'=>"soap");
 //$resourceCategoryKeys=array($categorykey1,$categorykey2,$categorykey3);
 $roleCategoryKeys = array($categorykey1, $categorykey2);
 // dn de la aplicación
 $entityKey = "cn=" . $APP . $SEPARADOR . $Perfil . "," . $PRFCONTEXT . $ROLECONTEXT;
 //en~ACEOLIVC.ACEOLIVA
 $role = array('description' => $description, 'entityKey' => $entityKey, 'name' => $APP . $SEPARADOR . $Perfil, 'container' => "cn=Perfiles", 'owners' => $owners, 'quorum' => "100", 'systemRole' => "false", 'roleCategoryKeys' => $roleCategoryKeys, 'roleLevel' => "10");
 $result = "";
 if ($DEBUG == 5) {
     print_r($role);
 }
 if (!$SOAP_DEBUG) {
     if (trim($Perfil) != "") {
         $result = createRole($stub_prov, $role);
     } else {
         myLog("Error registro sin Nombre: " . $contador, 1, "");
     }
 } else {
     print_r($role);
     echo "-----------------------------------------\n";
     myLog("modo SOAP DEBUG:" . $contador, 1, "");
 }
 // Si se ha creado el recurso
 if ($result) {
     // Generamos la llamada para crear la asociación con la Aplicación
     $roleDN = "cn=" . $APP . $SEPARADOR . $Perfil . "," . $PRFCONTEXT . $ROLECONTEXT;
     $rscDN = "cn=" . $APP . "," . $RSCCONTEXT;
     $localizedvalue1 = array('locale' => "en", 'value' => "Perfil de la aplicacion " . $APP);
     $localizedvalue2 = array('locale' => "en", 'value' => "Perfíl de la aplicación " . $APP);
Пример #2
0
    $o2 = new sotf_NodeObject("sotf_role_names");
    $o2->set('role_id', $id);
    $o2->set('language', 'en');
    $o2->set('name', $english);
    $o2->create();
}
createRole(1, 'Artist');
createRole(2, 'Author');
createRole(3, 'Commentator');
createRole(4, 'Composer');
createRole(5, 'Copyright holder');
createRole(6, 'Correspondent');
createRole(7, 'Designer');
createRole(8, 'Director');
createRole(9, 'Editor');
createRole(10, 'Funder / Sponsor');
createRole(11, 'Interviewee');
createRole(12, 'Interviewer');
createRole(13, 'Narrator');
createRole(14, 'Participant');
createRole(15, 'Performer');
createRole(16, 'Producer');
createRole(17, 'Production Personnel');
createRole(18, 'Speaker');
createRole(19, 'Transcriber');
createRole(20, 'Translator');
createRole(21, 'Other');
?>

<h2>initialized roles</h2>
Пример #3
0
        $roleid = $_REQUEST['roleid'];
        $query = 'select rolename from vtiger_role where rolename=? and roleid !=?';
        $params = array($rolename, $roleid);
    }
    $result = $adb->pquery($query, $params);
    if ($adb->num_rows($result) > 0) {
        echo $mod_strings['LBL_ROLENAME_EXIST'];
        die;
    } else {
        echo 'SUCCESS';
        die;
    }
}
$parentRoleId = $_REQUEST['parent'];
//Inserting values into Role Table
if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'edit') {
    $roleId = $_REQUEST['roleid'];
    $selected_col_string = $_REQUEST['selectedColumnsString'];
    $profile_array = explode(';', $selected_col_string);
    updateRole($roleId, $rolename, $profile_array);
} elseif (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'create') {
    $selected_col_string = $_REQUEST['selectedColumnsString'];
    $profile_array = explode(';', $selected_col_string);
    //Inserting into vtiger_role Table
    $roleId = createRole($rolename, $parentRoleId, $profile_array);
    if ($roleId != '') {
        insertRole2Picklist($roleId, $parentRoleId);
    }
}
$loc = "Location: index.php?action=listroles&module=Settings&parenttab=Settings";
header($loc);
function user_form_save_action()
{
    //$_SESSION['wp_page'] = $_GET['page'];
    $current_user = wp_get_current_user();
    $user_name = isset($_POST['name']) ? $_POST['name'] : '';
    $user_email = isset($_POST['email']) && !empty($_POST['email']) ? $_POST['email'] : "";
    global $wpdb;
    $error = '';
    $table_name = $wpdb->prefix . 'users';
    $deactive_user_id = $wpdb->get_var('SELECT ID from ' . $table_name . ' where user_email="' . $_POST['email'] . '" AND user_status=-1');
    if ($deactive_user_id != '') {
        if (isset($_GET['page']) && $_GET['page'] != "") {
            if (isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])) {
                if ($error !== '') {
                    //$_SESSION['wp_page'] = $_GET['page'];
                    //$_SESSION['wp_errors']['my-contacts']['user_exists'] = $error;
                }
                set_site_message('my-contacts', 'success', "Contact Added Successfully");
                if (active_user($user_email)) {
                    wp_redirect(base64_decode($_POST['redirect_url']) . '?page=' . $_GET['page']);
                }
            } else {
                wp_redirect(admin_url() . "admin.php?page=" . $_GET['page']);
            }
        } else {
            $success = "Contact Added Successfully";
            $error = '';
            if (active_user($user_email)) {
                user_form($error, $success, $deactive_user_id, $_POST['label']);
            }
        }
        die;
    }
    $is_update = false;
    if ($_POST['id'] == 0) {
        remove_filter('profile_update', 'numediaweb_custom_user_profile_fields', 20);
        if (!email_exists($user_email)) {
            $random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
            /* 0846 - 08/06/15 - in place of user_name in below function we take user_email because we change the functionality to take user_name as user_email */
            $user_id = @wp_create_user($user_email, $random_password, $user_email);
            //$user_id = wp_update_user(array('first_name' => $_POST['fname'], 'last_name' => $_POST['lname'], 'ID' => $user_id));
            $user = get_user_by('id', $user_id);
            $wpdb->query("update " . $wpdb->prefix . "users set display_name = '" . $_POST['fname'] . " " . $_POST['lname'] . "', first_name = '" . $_POST['fname'] . "',last_name='" . $_POST['lname'] . "',salutaions='" . $_POST['salutaions'] . "', phone = '" . $_POST['phone'] . "', country=" . $_POST['country'] . ",state=" . $_POST['state'] . ",city='" . $_POST['city'] . "', title = '" . $_POST['title'] . "', fax = '" . $_POST['fax'] . "', address = '" . $_POST['address'] . "', created_by = " . get_current_user_id() . ", created_on = '" . date("Y-m-d H:m:s") . "', company_id = '" . $_POST['company_id'] . "' where ID=" . $user_id);
            $get_current_user_role_new = get_current_user_role();
            $bnfw = BNFW::factory();
            if (strtolower($get_current_user_role_new) != 'staff') {
                $sql = 'SELECT * FROM ' . $wpdb->prefix . 'users where ID=' . get_current_user_id();
                $result_user = $wpdb->get_results($sql);
                $link_to_users = get_permalink(get_page_by_path('listings')) . '?page=my-contacts';
                if ($bnfw->notifier->notification_exists('new-contact')) {
                    $notifications = $bnfw->notifier->get_notifications('new-contact');
                    foreach ($notifications as $notification) {
                        $setting = $bnfw->notifier->read_settings($notification->ID);
                        foreach ($setting['users'] as $users_role) {
                            $main_role = strtolower(str_replace('role-', '', $users_role));
                            $sql = "select `user_email` from " . $wpdb->prefix . "users where `user_type` = '" . $main_role . "'";
                            $staff_user = $wpdb->get_results($sql);
                            foreach ($staff_user as $staff_user) {
                                $emailstaff = $staff_user->user_email;
                                $display_name = isset($staff_user->display_name) ? $staff_user->display_name : '';
                                $usernamestaff = ucwords($display_name);
                                $subjectstaff = $setting['subject'];
                                $date = date('Y-m-d');
                                $messagestaff = $setting['message'];
                                $messagestaff = str_replace('[firstuser]', $_POST['fname'], $messagestaff);
                                $messagestaff = str_replace('[lastuser]', $_POST['lname'], $messagestaff);
                                $messagestaff = str_replace('[firstname]', $result_user[0]->first_name, $messagestaff);
                                $messagestaff = str_replace('[lastname]', $result_user[0]->last_name, $messagestaff);
                                $messagestaff = str_replace('[username]', $usernamestaff, $messagestaff);
                                $messagestaff = str_replace('[date]', $date, $messagestaff);
                                $messagestaff = str_replace('[linkToUser]', $link_to_users, $messagestaff);
                                $subjectstaff = str_replace('[firstname]', $result_user[0]->first_name, $subjectstaff);
                                $subjectstaff = str_replace('[lastname]', $result_user[0]->last_name, $subjectstaff);
                                wp_mail($emailstaff, $subjectstaff, wpautop($messagestaff));
                            }
                        }
                    }
                }
            }
            if ($bnfw->notifier->notification_exists('new-contact-to-customer')) {
                $notifications = $bnfw->notifier->get_notifications('new-contact-to-customer');
                foreach ($notifications as $notification) {
                    $setting = $bnfw->notifier->read_settings($notification->ID);
                    $emailcustomer = $current_user->user_email;
                    $subjectcustomer = $setting['subject'];
                    $date = date('Y-m-d');
                    $messagecustomer = $setting['message'];
                    $messagecustomer = str_replace('[firstuser]', $_POST['fname'], $messagecustomer);
                    $messagecustomer = str_replace('[lastuser]', $_POST['lname'], $messagecustomer);
                    $messagecustomer = str_replace('[firstname]', ucfirst($result_user[0]->first_name), $messagecustomer);
                    $messagecustomer = str_replace('[lastname]', $result_user[0]->last_name, $messagecustomer);
                    $messagecustomer = str_replace('[date]', $date, $messagecustomer);
                    $messagecustomer = str_replace('[linkToUser]', $link_to_users, $messagecustomer);
                    $subjectcustomer = str_replace('[firstname]', $result_user[0]->first_name, $subjectcustomer);
                    $subjectcustomer = str_replace('[lastname]', $result_user[0]->last_name, $subjectcustomer);
                    wp_mail($emailcustomer, $subjectcustomer, wpautop($messagecustomer));
                }
            }
            $error = '';
            $success = 'User added successfully';
            if (isset($_GET['page']) && $_GET['page'] != "") {
                set_site_message('my-contacts', 'success', "Contact Added Successfully");
            }
            //$_SESSION['wp_notices']['user_added'] = __('Contact added successfully.');
            //$_SESSION['wp_page'] = $_GET['page'];
        } else {
            if (isset($_POST['label']) && !empty($_POST['label']) && $_POST['label'] == 'applicantbillingid') {
                $user = get_user_by('email', $_POST['email']);
                $is_billing_exist_for_application = $wpdb->get_row("select * from " . $wpdb->prefix . "application_user_roles where user_id = " . $user->data->ID . " and application_id = " . $_POST['application_id']);
                if (empty($is_billing_exist_for_application)) {
                    if (!empty($user)) {
                        $wpdb->insert($wpdb->prefix . 'application_user_roles', array('user_id' => $user->data->ID, 'application_id' => $_POST['application_id'], 'roles' => serialize(array(array("billing" => 1)))));
                    }
                    $error = '';
                    $success = 'User added successfully';
                    user_form($error, $success, $user->data->ID, $_POST['label']);
                    $user_id = $user->data->ID;
                } else {
                    if (isset($_GET['page']) && $_GET['page'] != "") {
                        set_site_message('my-contacts', 'error', "Contact already exists");
                    }
                    $error = 'This user already assign as billing for this application.';
                    $success = '';
                    $user_id = '';
                }
            } else {
                if (isset($_GET['page']) && $_GET['page'] != "") {
                    set_site_message('my-contacts', 'error', "Contact already exists");
                }
                $error = 'Contact already exists.';
                $success = '';
                $user_id = '';
            }
            //$_SESSION['wp_errors']['user_exists'] = __('User already exists.  Password inherited.');
            //wp_redirect(admin_url()."/admin-post.php?page=my-contacts&error=".$error);
        }
    } else {
        $user = get_user_by('id', trim($_POST['id']));
        $user_info = get_userdata($user->ID);
        $user_role = implode(', ', $user_info->roles);
        $u = new WP_User($user->ID);
        $roles = get_user_meta($_POST['id'], "wp_capabilities");
        $dataarray = array('salutaions' => $_POST['salutaions'], 'display_name' => $_POST['fname'] . " " . $_POST['lname'], 'phone' => $_POST['phone'], 'country' => $_POST['country'], 'state' => $_POST['state'], 'city' => $_POST['city'], 'zipcode' => $_POST['zipcode'], 'first_name' => $_POST['fname'], 'last_name' => $_POST['lname'], 'title' => $_POST['title'], 'fax' => $_POST['fax'], 'address' => $_POST['address'], 'modified_by' => get_current_user_id(), 'modified_on' => date("Y-m-d H:m:s"));
        $wpdb->update($table_name, $dataarray, array('id' => $_POST['id']));
        $get_current_user_role_new = get_current_user_role();
        if (strtolower($get_current_user_role_new) != 'staff') {
            $sql = 'SELECT * FROM ' . $wpdb->prefix . 'users where ID=' . get_current_user_id();
            $result_user = $wpdb->get_results($sql);
            $link_to_users = get_permalink(get_page_by_path('listings')) . '?page=my-contacts';
            $bnfw = BNFW::factory();
            if ($bnfw->notifier->notification_exists('new-contact-update')) {
                $notifications = $bnfw->notifier->get_notifications('new-contact-update');
                foreach ($notifications as $notification) {
                    $setting = $bnfw->notifier->read_settings($notification->ID);
                    foreach ($setting['users'] as $users_role) {
                        $main_role = strtolower(str_replace('role-', '', $users_role));
                        $sql = "select `user_email` from " . $wpdb->prefix . "users where `user_type` = '" . $main_role . "'";
                        $staff_user = $wpdb->get_results($sql);
                        foreach ($staff_user as $staff_user) {
                            $emailstaff = $staff_user->user_email;
                            $subjectstaff = $setting['subject'];
                            $date = date('Y-m-d');
                            $messagestaff = $setting['message'];
                            $messagestaff = str_replace('[firstuser]', $_POST['fname'], $messagestaff);
                            $messagestaff = str_replace('[lastuser]', $_POST['lname'], $messagestaff);
                            $messagestaff = str_replace('[firstname]', $result_user[0]->first_name, $messagestaff);
                            $messagestaff = str_replace('[lastname]', $result_user[0]->last_name, $messagestaff);
                            $messagestaff = str_replace('[date]', $date, $messagestaff);
                            $messagestaff = str_replace('[linkToUser]', $link_to_users, $messagestaff);
                            $subjectstaff = str_replace('[firstname]', $result_user[0]->first_name, $subjectstaff);
                            $subjectstaff = str_replace('[lastname]', $result_user[0]->last_name, $subjectstaff);
                            wp_mail($emailstaff, $subjectstaff, wpautop($messagestaff));
                        }
                    }
                }
            }
        }
        if (isset($user_info->crm_id) && !empty($user_info)) {
            $is_update = true;
            createRole('modified', 'Modified', array('read' => true, 'application-form' => false));
            //create modified role
            $user_info->add_role('modified');
        }
        $user_id = $_POST['id'];
        //$_SESSION['wp_page'] = $_GET['page'];
        set_site_message('my-contacts', 'success', "Contact Details Updated Successfully");
        //  $_SESSION['wp_notices']['user_updated'] = __("Contact Updated Successfully");
    }
    if (empty($error)) {
        $roles = get_user_meta($current_user->ID, "wp_capabilities");
        if (!empty($roles) && isset($roles[0]) && array_key_exists('staff', $roles[0])) {
            try {
                approve_user_by_staff($user_id, $is_update);
            } catch (Exception $e) {
                $error = "CRM approve error " . $e->getMessage();
            }
        }
    }
    if (isset($_GET['page']) && $_GET['page'] != "") {
        if (isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])) {
            if ($error !== '') {
                //$_SESSION['wp_page'] = $_GET['page'];
                //$_SESSION['wp_errors']['my-contacts']['user_exists'] = $error;
            }
            wp_redirect(base64_decode($_POST['redirect_url']) . '?page=' . $_GET['page']);
        } else {
            wp_redirect(admin_url() . "admin.php?page=" . $_GET['page']);
        }
    } else {
        user_form($error, $success, $user_id, $_POST['label']);
    }
}
Пример #5
0
 createRole(9, 'Editor');
 createRole(10, 'Funder / Sponsor');
 createRole(11, 'Interviewee');
 createRole(12, 'Interviewer');
 createRole(13, 'Narrator');
 createRole(14, 'Participant');
 createRole(15, 'Performer');
 createRole(16, 'Producer');
 createRole(17, 'Production Personnel');
 createRole(18, 'Speaker');
 createRole(19, 'Transcriber');
 createRole(20, 'Translator');
 createRole(21, 'Other');
 createRole(22, 'Creator');
 createRole(23, 'Publisher');
 createRole(24, 'Contributor');
 // create genres
 $db->query("DELETE FROM sotf_node_objects WHERE id LIKE '%ge%'");
 $db->query("DELETE FROM sotf_genres");
 $db->query("SELECT setval('sotf_genres_seq', 1, false)");
 function createGenre($id, $english)
 {
     $o1 = new sotf_NodeObject("sotf_genres");
     $o1->set('genre_id', $id);
     $o1->set('language', 'en');
     $o1->set('name', $english);
     $o1->create();
 }
 createGenre(1, 'Actuality');
 createGenre(2, 'Advert / jingle / spot');
 createGenre(3, 'Announcement');