├── rich-editor ├── koneksi.php~ ├── koneksi.php ├── save.php~ ├── save.php ├── view.php ├── view.php~ ├── detail.php ├── detail.php~ ├── index.php ├── index.php~ ├── article.sql └── dist │ ├── summernote.css │ └── summernote.min.js ├── README.md ├── oop ├── config │ └── config.ini ├── proccess │ ├── logout.php │ ├── delete.php │ └── processUser.php ├── class │ ├── getConfig.php │ ├── Factory.php │ ├── dbConnect.php │ ├── dbConnect.php~ │ ├── userAccount.php~ │ ├── userAccount.php │ ├── Iterator.php~ │ ├── Iterator.php │ ├── pagination.php │ ├── pagination.php~ │ ├── db.php~ │ └── db.php ├── view │ ├── login.php │ ├── add_user_view.php │ └── admin.php ├── index.php └── tes (1).sql └── pdo-search ├── connection.php ├── connection.php~ ├── style.css ├── style.css~ ├── index.php └── index.php~ /rich-editor/koneksi.php~: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #Collection of PDO examples 2 | -------------------------------------------------------------------------------- /oop/config/config.ini: -------------------------------------------------------------------------------- 1 | ;konfigurasi database 2 | 3 | dbdns = "mysql:host=localhost;dbname=test" 4 | dbuser = "root" 5 | dbpass = "" 6 | -------------------------------------------------------------------------------- /oop/proccess/logout.php: -------------------------------------------------------------------------------- 1 | userLogout(); 9 | 10 | -------------------------------------------------------------------------------- /oop/proccess/delete.php: -------------------------------------------------------------------------------- 1 | deleteUser(array('nim'=>$nim)); -------------------------------------------------------------------------------- /rich-editor/koneksi.php: -------------------------------------------------------------------------------- 1 | PDO::ERRMODE_EXCEPTION 9 | )); 10 | -------------------------------------------------------------------------------- /pdo-search/connection.php: -------------------------------------------------------------------------------- 1 | PDO::ERRMODE_EXCEPTION 10 | )); 11 | -------------------------------------------------------------------------------- /pdo-search/connection.php~: -------------------------------------------------------------------------------- 1 | PDO::ERRMODE_EXCEPTION 10 | )); 11 | -------------------------------------------------------------------------------- /rich-editor/save.php~: -------------------------------------------------------------------------------- 1 | prepare("INSERT INTO article (title,content) VALUES (:title,:content)"); 4 | $stmt->bindParam(':title', $title); 5 | $stmt->bindParam(':content', $content); 6 | 7 | // insert one row 8 | $title = $_POST['title']; 9 | $content = $_POST['content']; 10 | if($stmt->execute()) 11 | header("Location:index.php"); 12 | 13 | -------------------------------------------------------------------------------- /rich-editor/save.php: -------------------------------------------------------------------------------- 1 | prepare("INSERT INTO article (title,content) VALUES (:title,:content)"); 5 | $stmt->bindParam(':title', $title); 6 | $stmt->bindParam(':content', $content); 7 | 8 | // insert one row 9 | $title = $_POST['title']; 10 | $content = $_POST['content']; 11 | if($stmt->execute()) 12 | header("Location:index.php"); 13 | 14 | -------------------------------------------------------------------------------- /pdo-search/style.css: -------------------------------------------------------------------------------- 1 | body{ 2 | 3 | background:#f8f9fa; 4 | width:99%; 5 | } 6 | 7 | .form{ 8 | 9 | padding:30px; 10 | border:1px solid #eee; 11 | background:#fff; 12 | margin-left:30%; 13 | width:500px; 14 | height:300px; 15 | } 16 | h2{text-align:center;margin-bottom:30px;color:#ff3c1f} 17 | input,button {height:30px} 18 | 19 | table{border-collapse:collapse;width:100%;border:1px solid #ddd} 20 | table tr td,table tr th{height:30px;padding:5px} 21 | .footer{text-align:center;} 22 | -------------------------------------------------------------------------------- /pdo-search/style.css~: -------------------------------------------------------------------------------- 1 | body{ 2 | 3 | background:#f8f9fa; 4 | width:99%; 5 | } 6 | 7 | .form{ 8 | 9 | padding:30px; 10 | border:1px solid #eee; 11 | background:#fff; 12 | margin-left:30%; 13 | width:500px; 14 | height:300px; 15 | } 16 | h2{text-align:center;margin-bottom:30px;color:#ff3c1f} 17 | input,button {height:30px} 18 | 19 | table{border-collapse:collapse;width:100%;border:1px solid #ddd} 20 | table tr td,table tr th{height:30px;padding:10px} 21 | .footer{text-align:center;} 22 | -------------------------------------------------------------------------------- /oop/proccess/processUser.php: -------------------------------------------------------------------------------- 1 | $_POST['nim'], 6 | 'nama' => $_POST['nama'], 7 | 'alamat' => $_POST['alamat'], 8 | ); 9 | $mode = $_POST['mode']; 10 | include_once '../class/userAccount.php'; 11 | 12 | $user = new UserAccount(); 13 | 14 | if($mode =='new'): 15 | $user->addUser($data); 16 | else: 17 | $id = $_POST['id']; 18 | $user->saveEditUser($data,$id); 19 | endif; 20 | //header('Location:home.php'); 21 | 22 | -------------------------------------------------------------------------------- /rich-editor/view.php: -------------------------------------------------------------------------------- 1 | prepare("SELECT * FROM article"); 6 | $query->execute(); 7 | if($query->rowCount() > 0 ){ 8 | 9 | $no=1; 10 | while ($r = $query->fetch()) { 11 | 12 | echo ' 13 | 14 | '.$no.' 15 | '.$r['title'].' 16 | '; 17 | 18 | ++$no; 19 | 20 | }//end while 21 | 22 | }else{ 23 | 24 | echo "Not Found"; 25 | } 26 | -------------------------------------------------------------------------------- /rich-editor/view.php~: -------------------------------------------------------------------------------- 1 | prepare("SELECT * FROM article"); 6 | $query->execute(); 7 | if($query->rowCount() > 0 ){ 8 | 9 | $no=1; 10 | while ($r = $query->fetch()) { 11 | 12 | echo ' 13 | 14 | '.$no.' 15 | '.$r['title'].' 16 | '; 17 | 18 | ++$no; 19 | 20 | }//end while 21 | 22 | }else{ 23 | 24 | echo "Not Found"; 25 | } 26 | -------------------------------------------------------------------------------- /oop/class/getConfig.php: -------------------------------------------------------------------------------- 1 | 2 |

Login

3 |
4 | Username : 5 |

6 | 7 |

8 | Password : 9 |

10 | 11 |

