function name() { set_include_path(get_include_path() . PATH_SEPARATOR . BASEPATH . 'libraries/inc'); $aql = new aql(); $aql->set('basedir', '/etc/asterisk/'); $db = $aql->query("insert into t9.conf set callerid=\"'99' <99>\",section='555'"); echo $aql->errstr; print_r($db); return 'name'; }
function select($aql = null, $clause = null) { if ($aql) { $this->aql = $aql; } if ($clause) { $this->clause = $clause; } //pagination settings $default_limit = if_not($this->clause['default_limit'], 25); if (!$_GET['limit' . $this->i]) { $_GET['limit' . $this->i] = $default_limit; } $this->offset = $_GET['page' . $this->i] * $_GET['limit' . $this->i] - $_GET['limit' . $this->i]; $this->clause['limit'] = $_GET['limit' . $this->i]; $this->clause['offset'] = $this->offset; $this->rs = aql::select($this->aql, $this->clause); $this->first_row = $this->offset + 1; $this->last_row = count($this->rs) + $this->first_row - 1; $c = aql::sql($this->aql, $this->clause); $c = sql($c['sql_count']); $this->total_rows = $c->Fields('count'); $this->num_pages = ceil($this->total_rows / $_GET['limit' . $this->i]); return $this->rs; }
public function construct() { // get the fname and lname of the mod__person_id $r = aql::value("person{fname,lname}", $this->mod__person_id); $this->addProperty('modified_by'); $this->modified_by = $r['fname'] . ' ' . $r['lname']; $this->addProperty('message'); $this->message = $this->getMessage(); }
/** * Makes sure this account only has one app by this name * @param string $val */ public function validate_name($val) { $t = $this->getPrimaryTable(); $n = static::getAccountFieldName(); $acct_id = $this->{$n} ?: ($this->isInsert() ? null : aql::value("{$t}.{$n}", $this->getID())); $clause = array('name' => $val); if ($acct_id) { $clause[$n] = $acct_id; } if (static::count($clause)) { $this->addError('duplicate_app_name'); } }
public function getList($a = array()) { //. category //. seo_field //. website_id //. total_volume //. page //. name //. order_by $where = array(); if (is_array($a['where'])) { foreach ($a['where'] as $w) { $where[] = $w; } } if ($a['category']) { $where[] = "category = '" . addslashes($a['category']) . "'"; } if ($a['seo_field']) { $where[] = "seo_field = '" . addslashes($a['seo_field']) . "'"; } if ($a['website_id']) { $where[] = "website_id = " . $a['website_id']; } if ($a['total_volume']) { $where[] = "total_volume >= " . $a['total_volume']; } if ($a['page']) { $where[] = "page = '" . addslashes($a['page']) . "'"; } if ($a['name']) { $where[] = "name = '" . addslashes($a['name']) . "'"; } if ($a['order_by']) { $order_by = $a['order_by']; } $aql = "dup_phrase_group { }"; $clause = array("dup_phrase_group" => array("where" => $where, "order by" => $order_by)); $rs = aql::select($aql, $clause); $ids = array(); foreach ($rs as $r) { $ids[] = $r['dup_phrase_group_id']; } return $ids; }
public function getList($a = array()) { //. category //. sub_category //. base //. volume //. holiday //. keyword $where = array(); if (is_array($a['where'])) { foreach ($a['where'] as $w) { $where[] = $w; } } if ($a['category']) { $where[] = "category = '" . addslashes($a['category']) . "'"; } if ($a['sub_category']) { $where[] = "sub_category = '" . addslashes($a['sub_category']) . "'"; } if ($a['base']) { $where[] = "base = '" . addslashes($a['base']) . "'"; } if ($a['volume']) { $where[] = "volume = " . $a['volume']; } if ($a['keyword']) { $where[] = "keyword = '" . addslashes($a['keyword']) . "'"; } if ($a['holiday']) { $where[] = "holiday = '" . addslashes($a['holiday']) . "'"; } if ($a['order_by']) { $order_by = $a['order_by']; } $aql = "dup_phrase_data { }"; $clause = array("dup_phrase_data" => array("where" => $where, "order by" => $order_by)); $rs = aql::select($aql, $clause); $ids = array(); foreach ($rs as $r) { $ids[] = $r['dup_phrase_data_id']; } return $ids; }
function configure_perm($sentences = array()) { echo '<div class="has-floats" style="margin-bottom:15px;">'; echo '<div style="float:left; margin-right:10px;"><input type="checkbox" class="perm-box" s_order="'; $x = 0; foreach ($sentences as $sentence_id) { $x++; echo $sentence_id; if ($x != count($sentences)) { echo ","; } } echo '"/></div>'; echo '<div style="float:left;">'; foreach ($sentences as $sentence_id) { $rs = aql::select("dup_sentence_data { sentence where id = " . $sentence_id . " } "); echo $rs[0]['sentence'] . '<br>'; } echo "</div></div>"; }
$title .= '- Title'; $type = "phrase"; break; case 'h1': $type = "phrase"; $title .= '- H1'; break; case 'meta-title': $type = "phrase"; $title .= '- Meta Title'; break; } $p->template('seo', 'top'); $filters = array('category' => 'both', 'market_name' => 'both', 'market' => 'phrase', 'base' => 'phrase', 'volume' => 'phrase', 'page' => 'modifier', 'sub_category' => 'modifier'); $width = 310; $listing = aql::select("dup_phrase_data { id as phrase_id, lower(phrase) as lower_phrase, phrase, volume order by volume DESC, phrase asc }"); $count = count($listing); foreach ($seo_field_array as $header => $arr) { foreach ($arr as $field => $limit) { if ($field == str_replace('-', '_', $_GET['type'])) { $char_count_limit = $limit; } } } $field_array = array('Title', 'H1', 'Meta Title', 'Keywords'); ?> <div style="margin: 15px;"><a href="/admin/seo/duplicate-data/split-paragraph" >Paragraph Splitter</a> | <a href="/admin/seo/duplicate-data/phrases">Phrase Listing</a></div> <h1><?php echo $p->title; ?>
</div> </fieldset> <?php if ($media_item) { $aql = "blog_article{\n\t\t\t\ttitle,\n\t\t\t\tintroduction,\n\t\t\t\tmedia_item_id as article__media_item_id\n\t\t\t}\n\t\t\tblog_media\t{\n\t\t\t\t\t\t\tmedia_item_id as blog_media__media_item_id\n\t\t\t\t\t\t}\n\t\t\tblog_article_tag{\n\t\t\t\tname\n\t\t\t\twhere blog_media.blog_article_id = {$blog_article_id}\n\t\t\t\t\tand blog_media.type = 'mebox'\n\t\t\t\torder by iorder asc\n\t\t\t\tlimit 1\n\t\t\t}"; $rs = aql::select($aql); } $settingss = array("transition" => "fade", "duration" => 4000, "height" => 322, "width" => 640, "height_small" => 62, "width_small" => 90); ?> <fieldset> <legend>Mediabox Preview</legend> <?php if ($rs) { $rs[0]['media_item_id'] = $rs[0]['blog_media__media_item_id'] ? $rs[0]['blog_media__media_item_id'] : $rs[0]['article__media_item_id']; $aql = "blog_media {\n media_item_id\n where blog_media.blog_article_id = {$rs[0]['blog_article_id']}\n and type = 'tnail'\n limit 1\n }"; $thumb = aql::select($aql); $rs[0]['thumb__media_item_id'] = $thumb[0]['media_item_id'] ? $thumb[0]['media_item_id'] : $rs[0]['media_item_id']; blog::marquee($rs, $settingss); } else { echo "No images have been uploaded yet"; } ?> </fieldset> <ul class="contextMenu" id="imageContextMenu"> <li> <a href="#set_article">Add to article</a> </li> <li> <a href="#delete">Delete</a> </li>
<?php $title = 'Codebase Editor'; template::inc('skybox', 'top'); $selected_codebase = $_GET['codebase']; $table = $_GET['table']; $codebase_list = get_codebases(); $codebase_arr = array(); $aql = "dev_codebase\t{\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t}"; $codebase_arr = array(); $rs = aql::select($aql); foreach ($rs as $r) { $codebase_arr[$r['name']] = $r['name']; } foreach ($codebase_list as $codebase) { $codebase_arr[$codebase['codebase']] = $codebase['codebase']; } $param = array('id' => 'codebase_name', 'name' => 'name', 'selected_value' => $selected_codebase); snippet::dropdown($codebase_arr, $param); ?> <br><br> <div> <input type="hidden" id = "table_name" value = "<?php echo $table; ?> " /> <input type="submit" value="Save" onclick = "save_codebase()" /> </div> <?php template::inc('skybox', 'bottom');
<?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'; } }
?> </select> </div> <?php } if (is_array($markets)) { ?> <div class="col"> <?php $aql = "market {\n\t\t\t\t\t\tname\n\t\t\t\t\t\twhere market.name is not null and market.name <>''\n\t\t\t\t\t\tand market.primary = 1 \n\t\t\t\t\t\torder by name asc\n\t\t\t\t\t}"; $dropdown = array('select_name' => 'market_ide', 'value_field' => 'market_ide', 'option_field' => 'name', 'selected_value' => $_GET['market_ide'], 'null_option' => 'All Markets', 'onchange' => 'this.form.submit();'); aql::dd($aql, $dropdown); ?> </div> <?php } //if ?> </div> <br/> <div class="has-floats"> <div class="col"> <?php $aql = "blog_category{\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\torder by iorder\n\t\t\t\t\t\t\t}"; $dropdown = array('select_name' => 'blog_category_ide', 'value_field' => 'blog_category_ide', 'option_field' => 'name', 'selected_value' => $_GET['blog_category_ide'], 'null_option' => 'All Categories', 'onchange' => 'this.form.submit();'); aql::dd($aql, $dropdown); ?> </div> </div> </div> </form>
<?php /* * This is Test demo script for AQL */ error_reporting(E_ALL); require "../inc/aql.php"; $a = new aql(); $setok = $a->set('basedir', './'); if (!$setok) { echo __LINE__ . ' ' . $a->get_error(); } $result = $a->query("insert into t10.conf set type='friend',section='8001',call-limit=1"); $result = $a->query("delete from t10.conf where section = '8001'"); if ($result == false) { echo $a->get_error(); } else { echo 'affected_rows :' . $a->get_affected_rows() . "\n"; }
/** * Gets aql::$errors and adds them to the stack */ protected function addAQLErrors() { foreach (aql::$errors as $e) { $this->addInternalError('aql_class_error', array('message' => $e->getMessage(), 'Exception' => $e)); } aql::$errors = array(); }
} } if ($ct_holiday_id) { $ct_holiday = aql::profile('ct_holiday', $ct_holiday_id); $holiday_name = $ct_holiday['name']; $holiday1 = $ct_holiday['holiday1']; $holiday2 = $ct_holiday['holiday2']; $holiday3 = $ct_holiday['holiday3']; $holiday4 = $ct_holiday['holiday4']; $holiday5 = $ct_holiday['holiday5']; $holiday6 = $ct_holiday['holiday6']; } if ($ct_campaign_id) { $ct_campaign = aql::profile('ct_campaign', $ct_campaign_id); $campaign_name = $ct_campaign['name']; } if ($ct_contract_id) { $ct_contract = aql::profile('ct_contract', $ct_contract_id); $contract_name = $ct_contract['name']; $contract_open_bar_start = $ct_contract['open_bar_start']; $contract_open_bar_end = $ct_contract['open_bar_end']; } $website_name = $p->seo['domain'] = $website->website['domain']; $seo_phone = $website->website['seo_phone']; $seo_year = date('Y'); if ($ct_campaign_id == 1 || $ct_holiday_id == 1) { $seo_year++; } if ($_GET['seo']) { echo $market_id . 'zz'; }
<?php /* * This is Test demo script for AQL */ error_reporting(E_ALL); require "../inc/aql.php"; $a = new aql(); $setok = $a->set('basedir', './'); if (!$setok) { echo __LINE__ . ' ' . $a->get_error(); } // very simple test query $query = <<<EOF select * from t2.conf where section = 9999 EOF; // select * from t2.conf where section != 'general' and section != NULL // select section,host,secret FROM t2.conf where section <= 9995 and section != 'general' and section != null limit 6,1 // select section,host,secret FROM t2.conf where section like '%99%' and section != 'general' and section != null limit 1 $result = $a->query($query); if ($result == false) { echo $a->get_error(); } else { print_r($result); } echo "====================================================================================\n"; # very simple test query $query = "select * from t2.conf where section != 'general' and section != NULL limit 1"; $result = $a->query($query); if ($result == false) { echo $a->get_error();
<?php /* * This is Test demo script for AQL */ error_reporting(E_ALL); require "../inc/aql.php"; $a = new aql(); $setok = $a->set('basedir', './'); if (!$setok) { echo __LINE__ . ' ' . $a->get_error(); } $result = $a->query("insert into t15.conf set callerid=\"\\\"99\\\" <99>\",section='" . time() . "'"); if ($result == false) { echo $a->get_error(); } else { echo 'affected_rows :' . $a->get_affected_rows() . "\n"; }
<hr> <div>host: <pre>skyphp.org</pre></div> <div>db name: <pre>dev_db</pre></div> </div> <div id = "sql" class = 'col'> <h3>SQL:</h3> <textarea cols="100" rows="20" id="sql_statement"></textarea> </div> <?php $code_aql = "sky_codebase {\n\t\t\t\t\tname as codebase\n\t\t\t\t}"; $code_p = array('select_name' => 'codebase', 'value_field' => 'codebase', 'option_field' => 'codebase', 'null_option' => '- codebase -', 'selected_value' => ''); ?> <div id = "options" class = 'col'> <div>Codebase:</div> <div><?php aql::dd($code_aql, $code_p); ?> </div> <div><input name = "execute" type = "button" onclick = "execute()" value = "Execute" id = "execute" /></div> <div id = "output"></div> </div> </div> <div id = "previous-runs"> <?php #require_once('/pages/dev/db-version-control/ajax/previous-runs.php'); ?> </div> <div class = "clear"></div> </div> <?php
<?php $model = 'blog_article'; $blog_article = aql::profile($model, IDE); $primary_table = aql::get_primary_table($model); $blog_article_id = $blog_article['blog_article_id']; $blog_article_ide = $blog_article['blog_article_ide']; $title = $blog_article['title'] ? $blog_article['title'] : 'Write A New Post'; $head_arr[] = "<script src = '/lib/swfupload/swfupload.js' type = 'text/javascript'></script>"; $head_arr[] = "<script src = '/modules/media/upload/handlers.js' type = 'text/javascript'></script>"; $head_arr[] = "<link type='text/css' rel='stylesheet' href='/modules/media/upload/progress.css' />"; template::inc('intranet', 'top'); ?> <div id = "back_to_blogs"><a href = "/admin/blog/post/">« Back to Blog Posts</a></div> <?php //$theme_ab1 = "undo,redo,|,bold,italic,underline,strikethrough,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,fontselect,fontsizeselect,styleselect"; //$theme_ab2 = "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,sub,sup,charmap,|,link,unlink,anchor,image,cleanup,help,|,code,|,removeformat,|,fullscreen,|,preview"; $theme_ab1 = "undo,redo,|,bold,italic,underline,strikethrough,forecolor,backcolor,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect"; $theme_ab2 = "cut,copy,paste,pastetext,pasteword,|,outdent,indent,blockquote,|,sub,sup,charmap,|,link,unlink,image,cleanup,|,code,|,removeformat,|,fullscreen,|,hr"; if (!$css_blog_editor) { $css_blog_editor = '/css/blog.css'; } $options_article = array('resizing' => false, 'full_url' => $blog_img_absolute ? true : false, 'theme' => 'advanced', 'multi_buttons' => true, 'theme_ab1' => $theme_ab1, 'theme_ab2' => $theme_ab2, 'theme_ab3' => "", 'theme_ab4' => "", 'width' => '675', 'height' => '520', 'css' => $css_blog_editor); $theme_ab1_notes = "bold,italic,underline,strikethrough,forecolor,backcolor,hr"; $options_notes = array('resizing' => true, 'theme' => 'advanced', 'multi_buttons' => true, 'theme_ab1' => $theme_ab1_notes, 'theme_ab2' => '', 'theme_ab3' => "", 'theme_ab4' => "", 'height' => '120', 'width' => '257'); $settings = array('article-content' => $options_article, 'note' => $options_notes); helper::tinymce($settings); aql::form($model); template::inc('intranet', 'bottom');
<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
<?php $websites = aql::select("website_group { website_id } website { name as website_name where website_group.name = '{$_POST['website_group_name']}' order by website.name asc }"); if (is_array($websites)) { foreach ($websites as $website) { ?> <div class="website"><?php echo $website['website_name']; ?> </div> <?php $pages = aql::select("website_page { nickname, page_path where website_id = {$website['website_id']} order by nickname asc } "); if (is_array($pages)) { foreach ($pages as $page) { ?> <a class="edit_page" title="<?php echo $page['page_path']; ?> " wg="<?php echo $_POST['website_group_name']; ?> " page_ide="<?php echo $page['website_page_ide']; ?> "> <div class="nickname"><?php echo $page['nickname']; ?> </div> <div class="page_path"><?php echo $page['page_path'];
$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}");
<?php $title = "Blog Listing"; template::inc('intranet', 'top'); ?> <div class = "has-floats"> <div class = "float-right blog_listing"> <div class = "content_listing"> <input type = "button" onclick = "window.location = '/admin/blog/blogs/add-new'" value = "Add new blog"/> <?php $cols = "\t\n\t\t\tname\t\t{label:\tName\t\t;}\n\t\t\tdescription\t{label:\tDescription\t;}\n slug {label: Slug \t\t;}\n status\t\t{label: Status\t\t;}\n\t\t"; if (auth('blog_author:editor')) { $cols .= 'edit {}'; } $clause = array('blog_website' => array('where' => 'blog_website.website_id=' . $website_id)); $param = array('enable_sort' => true); $params = array("aql" => 'blog', 'clause' => $clause, "cols" => $cols, "param" => $param); aql::grid($params); ?> </div> </div> <div class = "left_nav"> <?php include 'pages/admin/blog/left-nav/left-nav.php'; ?> </div> </div> <?php template::inc('intranet', 'bottom');
</select> </div> <?php } ?> <div class="col"> <?php $aql = "blog_category {\n\t\t\t\t\t\tname\n\t\t\t\t\t\torder by name asc\n\t\t\t\t\t}\n\t\t\t\t\tblog_website on blog_category.blog_id = blog_website.blog_id {\n\t\t\t\t\t\twhere website_id = {$website_id}\n\t\t\t\t\t}"; $dropdown = array('select_name' => 'cat_ide', 'value_field' => 'blog_category_ide', 'option_field' => 'name', 'selected_value' => $_GET['cat_ide'], 'null_option' => 'All Categories', 'onchange' => 'this.form.submit();'); aql::dd($aql, $dropdown); ?> </div> <div class="clear"></div> </div> </form> <?php snippet::tabs($tabs); ?> <div id="gridcontent"> <?php aql::grid($aql_blog_title, $col, $param); ?> </div> <?php template::inc('intranet', 'bottom');
<p id="instruction" style="font-size: 2em; font-family: Arial, Helveitca, Sans-serif; color: Blue; margin-bottom: 5px;"> <span style="color: Crimson; font-weight: bold;">Crtl+Click</span> on a field you want to edit... <small style="color:red; font-size:0.9em;">Be careful with those that have HTML content!</small> </p> <?php print_a($aql_data); elapsed('before getting cols'); $column_name = $tablename . "_id"; $sql = "SELECT\n a.table_name\n FROM information_schema.columns a,\n information_schema.columns b,\n information_schema.columns c\n WHERE a.table_name = b.table_name\n and a.table_name = c.table_name\n and b.column_name = 'id'\n and c.column_name = 'active'\n and a.column_name = '{$column_name}'"; $cols = sql_array($sql); if ($cols) { echo '<hr />'; foreach ($cols as $col) { $count = aql::count("{$col['table_name']} { where {$column_name} = '{$id}' }"); if ($count) { ?> <p> <a href="/dev/ide/<?php echo $col['table_name']; ?> /<?php echo $column_name; ?> /<?php echo $id; ?> " class="ide" >
<?php /* * This is Test demo script for AQL */ error_reporting(E_ALL); require "../inc/aql.php"; $a = new aql(); $a->open_config_file('t3.conf'); $a->assign_editkey('general', 'allow[1]', 'g722'); if (!$a->save_config_file('t3.conf')) { echo $a->get_error(); } else { echo "changed sections: \n"; print_r($a->last_save_changed_sections); echo "changed filename: " . $a->last_save_changed_filename . "\n"; }
<div id = "save_bg"> <div id = "save_body"> <?php if (!$person_id) { $person_id = $_SESSION['login']['person_id']; } if (!$blog_article) { $blog_article_ide = $_POST['blog_article_ide']; $blog_article = aql::profile('blog_article', $blog_article_ide); } $status = $blog_article['status']; $trash = $status == 'T' ? 'Untrash' : 'Send to Trash'; $blog_editor = auth('blog_author:editor'); $blog_author = !$blog_editor && auth('blog_author:*') && $blog_article['author__person_id'] == $person_id; if (!$blog_article['blog_article_id'] || $blog_author || $blog_editor) { $save = $status == 'A' ? 'Save' : 'Save Draft'; $approve = $blog_editor ? $status == 'A' ? 'Unpublish' : 'Publish' : ($blog_author ? $status == 'P' || $status == 'A' ? 'Unsubmit' : 'Submit' : 'No permission'); ?> <input type = "hidden" value = "blog_article_status" value = "<?php echo $status; ?> "/> <div> <input type="button" value="<?php echo $save; ?> " onclick="save_post(true,false,false)"> <a id="preview_button" href="/<?php echo $blog_article['blog_slug']; ?>
<?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)); }
aql::update('blog_article', $fields, $blog_article_id); exit('Notification has been sent.'); } else { exit('Error: notification template has not been created or notifacation has already been sent.'); } } else { exit("Error: Enter valid target email address."); } } elseif ($func == 'set_blog_media_title') { $title = $_POST['title']; $type = $_POST['type']; $aql = "blog_media\t{\n\t\t\t\t\t\t\twhere media_item_ide = {$media_item_ide}\n\t\t\t\t\t\t\tand type = '{$type}'\n\t\t\t\t\t\t}"; $rs = aql::select($aql); if ($rs) { $fields = array('title' => $title, 'update_time' => 'now()', 'mod__person_id' => $person_id); aql::update('blog_media', $fields, $rs[0]['blog_media_id']); exit('success'); } else { exit('Error: could not find this media file in database.'); } } else { exit('Error: Unrecognized function.'); } } function email($message_text, $subject, $to, $from) { // message $message = "\n\t<html>\n\t<head>\n\t <title>{$subject}</title>\n\t</head>\n\t<body>\n\t {$message_text}\n\t</body>\n\t</html>"; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
<?php $aql = "sky_sql_log\t{\n\t\t\t\t\t\t\tcodebase,\n\t\t\t\t\t\t\tsql\n\t\t\t\t\t\t}"; $param = array('aql' => $aql, 'cols' => array('codebase', 'sql')); aql::grid($param);