示例#1
0
文件: functions.php 项目: hshoghi/cms
    	</div>
    <?
    */
} elseif ($func == 'iorder') {
    $media_item_ides = explode(',', $_POST['order']);
    foreach ($media_item_ides as $key => $media_item_ide) {
        $fields = array('iorder' => $key);
        aql::update('media_item', $fields, $media_item_ide);
    }
    exit('success');
} elseif ($func == 'save_youtube_video') {
    $blog_article_video_ide = $_POST['blog_article_video_ide'];
    $youtube_url = $_POST['youtube_url'];
    $title = $_POST['title'];
    $fields = array('blog_article_id' => $blog_article_id, 'youtube_url' => $youtube_url, 'title' => $title, 'type' => $type, 'insert_time' => 'now()', 'mod__person_id' => $person_id);
    $rs = aql::insert('blog_article_video', $fields);
    exit('success');
} else {
    if ($func == 'delete_youtube_media') {
        $blog_article_video_ide = $_POST['blog_article_video_ide'];
        $fields = array('active' => 0, 'update_time' => 'now()', 'mod__person_id' => $person_id);
        $rs = aql::update('blog_article_video', $fields, $blog_article_video_ide);
        exit('success');
    } elseif ($func == 'suggest_venue') {
        $string = addslashes(trim($_POST['input']));
        $aql = "venue\t{\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tstate,\n\t\t\t\t\t\tcity\n\t\t\t\t\t\twhere name ilike '%{$string}%'\n\t\t\t\t\t\torder by name asc\n\t\t\t\t\t}";
        $rs = aql::select($aql);
        if ($rs) {
            ?>
		<div class = "suggestions">
<?php 
示例#2
0
文件: add_staff.php 项目: hshoghi/cms
<?php

$blog_author_ide = $_POST['blog_author_ide'];
$blog_author_id = decrypt($blog_author_ide, 'blog_author');
$aql = "\nmarket {\n   name as market_name\n   where market.primary = 1\n   order by name asc\n}";
$markets = aql::select($aql);
$new_market_ids = array();
foreach ($markets as $market) {
    if ($_POST['market_' . $market['market_ide']]) {
        $new_market_ids[] = $market['market_id'];
    }
}
$where = 'market_id not in (' . implode(',', $new_market_ids) . ')';
$aql = "\nblog_author_market{\n   market_id\n   where blog_author_id={$blog_author_id} and active=1\n}";
//'bam' short for 'blog_author_market'
$all_bam = aql::select($aql);
if (is_array($all_bam)) {
    foreach ($all_bam as $bam) {
        if (!in_array($bam['market_id'], $new_market_ids)) {
            aql::update('blog_author_market', array('active' => 0), $bam['blog_author_market_id']);
        } else {
            unset($new_market_ids[array_search($bam['market_id'], $new_market_ids)]);
        }
    }
}
foreach ($new_market_ids as $new_market_id) {
    aql::insert('blog_author_market', array('market_id' => $new_market_id, 'blog_author_id' => $blog_author_id));
}
示例#3
0
<?php

$rs = aql::select("website_page_data { value where website_page_ide = '{$_POST['website_page_ide']}' and field = '{$_POST['field']}' }");
$data = array('value' => $_POST['value'], 'mod__person_id' => PERSON_ID, 'update_time' => 'now()');
if (is_numeric($rs[0]['website_page_data_id'])) {
    $update = aql::update('website_page_data', $data, $rs[0]['website_page_data_ide']);
    if ($update == true) {
        echo 'saved';
    } else {
        echo 'error';
    }
} else {
    $data['website_page_id'] = decrypt($_POST['website_page_ide'], 'website_page');
    $data['field'] = $_POST['field'];
    $insert = aql::insert('website_page_data', $data);
    if (is_numeric($insert['website_page_data_id'])) {
        echo 'saved';
    } else {
        echo 'error';
    }
}
示例#4
0
文件: split.php 项目: hshoghi/cms
	<div class="has-floats" style="margin-top: 20px;">
		<div style="float:left; width: 1000px; margin-right: 10px; font-weight:bold; font-size:18px;">Sentences</div>
    	<div style="float:left; font-weight:bold;">
        	<span style="font-size:18px">Order</span><br>
        	<input type="radio" name="auto-switch" value="man" <?php 
echo $man;
?>
> Manual<br>
        	<input type="radio" name="auto-switch" value="auto"> Auto
        </div>
	</div>
<?php 
$ids = array();
foreach ($sentences[0] as $key => $sentence) {
    $data = array('sentence' => addslashes(str_replace("''", '"', $sentence)), 'name' => $_POST['name'], 'source' => $_POST['source'], 'mod__person_id' => PERSON_ID);
    $insert = aql::insert('dup_sentence_data', $data);
    ?>
	
	<div id="sentence<?php 
    echo $key;
    ?>
-container" class="has-floats" style="margin:10px 0 20px 0;">
    	<div>Sentence <?php 
    echo $key + 1;
    ?>
</div>
		<div style="float:left; margin-right:10px;">
        	<input type="text" dup_sentence_data_id="<?php 
    echo $insert[0]['dup_sentence_data_id'];
    ?>
" id="sentence<?php 
示例#5
0
文件: preview.php 项目: hshoghi/cms
                $blog_article_id = $article_id;
                $blog_tag_id = $tag_session_array_id;
                #search this combination in database
                $aql_article_tag = "blog_article_tag{\n\t\t\t\t\t\t\t\t*\n\t\t\t\t\t\t\t\twhere blog_article_tag.blog_article_id = '{$blog_article_id}' and blog_article_tag.blog_tag_id = '{$blog_tag_id}'\n\t\t\t\t\t\t\t}";
                $rs_article_tag = aql::select($aql_article_tag);
                if (count($rs_article_tag) > 0) {
                    $blog_article_tag_id = $rs_article_tag[0]['blog_article_tag_id'];
                    $table_name = 'blog_article_tag';
                    $data_array = array('active' => 0);
                    aql::update($table_name, $data_array, $blog_article_tag_id);
                }
            }
            foreach ($_SESSION['blog_article']['tags'] as $tag_session_array_id) {
                #inserting each
                $table_name = 'blog_article_tag';
                $data_array = array('blog_article_id' => $article_id, 'blog_tag_id' => $tag_session_array_id);
                $rs = aql::insert($table_name, $data_array);
            }
        }
    }
}
#get the blog name
if (trim($rs_article[0]['blog_id']) != '') {
    $blog_id = trim($rs_article[0]['blog_id']);
    $aql_blog = "blog {\n\t\t\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t\t\t\t\twhere blog.id  ='{$blog_id}'\n\t\t\t\t\t\t\t\t\t\t\t}";
    $rs_blog = aql::select($aql_blog);
    $blog_name = $rs_blog[0]['slug'];
}
//getting the article ide
$article_ide = $rs_article[0]['blog_article_ide'];
header("location:/{$blog_name}/{$article_ide}");
示例#6
0
<?php

