$query = "SHOW INDEX FROM " . table('participants');
    $result = or_query($query);
    while ($line = pdo_fetch_assoc($result)) {
        if (isset($user_columns[$line['Column_name']])) {
            $user_columns[$line['Column_name']]['has_index'] = 1;
        }
    }
    $query = "SELECT * FROM " . table('profile_fields');
    $result = or_query($query);
    $redundant = array();
    while ($line = pdo_fetch_assoc($result)) {
        if (isset($user_columns[$line['mysql_column_name']])) {
            $user_columns[$line['mysql_column_name']]['is_configured'] = 1;
            $user_columns[$line['mysql_column_name']]['enabled'] = $line['enabled'];
            $user_columns[$line['mysql_column_name']]['type'] = $line['type'];
            $user_columns[$line['mysql_column_name']]['properties'] = db_string_to_property_array($line['properties']);
        } else {
            $redundant[] = $line['mysql_column_name'];
        }
    }
}
if ($proceed) {
    if (isset($_REQUEST['delete_redundant']) && $_REQUEST['delete_redundant']) {
        $pars = array();
        foreach ($redundant as $r) {
            $pars[] = array(':mysql_column_name' => $r);
        }
        $query = "DELETE FROM " . table('profile_fields') . " WHERE mysql_column_name = :mysql_column_name";
        $done = or_query($query, $pars);
        message(lang('redundant_configurations_deleted'));
        redirect('admin/' . thisdoc());
Esempio n. 2
0
function options__load_object($item_type, $item_name)
{
    $pars = array(':item_type' => $item_type, ':item_name' => $item_name);
    $query = "select * from " . table('objects') . "\n            where item_type= :item_type\n            and item_name= :item_name";
    $object = orsee_query($query, $pars);
    $object['item_details'] = db_string_to_property_array($object['item_details']);
    return $object;
}
Esempio n. 3
0
function email__dbstring_to_attachment_array($dbstring = '', $decode = false)
{
    $atts = array();
    $attachments = array();
    if ($dbstring) {
        $atts = explode('|-!nextatt!-|', $dbstring);
    }
    foreach ($atts as $ta) {
        $attachment = db_string_to_property_array($ta);
        if ($decode) {
            $attachment['data'] = base64_decode($attachment['data']);
        }
        $attachments[] = $attachment;
    }
    return $attachments;
}
Esempio n. 4
0
function query__load_saved_queries($type, $limit = -1, $experiment_id = 0, $details = false, $order = "query_time DESC")
{
    // type can be participants_search_active, participants_search_all, assign, deassign
    $conditions = array();
    if ($type) {
        $types = explode(",", $type);
        $tqueries = array();
        foreach ($types as $t) {
            $tqueries[] = "query_type='" . trim($t) . "'";
        }
        $conditions[] = "( " . implode(' OR ', $tqueries) . " )";
    }
    if ($experiment_id) {
        $conditions[] = "( experiment_id='" . $experiment_id . "' )";
    }
    $query = "SELECT * FROM " . table('queries');
    if (count($conditions) > 0) {
        $query .= " WHERE " . implode(" AND ", $conditions);
    }
    $query .= " ORDER BY " . $order;
    if ($limit > 0) {
        $query .= " LIMIT " . $limit;
    }
    $result = or_query($query);
    $queries = array();
    while ($q = pdo_fetch_assoc($result)) {
        if ($details) {
            $q['properties'] = db_string_to_property_array($q['properties']);
            $queries[] = $q;
        } else {
            $queries[] = $q['json_query'];
        }
    }
    return $queries;
}
             <TR><TD align="center">' . lang('currently_active_form_template') . '</TD></TR></TABLE>
         </TD>
         <TD>
             <TABLE class="or_page_subtitle" style="background: ' . $color['page_subtitle_background'] . '; color: ' . $color['page_subtitle_textcolor'] . '; width: 95%">
             <TR><TD align="center">' . lang('current_template_draft') . '</TD></TR></TABLE>
         </TD>
         <TD></TD>
     </TR>';
 $edit = array();
 if (isset($subpool_id)) {
     $edit['subpool_id'] = $subpool_id;
 }
 $query = "SELECT *\n            FROM " . table('objects') . "\n            WHERE item_type='profile_form_template'\n            ORDER BY item_id ";
 $result = or_query($query);
 while ($t = pdo_fetch_assoc($result)) {
     $details = db_string_to_property_array($t['item_details']);
     if ($t['item_name'] == 'profile_form_public') {
         echo '<TR><TD valign="top">' . lang('profile_form_public') . '</TD>
                 <TD valign="top" bgcolor="' . $color['list_shade1'] . '">';
         participant__show_inner_form($edit, array(), false, 'current_template');
         echo '</TD>
                 <TD valign="top" bgcolor="' . $color['list_shade2'] . '">';
         if ($details['current_template'] != $details['current_draft']) {
             participant__show_inner_form($edit, array(), false, 'current_draft');
         }
         echo '</TD><TD valign="top">' . button_link('options_profile_template_edit.php?item_name=' . $t['item_name'], lang('edit'), 'pencil-square-o') . '
                 </TD></TR>';
     } elseif ($t['item_name'] == 'profile_form_admin_part') {
         echo '<TR><TD valign="top">' . lang('profile_form_admin_part') . '</TD>
                 <TD valign="top" bgcolor="' . $color['list_shade1'] . '">';
         echo participant__get_inner_admin_form($edit, array(), 'current_template');
Esempio n. 6
0
function participantform__load()
{
    global $preloaded_participant_form;
    if (isset($preloaded_participant_form) && is_array($preloaded_participant_form) && count($preloaded_participant_form) > 0) {
        return $preloaded_participant_form;
    } else {
        $query = "SELECT  * FROM " . table('profile_fields') . "\n                WHERE enabled=1";
        $result = or_query($query);
        $pform = array();
        while ($line = pdo_fetch_assoc($result)) {
            $prop = db_string_to_property_array($line['properties']);
            foreach ($prop as $k => $v) {
                if (!isset($line[$k])) {
                    $line[$k] = $v;
                }
            }
            $pform[] = $line;
        }
        // make sure all standard properties are set for all fields
        foreach ($pform as $k => $f) {
            $t = participantform__allvalues();
            foreach ($f as $kf => $vf) {
                $t[$kf] = $vf;
            }
            $pform[$k] = $t;
        }
        $preloaded_participant_form = $pform;
        return $pform;
    }
}
    } else {
        $field_name = $_REQUEST['mysql_column_name'];
    }
}
if ($proceed) {
    $allow = check_allow('pform_config_field_configure', 'options_participant_profile.php');
}
if ($proceed) {
    $field = orsee_db_load_array("profile_fields", $field_name, "mysql_column_name");
    $allvalues = participantform__allvalues();
    if (!isset($field['mysql_column_name'])) {
        $new = true;
        $field = array('mysql_column_name' => $field_name, 'enabled' => 'y', 'name_lang' => $field_name, 'type' => 'select_lang');
    } else {
        $new = false;
        $prop = db_string_to_property_array($field['properties']);
        unset($field['properties']);
        foreach ($prop as $k => $v) {
            $field[$k] = $v;
        }
    }
    foreach ($allvalues as $k => $v) {
        if (!isset($field[$k])) {
            $field[$k] = $v;
        }
    }
}
if ($proceed) {
    if ($field_name == 'email') {
        $restrict_to = array('size', 'maxlength', 'error_message_if_empty_lang', 'perl_regexp', 'error_message_if_no_regexp_match_lang', 'unique_on_create_page_error_message_if_exists_lang', 'unique_on_create_page_tell_if_deleted', 'unique_on_create_page_email_regmail_confmail_again', 'unique_on_edit_page_error_message_if_exists_lang', 'default_value', 'link_as_email_in_lists');
    } else {