Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Dibuat : Alcom Edunet
- * Alamat : Gondang, Wonosobo Jateng
- * Oleh : Chabib Nurozak
- * Dikerjakan pada : 23 Juni 2012
- * Email : [email protected]
- * Versi/PHP : chapps-1.2/5.3.x
- */
- /* start program */
- function chappsstart($title=null,$data=null){
- $title = (isset($title))? $title : 'Selamat Datang';
- if (isset($data)){
- if (is_array($data)){
- extract($data);
- echo (isset($doctype))? "<!$doctype><html><head>" : "<!doctype html><html><head>";
- echo "<title>$title</title>";
- echo (isset($favicon))? "<link rel='shortcut icon' href='$favicon'/>" : "<link rel='shortcut icon' href='http://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-ash4/321273_186478848101769_100002189661207_438871_2102331646_n.jpg'/>";
- echo (isset($contenttype))? "<meta http-equiv='content-type' content='$contenttype'/>" : "<meta http-equiv='content-type' content='text/html; charset=UTF-8'/>";
- echo (isset($keywords))? "<meta name='keywords' content='$keywords'/>" : '';
- echo (isset($discription))? "<meta name='discription' content='$discription'/>" : '';
- echo (isset($revised))? "<meta name='revised' content='$revised'/>" : '';
- echo (isset($generator))? "<meta name='generator' content='$generator'/>" : '';
- }
- else {}
- }
- else {echo "<!doctype html><html><head><title>$title</title>";}
- echo "<link rel='stylesheet' type='text/css' href='c/button.css'/>";
- echo "</head><body>";
- }
- function chappsend(){
- echo "</body></html>";
- }
- /* function form */
- function chappsstartform($action,$method,$formtitle){
- echo "<form action='$action' method='$method'>";
- echo "<table>\n";
- echo "<tr><th colspan='2'>$formtitle</th></tr>\n";
- }
- function chappsinputtext($title,$name,$val=null){
- echo "<tr><td>$title</td><td>: <input type='text' name='$name' placeholder='$title' value='$val'/></td></tr>\n";
- }
- function chappsselectcategory($title,$table='category'){
- echo "<tr><td>$title</td><td>: <select name='category'>";
- $query = mysql_query("SELECT * FROM `$table`");
- while($cat= mysql_fetch_assoc($query)){
- echo "<option value='". $cat['id_category'] ."'>".$cat['name_category']."</option>";
- }
- echo "</select></td></tr>\n";
- }
- function chappsinputhidden($name,$val){
- echo "<input type='hidden' name='$name' value='$val'/>";
- }
- function chappsbutton($valsubmit,$valreset){
- echo "<tr><td colspan='2' align='center'><input type='submit' name='submit' value='$valsubmit'/> <input type='reset' value='$valreset'/></td></tr>";
- }
- function chappsendform(){
- echo "</table></form>";
- }
- /* end function form */
- /*rupiah */
- function chappsrupiah($uang){
- return "<div style='text-align: right;'><span style='float:left'>Rp. </span>".number_format($uang,2,',','.')."</div>";
- }
- /*end rupiah */
- /* pagging */
- function chappspagginglimit(){
- global $limit;
- $lim = (isset($limit))? $limit : 10;
- $limaw = (isset($_GET['page']) AND $_GET['page'] != 0) ? (intval($_GET['page']) - 1) * $lim : 0;
- return "$limaw,$lim";
- }
- function chappsnumstart(){
- global $limit;
- $lim = (isset($limit))? $limit : 10;
- $start = (isset($_GET['page']) AND $_GET['page'] != 0) ? (intval($_GET['page']) - 1) * $lim : 0;
- return $start;
- }
- function chappspagging($num,$addlink=null){
- global $limit;
- $h_p = "http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
- $lim = (isset($limit))? $limit : 10;
- $addurl = (isset($addlink) AND $addlink != '') ? $addlink."&" : '';
- $jumlahpagging = ceil($num/$lim);
- $nprev = "Prev";
- $nnext = "Next";
- if (isset($_GET['page'])){
- $page = $_GET['page'];
- $pprev = $page-1;
- $pnext = $page+1;
- if ($jumlahpagging<=1){
- $prev = $nprev;
- $next = $nnext;
- }
- elseif ($page == '' || $page-1 == 0){
- $prev = "$nprev";
- $next = "<li><a href='$h_p?".$addurl."page=$pnext'>$nnext</a></li>";
- }
- elseif ($page+1 > $jumlahpagging){
- $prev = "<li><a href='$h_p?".$addurl."page=$pprev'>$nprev</a></li>";
- $next = "$nnext";
- }
- else{
- $prev = "<li><a href='$h_p?".$addurl."page=".$pprev."'>$nprev</a></li>";
- $next = "<li><a href='$h_p?".$addurl."page=".$pnext."'>$nnext</a></li>";
- }
- }
- else {
- if ($jumlahpagging<=1){
- $prev = $nprev;
- $next = $nnext;
- }
- else {
- $prev = "$nprev";
- $next = "<li><a href='$h_p?".$addurl."page=2'>$nnext</a></li>";
- }
- }
- echo "$prev";
- for ($pagging = 1; $pagging <= $jumlahpagging; $pagging++){
- $e = " <li><a href='$h_p?".$addurl."page=$pagging'>$pagging</a></li>";
- if (isset($_GET['page'])){
- if ($_GET['page'] != ''){
- echo ($_GET['page'] == $pagging) ? " <b>$pagging</b>" : $e;
- }
- else {
- echo ($pagging == 1) ? " <b>$pagging</b>" : $e;
- }
- }
- else {
- echo ($pagging == 1) ? " <b>$pagging</b>" : $e;
- }
- }
- echo " $next ";
- }
- /* end pagging */
- /* date time day */
- function chappsdate($waktu){
- if (isset($waktu)){
- $waktu_bulan= substr($waktu,5,2)-1;
- $bulan_aray= array('Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember');
- return substr($waktu,8,2)." ".$bulan_aray[$waktu_bulan]." ".substr($waktu,0,4);
- }
- }
- function chappsdatetime($waktu){
- if (isset($waktu)){
- $waktu_bulan= substr($waktu,5,2)-1;
- $bulan_aray= array('Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember');
- return "<div>".substr($waktu,8,2)." ".$bulan_aray[$waktu_bulan]." ".substr($waktu,0,4)." ".substr($waktu,11,8)."</div>";
- }
- }
- function chappsday($date){
- $hari = array('Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu');
- return $hari[$date];
- }
- /* end date time day */
- /*file open */
- function chappsopenfile($dir){
- if ($handle = opendir($dir."/")) { //opendir diisi sama dir target
- while (false !== ($file = readdir($handle))) {
- if ($file != "." && $file != "..") {
- if (is_file($dir."/".$file)){
- }
- }
- }
- closedir($handle);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment