ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç PKp\Auth.phpnu[CI = &get_instance(); $this->CI->load->model([ 'm_users', 'm_user_privileges' ]); } /** * Logged In() * @param String $user_name * @param String $user_password * @param String $ip_address * @return Boolean */ public function logged_in($user_name, $user_password, $ip_address) { $ip_banned = $this->ip_banned($ip_address); if ( ! $ip_banned ) { $query = $this->CI->m_users->logged_in($user_name); if ($query->num_rows() === 1) { $data = $query->row(); if (password_verify($user_password, $data->user_password)) { $session_data = [ 'user_id' => $data->id, 'user_name' => $data->user_name, 'user_email' => $data->user_email, 'user_type' => $data->user_type, 'user_profile_id' => $data->user_profile_id, 'has_login' => TRUE, 'user_privileges' => $this->CI->m_user_privileges->get_user_privileges($data->user_group_id, $data->user_type) ]; // If Student if ($data->user_type == 'student') { $student = $this->CI->model->RowObject('id', $data->user_profile_id, 'students'); $session_data['is_student'] = filter_var((string) $student->is_student, FILTER_VALIDATE_BOOLEAN); $session_data['is_prospective_student'] = filter_var((string) $student->is_prospective_student, FILTER_VALIDATE_BOOLEAN); $session_data['is_alumni'] = filter_var((string) $student->is_alumni, FILTER_VALIDATE_BOOLEAN); } $this->CI->session->set_userdata($session_data); $this->last_logged_in($data->id); $this->reset_attempts($ip_address); return TRUE; } return FALSE; } $this->increase_login_attempts($ip_address); return FALSE; } return FALSE; } /** * Get User ID * @return Integer | NULL **/ public function get_user_id() { $id = (int) __session('user_id'); return !empty($id) ? $id : NULL; } /** * Last Logged In * Fungsi untuk mengupdate data login terakhir * @param Integer $id * @return Void */ private function last_logged_in($id) { $this->CI->m_users->last_logged_in($id); } /** * Has Login * Fungsi untuk mengecek apakah data session user id kosong / tidak * @return Boolean */ public function hasLogin() { return (bool) __session('has_login'); } /** * Restrict * Fungsi untuk validasi status login * @return Boolean */ public function restrict() { if (!$this->hasLogin()) { redirect('login', 'refresh'); } } /** * check if user has ban by ip address * @param String $ip_address * @return Boolean */ public function ip_banned($ip_address) { $max_attempts = 10; $banned_time = 600; // 600 || Banned at 10 minutes $query = $this->CI->m_users->get_attempts($ip_address); if (is_object($query) && $query->counter >= $max_attempts) { $datetime = strtotime($query->updated_at); $time_diff = time() - $datetime; if ($time_diff >= $banned_time) { $this->reset_attempts($ip_address); return FALSE; } return TRUE; } return FALSE; } /** * Increase Login Attempts * @param String $ip_address * @return Void */ private function increase_login_attempts($ip_address) { $this->CI->m_users->increase_login_attempts($ip_address); } /** * Reset Login Attempts * Fungsi untuk menghapus data login attempts * @param String $ip_address * @return Void */ private function reset_attempts($ip_address) { $this->CI->m_users->reset_attempts($ip_address); } } PKp\X6vv Token.phpnu[CI = &get_instance(); if (NULL !== __session('token')) { $this->old_token = __session('token'); } } /** * Set Token * @return String */ private function set_token() { $ip = $_SERVER['REMOTE_ADDR']; $uniqid = uniqid(mt_rand(), true); return md5($ip . $uniqid); } /** * Get Token * @return String */ public function get_token() { $this->token = $this->set_token(); $this->CI->session->set_userdata('token', $this->token); return $this->token; } /** * Token validated * @return Boolean */ public function is_valid_token($token) { return $token === $this->old_token; } } PKp\~ A0A0 Admission.phpnu[CI = &get_instance(); } /** * Overide Header */ public function Header() { } /** * Overide Footer */ public function Footer() { $str = ''; $str .= ''; $str .= ''; $str .= ''; $str .= ''; $str .= ''; $str .= ''; $str .= '
Simpanlah lembar pendaftaran ini sebagai bukti pendaftaran Anda.Dicetak tanggal '.indo_date(date('Y-m-d')).' pukul '.date('H:i:s').'
'; $this->setY(-1); $this->writeHTML($str, true, false, true, false, 'L'); } /** * Create Admission PDF Form * @param Array $result */ public function create_pdf(array $result, $file_name) { $this->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $this->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $this->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $this->SetAutoPageBreak(TRUE, 1); $this->setImageScale(PDF_IMAGE_SCALE_RATIO); // Set Properties $this->SetTitle('FORMULIR PENERIMAAN '.ucwords(strtolower($this->CI->session->_student)).' BARU TAHUN '.$this->CI->session->admission_year); $this->SetAuthor('https://sekolahku.web.id'); $this->SetSubject($this->CI->session->school_name); $this->SetKeywords($this->CI->session->school_name); $this->SetCreator('https://sekolahku.web.id'); $this->SetMargins(2, 1, 2, true); $this->AddPage(); $this->SetFont('freesans', '', 10); // Get HTML Template $str = file_get_contents(VIEWPATH.'admission/pdf_admission_template.html'); // Header $str = str_replace('[LOGO]', base_url('media_library/images/'.$this->CI->session->logo), $str); $str = str_replace('[SCHOOL_NAME]', strtoupper($this->CI->session->school_name), $str); $str = str_replace('[SCHOOL_STREET_ADDRESS]', $this->CI->session->street_address, $str); $str = str_replace('[SCHOOL_PHONE]', $this->CI->session->phone, $str); $str = str_replace('[SCHOOL_FAX]', $this->CI->session->fax, $str); $str = str_replace('[SCHOOL_POSTAL_CODE]', $this->CI->session->postal_code, $str); $str = str_replace('[SCHOOL_EMAIL]', $this->CI->session->email, $str); $str = str_replace('[SCHOOL_WEBSITE]', str_replace(['http://', 'https://', 'www.'], '', $this->CI->session->website), $str); $str = str_replace('[TITLE]', 'Formulir Penerimaan ' . ucwords(strtolower($this->CI->session->_student)) .' Baru Tahun '.$this->CI->session->admission_year, $str); // Registrasi Peserta Didik $str = str_replace('[STUDENT_TYPE]', ($this->CI->session->school_level >= 5 ? 'Calon Mahasiswa' : 'Calon Peserta Didik'), $str); $str = str_replace('[IS_TRANSFER]', ($result['is_transfer'] == 'true' ? 'Pindahan':'Baru'), $str); $str = str_replace('[ADMISSION_TYPE]', $result['admission_type'], $str); $str = str_replace('[REGISTRATION_NUMBER]', $result['registration_number'], $str); $str = str_replace('[CREATED_AT]', $result['created_at'], $str); if ($this->CI->session->school_level >= 3) { $str = str_replace('[FIRST_CHOICE]', $result['first_choice'], $str); $str = str_replace('[SECOND_CHOICE]', $result['second_choice'], $str); } else { $replace = 'Pilihan I:[FIRST_CHOICE]'; $str = str_replace($replace, '', $str); $replace = 'Pilihan II:[SECOND_CHOICE]'; $str = str_replace($replace, '', $str); } $str = str_replace('[PREV_SCHOOL_NAME]', $result['prev_school_name'], $str); $str = str_replace('[PREV_SCHOOL_ADDRESS]', $result['prev_school_address'], $str); // Profile $str = str_replace('[FULL_NAME]', $result['full_name'], $str); $str = str_replace('[GENDER]', $result['gender'], $str); if ($this->CI->session->school_level == 2 || $this->CI->session->school_level == 3 || $this->CI->session->school_level == 4) { $str = str_replace('[NISN]', $result['nisn'], $str); } else { $replace = 'NISN:[NISN]'; $str = str_replace($replace, '', $str); } if ($this->CI->session->school_level > 1) { $str = str_replace('[NIK]', $result['nik'], $str); } else { $replace = 'NIK:[NIK]'; $str = str_replace($replace, '', $str); } $str = str_replace('[BIRTH_PLACE]', $result['birth_place'], $str); $str = str_replace('[BIRTH_DATE]', indo_date($result['birth_date']), $str); $str = str_replace('[RELIGION]', $result['religion'], $str); $str = str_replace('[SPECIAL_NEEDS]', $result['special_needs'], $str); // Alamat $str = str_replace('[STREET_ADDRESS]', $result['street_address'], $str); $str = str_replace('[RT]', $result['rt'], $str); $str = str_replace('[RW]', $result['rw'], $str); $str = str_replace('[SUB_VILLAGE]', $result['sub_village'], $str); $str = str_replace('[VILLAGE]', $result['village'], $str); $str = str_replace('[SUB_DISTRICT]', $result['sub_district'], $str); $str = str_replace('[DISTRICT]', $result['district'], $str); $str = str_replace('[POSTAL_CODE]', $result['postal_code'], $str); $str = str_replace('[EMAIL]', $result['email'], $str); $str = str_replace('[FOOTER_DATE]', $result['district'].', '. indo_date(substr($result['created_at'], 0, 10)), $str); $str = str_replace('[FOOTER_FULL_NAME]', $result['full_name'], $str); $this->writeHTML($str, true, false, true, false, 'C'); $this->Output(FCPATH . 'media_library/students/'.$file_name, 'F'); } /** * Generating Blank Admission PDF Form * @param Array $params */ public function blank_pdf(array $params) { $CI = &get_instance(); $this->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $this->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $this->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $this->SetAutoPageBreak(TRUE, 1); $this->setImageScale(PDF_IMAGE_SCALE_RATIO); // Set Properties $this->SetTitle('FORMULIR PENERIMAAN '.ucfirst(strtolower($this->CI->session->_student)).' BARU TAHUN '.$this->CI->session->admission_year); $this->SetAuthor('https://sekolahku.web.id'); $this->SetSubject($this->CI->session->school_name); $this->SetKeywords($this->CI->session->school_name); $this->SetCreator('https://sekolahku.web.id'); $this->SetMargins(2, 1, 2, true); $this->AddPage(); $this->SetFont('freesans', '', 10); // Get HTML Template $str = file_get_contents(VIEWPATH.'admission/pdf_admission_template.html'); // Header $str = str_replace('[LOGO]', base_url('media_library/images/'.$this->CI->session->logo), $str); $str = str_replace('[SCHOOL_NAME]', strtoupper($this->CI->session->school_name), $str); $str = str_replace('[SCHOOL_STREET_ADDRESS]', $this->CI->session->street_address, $str); $str = str_replace('[SCHOOL_PHONE]', $this->CI->session->phone, $str); $str = str_replace('[SCHOOL_FAX]', $this->CI->session->fax, $str); $str = str_replace('[SCHOOL_POSTAL_CODE]', $this->CI->session->postal_code, $str); $str = str_replace('[SCHOOL_EMAIL]', $this->CI->session->email, $str); $str = str_replace('[SCHOOL_WEBSITE]', str_replace(['http://', 'https://', 'www.'], '', $this->CI->session->website), $str); $str = str_replace('[TITLE]', 'Formulir Penerimaan ' . ucwords(strtolower($this->CI->session->_student)).' Baru Tahun '.$this->CI->session->admission_year, $str); $dotted = '.................................................................................................................'; $str = str_replace('[STUDENT_TYPE]', ucwords(strtolower($this->CI->session->_student)), $str); $str = str_replace('[IS_TRANSFER]', 'Baru / Pindahan', $str); $str = str_replace('[ADMISSION_TYPE]', (count($params['admission_types']) > 0 ? implode(' / ', $params['admission_types']) : $dotted), $str); $str = str_replace('[REGISTRATION_NUMBER]', '....................................................................................... ( Diisi Panitia )', $str); $str = str_replace('[CREATED_AT]', '....................................................................................... ( Diisi Panitia )', $str); // Registrasi Peserta Didik if ($this->CI->session->school_level >= 3) { $str = str_replace('[FIRST_CHOICE]', $dotted, $str); $str = str_replace('[SECOND_CHOICE]', $dotted, $str); } else { $replace = 'Pilihan I:[FIRST_CHOICE]'; $str = str_replace($replace, '', $str); $replace = 'Pilihan II:[SECOND_CHOICE]'; $str = str_replace($replace, '', $str); } // Sekolah Asal $str = str_replace('[PREV_SCHOOL_NAME]', $dotted, $str); // Alamat Sekolah Asal $str = str_replace('[PREV_SCHOOL_ADDRESS]', $dotted, $str); // Profile $str = str_replace('[FULL_NAME]', $dotted, $str); $str = str_replace('[GENDER]', 'Laki-laki / Perempuan', $str); if ($this->CI->session->school_level == 2 || $this->CI->session->school_level == 3 || $this->CI->session->school_level == 4) { $str = str_replace('[NISN]', $dotted, $str); } else { $replace = 'NISN:[NISN]'; $str = str_replace($replace, '', $str); } if ($this->CI->session->school_level > 1) { $str = str_replace('[NIK]', $dotted, $str); } else { $replace = 'NIK:[NIK]'; $str = str_replace($replace, '', $str); } $str = str_replace('[BIRTH_PLACE]', $dotted, $str); $str = str_replace('[BIRTH_DATE]', $dotted, $str); $str = str_replace('[RELIGION]', (count($params['religions']) > 0 ? implode(' / ', $params['religions']) : $dotted), $str); $str = str_replace('[SPECIAL_NEEDS]', (count($params['special_needs']) > 0 ? implode(' / ', $params['special_needs']) : $dotted), $str); // Alamat $str = str_replace('[STREET_ADDRESS]', $dotted, $str); $str = str_replace('[RT]', $dotted, $str); $str = str_replace('[RW]', $dotted, $str); $str = str_replace('[SUB_VILLAGE]', $dotted, $str); $str = str_replace('[VILLAGE]', $dotted, $str); $str = str_replace('[SUB_DISTRICT]', $dotted, $str); $str = str_replace('[DISTRICT]', $dotted, $str); $str = str_replace('[POSTAL_CODE]', $dotted, $str); $str = str_replace('[EMAIL]', $dotted, $str); $str = str_replace('[FOOTER_DATE]', '.............................................., ............. .................................... ' . $this->CI->session->admission_year, $str); $str = str_replace('[FOOTER_FULL_NAME]', '....................................................................', $str); $file_name = 'formulir-penerimaan-'. ($this->CI->session->school_level >= 5 ? 'mahasiswa' : 'peserta-didik').'-baru-tahun-'.$this->CI->session->admission_year; $file_name = strtoupper(str_replace(' ', '-', $file_name)).'.pdf'; $this->writeHTML($str, true, false, true, false, 'C'); $this->Output(__DIR__.'../../media_library/students/'.$file_name, 'I'); } } /* End of file Admission.php */ /* Location: ./application/libraries/Admission.php */ PKp\( index.htmlnu[ 403 Forbidden

Directory access is forbidden.

PKp\ Recaptcha.phpnu[CI = & get_instance(); $this->site_key = __session('recaptcha_site_key'); $this->secret_key = __session('recaptcha_secret_key'); if ( ! $this->site_key || ! $this->secret_key ) { die("Recaptcha site key dan secret key belum diatur. Silahkan masuk ke menu Pengaturan / Umum."); } } /** * Function for verifying user's input * @param string $response User's input * @param string $remoteIp Remote IP you wish to send to reCAPTCHA, if NULL $this->input->ip_address() will be called * @return Array Array of response */ public function verifyResponse($response, $remoteIp = NULL) { if ($response == NULL || strlen($response) == 0) { $response = [ 'success' => FALSE, 'error_codes' => 'missing-input' ]; } $getResponse = $this->_submitHttpGet( $this->siteVerifyURL, [ 'secret' => $this->secret_key, 'remoteip' => (!is_null($remoteIp)) ? $remoteIp : $this->CI->input->ip_address(), 'v' => $this->_version, 'response' => $response ] ); $res = json_decode($getResponse, TRUE); if ($res['success']) { $response = [ 'success' => TRUE, 'error_codes' => '' ]; } else { $response = [ 'success' => FALSE, 'error_codes' => $res['error-codes'] ]; } return $response; } /** * HTTP GET to communicate with reCAPTCHA server * @param String $path * @param Array $data * @return String JSON */ private function _submitHTTPGet($path, $data) { $req = $this->_encodeQS($data); $response = file_get_contents($path . $req); return $response; } /** * Function to convert an array into query string * @param Array $data Array of params * @return String query string of parameters */ private function _encodeQS($data) { $req = ""; foreach ($data as $key => $value) { $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; } return substr($req, 0, strlen($req) - 1); } } PK"\qY$@$@ Xmlrpcs.phpnu[set_system_methods(); if (isset($config['functions']) && is_array($config['functions'])) { $this->methods = array_merge($this->methods, $config['functions']); } log_message('info', 'XML-RPC Server Class Initialized'); } // -------------------------------------------------------------------- /** * Initialize Prefs and Serve * * @param mixed * @return void */ public function initialize($config = array()) { if (isset($config['functions']) && is_array($config['functions'])) { $this->methods = array_merge($this->methods, $config['functions']); } if (isset($config['debug'])) { $this->debug = $config['debug']; } if (isset($config['object']) && is_object($config['object'])) { $this->object = $config['object']; } if (isset($config['xss_clean'])) { $this->xss_clean = $config['xss_clean']; } } // -------------------------------------------------------------------- /** * Setting of System Methods * * @return void */ public function set_system_methods() { $this->methods = array( 'system.listMethods' => array( 'function' => 'this.listMethods', 'signature' => array(array($this->xmlrpcArray, $this->xmlrpcString), array($this->xmlrpcArray)), 'docstring' => 'Returns an array of available methods on this server'), 'system.methodHelp' => array( 'function' => 'this.methodHelp', 'signature' => array(array($this->xmlrpcString, $this->xmlrpcString)), 'docstring' => 'Returns a documentation string for the specified method'), 'system.methodSignature' => array( 'function' => 'this.methodSignature', 'signature' => array(array($this->xmlrpcArray, $this->xmlrpcString)), 'docstring' => 'Returns an array describing the return type and required parameters of a method'), 'system.multicall' => array( 'function' => 'this.multicall', 'signature' => array(array($this->xmlrpcArray, $this->xmlrpcArray)), 'docstring' => 'Combine multiple RPC calls in one request. See http://www.xmlrpc.com/discuss/msgReader$1208 for details') ); } // -------------------------------------------------------------------- /** * Main Server Function * * @return void */ public function serve() { $r = $this->parseRequest(); $payload = 'xmlrpc_defencoding.'"?'.'>'."\n".$this->debug_msg.$r->prepare_response(); header('Content-Type: text/xml'); header('Content-Length: '.strlen($payload)); exit($payload); } // -------------------------------------------------------------------- /** * Add Method to Class * * @param string method name * @param string function * @param string signature * @param string docstring * @return void */ public function add_to_map($methodname, $function, $sig, $doc) { $this->methods[$methodname] = array( 'function' => $function, 'signature' => $sig, 'docstring' => $doc ); } // -------------------------------------------------------------------- /** * Parse Server Request * * @param string data * @return object xmlrpc response */ public function parseRequest($data = '') { //------------------------------------- // Get Data //------------------------------------- if ($data === '') { $CI =& get_instance(); if ($CI->input->method() === 'post') { $data = $CI->input->raw_input_stream; } } //------------------------------------- // Set up XML Parser //------------------------------------- $parser = xml_parser_create($this->xmlrpc_defencoding); $parser_object = new XML_RPC_Message('filler'); $pname = (string) $parser; $parser_object->xh[$pname] = array( 'isf' => 0, 'isf_reason' => '', 'params' => array(), 'stack' => array(), 'valuestack' => array(), 'method' => '' ); xml_set_object($parser, $parser_object); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, TRUE); xml_set_element_handler($parser, 'open_tag', 'closing_tag'); xml_set_character_data_handler($parser, 'character_data'); //xml_set_default_handler($parser, 'default_handler'); //------------------------------------- // PARSE + PROCESS XML DATA //------------------------------------- if ( ! xml_parse($parser, $data, 1)) { // Return XML error as a faultCode $r = new XML_RPC_Response(0, $this->xmlrpcerrxml + xml_get_error_code($parser), sprintf('XML error: %s at line %d', xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); xml_parser_free($parser); } elseif ($parser_object->xh[$pname]['isf']) { return new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'], $this->xmlrpcstr['invalid_return']); } else { xml_parser_free($parser); $m = new XML_RPC_Message($parser_object->xh[$pname]['method']); $plist = ''; for ($i = 0, $c = count($parser_object->xh[$pname]['params']); $i < $c; $i++) { if ($this->debug === TRUE) { $plist .= $i.' - '.print_r(get_object_vars($parser_object->xh[$pname]['params'][$i]), TRUE).";\n"; } $m->addParam($parser_object->xh[$pname]['params'][$i]); } if ($this->debug === TRUE) { echo "
---PLIST---\n".$plist."\n---PLIST END---\n\n
"; } $r = $this->_execute($m); } //------------------------------------- // SET DEBUGGING MESSAGE //------------------------------------- if ($this->debug === TRUE) { $this->debug_msg = "\n"; } return $r; } // -------------------------------------------------------------------- /** * Executes the Method * * @param object * @return mixed */ protected function _execute($m) { $methName = $m->method_name; // Check to see if it is a system call $system_call = (strpos($methName, 'system') === 0); if ($this->xss_clean === FALSE) { $m->xss_clean = FALSE; } //------------------------------------- // Valid Method //------------------------------------- if ( ! isset($this->methods[$methName]['function'])) { return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); } //------------------------------------- // Check for Method (and Object) //------------------------------------- $method_parts = explode('.', $this->methods[$methName]['function']); $objectCall = ! empty($method_parts[1]); if ($system_call === TRUE) { if ( ! is_callable(array($this, $method_parts[1]))) { return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); } } elseif (($objectCall && ( ! method_exists($method_parts[0], $method_parts[1]) OR ! (new ReflectionMethod($method_parts[0], $method_parts[1]))->isPublic())) OR ( ! $objectCall && ! is_callable($this->methods[$methName]['function'])) ) { return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); } //------------------------------------- // Checking Methods Signature //------------------------------------- if (isset($this->methods[$methName]['signature'])) { $sig = $this->methods[$methName]['signature']; for ($i = 0, $c = count($sig); $i < $c; $i++) { $current_sig = $sig[$i]; if (count($current_sig) === count($m->params)+1) { for ($n = 0, $mc = count($m->params); $n < $mc; $n++) { $p = $m->params[$n]; $pt = ($p->kindOf() === 'scalar') ? $p->scalarval() : $p->kindOf(); if ($pt !== $current_sig[$n+1]) { $pno = $n+1; $wanted = $current_sig[$n+1]; return new XML_RPC_Response(0, $this->xmlrpcerr['incorrect_params'], $this->xmlrpcstr['incorrect_params'] . ': Wanted '.$wanted.', got '.$pt.' at param '.$pno.')'); } } } } } //------------------------------------- // Calls the Function //------------------------------------- if ($objectCall === TRUE) { if ($method_parts[0] === 'this' && $system_call === TRUE) { return call_user_func(array($this, $method_parts[1]), $m); } elseif ($this->object === FALSE) { return get_instance()->{$method_parts[1]}($m); } return $this->object->{$method_parts[1]}($m); } return call_user_func($this->methods[$methName]['function'], $m); } // -------------------------------------------------------------------- /** * Server Function: List Methods * * @param mixed * @return object */ public function listMethods($m) { $v = new XML_RPC_Values(); $output = array(); foreach ($this->methods as $key => $value) { $output[] = new XML_RPC_Values($key, 'string'); } foreach ($this->system_methods as $key => $value) { $output[] = new XML_RPC_Values($key, 'string'); } $v->addArray($output); return new XML_RPC_Response($v); } // -------------------------------------------------------------------- /** * Server Function: Return Signature for Method * * @param mixed * @return object */ public function methodSignature($m) { $parameters = $m->output_parameters(); $method_name = $parameters[0]; if (isset($this->methods[$method_name])) { if ($this->methods[$method_name]['signature']) { $sigs = array(); $signature = $this->methods[$method_name]['signature']; for ($i = 0, $c = count($signature); $i < $c; $i++) { $cursig = array(); $inSig = $signature[$i]; for ($j = 0, $jc = count($inSig); $j < $jc; $j++) { $cursig[]= new XML_RPC_Values($inSig[$j], 'string'); } $sigs[] = new XML_RPC_Values($cursig, 'array'); } return new XML_RPC_Response(new XML_RPC_Values($sigs, 'array')); } return new XML_RPC_Response(new XML_RPC_Values('undef', 'string')); } return new XML_RPC_Response(0, $this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']); } // -------------------------------------------------------------------- /** * Server Function: Doc String for Method * * @param mixed * @return object */ public function methodHelp($m) { $parameters = $m->output_parameters(); $method_name = $parameters[0]; if (isset($this->methods[$method_name])) { $docstring = isset($this->methods[$method_name]['docstring']) ? $this->methods[$method_name]['docstring'] : ''; return new XML_RPC_Response(new XML_RPC_Values($docstring, 'string')); } return new XML_RPC_Response(0, $this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']); } // -------------------------------------------------------------------- /** * Server Function: Multi-call * * @param mixed * @return object */ public function multicall($m) { // Disabled return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); $parameters = $m->output_parameters(); $calls = $parameters[0]; $result = array(); foreach ($calls as $value) { $m = new XML_RPC_Message($value[0]); $plist = ''; for ($i = 0, $c = count($value[1]); $i < $c; $i++) { $m->addParam(new XML_RPC_Values($value[1][$i], 'string')); } $attempt = $this->_execute($m); if ($attempt->faultCode() !== 0) { return $attempt; } $result[] = new XML_RPC_Values(array($attempt->value()), 'array'); } return new XML_RPC_Response(new XML_RPC_Values($result, 'array')); } // -------------------------------------------------------------------- /** * Multi-call Function: Error Handling * * @param mixed * @return object */ public function multicall_error($err) { $str = is_string($err) ? $this->xmlrpcstr["multicall_${err}"] : $err->faultString(); $code = is_string($err) ? $this->xmlrpcerr["multicall_${err}"] : $err->faultCode(); $struct['faultCode'] = new XML_RPC_Values($code, 'int'); $struct['faultString'] = new XML_RPC_Values($str, 'string'); return new XML_RPC_Values($struct, 'struct'); } // -------------------------------------------------------------------- /** * Multi-call Function: Processes method * * @param mixed * @return object */ public function do_multicall($call) { if ($call->kindOf() !== 'struct') { return $this->multicall_error('notstruct'); } elseif ( ! $methName = $call->me['struct']['methodName']) { return $this->multicall_error('nomethod'); } list($scalar_value, $scalar_type) = array(reset($methName->me), key($methName->me)); $scalar_type = $scalar_type === $this->xmlrpcI4 ? $this->xmlrpcInt : $scalar_type; if ($methName->kindOf() !== 'scalar' OR $scalar_type !== 'string') { return $this->multicall_error('notstring'); } elseif ($scalar_value === 'system.multicall') { return $this->multicall_error('recursion'); } elseif ( ! $params = $call->me['struct']['params']) { return $this->multicall_error('noparams'); } elseif ($params->kindOf() !== 'array') { return $this->multicall_error('notarray'); } list($b, $a) = array(reset($params->me), key($params->me)); $msg = new XML_RPC_Message($scalar_value); for ($i = 0, $numParams = count($b); $i < $numParams; $i++) { $msg->params[] = $params->me['array'][$i]; } $result = $this->_execute($msg); if ($result->faultCode() !== 0) { return $this->multicall_error($result); } return new XML_RPC_Values(array($result->value()), 'array'); } } PK"\B]00 Migration.phpnu[ $val) { $this->{'_'.$key} = $val; } log_message('info', 'Migrations Class Initialized'); // Are they trying to use migrations while it is disabled? if ($this->_migration_enabled !== TRUE) { show_error('Migrations has been loaded but is disabled or set up incorrectly.'); } // If not set, set it $this->_migration_path !== '' OR $this->_migration_path = APPPATH.'migrations/'; // Add trailing slash if not set $this->_migration_path = rtrim($this->_migration_path, '/').'/'; // Load migration language $this->lang->load('migration'); // They'll probably be using dbforge $this->load->dbforge(); // Make sure the migration table name was set. if (empty($this->_migration_table)) { show_error('Migrations configuration file (migration.php) must have "migration_table" set.'); } // Migration basename regex $this->_migration_regex = ($this->_migration_type === 'timestamp') ? '/^\d{14}_(\w+)$/' : '/^\d{3}_(\w+)$/'; // Make sure a valid migration numbering type was set. if ( ! in_array($this->_migration_type, array('sequential', 'timestamp'))) { show_error('An invalid migration numbering type was specified: '.$this->_migration_type); } // If the migrations table is missing, make it if ( ! $this->db->table_exists($this->_migration_table)) { $this->dbforge->add_field(array( 'version' => array('type' => 'BIGINT', 'constraint' => 20), )); $this->dbforge->create_table($this->_migration_table, TRUE); $this->db->insert($this->_migration_table, array('version' => 0)); } // Do we auto migrate to the latest migration? if ($this->_migration_auto_latest === TRUE && ! $this->latest()) { show_error($this->error_string()); } } // -------------------------------------------------------------------- /** * Migrate to a schema version * * Calls each migration step required to get to the schema version of * choice * * @param string $target_version Target schema version * @return mixed TRUE if no migrations are found, current version string on success, FALSE on failure */ public function version($target_version) { // Note: We use strings, so that timestamp versions work on 32-bit systems $current_version = $this->_get_version(); if ($this->_migration_type === 'sequential') { $target_version = sprintf('%03d', $target_version); } else { $target_version = (string) $target_version; } $migrations = $this->find_migrations(); if ($target_version > 0 && ! isset($migrations[$target_version])) { $this->_error_string = sprintf($this->lang->line('migration_not_found'), $target_version); return FALSE; } if ($target_version > $current_version) { $method = 'up'; } elseif ($target_version < $current_version) { $method = 'down'; // We need this so that migrations are applied in reverse order krsort($migrations); } else { // Well, there's nothing to migrate then ... return TRUE; } // Validate all available migrations within our target range. // // Unfortunately, we'll have to use another loop to run them // in order to avoid leaving the procedure in a broken state. // // See https://github.com/bcit-ci/CodeIgniter/issues/4539 $pending = array(); foreach ($migrations as $number => $file) { // Ignore versions out of our range. // // Because we've previously sorted the $migrations array depending on the direction, // we can safely break the loop once we reach $target_version ... if ($method === 'up') { if ($number <= $current_version) { continue; } elseif ($number > $target_version) { break; } } else { if ($number > $current_version) { continue; } elseif ($number <= $target_version) { break; } } // Check for sequence gaps if ($this->_migration_type === 'sequential') { if (isset($previous) && abs($number - $previous) > 1) { $this->_error_string = sprintf($this->lang->line('migration_sequence_gap'), $number); return FALSE; } $previous = $number; } include_once($file); $class = 'Migration_'.ucfirst(strtolower($this->_get_migration_name(basename($file, '.php')))); // Validate the migration file structure if ( ! class_exists($class, FALSE)) { $this->_error_string = sprintf($this->lang->line('migration_class_doesnt_exist'), $class); return FALSE; } elseif ( ! method_exists($class, $method) OR ! (new ReflectionMethod($class, $method))->isPublic()) { $this->_error_string = sprintf($this->lang->line('migration_missing_'.$method.'_method'), $class); return FALSE; } $pending[$number] = array($class, $method); } // Now just run the necessary migrations foreach ($pending as $number => $migration) { log_message('debug', 'Migrating '.$method.' from version '.$current_version.' to version '.$number); $migration[0] = new $migration[0]; call_user_func($migration); $current_version = $number; $this->_update_version($current_version); } // This is necessary when moving down, since the the last migration applied // will be the down() method for the next migration up from the target if ($current_version <> $target_version) { $current_version = $target_version; $this->_update_version($current_version); } log_message('debug', 'Finished migrating to '.$current_version); return $current_version; } // -------------------------------------------------------------------- /** * Sets the schema to the latest migration * * @return mixed Current version string on success, FALSE on failure */ public function latest() { $migrations = $this->find_migrations(); if (empty($migrations)) { $this->_error_string = $this->lang->line('migration_none_found'); return FALSE; } $last_migration = basename(end($migrations)); // Calculate the last migration step from existing migration // filenames and proceed to the standard version migration return $this->version($this->_get_migration_number($last_migration)); } // -------------------------------------------------------------------- /** * Sets the schema to the migration version set in config * * @return mixed TRUE if no migrations are found, current version string on success, FALSE on failure */ public function current() { return $this->version($this->_migration_version); } // -------------------------------------------------------------------- /** * Error string * * @return string Error message returned as a string */ public function error_string() { return $this->_error_string; } // -------------------------------------------------------------------- /** * Retrieves list of available migration scripts * * @return array list of migration file paths sorted by version */ public function find_migrations() { $migrations = array(); // Load all *_*.php files in the migrations path foreach (glob($this->_migration_path.'*_*.php') as $file) { $name = basename($file, '.php'); // Filter out non-migration files if (preg_match($this->_migration_regex, $name)) { $number = $this->_get_migration_number($name); // There cannot be duplicate migration numbers if (isset($migrations[$number])) { $this->_error_string = sprintf($this->lang->line('migration_multiple_version'), $number); show_error($this->_error_string); } $migrations[$number] = $file; } } ksort($migrations); return $migrations; } // -------------------------------------------------------------------- /** * Extracts the migration number from a filename * * @param string $migration * @return string Numeric portion of a migration filename */ protected function _get_migration_number($migration) { return sscanf($migration, '%[0-9]+', $number) ? $number : '0'; } // -------------------------------------------------------------------- /** * Extracts the migration class name from a filename * * @param string $migration * @return string text portion of a migration filename */ protected function _get_migration_name($migration) { $parts = explode('_', $migration); array_shift($parts); return implode('_', $parts); } // -------------------------------------------------------------------- /** * Retrieves current schema version * * @return string Current migration version */ protected function _get_version() { $row = $this->db->select('version')->get($this->_migration_table)->row(); return $row ? $row->version : '0'; } // -------------------------------------------------------------------- /** * Stores the current schema version * * @param string $migration Migration reached * @return void */ protected function _update_version($migration) { $this->db->update($this->_migration_table, array( 'version' => $migration )); } // -------------------------------------------------------------------- /** * Enable the use of CI super-global * * @param string $var * @return mixed */ public function __get($var) { return get_instance()->$var; } } PK"\4s@s@Pagination.phpnu['; /** * Current tag close * * @var string */ protected $cur_tag_close = ''; /** * Next tag open * * @var string */ protected $next_tag_open = ''; /** * Next tag close * * @var string */ protected $next_tag_close = ''; /** * Previous tag open * * @var string */ protected $prev_tag_open = ''; /** * Previous tag close * * @var string */ protected $prev_tag_close = ''; /** * Number tag open * * @var string */ protected $num_tag_open = ''; /** * Number tag close * * @var string */ protected $num_tag_close = ''; /** * Page query string flag * * @var bool */ protected $page_query_string = FALSE; /** * Query string segment * * @var string */ protected $query_string_segment = 'per_page'; /** * Display pages flag * * @var bool */ protected $display_pages = TRUE; /** * Attributes * * @var string */ protected $_attributes = ''; /** * Link types * * "rel" attribute * * @see CI_Pagination::_attr_rel() * @var array */ protected $_link_types = array(); /** * Reuse query string flag * * @var bool */ protected $reuse_query_string = FALSE; /** * Use global URL suffix flag * * @var bool */ protected $use_global_url_suffix = FALSE; /** * Data page attribute * * @var string */ protected $data_page_attr = 'data-ci-pagination-page'; /** * CI Singleton * * @var object */ protected $CI; // -------------------------------------------------------------------- /** * Constructor * * @param array $params Initialization parameters * @return void */ public function __construct($params = array()) { $this->CI =& get_instance(); $this->CI->load->language('pagination'); foreach (array('first_link', 'next_link', 'prev_link', 'last_link') as $key) { if (($val = $this->CI->lang->line('pagination_'.$key)) !== FALSE) { $this->$key = $val; } } // _parse_attributes(), called by initialize(), needs to run at least once // in order to enable "rel" attributes, and this triggers it. isset($params['attributes']) OR $params['attributes'] = array(); $this->initialize($params); log_message('info', 'Pagination Class Initialized'); } // -------------------------------------------------------------------- /** * Initialize Preferences * * @param array $params Initialization parameters * @return CI_Pagination */ public function initialize(array $params = array()) { if (isset($params['attributes']) && is_array($params['attributes'])) { $this->_parse_attributes($params['attributes']); unset($params['attributes']); } // Deprecated legacy support for the anchor_class option // Should be removed in CI 3.1+ if (isset($params['anchor_class'])) { empty($params['anchor_class']) OR $attributes['class'] = $params['anchor_class']; unset($params['anchor_class']); } foreach ($params as $key => $val) { if (property_exists($this, $key)) { $this->$key = $val; } } if ($this->CI->config->item('enable_query_strings') === TRUE) { $this->page_query_string = TRUE; } if ($this->use_global_url_suffix === TRUE) { $this->suffix = $this->CI->config->item('url_suffix'); } return $this; } // -------------------------------------------------------------------- /** * Generate the pagination links * * @return string */ public function create_links() { // If our item count or per-page total is zero there is no need to continue. // Note: DO NOT change the operator to === here! if ($this->total_rows == 0 OR $this->per_page == 0) { return ''; } // Calculate the total number of pages $num_pages = (int) ceil($this->total_rows / $this->per_page); // Is there only one page? Hm... nothing more to do here then. if ($num_pages === 1) { return ''; } // Check the user defined number of links. $this->num_links = (int) $this->num_links; if ($this->num_links < 0) { show_error('Your number of links must be a non-negative number.'); } // Keep any existing query string items. // Note: Has nothing to do with any other query string option. if ($this->reuse_query_string === TRUE) { $get = $this->CI->input->get(); // Unset the control, method, old-school routing options unset($get['c'], $get['m'], $get[$this->query_string_segment]); } else { $get = array(); } // Put together our base and first URLs. // Note: DO NOT append to the properties as that would break successive calls $base_url = trim($this->base_url); $first_url = $this->first_url; $query_string = ''; $query_string_sep = (strpos($base_url, '?') === FALSE) ? '?' : '&'; // Are we using query strings? if ($this->page_query_string === TRUE) { // If a custom first_url hasn't been specified, we'll create one from // the base_url, but without the page item. if ($first_url === '') { $first_url = $base_url; // If we saved any GET items earlier, make sure they're appended. if ( ! empty($get)) { $first_url .= $query_string_sep.http_build_query($get); } } // Add the page segment to the end of the query string, where the // page number will be appended. $base_url .= $query_string_sep.http_build_query(array_merge($get, array($this->query_string_segment => ''))); } else { // Standard segment mode. // Generate our saved query string to append later after the page number. if ( ! empty($get)) { $query_string = $query_string_sep.http_build_query($get); $this->suffix .= $query_string; } // Does the base_url have the query string in it? // If we're supposed to save it, remove it so we can append it later. if ($this->reuse_query_string === TRUE && ($base_query_pos = strpos($base_url, '?')) !== FALSE) { $base_url = substr($base_url, 0, $base_query_pos); } if ($first_url === '') { $first_url = $base_url.$query_string; } $base_url = rtrim($base_url, '/').'/'; } // Determine the current page number. $base_page = ($this->use_page_numbers) ? 1 : 0; // Are we using query strings? if ($this->page_query_string === TRUE) { $this->cur_page = $this->CI->input->get($this->query_string_segment); } elseif (empty($this->cur_page)) { // Default to the last segment number if one hasn't been defined. if ($this->uri_segment === 0) { $this->uri_segment = count($this->CI->uri->segment_array()); } $this->cur_page = $this->CI->uri->segment($this->uri_segment); // Remove any specified prefix/suffix from the segment. if ($this->prefix !== '' OR $this->suffix !== '') { $this->cur_page = str_replace(array($this->prefix, $this->suffix), '', $this->cur_page); } } else { $this->cur_page = (string) $this->cur_page; } // If something isn't quite right, back to the default base page. if ( ! ctype_digit($this->cur_page) OR ($this->use_page_numbers && (int) $this->cur_page === 0)) { $this->cur_page = $base_page; } else { // Make sure we're using integers for comparisons later. $this->cur_page = (int) $this->cur_page; } // Is the page number beyond the result range? // If so, we show the last page. if ($this->use_page_numbers) { if ($this->cur_page > $num_pages) { $this->cur_page = $num_pages; } } elseif ($this->cur_page > $this->total_rows) { $this->cur_page = ($num_pages - 1) * $this->per_page; } $uri_page_number = $this->cur_page; // If we're using offset instead of page numbers, convert it // to a page number, so we can generate the surrounding number links. if ( ! $this->use_page_numbers) { $this->cur_page = (int) floor(($this->cur_page/$this->per_page) + 1); } // Calculate the start and end numbers. These determine // which number to start and end the digit links with. $start = (($this->cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1; $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; // And here we go... $output = ''; // Render the "First" link. if ($this->first_link !== FALSE && $this->cur_page > ($this->num_links + 1 + ! $this->num_links)) { // Take the general parameters, and squeeze this pagination-page attr in for JS frameworks. $attributes = sprintf('%s %s="%d"', $this->_attributes, $this->data_page_attr, 1); $output .= $this->first_tag_open.'_attr_rel('start').'>' .$this->first_link.''.$this->first_tag_close; } // Render the "Previous" link. if ($this->prev_link !== FALSE && $this->cur_page !== 1) { $i = ($this->use_page_numbers) ? $uri_page_number - 1 : $uri_page_number - $this->per_page; $attributes = sprintf('%s %s="%d"', $this->_attributes, $this->data_page_attr, ($this->cur_page - 1)); if ($i === $base_page) { // First page $output .= $this->prev_tag_open.'_attr_rel('prev').'>' .$this->prev_link.''.$this->prev_tag_close; } else { $append = $this->prefix.$i.$this->suffix; $output .= $this->prev_tag_open.'_attr_rel('prev').'>' .$this->prev_link.''.$this->prev_tag_close; } } // Render the pages if ($this->display_pages !== FALSE) { // Write the digit links for ($loop = $start - 1; $loop <= $end; $loop++) { $i = ($this->use_page_numbers) ? $loop : ($loop * $this->per_page) - $this->per_page; $attributes = sprintf('%s %s="%d"', $this->_attributes, $this->data_page_attr, $loop); if ($i >= $base_page) { if ($this->cur_page === $loop) { // Current page $output .= $this->cur_tag_open.$loop.$this->cur_tag_close; } elseif ($i === $base_page) { // First page $output .= $this->num_tag_open.'_attr_rel('start').'>' .$loop.''.$this->num_tag_close; } else { $append = $this->prefix.$i.$this->suffix; $output .= $this->num_tag_open.'' .$loop.''.$this->num_tag_close; } } } } // Render the "next" link if ($this->next_link !== FALSE && $this->cur_page < $num_pages) { $i = ($this->use_page_numbers) ? $this->cur_page + 1 : $this->cur_page * $this->per_page; $attributes = sprintf('%s %s="%d"', $this->_attributes, $this->data_page_attr, $this->cur_page + 1); $output .= $this->next_tag_open.'_attr_rel('next').'>'.$this->next_link.''.$this->next_tag_close; } // Render the "Last" link if ($this->last_link !== FALSE && ($this->cur_page + $this->num_links + ! $this->num_links) < $num_pages) { $i = ($this->use_page_numbers) ? $num_pages : ($num_pages * $this->per_page) - $this->per_page; $attributes = sprintf('%s %s="%d"', $this->_attributes, $this->data_page_attr, $num_pages); $output .= $this->last_tag_open.'' .$this->last_link.''.$this->last_tag_close; } // Kill double slashes. Note: Sometimes we can end up with a double slash // in the penultimate link so we'll kill all double slashes. $output = preg_replace('#([^:"])//+#', '\\1/', $output); // Add the wrapper HTML if exists return $this->full_tag_open.$output.$this->full_tag_close; } // -------------------------------------------------------------------- /** * Parse attributes * * @param array $attributes * @return void */ protected function _parse_attributes($attributes) { isset($attributes['rel']) OR $attributes['rel'] = TRUE; $this->_link_types = ($attributes['rel']) ? array('start' => 'start', 'prev' => 'prev', 'next' => 'next') : array(); unset($attributes['rel']); $this->_attributes = ''; foreach ($attributes as $key => $value) { $this->_attributes .= ' '.$key.'="'.$value.'"'; } } // -------------------------------------------------------------------- /** * Add "rel" attribute * * @link https://www.w3.org/TR/html5/links.html#linkTypes * @param string $type * @return string */ protected function _attr_rel($type) { if (isset($this->_link_types[$type])) { unset($this->_link_types[$type]); return ' rel="'.$type.'"'; } return ''; } } PK"\~66Zip.phpnu[now = time(); log_message('info', 'Zip Compression Class Initialized'); } // -------------------------------------------------------------------- /** * Add Directory * * Lets you add a virtual directory into which you can place files. * * @param mixed $directory the directory name. Can be string or array * @return void */ public function add_dir($directory) { foreach ((array) $directory as $dir) { if ( ! preg_match('|.+/$|', $dir)) { $dir .= '/'; } $dir_time = $this->_get_mod_time($dir); $this->_add_dir($dir, $dir_time['file_mtime'], $dir_time['file_mdate']); } } // -------------------------------------------------------------------- /** * Get file/directory modification time * * If this is a newly created file/dir, we will set the time to 'now' * * @param string $dir path to file * @return array filemtime/filemdate */ protected function _get_mod_time($dir) { // filemtime() may return false, but raises an error for non-existing files $date = file_exists($dir) ? getdate(filemtime($dir)) : getdate($this->now); return array( 'file_mtime' => ($date['hours'] << 11) + ($date['minutes'] << 5) + $date['seconds'] / 2, 'file_mdate' => (($date['year'] - 1980) << 9) + ($date['mon'] << 5) + $date['mday'] ); } // -------------------------------------------------------------------- /** * Add Directory * * @param string $dir the directory name * @param int $file_mtime * @param int $file_mdate * @return void */ protected function _add_dir($dir, $file_mtime, $file_mdate) { $dir = str_replace('\\', '/', $dir); $this->zipdata .= "\x50\x4b\x03\x04\x0a\x00\x00\x00\x00\x00" .pack('v', $file_mtime) .pack('v', $file_mdate) .pack('V', 0) // crc32 .pack('V', 0) // compressed filesize .pack('V', 0) // uncompressed filesize .pack('v', self::strlen($dir)) // length of pathname .pack('v', 0) // extra field length .$dir // below is "data descriptor" segment .pack('V', 0) // crc32 .pack('V', 0) // compressed filesize .pack('V', 0); // uncompressed filesize $this->directory .= "\x50\x4b\x01\x02\x00\x00\x0a\x00\x00\x00\x00\x00" .pack('v', $file_mtime) .pack('v', $file_mdate) .pack('V',0) // crc32 .pack('V',0) // compressed filesize .pack('V',0) // uncompressed filesize .pack('v', self::strlen($dir)) // length of pathname .pack('v', 0) // extra field length .pack('v', 0) // file comment length .pack('v', 0) // disk number start .pack('v', 0) // internal file attributes .pack('V', 16) // external file attributes - 'directory' bit set .pack('V', $this->offset) // relative offset of local header .$dir; $this->offset = self::strlen($this->zipdata); $this->entries++; } // -------------------------------------------------------------------- /** * Add Data to Zip * * Lets you add files to the archive. If the path is included * in the filename it will be placed within a directory. Make * sure you use add_dir() first to create the folder. * * @param mixed $filepath A single filepath or an array of file => data pairs * @param string $data Single file contents * @return void */ public function add_data($filepath, $data = NULL) { if (is_array($filepath)) { foreach ($filepath as $path => $data) { $file_data = $this->_get_mod_time($path); $this->_add_data($path, $data, $file_data['file_mtime'], $file_data['file_mdate']); } } else { $file_data = $this->_get_mod_time($filepath); $this->_add_data($filepath, $data, $file_data['file_mtime'], $file_data['file_mdate']); } } // -------------------------------------------------------------------- /** * Add Data to Zip * * @param string $filepath the file name/path * @param string $data the data to be encoded * @param int $file_mtime * @param int $file_mdate * @return void */ protected function _add_data($filepath, $data, $file_mtime, $file_mdate) { $filepath = str_replace('\\', '/', $filepath); $uncompressed_size = self::strlen($data); $crc32 = crc32($data); $gzdata = self::substr(gzcompress($data, $this->compression_level), 2, -4); $compressed_size = self::strlen($gzdata); $this->zipdata .= "\x50\x4b\x03\x04\x14\x00\x00\x00\x08\x00" .pack('v', $file_mtime) .pack('v', $file_mdate) .pack('V', $crc32) .pack('V', $compressed_size) .pack('V', $uncompressed_size) .pack('v', self::strlen($filepath)) // length of filename .pack('v', 0) // extra field length .$filepath .$gzdata; // "file data" segment $this->directory .= "\x50\x4b\x01\x02\x00\x00\x14\x00\x00\x00\x08\x00" .pack('v', $file_mtime) .pack('v', $file_mdate) .pack('V', $crc32) .pack('V', $compressed_size) .pack('V', $uncompressed_size) .pack('v', self::strlen($filepath)) // length of filename .pack('v', 0) // extra field length .pack('v', 0) // file comment length .pack('v', 0) // disk number start .pack('v', 0) // internal file attributes .pack('V', 32) // external file attributes - 'archive' bit set .pack('V', $this->offset) // relative offset of local header .$filepath; $this->offset = self::strlen($this->zipdata); $this->entries++; $this->file_num++; } // -------------------------------------------------------------------- /** * Read the contents of a file and add it to the zip * * @param string $path * @param bool $archive_filepath * @return bool */ public function read_file($path, $archive_filepath = FALSE) { if (file_exists($path) && FALSE !== ($data = file_get_contents($path))) { if (is_string($archive_filepath)) { $name = str_replace('\\', '/', $archive_filepath); } else { $name = str_replace('\\', '/', $path); if ($archive_filepath === FALSE) { $name = preg_replace('|.*/(.+)|', '\\1', $name); } } $this->add_data($name, $data); return TRUE; } return FALSE; } // ------------------------------------------------------------------------ /** * Read a directory and add it to the zip. * * This function recursively reads a folder and everything it contains (including * sub-folders) and creates a zip based on it. Whatever directory structure * is in the original file path will be recreated in the zip file. * * @param string $path path to source directory * @param bool $preserve_filepath * @param string $root_path * @return bool */ public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL) { $path = rtrim($path, '/\\').DIRECTORY_SEPARATOR; if ( ! $fp = @opendir($path)) { return FALSE; } // Set the original directory root for child dir's to use as relative if ($root_path === NULL) { $root_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, dirname($path)).DIRECTORY_SEPARATOR; } while (FALSE !== ($file = readdir($fp))) { if ($file[0] === '.') { continue; } if (is_dir($path.$file)) { $this->read_dir($path.$file.DIRECTORY_SEPARATOR, $preserve_filepath, $root_path); } elseif (FALSE !== ($data = file_get_contents($path.$file))) { $name = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path); if ($preserve_filepath === FALSE) { $name = str_replace($root_path, '', $name); } $this->add_data($name.$file, $data); } } closedir($fp); return TRUE; } // -------------------------------------------------------------------- /** * Get the Zip file * * @return string (binary encoded) */ public function get_zip() { // Is there any data to return? if ($this->entries === 0) { return FALSE; } // @see https://github.com/bcit-ci/CodeIgniter/issues/5864 $footer = $this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00" .pack('v', $this->entries) // total # of entries "on this disk" .pack('v', $this->entries) // total # of entries overall .pack('V', self::strlen($this->directory)) // size of central dir .pack('V', self::strlen($this->zipdata)) // offset to start of central dir ."\x00\x00"; // .zip file comment length return $this->zipdata.$footer; } // -------------------------------------------------------------------- /** * Write File to the specified directory * * Lets you write a file * * @param string $filepath the file name * @return bool */ public function archive($filepath) { if ( ! ($fp = @fopen($filepath, 'w+b'))) { return FALSE; } flock($fp, LOCK_EX); for ($result = $written = 0, $data = $this->get_zip(), $length = self::strlen($data); $written < $length; $written += $result) { if (($result = fwrite($fp, self::substr($data, $written))) === FALSE) { break; } } flock($fp, LOCK_UN); fclose($fp); return is_int($result); } // -------------------------------------------------------------------- /** * Download * * @param string $filename the file name * @return void */ public function download($filename = 'backup.zip') { if ( ! preg_match('|.+?\.zip$|', $filename)) { $filename .= '.zip'; } get_instance()->load->helper('download'); $get_zip = $this->get_zip(); $zip_content =& $get_zip; force_download($filename, $zip_content); } // -------------------------------------------------------------------- /** * Initialize Data * * Lets you clear current zip data. Useful if you need to create * multiple zips with different data. * * @return CI_Zip */ public function clear_data() { $this->zipdata = ''; $this->directory = ''; $this->entries = 0; $this->file_num = 0; $this->offset = 0; return $this; } // -------------------------------------------------------------------- /** * Byte-safe strlen() * * @param string $str * @return int */ protected static function strlen($str) { return (self::$func_overload) ? mb_strlen($str, '8bit') : strlen($str); } // -------------------------------------------------------------------- /** * Byte-safe substr() * * @param string $str * @param int $start * @param int $length * @return string */ protected static function substr($str, $start, $length = NULL) { if (self::$func_overload) { // mb_substr($str, $start, null, '8bit') returns an empty // string on PHP 5.3 isset($length) OR $length = ($start >= 0 ? self::strlen($str) - $start : -$start); return mb_substr($str, $start, $length, '8bit'); } return isset($length) ? substr($str, $start, $length) : substr($str, $start); } } PK"\P T6T6Typography.phpnu[ tags * * @var string */ public $block_elements = 'address|blockquote|div|dl|fieldset|form|h\d|hr|noscript|object|ol|p|pre|script|table|ul'; /** * Elements that should not have

and
tags within them. * * @var string */ public $skip_elements = 'p|pre|ol|ul|dl|object|table|h\d'; /** * Tags we want the parser to completely ignore when splitting the string. * * @var string */ public $inline_elements = 'a|abbr|acronym|b|bdo|big|br|button|cite|code|del|dfn|em|i|img|ins|input|label|map|kbd|q|samp|select|small|span|strong|sub|sup|textarea|tt|var'; /** * array of block level elements that require inner content to be within another block level element * * @var array */ public $inner_block_required = array('blockquote'); /** * the last block element parsed * * @var string */ public $last_block_element = ''; /** * whether or not to protect quotes within { curly braces } * * @var bool */ public $protect_braced_quotes = FALSE; /** * Auto Typography * * This function converts text, making it typographically correct: * - Converts double spaces into paragraphs. * - Converts single line breaks into
tags * - Converts single and double quotes into correctly facing curly quote entities. * - Converts three dots into ellipsis. * - Converts double dashes into em-dashes. * - Converts two spaces into entities * * @param string * @param bool whether to reduce more then two consecutive newlines to two * @return string */ public function auto_typography($str, $reduce_linebreaks = FALSE) { if ($str === '') { return ''; } // Standardize Newlines to make matching easier if (strpos($str, "\r") !== FALSE) { $str = str_replace(array("\r\n", "\r"), "\n", $str); } // Reduce line breaks. If there are more than two consecutive linebreaks // we'll compress them down to a maximum of two since there's no benefit to more. if ($reduce_linebreaks === TRUE) { $str = preg_replace("/\n\n+/", "\n\n", $str); } // HTML comment tags don't conform to patterns of normal tags, so pull them out separately, only if needed $html_comments = array(); if (strpos($str, '