function showPagination($pagename, $tbl_name, $start, $limit, $page, $condition) { $database = new MySQLDB(); //your table name // How many adjacent pages should be shown on each side? $adjacents = 3; /* First get total number of rows in data table. If you have a WHERE clause in your query, make sure you mirror it here. */ $query = "SELECT COUNT(*) as num FROM {$tbl_name} {$condition} "; $total_pages = mysqli_fetch_array($database->query($query)); $total_pages = $total_pages['num']; /* Setup vars for query. */ $targetpage = $pagename; //your file name (the name of this file) //how many items to show per page /* Setup page vars for display. */ if ($page == 0) { $page = 1; } //if no page var is given, default to 1. $prev = $page - 1; //previous page is page - 1 $next = $page + 1; //next page is page + 1 $lastpage = ceil($total_pages / $limit); //lastpage is = total pages / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 /* Now we apply our rules and draw the pagination object. We're actually saving the code to a variable in case we want to draw it more than once. */ $pagination = ""; if ($lastpage > 1) { $pagination .= "<div class=\"pagination\">"; //previous button if ($page > 1) { $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=" . $prev . "')\">« previous</a>"; } else { $pagination .= "<span class=\"disabled\">« previous</span>"; } //pages if ($lastpage < 7 + $adjacents * 2) { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page) { $pagination .= "<span class=\"current\">{$counter}</span>"; } else { $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=" . $counter . "')\">{$counter}</a>"; } } } elseif ($lastpage > 5 + $adjacents * 2) { //close to beginning; only hide later pages if ($page < 1 + $adjacents * 2) { for ($counter = 1; $counter < 4 + $adjacents * 2; $counter++) { if ($counter == $page) { $pagination .= "<span class=\"current\">{$counter}</span>"; } else { $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=" . $counter . "')\">{$counter}</a>"; } } $pagination .= "..."; $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=" . $lpm1 . "')\">{$lpm1}</a>"; $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=" . $lastpage . "')\">{$lastpage}</a>"; } elseif ($lastpage - $adjacents * 2 > $page && $page > $adjacents * 2) { $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=1')\">1</a>"; $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=2')\">2</a>"; $pagination .= "..."; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) { $pagination .= "<span class=\"current\">{$counter}</span>"; } else { $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=" . $counter . "')\">{$counter}</a>"; } } $pagination .= "..."; $pagination .= "<a >{$lpm1}</a>"; $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=" . $lastpage . "')\">{$lastpage}</a>"; } else { $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=1')\">1</a>"; $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=2')\">2</a>"; $pagination .= "..."; for ($counter = $lastpage - (2 + $adjacents * 2); $counter <= $lastpage; $counter++) { if ($counter == $page) { $pagination .= "<span class=\"current\">{$counter}</span>"; } else { $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=" . $counter . "')\">{$counter}</a>"; } } } } //next button if ($page < $counter - 1) { $pagination .= "<a onclick=\"setStateGet('adminTable','" . $targetpage . "','page=" . $next . "')\">next »</a>"; } else { $pagination .= "<span class=\"disabled\">next »</span>"; } $pagination .= "</div>\n"; } return $pagination; }
if ($input->p['license'] == 'agree') { if ($input->p['settings'] == 'install') { if ($input->p['sql_type'] == 'mysqli') { $db = new MySQLIDB(); } else { $db = new MySQLDB(); } $error_msg = $db->testconnect($input->p['db_name'], $input->p['db_host'], $input->p['db_user'], $input->p['db_password']); if ($error_msg != '') { helpdeskz_database($error_msg); } elseif ($input->p['admin_user'] == '' || $input->p['admin_password'] == '') { helpdeskz_database('Enter the HelpDeskZ login details.'); } else { $db->connect($input->p['db_name'], $input->p['db_host'], $input->p['db_user'], $input->p['db_password'], $input->p['db_prefix']); $query = helpdeskz_getQuery($input->p['db_prefix'], $input->p['admin_user'], $input->p['admin_password']); foreach ($query as $q) { $db->query($q); } helpdeskz_saveConfigFile($input->p['db_host'], $input->p['db_name'], $input->p['db_user'], $input->p['db_password'], $input->p['db_prefix'], $input->p['sql_type']); header('location: install.php?result=completed'); exit; } } helpdeskz_checksetup(); } else { if ($input->g['result'] == 'completed') { helpdeskz_completed(); } else { helpdeskz_agreement(); } }
} } function createMarker(latitude,longitude,markertitle,content) { var marker = new GMarker(new GLatLng(latitude,longitude),{title: markertitle}); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(content); }); return marker; } function initMarkers() { var batch = []; <?php $db = new MySQLDB(); $sql = "SELECT * from `geodatatable`"; $result = $db->query($sql); while ($row = mysql_fetch_array($result)) { echo "this.aaTitles['" . $row['id'] . "'] = " . '\'<a onmouseover="centerMap(' . $row['id'] . ',' . $row['latitude'] . ',' . $row['longitude'] . ');return false;" href="#">' . addslashes($row['name']) . '</a><br/>\';'; echo "this.aaContents['" . $row['id'] . "'] = '" . addslashes($row['content']) . "';"; echo "marker = createMarker(" . $row['latitude'] . ", " . $row['longitude'] . ", '" . addslashes($row['name']) . "', '" . addslashes($row['name']) . "' +'<br/>'+ this.aaContents['" . $row['id'] . "']);"; echo 'markers["' . $row['id'] . '"] = marker;'; echo 'marker._id="' . $row['id'] . '";'; echo 'batch.push(marker);'; } ?> return batch; } function setupMarkers() {
require_once INCLUDES . 'classes/classRegistry.php'; require_once INCLUDES . 'classes/classMailer.php'; require_once INCLUDES . 'functions.php'; // DB Connection $helpdeskz = new Registry(); if ($helpdeskz->config['Database']['type'] == 'mysqli') { require_once INCLUDES . 'classes/classMysqli.php'; $db = new MySQLIDB(); } else { require_once INCLUDES . 'classes/classMysql.php'; $db = new MySQLDB(); } $db->connect($helpdeskz->config['Database']['dbname'], $helpdeskz->config['Database']['servername'], $helpdeskz->config['Database']['username'], $helpdeskz->config['Database']['password'], $helpdeskz->config['Database']['tableprefix']); //Settings $settings = array(); $q = $db->query("SELECT * FROM " . TABLE_PREFIX . "settings"); while ($r = $db->fetch_array($q)) { $settings[$r['field']] = $r['value']; } if ($settings['email_piping'] == 'no') { exit; } if (version_compare(PHP_VERSION, '5.3.0', '<')) { echo "This script requires PHP version 5.3.0 or higher to work, sorry."; exit(1); } // because version 5.3.0 is required, we could in theory use the autoloader :) //require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'autoload.php'; // ... but this project is not so much inteded to be installed through composer etc which is a bit of a pain, but that's okay. require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tomaj' . DIRECTORY_SEPARATOR . 'imap-mail-downloader' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'ProcessAction.php'; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tomaj' . DIRECTORY_SEPARATOR . 'imap-mail-downloader' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Downloader.php';
<?php require_once 'php/db.inc.php'; $mysqlObj = new MySQLDB(); $sql = "SELECT\n\t\t\testoque_items.nome,\n\t\t\testoque_items.quantidade,\n\t\t\testoque_items.medida,\n\t\t\testoque_items.descartavel,\n\t\t\testoque_items.categoria,\n\t\t\tlote.codigo,\n\t\t\tlocal_estoque.sala,\n\t\t\tlocal_estoque.apelido,\n\t\t\tfabricante.nome_fantasia\n\t\t\tFROM\n\t\t\testoque_items\n\t\t\tLEFT JOIN lote ON estoque_items.lote = lote.idlote\n\t\t\tLEFT JOIN local_estoque ON estoque_items.`local` = local_estoque.idestoque\n\t\t\tLEFT JOIN fabricante ON estoque_items.fabricante = fabricante.idfabricante\n\t\t\t"; $items = $mysqlObj->query($sql); $sql_local_estoque = "SELECT\t\t\t\n\t\t\t\t\t\t\tlocal_estoque.predio,\n\t\t\t\t\t\t\tlocal_estoque.sala,\n\t\t\t\t\t\t\tlocal_estoque.apelido\n\t\t\t\t\t\t FROM local_estoque;\n\t\t\t\t\t\t\t"; $local_estoque = $mysqlObj->query($sql_local_estoque); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>MedStock | By: Marcus Vinicius Campos</title> <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> <!-- Bootstrap 3.3.4 --> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <!-- Font Awesome Icons --> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> <!-- Ionicons --> <link href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css" /> <!-- jvectormap --> <link href="plugins/jvectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" /> <!-- DATA TABLES --> <link href="plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" /> <!-- Theme style --> <link href="dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" /> <!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. --> <link href="dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />