function faq() { global $LANG; $sql = "select * from " . $this->tabela; $sql .= " where faq_seccao = '" . $this->faq_seccao . "' "; $sql .= " and faq_idioma = '" . $LANG . "' "; $sql .= " and faq_ativo = 1"; $sql .= " order by faq_idioma, faq_ordem "; $rlt = db_query($sql); $sx = ''; $per = 0; while ($line = db_read($rlt)) { $per++; $sx .= '<BR>' . $per . ' <B>'; $sx .= '<A TAG="#fq' . $line['id_faq'] . '"></A>'; $sx .= '<A HREF="#fq' . $line['id_faq'] . '" style="lt2" onclick="mostra_answer(' . $line['id_faq'] . ');">'; $sx .= trim($line['faq_pergunta']); $sx .= '</A>'; $sx .= '</B>'; $sx .= '<div id="faq' . $line['id_faq'] . '" style="display: none;" >' . chr(13); $sx .= mst(trim($line['faq_resposta'])) . chr(13); $sx .= '</div>' . chr(13); } $sx .= '<script>' . chr(13); $sx .= 'function mostra_answer(id) {' . chr(13); $sx .= " var local = '#faq'+id; " . chr(13); $sx .= ' var tela01 = $(local).toggle("slow"); ' . chr(13); $sx .= '}' . chr(13); $sx .= '</script>' . chr(13); return $sx; }
function index($url = false) { $page = false; $this->load->module('microsite'); if (!$this->microsite->index($url)) { $lang = $this->session->userdata('lang'); session_write_close(); $id = $this->input->get('id'); if ($id) { $page = db_read('page', array('id' => $id)); } else { if ($url) { $page = db_read('page', array('url' => $url)); } else { $page = db_read('page', array('main' => 1)); } } if (!$page) { show_404(); exit; } $view['page'] = $page; $view['lang'] = $lang ? $lang : ''; $this->load->view(tpldir('page/' . $page->template), $view); } }
function edit($id = false) { if (empty($_POST)) { $category = db_read('category'); if (!$category) { redirect(base_url('admin/category/add')); } if (!$id) { $id = $category->id; } $view['blogs'] = db_reads('page', array('type' => 'blog', 'catid' => $id)); $view['categories'] = db_reads('category', array('type' => 'blog')); $view['category'] = db_read('category', array('id' => $id, 'type' => 'blog')); $this->load->view(tpldir('admin/category/edit_view'), $view); } else { $result = jsonSrc(); $id = $this->input->post('id'); $updatecat['name'] = $this->input->post('name'); db_update('category', array('id' => $id), $updatecat); $result['resultCode'] = 1000; $result['resultMsg'] = "Success!!"; $result['resultData']['openUrl'] = base_url('admin/category/edit/' . $id); echo json_encode($result); } }
function install_sql() { global $base_name; /* Verificar se existe tabela */ $sql = "SELECT table_name FROM information_schema.tables \n\t\t\t\t\t\tWHERE table_name = 'apoio_titulacao'\n\t\t\t\t\t\t\t\tand table_schema = '{$base_name}' "; $rlt = db_query($sql); /* Consulta */ if ($line = db_read($rlt)) { /* Tabelas já instaladas */ echo 'Database already exist.'; } else { $file_sql = "../proethos.sql"; /* Le arquivo com estrutura do banco */ $flt = fopen($file_sql, "r"); $sql = ""; while (!feof($flt)) { $sql .= fread($flt, 1024); } fclose($flt); $ln = splitx(';', $sql . ';'); /* Executa criacao das tabelas */ for ($r = 0; $r < count($ln); $r++) { echo '<BR>' . substr($ln[$r], 0, strpos('(', $ln[$r])); $sql = trim($ln[$r]); if (strlen($sql) > 10) { $rlt = db_query($sql); } } echo '<BR>Database install!!'; } }
function edit($id = false) { if (empty($_POST)) { $menu = db_read('menu_item', array('id' => $id)); if (!$menu) { $menu = db_read('menu_item'); } if (!$menu) { redirect('admin/menu/add'); } $this->load->module('mod_page'); $view['page'] = false; $pageResult = $this->mod_page->gets(); if ($pageResult['resultCode'] == 1000) { $view['page'] = $pageResult['resultData']['page']; } $view['menu'] = $menu; $this->load->view(tpldir('admin/menu/edit_view'), $view); } else { $result = jsonSrc(); $id = $this->input->post('id'); $this->load->module('mod_menu'); $result = $this->mod_menu->put($id); $result['resultData']['openUrl'] = $this->agent->referrer(); echo json_encode($result); } }
/** * @param $appid * @param $appkey * @return mixed */ function curl_check($appid, $appkey) { if (!$appid || !$appkey) { $err = ErrorCode::BadRequest; header("HTTP/1.0 " . $err . " " . ConvertErrCodeToMsg($err) . " ", true); echo "Argument Error.\r\n"; exit; } $sql = 'select * from Apps where appid=? and secret=?'; $app = db_read($sql, array(new dbpara('i', $appid), new dbpara('s', $appkey))); if ($app) { $ua = $app[0]["cURLAgent"]; $cua = $_SERVER["HTTP_USER_AGENT"]; $err = ErrorCode::Accepted; if (strlen($ua) != 0 && strcmp($ua, $cua) != 0) { header("HTTP/1.0 " . $err . " " . ConvertErrCodeToMsg($err) . " ", true); echo "User-Agent Check Error.\r\n"; exit; } else { return $app[0]; } } else { $err = ErrorCode::Accepted; header("HTTP/1.0 " . $err . " " . ConvertErrCodeToMsg($err) . " ", true); echo "App Auth Error.\r\n"; exit; } }
function custom() { $sosmed = db_read('mod_sosmed', array('status' => 1, 'name ' => 'custom')); if ($sosmed) { echo $sosmed->url; } }
function index() { if ($_SERVER['REQUEST_METHOD'] == "GET") { $admin_auth = $this->session->userdata('admin_auth'); $login_error = $this->session->userdata('login_error'); $this->session->unset_userdata('login_error'); session_write_close(); if ($admin_auth) { redirect('admin/dashboard'); } $view['error'] = $login_error; $this->load->view(tpldir('admin/login/index_view'), $view); } else { $username = $this->input->post('username'); $password = hash('sha256', $this->input->post('password')); $adminRow = db_read('admin', array('username' => $username, 'password' => $password)); if ($adminRow) { $this->session->set_userdata('admin_auth', true); $this->session->set_userdata('adminid', $adminRow->id); $this->session->set_userdata('admin_user', $adminRow->username); // redirect(base_url('admin/dashboard')); } else { $this->session->set_userdata('login_error', 'Invalid Username / password'); } redirect('admin/login'); } }
function googleplus() { $share = db_read('mod_share', array('status' => 1, 'name' => 'googleplus')); if ($share) { $view['share'] = $share; $view['sharedetail'] = $share ? db_reads('mod_share_detail', array('relid' => $share->id)) : false; $this->load->view(tpldir('modules/mod_share/googleplus_view'), $view); } }
function db_build($p, $o) { $f = db_f('test'); if ($p) { db_add($f, $p); } $r = db_read($f); return p($r, 1); }
function compile_engine() { global $BASEDIR; global $APPEND; $order = "bp_name,rule_prio"; $data = db_read("rules,bps", null, array(), $order, 0, 0); $table = array(); foreach ($data as $def) { $bp_name = $def["bp_name"]; $rule_prio = $def["rule_prio"]; $statefield = $def["bp_statefield"]; if ($bp_name == "GLOBAL") { $statefield = "GLOBAL.GLOBAL"; } if (!$statefield) { // use default: bpstates $statefield = "states.state_value:state_env"; } $def["rule_location"] = split("\n", $def["rule_location"]); $def["rule_condition"] = split("\n", $def["rule_condition"]); $def["rule_action"] = split("\n", $def["rule_action"]); $startvalue = $def["rule_startvalue"]; echo "compiling business process '{$bp_name}' prio {$rule_prio}: acts on {$statefield}<br>\n"; $subcond = array("bp_name" => $bp_name, "rule_prio" => $rule_prio); $subdata = db_read("conts", null, $subcond, "cont_prio", 0, 0); foreach ($subdata as $subidx => $subdef) { $subdata[$subidx]["cont_action"] = split("\n", $subdef["cont_action"]); } $def["CONTI"] = array_merge($subdata, $APPEND); $split = split(":", $statefield); $state_base = $split[0]; $def["bp_statefield"] = $state_base; $def["ENV_FIELD"] = @$split[1]; $newsplit = split("\\.", $split[0]); $def["TABLE"] = $newsplit[0]; $def["FIELD"] = $newsplit[1]; $table[$state_base][] = $def; } echo "done.<br>\n"; $code = "<?php // this file was automatically generated by the engine compiler from database tables.\n\n// ====> DO NOT EDIT! <===\n\n"; $code .= "\$ENGINE =\n" . db_data_to_code($table); $code .= "\n\n?>\n"; $outname = "{$BASEDIR}/compiled/engine_table.php"; $tmpname = "{$outname}.tmp"; $fp = fopen($tmpname, "w"); if (!$fp) { die("cannot create file '{$outname}'\n"); } $len = fwrite($fp, $code); if ($len != strlen($code)) { die("cannot write temporary file '{$tmpname}'\n"); } fclose($fp); rename($tmpname, $outname); }
function edit($id = false) { if (empty($_POST)) { $shareRow = db_read('mod_share', array('id' => $id)); if ($shareRow->name == 'twitter') { $shareDetails = db_reads('mod_share_detail', array('relid' => $id)); $view['share_details'] = $shareDetails; $view['share'] = $shareRow; $this->load->view(tpldir('admin/extension/share/edit/twitter_view'), $view); } elseif ($shareRow->name == 'facebook') { $shareDetails = db_reads('mod_share_detail', array('relid' => $id)); $view['share_details'] = $shareDetails; $view['share'] = $shareRow; $this->load->view(tpldir('admin/extension/share/edit/facebook_view'), $view); } elseif ($shareRow->name == 'googleplus') { $shareDetails = db_reads('mod_share_detail', array('relid' => $id)); $view['share_details'] = $shareDetails; $view['share'] = $shareRow; $this->load->view(tpldir('admin/extension/share/edit/googleplus_view'), $view); } } else { $result = jsonSrc(); $relid = $this->input->post('relid'); $sosmed = $this->input->post('sosmed'); if ($sosmed == 'twitter') { $updateContent = false; $updateContent['name'] = 'tweettext'; $updateContent['value'] = $this->input->post('tweettext'); db_update('mod_share_detail', array('relid' => $relid, 'name' => 'tweettext'), $updateContent); $updateContent = false; $updateContent['name'] = 'username'; $updateContent['value'] = $this->input->post('username'); db_update('mod_share_detail', array('relid' => $relid, 'name' => 'username'), $updateContent); $updateContent = false; $updateContent['name'] = 'hashtag'; $updateContent['value'] = $this->input->post('hashtag'); db_update('mod_share_detail', array('relid' => $relid, 'name' => 'hashtag'), $updateContent); $updateContent = false; $updateContent['status'] = $this->input->post('status'); db_update('mod_share', array('id' => $relid), $updateContent); } elseif ($sosmed == 'facebook') { $updateContent = false; $updateContent['status'] = $this->input->post('status'); db_update('mod_share', array('id' => $relid), $updateContent); } elseif ($sosmed == 'googleplus') { $updateContent = false; $updateContent['status'] = $this->input->post('status'); db_update('mod_share', array('id' => $relid), $updateContent); } $result['resultCode'] = 1000; $result['resultMsg'] = "Content Updated"; $result['resultData']['openUrl'] = base_url('admin/share'); echo json_encode($result); } }
function test_sae_db() { $db = db(); $data = reset(get_data("show global variables like 'read_only';", $db)); $this->assertEqual($data['Value'], 'OFF'); $dbr = db_read(); $data2 = reset(get_data("show global variables like 'read_only';", $dbr)); $this->assertEqual($data2['Value'], 'ON'); // auto $data3 = reset(get_data("show global variables like 'read_only';")); $this->assertEqual($data2['Value'], 'ON'); }
function institution_list() { $sql = "select * from " . $this->tabela . " "; $rlt = db_query($sql); while ($line = db_read($rlt)) { $sx .= '<TR>'; $sx .= '<TD>'; $sx .= trim($line['it_nome']); $sx .= '<TD>'; $sx .= trim($line['it_nome_abrev']); } }
function user_check($uid, $upwd) { $sql = 'select * from Users where name=? and password=?'; $user = db_read($sql, array(new dbpara('s', $uid), new dbpara('s', $upwd))); if ($user) { return $user[0]; } else { $err = ErrorCode::Accepted; header("HTTP/1.0 " . $err . " " . ConvertErrCodeToMsg($err) . " ", true); echo "User Auth Error.\r\n"; exit; } }
function tableexist($ttable) { global $base, $rlt; if ($base == 'pgsql') { $ttsql = "select * from pg_tables where (tablename='" . $ttable . "') and (schemaname='public')"; $ttrlt = db_query($ttsql); if ($tline = db_read($ttrlt)) { return 1; } else { return 0; } } }
function img($type, $id, $mode = '') { // mode: emb, ext, link $extension = 'jpg'; if ($type == 'foto_last') { $type = 'foto'; $id = db_read(array('table' => $type, 'col' => 'id', 'where' => '`foto`=' . $id, 'order' => '`dates` DESC')); //, 'limit'=>1 } if ($type == 'some_doc') { $extension = 'pdf'; } $tmp = substr('000000' . dechex($id), -6, 6); $file = 'd/' . $type . '/' . substr($tmp, 0, 2) . '/' . substr($tmp, 2, 2) . '/' . substr($tmp, 4, 2) . '.' . $extension; //if (config('port_81')) { // $file_81 = $file; // $file = '../wwws/'.$file; // } if (file_exists($file)) { $image = fread(fopen($file, 'rb'), filesize($file)); if (!$mode) { if (strlen($image) < 4000) { $mode = 'emb'; } else { $mode = 'ext'; } } if ($mode == 'emb') { // 1 $image = '<img src="data:image/png;base64,' . base64_encode($image) . '">'; } if ($mode == 'ext') { // 2 $size = getimagesize($file); //, $info $image = '<img ' . $size[3] . ' src="' . $file . '">'; } //if ($mode == 3) reserved for RAW if ($mode == 'link') { // 4 $image = $file; //if (config('port_81')) { // $image = 'https://'.$_SERVER['SERVER_ADDR'].'/'.$file_81; // } } return $image; } else { return false; } }
function video($id = false) { if ($id) { $video = db_read('mod_video', array('status' => 1, 'id' => $id)); $view['video'] = $video; $this->load->view(tpldir('page/video'), $view); } else { $video = db_reads('mod_video', array('status' => 1)); $count_video = count_db_reads('mod_video', array('status' => 1)); $view['video'] = $video; $view['count_video'] = $count_video; $this->load->view(tpldir('page/video-list'), $view); } }
public function get($id = false) { $result = jsonSrc(); if ($id) { $blog = db_read('page', array('id' => $id, 'type' => 'blog')); } else { $blog = db_read('page', array('type' => 'blog')); } if ($blog) { $result['resultCode'] = 1000; $result['resultData']['blog'] = $blog; } return $result; }
public function get($id = false) { $result = jsonSrc(); if ($id) { $event = db_read('page', array('id' => $id, 'type' => 'event')); } else { $event = db_read('page', array('type' => 'event')); } if ($event) { $result['resultCode'] = 1000; $result['resultData']['event'] = $event; } return $result; }
function index($url = false) { if ($url) { $microsite = db_read('mod_microsite', array('url' => $url)); if ($microsite) { $view['microsite'] = $microsite; $view['template'] = db_read('mod_microsite_template', array('mid', $microsite->id)); $view['contact'] = db_read('mod_microsite_contact', array('mid', $microsite->id)); $view['content'] = db_reads('mod_microsite_content', array('mid', $microsite->id)); $this->load->view(tpldir('page/microsite'), $view); return true; } } return false; }
function actions($mes = '') { if (strlen($mes) == 0) { $mes = date("Ym"); } $mes = substr($mes, 0, 6); $mes1 = $mes . '00'; $mes2 = $mes . '99'; $sql = "select * from " . $this->tabela . "\n\t\t\t\t\tinner join " . $this->tabela_type . " on cal_cod = calt_codigo \n\t\t\t\t\twhere \n\t\t\t\t\tcal_date >= '{$mes1}' and cal_date <= '{$mes2}'\n\t\t\t\t\torder by cal_date, cal_time\n\t\t\t\t"; $rlt = db_query($sql); $act = array(); while ($line = db_read($rlt)) { array_push($act, array($line['cal_date'], $line['cal_time'], $line['cal_description'], $line['calt_descricao'], $line['calt_color'])); } return $act; }
function load_committe() { $sql = "select * from _committee"; $rlt = db_query($sql); if ($line = db_read($rlt)) { $this->email = trim($line['cm_admin_email']); $this->email_user = trim($line['cm_admin_email']); $this->email_type = trim($line['cm_admin_email_tipo']); $this->email_pass = trim($line['cm_admin_email_pass']); $this->email_smtp = trim($line['cm_admin_email_smtp']); $this->email_name = $line['cm_name']; $this->email_replay = $line['cm_email_replay']; $this->site = $line['cm_site']; $this->prefix = trim($line['cm_committe']); } }
function display() { global $edit_mode, $date; $sql = "select * from " . $this->tabela . " \n\t\t\t\t\t\tleft join usuario on email_log = us_codigo\n\t\t\t\t\t\twhere email_protocolo = '" . $this->protocolo . "' \n\t\t\t\t\t\torder by email_id_msg, email_data desc, email_hora desc "; $rlt = db_query($sql); $sx = '<TABLE width=100% class="lt1" border=0 cellpadding=3 cellspacing=0>'; while ($line = db_read($rlt)) { $sx .= '<TR><TD align="left"><fieldset><legend>'; $sx .= msg("message_poted") . ': ' . $date->stod($line['email_data']) . ' ' . $line['email_hora'] . '</legend>'; $sx .= '<TT><I>Subject: ' . $line['email_assunto'] . '</I>'; $sx .= '<BR>Message: ' . mst($line['email_texto']); $sx .= '</fieldset><HR width="50%" size=1>'; } $sx .= '</table>'; return $sx; }
function edit($id = false) { if (empty($_POST)) { $view['banner'] = db_read('mod_banner', array('id' => $id)); $this->load->view(tpldir('admin/extension/banner/edit_view'), $view); } else { $result = jsonSrc(); $id = $this->input->post('id'); $updateBanner['url'] = $this->input->post('url'); $updateBanner['status'] = $this->input->post('status'); db_update('mod_banner', array('id' => $id), $updateBanner); $result['resultCode'] = 1000; $result['resultMsg'] = "Banner Updated"; $result['resultData']['openUrl'] = base_url('admin/banner'); echo json_encode($result); } }
/** * @param $appid * @param $appkeys * @return mixed */ function web_check($appid, $appkey) { if (!$appid || !$appkey) { $err = ErrorCode::BadRequest; header("HTTP/1.0 " . $err . " " . ConvertErrCodeToMsg($err) . " ", true); echo "Argument Error.\r\n"; exit; } $sql = 'select * from Apps where appid=? and secret=?'; $app = db_read($sql, array(new dbpara('i', $appid), new dbpara('s', $appkey))); if ($app) { $err = ErrorCode::Accepted; return $app[0]; } else { $err = ErrorCode::Accepted; header("HTTP/1.0 " . $err . " " . ConvertErrCodeToMsg($err) . " ", true); echo "App Auth Error.\r\n"; exit; } }
function read($paste_meta) { if (false !== ($paste = db_read($paste_meta['id']))) { switch ($paste['crypto']) { case 'PIDCRYPT': $cipher = 'AES-128-CBC'; break; case 'CRYPTO_JS': $cipher = 'AES-256-OFB'; break; default: $cipher = $paste['crypto']; } if (-100 == $paste['ttl']) { // one-time only paste, delete it now db_delete($paste_meta['id']); } return array('data' => $paste['data'], 'syntax' => $paste['syntax'], 'cipher' => $cipher); } }
function ic($cod = '') { global $jid, $LANG; $sql = "select * from " . $this->tabela . " \n\t\t\t\t\twhere nw_ref = '" . $cod . "' "; $sql .= " and nw_idioma = '{$LANG}' "; if (strlen($jid) > 0) { $sql .= " and (journal_id = {$jid})"; } $sql .= " limit 1"; $rlt = db_query($sql); if ($line = db_read($rlt)) { $title = trim($line['nw_titulo']); $txt = trim($line['nw_descricao']); } else { $title = $cod; $txt .= 'Message not found: ' . $cod . ' (' . $LANG . ')'; } $txt .= '<BR><BR><font style="font-size:8px">MSG_COD:' . $cod . '</font>'; $txt = mst($txt); $rst = array('title' => $title, 'text' => $txt); return $rst; }
function edit($id = false) { if (empty($_POST)) { $resultPages = db_reads('page', array('type' => 'event')); $resultPage = db_read('page', array('id' => $id, 'type' => 'event')); if (!$resultPages) { redirect(base_url('admin/event/add')); } $resultTemplate = $this->mod_template->get(); $view['categories'] = db_reads('category', array('type' => 'event')); $view['templates'] = $resultTemplate['resultData']; $view['blogs'] = $resultPages; $view['blog'] = $resultPage ? $resultPage : $resultPages[0]; $this->load->view(tpldir('admin/event/edit_view'), $view); } else { $result = jsonSrc(); $id = $this->input->post('id'); $result = $this->mod_event->put($id); $result['resultData']['openUrl'] = $this->agent->referrer(); echo json_encode($result); } }
function edit($id = false) { if (empty($_POST)) { if ($id) { $newsticker = db_read('mod_newsticker', array('id' => $id)); if ($newsticker) { $view['newsticker'] = $newsticker; $this->load->view(tpldir('admin/newsticker/edit_view'), $view); } } } else { $result = jsonSrc(); $update['text'] = $this->input->post('text'); $update['url'] = $this->input->post('url'); $update['status'] = $this->input->post('status'); $id = $this->input->post('id'); db_update('mod_newsticker', array('id' => $id), $update); $result['resultCode'] = 1000; $result['resultMsg'] = "Newsticker Updated"; $result['resultData']['openUrl'] = base_url('admin/dashboard'); echo json_encode($result); } }