12 | 13 |
14 | 15 | login($username,$password); 26 | 27 | } 28 | 29 | ?> 30 | -------------------------------------------------------------------------------- /oop/class/Factory.php: -------------------------------------------------------------------------------- 1 | $class, 16 | 'option' =>$option, 17 | )); 18 | 19 | 20 | if(empty(self::$_instance[$dataClass])){ 21 | 22 | 23 | self::$_classPath = dirname(__FILE__).DIRECTORY_SEPARATOR.''.$class.'.php'; 24 | //exit( self::$_classPath); 25 | self::$_class = $class; 26 | include_once self::$_classPath; 27 | self::$_instance[$dataClass] = new $class($option); 28 | } 29 | 30 | return self::$_instance[$dataClass]; 31 | } 32 | 33 | 34 | } -------------------------------------------------------------------------------- /oop/view/add_user_view.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | Home 5 |

6 | getEditUser(array('id'=>$id)); 13 | 14 | $mode = isset($_GET['q'])?'edit':'new'; 15 | ?> 16 |
17 | 18 | Nim : 19 |

20 | 21 |

22 | Nama : 23 |

24 | 25 |

26 | Alamat : 27 |

28 | 29 |

30 |

31 | 32 | 33 | 34 |

35 |
36 | 37 | 38 | -------------------------------------------------------------------------------- /oop/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Simple CRUD with OOP-PHP

4 | Login'; 8 | } 9 | 10 | ?> 11 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /oop/class/dbConnect.php: -------------------------------------------------------------------------------- 1 | konek = self::$_connection; 33 | } 34 | } 35 | catch(PDOException $e){ 36 | 37 | echo "Error : ".$e->getMessage()."
"; 38 | } 39 | } 40 | 41 | return self::$_connection; 42 | } 43 | 44 | 45 | public static function cekInstance(){ 46 | 47 | if(is_null(self::$_cekInstance)){ 48 | 49 | self::$_cekInstance = new self(); 50 | } 51 | return self::$_cekInstance; 52 | } 53 | 54 | //Close koneksi 55 | 56 | public static function closeConnection(){ 57 | 58 | $this->konek = NULL; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /oop/class/dbConnect.php~: -------------------------------------------------------------------------------- 1 | konek = self::$_connection; 33 | } 34 | } 35 | catch(PDOException $e){ 36 | 37 | echo "Error : ".$e->getMessage()."
"; 38 | } 39 | } 40 | 41 | return self::$_connection; 42 | } 43 | 44 | 45 | public static function cekInstance(){ 46 | 47 | if(is_null(self::$_cekInstance)){ 48 | 49 | self::$_cekInstance = new self(); 50 | } 51 | return self::$_cekInstance; 52 | } 53 | 54 | //Close koneksi 55 | 56 | public static function closeConnection(){ 57 | 58 | $this->konek = NULL; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /rich-editor/detail.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sample 5 | 6 | 10 | 11 | 12 |
13 |
14 | prepare("SELECT * FROM article WHERE id = :id "); 18 | $query->bindValue(':id',$id); 19 | $query->execute(); 20 | if($query->rowCount() > 0 ){ 21 | $r = $query->fetch(); 22 | ?> 23 |

24 |
25 |
26 |
27 |

<< Back

28 | 35 |
36 | 37 |
38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /rich-editor/detail.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sample 5 | 6 | 10 | 11 | 12 |
13 |
14 | prepare("SELECT * FROM article WHERE id = :id "); 18 | $query->bindValue(':id',$id); 19 | $query->execute(); 20 | if($query->rowCount() > 0 ){ 21 | $r = $query->fetch(); 22 | ?> 23 |

24 |
25 |
26 |
27 |

<< Back

28 | 35 |
36 | 37 |
38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /oop/view/admin.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

CRUD - OOP PHP

4 |

5 | 6 |

7 |

8 | Add New | 9 | Logout 10 |

11 |

12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | query("SELECT * FROM mhs LIMIT {$offset},{$limit}")->result(); 31 | $totalRows = $user->get('mhs')->num_rows(); 32 | 33 | foreach($getData as $data): 34 | 35 | echo ' 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | '; 45 | endforeach; 46 | ?> 47 | 48 | 49 |
NimNamaAlamatAction
'.$data->nim.''.$data->nama.''.$data->alamat.'Delete | Edit
50 |

51 |

52 | $limit, 56 | 'url' =>$_SERVER['PHP_SELF'].'?', 57 | 'total_data' =>$totalRows, 58 | 'uri_segment'=>$page, 59 | ); 60 | $paging = Factory::getClass("Pagination"); 61 | echo $paging->create_page($config); 62 | 63 | ?> 64 |

65 | -------------------------------------------------------------------------------- /oop/class/userAccount.php~: -------------------------------------------------------------------------------- 1 | objUser = Factory::getClass("Db"); 10 | 11 | } 12 | public function login($username=NULL,$password=NULL){ 13 | 14 | $result = $this->objUser->getWhere('user',array('username'=>$username,'password'=>md5($password))) 15 | ->num_rows(); 16 | 17 | if($result < 1){ 18 | 19 | print('Error : Username or password invalid'); 20 | exit; 21 | }else{ 22 | session_register('username',$username); 23 | header('Location:../view/admin.php'); 24 | } 25 | } 26 | 27 | public function userLogout(){ 28 | 29 | session_destroy(); 30 | header('Location:../index.php'); 31 | } 32 | 33 | public function addUser($data=array()){ 34 | 35 | if(!empty($data)): 36 | 37 | $validateNim = $this->objUser->getWhere('mhs',array('nim'=>$data['nim']))->num_rows(); 38 | 39 | if($validateNim <= 0): 40 | $this->objUser->insert('mhs',$data); 41 | header('Location:../view/admin.php'); 42 | else: 43 | echo 'user already Exist';exit(' admin'); 44 | endif; 45 | endif; 46 | } 47 | 48 | public function deleteUser($data=array()){ 49 | 50 | if(!empty($data)): 51 | $this->objUser->delete('mhs',$data); 52 | 53 | header('Location:../view/admin.php'); 54 | endif; 55 | } 56 | 57 | public function getEditUser($data=array()){ 58 | 59 | if(!empty($data)): 60 | return $this->objUser->getWhere('mhs',$data)->getRows(); 61 | endif; 62 | 63 | } 64 | public function saveEditUser($data=array(),$id){ 65 | 66 | if(!empty($data)): 67 | $this->objUser->update('mhs',$data,array('id'=>$id)); 68 | header('Location:../view/admin.php'); 69 | endif; 70 | } 71 | 72 | 73 | 74 | } 75 | 76 | -------------------------------------------------------------------------------- /oop/class/userAccount.php: -------------------------------------------------------------------------------- 1 | objUser = Factory::getClass("Db"); 10 | 11 | } 12 | public function login($username=NULL,$password=NULL){ 13 | 14 | $result = $this->objUser->getWhere('user',array('username'=>$username,'password'=>md5($password))) 15 | ->num_rows(); 16 | 17 | if($result < 1){ 18 | 19 | print('Error : Username or password invalid'); 20 | exit; 21 | }else{ 22 | session_register('username',$username); 23 | header('Location:../view/admin.php'); 24 | } 25 | } 26 | 27 | public function userLogout(){ 28 | 29 | session_destroy(); 30 | header('Location:../index.php'); 31 | } 32 | 33 | public function addUser($data=array()){ 34 | 35 | if(!empty($data)): 36 | 37 | $validateNim = $this->objUser->getWhere('mhs',array('nim'=>$data['nim']))->num_rows(); 38 | 39 | if($validateNim <= 0): 40 | $this->objUser->insert('mhs',$data); 41 | header('Location:../view/admin.php'); 42 | else: 43 | echo 'user already Exist';exit(' admin'); 44 | endif; 45 | endif; 46 | } 47 | 48 | public function deleteUser($data=array()){ 49 | 50 | if(!empty($data)): 51 | $this->objUser->delete('mhs',$data); 52 | 53 | header('Location:../view/admin.php'); 54 | endif; 55 | 56 | 57 | } 58 | 59 | public function getEditUser($data=array()){ 60 | 61 | if(!empty($data)): 62 | return $this->objUser->getWhere('mhs',$data)->getRows(); 63 | endif; 64 | 65 | } 66 | public function saveEditUser($data=array(),$id){ 67 | 68 | if(!empty($data)): 69 | $this->objUser->update('mhs',$data,array('id'=>$id)); 70 | header('Location:../view/admin.php'); 71 | endif; 72 | } 73 | 74 | 75 | 76 | } 77 | 78 | -------------------------------------------------------------------------------- /rich-editor/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 |
16 | 17 |
18 |
19 |
20 | 21 | Title 22 | 23 |
24 | 25 | 26 |
27 | 28 | 29 | 30 |
31 |
32 | 33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
NoTitle
45 | 46 |
47 | 48 |
49 |
50 | 51 | 52 | 53 | 54 | 55 | 56 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /rich-editor/index.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 |
16 | 17 |
18 |
19 |
20 | 21 | Title 22 | 23 |
24 | 25 | 26 |
27 | 28 | 29 | 30 |
31 |
32 | 33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
NoTitle
45 | 46 |
47 | 48 |
49 |
50 | 51 | 52 | 53 | 54 | 55 | 56 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /oop/tes (1).sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 3.4.5 3 | -- http://www.phpmyadmin.net 4 | -- 5 | -- Host: localhost 6 | -- Generation Time: Nov 27, 2012 at 10:24 AM 7 | -- Server version: 5.5.16 8 | -- PHP Version: 5.3.8 9 | 10 | SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; 11 | SET time_zone = "+00:00"; 12 | 13 | 14 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 15 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 16 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 17 | /*!40101 SET NAMES utf8 */; 18 | 19 | -- 20 | -- Database: `tes` 21 | -- 22 | 23 | -- -------------------------------------------------------- 24 | 25 | -- 26 | -- Table structure for table `mhs` 27 | -- 28 | 29 | CREATE TABLE IF NOT EXISTS `mhs` ( 30 | `id` int(11) NOT NULL AUTO_INCREMENT, 31 | `nim` varchar(11) COLLATE latin1_general_ci NOT NULL, 32 | `nama` varchar(30) CHARACTER SET latin1 DEFAULT NULL, 33 | `alamat` text CHARACTER SET latin1, 34 | PRIMARY KEY (`id`) 35 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=10 ; 36 | 37 | -- 38 | -- Dumping data for table `mhs` 39 | -- 40 | 41 | INSERT INTO `mhs` (`id`, `nim`, `nama`, `alamat`) VALUES 42 | (1, '00001', 'Leny Angel ', 'Ciledug '), 43 | (2, '00002', 'Indah japri', 'Palmerah'), 44 | (3, '00003', 'Agus', 'Bekasi'), 45 | (4, '00004', 'Miftah', 'Cengkareng'), 46 | (5, '00005', 'Mario Cabul', 'Bekasi'), 47 | (6, '00006', 'Riki', 'Ciledug'), 48 | (7, '00007', 'Andi', 'tasik'), 49 | (8, '00008', 'Cici', 'Bandung'); 50 | 51 | -- -------------------------------------------------------- 52 | 53 | -- 54 | -- Table structure for table `user` 55 | -- 56 | 57 | CREATE TABLE IF NOT EXISTS `user` ( 58 | `id` int(11) NOT NULL AUTO_INCREMENT, 59 | `username` varchar(50) COLLATE latin1_general_ci NOT NULL, 60 | `password` varchar(50) COLLATE latin1_general_ci NOT NULL, 61 | PRIMARY KEY (`id`) 62 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ; 63 | 64 | -- 65 | -- Dumping data for table `user` 66 | -- 67 | 68 | INSERT INTO `user` (`id`, `username`, `password`) VALUES 69 | (1, 'admin', 'admin'); 70 | 71 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 72 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 73 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 74 | -------------------------------------------------------------------------------- /oop/class/Iterator.php~: -------------------------------------------------------------------------------- 1 | _sql = $sql; 17 | $this->_mode= $mode; 18 | 19 | //echo $mode.$sql; 20 | } 21 | 22 | //reset pointer ke 0 23 | function rewind(){ 24 | 25 | $this->_pointer = 0; 26 | } 27 | 28 | // return pointer terkini 29 | function key(){ 30 | 31 | return $this->_pointer; 32 | } 33 | 34 | protected function _getQuery(){ 35 | 36 | if(!$this->_query){ 37 | 38 | $this->_conn = dbConnect::getConnection(); 39 | 40 | $this->_query = mysql_query($this->_sql,$this->_conn); 41 | if(!$this->_query) 42 | print('Error : '.mysql_error().' '.$this->_sql); 43 | 44 | } 45 | 46 | return $this->_query; 47 | dbConnect::closeConnection(); 48 | } 49 | 50 | protected function _getNumResult(){ 51 | 52 | if(!$this->_numResult){ 53 | 54 | $this->_numResult = mysql_num_rows($this->_getQuery()); 55 | } 56 | 57 | return $this->_numResult; 58 | 59 | } 60 | 61 | //memvalidasi pointer current ada elemen nya 62 | function valid(){ 63 | 64 | if($this->_pointer >=0 && $this->_pointer < $this->_getNumResult()){ 65 | 66 | return TRUE; 67 | } 68 | else{ 69 | 70 | return FALSE; 71 | } 72 | 73 | } 74 | 75 | protected function _getRow($pointer){ 76 | 77 | if(isset($this->_result[$pointer])){ 78 | 79 | return $this->_result[$pointer]; 80 | } 81 | 82 | $row = NULL; 83 | 84 | if($this->_mode=='result'){ 85 | 86 | $row = mysql_fetch_object($this->_getQuery()); 87 | } 88 | elseif($this->_mode=='result_array'){ 89 | 90 | $row = mysql_fetch_array($this->_getQuery()); 91 | } 92 | 93 | if($row){ 94 | 95 | $this->_result[$pointer] = $row; 96 | } 97 | return $row; 98 | } 99 | function next(){ 100 | 101 | $row = $this->_getRow($this->_pointer); 102 | if($row){ 103 | 104 | $this->_pointer++; 105 | } 106 | 107 | return $row; 108 | } 109 | function current(){ 110 | 111 | return $this->_getRow($this->_pointer); 112 | } 113 | 114 | } -------------------------------------------------------------------------------- /oop/class/Iterator.php: -------------------------------------------------------------------------------- 1 | _sql = $sql; 17 | $this->_mode= $mode; 18 | 19 | //echo $mode.$sql; 20 | } 21 | 22 | //reset pointer ke 0 23 | function rewind(){ 24 | 25 | $this->_pointer = 0; 26 | } 27 | 28 | // return pointer terkini 29 | function key(){ 30 | 31 | return $this->_pointer; 32 | } 33 | 34 | protected function _getQuery(){ 35 | 36 | if(!$this->_query){ 37 | 38 | $this->_conn = dbConnect::getConnection(); 39 | 40 | $this->_query = mysql_query($this->_sql,$this->_conn); 41 | if(!$this->_query) 42 | print('Error : '.mysql_error().' '.$this->_sql); 43 | 44 | } 45 | 46 | return $this->_query; 47 | dbConnect::closeConnection(); 48 | } 49 | 50 | protected function _getNumResult(){ 51 | 52 | if(!$this->_numResult){ 53 | 54 | $this->_numResult = mysql_num_rows($this->_getQuery()); 55 | } 56 | 57 | return $this->_numResult; 58 | 59 | } 60 | 61 | //memvalidasi pointer current ada elemen nya 62 | function valid(){ 63 | 64 | if($this->_pointer >=0 && $this->_pointer < $this->_getNumResult()){ 65 | 66 | return TRUE; 67 | } 68 | else{ 69 | 70 | return FALSE; 71 | } 72 | 73 | } 74 | 75 | protected function _getRow($pointer){ 76 | 77 | if(isset($this->_result[$pointer])){ 78 | 79 | return $this->_result[$pointer]; 80 | } 81 | 82 | $row = NULL; 83 | 84 | if($this->_mode=='result'){ 85 | 86 | $row = mysql_fetch_object($this->_getQuery()); 87 | } 88 | elseif($this->_mode=='result_array'){ 89 | 90 | $row = mysql_fetch_array($this->_getQuery()); 91 | } 92 | 93 | if($row){ 94 | 95 | $this->_result[$pointer] = $row; 96 | } 97 | return $row; 98 | } 99 | function next(){ 100 | 101 | $row = $this->_getRow($this->_pointer); 102 | if($row){ 103 | 104 | $this->_pointer++; 105 | } 106 | 107 | return $row; 108 | } 109 | function current(){ 110 | 111 | return $this->_getRow($this->_pointer); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /pdo-search/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Search with PHP PDO & Mysql Script 4 | 5 | 6 | 7 |
8 |

