Example #1
0
		<?php 
$query = "SELECT * FROM `directus_users` ";
// Hides inactive users from non-administrators
if (!$cms_user['admin']) {
    $query .= "WHERE `active` = '1' ";
}
$query .= "ORDER BY `active` DESC, `last_login` DESC ";
foreach ($dbh->query($query) as $user) {
    $last_page = explode('?', $user["last_page"]);
    $page_user_on = uc_convert(basename($last_page[0], ".php"));
    parse_str($last_page[1], $user_query_string);
    $table = $user_query_string['table'] ? uc_table($user_query_string['table']) : '';
    // Find out the page that users are on based on URL
    if ($plugin_pos = strpos($user["last_page"], '/plugins/')) {
        $plugin_name = explode('/', substr($last_page[0], $plugin_pos + 9));
        $describe_page_on = uc_convert($plugin_name[0]) . ' Plugin';
    } elseif ($page_user_on == 'Edit') {
        $describe_page_on = $user_query_string['item'] ? 'Editing within <b>' . $table . '</b>' : 'Creating new item in <b>' . $table . '</b>';
    } elseif ($page_user_on == 'Index') {
        $describe_page_on = 'Dashboard';
    } elseif ($page_user_on == 'Browse') {
        $describe_page_on = 'Browsing <b>' . $table . '</b>';
    } elseif (!$user["last_page"]) {
        $describe_page_on = 'Hasn\'t logged in yet';
    } else {
        $describe_page_on = $page_user_on . ' page';
    }
    ?>
			<tr<?php 
    echo !$user['active'] ? ' class="inactive_user"' : '';
    ?>
Example #2
0
 public function testSpecialCaps()
 {
     $text = 'I want an ipad, ipod and iphone with the latest ios';
     $expected = 'I Want An iPad, iPod And iPhone With The Latest iOS';
     $this->assertSame($expected, uc_convert($text));
 }
Example #3
0
" class="header field_<?php 
        echo $field;
        ?>
 <?php 
        echo $key == 0 ? 'first_field' : '';
        ?>
 <?php 
        echo $field_order[0] == $field ? $field_direction : '';
        ?>
" <?php 
        echo !$table_rows['header_fields'] && $key < 8 || $settings['field_primary'][$table_rows['name']] == $field || strpos($table_rows['header_fields'], ',' . $field . ',') !== false ? '' : 'style="display:none;"';
        ?>
 >
						<div class="wrap">
							<?php 
        echo uc_convert($field);
        // Add mail icon for email fields
        echo $settings["field_format"][$table_rows['name'] . "," . $field] == 'email' ? ' <a href="#" field="' . $field . '" table="' . $table_rows['name'] . '" class="generate_email_list"><img src="media/site/icons/mail-medium.png" width="16" height="16" /></a>' : '';
        ?>
							<span class="ui-icon up"></span>
						</div>
					</th>
					<?php 
    }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
?>
		</tr>
	</thead>
	<tbody class="sortable check_no_rows">
		<?php 
