コード例 #1
0
function db_meta($post)
{
    $post_meta = get_post_custom();
    // assign all columns to variable
    $db_columns = db_columns();
    // in case value isn't set in database, set required variables to ''
    foreach ($db_columns as $column) {
        ${$column} = '';
    }
    // assign all fields
    foreach ((array) $post_meta as $key => $meta) {
        if (array_key_exists($key, array_flip($db_columns))) {
            // if we want this key
            if (isset($key) && !empty($key)) {
                ${$key} = trim($meta[0]);
            } else {
                ${$key} = '';
            }
        }
    }
    ?>
	<style>
		#category-adder h4 { display:none; }
		#postexcerpt { display:none; }
		.field { margin-bottom:5px; }
		.role-administrator #category-adder h4, .role-administrator #postexcerpt { display:block; } 

	</style>

	Page Views: <?php 
    echo $db_views;
    ?>
	<div class="field">
		<label>SoundCloud Link:</label>
		<input style="padding:5px; width:700px;" autocomplete="off" class="" name="db_soundcloud" type="text" value="<?php 
    echo $db_soundcloud;
    ?>
" />
	</div>
	<div class="field">
		<label>SoundCloud HEX Color (# is required):</label>
		<input style="padding:5px; width:700px;" autocomplete="off" class="" name="db_soundcloud_color" type="text" value="<?php 
    echo $db_soundcloud_color;
    ?>
" />
	</div>
	<div class="field">
		<label>Featured Title (optional.  this will replace the current title for a shorter title):</label>
		<input style="padding:5px; width:700px;" autocomplete="off" class="" name="db_featured_title" type="text" value="<?php 
    echo $db_featured_title;
    ?>
" />
	</div>
	<div class="field">
		<label>SubTitle for Featured Posts. (optional.  this is a subtitle...):</label>
		<input style="padding:5px; width:700px;" autocomplete="off" class="" name="db_subtitle" type="text" value="<?php 
    echo $db_subtitle;
    ?>
" />
	</div>
	<div class="field">
		<label>Premiere Title (optional):</label>
		<input style="padding:5px; width:700px;" autocomplete="off" class="" name="db_premiere_title" type="text" value="<?php 
    echo $db_premiere_title;
    ?>
" />
	</div>
	<div class="field">
		<div style="float:left; margin-top:8px;">
			<label>Video Post:</label>
			<input autocomplete="off" name="db_is_video" type="hidden" value="0">
			<input autocomplete="off" name="db_is_video" type="checkbox" value="1" <?php 
    if ($db_is_video == 1) {
        echo 'checked="checked"';
    }
    ?>
>
		</div>
		<div>
			<label>Video URL (features the video):</label>
			<input style="padding:5px; width:700px;" autocomplete="off" class="" name="db_video_url" type="text" value="<?php 
    echo $db_video_url;
    ?>
" />
		</div>
	</div>
	<div class="field">
		<label for="ads">Ad Size (optional):</label>
		<select name="db_ad_size" style="padding:5px; width:700px;">
			<option value="300x250" <?php 
    if ($db_ad_size == "300x250") {
        echo "selected";
    }
    ?>
>300 x 250 (square)</option>
			<option value="300x600" <?php 
    if ($db_ad_size == "300x600") {
        echo "selected";
    }
    ?>
>300 x 600 (rectangle)</option>
		</select>
	</div>
	<div> views : <?php 
    echo $db_views;
    ?>
</div>
	<?php 
}
コード例 #2
0
ファイル: index.php プロジェクト: Rhenan/intranet-1
foreach ($columns as $c) {
    extract($c);
    if (!db_column_exists($table, $after)) {
        db_column_rename($table, $before, $after);
        echo draw_li($table . '.' . $before . ' was renamed to ' . $after);
    } else {
        echo draw_li($after . ' already existed in ' . $table);
    }
}
echo '</ul>';
//fix column types
echo draw_h3('Fix Column Types');
echo '<ul>';
$tables = db_tables();
foreach ($tables as $t) {
    $columns = db_columns($t);
    //die(draw_array($columns));
    if (!stristr($t, '_to_') && !stristr($t, '_2_') && $t != 'it_system_status' && $t != 'docs_views' && $t != 'ldcodes' && $t != 'queries_executions' && $t != 'web_income_tables_values' && $columns[0]['type'] == 'int' && !$columns[0]['auto']) {
        //set first column to PRIMARY KEY AUTO_INCREMENT
        db_column_key($t, $columns[0]['name']);
        echo draw_li('set ' . $t . '.' . $columns[0]['name'] . ' to primary key auto_increment');
    }
    $replacements = array('bit' => 'tinyint', 'longtext' => 'text', 'longblob' => 'mediumblob');
    foreach ($columns as $c) {
        if (isset($replacements[$c['type']])) {
            db_column_type_set($t, $c['name'], $replacements[$c['type']]);
            echo draw_li('set ' . $t . '.' . $c['name'] . ' from ' . $c['type'] . ' to ' . $replacements[$c['type']]);
        }
    }
}
echo '</ul>';
コード例 #3
0
ファイル: nurunpdf.php プロジェクト: ktla/nuBuilderPro
function nuAddCriteriaValues($hashData)
{
    $T = $GLOBALS['TABLE_ID'];
    $c = db_columns($T);
    $a = array();
    foreach ($hashData as $key => $value) {
        //Changed by SG 1 May 2015
        /*
                if(!in_array($key, $c) and !is_array($value)){
                    $v   = substr(addslashes($value),0,199);
                    $l   = min(strlen($v), 200);
                    if($l > 0){
                        $a[] = " ADD `$key` VARCHAR($l) DEFAULT '$v' ";
                    }
                    $c[] = strtolower($key);
                }
        */
        if (!in_array($key, $c) and !is_array($value) and !is_object($value)) {
            $v = substr(addslashes($value), 0, 199);
            $l = min(strlen($v), 200);
            if ($l > 0) {
                $a[] = " ADD `{$key}` VARCHAR({$l}) DEFAULT '{$v}' ";
            }
            $c[] = strtolower($key);
        }
    }
    if (count($a) > 0) {
        nuRunQuery("ALTER TABLE {$T} " . implode(',', $a));
    }
    return $c;
}
コード例 #4
0
ファイル: nucommon.php プロジェクト: natanoj/nuBuilderPro
function nuNextNumber($t)
{
    $l = db_columns($t);
    //-- 2 columns (Primary Key, varchar(25))
    $u = nuID();
    $s = "INSERT INTO `{$t}` SET `{$l['1']}` = ? ";
    //-- insert to create next number
    $i = nuRunQuery($s, array($u), true);
    $s = "SELECT `{$l['0']}` FROM `{$t}` WHERE `{$l['1']}` = ? ";
    //-- get next number
    $t = nuRunQuery($s, array($u));
    $r = db_fetch_row($t);
    return $r[0];
    //-- return next number
}
コード例 #5
0
ファイル: nuapi.php プロジェクト: ktla/nuBuilderPro
function nuGetLookupValues($f, $o, $recordID, $hashData, $default)
{
    //--get value to lookup eg. customer_id
    if ($default) {
        $fieldValue = $recordID;
    } else {
        if (in_array($o->sob_all_name, db_columns($f->parent_table))) {
            $s = "SELECT `{$o->sob_all_name}` FROM `{$f->parent_table}` WHERE `{$f->parent_primary_key}` = '{$recordID}'";
            $s = nuReplaceHashes($s, $hashData);
            $t = nuRunQuery($s);
            if (nuErrorFound()) {
                return;
            }
            $r = db_fetch_row($t);
            $fieldValue = $r[0];
        } else {
            $fieldValue = '';
        }
    }
    //-- get id of browse form to look in
    $luForm = $o->sob_lookup_zzzsys_form_id;
    $t = nuRunQuery("SELECT * FROM zzzsys_form WHERE `zzzsys_form_id` = '{$luForm}'");
    if (nuErrorFound()) {
        return;
    }
    $r = db_fetch_object($t);
    $r->sfo_custom_code_run_before_browse = nuGetSafePHP('sfo_custom_code_run_before_browse', $r->zzzsys_form_id, $r->sfo_custom_code_run_before_browse);
    $bb = nuReplaceHashes($r->sfo_custom_code_run_before_browse, $hashData);
    eval($bb);
    $SQL = new nuSqlString($r->sfo_sql);
    $s = "\n        SELECT \n            {$o->sob_lookup_id_field}, \n            {$o->sob_lookup_code_field}, \n            {$o->sob_lookup_description_field} \n            {$SQL->from} \n        WHERE {$r->sfo_primary_key} = '{$fieldValue}'\n    ";
    $s = nuReplaceHashes($s, $hashData);
    $t = nuRunQuery($s);
    if (nuErrorFound()) {
        return;
    }
    $r = db_fetch_row($t);
    if ($r[0] == '') {
        $r[0] = '';
        $r[1] = '';
        $r[2] = '';
    }
    return json_encode($r);
}