global $seo_field_array;
$website_id = aql::value("website_page.website_id", $_POST['website_page_id']);
if ($_POST['val'] == 1) {
    $data = array('website_id' => $website_id, 'website_page_id' => $_POST['website_page_id'], 'on_website' => 1, 'uri' => $_POST['uri']);
    foreach ($seo_field_array as $type => $arr) {
        foreach ($arr as $field => $max) {
            $data['field'] = $field;
            $rs = aql::select("website_uri_data { id as uri_id where website_id = " . $website_id . " and uri = '" . $data['uri'] . "' and field='" . $field . "' }");
            if (!is_numeric($rs[0]['uri_id'])) {
                $data['field'] = $field;
                aql::insert('website_uri_data', $data);
            }
        }
    }
    aql::update('website_page', array('url_specific' => $_POST['val']), $_POST['website_page_id']);
    //sql("update website_uri_data set on_website = 1 where uri = '".$_POST['uri']."' and website_id = ".$website_id);
    $aql = "website_uri_data { where uri = '" . $_POST['uri'] . "' and website_id = " . $website_id . "}";
    $rs = aql::select($aql);
    if ($rs) {
        foreach ($rs as $r) {
            $website_uri_data = array('on_website' => '1');
            $rs = aql::update('website_uri_data', $website_uri_data, $r['website_uri_data_id']);
        }
    }
    ?>
		<input type="hidden" id="uri_enabled" value="<?php 
    echo $_POST['uri'];
    ?>
" />
 /**
  * aql::insert/update on the save array depending on what needs to be done
  * recursive because of sub objects / queries
  * @param   array   $save_array     array to save
  * @param   array   $ids            ids to pass through
  * @return  array                   updated save array
  */
 private final function saveArray($save_array, $ids = array())
 {
     $is_dev = $this->isDev();
     // copy out objects
     $objects = $save_array['__objects__'];
     unset($save_array['__objects__']);
     // helper function
     $addRecordInfo = function ($table_block, $is_update = false) {
         $fields = array('update' => array('mod__person_id', 'update__person_id'), 'insert' => array('insert__person_id'));
         $key = $is_update ? 'update' : 'insert';
         $time_field = $key . '_time';
         if (!$table_block['fields'][$time_field]) {
             $table_block['fields'][$time_field] = aql::now();
         }
         if (!defined('PERSON_ID') || !is_numeric(PERSON_ID)) {
             return $table_block;
         }
         $id = PERSON_ID;
         $fields = $fields[$key];
         foreach ($fields as $field) {
             $table_block['fields'][$field] = $table_block['fields'][$field] ?: $id;
         }
         return $table_block;
     };
     foreach ($save_array as $table => $info) {
         // make sure this is an array
         $info['fields'] = arrayify($info['fields']);
         foreach ($ids as $n => $v) {
             if (is_array($this->_ignore['fields']) && in_array($n, $this->_ignore['fields'])) {
                 // since ids are added to each table in case of foreign keys
                 // abort if they are being ignored in this model
                 continue;
             }
             // add the id to the table block iff there are already fields
             if ($info['fields'] && !$info['fields'][$n]) {
                 $save_array[$table]['fields'][$n] = $v;
                 $info['fields'][$n] = $v;
             }
         }
         if ($info['fields']) {
             $is_update = $info['id'] && is_numeric($info['id']);
             $info = $addRecordInfo($info, $is_update);
             if ($is_update) {
                 aql::update($table, $info['fields'], $info['id'], true);
             } else {
                 $rs = aql::insert($table, $info['fields'], true);
                 $save_array[$table]['id'] = $info['id'] = $rs[0][$table . '_id'];
             }
         }
         $ids[$table . '_id'] = $info['id'];
         if (is_array($info['subs'])) {
             foreach ($info['subs'] as $i => $sub) {
                 $save_array[$table]['subs'][$i] = $this->saveArray($sub, $ids);
             }
         }
     }
     if (is_array($objects)) {
         foreach ($objects as $o) {
             if (!$o['data']) {
                 continue;
             }
             $tmp = Model::get($o['object']);
             $tmp->_data = $o['data'];
             $tmp->loadIDs($ids);
             $pt = $tmp->getPrimaryTable();
             $pt_id = $pt . '_id';
             if (!$tmp->{$pt_id} && $this->{$pt_id}) {
                 $tmp->{$pt_id} = $this->{$pt_id};
             }
             $tmp->save(true);
             if ($tmp->_errors) {
                 $this->addErrors($tmp->_errors);
                 $this->failTransaction();
             }
         }
     }
     $save_array['objects'] = $objects;
     return $save_array;
 }
function tinyurl($url)
{
    global $cookie_domain, $tiny_domain;
    if ($tiny_domain) {
        $domain = $tiny_domain;
    } else {
        if (substr($cookie_domain, 0, 1) == '.') {
            $domain = substr($cookie_domain, 1);
        } else {
            $domain = $cookie_domain;
        }
    }
    $aql = "url {\n                    tinyid\n\t\t\t\t\twhere url = '{$url}'\n\t\t\t\t}";
    $rs = aql::select($aql);
    $tinyid = $rs[0]['tinyid'];
    if (!$rs) {
        $arr = array('url' => $url);
        $rs = aql::insert('url', $arr);
        $tinyid = NULL;
    }
    //if
    $url_id = $rs[0]['url_id'];
    if (!$tinyid) {
        $tinyid = my_base_convert($url_id, 10, 62);
        aql::update('url', array('tinyid' => $tinyid), $url_id);
    }
    return 'http://' . $domain . '/' . $tinyid;
}
示例#9
0
文件: functions.php 项目: hshoghi/cms
<?php

if ($_POST['sql']) {
    if ($_POST['codebase']) {
        $codebase = $_POST['codebase'];
        $sql = $_POST['sql'];
        #$dbw->Execute($sql) or die("$sql<br>" . $dbw->ErrorMsg());
        $mod__person_id = $_SESSION['login']['member_id'];
        $fields = array('codebase' => $codebase, 'mod__person_id' => $mod__person_id, 'version' => 'trunk', 'sql' => $sql);
        aql::insert('sky_sql_log', $fields);
        exit('success');
    } else {
        exit('Enter codebase');
    }
}
示例#10
0
<?php

if (!$_POST['list']) {
    exit('Please Select a Paragraph');
} else {
    foreach ($_POST['list'] as $list) {
        $data = array('sentence_order' => $list, 'mod__person_id' => PERSON_ID);
        aql::insert("dup_sentence_group", $data);
        $num++;
    }
    exit('Saved');
}
示例#11
0
    $total_volume[] = $volume + $vol2[$key];
}
// CHECK THE DB AND ENTER NON-DUPS
foreach ($final as $key => $phrase) {
    $split = explode(',', $phrase);
    if ($split[2]) {
        $mod_where = "and dup_modifier_id = " . $split[2];
    } else {
        $mod_where = "";
    }
    $rs = aql::select("\n\t\t\tdup_phrase_group { \n\t\t\t\twhere phrase1__dup_phrase_data_id = " . $split[0] . "\n\t\t\t\tand phrase2__dup_phrase_data_id = " . $split[1] . "\n\t\t\t\t{$mod_where}\n\t\t\t}\n\t\t");
    if ($rs || $split[0] == $split[1]) {
        $exists[$key] = true;
    } else {
        $data = array('name' => $_POST['group_name'], 'seo_field' => $_POST['seo_field'], 'phrase1__dup_phrase_data_id' => $split[0], 'phrase2__dup_phrase_data_id' => $split[1], 'dup_modifier_id' => $split[2], 'mod__person_id' => PERSON_ID, 'total_volume' => $total_volume[$key], 'category' => $_POST['category'], 'market_name' => $_POST['market_name'], 'page' => $_POST['page']);
        aql::insert('dup_phrase_group', $data);
    }
}
// SHOW THE POSTED STUFF
if ($_POST['phrase1']) {
    foreach ($_POST['phrase1'] as $p1) {
        if ($_POST['phrase2']) {
            foreach ($_POST['phrase2'] as $p2) {
                $phrases[] = $p1 . ',' . $p2;
            }
        }
    }
}
if ($_POST['mods']) {
    foreach ($phrases as $phrase) {
        foreach ($_POST['mods'] as $mod) {
示例#12
0
<?php

$data = array('name' => $_POST['website_name'], 'type' => 'skymedia', 'domain' => $_SERVER['SERVER_NAME'], 'mod__person_id' => PERSON_ID);
$insert = aql::insert('website', $data);
if (is_array($insert)) {
    ?>
		Website Added Successfully!
        <br><br>
        <button onClick="location.reload()">Close</button>

<?php 
}