Example #4
0
function generate_fields($data)
{
    global $dbh;
    global $settings;
    $item = $data['rows'][$data['item_id']];
    foreach ($data['info'] as $key => $field) {
        $value = $item[$key];
        $t_f = $data['name'] . ',' . $key;
        $note = $settings['field_note'][$t_f] ? ' <span class="note">' . $settings['field_note'][$t_f] . '</span>' : '';
        $required_mark = $settings['field_required'][$t_f] == 'true' ? '<span class="loud">*</span>' : '';
        $required = $settings['field_required'][$t_f] == 'true' ? 'required' : '';
        $field_format = $settings['field_format'][$t_f] ? $settings['field_format'][$t_f] : get_datatype_formats($field['type_lengthless'], $primary_only = true);
        // 'text_field'
        $is_relational = $settings['field_format'][$t_f] == 'relational' ? true : false;
        $field_option = $settings['field_option'][$t_f];
        // If field is hidden, add a hidden input and skip
        if ($settings['field_hidden'][$t_f] == 'true') {
            ?>
			<input type="hidden" name="<?php 
            echo $key;
            ?>
" value="<?php 
            echo esc_attr($value);
            ?>
">
			<?php 
            continue;
        }
        //////////////////////////////////////////////////////////////////////////////
        ?>
		<div class="field">
			<?php 
        //////////////////////////////////////////////////////////////////////////////s
        // Check if field is relational
        if ($is_relational) {
            // Get options
            // REMINDER: MUST CHECK THE SQL STATEMENT TO ENSURE THERE IS NOTHING MALICIOUS!
            if ($sth = $dbh->query($field_option['relational']['sql'])) {
                $option_fields = explode(",", $field_option['relational']["option"]);
                if ($field_option['relational']["style"] == 'fancy') {
                    unset($row_options);
                    while ($row_array = $sth->fetch()) {
                        $row_options[$row_array[$field_option['relational']["value"]]] = $row_array;
                    }
                    ?>
						<label class="primary" for="<?php 
                    echo $key;
                    ?>
"><?php 
                    echo uc_convert($key) . $required_mark;
                    ?>
</label> <?php 
                    echo $note;
                    ?>
<br>
						<table id="fancy_<?php 
                    echo $key;
                    ?>
" cellpadding="0" cellspacing="0" border="0" class="simple_sortable">
							<tbody class="check_no_rows">
								<tr class="item no_rows"><td colspan="3">No items</td></tr>
								
								<?php 
                    $value_array = array_filter(explode(',', $value));
                    foreach ($value_array as $ordered_value) {
                        // Should save only ID for fancy... so we can edit items with a unique key
                        $id = str_replace('"', "&#34;", $ordered_value);
                        // Make visible option with multiple fields  (field1,field2)
                        unset($option_array);
                        foreach ($option_fields as $temp) {
                            $option_array[] = get_field_value($field_option['relational']["add_from_table"], $temp, $row_options[$ordered_value][$temp], 'code');
                        }
                        // Only show found
                        $found = $value == $ordered_value ? true : strpos($value, "," . $ordered_value . ",");
                        if ($found !== false) {
                            ?>
										<tr class="item" replace_with="<?php 
                            echo $id;
                            ?>
"> 
											<td class="order handle"><img src="media/site/icons/ui-splitter-horizontal.png" width="16" height="16" /></td> 
											<td>
												<div class="wrap">
													<?php 
                            echo implode($field_option['relational']["option_glue"], $option_array);
                            ?>
													<input type="hidden" name="<?php 
                            echo $key;
                            ?>
[]" value="<?php 
                            echo $id;
                            ?>
">
													<a class="badge edit_fancy modal" href="edit.php?modal=<?php 
                            echo $key;
                            ?>
&table=<?php 
                            echo $field_option['relational']["add_from_table"];
                            ?>
&parent_table=<?php 
                            echo $_GET['table'];
                            ?>
&item=<?php 
                            echo $id;
                            ?>
" style="display:none;">Edit</a>
												</div>
											</td> 
											<td width="10%"><a class="ui-icon ui-icon-close right remove_fancy" href=""></a></td> 
										</tr> 
										<?php 
                        }
                    }
                    ?>
																
							</tbody>
						</table> 
						
						<?php 
                    if (!$field_option['relational']["only_new"]) {
                        ?>
							<span class="fancy_new"> 
								<select field="<?php 
                        echo $key;
                        ?>
" table="<?php 
                        echo $field_option['relational']["add_from_table"];
                        ?>
" parent_table="<?php 
                        echo $_GET['table'];
                        ?>
"> 
									<option value="">Select One</option> 
									<?php 
                        foreach ($row_options as $row_option) {
                            $option_value = $row_option[$field_option['relational']["value"]];
                            // Make visible option with multiple fields  (field1,field2)
                            $safe_value = str_replace('"', "&#34;", $option_value);
                            unset($option_array);
                            foreach ($option_fields as $temp) {
                                $option_array[] = get_field_value($field_option['relational']["add_from_table"], $temp, $row_option[$temp], 'text');
                            }
                            // Only show non-used
                            //$found = ($value == $option_value)? true : strpos($value, ",".$option_value.",");
                            //if($found === false){
                            ?>
										<option value="<?php 
                            echo $safe_value;
                            ?>
"><?php 
                            echo implode($field_option['relational']["option_glue"], $option_array);
                            ?>
</option>
										<?php 
                        }
                        ?>
 
								</select> 
								
								<span> or </span>
							<?php 
                    }
                    ?>
							
							<a class="modal button pill" href="edit.php?modal=<?php 
                    echo $key;
                    ?>
&table=<?php 
                    echo $field_option['relational']["add_from_table"];
                    ?>
&parent_table=<?php 
                    echo $_GET['table'];
                    ?>
">Add New</a></span>
							
						<?php 
                } elseif ($field_option['relational']["style"] == 'checkboxes_radios') {
                    //////////////////////////////////////////////////////////////////////////////
                    // Checkboxes or Radio Buttons
                    $multiple = $field_option['relational']["multiple"] ? 'checkbox' : 'radio';
                    $array_code = $field_option['relational']["multiple"] ? '[]' : '';
                    ?>
						<label class="primary" <?php 
                    echo $required != '' ? 'class="required_multi" require="' . $key . $array_code . '"' : '';
                    ?>
><?php 
                    echo uc_convert($key) . $required_mark;
                    ?>
</label> <?php 
                    echo $note;
                    ?>
<br>
						<?php 
                    while ($row_options = $sth->fetch()) {
                        $option_value = $row_options[$field_option['relational']["value"]];
                        // Make visible option with multiple fields  (field1,field2)
                        $safe_value = str_replace('"', "&#34;", $option_value);
                        unset($option_array);
                        foreach ($option_fields as $temp) {
                            $option_array[] = $row_options[$temp];
                        }
                        if ($field_option['relational']["multiple"]) {
                            $found = $value == $option_value ? 1 : strpos($value, "," . $option_value . ",");
                            $selected = $found !== false ? 'checked="checked"' : '';
                        } else {
                            $selected = $value == $option_value ? 'checked="checked"' : '';
                        }
                        ?>
							<label class="multi_inputs"><input name="<?php 
                        echo $key . $array_code;
                        ?>
" value="<?php 
                        echo $safe_value;
                        ?>
" <?php 
                        echo $selected;
                        ?>
 type="<?php 
                        echo $multiple;
                        ?>
"><?php 
                        echo implode($field_option['relational']["option_glue"], $option_array);
                        ?>
</label>
							<?php 
                    }
                } else {
                    //////////////////////////////////////////////////////////////////////////////
                    // Default dropdown or multi-select list
                    $multiple = $field_option['relational']["multiple"] ? 'multiple="multiple"' : '';
                    $array_code = $field_option['relational']["multiple"] ? '[]' : '';
                    ?>
						<label class="primary" for="<?php 
                    echo $key;
                    ?>
"><?php 
                    echo uc_convert($key) . $required_mark;
                    ?>
</label> <?php 
                    echo $note;
                    ?>
<br>
						<select name="<?php 
                    echo $key . $array_code;
                    ?>
" <?php 
                    echo $multiple;
                    ?>
 class="<?php 
                    echo $required;
                    ?>
"> 
							<?php 
                    if (!$field_option['relational']["multiple"]) {
                        ?>
<option value="NULL">Select One</option><?php 
                    }
                    while ($row_options = $sth->fetch()) {
                        $option_value = $row_options[$field_option['relational']["value"]];
                        // Make visible option with multiple fields  (field1,field2)
                        $safe_value = str_replace('"', "&#34;", $option_value);
                        unset($option_array);
                        foreach ($option_fields as $temp) {
                            $option_array[] = $row_options[$temp];
                        }
                        if ($field_option['relational']["multiple"]) {
                            $found = $value == $option_value ? 1 : strpos($value, "," . $option_value . ",");
                            $selected = $found !== false ? 'selected="selected"' : '';
                        } else {
                            $selected = $value == $option_value ? 'selected="selected"' : '';
                        }
                        ?>
								<option value="<?php 
                        echo $safe_value;
                        ?>
" <?php 
                        echo $selected;
                        ?>
 ><?php 
                        echo implode($field_option['relational']["option_glue"], $option_array);
                        ?>
</option>
								<?php 
                    }
                    ?>
						</select>
						<?php 
                }
            } else {
                echo '<b class="warning">Error:</b> Update the options for this field on the <a class="warning" href="settings.php">settings page</a>.';
            }
        } elseif ($field_format == 'media') {
            ?>
			
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<table id="media_<?php 
            echo $key;
            ?>
" cellpadding="0" cellspacing="0" border="0" class="simple_sortable media_dropzone_target" parent_item="<?php 
            echo $key;
            ?>
" extensions="<?php 
            echo $field_option['media']["extensions"];
            ?>
" media_type="relational"> 
					<tbody class="check_no_rows">
						<tr class="item no_rows"><td colspan="4">No media</td></tr>
						
						<?php 
            $media_array = explode(',', $value);
            $media_array = array_filter($media_array);
            // Prepare the query once and run it for each media item
            // Reminder: This can be moved FURTHER up to before foreach to prepare only ONCE
            $sth = $dbh->prepare("SELECT * FROM `directus_media` WHERE `active` = '1' AND `id` = :id ");
            $sth->bindParam(':id', $media_id);
            foreach ($media_array as $media_id) {
                $sth->execute();
                if ($media = $sth->fetch()) {
                    ?>
								<tr class="item" replace_with="media_<?php 
                    echo $media_id;
                    ?>
"> 
									<td class="order handle"><img src="media/site/icons/ui-splitter-horizontal.png" width="16" height="16" /></td> 
									<td class="thumb"><?php 
                    generate_media_image($media['extension'], $media['source'], $media['height'], $media['width'], $media['file_size']);
                    ?>
</td> 
									<td>
										<div class="wrap">
											<?php 
                    echo $media['title'];
                    ?>
											<input type="hidden" name="<?php 
                    echo $key;
                    ?>
[]" value="<?php 
                    echo $media_id;
                    ?>
">
											<a class="badge edit_fancy modal" href="inc/media_modal.php?type=relational&replace=true&parent_item=<?php 
                    echo $key;
                    ?>
&id=<?php 
                    echo $media['id'];
                    ?>
" style="display:none;">Edit</a>
										</div>
									</td> 
									<td width="10%"><a tabindex="-1" class="ui-icon ui-icon-close right remove_media" href=""></a></td> 
								</tr>
								<?php 
                }
            }
            ?>
												
					</tbody>
				</table> 
				<span class="fancy_new">
					<a tabindex="-1" class="modal button pill" href="inc/media_modal.php?type=relational&parent_item=<?php 
            echo $key;
            echo $field_option['media']["new_only"] ? '&new_only=true' : '';
            echo $field_option['media']["extensions"] ? '&extensions=' . $field_option['media']["extensions"] : '';
            ?>
">Add Media</a>
					<?php 
            echo $field_option['media']["extensions"] ? ' <span class="note">(' . implode(' or ', array_filter(explode(',', str_replace(' ', '', strtolower($field_option['media']["extensions"]))))) . ')</span>' : '';
            ?>
				</span>
			
			<?php 
        } elseif ($field_format == 'options') {
            ?>
				
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				
				<?php 
            $array_code = $field_option['options']["multiple"] ? '[]' : '';
            // Get multiple options
            if ($field_option['options']["style"] != 'checkboxes_radios') {
                $select_code = 'selected="selected"';
                $multiple = $field_option['options']["multiple"] ? 'multiple="multiple"' : '';
                ?>
<select name="<?php 
                echo $key . $array_code;
                ?>
" <?php 
                echo $multiple;
                ?>
 class="<?php 
                echo $required;
                ?>
"> <?php 
            } else {
                $select_code = 'checked="checked"';
                $multiple = $field_option['options']["multiple"] ? 'checkbox' : 'radio';
            }
            if (!$field_option['options']["multiple"]) {
                ?>
<option value="NULL">Select One</option><?php 
            }
            $option_array = array_filter(explode(',', $field_option['options']["values"]));
            foreach ($option_array as $option_value) {
                // Clean up the value a bit
                $option_value = trim($option_value);
                // Make safe the attribute value
                $safe_value = str_replace('"', "&#34;", $option_value);
                if ($field_option['options']["multiple"]) {
                    $found = $value == $option_value ? 1 : strpos($value, "," . $option_value . ",");
                    $selected = $found !== false ? $select_code : '';
                } else {
                    $selected = $value == $option_value ? $select_code : '';
                }
                if ($field_option['options']["style"] == 'checkboxes_radios') {
                    ?>
<label class="multi_inputs"><input name="<?php 
                    echo $key . $array_code;
                    ?>
" value="<?php 
                    echo $safe_value;
                    ?>
" <?php 
                    echo $selected;
                    ?>
 type="<?php 
                    echo $multiple;
                    ?>
"><?php 
                    echo $option_value;
                    ?>
</label><?php 
                } else {
                    ?>
<option value="<?php 
                    echo $safe_value;
                    ?>
" <?php 
                    echo $selected;
                    ?>
 ><?php 
                    echo $option_value;
                    ?>
</option><?php 
                }
            }
            if ($field_option['options']["style"] != 'checkboxes_radios') {
                ?>
</select><?php 
            }
        } elseif ($field_format == 'tags') {
            $tags = explode(',', $value);
            $tags = array_filter($tags);
            ?>
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<input id="input_<?php 
            echo $key;
            ?>
" class="short_half tag_input <?php 
            echo $field_option['tags']["autocomplete"] ? 'tag_autocomplete' : '';
            ?>
" type="text"> <input tabindex="-1" field="<?php 
            echo $key;
            ?>
" class="tag_add button pill" type="button" value="Add"> 
				<input id="hidden_<?php 
            echo $key;
            ?>
" type="hidden" name="<?php 
            echo $key;
            ?>
" value="<?php 
            echo esc_attr($value);
            ?>
" class="<?php 
            echo $required;
            ?>
">
				<div id="tags_<?php 
            echo $key;
            ?>
" class="tags_list clearfix">
					<?php 
            foreach ($tags as $tag_key => $tag_value) {
                ?>
						<span class="tag" tag="<?php 
                echo $tag_value;
                ?>
"><?php 
                echo $tag_value;
                ?>
<a class="tag_remove" tabindex="-1" href="#">&times;</a></span> 
						<?php 
            }
            ?>
				</div>
				
			<?php 
        } elseif ($field_format == 'checkbox') {
            ?>
				
				<label class="primary" for="<?php 
            echo $key;
            ?>
">
				<input name="<?php 
            echo $key;
            ?>
" type="checkbox" value="1" <?php 
            echo $value == 1 ? 'checked="checked"' : '';
            ?>
>
				 <?php 
            echo uc_convert($key) . $required_mark;
            ?>
				</label> <?php 
            echo $note;
            ?>
			
			<?php 
        } elseif ($field['type_lengthless'] == 'date') {
            $value = $value ? $value : date('Y-m-d');
            ?>
	
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<input name="<?php 
            echo $key;
            ?>
" value="<?php 
            echo $value ? $value : date('Y-m-d');
            ?>
" maxlength="10" class="small short_10 text_center date datepicker <?php 
            echo $required;
            ?>
" type="text" size="10"> 
			
			<?php 
        } elseif ($field['type_lengthless'] == 'time') {
            $value = $value ? $value : date('h:i:s');
            ?>
	
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<input name="<?php 
            echo $key;
            ?>
" value="<?php 
            echo $value;
            ?>
" maxlength="8" class="small short_8 text_center date <?php 
            echo $required;
            ?>
" type="text" size="10"> 
			
			<?php 
        } elseif ($field['type_lengthless'] == 'year') {
            $value = $value ? $value : date('Y');
            ?>
	
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<input name="<?php 
            echo $key;
            ?>
" value="<?php 
            echo $value;
            ?>
" maxlength="4" class="small short_4 text_center year force_numeric <?php 
            echo $required;
            ?>
" type="text" size="10"> 
			
			<?php 
        } elseif ($field['type_lengthless'] == 'datetime') {
            $value_time = $value ? strtotime($value) : strtotime('now');
            $month = date('m', $value_time);
            ?>
				
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<div class="datetime_fields">
					<select class="month"> 
						<option value="01" <?php 
            echo $month == '01' ? 'selected="selected"' : '';
            ?>
>Jan</option> 
						<option value="02" <?php 
            echo $month == '02' ? 'selected="selected"' : '';
            ?>
>Feb</option> 
						<option value="03" <?php 
            echo $month == '03' ? 'selected="selected"' : '';
            ?>
>Mar</option> 
						<option value="04" <?php 
            echo $month == '04' ? 'selected="selected"' : '';
            ?>
>Apr</option> 
						<option value="05" <?php 
            echo $month == '05' ? 'selected="selected"' : '';
            ?>
>May</option> 
						<option value="06" <?php 
            echo $month == '06' ? 'selected="selected"' : '';
            ?>
>Jun</option> 
						<option value="07" <?php 
            echo $month == '07' ? 'selected="selected"' : '';
            ?>
>Jul</option> 
						<option value="08" <?php 
            echo $month == '08' ? 'selected="selected"' : '';
            ?>
>Aug</option> 
						<option value="09" <?php 
            echo $month == '09' ? 'selected="selected"' : '';
            ?>
>Sep</option> 
						<option value="10" <?php 
            echo $month == '10' ? 'selected="selected"' : '';
            ?>
>Oct</option> 
						<option value="11" <?php 
            echo $month == '11' ? 'selected="selected"' : '';
            ?>
>Nov</option> 
						<option value="12" <?php 
            echo $month == '12' ? 'selected="selected"' : '';
            ?>
>Dec</option> 
					</select> 
					<input class="small short_1 text_center day force_numeric" type="text" size="2" maxlength="2" value="<?php 
            echo date('j', $value_time);
            ?>
">, 
					<input class="small short_4 text_center year force_numeric" type="text" size="4" maxlength="4" value="<?php 
            echo date('Y', $value_time);
            ?>
"> @ 
					<input class="small short_1 text_center hour force_numeric" type="text" size="2" maxlength="2" value="<?php 
            echo date('H', $value_time);
            ?>
"> : 
					<input class="small short_1 text_center minute force_numeric" type="text" size="2" maxlength="2" value="<?php 
            echo date('i', $value_time);
            ?>
"> : 
					<input class="small short_1 text_center second force_numeric" type="text" size="2" maxlength="2" value="<?php 
            echo date('s', $value_time);
            ?>
"> 
					<input class="small short_6 text_center datetime <?php 
            echo $required;
            ?>
" type="hidden" name="<?php 
            echo $key;
            ?>
" value="<?php 
            echo $value ? $value : date('Y-m-j H:i:s', $value_time);
            ?>
">
				</div>
			
			<?php 
        } elseif ($field_format == 'text_area') {
            ?>
				
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<div class="textarea_format clearfix"> 
					<ul> 
						<li><a href="#" class="text_format_button" tabindex="-1" format="bold"><strong>Bold</strong></a></li> 
						<li><a href="#" class="text_format_button" tabindex="-1" format="italic"><em>Italic</em></a></li> 
						<li><a href="#" class="text_format_button" tabindex="-1" format="link">Link</a></li> 
						<li><a href="#" class="text_format_button" tabindex="-1" format="mail">Mail</a></li>
						<li><a href="#" class="text_format_button" tabindex="-1" format="image">Insert Image</a></li> 
						<li><a href="#" class="text_format_button" tabindex="-1" format="excerpt">Excerpt</a></li> 
						<li><a href="#" class="text_format_button" tabindex="-1" format="blockquote">Blockquote</a></li> 
					</ul>
				</div> 
				<textarea class="textarea_formatted media_dropzone_target" parent_item="text_area_<?php 
            echo $key;
            ?>
" extensions="jpg,gif,png" media_type="inline" rows="<?php 
            echo $field_option['text_area']["height"] ? $field_option['text_area']["height"] : '8';
            ?>
" id="text_area_<?php 
            echo $key;
            ?>
" name="<?php 
            echo $key;
            ?>
" class="<?php 
            echo $required;
            ?>
"><?php 
            echo esc_attr(br2nl($value));
            ?>
</textarea> 
			
			<?php 
        } elseif ($field_format == 'table_view') {
            ?>
				
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br> 
				<textarea rows="4" id="text_area_<?php 
            echo $key;
            ?>
" name="<?php 
            echo $key;
            ?>
" class="<?php 
            echo $required;
            ?>
"><?php 
            echo $value;
            ?>
</textarea> 
				<a tabindex="-1" class="edit_table_view button pill" csv-id="text_area_<?php 
            echo $key;
            ?>
" href="inc/edit_table.php">Edit in table view</a>
				<span class="note">You can always paste a CSV file above to start with</span>
			
			<?php 
        } elseif ($field_format == 'short_name') {
            ?>
			
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<input class="track_max_length short_name <?php 
            echo $required;
            ?>
" short_name="<?php 
            echo $field_option['short_name']["field"];
            ?>
" name="<?php 
            echo $key;
            ?>
" type="text" value="<?php 
            echo esc_attr($value);
            ?>
" maxlength="<?php 
            echo $field['type_length'];
            ?>
">
				<span class="char_count"><?php 
            echo $field['type_length'] - strlen($value);
            ?>
</span> 
				
			<?php 
        } elseif ($field_format == 'numeric') {
            ?>
			
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<input class="track_max_length force_numeric <?php 
            echo $required;
            ?>
" name="<?php 
            echo $key;
            ?>
" type="text" value="<?php 
            echo esc_attr($value);
            ?>
" maxlength="<?php 
            echo $field['type_length'];
            ?>
">
				<span class="char_count"><?php 
            echo $field['type_length'] - strlen($value);
            ?>
</span> 
				
			<?php 
        } elseif ($field_format == 'password') {
            ?>
			
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<input class="track_max_length <?php 
            echo $required;
            ?>
 <?php 
            echo $field_option['password']["unmask"] ? 'unmask' : '';
            ?>
" name="<?php 
            echo $key;
            ?>
" type="password" value="<?php 
            echo esc_attr($value);
            ?>
" maxlength="<?php 
            echo $field['type_length'];
            ?>
">
				<span class="char_count"><?php 
            echo $field['type_length'] - strlen($value);
            ?>
</span> 
				
			<?php 
        } elseif ($field_format == 'password_confirm') {
            ?>
			
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<input class="track_max_length <?php 
            echo $required;
            ?>
" name="<?php 
            echo $key;
            ?>
" type="password" value="<?php 
            echo esc_attr($value);
            ?>
" maxlength="<?php 
            echo $field['type_length'];
            ?>
">
				<span class="char_count"><?php 
            echo $field['type_length'] - strlen($value);
            ?>
</span> 
				
			<?php 
        } elseif ($field_format == 'color') {
            ?>
			
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				# <input class="small short_6 text_center color_field <?php 
            echo $required;
            ?>
" name="<?php 
            echo $key;
            ?>
" type="text" value="<?php 
            echo $value ? strtoupper(esc_attr($value)) : 'FFFFFF';
            ?>
" maxlength="6"> <span class="color_box" color_box="<?php 
            echo $key;
            ?>
" style="background-color:#<?php 
            echo $value ? esc_attr($value) : 'FFFFFF';
            ?>
;"></span>
			
			<?php 
        } elseif ($field_format == 'histogram') {
            // Get highest value for this field across the table
            $histogram_table = get_rows_info($data['name']);
            $histogram_sql = $histogram_table['active'] == true ? "AND `active` = '1' " : "";
            $sth = $dbh->query("SELECT max({$key}) as peak_amount FROM `" . $data['name'] . "` WHERE id != '" . $data['item_id'] . "' {$histogram_sql}");
            $peak_amount = ($peak = $sth->fetch()) ? $peak["peak_amount"] : 0;
            ?>
			
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<input class="small short_6 force_numeric histogram <?php 
            echo $required;
            ?>
" name="<?php 
            echo $key;
            ?>
" type="text" value="<?php 
            echo esc_attr($value);
            ?>
" maxlength="<?php 
            echo $field['type_length'];
            ?>
"> <span class="histogram_bar" peak_amount="<?php 
            echo $peak_amount;
            ?>
"><span this_amount="<?php 
            echo esc_attr($value);
            ?>
"></span></span> <span title="<?php 
            echo esc_attr($value) . '/' . $peak_amount;
            ?>
" class="histogram_percent">0%</span>
				
			<?php 
        } elseif ($field_format == 'rating') {
            ?>
			
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<div class="editable_rating">
					<div class="rating_system" style="width:<?php 
            echo 16 * $field_option['rating']["max"];
            ?>
px;">
						<div class="rating_bar" style="width:<?php 
            echo 16 * $value;
            ?>
px;">&nbsp;</div>
						<?php 
            for ($i = 1; $i <= $field_option['rating']["max"]; $i++) {
                ?>
<span class="star" alt="<?php 
                echo $i;
                ?>
" count="<?php 
                echo $i;
                ?>
"></span><?php 
            }
            ?>
					</div>
					<input class="small short_2 text_center rating_input <?php 
            echo $required;
            ?>
" name="<?php 
            echo $key;
            ?>
" type="text" value="<?php 
            echo esc_attr($value);
            ?>
" maxlength="<?php 
            echo $field['type_length'];
            ?>
"> out of <?php 
            echo $field_option['rating']["max"];
            ?>
				</div>
				
			<?php 
        } else {
            ?>
			
				<label class="primary" for="<?php 
            echo $key;
            ?>
"><?php 
            echo uc_convert($key) . $required_mark;
            ?>
</label> <?php 
            echo $note;
            ?>
<br>
				<input class="<?php 
            echo $field_format == 'email' ? 'validate_email short_half' : '';
            ?>
 <?php 
            echo $field['type_length'] > 0 ? 'track_max_length' : '';
            ?>
 <?php 
            echo $required;
            ?>
" name="<?php 
            echo $key;
            ?>
" type="<?php 
            echo $field_format == 'email' ? 'email' : 'text';
            ?>
" value="<?php 
            echo esc_attr($value);
            ?>
" <?php 
            echo $field['type_length'] > 0 ? 'maxlength="' . $field['type_length'] . '"' : '';
            ?>
>
				<?php 
            if ($field['type_length'] > 0) {
                ?>
<span class="char_count"><?php 
                echo $field['type_length'] - strlen($value);
                ?>
</span> <?php 
            }
            ?>
			<?php 
        }
        ?>
			
		</div>
		<?php 
    }
}
Example #5
0
 public static function getTemplates()
 {
     // @TODO: SchemaManager shouldn't be a class with static methods anymore
     // the UI templates list will be provided by a container or bootstrap.
     $path = implode(DIRECTORY_SEPARATOR, [BASE_PATH, 'api', 'migrations', 'templates', '*']);
     $templatesDirs = glob($path, GLOB_ONLYDIR);
     $templatesData = [];
     foreach ($templatesDirs as $dir) {
         $key = basename($dir);
         $templatesData[$key] = ['id' => $key, 'name' => uc_convert($key)];
     }
     return $templatesData;
 }