Search with PHP-PDO & MySQL

9 |
10 | Search: 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | prepare("SELECT * FROM buku WHERE title LIKE :param OR author LIKE :param "); 33 | $query->bindValue(':param', '%'.$param.'%', PDO::PARAM_STR); 34 | $query->execute(); 35 | if($query->rowCount() > 0 ){ 36 | 37 | $no=1; 38 | while ($r = $query->fetch()) { 39 | 40 | echo ' 41 | 42 | 43 | 44 | 45 | 46 | '; 47 | 48 | ++$no; 49 | 50 | }//end while 51 | 52 | }else{ 53 | 54 | echo ""; 55 | } 56 | 57 | }//end if 58 | 59 | ?> 60 | 61 | 62 |
NoJudul BukuAuthorHarga
'.$no.''.$r['title'].''.$r['author'].'Rp'.$r['price'].'
Not Found
63 |
64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /pdo-search/index.php~: -------------------------------------------------------------------------------- 1 | 2 | 3 | Search with PHP PDO & Mysql Script 4 | 5 | 6 | 7 |
8 |

Search with PHP-PDO & MySQL

9 |
10 | Search: 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | prepare("SELECT * FROM buku WHERE title LIKE :param OR author LIKE :param "); 33 | $query->bindValue(':param', '%'.$param.'%', PDO::PARAM_STR); 34 | $query->execute(); 35 | if($query->rowCount() > 0 ){ 36 | 37 | $no=1; 38 | while ($r = $query->fetch()) { 39 | 40 | echo ' 41 | 42 | 43 | 44 | 45 | 46 | '; 47 | 48 | ++$no; 49 | 50 | }//end while 51 | 52 | }else{ 53 | 54 | echo ""; 55 | } 56 | 57 | }//end if 58 | 59 | ?> 60 | 61 | 62 |
NoJudul BukuAuthorHarga
'.$no.''.$r['title'].''.$r['author'].'Rp'.$r['price'].'
Not Found
63 |
64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /oop/class/pagination.php: -------------------------------------------------------------------------------- 1 | 1) 25 | { 26 | $pagination .= "Page $page of $jml_page "; 27 | if ($page > 1){ 28 | 29 | $pagination.= " << First < Prev "; 30 | } 31 | 32 | if( $jml_page < 10){ /*jika jml page < 10 pake paging biasa*/ 33 | if ($jml_page < 7 + ($limit * 2)) 34 | { 35 | for ($i = 1; $i <= $jml_page; $i++) 36 | { 37 | if ($i == $page) 38 | $pagination.= "$i "; 39 | else 40 | $pagination.= "$i "; 41 | } 42 | } 43 | elseif($jml_page > 5 + ($limit * 2)) 44 | { 45 | if($page < 1 + ($limit * 2)) 46 | { 47 | for ($i = 1; $i < 4 + ($limit * 2); $i++) 48 | { 49 | if ($i == $page){ 50 | $pagination.= "$i "; 51 | 52 | } 53 | else 54 | $pagination.= "$i "; 55 | } 56 | $pagination.= "..."; 57 | $pagination.= "$lpm1 "; 58 | $pagination.= "$jml_page "; 59 | } 60 | elseif($jml_page - ($limit * 2) > $page && $page > ($limit * 2)) 61 | { 62 | if($page==1) $satu.="1 "; 63 | else $satu=1; 64 | if($page==2) $dua.="2 "; 65 | else $dua=2; 66 | $pagination.= "$satu "; 67 | $pagination.= "$dua "; 68 | $pagination.= "..."; 69 | for ($i = $page - $limit; $i <= $page + $limit; $i++) 70 | { 71 | if ($i == $page) 72 | $pagination.= "$i "; 73 | else 74 | $pagination.= "$i "; 75 | } 76 | $pagination.= ".."; 77 | $pagination.= "$lpm1 "; 78 | $pagination.= "$jml_page "; 79 | } 80 | else 81 | { if($page==1) $satu.="1 "; 82 | else $satu=1; 83 | if($page==2) $dua.="2 "; 84 | else $dua=2; 85 | $pagination.= "$satu "; 86 | $pagination.= "$dua "; 87 | $pagination.= ".."; 88 | for ($i = $jml_page - (2 + ($limit * 2)); $i <= $jml_page; $i++) 89 | { 90 | if ($i == $page) 91 | $pagination.= "$i "; 92 | else 93 | $pagination.= "$i "; 94 | } 95 | } 96 | } 97 | } 98 | else{ /*kalo jmlpage na besar > 10 pake select value*/ 99 | 100 | $pagination.= ''; 112 | } 113 | if ($page < $i - 1){ 114 | $pagination.= "Next > "; 115 | $pagination.= "Last >>"; 116 | }else{ 117 | $pagination.= ""; 118 | $pagination.= ""; 119 | } 120 | $pagination.= "\n"; 121 | } 122 | 123 | return $pagination; 124 | } 125 | 126 | } 127 | -------------------------------------------------------------------------------- /oop/class/pagination.php~: -------------------------------------------------------------------------------- 1 | 1) 26 | { 27 | $pagination .= "Page $page of $jml_page "; 28 | if ($page > 1){ 29 | 30 | $pagination.= " << First < Prev "; 31 | } 32 | 33 | if( $jml_page < 10){ /*jika jml page < 10 pake paging biasa*/ 34 | if ($jml_page < 7 + ($limit * 2)) 35 | { 36 | for ($i = 1; $i <= $jml_page; $i++) 37 | { 38 | if ($i == $page) 39 | $pagination.= "$i "; 40 | else 41 | $pagination.= "$i "; 42 | } 43 | } 44 | elseif($jml_page > 5 + ($limit * 2)) 45 | { 46 | if($page < 1 + ($limit * 2)) 47 | { 48 | for ($i = 1; $i < 4 + ($limit * 2); $i++) 49 | { 50 | if ($i == $page){ 51 | $pagination.= "$i "; 52 | 53 | } 54 | else 55 | $pagination.= "$i "; 56 | } 57 | $pagination.= "..."; 58 | $pagination.= "$lpm1 "; 59 | $pagination.= "$jml_page "; 60 | } 61 | elseif($jml_page - ($limit * 2) > $page && $page > ($limit * 2)) 62 | { 63 | if($page==1) $satu.="1 "; 64 | else $satu=1; 65 | if($page==2) $dua.="2 "; 66 | else $dua=2; 67 | $pagination.= "$satu "; 68 | $pagination.= "$dua "; 69 | $pagination.= "..."; 70 | for ($i = $page - $limit; $i <= $page + $limit; $i++) 71 | { 72 | if ($i == $page) 73 | $pagination.= "$i "; 74 | else 75 | $pagination.= "$i "; 76 | } 77 | $pagination.= ".."; 78 | $pagination.= "$lpm1 "; 79 | $pagination.= "$jml_page "; 80 | } 81 | else 82 | { if($page==1) $satu.="1 "; 83 | else $satu=1; 84 | if($page==2) $dua.="2 "; 85 | else $dua=2; 86 | $pagination.= "$satu "; 87 | $pagination.= "$dua "; 88 | $pagination.= ".."; 89 | for ($i = $jml_page - (2 + ($limit * 2)); $i <= $jml_page; $i++) 90 | { 91 | if ($i == $page) 92 | $pagination.= "$i "; 93 | else 94 | $pagination.= "$i "; 95 | } 96 | } 97 | } 98 | } 99 | else{ /*kalo jmlpage na besar > 10 pake select value*/ 100 | 101 | $pagination.= ''; 113 | } 114 | if ($page < $i - 1){ 115 | $pagination.= "Next > "; 116 | $pagination.= "Last >>"; 117 | }else{ 118 | $pagination.= ""; 119 | $pagination.= ""; 120 | } 121 | $pagination.= "\n"; 122 | } 123 | 124 | return $pagination; 125 | } 126 | 127 | } -------------------------------------------------------------------------------- /rich-editor/article.sql: -------------------------------------------------------------------------------- 1 | -- phpMyAdmin SQL Dump 2 | -- version 4.0.9 3 | -- http://www.phpmyadmin.net 4 | -- 5 | -- Host: localhost 6 | -- Generation Time: Sep 19, 2014 at 09:59 AM 7 | -- Server version: 5.5.34 8 | -- PHP Version: 5.4.22 9 | 10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 11 | SET time_zone = "+00:00"; 12 | 13 | 14 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 15 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 16 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 17 | /*!40101 SET NAMES utf8 */; 18 | 19 | -- 20 | -- Database: `test` 21 | -- 22 | 23 | -- -------------------------------------------------------- 24 | 25 | -- 26 | -- Table structure for table `article` 27 | -- 28 | 29 | CREATE TABLE IF NOT EXISTS `article` ( 30 | `id` int(11) NOT NULL AUTO_INCREMENT, 31 | `title` varchar(200) NOT NULL, 32 | `content` longtext NOT NULL, 33 | PRIMARY KEY (`id`) 34 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; 35 | 36 | -- 37 | -- Dumping data for table `article` 38 | -- 39 | 40 | INSERT INTO `article` (`id`, `title`, `content`) VALUES 41 | (1, 'Testing Ganjar', '

dscscdsc

sdcsdc

sdcsd

dscsdc

csdcsdcsdcsdcsdcsdcdsc

'), 42 | (4, 'COba in testing', '
sdcsdc
dscsdc
sdcsdc
sdcsd

csdcsdcdsc

dscsd

dcsdcsdcsdcsdcsdc

'), 43 | (5, 'Sains & Teknologi', '

Hallo Thank you for visitong Sains & Teknologi 

Have a nice day

'), 44 | (6, 'Hold on kid, this girl is mine', '

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ''Content here, content here'', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for ''lorem ipsum'' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). 

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ''Content here, content here'', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for ''lorem ipsum'' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). 

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ''Content here, content here'', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for ''lorem ipsum'' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). 

'), 45 | (7, 'Simon Si Peniup Salju', '

Holaaaaaaaaaaaa

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ''Content here, content here'', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for ''lorem ipsum'' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).

