function daemons_servers_delete() { $cfg = $GLOBALS['cfg']; $db = $GLOBALS['db']; $server_id = intval(params('server_id')); $daemon_id = intval(params('daemon_id')); $arrService = $db->select("SELECT id\n FROM {$cfg['tblService']}\n WHERE server_id='{$server_id}'\n AND daemon_id='{$daemon_id}'"); if (!$arrService) { halt(SERVER_ERROR); return; } $id = $arrService[0]['id']; $result = $db->delete("DELETE FROM {$cfg['tblService']}\n WHERE id='{$id}'\n LIMIT 1"); $resultForeign = $db->delete("DELETE FROM {$cfg['tblAccess']}\n WHERE dienst_id='{$id}'"); if (!$result || !$resultForeign) { halt(SERVER_ERROR); return; } set('server', array('id' => $server_id)); set('daemon', array('id' => $daemon_id)); if (isAjaxRequest()) { return js('daemons_servers/delete.js.php', null); } else { halt(HTTP_NOT_IMPLEMENTED); } }
function dump($msg) { if (Config::Get('sys.logs.hacker_console') && !isAjaxRequest()) { call_user_func(array('Debug_HackerConsole_Main', 'out'), $msg); } else { //var_dump($msg); } }
function after($output, $route) { if (!isAjaxRequest()) { $time = number_format((double) substr(microtime(), 0, 10) - LIM_START_MICROTIME, 6); $output .= "\n<!-- page rendered in {$time} sec., on " . date("D M j G:i:s T Y") . " -->\n"; $output .= "<!-- for route\n"; $output .= print_r($route, true); $output .= "-->"; } return $output; }
/** * функция вывода отладочных сообщений через "хакерскую" консоль Дмитрия Котерова */ function dump($msg) { if (Config::Get('sys.logs.hacker_console') && !isAjaxRequest()) { if (!class_exists('Debug_HackerConsole_Main')) { require_once Config::Get('path.root.server') . "/engine/lib/external/HackerConsole/Main.php"; new Debug_HackerConsole_Main(true); } call_user_func(array('Debug_HackerConsole_Main', 'out'), $msg); } else { //var_dump($msg); } }
function ports_delete() { $id = intval(params('id')); $cfg = $GLOBALS['cfg']; $db = $GLOBALS['db']; $result = $db->delete("DELETE FROM {$cfg['tblPort']}\n WHERE id={$id}\n LIMIT 1"); if (!$result) { halt(SERVER_ERROR); return; } set('port', array('id' => $id)); if (isAjaxRequest()) { return js('ports/delete.js.php', null); } else { halt(HTTP_NOT_IMPLEMENTED); } }
function access_delete() { $cfg = $GLOBALS['cfg']; $db = $GLOBALS['db']; $role_id = intval(params('role_id')); $dienst_id = intval(params('service_id')); $result = $db->delete("DELETE FROM {$cfg['tblAccess']}\n WHERE rolle_id='{$role_id}'\n AND dienst_id='{$dienst_id}'\n LIMIT 1"); if (!$result) { halt(SERVER_ERROR); return; } set('role', array('id' => $role_id)); set('service', array('id' => $dienst_id)); if (isAjaxRequest()) { return js('access/delete.js.php', null); } else { halt(HTTP_NOT_IMPLEMENTED); } }
function roles_services_delete() { $cfg = $GLOBALS['cfg']; $db = $GLOBALS['db']; $role_id = intval($_POST['role_id']); $service_id = intval($_POST['service_id']); $connect = isset($_POST['connect']) ? true : false; $result = $db->delete("DELETE FROM {$cfg['tblAccess']}\n WHERE rolle_id='{$role_id}'\n AND dienst_id='{$service_id}'\n LIMIT 1"); if (!$result) { halt(SERVER_ERROR); return; } if (isAjaxRequest() && $connect) { $arrRoles = fetchRolesServices("WHERE {$cfg['tblRole']}.id = {$role_id}"); return js('roles_services/role.js.php', null, array('role' => array_pop($arrRoles))); } else { halt(HTTP_NOT_IMPLEMENTED); } }
function people_delete() { $cfg = $GLOBALS['cfg']; $db = $GLOBALS['db']; $id = intval(params('id')); $result = $db->delete("DELETE FROM {$cfg['tblPerson']}\n WHERE id={$id}\n LIMIT 1"); $resClientForeign = $db->delete("DELETE FROM {$cfg['tblClient']}\n WHERE person_id={$id}"); $resHasRolleForeign = $db->delete("DELETE FROM {$cfg['tblPersonHasRole']}\n WHERE person_id={$id}"); if ($result && $resClientForeign && $resHasRolleForeign) { set('person', array('id' => $id)); if (isAjaxRequest()) { return js('people/delete.js.php', null); } else { redirect_to('people'); } } else { halt(SERVER_ERROR); } }
function isAjaxPost() { return isPost() && isAjaxRequest() ? true : false; }
function people_roles_delete() { $cfg = $GLOBALS['cfg']; $db = $GLOBALS['db']; $role_id = intval(params('role_id')); $person_id = intval(params('person_id')); $connect = isset($_POST['connect']) ? true : false; if ($connect) { $role_id = intval($_POST['role_id']); $person_id = intval($_POST['person_id']); } $result = $db->delete("DELETE FROM {$cfg['tblPersonHasRole']}\n WHERE rolle_id='{$role_id}'\n AND person_id='{$person_id}'\n LIMIT 1"); if (!$result) { halt(SERVER_ERROR); return; } if (isAjaxRequest()) { if ($connect) { $arrRoles = fetchRoles("WHERE {$cfg['tblRole']}.id = {$role_id}"); return js('people_roles/role.js.php', null, array('role' => array_pop($arrRoles))); } else { set('role', array('id' => $role_id)); set('person', array('id' => $person_id)); return js('people_roles/delete.js.php', null); } } else { halt(HTTP_NOT_IMPLEMENTED); } }
require_once 'main.php'; require_once 'Connection.class.php'; require_once 'CustomerPaginator.class.php'; $c = new Connection(); $conn = $c->getConnection(); $limit = from_get('limit', 10); $page = from_get('page', 1); $links = from_get('links', 7); $expanded = from_get('expanded', 'on'); $search_name = from_get('search_name', ''); $search_participants = from_get('search_participants', ''); $query = "SELECT DISTINCT A.id, A.name, A.email, A.phone, A.participants, A.observations, A.timestamp FROM wp_musicteach_customer A "; $conn->set_charset("utf8"); $Paginator = new CustomerPaginator($conn, $query, $search_name, $search_participants); $results = $Paginator->getData($limit, $page); if (isAjaxRequest()) { include 'include_list_customers.php'; } else { include 'head.php'; ?> <h1 class="text-center">Cercador de famílies</h1> <div id="form-list" class="form-list" data-model="customer"> <?php include 'include_search_customers.php'; include 'include_list_customers.php'; ?> </div> <?php include 'foot.php'; } ?>
function clients_delete() { $id = intval(params('id')); $cfg = $GLOBALS['cfg']; $db = $GLOBALS['db']; $result = $db->delete("DELETE FROM {$cfg['tblClient']}\n WHERE id={$id}\n LIMIT 1"); if ($result) { set('client', array('id' => $id)); if (isAjaxRequest()) { return js('clients/delete.js.php', null); } else { redirect_to('clients'); } } else { halt(SERVER_ERROR); } }
<?php include 'access.php'; error_reporting(E_ALL); ini_set("display_errors", 1); require_once 'main.php'; require_once 'Connection.class.php'; require_once 'GroupDAO.class.php'; $response = array('status' => '1', 'message' => ''); $isAjax = isAjaxRequest(); $action = from_post_or_get('action', ''); if (!isset($action)) { die('accio no informada'); exit; } $id = -1; if ($action !== 'new' && $action !== 'update' && $action !== 'delete') { die('accio incorrecta: ' . $action); } switch ($action) { case 'delete': $id = $_GET['id'] or die('id de grup no informat'); break; case 'update': $id = $_POST['id'] or die('id de grup no informat'); case 'new': $name = $_POST['name'] or die('nom de grup no informat'); $age = $_POST['age'] or die('edat no informada'); $date_start = $_POST['date_start'] or die('data inici informada'); $date_end = $_POST['date_end'] or die('data fi informada'); $location = $_POST['location'] or die('ubicació no informada');
function flag() { loggedInSection(); // urika_helper.php if (isAjaxRequest()) { $image = $this->image_model->getImage($this->input->xss_clean($_POST["image_id"])); $image = $image->row(); $this->load->model("flag_model"); if ($this->flag_model->flagExists($this->session->userdata("user_id"), $image->image_id) == true) { echo "false"; } else { // need to add a new favourite $insert_data = array("fl_upload_id" => $image->image_id, "fl_flagger_id" => $this->session->userdata("user_id")); $insert = $this->flag_model->createNewFlag($insert_data); if ($insert !== false) { echo "true"; } else { echo "false"; } } } else { $data = array("errorTitle" => "Request Denied", "content" => "An error has occurred: you cannot access this page from the browser."); $this->template->write_view("content", "general/error", $data, TRUE); //now render templates $this->template->render(); } }
function delete() { loggedInSection(); // urika_helper.php if (isAjaxRequest()) { if (isset($_POST["delete_id"]) && is_numeric($_POST["delete_id"])) { // check this post belongs to the user $comment = $this->comment_model->getComment($this->input->xss_clean($_POST["delete_id"])); if ($comment != false) { $comment = $comment->row(); if ($comment->c_poster_id == $this->session->userdata("user_id")) { // now delete the comment if ($this->comment_model->deleteComment($_POST["delete_id"]) == true) { echo "true"; } else { echo "false"; } } else { echo "false"; } } else { echo "false"; } } else { echo "false"; } } else { $data = array("errorTitle" => "Request Denied", "content" => "An error has occurred: you cannot access this page from the browser."); $this->template->write_view("content", "general/error", $data, TRUE); //now render templates $this->template->render(); } }
/** AJAX browse super function, used to grab image results follow results, and comments results etc but in an a straight upload return form Params are part of the post var, the type of results determines by the url parameter @param type : type of results to grab */ function ajaxresults($type = null) { if (isAjaxRequest()) { if ($type != null) { $allowedTypes = array("images", "moodboards", "comments"); $this->input->xss_clean($_POST); // check it actually exists if (in_array(strtolower($type), $allowedTypes)) { $result_html = ""; $result; $base = base_url(); // some universal or multiplue use variables $search_term = $tag = ""; $page = 1; $per_page = 20; $base = base_url(); // now process the post terms if (isset($_POST["search"]) && $_POST["search"] != "") { $search_term = trim($_POST["search"]); } if (isset($_POST["tag"]) && $_POST["tag"] != "") { $tag = trim($_POST["tag"]); } if (isset($_POST["page"]) && $_POST["page"] != "") { $page = $_POST["page"]; } if (isset($_POST["per_page"]) && $_POST["per_page"] != "") { $per_page = $_POST["per_page"]; } // set offset $offset = (int) ($page * $per_page); if (strtolower($type) == "images") { /* 1) Images search Handles: Order by Date Order by Views User's uploads User's favs Follow feed Tag Search term */ $order_by = ""; $order_dir = ""; if (isset($_POST["order_by"]) && $_POST["order_by"] == "") { $order_by = trim($_POST["order_by"]); } // Now determine which functions to run if (isset($_POST["user_id"]) && !isset($_POST["user_favs"])) { // this means we are looking at user uploads $this->load->model("user_model"); $results = $this->user_model->getUserImages($_POST["user_id"], $per_page * ($page - 1)); // generate user lis from results } else { if (isset($_POST["user_favs"])) { // this means we are looking at favurites $this->load->model("user_model"); $results = $this->user_model->getUserFavs($_POST["user_id"], $per_page * ($page - 1)); } } // now process results into upload list li if ($results["count"] != false) { $out = ""; for ($i = 0; $i < $results["count"]; $i++) { $irow = $results["result"][$i]; if (!isset($irow->f_type)) { // load li through view $data = array("thumb_url" => $irow->i_thumb_url, "title" => $irow->i_title, "url" => $base . 'image/view/' . $irow->image_id . '/' . slugify($irow->i_title) . '/', "user_url" => $base . 'user/u/' . $irow->u_username . '/', "username" => $irow->u_username, "views" => $irow->i_views, "overlay" => $base . 'assets/images/layout/uploadListOverlay.gif'); $out .= $this->load->view("components/uploadListLi", $data, true); } else { if ($irow->f_type == "image") { // load li through view $data = array("thumb_url" => $irow->i_thumb_url, "title" => $irow->i_title, "url" => $base . 'image/view/' . $irow->image_id . '/' . slugify($irow->i_title) . '/', "user_url" => $base . 'user/u/' . $irow->u_username . '/', "username" => $irow->u_username, "views" => $irow->i_views, "overlay" => $base . 'assets/images/layout/uploadListOverlay.gif'); $out .= $this->load->view("components/uploadListLi", $data, true); } else { if ($irow->f_type == "moodboard") { // load li through view $data = array("thumb_url" => $irow->m_thumb_url, "title" => $irow->m_title, "url" => $base . 'moodboard/view/' . $irow->moodboard_id . '/' . slugify($irow->m_title) . '/', "user_url" => $base . 'user/u/' . $irow->u_username . '/', "username" => $irow->u_username, "views" => $irow->m_views, "overlay" => $base . 'assets/images/layout/mbListOverlay.gif'); $out .= $this->load->view("components/mbListLi", $data, true); } } } } } else { $out = "no_more"; } $return_html = $out; } else { if (strtolower($type) == "moodboards") { /* Moodboards search - simple pagination for user page */ if (isset($_POST["user_id"])) { // this means we are looking at user uploads $this->load->model("user_model"); $results = $this->user_model->getUserMoodboards($_POST["user_id"], $per_page * ($page - 1)); if ($results["count"] != 0) { $out = ""; for ($i = 0; $i < $results["count"]; $i++) { $mrow = $results["result"][$i]; // load li through view $data = array("thumb_url" => $mrow->m_thumb_url, "title" => $mrow->m_title, "url" => $base . 'moodboard/view/' . $mrow->moodboard_id . '/' . slugify($mrow->m_title) . '/', "user_url" => $base . 'user/u/' . $mrow->u_username . '/', "username" => $mrow->u_username, "views" => $mrow->m_views, "overlay" => $base . 'assets/images/layout/mbListOverlay.gif'); $out .= $this->load->view("components/mbListLi", $data, true); } $return_html = $out; } else { $return_html = "no_more"; } } else { $return_html = "false"; } } else { if (strtolower($type) == "comments") { $this->load->model("comment_model"); // simply, simply need to return an offset $comments = $this->comment_model->getComments($_POST["subject_id"], $page, $_POST["comment_type"]); if (is_array($comments)) { $comments_html = ""; $comments_count = count($comments); for ($i = 0; $i < $comments_count; $i++) { $comment_data = array("profile_url" => getUserProfileURL($comments[$i]->u_profile_id, $comments[$i]->u_email), "user_url" => $base . "user/u/" . $comments[$i]->u_username . "/", "username" => $comments[$i]->u_username, "comment_id" => $comments[$i]->comment_id, "date_uploader" => date("F j, Y, G:i", strtotime($comments[$i]->c_datetime)), "comment_text" => html_entity_decode($comments[$i]->c_content), "classes" => "", "showdelete" => "false"); // set delete link think if ($comments[$i]->c_poster_id == $this->session->userdata("user_id")) { $comment_data["showdelete"] = "true"; } // get classes if ($i % 2 == 1) { $comment_data["classes"] = "even"; } else { $comment_data["classes"] = "odd"; } // uploader comment if ($comments[$i]->user_id == $comments[$i]->c_subject_user_id) { $comment_data["classes"] .= " uploader_comment"; $comment_data["date_uploader"] .= " <span>- uploader comment</span>"; } $comments_html .= $this->load->view("components/commentDiv", $comment_data, true); } $return_html = $comments_html; } else { // no more comments $return_html = "no_more"; } } else { } } } echo $return_html; } else { echo "false"; } } else { echo "false"; } } else { redirect('', 'location'); } }
function security_warnOnInputWithNoReferer() { if (!@$GLOBALS['SETTINGS']['advanced']['checkReferer']) { return; } if (@$_SERVER['HTTP_REFERER']) { return; } if (isFlashUploader()) { return; } // skip for flash uploader (flash doesn't always send referer) // allowed link combinations if ($_SERVER['REQUEST_METHOD'] == 'GET') { if (!array_diff(array_keys($_REQUEST), array('menu', 'userNum', 'resetCode'))) { return; } // skip if nothing but password-reset form keys } // $error = ''; $userInput = @$_REQUEST || @$_POST || @$_GET || @$_SERVER['QUERY_STRING'] || @$_SERVER['PATH_INFO']; if ($userInput) { $format = "Security Warning: A manually entered link with user input was detected.\n"; $format .= "If you didn't type this url in yourself, please close this browser window.\n"; $error = nl2br(t($format)); if (isAjaxRequest()) { $error = strip_tags(html_entity_decode($error)); } } return $error; }
</div> <br> <div class="text-center"> <button class="btn btn-primary" type="submit">Guardar <span class="glyphicon glyphicon-ok"></span></button> <button class="btn btn-info btn-back" type="button">Tornar</span></button> </button></div> </form> </div> <div id="form-track"> <?php form_track(); ?> </div> <?php if (!isAjaxRequest()) { include 'foot.php'; } ?>
apache_setenv("AUTOLOADER_BUILD_RUNNING", false); } catch (AutoloaderException $e) { if ($e instanceof AutoloaderException_Parser_IO) { die("ERROR: Check you file permissions!"); } else { if ($e instanceof AutoloaderException_IndexBuildCollision) { if (!isAjaxRequest()) { echo $e->getMessage(); } } else { var_dump($e); die; } } } if (!isPhpCli() && !isAjaxRequest()) { echo "\n\n Trying to reload in 10 sec.<script type=\"text/javascript\">window.setTimeout('window.location.reload()', 10000);</script>"; die; } } // start session session_name(str_replace(".", "-", PLATFORM_ID . KOALA_VERSION)); session_start(); // style if (!empty($_GET["style"]) && DEVELOPMENT_MODE == TRUE) { $STYLE = $_GET["style"]; $_SESSION["STYLE"] = $_GET["style"]; get_cache()->clean(); } else { if (!empty($_SESSION["STYLE"]) && DEVELOPMENT_MODE == TRUE) { $STYLE = $_SESSION["STYLE"];
function showInterfaceError($alert) { $errors = alert($alert); if (isAjaxRequest()) { die($errors); } else { showInterface('', true); } }
function daemons_delete() { $cfg = $GLOBALS['cfg']; $db = $GLOBALS['db']; $id = intval(params('id')); $result = $db->delete("DELETE FROM {$cfg['tblDaemon']}\n WHERE id={$id}\n LIMIT 1"); $resPortsForeign = $db->delete("DELETE FROM {$cfg['tblPort']}\n WHERE daemon_id={$id}"); $resServiceForeign = $db->delete("DELETE {$cfg['tblService']}, {$cfg['tblAccess']}\n FROM {$cfg['tblService']}\n LEFT OUTER JOIN {$cfg['tblAccess']}\n ON {$cfg['tblService']}.id = {$cfg['tblAccess']}.dienst_id\n WHERE {$cfg['tblService']}.daemon_id={$id}"); if ($result && $resPortsForeign && $resServiceForeign) { set('daemon', array('id' => $id)); if (isAjaxRequest()) { return js('daemons/delete.js.php', null); } else { redirect_to('daemons'); } } else { halt(SERVER_ERROR); } }
public function run(&$params) { $m = MODULE_NAME; $a = ACTION_NAME; $allow = $params['allow']; $permission = $params['permission']; if (!session('?user_id') && intval(cookie('user_id')) != 0 && trim(cookie('name')) != '' && trim(cookie('salt_code')) != '') { $user = M('user')->where(array('user_id' => intval(cookie('user_id'))))->find(); if (md5(md5($user['user_id'] . $user['name']) . $user['salt']) == trim(cookie('salt_code'))) { $d_role = D('RoleView'); $role = $d_role->where('user.user_id = %d', $user['user_id'])->find(); if ($user['category_id'] == 1) { session('admin', 1); } session('role_id', $role['role_id']); session('position_id', $role['position_id']); session('role_name', $role['role_name']); session('department_id', $role['department_id']); session('name', $user['name']); session('user_id', $user['user_id']); } } if (session('?admin')) { return true; } if (in_array($a, $permission)) { return true; } elseif (session('?position_id') && session('?role_id')) { if (in_array($a, $allow)) { return true; } else { switch ($a) { case "listdialog": $a = 'index'; break; case "adddialog": $a = 'add'; break; case "excelimport": $a = 'add'; break; case "excelexport": $a = 'view'; break; case "cares": $a = 'index'; break; case "caresview": $a = 'view'; break; case "caresedit": $a = 'edit'; break; case "caresdelete": $a = 'delete'; break; case "caresadd": $a = 'add'; break; case "receive": $a = 'add'; break; case "role_add": $a = 'add'; break; case "sendsms": $a = 'marketing'; break; case "smsrecord": $a = 'marketing'; break; case "sendemail": $a = 'marketing'; break; case "search": $a = 'search'; break; } $url = strtolower($m) . '/' . strtolower($a); $ask_per = M('permission')->where('url = "%s" and position_id = %d', $url, session('position_id'))->find(); if (is_array($ask_per) && !empty($ask_per)) { return true; } else { if (isAjaxRequest()) { echo '<div class="alert alert-error">您没有此权利!</div>'; die; } else { $url = empty($_SERVER['HTTP_REFERER']) ? U('index/index') : $_SERVER['HTTP_REFERER']; alert('error', '您没有此权利!', $url); } } } } else { alert('error', '请先登录...', U('user/login')); } }
<?php define('BLOCK', 0); define('PHP_EXT', strrchr(__FILE__, '.')); define('ROOT', './../../'); header('Content-Type: text/html; charset=utf-8'); require_once ROOT . 'lib/fonctions.php'; isAjaxRequest() || exit; if (!empty($_POST['pseudo']) && !empty($_POST['pass'])) { var_dump($_POST['pseudo']); echo '<hr />'; var_dump(md5($_POST['pass'])); $resultat = Doctrine_Core::getTable(T_USER)->findOneByPseudoAndPass($_POST['pseudo'], md5($_POST['pass'])); if ($resultat != NULL) { var_dump($resultat); $_SESSION = $resultat->toArray(false); echo '<br /><img src="avatar/' . $_SESSION['avatar'] . '"> <br />Bienvenue, ' . $_SESSION['pseudo'] . '<br /> <li><a href="?page=deconnexion">Déconnexion</a></li> <li><a href="?page=profil">Profil</a></li>'; } else { echo '<p class="error">' . encode('Erreur: le mot de passe et/ou le pseudo ne sont pas bons !') . '</p>'; var_dump($resultat); } } else { echo '<p class="error">' . encode('Erreur: veuillez rentrez un pseudo et un mot de passe !') . '</p>'; }
function addImageToNew() { loggedInSection(); if (isAjaxRequest()) { // first create the collection $col_insert_array = array("col_user_id" => $this->session->userdata("user_id"), "col_name" => $this->input->xss_clean($_POST["newcol_name"])); // insert then return a view of the corrent data set once ive done a design $insertcol = $this->collection_model->createNewCollection($col_insert_array); if ($insertcol == false) { echo "colfail"; } else { // now add an image $image_id = $this->input->xss_clean($_POST["image_id"]); $this->load->model("image_model"); $image = $this->image_model->getImage($image_id)->row(); $update_data = array("col_string" => $image_id, "col_updated" => date('Y-m-d H:i:s')); $insert = $this->collection_model->updateCollection($update_data, $insertcol["id"]); // check for upload_comments in notice format string $createNotice = true; $this->load->model("user_model"); $subject_user = $this->user_model->getUser($image->i_user_id)->row(); if (strpos($subject_user->u_notice_format, "collection_add") === FALSE) { $createNotice = false; } if ($insert !== false && $createNotice == true && $image != false) { /* Add notice code Only add if its not your own image, save times with activity */ if ($image->i_user_id != $this->session->userdata("user_id")) { $notice_insert = array("n_object_user_id" => $image->i_user_id, "n_object_id" => $image->image_id, "n_object_type" => "image", "n_action_user_id" => $this->session->userdata("user_id"), "n_type" => "collection_add", "n_new" => 1, "n_html" => ""); $base = base_url(); // now html $notice_html = '<span class="notice_date">' . date("F j, Y, G:i") . '</span> - <a href="' . $base . 'user/u/' . $this->session->userdata("username") . '/" title="' . $this->session->userdata("username") . '\'s profile">' . $this->session->userdata("username") . '</a> added your '; $n_url = $base . 'image/view/' . $image->image_id . '/' . slugify($irow->i_title) . '/'; $notice_html .= 'upload <a href="' . $n_url . '" title="View this image">' . $image->i_title . '</a>'; $notice_html .= ' to their collection <a href="' . $base . 'collection/view/' . $insertcol["id"] . '/' . slugify($col_insert_array["col_name"]) . '/" title="View Collection">' . $this->input->xss_clean($_POST["newcol_name"]) . '</a>'; $notice_insert["n_html"] = $notice_html; $this->load->model("notice_model"); $this->notice_model->createNewNotice($notice_insert); } /* End notice code add */ echo "true"; } else { if ($insert == false) { echo "false"; } else { echo "true"; } } } } else { $data = array("errorTitle" => "Request Denied", "content" => "An error has occurred: you cannot access this page from the browser."); $this->template->write_view("content", "general/error", $data, TRUE); //now render templates $this->template->render(); } }
/** * Проверяет запрос послан как ajax или нет * * @return bool */ public static function GetIsAjaxRequest() { return isAjaxRequest(); }
function renderPHPExtensionsFormContent() { $phpext = new Webinterface\Helper\PHPExtensionManager(); $available_extensions = $phpext->getExtensionDirFileList(); $enabled_extensions = $phpext->getEnabledExtensionsFromIni(); $html_checkboxes = ''; $i = 1; // start at first element $itemsTotal = count($available_extensions); // elements total $itemsPerColumn = ceil($itemsTotal / 4); // use list of available_extensions to draw checkboxes foreach ($available_extensions as $name => $file) { // if extension is enabled, check the checkbox $checked = false; if (isset($enabled_extensions[$file])) { $checked = true; } /** * Set disabled state of "zend_extension"s (deactivate the checkbox). * XDebug, Opcache is not loaded as normal PHP extension, but as a Zend Engine extension. */ $disabled = ''; if ($name === 'php_xdebug' or $name === 'php_opcache') { $disabled = 'disabled'; } // render column opener (everytime on 1 of 12) if ($i === 1) { $html_checkboxes .= '<div class="form-group">'; } // the input tag is wrapped by the label tag $html_checkboxes .= '<label class="checkbox'; $html_checkboxes .= $checked === true ? ' active-element">' : ' not-active-element">'; $html_checkboxes .= '<input type="checkbox" name="extensions[]" value="' . $file . '" '; $html_checkboxes .= $checked === true ? 'checked="checked" ' : ''; $html_checkboxes .= $disabled . '>'; $html_checkboxes .= substr($name, 4); $html_checkboxes .= '</label>'; if ($i == $itemsPerColumn or $itemsTotal === 1) { $html_checkboxes .= '</div>'; $i = 0; /* reset column counter */ } $i++; $itemsTotal--; } if (isAjaxRequest() and !isset($_GET['tab'])) { echo $html_checkboxes; } else { return $html_checkboxes; } }
function displayStartupUserInfo() { if (!isPhpCli() && !isAjaxRequest()) { @ob_start(); $version = KOALA_VERSION; echo <<<END <style type="text/css"> body { \ttext-align: center; \tfont-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; \tfont-size: 17px; \tfont-weight: bold; } div#container { \tposition:relative; \ttop:30%; } </style> <div id="container"> <h1>Initializing System. Please wait ...</h1> <small style="font-weight: normal;">koala framework v{$version}</small> </div> END; buffer_flush(); } else { if (isPhpCli()) { echo "Initializing System. Please wait ...\n"; } } }
/** * Выводит данные в консоль браузера * * @return bool|void */ public function Console() { if (!Config::Get('sys.logs.console') or isAjaxRequest()) { return false; } $aArgs = func_get_args(); if (count($aArgs)) { if (is_string($aArgs[0]) or is_numeric($aArgs[0])) { $sMsg = array_shift($aArgs); } else { $sMsg = ''; } return $this->Info($sMsg, $aArgs, 'console'); } return false; }
/** Saves user Notices **/ function saveUserNotices() { loggedInSection(); // urika_helper.php if (isAjaxRequest()) { $user = $this->session->userdata("user_id"); $notices_data = array("u_notice_format" => trim(str_replace('.', '#', $_POST["notice_format"]))); $update = $this->user_model->updateUser($notices_data, $user, "user_id"); if ($update) { $rtn_html = "true"; } else { $rtn_html = "false"; } echo $rtn_html; } else { $data = array("errorTitle" => "Request Denied", "content" => "An error has occurred: you cannot access this page from the browser."); $this->template->write_view("content", "general/error", $data, TRUE); //now render templates $this->template->render(); } }
function add() { loggedInSection(); // urika_helper.php if (isAjaxRequest()) { $this->load->model("image_model"); $this->load->model("moodboard_model"); $this->load->model("user_model"); $base = base_url(); if ($this->favourite_model->favouriteExists($this->session->userdata("user_id"), $_POST["subject_id"], $_POST["object_type"]) == true) { $out_arr = array("msg" => "false"); } else { // need to add a new favourite $insert_data = array("f_subject_id" => $_POST["subject_id"], "f_user_id" => $this->session->userdata("user_id"), "f_type" => $this->input->xss_clean($_POST["object_type"])); $insert = $this->favourite_model->createNewFavourite($insert_data); // get the request object if ($_POST["object_type"] == "image") { $obj = $this->image_model->getImage($this->input->xss_clean($_POST["subject_id"]))->row(); $obj_user_id = $obj->i_user_id; $obj_name = $obj->i_title; } else { $obj = $this->moodboard_model->getMoodboard($this->input->xss_clean($_POST["subject_id"]))->row(); $obj_user_id = $obj->m_user_id; $obj_name = $obj->m_title; } // check for upload_comments in notice format string $createNotice = true; $subject_user = $this->user_model->getUser($obj_user_id)->row(); if ($_POST["object_type"] == "image") { if (strpos($subject_user->u_notice_format, "upload_comments") === FALSE) { $createNotice = false; } } else { if ($_POST["object_type"] == "moodboard") { if (strpos($subject_user->u_notice_format, "mb_comments") === FALSE) { $createNotice = false; } } } if ($insert !== false && $createNotice == true) { // success /* Begin notice insert */ $notice_insert = array("n_object_user_id" => $obj_user_id, "n_object_id" => $_POST["subject_id"], "n_object_type" => $_POST["object_type"], "n_action_user_id" => $this->session->userdata("user_id"), "n_type" => "favourite", "n_new" => 1, "n_html" => ""); // now html $notice_html = '<span class="notice_date">' . date("F j, Y, G:i") . '</span> - <a href="' . $base . 'user/u/' . $this->session->userdata("username") . '/" title="' . $this->session->userdata("username") . '\'s profile">' . $this->session->userdata("username") . '</a> added your '; if ($_POST["object_type"] == "image") { $this->load->model("image_model"); $image = $this->image_model->getImage($_POST["subject_id"])->row(); $n_url = $base . 'image/view/' . $_POST["subject_id"] . '/' . slugify($image->i_title) . '/'; $notice_html .= 'upload <a href="' . $n_url . '" title="View this image">' . $obj_name . '</a>'; } else { if ($_POST["object_type"] == "moodboard") { $this->load->model("moodboard_model"); $mb = $this->moodboard_model->getMoodboard($_POST["subject_id"])->row(); $n_url = $base . 'moodboard/view/' . $_POST["subject_id"] . '/' . slugify($mb->m_title) . '/'; $notice_html .= 'moodboard <a href="' . $n_url . '" title="View this moodboard">' . $obj_name . '</a>'; } } $notice_html .= ' to their favourites'; $notice_insert["n_html"] = $notice_html; $this->load->model("notice_model"); $this->notice_model->createNewNotice($notice_insert); /* End notice insert */ $out_arr = array("msg" => "true", "newfavli" => '<li class="sul_' . $this->session->userdata("user_id") . '"> <a href="' . $base . 'user/u/' . $this->session->userdata("username") . '/" title="View this users profile"> <img src="' . $this->session->userdata("image_url") . '" width="30" height="30" alt="User profile image" /> <span>' . $this->session->userdata("username") . '</span> </a>'); } else { if ($insert == false) { $out_arr = array("msg" => "false"); } else { $out_arr = array("msg" => "true", "newfavli" => '<li class="sul_' . $this->session->userdata("user_id") . '"> <a href="' . $base . 'user/u/' . $this->session->userdata("username") . '/" title="View this users profile"> <img src="' . $this->session->userdata("image_url") . '" width="30" height="30" alt="User profile image" /> <span>' . $this->session->userdata("username") . '</span> </a>'); } } echo json_encode($out_arr); } } else { $data = array("errorTitle" => "Request Denied", "content" => "An error has occurred: you cannot access this page from the browser."); $this->template->write_view("content", "general/error", $data, TRUE); //now render templates $this->template->render(); } }