Example #6
0
			<?php 
    } else {
        echo '<div id="messages_message">No such message</div>';
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // View listing of messages
} else {
    ?>
		<div id="messages_<?php 
    echo $_GET["m"];
    ?>
">
			<h3>
				<span>
				<?php 
    echo !$_GET["m"] || $_GET["m"] == "inbox" ? 'Inbox' : uc_convert($_GET["m"]) . ' Messages';
    ?>
				</span>
				<?php 
    if (!$_GET["m"] || $_GET["m"] == "inbox") {
        ?>
<a id="mark_all_as_read" class="button right" href="#" style="line-height:1.5;">Mark all as read</a><?php 
    }
    ?>
			</h3>
			<table id="inbox" cellspacing="0" cellpadding="0">
				<?php 
    $total_visible = 0;
    foreach ($messages as $message) {
        $unread = strpos($message['viewed'], ',' . $cms_user['id'] . ',') === false && $message['unread_replies'] == NULL || $message['unread_replies'] > 0 && $message['unread_replies'] != NULL ? true : false;
        if ($_GET['m'] == 'unread') {
Example #7
0
    $_GET['extensions'] = implode(',', $extensions_allowed);
    $extensions_string = '(Only: ' . implode(', ', $extensions_allowed) . ')';
    $extension_sql = "AND FIND_IN_SET(`extension`, :extension)";
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
?>

<div class="fog"></div> 

<div class="modal_window" style="display:none;"> 
	<div class="modal_window_header" class="clearfix"> 
		<?php 
echo is_numeric($_GET['id']) ? 'Edit Media' : 'Add New Media';
?>
		<?php 
echo $_GET['type'] == 'relational' ? ' within ' . uc_convert($_GET['parent_item']) : '';
?>
		<?php 
echo $extensions_string;
?>
		<a class="close_modal" href=""></a> 
	</div> 
	
	<form enctype="multipart/form-data" id="upload_form" target="iframe" action="inc/upload.php" method="post" name="upload_media_form">
		
		<div class="modal_window_content media_modal_window_content"> 
			
			<?php 
if (is_numeric($_GET['id'])) {
    ?>
<input type="hidden" value="<?php 
Example #8
0
			</body>
		</html>
		<?php 
    } else {
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Edit in modal window
        ?>
		<div class="fog"></div> 
			
		<div class="modal_window" style="display:none;"> 
			<div class="modal_window_header" class="clearfix"> 
				<?php 
        echo $has_id ? 'Edit Item' : 'Add New Item';
        ?>
				<?php 
        echo isset($_GET['relational_media']) ? ' within ' . uc_convert($_GET['relational_media']) : '';
        ?>
				<a class="close_modal" href=""></a> 
			</div>
			
			<form id="edit_form" name="edit_form" target="iframe" action="edit.php?modal=<?php 
        echo $_GET['modal'];
        ?>
&table=<?php 
        echo $_GET['table'];
        ?>
&parent_table=<?php 
        echo $_GET['parent_table'];
        echo $has_id ? '&item=' . $id : '';
        ?>
" method="post">
		<select name="field_option[<?php 
    echo $table_field;
    ?>
][field]">
			<?php 
    $table_rows_short_name = get_rows_info($table);
    foreach ($table_rows_short_name['fields'] as $field_key_short_name => $field_short_name) {
        ?>
<option value="<?php 
        echo $field_short_name;
        ?>
" <?php 
        echo $option['field'] == $field_short_name ? 'selected="selected"' : '';
        ?>
><?php 
        echo uc_convert($field_short_name);
        ?>
</option><?php 
    }
    ?>
		</select>
	</div>
	<?php 
} elseif ($datatype == 'color') {
    // NULL
} elseif ($datatype == 'rating') {
    ?>
	<div>
		<input type="text" name="field_option[<?php 
    echo $table_field;
    ?>
Example #10
0
        echo $table_field;
        ?>
">
												<?php 
        //////////////////////////////////////////////////////////////////////////////
        // Print out all dropdown options for this datatype
        foreach ((array) get_datatype_formats($type) as $value) {
            ?>
<option value="<?php 
            echo $value;
            ?>
" <?php 
            echo $datatype == $value ? 'selected="selected"' : '';
            ?>
 ><?php 
            echo uc_convert($value);
            echo $value == "table_view" ? " (Beta)" : "";
            ?>
</option><?php 
        }
        //////////////////////////////////////////////////////////////////////////////
        ?>
											</select>
											<a id="" class="datatype_more_options" href="#">more options</a>
											<div class="options_container"><?php 
        include 'inc/datatype_options.php';
        ?>
</div>
										</td>
										<td class="text_center"><input title="Required" type="checkbox" name="field_required[<?php 
        echo $table_field;
Example #11
0
	<div id="content">
		<div class="container">

			<div id="page">
			
			<?php 
// Show the header if we're on a plugin page
if ($plugin_on) {
    ?>
				<div id="page_header" class="clearfix"> 
					<h2 class="col_8">
						<?php 
    if (CMS_PAGE_FILE == 'plugin_settings.php') {
        echo '<a href="' . $directus_path . 'plugins/' . $plugin_on . '/index.php">' . uc_convert($plugin_on) . '</a> <span class="divider">/</span> Settings ';
    } else {
        echo uc_convert($plugin_on);
    }
    ?>
					</h2> 
					<?php 
    if ($cms_user['admin'] && file_exists(BASE_PATH . 'plugins/' . $plugin_on . '/plugin_settings.php') && CMS_PAGE_FILE != 'plugin_settings.php') {
        ?>
<a id="plugin_settings" class="button pill right" href="plugin_settings.php">Plugin Settings</a><?php 
    }
    ?>
					<a id="plugin_info" class="button pill right" href="info.txt">Plugin Info</a>
				</div> 
				
				<hr class="chubby">
				<?php 
}