'); 46 | 47 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 48 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 49 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 50 | -------------------------------------------------------------------------------- /oop/class/db.php~: -------------------------------------------------------------------------------- 1 | ','<','!=','>=','>=','<>','LIKE','OR'); 12 | 13 | 14 | public function __construct(){ 15 | 16 | //$this->_conn = dbConnect::getConnection(); 17 | $this->_connAccess = dbConnect::cekInstance(); 18 | 19 | } 20 | private function includeIterator(){ 21 | 22 | require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'iterator.php'; 23 | } 24 | public function execute($sql){ 25 | 26 | $exe = mysql_query($sql,$this->_connAccess->getConnection()); 27 | 28 | if(!$exe) 29 | exit('Error : '.mysql_error().':'.$sql); 30 | else{ 31 | return $exe; 32 | dbConnect::closeConnection(); 33 | } 34 | } 35 | public function getRow(){ 36 | 37 | mysql_fetch_object($this->execute()); 38 | } 39 | function insert($table,array $data){ 40 | 41 | $sql = "INSERT INTO ".$table." SET"; 42 | 43 | foreach((array) $data as $field=>$value){ 44 | 45 | $sql.= " ".$field." = '".mysql_real_escape_string($value)."',"; 46 | } 47 | $sql = rtrim($sql,','); 48 | $this->execute($sql); 49 | 50 | } 51 | function update($table,$data,$where=NULL){ 52 | 53 | $sql ="UPDATE ".$table." SET "; 54 | if(is_array($data)){ 55 | foreach((array) $data as $field=>$value){ 56 | 57 | $sql.= " ".$field." = '".mysql_real_escape_string($value)."',"; 58 | } 59 | } 60 | $sql = rtrim($sql,','); 61 | $sql.=" WHERE 1=1 "; 62 | 63 | if($where){ 64 | 65 | if(is_array($where)){ 66 | 67 | foreach((array) $where as $field=>$value){ 68 | 69 | $sql.=" AND ".$field." = '".mysql_real_escape_string($value)."' "; 70 | } 71 | } 72 | else{ 73 | 74 | print('Error, WHERE clause is not an array'); 75 | } 76 | } 77 | //echo $sql;exit; 78 | $this->execute($sql); 79 | 80 | } 81 | 82 | function get($table){ 83 | 84 | $sql = "SELECT * FROM ".$table." WHERE 1=1 "; 85 | 86 | if($sql){ 87 | 88 | $this->_sql = $sql; 89 | } 90 | return $this; 91 | } 92 | function query($sql){ 93 | 94 | if(!empty($sql)) 95 | $this->_sql = $sql; 96 | 97 | return $this; 98 | } 99 | function result(){ 100 | 101 | $this->includeIterator(); 102 | return new Iterate ($this->_sql,'result'); 103 | 104 | } 105 | function resultArray(){ 106 | 107 | $this->includeIterator(); 108 | return new Iterate($this->_sql,'result_array'); 109 | 110 | } 111 | function num_rows(){ 112 | 113 | $data = $this->execute($this->_sql); 114 | return mysql_num_rows($data); 115 | } 116 | function getRows(){ 117 | 118 | $data = $this->execute($this->_sql); 119 | return mysql_fetch_object($data); 120 | } 121 | function getWhere($table,$where=NULL){ 122 | 123 | $this->includeIterator(); 124 | 125 | $sql = "SELECT * FROM ".$table." WHERE 1=1 "; 126 | if($where){ 127 | 128 | if(is_array($where)){ 129 | 130 | foreach((array) $where as $field=>$value){ 131 | 132 | /* agar where sesuai kemauan User let's do this. */ 133 | $op_pos= $field." = "; 134 | foreach ((array)$this->_op as $op){ 135 | 136 | if(strpos($field,$op)!==FALSE){ 137 | 138 | $op_pos = $field; 139 | } 140 | 141 | } 142 | 143 | $sql.=" AND ".$op_pos." '".mysql_real_escape_string($value)."' "; 144 | } 145 | 146 | } 147 | else{ 148 | 149 | print('Error, WHERE clause is not an array'); 150 | } 151 | } 152 | echo '
';
153 | 		// echo $sql;
154 | 		// exit;
155 | 		if($sql)
156 | 			$this->_sql=$sql;
157 | 		
158 | 		return $this;
159 | 	}
160 | 	function delete($table,$where=NULL){
161 | 	
162 | 		$sql = "DELETE FROM ".$table." WHERE 1=1 ";
163 | 		
164 | 		if(!empty($where)){
165 | 			
166 | 			if(is_array($where)){
167 | 				
168 | 				foreach((array) $where as $field=>$val){
169 | 					
170 | 					$op_pos= $field." = ";
171 | 					foreach ((array)$this->_op as $op){
172 | 						
173 | 						if(strpos($field,$op)!==FALSE){
174 | 						
175 | 							$op_pos = $field; 
176 | 						}
177 | 						
178 | 					}
179 | 					
180 | 					$sql.=" AND ".$op_pos." '".mysql_real_escape_string($val)."' ";
181 | 				}
182 | 			
183 | 			}
184 | 			else{
185 | 				
186 | 				print('Paramater is not array, make it array first');
187 | 			}
188 | 		
189 | 		}
190 | 		
191 | 		$this->execute($sql);
192 | 		
193 | 	}
194 | 	
195 | }


--------------------------------------------------------------------------------
/oop/class/db.php:
--------------------------------------------------------------------------------
  1 | ','<','!=','>=','>=','<>','LIKE','OR');
 12 | 
 13 | 	
 14 | 	public function __construct(){
 15 | 		
 16 | 		//$this->_conn 	   = dbConnect::getConnection();
 17 | 		$this->_connAccess = dbConnect::cekInstance();
 18 | 		
 19 | 	}
 20 | 	private function includeIterator(){
 21 | 		
 22 | 		require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'iterator.php';
 23 | 	}
 24 | 	public function execute($sql){
 25 | 			
 26 | 		$exe = mysql_query($sql,$this->_connAccess->getConnection());
 27 | 		
 28 | 		if(!$exe)
 29 | 			exit('Error : '.mysql_error().':'.$sql);
 30 | 		else{ 
 31 | 			return $exe;
 32 | 			dbConnect::closeConnection();
 33 | 		}
 34 | 	}
 35 | 	public function getRow(){
 36 | 		
 37 | 		mysql_fetch_object($this->execute());
 38 | 	}
 39 | 	function insert($table,array $data){
 40 | 		
 41 | 		$sql = "INSERT INTO ".$table." SET";
 42 | 			
 43 | 			foreach((array) $data as $field=>$value){
 44 | 			
 45 | 				$sql.= " ".$field." = '".mysql_real_escape_string($value)."',";			
 46 | 			}
 47 | 			$sql = rtrim($sql,',');
 48 | 			$this->execute($sql);
 49 | 		
 50 | 	}
 51 | 	function update($table,$data,$where=NULL){
 52 | 		
 53 | 		$sql ="UPDATE ".$table." SET ";
 54 | 		if(is_array($data)){
 55 | 			foreach((array) $data as $field=>$value){
 56 | 				
 57 | 				$sql.= " ".$field." = '".mysql_real_escape_string($value)."',";			
 58 | 			}
 59 | 		}
 60 | 		$sql = rtrim($sql,','); 
 61 | 		$sql.=" WHERE 1=1 ";
 62 | 				
 63 | 		if($where){
 64 | 		
 65 | 			if(is_array($where)){
 66 | 				
 67 | 				foreach((array) $where as $field=>$value){
 68 | 					
 69 | 					$sql.=" AND ".$field." = '".mysql_real_escape_string($value)."' ";				
 70 | 				}			
 71 | 			}
 72 | 			else{
 73 | 				
 74 | 				print('Error, WHERE clause  is not an array');
 75 | 			}
 76 | 		}
 77 | 		//echo $sql;exit;
 78 | 		$this->execute($sql);
 79 | 			
 80 | 	}
 81 | 	
 82 | 	function get($table){
 83 | 				
 84 | 		$sql = "SELECT * FROM ".$table." WHERE 1=1 ";
 85 | 
 86 | 		if($sql){
 87 | 		
 88 | 			$this->_sql = $sql;
 89 | 		}
 90 | 		return $this;
 91 | 	}
 92 | 	function query($sql){
 93 | 		
 94 | 		if(!empty($sql))
 95 | 			$this->_sql = $sql;
 96 | 		
 97 | 		return $this;
 98 | 	}
 99 | 	function result(){
100 | 		
101 | 		$this->includeIterator();
102 | 		return new Iterate ($this->_sql,'result');
103 | 	
104 | 	}
105 | 	function resultArray(){
106 | 		
107 | 		$this->includeIterator();
108 | 		return new Iterate($this->_sql,'result_array');
109 | 	
110 | 	}
111 | 	function num_rows(){
112 | 		
113 | 		$data = $this->execute($this->_sql);
114 | 		return mysql_num_rows($data); 
115 | 	}
116 | 	function getRows(){
117 | 		
118 | 		$data = $this->execute($this->_sql);
119 | 		return mysql_fetch_object($data);
120 | 	}
121 | 	function getWhere($table,$where=NULL){
122 | 		
123 | 		$this->includeIterator();
124 | 		 
125 | 		$sql = "SELECT * FROM ".$table." WHERE 1=1 ";
126 | 		if($where){
127 | 						
128 | 			if(is_array($where)){
129 | 				
130 | 				foreach((array) $where as $field=>$value){
131 | 					
132 | 					/* agar where sesuai kemauan User let's do this. */
133 | 					$op_pos= $field." = ";
134 | 					foreach ((array)$this->_op as $op){
135 | 						
136 | 						if(strpos($field,$op)!==FALSE){
137 | 						
138 | 							$op_pos = $field; 
139 | 						}
140 | 						
141 | 					}
142 | 					
143 | 					$sql.=" AND ".$op_pos." '".mysql_real_escape_string($value)."' ";				
144 | 				}
145 | 			
146 | 			}
147 | 			else{
148 | 				
149 | 				print('Error, WHERE clause  is not an array');
150 | 			}
151 | 		}
152 | 		echo '
';
153 | 		// echo $sql;
154 | 		// exit;
155 | 		if($sql)
156 | 			$this->_sql=$sql;
157 | 		
158 | 		return $this;
159 | 	}
160 | 	function delete($table,$where=NULL){
161 | 	
162 | 		$sql = "DELETE FROM ".$table." WHERE 1=1 ";
163 | 		
164 | 		if(!empty($where)){
165 | 			
166 | 			if(is_array($where)){
167 | 				
168 | 				foreach((array) $where as $field=>$val){
169 | 					
170 | 					$op_pos= $field." = ";
171 | 					foreach ((array)$this->_op as $op){
172 | 						
173 | 						if(strpos($field,$op)!==FALSE){
174 | 						
175 | 							$op_pos = $field; 
176 | 						}
177 | 						
178 | 					}
179 | 					
180 | 					$sql.=" AND ".$op_pos." '".mysql_real_escape_string($val)."' ";
181 | 				}
182 | 			
183 | 			}
184 | 			else{
185 | 				
186 | 				print('Paramater is not array, make it array first');
187 | 			}
188 | 		
189 | 		}
190 | 		
191 | 		$this->execute($sql);
192 | 		
193 | 	}
194 | 	
195 | }
196 | 


