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 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>"; }
" value="<?php echo $page['page_type']; ?> " /><span style="font-size: 10px; color: rgb(0, 102, 0); margin-left: 4px; display: inline; " id="saved_1"></span></td> <td>page_path = <?php echo $page['page_path']; ?> </td> </tr> </table> <?php // Insert the blank field records in the db for website_page fields that don't already exist $y = 2; foreach ($seo_field_array as $type => $field_array) { foreach ($field_array as $field => $max) { $rs2 = aql::select("website_page_data { id where field = '{$field}' and website_page_id = {$page['website_page_id']} }"); if (!$rs2) { $data = array('field' => $field, 'website_id' => $website_id, 'website_page_id' => $page['website_page_id'], 'mod__person_id' => PERSON_ID); aql::insert('website_page_data', $data); } } if (!isset($header)) { ?> <fieldset style="width:872px; background:#f3f3f3; margin-bottom:4px; border: 1px solid #ccc; padding:5px;"> <legend style="border: 1px solid #ccc; background:#ffffff; font-weight:bold; padding:2px 5px 2px 5px;"><?php echo strtoupper(str_replace('_', ' ', $type)); ?> </legend> <?php $header = $type; } else {
<?php $SQL = "select id from market limit 1"; $r = $db->Execute($SQL); if (!$db->ErrorMsg()) { ?> <!-- Section for Market Start --> <h2 class="module-bar">Market</h2> <div class="module-body"> <div class="module-container"> <p> <?php #fetching all the market value $aql_market = "market {\n * \n where market.primary = 1 \n\t\t\t\t\t\torder by market.name asc\n }"; $rs_market = aql::select($aql_market); ?> <select name="market_id"> <?php $selected = $rs_article[0]['market_id'] == "" ? "selected" : ""; ?> <option value="NULL" <?php echo $selected; ?> >National</option> <?php foreach ($rs_market as $market) { $selected = $market['market_id'] == $rs_article[0]['market_id'] ? "selected" : ""; ?> <option value="<?php echo $market['market_id'];
function getUpcomingHolidays($date = NULL) { if (!$date) { $date = time(); } $year = date('Y'); $rs = aql::select("ct_holiday { slug, date where date is not null order by date_order asc }"); foreach ($rs as $r) { if (strtotime($r['date'] . '/' . $year) > $date) { $this_years_holidays[$r['slug']] = strtotime($r['date'] . '/' . $year); } else { $next_years_holidays[$r['slug']] = strtotime($r['date'] . '/' . ($year + 1)); } } return array_merge($this_years_holidays, $next_years_holidays); }
<?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'; } }
</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>
/** * auth class * * Organization: Hotwire Communications * Author: Harley Fischel */ public static function permission($params = null, $person_id = null) { $params = trim($params); if (empty($params)) { return false; } if (empty($person_id) && isset($_SESSION['login']['person_id'])) { $person_id = $_SESSION['login']['person_id']; } // old method support if (!strpos($params, ':')) { $arr = explode(',', $params); foreach ($arr as $arg) { if (strpos(strtolower($_SESSION['login']['access_group']), strtolower($arg)) !== false) { return true; } } return false; } static $access, $key; // new method $perms = explode(';', $params); foreach ($perms as $perm) { list($group, $granted) = explode(':', $perm); if (empty($group)) { return false; } if (empty($key[$group])) { $key[$group] = md5($group . $person_id); } if (empty($access[$key[$group]]) && !empty($person_id)) { $rs = aql::select(" {$group} { id, access_group } ", array('where' => array(0 => ($group != 'person' ? 'person_' : '') . 'id=' . $person_id), 'limit' => 1)); $access[$key[$group]] = array_map(function ($str) { return md5(trim(strtolower($str))); }, explode(',', $rs[0]['access_group'])); // un-comment to see access array // echo "<pre>md5:\n".print_r($access,true)."</pre>"; } if ($granted == '*') { return true; } if (is_array($access[$key[$group]])) { if (in_array(md5($granted), $access[$key[$group]])) { return true; } } } return false; }
<div class="col"> <?php $aql = "blog {\n\t\t\t\t\t \tid,\n\t\t\t\t\t\tname\n\t\t\t\t\t}\n\t\t\t\t\tblog_website {\n\t\t\t\t\t\twhere website_id = {$website_id}\n\t\t\t\t\t}"; $dropdown = array('select_name' => 'blog_id', 'value_field' => 'blog_id', 'option_field' => 'name', 'selected_value' => $_GET['blog_id'], 'null_option' => 'All Blogs', 'onchange' => 'this.form.submit();'); aql::dd($aql, $dropdown); ?> </div> <?php if (auth('admin', 'developer', 'blog_editor')) { ?> <div class="col"> <?php $aql = "blog_author {\n\t\t\t\t\t\tperson_id\n\t\t\t\t\t\twhere website_id = {$website_id}\n\t\t\t\t\t}\n\t\t\t\t\tperson {\n\t\t\t\t\t\tfname,\n\t\t\t\t\t\tlname\n\t\t\t\t\t\torder by lname asc\n\t\t\t\t\t}"; $rs_author = aql::select($aql); ?> <select name="author_ide" onchange="this.form.submit();"> <option value="">All Contributors</option> <?php if ($rs_author) { foreach ($rs_author as $author) { ?> <option value="<?php echo $author['person_ide']; ?> " <?php echo $author['person_ide'] == $_GET['author_ide'] ? 'selected="selected"' : ''; ?> >
/** * Executes the actual select query based on sql_array and settings, * It will execute recursively based on the given array * depending on if there are "subs" or objects and their respective sql_arrays and aql * * @see self::sql() * @param array $arr generated sql array * - sql * - sql_list * - sql_count * - subs * - objects * @param array $settings * - object (bool) * - aql_statement (string) * - select_type (string) default is 'sql' * @param db $db_conn * @return array * @throws \Sky\AQL\ConnectionException if no db * @throws \Sky\AQL\SelectException if db select fails */ private static function sql_result($arr, $settings, $db_conn = null) { if (!$db_conn) { $db_conn = self::getDB(); } if (self::in_transaction()) { $db_conn = self::getMasterDB(); $silent = true; } if (!$db_conn) { throw new \Sky\AQL\ConnectionException('Cannot Execute AQL without a db connection'); } $object = $settings['object']; $aql_statement = $settings['aql_statement']; $sub_do_set = $settings['sub_do_set']; $select_type = $settings['select_type'] ?: 'sql'; $rs = array(); $microtime_start = microtime(true); $r = $db_conn->Execute($arr[$select_type]); if (class_exists('hwc_debug')) { hwc_debug::add_aql($arr[$select_type], number_format(microtime(true) - $microtime_start, 3)); } if ($r === false) { $e = new \Sky\AQL\SelectException($aql_statement, $arr[$select_type], $db_conn->ErrorMsg()); if (!$silent) { throw $e; } else { aql::$errors[] = $e; } return $rs; } while (!$r->EOF) { $tmp = self::generate_ides($r->GetRowAssoc(false)); $placeholder = null; $get_placeholder = function ($m) use($tmp, &$placeholder) { return $placeholder = $tmp[$m[1]]; }; $replace_placeholder = function ($clause) use($get_placeholder) { return preg_replace_callback('/\\{\\$([\\w.]+)\\}/', $get_placeholder, $clause); }; if ($arr['subs']) { foreach ($arr['subs'] as $k => $s) { $s['sql'] = $replace_placeholder($s['sql']); if ($placeholder) { $params = array('object' => $object); $tmp[$k] = self::sql_result($s, $params, $db_conn); } } } $placeholder = ''; if ($arr['objects']) { foreach ($arr['objects'] as $k => $s) { $m = $s['model']; if ($s['plural'] && $s['sub_where']) { $clauses = self::get_clauses_from_model($m); $min_aql = self::get_min_aql_from_model($m); $clauses['where'][] = $replace_placeholder($s['sub_where']); $query = aql::select($min_aql, $clauses, null, null, $sub_do_set, $db_conn); if ($query) { // new getRecords method $ca = $s['constructor argument']; $p = new $m(); $arr = array('ids' => array_map(function ($a) use($ca) { return $a[$ca]; }, $query)); foreach ($p->getRecords($arr) as $row) { $tmp[$k][]['_data'] = $row; } // old query loop method /* foreach ($query as $row) { $arg = $row[$s['constructor argument']]; $o = Model::get($m, $arg, $sub_do_set); $tmp[$k][] = ($object) ? $o : $o->dataToArray(); }*/ } } else { if (!$s['plural']) { $arg = (int) $tmp[$s['constructor argument']]; if ($arg) { $o = Model::get($m, $arg, $sub_do_set); $tmp[$k] = $object ? $o : $o->dataToArray(); } } } } } if ($object && $aql_statement) { $tmp_model = $object === true ? new Model(null, $aql_statement) : Model::get($object); $tmp_model->loadArray($tmp); $tmp_model->_token = $tmp_model->getToken(); $tmp = $tmp_model; } $rs[] = $tmp; $r->moveNext(); } return $rs; }
<?php $rs = aql::select("website_uri_data { value where website_id = {$_POST['website_id']} and uri = '{$_POST['uri']}' and field = '{$_POST['field']}' }"); if ($rs) { aql::update("website_uri_data", array('on_website' => $_POST['url_specific']), $rs[0]['website_uri_data_id']); } if (!$_POST['url_specific']) { $rs = aql::select("website_page_data { value where field = '{$_POST['field']}' and website_page_id = {$_POST['website_page_id']} }"); } exit($rs[0]['value']);
<?php $type = "mp3"; $blog_article_ide = IDE ? IDE : $_POST['blog_article_ide']; $blog_article_id = $blog_article_id ? $blog_article_id : decrypt($blog_article_ide, 'blog_article'); $vfolder_path = '/blog/blog_article/' . $blog_article_id . '/mp3'; $media_upload['vfolder_path'] = $vfolder_path; #$vfolder = media::get_vfolder($media_upload['vfolder_path']); $aql = "blog_media{\t\n\t\t\t\t\tmedia_item_id as id,\n\t\t\t\t\ttitle\n\t\t\t\t\twhere type='mp3'\n\t\t\t\t\tand blog_article_id = {$blog_article_id}\n\t\t\t\t\torder by title asc\n\t\t\t\t}"; $vfolder['items'] = aql::select($aql); ?> <div class = "float-left youtube_upload"> <h2>A) Youtube</h2> <input type = "button" value = "Add YouTube Song" onclick = "new_youtube_media('<?php echo $type; ?> ')" /> </div> <div class = "has-floats" id = "images"> <h2>B) MP3 Upload</h2> <input type = "hidden" name = "vfolder_path" id = "vfolder_path" value = "<?php echo $vfolder_path; ?> "/> <input type = "hidden" name = "session_id" id = "session_id" value = "<?php echo session_id(); ?> "/> <?php
?> </h2> <br> This Website Cannot Be Optimized Until it is Set Up in the System <br><br> Would You Like to Set it Up Now? <button id="set-up-website">Yes</button> <button id="close">No</button> <?php // The website exists... move forward to the check if website_page record is entered } else { $aql = "website_page { url_specific, page_type, page_path, nickname where page_path = '" . addslashes($_POST['page_path']) . "' and website_id = {$website_id} }"; $rs = aql::select($aql); $page = $rs[0]; if ($page['website_page_id']) { if ($page['url_specific']) { $rs_uri = aql::select("website_uri_data { where website_id = " . $website_id . " and uri = '" . $uri . "' and on_website = 1 }"); if ($rs_uri) { $url_specific_flag = true; } else { $url_specific_flag = false; } } // We have a website_page_record so load the form ?> <div style="margin-bottom:10px;"> <input type="checkbox" id="url_specific" website_id="<?php echo $website_id; ?> " website_page_id="<?php echo $page['website_page_id']; ?>
</div> <div class="field float-left"> <?php $field = "website_id"; ?> <label class="label" for="<?php echo $field; ?> ">Website</label><br> <select name="<?php echo $field; ?> " style="width:200px;"> <option value="">- Website -</option> <?php $rs = aql::select("website { name order by name }"); foreach ($rs as $r) { ?> <option value="<?php echo $r['website_id']; ?> " <?php echo $r['website_id'] == $o['website_id'] ? 'selected' : ''; ?> ><?php echo $r['name']; ?> </option> <?php }
/** * Uses required fields to fetch the identifier of the object if it is not set * Should generally be used in postValidate() for a uniqueness constraint on the * required fields * This sets $this->{primary_table_id} * * @return Model $this */ public function getIDByRequiredFields() { # if there are errors | have ID | no required fields return if ($this->_errors || $this->getID() || !$this->hasRequiredFields()) { return $this; } # set up $where = array(); $clause = array('limit' => 1, 'where' => &$where); $aql = sprintf('%s { }', $this->getPrimaryTable()); $key = $this->getPrimaryTable() . '_id'; # make where foreach ($this->getRequiredFields() as $f) { $where[] = sprintf("%s = '%s'", $f, $this->{$f}); } $rs = aql::select($aql, $clause); $this->{$key} = $rs[0][$key] ?: $this->{$key}; $this->_token = $this->_token ?: $this->getToken(); return $this; }
public function checkLogin() { global $access_groups, $access_denied, $rs_logins; if ($this->login_path) { $this->checkLoginPath(); } if (!$this->post_password) { $this->_errors[] = 'You need to enter a password.'; } if (!$this->post_username) { $this->_errors[] = 'You need to enter a username or email address'; } if ($this->_errors) { return $this->r(); } $username = trim(strtolower($this->post_username)); $aql = "\n\t\t\t\t\tperson {\n\t\t\t\t\t\twhere (\n\t\t\t\t\t\t\tlower(email_address) like '{$username}' or lower(username) like '{$username}'\n\t\t\t\t\t\t\tand password_hash is not null\n\t\t\t\t\t\t)\n\t\t\t\t\t\torder by id desc\n\t\t\t\t\t}\n\t\t\t\t"; $rs_logins = aql::select($aql); if ($this->post_password) { $granted = false; foreach ($rs_logins as $p) { $this->person = new person($p['person_id'], null, true); if (!$this->person->person_id) { continue; } if ($this->_checkLogin($this->post_password)) { if (auth_person($access_groups, $this->person->person_id) || !$access_groups) { $access_denied = false; return $this->r(array('person_ide' => $this->person->person_ide)); } } } } $this->_errors[] = 'Invalid Login'; return $this->r(); }
$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}");
</tr> <?php } ?> </table> </fieldset> <fieldset><legend>Assignments</legend> <a href='javascript:toggle_inactive();' id='toggle_inactive'>Show Inactive</a> <?php $aql = "blog_author{\n where person_id={$blog_author['person_id']}\n order by status!='A'\n }"; $blog_authors_rs = aql::select($aql); foreach ($blog_authors_rs as $form_id => $blog_author_rs) { $blog_author = aql::profile('blog_author', $blog_author_rs['blog_author_ide']); ?> <fieldset id='blog_author_fieldset_<?php echo $form_id; ?> ' class='blog_author_<?php echo $blog_author['status'] != 'A' ? 'inactive' : 'active'; ?> '><?php // include( 'aql/models/blog_author/blog_author_form.php' ); aql::form('blog_author'); ?> <input class='blog_author_form_save_button' type="button" value="Save" onclick="save_button(true,'blog_author_form_<?php echo $form_id;
<?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)); }
$p->template('intranet', 'top'); $link = function ($table, $id) { return sprintf('/dev/ide/%s/%s', $table, $id); }; include 'pages/dev/dev-nav.php'; ?> <div id="idePage"> <?php if ($this->ide) { if ($this->queryfolders[0] && $this->queryfolders[1] && $this->queryfolders[2]) { list($tablename, $fieldname, $value) = $this->queryfolders; $value = is_numeric($value) ? $value : "'{$value}'"; $aql = "\n {$tablename} {\n id\n where {$fieldname} = {$value}\n ORDER BY id ASC\n }\n "; $records = aql::select($aql); if ($records) { if (count($records) == 1) { header("Location: {$link($tablename, $records[0]['id'])}"); } foreach ($records as $r) { ?> <p> <a href="<?php echo $link($tablename, $r['id']); ?> " style="color:blue" > ID: <?php echo $r['id'];
<?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'];
$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; ?>
<?php $rs = aql::select("website_page_data { draft, value where id = {$_POST['website_page_data_id']} }"); if ($_POST['type'] == 'draft') { $value = $rs[0]['draft']; } else { $value = $rs[0]['value']; } ?> <input type="text" class="input" value="<?php echo $value; ?> " field="<?php echo $_POST['field']; ?> " field_type="<?php echo $_POST['type']; ?> " wpd_id="<?php echo $_POST['website_page_data_id']; ?> " />
<?php $blog_id = trim($_REQUEST['blog_id']); #sorting variable $sort_by = $_REQUEST['sort_by']; $sort_type = $_REQUEST['sort_type']; $order_by = $sort_by . " " . $sort_type; $condition = ""; if ($blog_id != "") { $condition = " where blog.id ='" . $blog_id . "'"; } echo $aql_blog_title = "blog {\n name\n }\n blog_article {\n title \n }"; $rs_blog = aql::select($aql_blog_title); //print_a($rs_blog); // step 2. specify which columns to add to the grid $cols = "id {}\n\t\t\t\tname {\n label: Blog;\n }\n\t\t\ttitle {\n\t\t\tlabel: Article;\n\t\t}\n\t\t\t\n\t\t\t"; // step 3. display the data grid on the page $param = array('table_class' => ''); grid::render($aql_blog_title, $col, $param);
<div id="seo_fields"> <?php $opt_phrase = aql::value("website_page.opt_phrase", $page['website_page_ide']); ?> <div class="seo_field"> <fieldset> <legend class="legend">Opt Phrase</legend> <h3><?php echo $opt_phrase ? $opt_phrase : 'Not Set'; ?> </h3> </fieldset> </div> <?php foreach ($seo_field_array['html'] as $field => $max) { $rs = aql::select("website_page_data { draft, value where field = '{$field}' and website_page_ide = '{$page['website_page_ide']}' }"); ?> <div class="seo_field"> <fieldset> <legend class="legend"><?php echo ucwords(str_replace('_', ' ', $field)); ?> </legend> <div class="draft"> <div>Draft <span class="field_result" id="draft_result_<?php echo $field; ?> _<?php echo $page['website_page_ide']; ?> "></span></div>
<?php $where = array(); if ($_POST['page']) { $where[] = "( page = '{$_POST['page']}' OR page = 'general' )"; } if ($_POST['sub_category']) { $where[] = "sub_category = '{$_POST['sub_category']}'"; } $mods = aql::select("dup_modifier { id as mod_id, lower(phrase) as lower_phrase, phrase order by sub_category, phrase }", array('dup_modifier' => array('where' => $where))); if ($mods) { foreach ($mods as $data) { ?> <div><input type="checkbox" id="mod_<?php echo $data['mod_id']; ?> " phrase="<?php echo $data['phrase']; ?> " mod_id="<?php echo $data['mod_id']; ?> " class="mod-cb" id="<?php echo $data['lower_phrase']; ?> " /> <label for="mod_<?php echo $data['mod_id']; ?> ">{<?php echo $data['mod_id']; ?>
email($message, $subject, $to, $from); // update blog_article $fields = array('notification_sent' => 'now()'); 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>";
$_SESSION['blog_article']['tags'][] = $rs_tag[0]['blog_tag_id']; } } else { /* IT A NEW ENTRY IN DATA BASE */ $table_name = 'blog_tag'; $data_array = array('name' => $name); $rs = aql::insert($table_name, $data_array); $_SESSION['blog_article']['tags'][] = $rs[0]['id']; } } } #showing the tag if (count($_SESSION['blog_article']['tags'])) { foreach ($_SESSION['blog_article']['tags'] as $tag_session_array_id) { $aql_tag = "blog_tag {\n\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\twhere blog_tag.id ='{$tag_session_array_id}'\t\t\t\t\t\t \n\t\t\t\t\t\t}"; $rs_tag = aql::select($aql_tag); foreach ($rs_tag as $tag_info) { ?> <NOBR> <img src="/images/cross_black.jpg" alt="Click here to delete the Tag" title ="Click here to delete the Tag" onmouseover="this.src='/images/cross_red.jpg'" onmouseout="this.src='/images/cross_black.jpg'" onclick="deletetag(<?php echo $tag_info['blog_tag_id']; ?> )" style="vertical-align:middle;"/> <span style="vertical-align:middle;"><?php echo $tag_info['name'];