--------------------------------------------------------------------------------
/rich-editor/dist/summernote.css:
--------------------------------------------------------------------------------
1 | .note-editor{position:relative;border:1px solid #a9a9a9}.note-editor .note-dropzone{position:absolute;z-index:1;display:none;color:#87cefa;background-color:white;border:2px dashed #87cefa;opacity:.95;pointer-event:none}.note-editor .note-dropzone .note-dropzone-message{display:table-cell;font-size:28px;font-weight:bold;text-align:center;vertical-align:middle}.note-editor .note-dropzone.hover{color:#098ddf;border:2px dashed #098ddf}.note-editor.dragover .note-dropzone{display:table}.note-editor .note-toolbar{background-color:#f5f5f5;border-bottom:1px solid #a9a9a9}.note-editor.fullscreen{position:fixed;top:0;left:0;z-index:1050;width:100%}.note-editor.fullscreen .note-editable{background-color:white}.note-editor.fullscreen .note-resizebar{display:none}.note-editor.codeview .note-editable{display:none}.note-editor.codeview .note-codable{display:block}.note-editor .note-statusbar{background-color:#f5f5f5}.note-editor .note-statusbar .note-resizebar{width:100%;height:8px;cursor:ns-resize;border-top:1px solid #a9a9a9}.note-editor .note-statusbar .note-resizebar .note-icon-bar{width:20px;margin:1px auto;border-top:1px solid #a9a9a9}.note-editor .note-editable{padding:10px;overflow:auto;outline:0}.note-editor .note-editable[contenteditable="false"]{background-color:#e5e5e5}.note-editor .note-codable{display:none;width:100%;padding:10px;margin-bottom:0;font-family:Menlo,Monaco,monospace,sans-serif;font-size:14px;color:#ccc;background-color:#222;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;box-shadow:none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;resize:none}.note-air-editor{outline:0}.note-popover .popover{max-width:none}.note-popover .popover .popover-content a{display:inline-block;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}.note-popover .popover .arrow{left:20px}.note-popover .popover .popover-content,.note-toolbar{padding:0 0 5px 5px;margin:0}.note-popover .popover .popover-content>.btn-group,.note-toolbar>.btn-group{margin-top:5px;margin-right:5px;margin-left:0}.note-popover .popover .popover-content .btn-group .note-table,.note-toolbar .btn-group .note-table{min-width:0;padding:5px}.note-popover .popover .popover-content .btn-group .note-table .note-dimension-picker,.note-toolbar .btn-group .note-table .note-dimension-picker{font-size:18px}.note-popover .popover .popover-content .btn-group .note-table .note-dimension-picker .note-dimension-picker-mousecatcher,.note-toolbar .btn-group .note-table .note-dimension-picker .note-dimension-picker-mousecatcher{position:absolute!important;z-index:3;width:10em;height:10em;cursor:pointer}.note-popover .popover .popover-content .btn-group .note-table .note-dimension-picker .note-dimension-picker-unhighlighted,.note-toolbar .btn-group .note-table .note-dimension-picker .note-dimension-picker-unhighlighted{position:relative!important;z-index:1;width:5em;height:5em;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC') repeat}.note-popover .popover .popover-content .btn-group .note-table .note-dimension-picker .note-dimension-picker-highlighted,.note-toolbar .btn-group .note-table .note-dimension-picker .note-dimension-picker-highlighted{position:absolute!important;z-index:2;width:1em;height:1em;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIjd6vvD2f9LKLW+AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKwNDEVT0AAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC') repeat}.note-popover .popover .popover-content .note-style h1,.note-toolbar .note-style h1,.note-popover .popover .popover-content .note-style h2,.note-toolbar .note-style h2,.note-popover .popover .popover-content .note-style h3,.note-toolbar .note-style h3,.note-popover .popover .popover-content .note-style h4,.note-toolbar .note-style h4,.note-popover .popover .popover-content .note-style h5,.note-toolbar .note-style h5,.note-popover .popover .popover-content .note-style h6,.note-toolbar .note-style h6,.note-popover .popover .popover-content .note-style blockquote,.note-toolbar .note-style blockquote{margin:0}.note-popover .popover .popover-content .note-color .dropdown-toggle,.note-toolbar .note-color .dropdown-toggle{width:20px;padding-left:5px}.note-popover .popover .popover-content .note-color .dropdown-menu,.note-toolbar .note-color .dropdown-menu{min-width:340px}.note-popover .popover .popover-content .note-color .dropdown-menu .btn-group,.note-toolbar .note-color .dropdown-menu .btn-group{margin:0}.note-popover .popover .popover-content .note-color .dropdown-menu .btn-group:first-child,.note-toolbar .note-color .dropdown-menu .btn-group:first-child{margin:0 5px}.note-popover .popover .popover-content .note-color .dropdown-menu .btn-group .note-palette-title,.note-toolbar .note-color .dropdown-menu .btn-group .note-palette-title{margin:2px 7px;font-size:12px;text-align:center;border-bottom:1px solid #eee}.note-popover .popover .popover-content .note-color .dropdown-menu .btn-group .note-color-reset,.note-toolbar .note-color .dropdown-menu .btn-group .note-color-reset{padding:0 3px;margin:3px;font-size:11px;cursor:pointer;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.note-popover .popover .popover-content .note-color .dropdown-menu .btn-group .note-color-row,.note-toolbar .note-color .dropdown-menu .btn-group .note-color-row{height:20px}.note-popover .popover .popover-content .note-color .dropdown-menu .btn-group .note-color-reset:hover,.note-toolbar .note-color .dropdown-menu .btn-group .note-color-reset:hover{background:#eee}.note-popover .popover .popover-content .note-para .dropdown-menu,.note-toolbar .note-para .dropdown-menu{min-width:216px;padding:5px}.note-popover .popover .popover-content .note-para .dropdown-menu>div:first-child,.note-toolbar .note-para .dropdown-menu>div:first-child{margin-right:5px}.note-popover .popover .popover-content .dropdown-menu,.note-toolbar .dropdown-menu{min-width:90px}.note-popover .popover .popover-content .dropdown-menu.right,.note-toolbar .dropdown-menu.right{right:0;left:auto}.note-popover .popover .popover-content .dropdown-menu.right::before,.note-toolbar .dropdown-menu.right::before{right:9px;left:auto!important}.note-popover .popover .popover-content .dropdown-menu.right::after,.note-toolbar .dropdown-menu.right::after{right:10px;left:auto!important}.note-popover .popover .popover-content .dropdown-menu li a i,.note-toolbar .dropdown-menu li a i{color:deepskyblue;visibility:hidden}.note-popover .popover .popover-content .dropdown-menu li a.checked i,.note-toolbar .dropdown-menu li a.checked i{visibility:visible}.note-popover .popover .popover-content .note-fontsize-10,.note-toolbar .note-fontsize-10{font-size:10px}.note-popover .popover .popover-content .note-color-palette,.note-toolbar .note-color-palette{line-height:1}.note-popover .popover .popover-content .note-color-palette div .note-color-btn,.note-toolbar .note-color-palette div .note-color-btn{width:20px;height:20px;padding:0;margin:0;border:1px solid #fff}.note-popover .popover .popover-content .note-color-palette div .note-color-btn:hover,.note-toolbar .note-color-palette div .note-color-btn:hover{border:1px solid #000}.note-dialog>div{display:none}.note-dialog .note-image-dialog .note-dropzone{min-height:100px;margin-bottom:10px;font-size:30px;line-height:4;color:lightgray;text-align:center;border:4px dashed lightgray}.note-dialog .note-help-dialog{font-size:12px;color:#ccc;background:transparent;background-color:#222!important;border:0;-webkit-opacity:.9;-khtml-opacity:.9;-moz-opacity:.9;opacity:.9;-ms-filter:alpha(opacity=90);filter:alpha(opacity=90)}.note-dialog .note-help-dialog .modal-content{background:transparent;border:1px solid white;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.note-dialog .note-help-dialog a{font-size:12px;color:white}.note-dialog .note-help-dialog .title{padding-bottom:5px;font-size:14px;font-weight:bold;color:white;border-bottom:white 1px solid}.note-dialog .note-help-dialog .modal-close{font-size:14px;color:#dd0;cursor:pointer}.note-dialog .note-help-dialog .note-shortcut-layout{width:100%}.note-dialog .note-help-dialog .note-shortcut-layout td{vertical-align:top}.note-dialog .note-help-dialog .note-shortcut{margin-top:8px}.note-dialog .note-help-dialog .note-shortcut th{font-size:13px;color:#dd0;text-align:left}.note-dialog .note-help-dialog .note-shortcut td:first-child{min-width:110px;padding-right:10px;font-family:"Courier New";color:#dd0;text-align:right}.note-handle .note-control-selection{position:absolute;display:none;border:1px solid black}.note-handle .note-control-selection>div{position:absolute}.note-handle .note-control-selection .note-control-selection-bg{width:100%;height:100%;background-color:black;-webkit-opacity:.3;-khtml-opacity:.3;-moz-opacity:.3;opacity:.3;-ms-filter:alpha(opacity=30);filter:alpha(opacity=30)}.note-handle .note-control-selection .note-control-handle{width:7px;height:7px;border:1px solid black}.note-handle .note-control-selection .note-control-holder{width:7px;height:7px;border:1px solid black}.note-handle .note-control-selection .note-control-sizing{width:7px;height:7px;background-color:white;border:1px solid black}.note-handle .note-control-selection .note-control-nw{top:-5px;left:-5px;border-right:0;border-bottom:0}.note-handle .note-control-selection .note-control-ne{top:-5px;right:-5px;border-bottom:0;border-left:none}.note-handle .note-control-selection .note-control-sw{bottom:-5px;left:-5px;border-top:0;border-right:0}.note-handle .note-control-selection .note-control-se{right:-5px;bottom:-5px;cursor:se-resize}.note-handle .note-control-selection .note-control-selection-info{right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:white;background-color:black;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-opacity:.7;-khtml-opacity:.7;-moz-opacity:.7;opacity:.7;-ms-filter:alpha(opacity=70);filter:alpha(opacity=70)}


--------------------------------------------------------------------------------
/rich-editor/dist/summernote.min.js:
--------------------------------------------------------------------------------
1 | !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(window.jQuery)}(function(a){"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){var c,d,e=this.length>>>0,f=!1;for(1c;++c)this.hasOwnProperty(c)&&(f?d=a(d,this[c],c,this):(d=this[c],f=!0));if(!f)throw new TypeError("Reduce of empty array with no initial value");return d}),"function"!=typeof Array.prototype.filter&&(Array.prototype.filter=function(a){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments.length>=2?arguments[1]:void 0,f=0;c>f;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g)}return d});var b,c="function"==typeof define&&define.amd,d=function(b){var c="Comic Sans MS"===b?"Courier New":"Comic Sans MS",d=a("
").css({position:"absolute",left:"-9999px",top:"-9999px",fontSize:"200px"}).text("mmmmmmmmmwwwwwww").appendTo(document.body),e=d.css("fontFamily",c).width(),f=d.css("fontFamily",b+","+c).width();return d.remove(),e!==f},e={isMac:navigator.appVersion.indexOf("Mac")>-1,isMSIE:navigator.userAgent.indexOf("MSIE")>-1||navigator.userAgent.indexOf("Trident")>-1,isFF:navigator.userAgent.indexOf("Firefox")>-1,jqueryVersion:parseFloat(a.fn.jquery),isSupportAmd:c,hasCodeMirror:c?require.specified("CodeMirror"):!!window.CodeMirror,isFontInstalled:d,isW3CRangeSupport:!!document.createRange},f=function(){var b=function(a){return function(b){return a===b}},c=function(a,b){return a===b},d=function(a){return function(b,c){return b[a]===c[a]}},e=function(){return!0},f=function(){return!1},g=function(a){return function(){return!a.apply(a,arguments)}},h=function(a,b){return function(c){return a(c)&&b(c)}},i=function(a){return a},j=0,k=function(a){var b=++j+"";return a?a+b:b},l=function(b){var c=a(document);return{top:b.top+c.scrollTop(),left:b.left+c.scrollLeft(),width:b.right-b.left,height:b.bottom-b.top}},m=function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[a[c]]=c);return b};return{eq:b,eq2:c,peq2:d,ok:e,fail:f,self:i,not:g,and:h,uniqueId:k,rect2bnd:l,invertObject:m}}(),g=function(){var a=function(a){return a[0]},b=function(a){return a[a.length-1]},c=function(a){return a.slice(0,a.length-1)},d=function(a){return a.slice(1)},e=function(a,b){for(var c=0,d=a.length;d>c;c++){var e=a[c];if(b(e))return e}},g=function(a,b){for(var c=0,d=a.length;d>c;c++)if(!b(a[c]))return!1;return!0},h=function(a,b){return-1!==a.indexOf(b)},i=function(a,b){return b=b||f.self,a.reduce(function(a,c){return a+b(c)},0)},j=function(a){for(var b=[],c=-1,d=a.length;++cc;c++)a[c]&&b.push(a[c]);return b},m=function(a){for(var b=[],c=0,d=a.length;d>c;c++)-1===b.indexOf(a[c])&&b.push(a[c]);return b};return{head:a,last:b,initial:c,tail:d,find:e,contains:h,all:g,sum:i,from:j,clusterBy:k,compact:l,unique:m}}(),h=String.fromCharCode(160),i="",j=function(){var b=function(b){return b&&a(b).hasClass("note-editable")},c=function(b){return b&&a(b).hasClass("note-control-sizing")},d=function(b){var c;if(b.hasClass("note-air-editor")){var d=g.last(b.attr("id").split("-"));return c=function(b){return function(){return a(b+d)}},{editor:function(){return b},editable:function(){return b},popover:c("#note-popover-"),handle:c("#note-handle-"),dialog:c("#note-dialog-")}}return c=function(a){return function(){return b.find(a)}},{editor:function(){return b},dropzone:c(".note-dropzone"),toolbar:c(".note-toolbar"),editable:c(".note-editable"),codable:c(".note-codable"),statusbar:c(".note-statusbar"),popover:c(".note-popover"),handle:c(".note-handle"),dialog:c(".note-dialog")}},k=function(a){return a=a.toUpperCase(),function(b){return b&&b.nodeName.toUpperCase()===a}},l=function(a){return a&&3===a.nodeType},m=function(a){return a&&/^BR|^IMG|^HR/.test(a.nodeName.toUpperCase())},n=function(a){return b(a)?!1:a&&/^DIV|^P|^LI|^H[1-7]/.test(a.nodeName.toUpperCase())},o=k("LI"),p=function(a){return n(a)&&!o(a)},q=function(a){return!u(a)&&!r(a)&&!n(a)},r=function(a){return a&&/^UL|^OL/.test(a.nodeName.toUpperCase())},s=function(a){return a&&/^TD|^TH/.test(a.nodeName.toUpperCase())},t=k("BLOCKQUOTE"),u=function(a){return s(a)||t(a)||b(a)},v=k("A"),w=function(a){return q(a)&&!!D(a,n)},x=function(a){return q(a)&&!D(a,n)},y=k("BODY"),z=e.isMSIE?" ":"
",A=function(a){return l(a)?a.nodeValue.length:a.childNodes.length},B=function(a){var b=A(a);return 0===b?!0:j.isText(a)||1!==b||a.innerHTML!==z?!1:!0},C=function(a){m(a)||A(a)||(a.innerHTML=z)},D=function(a,c){for(;a;){if(c(a))return a;if(b(a))break;a=a.parentNode}return null},E=function(a,c){c=c||f.fail;var d=[];return D(a,function(a){return b(a)||d.push(a),c(a)}),d},F=function(a,b){var c=E(a);return g.last(c.filter(b))},G=function(b,c){for(var d=E(b),e=c;e;e=e.parentNode)if(a.inArray(e,d)>-1)return e;return null},H=function(a,b){b=b||f.fail;for(var c=[];a&&!b(a);)c.push(a),a=a.previousSibling;return c},I=function(a,b){b=b||f.fail;for(var c=[];a&&!b(a);)c.push(a),a=a.nextSibling;return c},J=function(a,b){var c=[];return b=b||f.ok,function d(e){a!==e&&b(e)&&c.push(e);for(var f=0,g=e.childNodes.length;g>f;f++)d(e.childNodes[f])}(a),c},K=function(b,c){var d=b.parentNode,e=a("<"+c+">")[0];return d.insertBefore(e,b),e.appendChild(b),e},L=function(a,b){var c=b.nextSibling,d=b.parentNode;return c?d.insertBefore(a,c):d.appendChild(a),a},M=function(b,c){return a.each(c,function(a,c){b.appendChild(c)}),b},N=function(a){return 0===a.offset},O=function(a){return a.offset===A(a.node)},P=function(a){return N(a)||O(a)},Q=function(a,b){for(;a&&a!==b;){if(0!==S(a))return!1;a=a.parentNode}return!0},R=function(a,b){for(;a&&a!==b;){if(S(a)!==A(a.parentNode)-1)return!1;a=a.parentNode}return!0},S=function(a){for(var b=0;a=a.previousSibling;)b+=1;return b},T=function(a){return!!(a&&a.childNodes&&a.childNodes.length)},U=function(a,c){var d,e;if(0===a.offset){if(b(a.node))return null;d=a.node.parentNode,e=S(a.node)}else T(a.node)?(d=a.node.childNodes[a.offset-1],e=A(d)):(d=a.node,e=c?0:a.offset-1);return{node:d,offset:e}},V=function(a,c){var d,e;if(A(a.node)===a.offset){if(b(a.node))return null;d=a.node.parentNode,e=S(a.node)+1}else T(a.node)?(d=a.node.childNodes[a.offset],e=0):(d=a.node,e=c?A(a.node):a.offset+1);return{node:d,offset:e}},W=function(a,b){return a.node===b.node&&a.offset===b.offset},X=function(a){if(l(a.node)||!T(a.node)||B(a.node))return!0;var b=a.node.childNodes[a.offset-1],c=a.node.childNodes[a.offset];return b&&!m(b)||c&&!m(c)?!1:!0},Y=function(a,b){for(;a;){if(b(a))return a;a=U(a)}return null},Z=function(a,b){for(;a;){if(b(a))return a;a=V(a)}return null},$=function(a,b,c,d){for(var e=a;e&&(c(e),!W(e,b));){var f=d&&a.node!==e.node&&b.node!==e.node;e=V(e,f)}},_=function(b,c){var d=E(c,f.eq(b));return a.map(d,S).reverse()},ab=function(a,b){for(var c=a,d=0,e=b.length;e>d;d++)c=c.childNodes.length<=b[d]?c.childNodes[c.childNodes.length-1]:c.childNodes[b[d]];return c},bb=function(a,b){if(l(a.node))return N(a)?a.node:O(a)?a.node.nextSibling:a.node.splitText(a.offset);var c=a.node.childNodes[a.offset],d=L(a.node.cloneNode(!1),a.node);return M(d,I(c)),b||(C(a.node),C(d)),d},cb=function(a,b,c){var d=E(b.node,f.eq(a));return d.length?1===d.length?bb(b,c):d.reduce(function(a,d){var e=L(d.cloneNode(!1),d);return a===b.node&&(a=bb(b,c)),M(e,I(a)),c||(C(d),C(e)),e}):null},db=function(a){return document.createElement(a)},eb=function(a){return document.createTextNode(a)},fb=function(a,b){if(a&&a.parentNode){if(a.removeNode)return a.removeNode(b);var c=a.parentNode;if(!b){var d,e,f=[];for(d=0,e=a.childNodes.length;e>d;d++)f.push(a.childNodes[d]);for(d=0,e=f.length;e>d;d++)c.insertBefore(f[d],a)}c.removeChild(a)}},gb=function(a,c){for(;a&&!b(a)&&c(a);){var d=a.parentNode;fb(a),a=d}},hb=function(a,b){if(a.nodeName.toUpperCase()===b.toUpperCase())return a;var c=db(b);return a.style.cssText&&(c.style.cssText=a.style.cssText),M(c,g.from(a.childNodes)),L(c,a),fb(a),c},ib=k("TEXTAREA"),jb=function(b,c){var d=ib(b[0])?b.val():b.html();if(c){var e=/<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g;d=d.replace(e,function(a,b,c){c=c.toUpperCase();var d=/^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(c)&&!!b,e=/^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(c);return a+(d||e?"\n":"")}),d=a.trim(d)}return d},kb=function(a){var b=a.val();return b.replace(/[\n\r]/g,"")};return{NBSP_CHAR:h,ZERO_WIDTH_NBSP_CHAR:i,blank:z,emptyPara:"

"+z+"

",isEditable:b,isControlSizing:c,buildLayoutInfo:d,isText:l,isPara:n,isPurePara:p,isInline:q,isBodyInline:x,isBody:y,isParaInline:w,isList:r,isTable:k("TABLE"),isCell:s,isBlockquote:t,isBodyContainer:u,isAnchor:v,isDiv:k("DIV"),isLi:o,isSpan:k("SPAN"),isB:k("B"),isU:k("U"),isS:k("S"),isI:k("I"),isImg:k("IMG"),isTextarea:ib,isEmpty:B,isEmptyAnchor:f.and(v,B),nodeLength:A,isLeftEdgePoint:N,isRightEdgePoint:O,isEdgePoint:P,isLeftEdgeOf:Q,isRightEdgeOf:R,prevPoint:U,nextPoint:V,isSamePoint:W,isVisiblePoint:X,prevPointUntil:Y,nextPointUntil:Z,walkPoint:$,ancestor:D,listAncestor:E,lastAncestor:F,listNext:I,listPrev:H,listDescendant:J,commonAncestor:G,wrap:K,insertAfter:L,appendChildNodes:M,position:S,hasChildren:T,makeOffsetPath:_,fromOffsetPath:ab,splitTree:cb,create:db,createText:eb,remove:fb,removeWhile:gb,replace:hb,html:jb,value:kb}}(),k={version:"0.5.9",options:{width:null,height:null,minHeight:null,maxHeight:null,focus:!1,tabsize:4,styleWithSpan:!0,disableLinkTarget:!1,disableDragAndDrop:!1,disableResizeEditor:!1,codemirror:{mode:"text/html",htmlMode:!0,lineNumbers:!0},lang:"en-US",direction:null,toolbar:[["style",["style"]],["font",["bold","italic","underline","superscript","subscript","strikethrough","clear"]],["fontname",["fontname"]],["color",["color"]],["para",["ul","ol","paragraph"]],["height",["height"]],["table",["table"]],["insert",["link","picture","video","hr"]],["view",["fullscreen","codeview"]],["help",["help"]]],airMode:!1,airPopover:[["color",["color"]],["font",["bold","underline","clear"]],["para",["ul","paragraph"]],["table",["table"]],["insert",["link","picture"]]],styleTags:["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],defaultFontName:"Helvetica Neue",fontNames:["Arial","Arial Black","Comic Sans MS","Courier New","Helvetica Neue","Impact","Lucida Grande","Tahoma","Times New Roman","Verdana"],colors:[["#000000","#424242","#636363","#9C9C94","#CEC6CE","#EFEFEF","#F7F7F7","#FFFFFF"],["#FF0000","#FF9C00","#FFFF00","#00FF00","#00FFFF","#0000FF","#9C00FF","#FF00FF"],["#F7C6CE","#FFE7CE","#FFEFC6","#D6EFD6","#CEDEE7","#CEE7F7","#D6D6E7","#E7D6DE"],["#E79C9C","#FFC69C","#FFE79C","#B5D6A5","#A5C6CE","#9CC6EF","#B5A5D6","#D6A5BD"],["#E76363","#F7AD6B","#FFD663","#94BD7B","#73A5AD","#6BADDE","#8C7BC6","#C67BA5"],["#CE0000","#E79439","#EFC631","#6BA54A","#4A7B8C","#3984C6","#634AA5","#A54A7B"],["#9C0000","#B56308","#BD9400","#397B21","#104A5A","#085294","#311873","#731842"],["#630000","#7B3900","#846300","#295218","#083139","#003163","#21104A","#4A1031"]],fontSizes:["8","9","10","11","12","14","18","24","36"],lineHeights:["1.0","1.2","1.4","1.5","1.6","1.8","2.0","3.0"],insertTableMaxSize:{col:10,row:10},oninit:null,onfocus:null,onblur:null,onenter:null,onkeyup:null,onkeydown:null,onImageUpload:null,onImageUploadError:null,onToolbarClick:null,onCreateLink:function(a){return-1!==a.indexOf("@")&&-1===a.indexOf(":")?a="mailto:"+a:-1===a.indexOf("://")&&(a="http://"+a),a},keyMap:{pc:{ENTER:"insertParagraph","CTRL+Z":"undo","CTRL+Y":"redo",TAB:"tab","SHIFT+TAB":"untab","CTRL+B":"bold","CTRL+I":"italic","CTRL+U":"underline","CTRL+SHIFT+S":"strikethrough","CTRL+BACKSLASH":"removeFormat","CTRL+SHIFT+L":"justifyLeft","CTRL+SHIFT+E":"justifyCenter","CTRL+SHIFT+R":"justifyRight","CTRL+SHIFT+J":"justifyFull","CTRL+SHIFT+NUM7":"insertUnorderedList","CTRL+SHIFT+NUM8":"insertOrderedList","CTRL+LEFTBRACKET":"outdent","CTRL+RIGHTBRACKET":"indent","CTRL+NUM0":"formatPara","CTRL+NUM1":"formatH1","CTRL+NUM2":"formatH2","CTRL+NUM3":"formatH3","CTRL+NUM4":"formatH4","CTRL+NUM5":"formatH5","CTRL+NUM6":"formatH6","CTRL+ENTER":"insertHorizontalRule","CTRL+K":"showLinkDialog"},mac:{ENTER:"insertParagraph","CMD+Z":"undo","CMD+SHIFT+Z":"redo",TAB:"tab","SHIFT+TAB":"untab","CMD+B":"bold","CMD+I":"italic","CMD+U":"underline","CMD+SHIFT+S":"strikethrough","CMD+BACKSLASH":"removeFormat","CMD+SHIFT+L":"justifyLeft","CMD+SHIFT+E":"justifyCenter","CMD+SHIFT+R":"justifyRight","CMD+SHIFT+J":"justifyFull","CMD+SHIFT+NUM7":"insertUnorderedList","CMD+SHIFT+NUM8":"insertOrderedList","CMD+LEFTBRACKET":"outdent","CMD+RIGHTBRACKET":"indent","CMD+NUM0":"formatPara","CMD+NUM1":"formatH1","CMD+NUM2":"formatH2","CMD+NUM3":"formatH3","CMD+NUM4":"formatH4","CMD+NUM5":"formatH5","CMD+NUM6":"formatH6","CMD+ENTER":"insertHorizontalRule","CMD+K":"showLinkDialog"}}},lang:{"en-US":{font:{bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript",clear:"Remove Font Style",height:"Line Height",name:"Font Family",size:"Font Size"},image:{image:"Picture",insert:"Insert Image",resizeFull:"Resize Full",resizeHalf:"Resize Half",resizeQuarter:"Resize Quarter",floatLeft:"Float Left",floatRight:"Float Right",floatNone:"Float None",dragImageHere:"Drag an image here",selectFromFiles:"Select from files",url:"Image URL",remove:"Remove Image"},link:{link:"Link",insert:"Insert Link",unlink:"Unlink",edit:"Edit",textToDisplay:"Text to display",url:"To what URL should this link go?",openInNewWindow:"Open in new window"},video:{video:"Video",videoLink:"Video Link",insert:"Insert Video",url:"Video URL?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)"},table:{table:"Table"},hr:{insert:"Insert Horizontal Rule"},style:{style:"Style",normal:"Normal",blockquote:"Quote",pre:"Code",h1:"Header 1",h2:"Header 2",h3:"Header 3",h4:"Header 4",h5:"Header 5",h6:"Header 6"},lists:{unordered:"Unordered list",ordered:"Ordered list"},options:{help:"Help",fullscreen:"Full Screen",codeview:"Code View"},paragraph:{paragraph:"Paragraph",outdent:"Outdent",indent:"Indent",left:"Align left",center:"Align center",right:"Align right",justify:"Justify full"},color:{recent:"Recent Color",more:"More Color",background:"Background Color",foreground:"Foreground Color",transparent:"Transparent",setTransparent:"Set transparent",reset:"Reset",resetToDefault:"Reset to default"},shortcut:{shortcuts:"Keyboard shortcuts",close:"Close",textFormatting:"Text formatting",action:"Action",paragraphFormatting:"Paragraph formatting",documentStyle:"Document Style"},history:{undo:"Undo",redo:"Redo"}}}},l=function(){var b=function(b){return a.Deferred(function(c){a.extend(new FileReader,{onload:function(a){var b=a.target.result;c.resolve(b)},onerror:function(){c.reject(this)}}).readAsDataURL(b)}).promise()},c=function(b,c){return a.Deferred(function(d){a("").one("load",function(){d.resolve(a(this))}).one("error abort",function(){d.reject(a(this))}).css({display:"none"}).appendTo(document.body).attr("src",b).attr("data-filename",c)}).promise()};return{readFileAsDataURL:b,createImage:c}}(),m={isEdit:function(a){return-1!==[8,9,13,32].indexOf(a)},nameFromCode:{8:"BACKSPACE",9:"TAB",13:"ENTER",32:"SPACE",48:"NUM0",49:"NUM1",50:"NUM2",51:"NUM3",52:"NUM4",53:"NUM5",54:"NUM6",55:"NUM7",56:"NUM8",66:"B",69:"E",73:"I",74:"J",75:"K",76:"L",82:"R",83:"S",85:"U",89:"Y",90:"Z",191:"SLASH",219:"LEFTBRACKET",220:"BACKSLASH",221:"RIGHTBRACKET"}},n=function(){var b=function(b,c){if(e.jqueryVersion<1.9){var d={};return a.each(c,function(a,c){d[c]=b.css(c)}),d}return b.css.call(b,c)};this.stylePara=function(b,c){a.each(b.nodes(j.isPara,{includeAncestor:!0}),function(b,d){a(d).css(c)})},this.current=function(c,d){var e=a(j.isText(c.sc)?c.sc.parentNode:c.sc),f=["font-family","font-size","text-align","list-style-type","line-height"],g=b(e,f)||{};if(g["font-size"]=parseInt(g["font-size"],10),g["font-bold"]=document.queryCommandState("bold")?"bold":"normal",g["font-italic"]=document.queryCommandState("italic")?"italic":"normal",g["font-underline"]=document.queryCommandState("underline")?"underline":"normal",g["font-strikethrough"]=document.queryCommandState("strikeThrough")?"strikethrough":"normal",g["font-superscript"]=document.queryCommandState("superscript")?"superscript":"normal",g["font-subscript"]=document.queryCommandState("subscript")?"subscript":"normal",c.isOnList()){var h=["circle","disc","disc-leading-zero","square"],i=a.inArray(g["list-style-type"],h)>-1;g["list-style"]=i?"unordered":"ordered"}else g["list-style"]="none";var k=j.ancestor(c.sc,j.isPara);if(k&&k.style["line-height"])g["line-height"]=k.style.lineHeight;else{var l=parseInt(g["line-height"],10)/parseInt(g["font-size"],10);g["line-height"]=l.toFixed(1)}return g.image=j.isImg(d)&&d,g.anchor=c.isOnAnchor()&&j.ancestor(c.sc,j.isAnchor),g.ancestors=j.listAncestor(c.sc,j.isEditable),g.range=c,g}},o=function(){var b=function(a,b){var c,d,e=a.parentElement(),f=document.body.createTextRange(),h=g.from(e.childNodes);for(c=0;c=0)break;d=h[c]}if(0!==c&&j.isText(h[c-1])){var i=document.body.createTextRange(),k=null;i.moveToElementText(d||e),i.collapse(!d),k=d?d.nextSibling:e.firstChild;var l=a.duplicate();l.setEndPoint("StartToStart",i);for(var m=l.text.replace(/[\r\n]/g,"").length;m>k.nodeValue.length&&k.nextSibling;)m-=k.nodeValue.length,k=k.nextSibling;{k.nodeValue}b&&k.nextSibling&&j.isText(k.nextSibling)&&m===k.nodeValue.length&&(m-=k.nodeValue.length,k=k.nextSibling),e=k,c=m}return{cont:e,offset:c}},c=function(a){var b=function(a,c){var d,e;if(j.isText(a)){var h=j.listPrev(a,f.not(j.isText)),i=g.last(h).previousSibling;d=i||a.parentNode,c+=g.sum(g.tail(h),j.nodeLength),e=!i}else{if(d=a.childNodes[c]||a,j.isText(d))return b(d,0);c=0,e=!1}return{node:d,collapseToStart:e,offset:c}},c=document.body.createTextRange(),d=b(a.node,a.offset);return c.moveToElementText(d.node),c.collapse(d.collapseToStart),c.moveStart("character",d.offset),c},d=function(b,h,i,k){this.sc=b,this.so=h,this.ec=i,this.eo=k;var l=function(){if(e.isW3CRangeSupport){var a=document.createRange();return a.setStart(b,h),a.setEnd(i,k),a}var d=c({node:b,offset:h});return d.setEndPoint("EndToEnd",c({node:i,offset:k})),d};this.getPoints=function(){return{sc:b,so:h,ec:i,eo:k}},this.getStartPoint=function(){return{node:b,offset:h}},this.getEndPoint=function(){return{node:i,offset:k}},this.select=function(){var a=l();if(e.isW3CRangeSupport){var b=document.getSelection();b.rangeCount>0&&b.removeAllRanges(),b.addRange(a)}else a.select()},this.normalize=function(){var a=function(a){return j.isVisiblePoint(a)||(j.isLeftEdgePoint(a)?a=j.nextPointUntil(a,j.isVisiblePoint):j.isRightEdgePoint(a)&&(a=j.prevPointUntil(a,j.isVisiblePoint))),a},b=a(this.getStartPoint()),c=a(this.getStartPoint());return new d(b.node,b.offset,c.node,c.offset)},this.nodes=function(a,b){a=a||f.ok;var c=b&&b.includeAncestor,d=b&&b.fullyContains,e=this.getStartPoint(),h=this.getEndPoint(),i=[],k=[];return j.walkPoint(e,h,function(b){if(!j.isEditable(b.node)){var e;d?(j.isLeftEdgePoint(b)&&k.push(b.node),j.isRightEdgePoint(b)&&g.contains(k,b.node)&&(e=b.node)):e=c?j.ancestor(b.node,a):b.node,e&&a(e)&&i.push(e)}},!0),g.unique(i)},this.commonAncestor=function(){return j.commonAncestor(b,i)},this.expand=function(a){var c=j.ancestor(b,a),e=j.ancestor(i,a);if(!c&&!e)return new d(b,h,i,k);var f=this.getPoints();return c&&(f.sc=c,f.so=0),e&&(f.ec=e,f.eo=j.nodeLength(e)),new d(f.sc,f.so,f.ec,f.eo)},this.collapse=function(a){return a?new d(b,h,b,h):new d(i,k,i,k)},this.splitText=function(){var a=b===i,c=this.getPoints();return j.isText(i)&&!j.isEdgePoint(this.getEndPoint())&&i.splitText(k),j.isText(b)&&!j.isEdgePoint(this.getStartPoint())&&(c.sc=b.splitText(h),c.so=0,a&&(c.ec=c.sc,c.eo=k-h)),new d(c.sc,c.so,c.ec,c.eo)},this.deleteContents=function(){if(this.isCollapsed())return this;var b=this.splitText(),c=b.nodes(null,{fullyContains:!0}),e=j.prevPointUntil(b.getStartPoint(),function(a){return!g.contains(c,a.node)}),f=[];return a.each(c,function(a,b){var c=b.parentNode;e.node!==c&&1===j.nodeLength(c)&&f.push(c),j.remove(b,!1)}),a.each(f,function(a,b){j.remove(b,!1)}),new d(e.node,e.offset,e.node,e.offset)};var m=function(a){return function(){var c=j.ancestor(b,a);return!!c&&c===j.ancestor(i,a)}};this.isOnEditable=m(j.isEditable),this.isOnList=m(j.isList),this.isOnAnchor=m(j.isAnchor),this.isOnCell=m(j.isCell),this.isLeftEdgeOf=function(a){if(!j.isLeftEdgePoint(this.getStartPoint()))return!1;var b=j.ancestor(this.sc,a);return b&&j.isLeftEdgeOf(this.sc,b)},this.isCollapsed=function(){return b===i&&h===k},this.wrapBodyInlineWithPara=function(){if(j.isEditable(b)&&!b.childNodes[h])return new d(b.appendChild(a(j.emptyPara)[0]),0);if(!j.isInline(b)||j.isParaInline(b))return this;var c=j.listAncestor(b,f.not(j.isInline)),e=g.last(c);j.isInline(e)||(e=c[c.length-2]||b.childNodes[h]);var i=j.listPrev(e,j.isParaInline).reverse();if(i=i.concat(j.listNext(e.nextSibling,j.isParaInline)),i.length){var k=j.wrap(g.head(i),"p");j.appendChildNodes(k,g.tail(i))}return this},this.insertNode=function(a,b){var c,d,e,f=this.wrapBodyInlineWithPara(),h=f.getStartPoint();if(b)d=j.isPara(h.node)?h.node:h.node.parentNode,e=j.isPara(h.node)?h.node.childNodes[h.offset]:j.splitTree(h.node,h);else{var i=j.listAncestor(h.node,j.isBodyContainer),k=g.last(i)||h.node;j.isBodyContainer(k)?(c=i[i.length-2],d=k):(c=k,d=c.parentNode),e=c&&j.splitTree(c,h)}return e?e.parentNode.insertBefore(a,e):d.appendChild(a),a},this.toString=function(){var a=l();return e.isW3CRangeSupport?a.toString():a.text},this.bookmark=function(a){return{s:{path:j.makeOffsetPath(a,b),offset:h},e:{path:j.makeOffsetPath(a,i),offset:k}}},this.getClientRects=function(){var a=l();return a.getClientRects()}};return{create:function(a,c,f,g){if(arguments.length)2===arguments.length&&(f=a,g=c);else if(e.isW3CRangeSupport){var h=document.getSelection();if(0===h.rangeCount)return null;if(j.isBody(h.anchorNode))return null;var i=h.getRangeAt(0);a=i.startContainer,c=i.startOffset,f=i.endContainer,g=i.endOffset}else{var k=document.selection.createRange(),l=k.duplicate();l.collapse(!1);var m=k;m.collapse(!0);var n=b(m,!0),o=b(l,!1);a=n.cont,c=n.offset,f=o.cont,g=o.offset}return new d(a,c,f,g)},createFromNode:function(a){return this.create(a,0,a,1)},createFromBookmark:function(a,b){var c=j.fromOffsetPath(a,b.s.path),e=b.s.offset,f=j.fromOffsetPath(a,b.e.path),g=b.e.offset;return new d(c,e,f,g)}}}(),p=function(){this.insertTab=function(a,b,c){var d=j.createText(new Array(c+1).join(j.NBSP_CHAR));b=b.deleteContents(),b.insertNode(d,!0),b=o.create(d,c),b.select()},this.insertParagraph=function(){var b=o.create();b=b.deleteContents(),b=b.wrapBodyInlineWithPara();var c=j.ancestor(b.sc,j.isPara),d=j.splitTree(c,b.getStartPoint()),e=j.listDescendant(c,j.isEmptyAnchor);e=e.concat(j.listDescendant(d,j.isEmptyAnchor)),a.each(e,function(a,b){j.remove(b)}),o.create(d,0).normalize().select()}},q=function(){this.tab=function(a,b){var c=j.ancestor(a.commonAncestor(),j.isCell),d=j.ancestor(c,j.isTable),e=j.listDescendant(d,j.isCell),f=g[b?"prev":"next"](e,c);f&&o.create(f,0).select()},this.createTable=function(b,c){for(var d,e=[],f=0;b>f;f++)e.push(""+j.blank+"");d=e.join("");for(var g,h=[],i=0;c>i;i++)h.push(""+d+"");return g=h.join(""),a(''+g+"
")[0]}},r=function(){this.insertOrderedList=function(){this.toggleList("OL")},this.insertUnorderedList=function(){this.toggleList("UL")},this.indent=function(){var b=this,c=o.create().wrapBodyInlineWithPara(),d=c.nodes(j.isPara,{includeAncestor:!0}),e=g.clusterBy(d,f.peq2("parentNode"));a.each(e,function(c,d){var e=g.head(d);j.isLi(e)?b.wrapList(d,e.parentNode.nodeName):a.each(d,function(b,c){a(c).css("marginLeft",function(a,b){return(parseInt(b,10)||0)+25})})}),c.select()},this.outdent=function(){var b=this,c=o.create().wrapBodyInlineWithPara(),d=c.nodes(j.isPara,{includeAncestor:!0}),e=g.clusterBy(d,f.peq2("parentNode"));a.each(e,function(c,d){var e=g.head(d);j.isLi(e)?b.releaseList([d]):a.each(d,function(b,c){a(c).css("marginLeft",function(a,b){return b=parseInt(b,10)||0,b>25?b-25:""})})}),c.select()},this.toggleList=function(b){var c=this,d=o.create().wrapBodyInlineWithPara(),e=d.nodes(j.isPara,{includeAncestor:!0}),h=g.clusterBy(e,f.peq2("parentNode"));if(g.find(e,j.isPurePara))a.each(h,function(a,d){c.wrapList(d,b)});else{var i=d.nodes(j.isList,{includeAncestor:!0}).filter(function(c){return!a.nodeName(c,b)});i.length?a.each(i,function(a,c){j.replace(c,b)}):this.releaseList(h,!0)}d.select()},this.wrapList=function(b,c){var d=g.head(b),e=g.last(b),f=j.isList(d.previousSibling)&&d.previousSibling,h=j.isList(e.nextSibling)&&e.nextSibling,i=f||j.insertAfter(j.create(c||"UL"),e);b=a.map(b,function(a){return j.isPurePara(a)?j.replace(a,"LI"):a}),j.appendChildNodes(i,b),h&&(j.appendChildNodes(i,g.from(h.childNodes)),j.remove(h))},this.releaseList=function(b,c){var d=[];return a.each(b,function(b,e){var f=g.head(e),h=g.last(e),i=c?j.lastAncestor(f,j.isList):f.parentNode,k=i.childNodes.length>1?j.splitTree(i,{node:h.parentNode,offset:j.position(h)+1},!0):null,l=j.splitTree(i,{node:f.parentNode,offset:j.position(f)},!0);e=c?j.listDescendant(l,j.isLi):g.from(l.childNodes).filter(j.isLi),(c||!j.isList(i.parentNode))&&(e=a.map(e,function(a){return j.replace(a,"P")})),a.each(g.from(e).reverse(),function(a,b){j.insertAfter(b,i)});var m=g.compact([i,l,k]);a.each(m,function(b,c){var d=[c].concat(j.listDescendant(c,j.isList));a.each(d.reverse(),function(a,b){j.nodeLength(b)||j.remove(b,!0)})}),d=d.concat(e)}),d}},s=function(){var b=new n,c=new q,d=new p,f=new r;this.saveRange=function(a,b){a.focus(),a.data("range",o.create()),b&&o.create().collapse().select()},this.restoreRange=function(a){var b=a.data("range");b&&(b.select(),a.focus())},this.currentStyle=function(a){var c=o.create();return c?c.isOnEditable()&&b.current(c,a):!1};var h=this.triggerOnChange=function(a){var b=a.data("callbacks").onChange;b&&b(a.html(),a)};this.undo=function(a){a.data("NoteHistory").undo(),h(a)},this.redo=function(a){a.data("NoteHistory").redo(),h(a)};for(var i=this.afterCommand=function(a){a.data("NoteHistory").recordUndo(),h(a)},k=["bold","italic","underline","strikethrough","superscript","subscript","justifyLeft","justifyCenter","justifyRight","justifyFull","formatBlock","removeFormat","backColor","foreColor","insertHorizontalRule","fontName"],m=0,s=k.length;s>m;m++)this[k[m]]=function(a){return function(b,c){document.execCommand(a,!1,c),i(b)}}(k[m]);this.tab=function(a,b){var e=o.create();e.isCollapsed()&&e.isOnCell()?c.tab(e):(d.insertTab(a,e,b.tabsize),i(a))},this.untab=function(){var a=o.create();a.isCollapsed()&&a.isOnCell()&&c.tab(a,!0)},this.insertParagraph=function(a){d.insertParagraph(a),i(a)},this.insertOrderedList=function(a){f.insertOrderedList(a),i(a)},this.insertUnorderedList=function(a){f.insertUnorderedList(a),i(a)},this.indent=function(a){f.indent(a),i(a)},this.outdent=function(a){f.outdent(a),i(a)},this.insertImage=function(a,b,c){l.createImage(b,c).then(function(b){b.css({display:"",width:Math.min(a.width(),b.width())}),o.create().insertNode(b[0]),i(a)}).fail(function(){var b=a.data("callbacks");b.onImageUploadError&&b.onImageUploadError()})},this.insertVideo=function(b,c){var d,e=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/,f=c.match(e),g=/\/\/instagram.com\/p\/(.[a-zA-Z0-9]*)/,h=c.match(g),j=/\/\/vine.co\/v\/(.[a-zA-Z0-9]*)/,k=c.match(j),l=/\/\/(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/,m=c.match(l),n=/.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/,p=c.match(n),q=/\/\/v\.youku\.com\/v_show\/id_(\w+)\.html/,r=c.match(q);if(f&&11===f[2].length){var s=f[2];d=a("