├── data ├── .htaccess ├── assets │ ├── .htaccess │ ├── img │ │ └── bg.gif │ ├── templates │ │ ├── partials │ │ │ └── twitter.php │ │ ├── layout.php │ │ ├── core │ │ │ ├── aside.php │ │ │ ├── navigation.php │ │ │ ├── footer.php │ │ │ └── header.php │ │ ├── layout_list.php │ │ ├── layout_blog_list.php │ │ └── layout_blog.php │ ├── js │ │ └── script.js │ └── css │ │ └── style.css ├── contact.md ├── blog │ ├── 20110429.md │ ├── 20110430.md │ └── 20110428.md ├── about.md └── index.md ├── lack ├── .htaccess ├── ci │ ├── .htaccess │ ├── index.html │ ├── core │ │ ├── index.html │ │ ├── Model.php │ │ ├── Controller.php │ │ ├── Benchmark.php │ │ ├── Lang.php │ │ ├── Utf8.php │ │ ├── Exceptions.php │ │ └── Hooks.php │ ├── database │ │ ├── index.html │ │ ├── drivers │ │ │ ├── index.html │ │ │ ├── mssql │ │ │ │ ├── index.html │ │ │ │ ├── mssql_utility.php │ │ │ │ └── mssql_result.php │ │ │ ├── mysql │ │ │ │ ├── index.html │ │ │ │ ├── mysql_result.php │ │ │ │ └── mysql_utility.php │ │ │ ├── mysqli │ │ │ │ ├── index.html │ │ │ │ ├── mysqli_utility.php │ │ │ │ └── mysqli_result.php │ │ │ ├── oci8 │ │ │ │ ├── index.html │ │ │ │ └── oci8_utility.php │ │ │ ├── odbc │ │ │ │ ├── index.html │ │ │ │ ├── odbc_utility.php │ │ │ │ └── odbc_result.php │ │ │ ├── postgre │ │ │ │ ├── index.html │ │ │ │ ├── postgre_utility.php │ │ │ │ └── postgre_result.php │ │ │ └── sqlite │ │ │ │ ├── index.html │ │ │ │ ├── sqlite_utility.php │ │ │ │ └── sqlite_result.php │ │ ├── DB.php │ │ └── DB_cache.php │ ├── fonts │ │ └── index.html │ ├── helpers │ │ ├── index.html │ │ ├── language_helper.php │ │ ├── email_helper.php │ │ ├── path_helper.php │ │ ├── xml_helper.php │ │ ├── number_helper.php │ │ ├── directory_helper.php │ │ ├── typography_helper.php │ │ ├── cookie_helper.php │ │ ├── array_helper.php │ │ ├── download_helper.php │ │ ├── security_helper.php │ │ └── inflector_helper.php │ ├── language │ │ ├── index.html │ │ └── english │ │ │ ├── index.html │ │ │ ├── number_lang.php │ │ │ ├── unit_test_lang.php │ │ │ ├── profiler_lang.php │ │ │ ├── ftp_lang.php │ │ │ ├── calendar_lang.php │ │ │ ├── upload_lang.php │ │ │ ├── email_lang.php │ │ │ ├── form_validation_lang.php │ │ │ ├── imglib_lang.php │ │ │ ├── db_lang.php │ │ │ └── date_lang.php │ └── libraries │ │ ├── index.html │ │ ├── Log.php │ │ ├── Cache │ │ ├── drivers │ │ │ ├── Cache_dummy.php │ │ │ ├── Cache_apc.php │ │ │ └── Cache_file.php │ │ └── Cache.php │ │ └── Parser.php ├── index.html ├── config │ ├── index.html │ ├── hooks.php │ ├── lack.php │ ├── profiler.php │ ├── doctypes.php │ ├── constants.php │ ├── routes.php │ ├── foreign_chars.php │ ├── database.php │ ├── smileys.php │ ├── autoload.php │ └── mimes.php ├── core │ └── index.html ├── errors │ ├── index.html │ ├── error_php.php │ ├── error_general.php │ ├── error_db.php │ └── error_404.php ├── helpers │ └── index.html ├── hooks │ └── index.html ├── models │ └── index.html ├── views │ └── index.html ├── controllers │ ├── index.html │ └── site.php ├── libraries │ ├── index.html │ └── Twitter.php ├── third_party │ └── index.html └── language │ └── english │ └── index.html ├── .gitignore ├── .htaccess └── README.md /data/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all -------------------------------------------------------------------------------- /lack/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all -------------------------------------------------------------------------------- /lack/ci/.htaccess: -------------------------------------------------------------------------------- 1 | Deny from all -------------------------------------------------------------------------------- /data/assets/.htaccess: -------------------------------------------------------------------------------- 1 | Allow from all -------------------------------------------------------------------------------- /data/assets/img/bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bstrahija/Lack/HEAD/data/assets/img/bg.gif -------------------------------------------------------------------------------- /data/assets/templates/partials/twitter.php: -------------------------------------------------------------------------------- 1 |

Twitter feed

2 | -------------------------------------------------------------------------------- /data/assets/templates/layout.php: -------------------------------------------------------------------------------- 1 | {header} 2 | 3 |
4 |
5 | {content} 6 |
7 |
8 | 9 | {footer} -------------------------------------------------------------------------------- /data/assets/templates/core/aside.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lack/ci/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /data/assets/js/script.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | $("p.profile .toggle").bind("click", function(e) { 3 | $("#codeigniter_profiler").toggle(); 4 | e.preventDefault(); 5 | }); 6 | }); -------------------------------------------------------------------------------- /lack/ci/core/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/config/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/core/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/errors/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/helpers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/hooks/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/models/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/views/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/database/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/fonts/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/helpers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/language/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/libraries/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/controllers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/libraries/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/third_party/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/language/english/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.bak 3 | Thumbs.db 4 | desktop.ini 5 | .DS_Store 6 | .buildpath 7 | .project 8 | .settings 9 | assts/cache/* 10 | lack/logs/* 11 | lack/cache/* 12 | nbproject/ 13 | .idea -------------------------------------------------------------------------------- /lack/ci/database/drivers/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/language/english/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/database/drivers/mssql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/database/drivers/mysql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/database/drivers/mysqli/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/database/drivers/oci8/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/database/drivers/odbc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/database/drivers/postgre/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /lack/ci/database/drivers/sqlite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 403 Forbidden 4 | 5 | 6 | 7 |

Directory access is forbidden.

8 | 9 | 10 | -------------------------------------------------------------------------------- /.htaccess: -------------------------------------------------------------------------------- 1 | 2 | RewriteEngine on 3 | Options +FollowSymLinks 4 | RewriteBase / 5 | 6 | RewriteCond %{REQUEST_FILENAME} !-f 7 | RewriteCond %{REQUEST_FILENAME} !-d 8 | RewriteRule ^(.*)$ index.php/$1 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /data/assets/templates/core/navigation.php: -------------------------------------------------------------------------------- 1 | 9 |
-------------------------------------------------------------------------------- /data/assets/templates/layout_list.php: -------------------------------------------------------------------------------- 1 | {header} 2 | 3 |
4 | 13 |
14 | 15 | {footer} -------------------------------------------------------------------------------- /lack/ci/language/english/number_lang.php: -------------------------------------------------------------------------------- 1 | 2 | 3 |

A PHP Error was encountered

4 | 5 |

Severity:

6 |

Message:

7 |

Filename:

8 |

Line Number:

9 | 10 | -------------------------------------------------------------------------------- /data/assets/templates/layout_blog_list.php: -------------------------------------------------------------------------------- 1 | {header} 2 | 3 |
4 |

Blog

5 | 6 | 17 |
18 | 19 | {footer} -------------------------------------------------------------------------------- /data/contact.md: -------------------------------------------------------------------------------- 1 | # Contact 2 | 3 | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. -------------------------------------------------------------------------------- /lack/config/hooks.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |

© 2011 Lack°, Creo

4 |

{memory_usage} • {elapsed_time}ms • #

5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /lack/config/lack.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Lack° 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

Lack°

19 |
20 |
21 | 22 | {aside} 23 | -------------------------------------------------------------------------------- /lack/controllers/site.php: -------------------------------------------------------------------------------- 1 | 7 | * @copyright Copyright (c) 2011, Boris Strahija, Creo 8 | * @version 0.1 9 | */ 10 | 11 | class Site extends CI_Controller { 12 | 13 | /* ------------------------------------------------------------------------------------------ */ 14 | 15 | /** 16 | * 17 | */ 18 | public function index() 19 | { 20 | // Load Lack 21 | $this->load->library('lack'); 22 | 23 | // Run it! 24 | Lack::run(); 25 | 26 | // Enable profiler 27 | $this->output->enable_profiler(true); 28 | 29 | } // index() 30 | 31 | 32 | /* ------------------------------------------------------------------------------------------ */ 33 | 34 | } // Site 35 | 36 | 37 | /* End of file site.php */ -------------------------------------------------------------------------------- /lack/ci/language/english/unit_test_lang.php: -------------------------------------------------------------------------------- 1 | '', 5 | 'xhtml1-strict' => '', 6 | 'xhtml1-trans' => '', 7 | 'xhtml1-frame' => '', 8 | 'html5' => '', 9 | 'html4-strict' => '', 10 | 'html4-trans' => '', 11 | 'html4-frame' => '' 12 | ); 13 | 14 | /* End of file doctypes.php */ 15 | /* Location: ./application/config/doctypes.php */ -------------------------------------------------------------------------------- /data/assets/templates/layout_blog.php: -------------------------------------------------------------------------------- 1 | {header} 2 | 3 |
4 |
5 | {content} 6 |
7 |
8 | 9 |

Comments

10 |
11 | 26 | 27 |
28 | 29 | {footer} -------------------------------------------------------------------------------- /lack/ci/language/english/profiler_lang.php: -------------------------------------------------------------------------------- 1 | $key; 51 | } 52 | } 53 | // END Model Class 54 | 55 | /* End of file Model.php */ 56 | /* Location: ./system/core/Model.php */ -------------------------------------------------------------------------------- /lack/errors/error_general.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Error 5 | 55 | 56 | 57 |
58 |

59 | 60 |
61 | 62 | -------------------------------------------------------------------------------- /lack/errors/error_db.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Database Error 5 | 55 | 56 | 57 |
58 |

59 | 60 |
61 | 62 | -------------------------------------------------------------------------------- /lack/errors/error_404.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 404 Page Not Found 5 | 55 | 56 | 57 |
58 |

59 | 60 |
61 | 62 | -------------------------------------------------------------------------------- /lack/ci/helpers/language_helper.php: -------------------------------------------------------------------------------- 1 | lang->line($line); 46 | 47 | if ($id != '') 48 | { 49 | $line = '"; 50 | } 51 | 52 | return $line; 53 | } 54 | } 55 | 56 | // ------------------------------------------------------------------------ 57 | /* End of file language_helper.php */ 58 | /* Location: ./system/helpers/language_helper.php */ -------------------------------------------------------------------------------- /lack/ci/language/english/calendar_lang.php: -------------------------------------------------------------------------------- 1 | 'ae', 12 | '/ö|œ/' => 'oe', 13 | '/ü/' => 'ue', 14 | '/Ä/' => 'Ae', 15 | '/Ü/' => 'Ue', 16 | '/Ö/' => 'Oe', 17 | '/À|Á|Â|Ã|Ä|Å|Ǻ|Ā|Ă|Ą|Ǎ/' => 'A', 18 | '/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/' => 'a', 19 | '/Ç|Ć|Ĉ|Ċ|Č/' => 'C', 20 | '/ç|ć|ĉ|ċ|č/' => 'c', 21 | '/Ð|Ď|Đ/' => 'D', 22 | '/ð|ď|đ/' => 'd', 23 | '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E', 24 | '/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e', 25 | '/Ĝ|Ğ|Ġ|Ģ/' => 'G', 26 | '/ĝ|ğ|ġ|ģ/' => 'g', 27 | '/Ĥ|Ħ/' => 'H', 28 | '/ĥ|ħ/' => 'h', 29 | '/Ì|Í|Î|Ï|Ĩ|Ī|Ĭ|Ǐ|Į|İ/' => 'I', 30 | '/ì|í|î|ï|ĩ|ī|ĭ|ǐ|į|ı/' => 'i', 31 | '/Ĵ/' => 'J', 32 | '/ĵ/' => 'j', 33 | '/Ķ/' => 'K', 34 | '/ķ/' => 'k', 35 | '/Ĺ|Ļ|Ľ|Ŀ|Ł/' => 'L', 36 | '/ĺ|ļ|ľ|ŀ|ł/' => 'l', 37 | '/Ñ|Ń|Ņ|Ň/' => 'N', 38 | '/ñ|ń|ņ|ň|ʼn/' => 'n', 39 | '/Ò|Ó|Ô|Õ|Ō|Ŏ|Ǒ|Ő|Ơ|Ø|Ǿ/' => 'O', 40 | '/ò|ó|ô|õ|ō|ŏ|ǒ|ő|ơ|ø|ǿ|º/' => 'o', 41 | '/Ŕ|Ŗ|Ř/' => 'R', 42 | '/ŕ|ŗ|ř/' => 'r', 43 | '/Ś|Ŝ|Ş|Š/' => 'S', 44 | '/ś|ŝ|ş|š|ſ/' => 's', 45 | '/Ţ|Ť|Ŧ/' => 'T', 46 | '/ţ|ť|ŧ/' => 't', 47 | '/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ/' => 'U', 48 | '/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u', 49 | '/Ý|Ÿ|Ŷ/' => 'Y', 50 | '/ý|ÿ|ŷ/' => 'y', 51 | '/Ŵ/' => 'W', 52 | '/ŵ/' => 'w', 53 | '/Ź|Ż|Ž/' => 'Z', 54 | '/ź|ż|ž/' => 'z', 55 | '/Æ|Ǽ/' => 'AE', 56 | '/ß/'=> 'ss', 57 | '/IJ/' => 'IJ', 58 | '/ij/' => 'ij', 59 | '/Œ/' => 'OE', 60 | '/ƒ/' => 'f' 61 | ); 62 | 63 | /* End of file foreign_chars.php */ 64 | /* Location: ./application/config/foreign_chars.php */ -------------------------------------------------------------------------------- /lack/ci/core/Controller.php: -------------------------------------------------------------------------------- 1 | $class) 45 | { 46 | $this->$var =& load_class($class); 47 | } 48 | 49 | $this->load =& load_class('Loader', 'core'); 50 | 51 | $this->load->set_base_classes()->ci_autoloader(); 52 | 53 | log_message('debug', "Controller Class Initialized"); 54 | } 55 | 56 | public static function &get_instance() 57 | { 58 | return self::$instance; 59 | } 60 | } 61 | // END Controller class 62 | 63 | /* End of file Controller.php */ 64 | /* Location: ./system/core/Controller.php */ -------------------------------------------------------------------------------- /lack/ci/language/english/form_validation_lang.php: -------------------------------------------------------------------------------- 1 | ","\"", "'", "-"), 53 | array("&", "<", ">", """, "'", "-"), 54 | $str); 55 | 56 | // Decode the temp markers back to entities 57 | $str = preg_replace("/$temp(\d+);/","&#\\1;",$str); 58 | 59 | if ($protect_all === TRUE) 60 | { 61 | $str = preg_replace("/$temp(\w+);/","&\\1;", $str); 62 | } 63 | 64 | return $str; 65 | } 66 | } 67 | 68 | // ------------------------------------------------------------------------ 69 | 70 | /* End of file xml_helper.php */ 71 | /* Location: ./system/helpers/xml_helper.php */ -------------------------------------------------------------------------------- /lack/ci/helpers/number_helper.php: -------------------------------------------------------------------------------- 1 | lang->load('number'); 43 | 44 | if ($num >= 1000000000000) 45 | { 46 | $num = round($num / 1099511627776, $precision); 47 | $unit = $CI->lang->line('terabyte_abbr'); 48 | } 49 | elseif ($num >= 1000000000) 50 | { 51 | $num = round($num / 1073741824, $precision); 52 | $unit = $CI->lang->line('gigabyte_abbr'); 53 | } 54 | elseif ($num >= 1000000) 55 | { 56 | $num = round($num / 1048576, $precision); 57 | $unit = $CI->lang->line('megabyte_abbr'); 58 | } 59 | elseif ($num >= 1000) 60 | { 61 | $num = round($num / 1024, $precision); 62 | $unit = $CI->lang->line('kilobyte_abbr'); 63 | } 64 | else 65 | { 66 | $unit = $CI->lang->line('bytes'); 67 | return number_format($num).' '.$unit; 68 | } 69 | 70 | return number_format($num, $precision).' '.$unit; 71 | } 72 | } 73 | 74 | 75 | /* End of file number_helper.php */ 76 | /* Location: ./system/helpers/number_helper.php */ -------------------------------------------------------------------------------- /lack/ci/database/drivers/postgre/postgre_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsuported_feature'); 83 | } 84 | } 85 | 86 | 87 | /* End of file postgre_utility.php */ 88 | /* Location: ./system/database/drivers/postgre/postgre_utility.php */ -------------------------------------------------------------------------------- /lack/ci/database/drivers/oci8/oci8_utility.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsuported_feature'); 83 | } 84 | } 85 | 86 | /* End of file oci8_utility.php */ 87 | /* Location: ./system/database/drivers/oci8/oci8_utility.php */ -------------------------------------------------------------------------------- /data/assets/css/style.css: -------------------------------------------------------------------------------- 1 | body { font-family: Palatino, Georgia, "Times New Roman", serif; color: #444; margin: 0; padding: 1em 2em; background: #f6f6f6 url(../img/bg.gif) repeat; text-shadow: 0 1px 0 #fff; } 2 | h1 { font-size: 38px; } 3 | h1 a { color: #777; text-decoration: none; } 4 | h1 a:hover { color: #222; } 5 | h2 { font-size: 20px; } 6 | h3 { font-size: 15px; } 7 | h4 { font-size: 13px; } 8 | h5 { font-size: 12px; } 9 | h6 { font-size: 11px; } 10 | p { font-size: 14px; line-height: 150%; margin: 1.5em 0; } 11 | a { text-decoration: none; color: #d75041; } 12 | a:hover { color: #5f9391; } 13 | ul { line-height: 140%; font-size: 14px; margin: 1.5em 0; } 14 | li { margin: 0 0 5px 0; } 15 | code { border: 1px solid #bbb; background: rgba(255,255,255,.8); box-shadow: 1px 1px 3px rgba(0,0,0,.2); display: block; padding: 1em; font-size: 12px; margin: 1.5em 0 2em 0; line-height: 150%; } 16 | 17 | /* Layout */ 18 | aside { float: left; width: 280px; margin: -10px 0 20px 0; } 19 | #main { margin: 0 20px 0 310px; } 20 | footer { clear: both; width: 100%; overflow: hidden; } 21 | footer p { float: left; width: 45%; } 22 | footer p.profile { float: right; width: 45%; text-align: right; } 23 | 24 | /* Comments */ 25 | #disqus_thread { font-size: 12px; } 26 | #disqus_thread .dsq-global-toolbar-container { text-shadow: 0 1px 0 #000; font-family: Helvetica, Arial, sans-serif; } 27 | 28 | /* Twitter widget */ 29 | .twitter { margin: 1.5em 0; } 30 | .twitter ul { margin: 0; padding: 0; list-style-type: none; border-top: 1px dotted #aaa; } 31 | .twitter li { border-bottom: 1px dotted #aaa; } 32 | .twitter p { font-size: 12px; } 33 | 34 | /* Codeigniter Profiler */ 35 | #codeigniter_profiler { display: none; width: 980px; margin: 44px auto 0 auto; overflow: auto; border: 1px solid #ccc; border-top: none; position: relative; left: 4px; .border-radius(5px); .box-shadow(0 2px 8px rgba(0,0,0,.2)); font-family: Helvetica, Arial, sans-serif; } 36 | #codeigniter_profiler fieldset { font-size: 12px; } 37 | #codeigniter_profiler table { border-spacing: 3px; width: 938px; } 38 | #codeigniter_profiler table td { padding: 1px 3px; } 39 | #codeigniter_profiler code { font-family: "Courier New"; font-size: 11px; line-height: 14px; } -------------------------------------------------------------------------------- /lack/ci/language/english/db_lang.php: -------------------------------------------------------------------------------- 1 | db->display_error('db_unsuported_feature'); 83 | } 84 | 85 | } 86 | 87 | /* End of file mssql_utility.php */ 88 | /* Location: ./system/database/drivers/mssql/mssql_utility.php */ -------------------------------------------------------------------------------- /lack/ci/database/drivers/mysqli/mysqli_utility.php: -------------------------------------------------------------------------------- 1 | db->_escape_identifiers($table); 52 | } 53 | 54 | // -------------------------------------------------------------------- 55 | 56 | /** 57 | * Repair table query 58 | * 59 | * Generates a platform-specific query so that a table can be repaired 60 | * 61 | * @access private 62 | * @param string the table name 63 | * @return object 64 | */ 65 | function _repair_table($table) 66 | { 67 | return "REPAIR TABLE ".$this->db->_escape_identifiers($table); 68 | } 69 | 70 | // -------------------------------------------------------------------- 71 | 72 | /** 73 | * MySQLi Export 74 | * 75 | * @access private 76 | * @param array Preferences 77 | * @return mixed 78 | */ 79 | function _backup($params = array()) 80 | { 81 | // Currently unsupported 82 | return $this->db->display_error('db_unsuported_feature'); 83 | } 84 | } 85 | 86 | /* End of file mysqli_utility.php */ 87 | /* Location: ./system/database/drivers/mysqli/mysqli_utility.php */ -------------------------------------------------------------------------------- /lack/ci/helpers/directory_helper.php: -------------------------------------------------------------------------------- 1 | 0) && @is_dir($source_dir.$file)) 61 | { 62 | $filedata[$file] = directory_map($source_dir.$file.DIRECTORY_SEPARATOR, $new_depth, $hidden); 63 | } 64 | else 65 | { 66 | $filedata[] = $file; 67 | } 68 | } 69 | 70 | closedir($fp); 71 | return $filedata; 72 | } 73 | 74 | return FALSE; 75 | } 76 | } 77 | 78 | 79 | /* End of file directory_helper.php */ 80 | /* Location: ./system/helpers/directory_helper.php */ -------------------------------------------------------------------------------- /data/about.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | Lorem ipsum dolor sit amet, consectetur adipisicing elit, **sed do eiusmod tempor** incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud [exercitation](http://creolab.hr) ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 4 | 5 | Lorem ipsum dolor sit amet, consectetur adipisicing elit, **sed do eiusmod tempor** incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud [exercitation](http://creolab.hr) ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 6 | 7 | ### Features 8 | 9 | - [Feature 1](http://creolab.hr) 10 | - *Another feature* 11 | - **More features** 12 | 13 | Lorem ipsum dolor sit amet, consectetur adipisicing elit, **sed do eiusmod tempor** incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud [exercitation](http://creolab.hr) ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 14 | 15 | Lorem ipsum dolor sit amet, consectetur adipisicing elit, **sed do eiusmod tempor** incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud [exercitation](http://creolab.hr) ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 16 | 17 | Lorem ipsum dolor sit amet, consectetur adipisicing elit, **sed do eiusmod tempor** incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud [exercitation](http://creolab.hr) ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 18 | -------------------------------------------------------------------------------- /lack/ci/database/drivers/sqlite/sqlite_utility.php: -------------------------------------------------------------------------------- 1 | db_debug) 41 | { 42 | return $this->db->display_error('db_unsuported_feature'); 43 | } 44 | return array(); 45 | } 46 | 47 | // -------------------------------------------------------------------- 48 | 49 | /** 50 | * Optimize table query 51 | * 52 | * Is optimization even supported in SQLite? 53 | * 54 | * @access private 55 | * @param string the table name 56 | * @return object 57 | */ 58 | function _optimize_table($table) 59 | { 60 | return FALSE; 61 | } 62 | 63 | // -------------------------------------------------------------------- 64 | 65 | /** 66 | * Repair table query 67 | * 68 | * Are table repairs even supported in SQLite? 69 | * 70 | * @access private 71 | * @param string the table name 72 | * @return object 73 | */ 74 | function _repair_table($table) 75 | { 76 | return FALSE; 77 | } 78 | 79 | // -------------------------------------------------------------------- 80 | 81 | /** 82 | * SQLite Export 83 | * 84 | * @access private 85 | * @param array Preferences 86 | * @return mixed 87 | */ 88 | function _backup($params = array()) 89 | { 90 | // Currently unsupported 91 | return $this->db->display_error('db_unsuported_feature'); 92 | } 93 | } 94 | 95 | /* End of file sqlite_utility.php */ 96 | /* Location: ./system/database/drivers/sqlite/sqlite_utility.php */ -------------------------------------------------------------------------------- /lack/ci/helpers/typography_helper.php: -------------------------------------------------------------------------------- 1 | load->library('typography'); 44 | 45 | return $CI->typography->nl2br_except_pre($str); 46 | } 47 | } 48 | 49 | // ------------------------------------------------------------------------ 50 | 51 | /** 52 | * Auto Typography Wrapper Function 53 | * 54 | * 55 | * @access public 56 | * @param string 57 | * @param bool whether to allow javascript event handlers 58 | * @param bool whether to reduce multiple instances of double newlines to two 59 | * @return string 60 | */ 61 | if ( ! function_exists('auto_typography')) 62 | { 63 | function auto_typography($str, $strip_js_event_handlers = TRUE, $reduce_linebreaks = FALSE) 64 | { 65 | $CI =& get_instance(); 66 | $CI->load->library('typography'); 67 | return $CI->typography->auto_typography($str, $strip_js_event_handlers, $reduce_linebreaks); 68 | } 69 | } 70 | 71 | 72 | // -------------------------------------------------------------------- 73 | 74 | /** 75 | * HTML Entities Decode 76 | * 77 | * This function is a replacement for html_entity_decode() 78 | * 79 | * @access public 80 | * @param string 81 | * @return string 82 | */ 83 | if ( ! function_exists('entity_decode')) 84 | { 85 | function entity_decode($str, $charset='UTF-8') 86 | { 87 | global $SEC; 88 | return $SEC->entity_decode($str, $charset); 89 | } 90 | } 91 | 92 | /* End of file typography_helper.php */ 93 | /* Location: ./system/helpers/typography_helper.php */ -------------------------------------------------------------------------------- /data/index.md: -------------------------------------------------------------------------------- 1 | # What is Lack° 2 | 3 | Lack° is a very simple, file based, CMS. It runs on the CodeIgniter framework. 4 | 5 | For now only markdown formatting is supported, but you can also use pure html in your data files. 6 | 7 | 8 | 9 | ## Single entry usage 10 | 11 | All the data files are inside the **/data** directory. The name of the file (without the extension) coresponds to the URI segment. 12 | 13 | Example URI for the file **/data/about.md** 14 | 15 | http://yoursite.com/about 16 | 17 | 18 | 19 | ## Entry list usage 20 | 21 | If you want a list of entries (something like a blog), just create a subfolder in the **/data** directory. 22 | 23 | A blog would then look something like this: 24 | 25 | /data 26 | blog 27 | first_entry 28 | second_entry 29 | third_entry 30 | 31 | And the URL's: 32 | 33 | http://yoursite.com/blog/first_entry 34 | http://yoursite.com/blog/second_entry 35 | http://yoursite.com/blog/third_entry 36 | 37 | A list of those entries is created automaticaly in the following URL: 38 | 39 | http://yoursite.com/blog 40 | 41 | You can add meta data to your entries by simply adding some JSON data in your data files. The simples example is adding a title that is displayed in the list: 42 | 43 | { "title": "One" } 44 | 45 | ##One 46 | 47 | Lorem ipsum dolor... 48 | 49 | 50 | 51 | ## Assets 52 | 53 | All the site assets (CSS, JavaScript, Images, etc.) are located in the directory **/data/assets**. 54 | 55 | 56 | 57 | ## Templates 58 | 59 | The templates are located in the directory **/data/assets/templates**. 60 | 61 | The default template used to display the data files is **layout.php**. And the template used to display a list of entries is **layout_list.php**. 62 | 63 | There's also a possibility to use partials. The template directory has 2 subfolders **core** and **partials**. 64 | You can place your partials in any of them, but best practice is to put the **header**, **footer**, **aside** and **navigation** partials in the **core** folder. 65 | 66 | Then you can simply include the partials in the temaplates. An example would be something like this: 67 | 68 | { header } 69 | 70 | { navigation } 71 | 72 |
{ content }
73 | 74 | { aside } 75 | 76 | { footer } 77 | 78 | Simple, right? 79 | 80 | The template for the entry list would then look like this: 81 | 82 | { header } 83 | 84 | { navigation } 85 | 86 | 95 | 96 | { aside } 97 | 98 | { footer } 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /lack/ci/database/drivers/odbc/odbc_utility.php: -------------------------------------------------------------------------------- 1 | db->db_debug) 37 | { 38 | return $this->db->display_error('db_unsuported_feature'); 39 | } 40 | return FALSE; 41 | } 42 | 43 | // -------------------------------------------------------------------- 44 | 45 | /** 46 | * Optimize table query 47 | * 48 | * Generates a platform-specific query so that a table can be optimized 49 | * 50 | * @access private 51 | * @param string the table name 52 | * @return object 53 | */ 54 | function _optimize_table($table) 55 | { 56 | // Not a supported ODBC feature 57 | if ($this->db->db_debug) 58 | { 59 | return $this->db->display_error('db_unsuported_feature'); 60 | } 61 | return FALSE; 62 | } 63 | 64 | // -------------------------------------------------------------------- 65 | 66 | /** 67 | * Repair table query 68 | * 69 | * Generates a platform-specific query so that a table can be repaired 70 | * 71 | * @access private 72 | * @param string the table name 73 | * @return object 74 | */ 75 | function _repair_table($table) 76 | { 77 | // Not a supported ODBC feature 78 | if ($this->db->db_debug) 79 | { 80 | return $this->db->display_error('db_unsuported_feature'); 81 | } 82 | return FALSE; 83 | } 84 | 85 | // -------------------------------------------------------------------- 86 | 87 | /** 88 | * ODBC Export 89 | * 90 | * @access private 91 | * @param array Preferences 92 | * @return mixed 93 | */ 94 | function _backup($params = array()) 95 | { 96 | // Currently unsupported 97 | return $this->db->display_error('db_unsuported_feature'); 98 | } 99 | 100 | } 101 | 102 | /* End of file odbc_utility.php */ 103 | /* Location: ./system/database/drivers/odbc/odbc_utility.php */ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # What is Lack° 2 | 3 | Lack° is a very simple, file based, CMS. It runs on the CodeIgniter framework. 4 | 5 | For now only markdown formatting is supported, but you can also use pure html in your data files. 6 | 7 | 8 | 9 | ## Single entry usage 10 | 11 | All the data files are inside the **/data** directory. The name of the file (without the extension) coresponds to the URI segment. 12 | 13 | Example URI for the file **/data/about.md** 14 | 15 | http://yoursite.com/about 16 | 17 | 18 | 19 | ## Entry list usage 20 | 21 | If you want a list of entries (something like a blog), just create a subfolder in the **/data** directory. 22 | 23 | A blog would then look something like this: 24 | 25 | /data 26 | blog 27 | first_entry 28 | second_entry 29 | third_entry 30 | 31 | And the URL's: 32 | 33 | http://yoursite.com/blog/first_entry 34 | http://yoursite.com/blog/second_entry 35 | http://yoursite.com/blog/third_entry 36 | 37 | A list of those entries is created automaticaly in the following URL: 38 | 39 | http://yoursite.com/blog 40 | 41 | You can add meta data to your entries by simply adding some JSON data in your data files. The simples example is adding a title that is displayed in the list: 42 | 43 | { "title": "One" } 44 | 45 | ##One 46 | 47 | Lorem ipsum dolor... 48 | 49 | 50 | 51 | ## Assets 52 | 53 | All the site assets (CSS, JavaScript, Images, etc.) are located in the directory **/data/assets**. 54 | 55 | 56 | 57 | ## Templates 58 | 59 | The templates are located in the directory **/data/assets/templates**. 60 | 61 | The default template used to display the data files is **layout.php**. And the template used to display a list of entries is **layout_list.php**. 62 | 63 | There's also a possibility to use partials. The template directory has 2 subfolders **core** and **partials**. 64 | You can place your partials in any of them, but best practice is to put the **header**, **footer**, **aside** and **navigation** partials in the **core** folder. 65 | 66 | Then you can simply include the partials in the templates. An example would be something like this: 67 | 68 | {header} 69 | 70 | {navigation} 71 | 72 |
{content}
73 | 74 | {aside} 75 | 76 | {footer} 77 | 78 | Simple, right? 79 | 80 | The template for the entry list would then look like this: 81 | 82 | {header} 83 | 84 | {navigation} 85 | 86 | 95 | 96 | {aside} 97 | 98 | {footer} 99 | 100 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/bstrahija/lack/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 101 | 102 | -------------------------------------------------------------------------------- /lack/ci/helpers/cookie_helper.php: -------------------------------------------------------------------------------- 1 | input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure); 52 | } 53 | } 54 | 55 | // -------------------------------------------------------------------- 56 | 57 | /** 58 | * Fetch an item from the COOKIE array 59 | * 60 | * @access public 61 | * @param string 62 | * @param bool 63 | * @return mixed 64 | */ 65 | if ( ! function_exists('get_cookie')) 66 | { 67 | function get_cookie($index = '', $xss_clean = FALSE) 68 | { 69 | $CI =& get_instance(); 70 | 71 | $prefix = ''; 72 | 73 | if ( ! isset($_COOKIE[$index]) && config_item('cookie_prefix') != '') 74 | { 75 | $prefix = config_item('cookie_prefix'); 76 | } 77 | 78 | return $CI->input->cookie($prefix.$index, $xss_clean); 79 | } 80 | } 81 | 82 | // -------------------------------------------------------------------- 83 | 84 | /** 85 | * Delete a COOKIE 86 | * 87 | * @param mixed 88 | * @param string the cookie domain. Usually: .yourdomain.com 89 | * @param string the cookie path 90 | * @param string the cookie prefix 91 | * @return void 92 | */ 93 | if ( ! function_exists('delete_cookie')) 94 | { 95 | function delete_cookie($name = '', $domain = '', $path = '/', $prefix = '') 96 | { 97 | set_cookie($name, '', '', $domain, $path, $prefix); 98 | } 99 | } 100 | 101 | 102 | /* End of file cookie_helper.php */ 103 | /* Location: ./system/helpers/cookie_helper.php */ -------------------------------------------------------------------------------- /lack/ci/helpers/array_helper.php: -------------------------------------------------------------------------------- 1 | '1', 'DEBUG' => '2', 'INFO' => '3', 'ALL' => '4'); 34 | 35 | /** 36 | * Constructor 37 | */ 38 | public function __construct() 39 | { 40 | $config =& get_config(); 41 | 42 | $this->_log_path = ($config['log_path'] != '') ? $config['log_path'] : APPPATH.'logs/'; 43 | 44 | if ( ! is_dir($this->_log_path) OR ! is_really_writable($this->_log_path)) 45 | { 46 | $this->_enabled = FALSE; 47 | } 48 | 49 | if (is_numeric($config['log_threshold'])) 50 | { 51 | $this->_threshold = $config['log_threshold']; 52 | } 53 | 54 | if ($config['log_date_format'] != '') 55 | { 56 | $this->_date_fmt = $config['log_date_format']; 57 | } 58 | } 59 | 60 | // -------------------------------------------------------------------- 61 | 62 | /** 63 | * Write Log File 64 | * 65 | * Generally this function will be called using the global log_message() function 66 | * 67 | * @param string the error level 68 | * @param string the error message 69 | * @param bool whether the error is a native PHP error 70 | * @return bool 71 | */ 72 | public function write_log($level = 'error', $msg, $php_error = FALSE) 73 | { 74 | if ($this->_enabled === FALSE) 75 | { 76 | return FALSE; 77 | } 78 | 79 | $level = strtoupper($level); 80 | 81 | if ( ! isset($this->_levels[$level]) OR ($this->_levels[$level] > $this->_threshold)) 82 | { 83 | return FALSE; 84 | } 85 | 86 | $filepath = $this->_log_path.'log-'.date('Y-m-d').'.php'; 87 | $message = ''; 88 | 89 | if ( ! file_exists($filepath)) 90 | { 91 | $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; 92 | } 93 | 94 | if ( ! $fp = @fopen($filepath, FOPEN_WRITE_CREATE)) 95 | { 96 | return FALSE; 97 | } 98 | 99 | $message .= $level.' '.(($level == 'INFO') ? ' -' : '-').' '.date($this->_date_fmt). ' --> '.$msg."\n"; 100 | 101 | flock($fp, LOCK_EX); 102 | fwrite($fp, $message); 103 | flock($fp, LOCK_UN); 104 | fclose($fp); 105 | 106 | @chmod($filepath, FILE_WRITE_MODE); 107 | return TRUE; 108 | } 109 | 110 | } 111 | // END Log Class 112 | 113 | /* End of file Log.php */ 114 | /* Location: ./system/libraries/Log.php */ -------------------------------------------------------------------------------- /lack/ci/helpers/download_helper.php: -------------------------------------------------------------------------------- 1 | security->xss_clean($str, $is_image); 44 | } 45 | } 46 | 47 | // ------------------------------------------------------------------------ 48 | 49 | /** 50 | * Sanitize Filename 51 | * 52 | * @access public 53 | * @param string 54 | * @return string 55 | */ 56 | if ( ! function_exists('sanitize_filename')) 57 | { 58 | function sanitize_filename($filename) 59 | { 60 | $CI =& get_instance(); 61 | return $CI->security->sanitize_filename($filename); 62 | } 63 | } 64 | 65 | // -------------------------------------------------------------------- 66 | 67 | /** 68 | * Hash encode a string 69 | * 70 | * @access public 71 | * @param string 72 | * @return string 73 | */ 74 | if ( ! function_exists('do_hash')) 75 | { 76 | function do_hash($str, $type = 'sha1') 77 | { 78 | if ($type == 'sha1') 79 | { 80 | return sha1($str); 81 | } 82 | else 83 | { 84 | return md5($str); 85 | } 86 | } 87 | } 88 | 89 | // ------------------------------------------------------------------------ 90 | 91 | /** 92 | * Strip Image Tags 93 | * 94 | * @access public 95 | * @param string 96 | * @return string 97 | */ 98 | if ( ! function_exists('strip_image_tags')) 99 | { 100 | function strip_image_tags($str) 101 | { 102 | $str = preg_replace("##", "\\1", $str); 103 | $str = preg_replace("##", "\\1", $str); 104 | 105 | return $str; 106 | } 107 | } 108 | 109 | // ------------------------------------------------------------------------ 110 | 111 | /** 112 | * Convert PHP tags to entities 113 | * 114 | * @access public 115 | * @param string 116 | * @return string 117 | */ 118 | if ( ! function_exists('encode_php_tags')) 119 | { 120 | function encode_php_tags($str) 121 | { 122 | return str_replace(array(''), array('<?php', '<?PHP', '<?', '?>'), $str); 123 | } 124 | } 125 | 126 | 127 | /* End of file security_helper.php */ 128 | /* Location: ./system/helpers/security_helper.php */ -------------------------------------------------------------------------------- /lack/ci/libraries/Cache/drivers/Cache_dummy.php: -------------------------------------------------------------------------------- 1 | marker[$name] = microtime(); 49 | } 50 | 51 | // -------------------------------------------------------------------- 52 | 53 | /** 54 | * Calculates the time difference between two marked points. 55 | * 56 | * If the first parameter is empty this function instead returns the 57 | * {elapsed_time} pseudo-variable. This permits the full system 58 | * execution time to be shown in a template. The output class will 59 | * swap the real value for this variable. 60 | * 61 | * @access public 62 | * @param string a particular marked point 63 | * @param string a particular marked point 64 | * @param integer the number of decimal places 65 | * @return mixed 66 | */ 67 | function elapsed_time($point1 = '', $point2 = '', $decimals = 4) 68 | { 69 | if ($point1 == '') 70 | { 71 | return '{elapsed_time}'; 72 | } 73 | 74 | if ( ! isset($this->marker[$point1])) 75 | { 76 | return ''; 77 | } 78 | 79 | if ( ! isset($this->marker[$point2])) 80 | { 81 | $this->marker[$point2] = microtime(); 82 | } 83 | 84 | list($sm, $ss) = explode(' ', $this->marker[$point1]); 85 | list($em, $es) = explode(' ', $this->marker[$point2]); 86 | 87 | return number_format(($em + $es) - ($sm + $ss), $decimals); 88 | } 89 | 90 | // -------------------------------------------------------------------- 91 | 92 | /** 93 | * Memory Usage 94 | * 95 | * This function returns the {memory_usage} pseudo-variable. 96 | * This permits it to be put it anywhere in a template 97 | * without the memory being calculated until the end. 98 | * The output class will swap the real value for this variable. 99 | * 100 | * @access public 101 | * @return string 102 | */ 103 | function memory_usage() 104 | { 105 | return '{memory_usage}'; 106 | } 107 | 108 | } 109 | 110 | // END CI_Benchmark class 111 | 112 | /* End of file Benchmark.php */ 113 | /* Location: ./system/core/Benchmark.php */ -------------------------------------------------------------------------------- /lack/libraries/Twitter.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright Copyright (c) 2011, Boris Strahija, Creo 10 | * @version 0.1 11 | */ 12 | 13 | class Twitter { 14 | 15 | protected static $ci; 16 | protected static $base_url = 'http://api.twitter.com/1/'; 17 | 18 | 19 | /* ------------------------------------------------------------------------------------------ */ 20 | 21 | /** 22 | * 23 | */ 24 | public function __construct() 25 | { 26 | self::$ci = get_instance(); 27 | 28 | // Load resources 29 | self::$ci->load->driver('cache'); 30 | 31 | } // __construct() 32 | 33 | /* ------------------------------------------------------------------------------------------ */ 34 | 35 | public static function timeline($username = null, $num = 5) 36 | { 37 | if ($tweets = self::$ci->cache->file->get('twitter_timeline_'.$username)) 38 | { 39 | return $tweets; 40 | } 41 | else 42 | { 43 | // Get tweets 44 | $call_url = self::$base_url.'statuses/user_timeline.json?screen_name='.$username.'&count='.$num; 45 | $tweets = json_decode(file_get_contents($call_url)); 46 | 47 | if($tweets) 48 | { 49 | // Format some of the data 50 | foreach ($tweets as $key=>$tweet) 51 | { 52 | $tweets[$key]->text = self::auto_link((string) $tweet->text); 53 | $tweets[$key]->when = strtotime((string) $tweet->created_at); 54 | $tweets[$key]->author = (string) $tweet->user->name; 55 | } 56 | 57 | // Cache results for 3 minutes 58 | self::$ci->cache->file->save('twitter_timeline_'.$username, $tweets, 180); 59 | 60 | return $tweets; 61 | } 62 | } 63 | 64 | return null; 65 | 66 | } // twitter_timeline() 67 | 68 | 69 | /* ------------------------------------------------------------------------------------------ */ 70 | 71 | /** 72 | * 73 | */ 74 | public static function timeline_list($username = null, $num = 5, $return = false) 75 | { 76 | $tweets = self::timeline($username, $num); 77 | 78 | if ($tweets) 79 | { 80 | $html = ''; 89 | 90 | if ($return) return $html; 91 | else echo $html; 92 | } 93 | 94 | return null; 95 | 96 | } // timeline_list() 97 | 98 | 99 | /* ------------------------------------------------------------------------------------------ */ 100 | 101 | /** 102 | * 103 | */ 104 | public static function auto_link($string = '') 105 | { 106 | $search = array('|#([\w_]+)|', '|@([\w_]+)|'); 107 | $replace = array('#$1', '@$1'); 108 | $string = preg_replace($search, $replace, $string); 109 | 110 | return auto_link($string); 111 | 112 | } // auto_link() 113 | 114 | 115 | /* ------------------------------------------------------------------------------------------ */ 116 | 117 | } // Twitter 118 | 119 | 120 | /* End of file twitter.php */ -------------------------------------------------------------------------------- /lack/config/smileys.php: -------------------------------------------------------------------------------- 1 | array('grin.gif', '19', '19', 'grin'), 20 | ':lol:' => array('lol.gif', '19', '19', 'LOL'), 21 | ':cheese:' => array('cheese.gif', '19', '19', 'cheese'), 22 | ':)' => array('smile.gif', '19', '19', 'smile'), 23 | ';-)' => array('wink.gif', '19', '19', 'wink'), 24 | ';)' => array('wink.gif', '19', '19', 'wink'), 25 | ':smirk:' => array('smirk.gif', '19', '19', 'smirk'), 26 | ':roll:' => array('rolleyes.gif', '19', '19', 'rolleyes'), 27 | ':-S' => array('confused.gif', '19', '19', 'confused'), 28 | ':wow:' => array('surprise.gif', '19', '19', 'surprised'), 29 | ':bug:' => array('bigsurprise.gif', '19', '19', 'big surprise'), 30 | ':-P' => array('tongue_laugh.gif', '19', '19', 'tongue laugh'), 31 | '%-P' => array('tongue_rolleye.gif', '19', '19', 'tongue rolleye'), 32 | ';-P' => array('tongue_wink.gif', '19', '19', 'tongue wink'), 33 | ':P' => array('raspberry.gif', '19', '19', 'raspberry'), 34 | ':blank:' => array('blank.gif', '19', '19', 'blank stare'), 35 | ':long:' => array('longface.gif', '19', '19', 'long face'), 36 | ':ohh:' => array('ohh.gif', '19', '19', 'ohh'), 37 | ':grrr:' => array('grrr.gif', '19', '19', 'grrr'), 38 | ':gulp:' => array('gulp.gif', '19', '19', 'gulp'), 39 | '8-/' => array('ohoh.gif', '19', '19', 'oh oh'), 40 | ':down:' => array('downer.gif', '19', '19', 'downer'), 41 | ':red:' => array('embarrassed.gif', '19', '19', 'red face'), 42 | ':sick:' => array('sick.gif', '19', '19', 'sick'), 43 | ':shut:' => array('shuteye.gif', '19', '19', 'shut eye'), 44 | ':-/' => array('hmm.gif', '19', '19', 'hmmm'), 45 | '>:(' => array('mad.gif', '19', '19', 'mad'), 46 | ':mad:' => array('mad.gif', '19', '19', 'mad'), 47 | '>:-(' => array('angry.gif', '19', '19', 'angry'), 48 | ':angry:' => array('angry.gif', '19', '19', 'angry'), 49 | ':zip:' => array('zip.gif', '19', '19', 'zipper'), 50 | ':kiss:' => array('kiss.gif', '19', '19', 'kiss'), 51 | ':ahhh:' => array('shock.gif', '19', '19', 'shock'), 52 | ':coolsmile:' => array('shade_smile.gif', '19', '19', 'cool smile'), 53 | ':coolsmirk:' => array('shade_smirk.gif', '19', '19', 'cool smirk'), 54 | ':coolgrin:' => array('shade_grin.gif', '19', '19', 'cool grin'), 55 | ':coolhmm:' => array('shade_hmm.gif', '19', '19', 'cool hmm'), 56 | ':coolmad:' => array('shade_mad.gif', '19', '19', 'cool mad'), 57 | ':coolcheese:' => array('shade_cheese.gif', '19', '19', 'cool cheese'), 58 | ':vampire:' => array('vampire.gif', '19', '19', 'vampire'), 59 | ':snake:' => array('snake.gif', '19', '19', 'snake'), 60 | ':exclaim:' => array('exclaim.gif', '19', '19', 'excaim'), 61 | ':question:' => array('question.gif', '19', '19', 'question') // no comma after last item 62 | 63 | ); 64 | 65 | /* End of file smileys.php */ 66 | /* Location: ./application/config/smileys.php */ -------------------------------------------------------------------------------- /lack/config/autoload.php: -------------------------------------------------------------------------------- 1 | $time + $ttl, 121 | 'mtime' => $time, 122 | 'data' => $data 123 | ); 124 | } 125 | 126 | // ------------------------------------------------------------------------ 127 | 128 | /** 129 | * is_supported() 130 | * 131 | * Check to see if APC is available on this system, bail if it isn't. 132 | */ 133 | public function is_supported() 134 | { 135 | if ( ! extension_loaded('apc') OR ! function_exists('apc_store')) 136 | { 137 | log_message('error', 'The APC PHP extension must be loaded to use APC Cache.'); 138 | return FALSE; 139 | } 140 | 141 | return TRUE; 142 | } 143 | 144 | // ------------------------------------------------------------------------ 145 | 146 | 147 | } 148 | // End Class 149 | 150 | /* End of file Cache_apc.php */ 151 | /* Location: ./system/libraries/Cache/drivers/Cache_apc.php */ -------------------------------------------------------------------------------- /lack/ci/core/Lang.php: -------------------------------------------------------------------------------- 1 | is_loaded, TRUE)) 64 | { 65 | return; 66 | } 67 | 68 | $config =& get_config(); 69 | 70 | if ($idiom == '') 71 | { 72 | $deft_lang = ( ! isset($config['language'])) ? 'english' : $config['language']; 73 | $idiom = ($deft_lang == '') ? 'english' : $deft_lang; 74 | } 75 | 76 | // Determine where the language file is and load it 77 | if ($alt_path != '' && file_exists($alt_path.'language/'.$idiom.'/'.$langfile)) 78 | { 79 | include($alt_path.'language/'.$idiom.'/'.$langfile); 80 | } 81 | else 82 | { 83 | $found = FALSE; 84 | 85 | foreach (get_instance()->load->get_package_paths(TRUE) as $package_path) 86 | { 87 | if (file_exists($package_path.'language/'.$idiom.'/'.$langfile)) 88 | { 89 | include($package_path.'language/'.$idiom.'/'.$langfile); 90 | $found = TRUE; 91 | break; 92 | } 93 | } 94 | 95 | if ($found !== TRUE) 96 | { 97 | show_error('Unable to load the requested language file: language/'.$idiom.'/'.$langfile); 98 | } 99 | } 100 | 101 | 102 | if ( ! isset($lang)) 103 | { 104 | log_message('error', 'Language file contains no data: language/'.$idiom.'/'.$langfile); 105 | return; 106 | } 107 | 108 | if ($return == TRUE) 109 | { 110 | return $lang; 111 | } 112 | 113 | $this->is_loaded[] = $langfile; 114 | $this->language = array_merge($this->language, $lang); 115 | unset($lang); 116 | 117 | log_message('debug', 'Language file loaded: language/'.$idiom.'/'.$langfile); 118 | return TRUE; 119 | } 120 | 121 | // -------------------------------------------------------------------- 122 | 123 | /** 124 | * Fetch a single line of text from the language array 125 | * 126 | * @access public 127 | * @param string $line the language line 128 | * @return string 129 | */ 130 | function line($line = '') 131 | { 132 | $value = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line]; 133 | 134 | // Because killer robots like unicorns! 135 | if ($value === FALSE) 136 | { 137 | log_message('error', 'Could not find the language line "'.$line.'"'); 138 | } 139 | 140 | return $value; 141 | } 142 | 143 | } 144 | // END Language Class 145 | 146 | /* End of file Lang.php */ 147 | /* Location: ./system/core/Lang.php */ 148 | -------------------------------------------------------------------------------- /lack/ci/database/drivers/mssql/mssql_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @mssql_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | while ($field = mssql_fetch_field($this->result_id)) 67 | { 68 | $field_names[] = $field->name; 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | while ($field = mssql_fetch_field($this->result_id)) 88 | { 89 | $F = new stdClass(); 90 | $F->name = $field->name; 91 | $F->type = $field->type; 92 | $F->max_length = $field->max_length; 93 | $F->primary_key = 0; 94 | $F->default = ''; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | if (is_resource($this->result_id)) 112 | { 113 | mssql_free_result($this->result_id); 114 | $this->result_id = FALSE; 115 | } 116 | } 117 | 118 | // -------------------------------------------------------------------- 119 | 120 | /** 121 | * Data Seek 122 | * 123 | * Moves the internal pointer to the desired offset. We call 124 | * this internally before fetching results to make sure the 125 | * result set starts at zero 126 | * 127 | * @access private 128 | * @return array 129 | */ 130 | function _data_seek($n = 0) 131 | { 132 | return mssql_data_seek($this->result_id, $n); 133 | } 134 | 135 | // -------------------------------------------------------------------- 136 | 137 | /** 138 | * Result - associative array 139 | * 140 | * Returns the result set as an array 141 | * 142 | * @access private 143 | * @return array 144 | */ 145 | function _fetch_assoc() 146 | { 147 | return mssql_fetch_assoc($this->result_id); 148 | } 149 | 150 | // -------------------------------------------------------------------- 151 | 152 | /** 153 | * Result - object 154 | * 155 | * Returns the result set as an object 156 | * 157 | * @access private 158 | * @return object 159 | */ 160 | function _fetch_object() 161 | { 162 | return mssql_fetch_object($this->result_id); 163 | } 164 | 165 | } 166 | 167 | 168 | /* End of file mssql_result.php */ 169 | /* Location: ./system/database/drivers/mssql/mssql_result.php */ -------------------------------------------------------------------------------- /lack/ci/database/drivers/mysql/mysql_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @mysql_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | while ($field = mysql_fetch_field($this->result_id)) 67 | { 68 | $field_names[] = $field->name; 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | while ($field = mysql_fetch_field($this->result_id)) 88 | { 89 | $F = new stdClass(); 90 | $F->name = $field->name; 91 | $F->type = $field->type; 92 | $F->default = $field->def; 93 | $F->max_length = $field->max_length; 94 | $F->primary_key = $field->primary_key; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | if (is_resource($this->result_id)) 112 | { 113 | mysql_free_result($this->result_id); 114 | $this->result_id = FALSE; 115 | } 116 | } 117 | 118 | // -------------------------------------------------------------------- 119 | 120 | /** 121 | * Data Seek 122 | * 123 | * Moves the internal pointer to the desired offset. We call 124 | * this internally before fetching results to make sure the 125 | * result set starts at zero 126 | * 127 | * @access private 128 | * @return array 129 | */ 130 | function _data_seek($n = 0) 131 | { 132 | return mysql_data_seek($this->result_id, $n); 133 | } 134 | 135 | // -------------------------------------------------------------------- 136 | 137 | /** 138 | * Result - associative array 139 | * 140 | * Returns the result set as an array 141 | * 142 | * @access private 143 | * @return array 144 | */ 145 | function _fetch_assoc() 146 | { 147 | return mysql_fetch_assoc($this->result_id); 148 | } 149 | 150 | // -------------------------------------------------------------------- 151 | 152 | /** 153 | * Result - object 154 | * 155 | * Returns the result set as an object 156 | * 157 | * @access private 158 | * @return object 159 | */ 160 | function _fetch_object() 161 | { 162 | return mysql_fetch_object($this->result_id); 163 | } 164 | 165 | } 166 | 167 | 168 | /* End of file mysql_result.php */ 169 | /* Location: ./system/database/drivers/mysql/mysql_result.php */ -------------------------------------------------------------------------------- /lack/ci/database/drivers/mysqli/mysqli_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @mysqli_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | while ($field = mysqli_fetch_field($this->result_id)) 67 | { 68 | $field_names[] = $field->name; 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | while ($field = mysqli_fetch_field($this->result_id)) 88 | { 89 | $F = new stdClass(); 90 | $F->name = $field->name; 91 | $F->type = $field->type; 92 | $F->default = $field->def; 93 | $F->max_length = $field->max_length; 94 | $F->primary_key = ($field->flags & MYSQLI_PRI_KEY_FLAG) ? 1 : 0; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | if (is_object($this->result_id)) 112 | { 113 | mysqli_free_result($this->result_id); 114 | $this->result_id = FALSE; 115 | } 116 | } 117 | 118 | // -------------------------------------------------------------------- 119 | 120 | /** 121 | * Data Seek 122 | * 123 | * Moves the internal pointer to the desired offset. We call 124 | * this internally before fetching results to make sure the 125 | * result set starts at zero 126 | * 127 | * @access private 128 | * @return array 129 | */ 130 | function _data_seek($n = 0) 131 | { 132 | return mysqli_data_seek($this->result_id, $n); 133 | } 134 | 135 | // -------------------------------------------------------------------- 136 | 137 | /** 138 | * Result - associative array 139 | * 140 | * Returns the result set as an array 141 | * 142 | * @access private 143 | * @return array 144 | */ 145 | function _fetch_assoc() 146 | { 147 | return mysqli_fetch_assoc($this->result_id); 148 | } 149 | 150 | // -------------------------------------------------------------------- 151 | 152 | /** 153 | * Result - object 154 | * 155 | * Returns the result set as an object 156 | * 157 | * @access private 158 | * @return object 159 | */ 160 | function _fetch_object() 161 | { 162 | return mysqli_fetch_object($this->result_id); 163 | } 164 | 165 | } 166 | 167 | 168 | /* End of file mysqli_result.php */ 169 | /* Location: ./system/database/drivers/mysqli/mysqli_result.php */ -------------------------------------------------------------------------------- /lack/ci/database/drivers/postgre/postgre_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @pg_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | for ($i = 0; $i < $this->num_fields(); $i++) 67 | { 68 | $field_names[] = pg_field_name($this->result_id, $i); 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | for ($i = 0; $i < $this->num_fields(); $i++) 88 | { 89 | $F = new stdClass(); 90 | $F->name = pg_field_name($this->result_id, $i); 91 | $F->type = pg_field_type($this->result_id, $i); 92 | $F->max_length = pg_field_size($this->result_id, $i); 93 | $F->primary_key = 0; 94 | $F->default = ''; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | if (is_resource($this->result_id)) 112 | { 113 | pg_free_result($this->result_id); 114 | $this->result_id = FALSE; 115 | } 116 | } 117 | 118 | // -------------------------------------------------------------------- 119 | 120 | /** 121 | * Data Seek 122 | * 123 | * Moves the internal pointer to the desired offset. We call 124 | * this internally before fetching results to make sure the 125 | * result set starts at zero 126 | * 127 | * @access private 128 | * @return array 129 | */ 130 | function _data_seek($n = 0) 131 | { 132 | return pg_result_seek($this->result_id, $n); 133 | } 134 | 135 | // -------------------------------------------------------------------- 136 | 137 | /** 138 | * Result - associative array 139 | * 140 | * Returns the result set as an array 141 | * 142 | * @access private 143 | * @return array 144 | */ 145 | function _fetch_assoc() 146 | { 147 | return pg_fetch_assoc($this->result_id); 148 | } 149 | 150 | // -------------------------------------------------------------------- 151 | 152 | /** 153 | * Result - object 154 | * 155 | * Returns the result set as an object 156 | * 157 | * @access private 158 | * @return object 159 | */ 160 | function _fetch_object() 161 | { 162 | return pg_fetch_object($this->result_id); 163 | } 164 | 165 | } 166 | 167 | 168 | /* End of file postgre_result.php */ 169 | /* Location: ./system/database/drivers/postgre/postgre_result.php */ -------------------------------------------------------------------------------- /lack/ci/core/Utf8.php: -------------------------------------------------------------------------------- 1 | item('charset') == 'UTF-8' // Application charset must be UTF-8 48 | ) 49 | { 50 | log_message('debug', "UTF-8 Support Enabled"); 51 | 52 | define('UTF8_ENABLED', TRUE); 53 | 54 | // set internal encoding for multibyte string functions if necessary 55 | // and set a flag so we don't have to repeatedly use extension_loaded() 56 | // or function_exists() 57 | if (extension_loaded('mbstring')) 58 | { 59 | define('MB_ENABLED', TRUE); 60 | mb_internal_encoding('UTF-8'); 61 | } 62 | else 63 | { 64 | define('MB_ENABLED', FALSE); 65 | } 66 | } 67 | else 68 | { 69 | log_message('debug', "UTF-8 Support Disabled"); 70 | define('UTF8_ENABLED', FALSE); 71 | } 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Clean UTF-8 strings 78 | * 79 | * Ensures strings are UTF-8 80 | * 81 | * @access public 82 | * @param string 83 | * @return string 84 | */ 85 | function clean_string($str) 86 | { 87 | if ($this->_is_ascii($str) === FALSE) 88 | { 89 | $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str); 90 | } 91 | 92 | return $str; 93 | } 94 | 95 | // -------------------------------------------------------------------- 96 | 97 | /** 98 | * Remove ASCII control characters 99 | * 100 | * Removes all ASCII control characters except horizontal tabs, 101 | * line feeds, and carriage returns, as all others can cause 102 | * problems in XML 103 | * 104 | * @access public 105 | * @param string 106 | * @return string 107 | */ 108 | function safe_ascii_for_xml($str) 109 | { 110 | return remove_invisible_characters($str, FALSE); 111 | } 112 | 113 | // -------------------------------------------------------------------- 114 | 115 | /** 116 | * Convert to UTF-8 117 | * 118 | * Attempts to convert a string to UTF-8 119 | * 120 | * @access public 121 | * @param string 122 | * @param string - input encoding 123 | * @return string 124 | */ 125 | function convert_to_utf8($str, $encoding) 126 | { 127 | if (function_exists('iconv')) 128 | { 129 | $str = @iconv($encoding, 'UTF-8', $str); 130 | } 131 | elseif (function_exists('mb_convert_encoding')) 132 | { 133 | $str = @mb_convert_encoding($str, 'UTF-8', $encoding); 134 | } 135 | else 136 | { 137 | return FALSE; 138 | } 139 | 140 | return $str; 141 | } 142 | 143 | // -------------------------------------------------------------------- 144 | 145 | /** 146 | * Is ASCII? 147 | * 148 | * Tests if a string is standard 7-bit ASCII or not 149 | * 150 | * @access public 151 | * @param string 152 | * @return bool 153 | */ 154 | function _is_ascii($str) 155 | { 156 | return (preg_match('/[^\x00-\x7F]/S', $str) == 0); 157 | } 158 | 159 | // -------------------------------------------------------------------- 160 | 161 | } 162 | // End Utf8 Class 163 | 164 | /* End of file Utf8.php */ 165 | /* Location: ./system/core/Utf8.php */ -------------------------------------------------------------------------------- /lack/ci/database/drivers/sqlite/sqlite_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @sqlite_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | for ($i = 0; $i < $this->num_fields(); $i++) 67 | { 68 | $field_names[] = sqlite_field_name($this->result_id, $i); 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | for ($i = 0; $i < $this->num_fields(); $i++) 88 | { 89 | $F = new stdClass(); 90 | $F->name = sqlite_field_name($this->result_id, $i); 91 | $F->type = 'varchar'; 92 | $F->max_length = 0; 93 | $F->primary_key = 0; 94 | $F->default = ''; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | // Not implemented in SQLite 112 | } 113 | 114 | // -------------------------------------------------------------------- 115 | 116 | /** 117 | * Data Seek 118 | * 119 | * Moves the internal pointer to the desired offset. We call 120 | * this internally before fetching results to make sure the 121 | * result set starts at zero 122 | * 123 | * @access private 124 | * @return array 125 | */ 126 | function _data_seek($n = 0) 127 | { 128 | return sqlite_seek($this->result_id, $n); 129 | } 130 | 131 | // -------------------------------------------------------------------- 132 | 133 | /** 134 | * Result - associative array 135 | * 136 | * Returns the result set as an array 137 | * 138 | * @access private 139 | * @return array 140 | */ 141 | function _fetch_assoc() 142 | { 143 | return sqlite_fetch_array($this->result_id); 144 | } 145 | 146 | // -------------------------------------------------------------------- 147 | 148 | /** 149 | * Result - object 150 | * 151 | * Returns the result set as an object 152 | * 153 | * @access private 154 | * @return object 155 | */ 156 | function _fetch_object() 157 | { 158 | if (function_exists('sqlite_fetch_object')) 159 | { 160 | return sqlite_fetch_object($this->result_id); 161 | } 162 | else 163 | { 164 | $arr = sqlite_fetch_array($this->result_id, SQLITE_ASSOC); 165 | if (is_array($arr)) 166 | { 167 | $obj = (object) $arr; 168 | return $obj; 169 | } else { 170 | return NULL; 171 | } 172 | } 173 | } 174 | 175 | } 176 | 177 | 178 | /* End of file sqlite_result.php */ 179 | /* Location: ./system/database/drivers/sqlite/sqlite_result.php */ -------------------------------------------------------------------------------- /lack/ci/helpers/inflector_helper.php: -------------------------------------------------------------------------------- 1 | regular plural 93 | $vowels = array('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'); 94 | $str = in_array(substr($str, -2, 1), $vowels) ? $str.'s' : substr($str, 0, -1).'ies'; 95 | } 96 | elseif (preg_match('/h/i',$end)) 97 | { 98 | if(preg_match('/^[c|s]h$/i',substr($str, -2))) 99 | { 100 | $str .= 'es'; 101 | } 102 | else 103 | { 104 | $str .= 's'; 105 | } 106 | } 107 | elseif (preg_match('/s/i',$end)) 108 | { 109 | if ($force == TRUE) 110 | { 111 | $str .= 'es'; 112 | } 113 | } 114 | else 115 | { 116 | $str .= 's'; 117 | } 118 | 119 | return $str; 120 | } 121 | } 122 | 123 | // -------------------------------------------------------------------- 124 | 125 | /** 126 | * Camelize 127 | * 128 | * Takes multiple words separated by spaces or underscores and camelizes them 129 | * 130 | * @access public 131 | * @param string 132 | * @return str 133 | */ 134 | if ( ! function_exists('camelize')) 135 | { 136 | function camelize($str) 137 | { 138 | $str = 'x'.strtolower(trim($str)); 139 | $str = ucwords(preg_replace('/[\s_]+/', ' ', $str)); 140 | return substr(str_replace(' ', '', $str), 1); 141 | } 142 | } 143 | 144 | // -------------------------------------------------------------------- 145 | 146 | /** 147 | * Underscore 148 | * 149 | * Takes multiple words separated by spaces and underscores them 150 | * 151 | * @access public 152 | * @param string 153 | * @return str 154 | */ 155 | if ( ! function_exists('underscore')) 156 | { 157 | function underscore($str) 158 | { 159 | return preg_replace('/[\s]+/', '_', strtolower(trim($str))); 160 | } 161 | } 162 | 163 | // -------------------------------------------------------------------- 164 | 165 | /** 166 | * Humanize 167 | * 168 | * Takes multiple words separated by underscores and changes them to spaces 169 | * 170 | * @access public 171 | * @param string 172 | * @return str 173 | */ 174 | if ( ! function_exists('humanize')) 175 | { 176 | function humanize($str) 177 | { 178 | return ucwords(preg_replace('/[_]+/', ' ', strtolower(trim($str)))); 179 | } 180 | } 181 | 182 | 183 | /* End of file inflector_helper.php */ 184 | /* Location: ./system/helpers/inflector_helper.php */ -------------------------------------------------------------------------------- /lack/config/mimes.php: -------------------------------------------------------------------------------- 1 | 'application/mac-binhex40', 12 | 'cpt' => 'application/mac-compactpro', 13 | 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel'), 14 | 'bin' => 'application/macbinary', 15 | 'dms' => 'application/octet-stream', 16 | 'lha' => 'application/octet-stream', 17 | 'lzh' => 'application/octet-stream', 18 | 'exe' => array('application/octet-stream', 'application/x-msdownload'), 19 | 'class' => 'application/octet-stream', 20 | 'psd' => 'application/x-photoshop', 21 | 'so' => 'application/octet-stream', 22 | 'sea' => 'application/octet-stream', 23 | 'dll' => 'application/octet-stream', 24 | 'oda' => 'application/oda', 25 | 'pdf' => array('application/pdf', 'application/x-download'), 26 | 'ai' => 'application/postscript', 27 | 'eps' => 'application/postscript', 28 | 'ps' => 'application/postscript', 29 | 'smi' => 'application/smil', 30 | 'smil' => 'application/smil', 31 | 'mif' => 'application/vnd.mif', 32 | 'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'), 33 | 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'), 34 | 'wbxml' => 'application/wbxml', 35 | 'wmlc' => 'application/wmlc', 36 | 'dcr' => 'application/x-director', 37 | 'dir' => 'application/x-director', 38 | 'dxr' => 'application/x-director', 39 | 'dvi' => 'application/x-dvi', 40 | 'gtar' => 'application/x-gtar', 41 | 'gz' => 'application/x-gzip', 42 | 'php' => 'application/x-httpd-php', 43 | 'php4' => 'application/x-httpd-php', 44 | 'php3' => 'application/x-httpd-php', 45 | 'phtml' => 'application/x-httpd-php', 46 | 'phps' => 'application/x-httpd-php-source', 47 | 'js' => 'application/x-javascript', 48 | 'swf' => 'application/x-shockwave-flash', 49 | 'sit' => 'application/x-stuffit', 50 | 'tar' => 'application/x-tar', 51 | 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'), 52 | 'xhtml' => 'application/xhtml+xml', 53 | 'xht' => 'application/xhtml+xml', 54 | 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'), 55 | 'mid' => 'audio/midi', 56 | 'midi' => 'audio/midi', 57 | 'mpga' => 'audio/mpeg', 58 | 'mp2' => 'audio/mpeg', 59 | 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'), 60 | 'aif' => 'audio/x-aiff', 61 | 'aiff' => 'audio/x-aiff', 62 | 'aifc' => 'audio/x-aiff', 63 | 'ram' => 'audio/x-pn-realaudio', 64 | 'rm' => 'audio/x-pn-realaudio', 65 | 'rpm' => 'audio/x-pn-realaudio-plugin', 66 | 'ra' => 'audio/x-realaudio', 67 | 'rv' => 'video/vnd.rn-realvideo', 68 | 'wav' => 'audio/x-wav', 69 | 'bmp' => 'image/bmp', 70 | 'gif' => 'image/gif', 71 | 'jpeg' => array('image/jpeg', 'image/pjpeg'), 72 | 'jpg' => array('image/jpeg', 'image/pjpeg'), 73 | 'jpe' => array('image/jpeg', 'image/pjpeg'), 74 | 'png' => array('image/png', 'image/x-png'), 75 | 'tiff' => 'image/tiff', 76 | 'tif' => 'image/tiff', 77 | 'css' => 'text/css', 78 | 'html' => 'text/html', 79 | 'htm' => 'text/html', 80 | 'shtml' => 'text/html', 81 | 'txt' => 'text/plain', 82 | 'text' => 'text/plain', 83 | 'log' => array('text/plain', 'text/x-log'), 84 | 'rtx' => 'text/richtext', 85 | 'rtf' => 'text/rtf', 86 | 'xml' => 'text/xml', 87 | 'xsl' => 'text/xml', 88 | 'mpeg' => 'video/mpeg', 89 | 'mpg' => 'video/mpeg', 90 | 'mpe' => 'video/mpeg', 91 | 'qt' => 'video/quicktime', 92 | 'mov' => 'video/quicktime', 93 | 'avi' => 'video/x-msvideo', 94 | 'movie' => 'video/x-sgi-movie', 95 | 'doc' => 'application/msword', 96 | 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 97 | 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 98 | 'word' => array('application/msword', 'application/octet-stream'), 99 | 'xl' => 'application/excel', 100 | 'eml' => 'message/rfc822', 101 | 'json' => array('application/json', 'text/json') 102 | ); 103 | 104 | 105 | /* End of file mimes.php */ 106 | /* Location: ./application/config/mimes.php */ -------------------------------------------------------------------------------- /lack/ci/database/DB.php: -------------------------------------------------------------------------------- 1 | $dns['scheme'], 75 | 'hostname' => (isset($dns['host'])) ? rawurldecode($dns['host']) : '', 76 | 'username' => (isset($dns['user'])) ? rawurldecode($dns['user']) : '', 77 | 'password' => (isset($dns['pass'])) ? rawurldecode($dns['pass']) : '', 78 | 'database' => (isset($dns['path'])) ? rawurldecode(substr($dns['path'], 1)) : '' 79 | ); 80 | 81 | // were additional config items set? 82 | if (isset($dns['query'])) 83 | { 84 | parse_str($dns['query'], $extra); 85 | 86 | foreach ($extra as $key => $val) 87 | { 88 | // booleans please 89 | if (strtoupper($val) == "TRUE") 90 | { 91 | $val = TRUE; 92 | } 93 | elseif (strtoupper($val) == "FALSE") 94 | { 95 | $val = FALSE; 96 | } 97 | 98 | $params[$key] = $val; 99 | } 100 | } 101 | } 102 | 103 | // No DB specified yet? Beat them senseless... 104 | if ( ! isset($params['dbdriver']) OR $params['dbdriver'] == '') 105 | { 106 | show_error('You have not selected a database type to connect to.'); 107 | } 108 | 109 | // Load the DB classes. Note: Since the active record class is optional 110 | // we need to dynamically create a class that extends proper parent class 111 | // based on whether we're using the active record class or not. 112 | // Kudos to Paul for discovering this clever use of eval() 113 | 114 | if ($active_record_override !== NULL) 115 | { 116 | $active_record = $active_record_override; 117 | } 118 | 119 | require_once(BASEPATH.'database/DB_driver.php'); 120 | 121 | if ( ! isset($active_record) OR $active_record == TRUE) 122 | { 123 | require_once(BASEPATH.'database/DB_active_rec.php'); 124 | 125 | if ( ! class_exists('CI_DB')) 126 | { 127 | eval('class CI_DB extends CI_DB_active_record { }'); 128 | } 129 | } 130 | else 131 | { 132 | if ( ! class_exists('CI_DB')) 133 | { 134 | eval('class CI_DB extends CI_DB_driver { }'); 135 | } 136 | } 137 | 138 | require_once(BASEPATH.'database/drivers/'.$params['dbdriver'].'/'.$params['dbdriver'].'_driver.php'); 139 | 140 | // Instantiate the DB adapter 141 | $driver = 'CI_DB_'.$params['dbdriver'].'_driver'; 142 | $DB = new $driver($params); 143 | 144 | if ($DB->autoinit == TRUE) 145 | { 146 | $DB->initialize(); 147 | } 148 | 149 | if (isset($params['stricton']) && $params['stricton'] == TRUE) 150 | { 151 | $DB->query('SET SESSION sql_mode="STRICT_ALL_TABLES"'); 152 | } 153 | 154 | return $DB; 155 | } 156 | 157 | 158 | 159 | /* End of file DB.php */ 160 | /* Location: ./system/database/DB.php */ -------------------------------------------------------------------------------- /lack/ci/libraries/Cache/drivers/Cache_file.php: -------------------------------------------------------------------------------- 1 | load->helper('file'); 39 | 40 | $path = $CI->config->item('cache_path'); 41 | 42 | $this->_cache_path = ($path == '') ? APPPATH.'cache/' : $path; 43 | } 44 | 45 | // ------------------------------------------------------------------------ 46 | 47 | /** 48 | * Fetch from cache 49 | * 50 | * @param mixed unique key id 51 | * @return mixed data on success/false on failure 52 | */ 53 | public function get($id) 54 | { 55 | if ( ! file_exists($this->_cache_path.$id)) 56 | { 57 | return FALSE; 58 | } 59 | 60 | $data = read_file($this->_cache_path.$id); 61 | $data = unserialize($data); 62 | 63 | if (time() > $data['time'] + $data['ttl']) 64 | { 65 | unlink($this->_cache_path.$id); 66 | return FALSE; 67 | } 68 | 69 | return $data['data']; 70 | } 71 | 72 | // ------------------------------------------------------------------------ 73 | 74 | /** 75 | * Save into cache 76 | * 77 | * @param string unique key 78 | * @param mixed data to store 79 | * @param int length of time (in seconds) the cache is valid 80 | * - Default is 60 seconds 81 | * @return boolean true on success/false on failure 82 | */ 83 | public function save($id, $data, $ttl = 60) 84 | { 85 | $contents = array( 86 | 'time' => time(), 87 | 'ttl' => $ttl, 88 | 'data' => $data 89 | ); 90 | 91 | if (write_file($this->_cache_path.$id, serialize($contents))) 92 | { 93 | @chmod($this->_cache_path.$id, 0777); 94 | return TRUE; 95 | } 96 | 97 | return FALSE; 98 | } 99 | 100 | // ------------------------------------------------------------------------ 101 | 102 | /** 103 | * Delete from Cache 104 | * 105 | * @param mixed unique identifier of item in cache 106 | * @return boolean true on success/false on failure 107 | */ 108 | public function delete($id) 109 | { 110 | return unlink($this->_cache_path.$id); 111 | } 112 | 113 | // ------------------------------------------------------------------------ 114 | 115 | /** 116 | * Clean the Cache 117 | * 118 | * @return boolean false on failure/true on success 119 | */ 120 | public function clean() 121 | { 122 | return delete_files($this->_cache_path); 123 | } 124 | 125 | // ------------------------------------------------------------------------ 126 | 127 | /** 128 | * Cache Info 129 | * 130 | * Not supported by file-based caching 131 | * 132 | * @param string user/filehits 133 | * @return mixed FALSE 134 | */ 135 | public function cache_info($type = NULL) 136 | { 137 | return get_dir_file_info($this->_cache_path); 138 | } 139 | 140 | // ------------------------------------------------------------------------ 141 | 142 | /** 143 | * Get Cache Metadata 144 | * 145 | * @param mixed key to get cache metadata on 146 | * @return mixed FALSE on failure, array on success. 147 | */ 148 | public function get_metadata($id) 149 | { 150 | if ( ! file_exists($this->_cache_path.$id)) 151 | { 152 | return FALSE; 153 | } 154 | 155 | $data = read_file($this->_cache_path.$id); 156 | $data = unserialize($data); 157 | 158 | if (is_array($data)) 159 | { 160 | $data = $data['data']; 161 | $mtime = filemtime($this->_cache_path.$id); 162 | 163 | if ( ! isset($data['ttl'])) 164 | { 165 | return FALSE; 166 | } 167 | 168 | return array( 169 | 'expire' => $mtime + $data['ttl'], 170 | 'mtime' => $mtime 171 | ); 172 | } 173 | 174 | return FALSE; 175 | } 176 | 177 | // ------------------------------------------------------------------------ 178 | 179 | /** 180 | * Is supported 181 | * 182 | * In the file driver, check to see that the cache directory is indeed writable 183 | * 184 | * @return boolean 185 | */ 186 | public function is_supported() 187 | { 188 | return is_really_writable($this->_cache_path); 189 | } 190 | 191 | // ------------------------------------------------------------------------ 192 | } 193 | // End Class 194 | 195 | /* End of file Cache_file.php */ 196 | /* Location: ./system/libraries/Cache/drivers/Cache_file.php */ -------------------------------------------------------------------------------- /lack/ci/core/Exceptions.php: -------------------------------------------------------------------------------- 1 | 'Error', 37 | E_WARNING => 'Warning', 38 | E_PARSE => 'Parsing Error', 39 | E_NOTICE => 'Notice', 40 | E_CORE_ERROR => 'Core Error', 41 | E_CORE_WARNING => 'Core Warning', 42 | E_COMPILE_ERROR => 'Compile Error', 43 | E_COMPILE_WARNING => 'Compile Warning', 44 | E_USER_ERROR => 'User Error', 45 | E_USER_WARNING => 'User Warning', 46 | E_USER_NOTICE => 'User Notice', 47 | E_STRICT => 'Runtime Notice' 48 | ); 49 | 50 | 51 | /** 52 | * Constructor 53 | */ 54 | public function __construct() 55 | { 56 | $this->ob_level = ob_get_level(); 57 | // Note: Do not log messages from this constructor. 58 | } 59 | 60 | // -------------------------------------------------------------------- 61 | 62 | /** 63 | * Exception Logger 64 | * 65 | * This function logs PHP generated error messages 66 | * 67 | * @access private 68 | * @param string the error severity 69 | * @param string the error string 70 | * @param string the error filepath 71 | * @param string the error line number 72 | * @return string 73 | */ 74 | function log_exception($severity, $message, $filepath, $line) 75 | { 76 | $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; 77 | 78 | log_message('error', 'Severity: '.$severity.' --> '.$message. ' '.$filepath.' '.$line, TRUE); 79 | } 80 | 81 | // -------------------------------------------------------------------- 82 | 83 | /** 84 | * 404 Page Not Found Handler 85 | * 86 | * @access private 87 | * @param string 88 | * @return string 89 | */ 90 | function show_404($page = '', $log_error = TRUE) 91 | { 92 | $heading = "404 Page Not Found"; 93 | $message = "The page you requested was not found."; 94 | 95 | // By default we log this, but allow a dev to skip it 96 | if ($log_error) 97 | { 98 | log_message('error', '404 Page Not Found --> '.$page); 99 | } 100 | 101 | echo $this->show_error($heading, $message, 'error_404', 404); 102 | exit; 103 | } 104 | 105 | // -------------------------------------------------------------------- 106 | 107 | /** 108 | * General Error Page 109 | * 110 | * This function takes an error message as input 111 | * (either as a string or an array) and displays 112 | * it using the specified template. 113 | * 114 | * @access private 115 | * @param string the heading 116 | * @param string the message 117 | * @param string the template name 118 | * @return string 119 | */ 120 | function show_error($heading, $message, $template = 'error_general', $status_code = 500) 121 | { 122 | set_status_header($status_code); 123 | 124 | $message = '

'.implode('

', ( ! is_array($message)) ? array($message) : $message).'

'; 125 | 126 | if (ob_get_level() > $this->ob_level + 1) 127 | { 128 | ob_end_flush(); 129 | } 130 | ob_start(); 131 | include(APPPATH.'errors/'.$template.'.php'); 132 | $buffer = ob_get_contents(); 133 | ob_end_clean(); 134 | return $buffer; 135 | } 136 | 137 | // -------------------------------------------------------------------- 138 | 139 | /** 140 | * Native PHP error handler 141 | * 142 | * @access private 143 | * @param string the error severity 144 | * @param string the error string 145 | * @param string the error filepath 146 | * @param string the error line number 147 | * @return string 148 | */ 149 | function show_php_error($severity, $message, $filepath, $line) 150 | { 151 | $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity]; 152 | 153 | $filepath = str_replace("\\", "/", $filepath); 154 | 155 | // For safety reasons we do not show the full file path 156 | if (FALSE !== strpos($filepath, '/')) 157 | { 158 | $x = explode('/', $filepath); 159 | $filepath = $x[count($x)-2].'/'.end($x); 160 | } 161 | 162 | if (ob_get_level() > $this->ob_level + 1) 163 | { 164 | ob_end_flush(); 165 | } 166 | ob_start(); 167 | include(APPPATH.'errors/error_php.php'); 168 | $buffer = ob_get_contents(); 169 | ob_end_clean(); 170 | echo $buffer; 171 | } 172 | 173 | 174 | } 175 | // END Exceptions Class 176 | 177 | /* End of file Exceptions.php */ 178 | /* Location: ./system/core/Exceptions.php */ -------------------------------------------------------------------------------- /lack/ci/database/DB_cache.php: -------------------------------------------------------------------------------- 1 | CI 39 | // and load the file helper since we use it a lot 40 | $this->CI =& get_instance(); 41 | $this->db =& $db; 42 | $this->CI->load->helper('file'); 43 | } 44 | 45 | // -------------------------------------------------------------------- 46 | 47 | /** 48 | * Set Cache Directory Path 49 | * 50 | * @access public 51 | * @param string the path to the cache directory 52 | * @return bool 53 | */ 54 | function check_path($path = '') 55 | { 56 | if ($path == '') 57 | { 58 | if ($this->db->cachedir == '') 59 | { 60 | return $this->db->cache_off(); 61 | } 62 | 63 | $path = $this->db->cachedir; 64 | } 65 | 66 | // Add a trailing slash to the path if needed 67 | $path = preg_replace("/(.+?)\/*$/", "\\1/", $path); 68 | 69 | if ( ! is_dir($path) OR ! is_really_writable($path)) 70 | { 71 | // If the path is wrong we'll turn off caching 72 | return $this->db->cache_off(); 73 | } 74 | 75 | $this->db->cachedir = $path; 76 | return TRUE; 77 | } 78 | 79 | // -------------------------------------------------------------------- 80 | 81 | /** 82 | * Retrieve a cached query 83 | * 84 | * The URI being requested will become the name of the cache sub-folder. 85 | * An MD5 hash of the SQL statement will become the cache file name 86 | * 87 | * @access public 88 | * @return string 89 | */ 90 | function read($sql) 91 | { 92 | if ( ! $this->check_path()) 93 | { 94 | return $this->db->cache_off(); 95 | } 96 | 97 | $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); 98 | 99 | $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); 100 | 101 | $filepath = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'.md5($sql); 102 | 103 | if (FALSE === ($cachedata = read_file($filepath))) 104 | { 105 | return FALSE; 106 | } 107 | 108 | return unserialize($cachedata); 109 | } 110 | 111 | // -------------------------------------------------------------------- 112 | 113 | /** 114 | * Write a query to a cache file 115 | * 116 | * @access public 117 | * @return bool 118 | */ 119 | function write($sql, $object) 120 | { 121 | if ( ! $this->check_path()) 122 | { 123 | return $this->db->cache_off(); 124 | } 125 | 126 | $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); 127 | 128 | $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); 129 | 130 | $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; 131 | 132 | $filename = md5($sql); 133 | 134 | if ( ! @is_dir($dir_path)) 135 | { 136 | if ( ! @mkdir($dir_path, DIR_WRITE_MODE)) 137 | { 138 | return FALSE; 139 | } 140 | 141 | @chmod($dir_path, DIR_WRITE_MODE); 142 | } 143 | 144 | if (write_file($dir_path.$filename, serialize($object)) === FALSE) 145 | { 146 | return FALSE; 147 | } 148 | 149 | @chmod($dir_path.$filename, FILE_WRITE_MODE); 150 | return TRUE; 151 | } 152 | 153 | // -------------------------------------------------------------------- 154 | 155 | /** 156 | * Delete cache files within a particular directory 157 | * 158 | * @access public 159 | * @return bool 160 | */ 161 | function delete($segment_one = '', $segment_two = '') 162 | { 163 | if ($segment_one == '') 164 | { 165 | $segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1); 166 | } 167 | 168 | if ($segment_two == '') 169 | { 170 | $segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2); 171 | } 172 | 173 | $dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/'; 174 | 175 | delete_files($dir_path, TRUE); 176 | } 177 | 178 | // -------------------------------------------------------------------- 179 | 180 | /** 181 | * Delete all existing cache files 182 | * 183 | * @access public 184 | * @return bool 185 | */ 186 | function delete_all() 187 | { 188 | delete_files($this->db->cachedir, TRUE); 189 | } 190 | 191 | } 192 | 193 | 194 | /* End of file DB_cache.php */ 195 | /* Location: ./system/database/DB_cache.php */ -------------------------------------------------------------------------------- /lack/ci/libraries/Parser.php: -------------------------------------------------------------------------------- 1 | load->view($template, $data, TRUE); 49 | 50 | return $this->_parse($template, $data, $return); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Parse a String 57 | * 58 | * Parses pseudo-variables contained in the specified string, 59 | * replacing them with the data in the second param 60 | * 61 | * @access public 62 | * @param string 63 | * @param array 64 | * @param bool 65 | * @return string 66 | */ 67 | function parse_string($template, $data, $return = FALSE) 68 | { 69 | return $this->_parse($template, $data, $return); 70 | } 71 | 72 | // -------------------------------------------------------------------- 73 | 74 | /** 75 | * Parse a template 76 | * 77 | * Parses pseudo-variables contained in the specified template, 78 | * replacing them with the data in the second param 79 | * 80 | * @access public 81 | * @param string 82 | * @param array 83 | * @param bool 84 | * @return string 85 | */ 86 | function _parse($template, $data, $return = FALSE) 87 | { 88 | if ($template == '') 89 | { 90 | return FALSE; 91 | } 92 | 93 | foreach ($data as $key => $val) 94 | { 95 | if (is_array($val)) 96 | { 97 | $template = $this->_parse_pair($key, $val, $template); 98 | } 99 | else 100 | { 101 | $template = $this->_parse_single($key, (string)$val, $template); 102 | } 103 | } 104 | 105 | if ($return == FALSE) 106 | { 107 | $CI =& get_instance(); 108 | $CI->output->append_output($template); 109 | } 110 | 111 | return $template; 112 | } 113 | 114 | // -------------------------------------------------------------------- 115 | 116 | /** 117 | * Set the left/right variable delimiters 118 | * 119 | * @access public 120 | * @param string 121 | * @param string 122 | * @return void 123 | */ 124 | function set_delimiters($l = '{', $r = '}') 125 | { 126 | $this->l_delim = $l; 127 | $this->r_delim = $r; 128 | } 129 | 130 | // -------------------------------------------------------------------- 131 | 132 | /** 133 | * Parse a single key/value 134 | * 135 | * @access private 136 | * @param string 137 | * @param string 138 | * @param string 139 | * @return string 140 | */ 141 | function _parse_single($key, $val, $string) 142 | { 143 | return str_replace($this->l_delim.$key.$this->r_delim, $val, $string); 144 | } 145 | 146 | // -------------------------------------------------------------------- 147 | 148 | /** 149 | * Parse a tag pair 150 | * 151 | * Parses tag pairs: {some_tag} string... {/some_tag} 152 | * 153 | * @access private 154 | * @param string 155 | * @param array 156 | * @param string 157 | * @return string 158 | */ 159 | function _parse_pair($variable, $data, $string) 160 | { 161 | if (FALSE === ($match = $this->_match_pair($string, $variable))) 162 | { 163 | return $string; 164 | } 165 | 166 | $str = ''; 167 | foreach ($data as $row) 168 | { 169 | $temp = $match['1']; 170 | foreach ($row as $key => $val) 171 | { 172 | if ( ! is_array($val)) 173 | { 174 | $temp = $this->_parse_single($key, $val, $temp); 175 | } 176 | else 177 | { 178 | $temp = $this->_parse_pair($key, $val, $temp); 179 | } 180 | } 181 | 182 | $str .= $temp; 183 | } 184 | 185 | return str_replace($match['0'], $str, $string); 186 | } 187 | 188 | // -------------------------------------------------------------------- 189 | 190 | /** 191 | * Matches a variable pair 192 | * 193 | * @access private 194 | * @param string 195 | * @param string 196 | * @return mixed 197 | */ 198 | function _match_pair($string, $variable) 199 | { 200 | if ( ! preg_match("|" . preg_quote($this->l_delim) . $variable . preg_quote($this->r_delim) . "(.+?)". preg_quote($this->l_delim) . '/' . $variable . preg_quote($this->r_delim) . "|s", $string, $match)) 201 | { 202 | return FALSE; 203 | } 204 | 205 | return $match; 206 | } 207 | 208 | } 209 | // END Parser Class 210 | 211 | /* End of file Parser.php */ 212 | /* Location: ./system/libraries/Parser.php */ 213 | -------------------------------------------------------------------------------- /lack/ci/core/Hooks.php: -------------------------------------------------------------------------------- 1 | _initialize(); 42 | log_message('debug', "Hooks Class Initialized"); 43 | } 44 | 45 | // -------------------------------------------------------------------- 46 | 47 | /** 48 | * Initialize the Hooks Preferences 49 | * 50 | * @access private 51 | * @return void 52 | */ 53 | function _initialize() 54 | { 55 | $CFG =& load_class('Config', 'core'); 56 | 57 | // If hooks are not enabled in the config file 58 | // there is nothing else to do 59 | 60 | if ($CFG->item('enable_hooks') == FALSE) 61 | { 62 | return; 63 | } 64 | 65 | // Grab the "hooks" definition file. 66 | // If there are no hooks, we're done. 67 | 68 | if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) 69 | { 70 | include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'); 71 | } 72 | elseif (is_file(APPPATH.'config/hooks.php')) 73 | { 74 | include(APPPATH.'config/hooks.php'); 75 | } 76 | 77 | 78 | if ( ! isset($hook) OR ! is_array($hook)) 79 | { 80 | return; 81 | } 82 | 83 | $this->hooks =& $hook; 84 | $this->enabled = TRUE; 85 | } 86 | 87 | // -------------------------------------------------------------------- 88 | 89 | /** 90 | * Call Hook 91 | * 92 | * Calls a particular hook 93 | * 94 | * @access private 95 | * @param string the hook name 96 | * @return mixed 97 | */ 98 | function _call_hook($which = '') 99 | { 100 | if ( ! $this->enabled OR ! isset($this->hooks[$which])) 101 | { 102 | return FALSE; 103 | } 104 | 105 | if (isset($this->hooks[$which][0]) AND is_array($this->hooks[$which][0])) 106 | { 107 | foreach ($this->hooks[$which] as $val) 108 | { 109 | $this->_run_hook($val); 110 | } 111 | } 112 | else 113 | { 114 | $this->_run_hook($this->hooks[$which]); 115 | } 116 | 117 | return TRUE; 118 | } 119 | 120 | // -------------------------------------------------------------------- 121 | 122 | /** 123 | * Run Hook 124 | * 125 | * Runs a particular hook 126 | * 127 | * @access private 128 | * @param array the hook details 129 | * @return bool 130 | */ 131 | function _run_hook($data) 132 | { 133 | if ( ! is_array($data)) 134 | { 135 | return FALSE; 136 | } 137 | 138 | // ----------------------------------- 139 | // Safety - Prevents run-away loops 140 | // ----------------------------------- 141 | 142 | // If the script being called happens to have the same 143 | // hook call within it a loop can happen 144 | 145 | if ($this->in_progress == TRUE) 146 | { 147 | return; 148 | } 149 | 150 | // ----------------------------------- 151 | // Set file path 152 | // ----------------------------------- 153 | 154 | if ( ! isset($data['filepath']) OR ! isset($data['filename'])) 155 | { 156 | return FALSE; 157 | } 158 | 159 | $filepath = APPPATH.$data['filepath'].'/'.$data['filename']; 160 | 161 | if ( ! file_exists($filepath)) 162 | { 163 | return FALSE; 164 | } 165 | 166 | // ----------------------------------- 167 | // Set class/function name 168 | // ----------------------------------- 169 | 170 | $class = FALSE; 171 | $function = FALSE; 172 | $params = ''; 173 | 174 | if (isset($data['class']) AND $data['class'] != '') 175 | { 176 | $class = $data['class']; 177 | } 178 | 179 | if (isset($data['function'])) 180 | { 181 | $function = $data['function']; 182 | } 183 | 184 | if (isset($data['params'])) 185 | { 186 | $params = $data['params']; 187 | } 188 | 189 | if ($class === FALSE AND $function === FALSE) 190 | { 191 | return FALSE; 192 | } 193 | 194 | // ----------------------------------- 195 | // Set the in_progress flag 196 | // ----------------------------------- 197 | 198 | $this->in_progress = TRUE; 199 | 200 | // ----------------------------------- 201 | // Call the requested class and/or function 202 | // ----------------------------------- 203 | 204 | if ($class !== FALSE) 205 | { 206 | if ( ! class_exists($class)) 207 | { 208 | require($filepath); 209 | } 210 | 211 | $HOOK = new $class; 212 | $HOOK->$function($params); 213 | } 214 | else 215 | { 216 | if ( ! function_exists($function)) 217 | { 218 | require($filepath); 219 | } 220 | 221 | $function($params); 222 | } 223 | 224 | $this->in_progress = FALSE; 225 | return TRUE; 226 | } 227 | 228 | } 229 | 230 | // END CI_Hooks class 231 | 232 | /* End of file Hooks.php */ 233 | /* Location: ./system/core/Hooks.php */ -------------------------------------------------------------------------------- /lack/ci/database/drivers/mysql/mysql_utility.php: -------------------------------------------------------------------------------- 1 | db->_escape_identifiers($table); 52 | } 53 | 54 | // -------------------------------------------------------------------- 55 | 56 | /** 57 | * Repair table query 58 | * 59 | * Generates a platform-specific query so that a table can be repaired 60 | * 61 | * @access private 62 | * @param string the table name 63 | * @return object 64 | */ 65 | function _repair_table($table) 66 | { 67 | return "REPAIR TABLE ".$this->db->_escape_identifiers($table); 68 | } 69 | 70 | // -------------------------------------------------------------------- 71 | /** 72 | * MySQL Export 73 | * 74 | * @access private 75 | * @param array Preferences 76 | * @return mixed 77 | */ 78 | function _backup($params = array()) 79 | { 80 | if (count($params) == 0) 81 | { 82 | return FALSE; 83 | } 84 | 85 | // Extract the prefs for simplicity 86 | extract($params); 87 | 88 | // Build the output 89 | $output = ''; 90 | foreach ((array)$tables as $table) 91 | { 92 | // Is the table in the "ignore" list? 93 | if (in_array($table, (array)$ignore, TRUE)) 94 | { 95 | continue; 96 | } 97 | 98 | // Get the table schema 99 | $query = $this->db->query("SHOW CREATE TABLE `".$this->db->database.'`.'.$table); 100 | 101 | // No result means the table name was invalid 102 | if ($query === FALSE) 103 | { 104 | continue; 105 | } 106 | 107 | // Write out the table schema 108 | $output .= '#'.$newline.'# TABLE STRUCTURE FOR: '.$table.$newline.'#'.$newline.$newline; 109 | 110 | if ($add_drop == TRUE) 111 | { 112 | $output .= 'DROP TABLE IF EXISTS '.$table.';'.$newline.$newline; 113 | } 114 | 115 | $i = 0; 116 | $result = $query->result_array(); 117 | foreach ($result[0] as $val) 118 | { 119 | if ($i++ % 2) 120 | { 121 | $output .= $val.';'.$newline.$newline; 122 | } 123 | } 124 | 125 | // If inserts are not needed we're done... 126 | if ($add_insert == FALSE) 127 | { 128 | continue; 129 | } 130 | 131 | // Grab all the data from the current table 132 | $query = $this->db->query("SELECT * FROM $table"); 133 | 134 | if ($query->num_rows() == 0) 135 | { 136 | continue; 137 | } 138 | 139 | // Fetch the field names and determine if the field is an 140 | // integer type. We use this info to decide whether to 141 | // surround the data with quotes or not 142 | 143 | $i = 0; 144 | $field_str = ''; 145 | $is_int = array(); 146 | while ($field = mysql_fetch_field($query->result_id)) 147 | { 148 | // Most versions of MySQL store timestamp as a string 149 | $is_int[$i] = (in_array( 150 | strtolower(mysql_field_type($query->result_id, $i)), 151 | array('tinyint', 'smallint', 'mediumint', 'int', 'bigint'), //, 'timestamp'), 152 | TRUE) 153 | ) ? TRUE : FALSE; 154 | 155 | // Create a string of field names 156 | $field_str .= '`'.$field->name.'`, '; 157 | $i++; 158 | } 159 | 160 | // Trim off the end comma 161 | $field_str = preg_replace( "/, $/" , "" , $field_str); 162 | 163 | 164 | // Build the insert string 165 | foreach ($query->result_array() as $row) 166 | { 167 | $val_str = ''; 168 | 169 | $i = 0; 170 | foreach ($row as $v) 171 | { 172 | // Is the value NULL? 173 | if ($v === NULL) 174 | { 175 | $val_str .= 'NULL'; 176 | } 177 | else 178 | { 179 | // Escape the data if it's not an integer 180 | if ($is_int[$i] == FALSE) 181 | { 182 | $val_str .= $this->db->escape($v); 183 | } 184 | else 185 | { 186 | $val_str .= $v; 187 | } 188 | } 189 | 190 | // Append a comma 191 | $val_str .= ', '; 192 | $i++; 193 | } 194 | 195 | // Remove the comma at the end of the string 196 | $val_str = preg_replace( "/, $/" , "" , $val_str); 197 | 198 | // Build the INSERT string 199 | $output .= 'INSERT INTO '.$table.' ('.$field_str.') VALUES ('.$val_str.');'.$newline; 200 | } 201 | 202 | $output .= $newline.$newline; 203 | } 204 | 205 | return $output; 206 | } 207 | } 208 | 209 | /* End of file mysql_utility.php */ 210 | /* Location: ./system/database/drivers/mysql/mysql_utility.php */ -------------------------------------------------------------------------------- /lack/ci/libraries/Cache/Cache.php: -------------------------------------------------------------------------------- 1 | _initialize($config); 49 | } 50 | } 51 | 52 | // ------------------------------------------------------------------------ 53 | 54 | /** 55 | * Get 56 | * 57 | * Look for a value in the cache. If it exists, return the data 58 | * if not, return FALSE 59 | * 60 | * @param string 61 | * @return mixed value that is stored/FALSE on failure 62 | */ 63 | public function get($id) 64 | { 65 | return $this->{$this->_adapter}->get($id); 66 | } 67 | 68 | // ------------------------------------------------------------------------ 69 | 70 | /** 71 | * Cache Save 72 | * 73 | * @param string Unique Key 74 | * @param mixed Data to store 75 | * @param int Length of time (in seconds) to cache the data 76 | * 77 | * @return boolean true on success/false on failure 78 | */ 79 | public function save($id, $data, $ttl = 60) 80 | { 81 | return $this->{$this->_adapter}->save($id, $data, $ttl); 82 | } 83 | 84 | // ------------------------------------------------------------------------ 85 | 86 | /** 87 | * Delete from Cache 88 | * 89 | * @param mixed unique identifier of the item in the cache 90 | * @return boolean true on success/false on failure 91 | */ 92 | public function delete($id) 93 | { 94 | return $this->{$this->_adapter}->delete($id); 95 | } 96 | 97 | // ------------------------------------------------------------------------ 98 | 99 | /** 100 | * Clean the cache 101 | * 102 | * @return boolean false on failure/true on success 103 | */ 104 | public function clean() 105 | { 106 | return $this->{$this->_adapter}->clean(); 107 | } 108 | 109 | // ------------------------------------------------------------------------ 110 | 111 | /** 112 | * Cache Info 113 | * 114 | * @param string user/filehits 115 | * @return mixed array on success, false on failure 116 | */ 117 | public function cache_info($type = 'user') 118 | { 119 | return $this->{$this->_adapter}->cache_info($type); 120 | } 121 | 122 | // ------------------------------------------------------------------------ 123 | 124 | /** 125 | * Get Cache Metadata 126 | * 127 | * @param mixed key to get cache metadata on 128 | * @return mixed return value from child method 129 | */ 130 | public function get_metadata($id) 131 | { 132 | return $this->{$this->_adapter}->get_metadata($id); 133 | } 134 | 135 | // ------------------------------------------------------------------------ 136 | 137 | /** 138 | * Initialize 139 | * 140 | * Initialize class properties based on the configuration array. 141 | * 142 | * @param array 143 | * @return void 144 | */ 145 | private function _initialize($config) 146 | { 147 | $default_config = array( 148 | 'adapter', 149 | 'memcached' 150 | ); 151 | 152 | foreach ($default_config as $key) 153 | { 154 | if (isset($config[$key])) 155 | { 156 | $param = '_'.$key; 157 | 158 | $this->{$param} = $config[$key]; 159 | } 160 | } 161 | 162 | if (isset($config['backup'])) 163 | { 164 | if (in_array('cache_'.$config['backup'], $this->valid_drivers)) 165 | { 166 | $this->_backup_driver = $config['backup']; 167 | } 168 | } 169 | } 170 | 171 | // ------------------------------------------------------------------------ 172 | 173 | /** 174 | * Is the requested driver supported in this environment? 175 | * 176 | * @param string The driver to test. 177 | * @return array 178 | */ 179 | public function is_supported($driver) 180 | { 181 | static $support = array(); 182 | 183 | if ( ! isset($support[$driver])) 184 | { 185 | $support[$driver] = $this->{$driver}->is_supported(); 186 | } 187 | 188 | return $support[$driver]; 189 | } 190 | 191 | // ------------------------------------------------------------------------ 192 | 193 | /** 194 | * __get() 195 | * 196 | * @param child 197 | * @return object 198 | */ 199 | public function __get($child) 200 | { 201 | $obj = parent::__get($child); 202 | 203 | if ( ! $this->is_supported($child)) 204 | { 205 | $this->_adapter = $this->_backup_driver; 206 | } 207 | 208 | return $obj; 209 | } 210 | 211 | // ------------------------------------------------------------------------ 212 | } 213 | // End Class 214 | 215 | /* End of file Cache.php */ 216 | /* Location: ./system/libraries/Cache/Cache.php */ -------------------------------------------------------------------------------- /lack/ci/database/drivers/odbc/odbc_result.php: -------------------------------------------------------------------------------- 1 | result_id); 38 | } 39 | 40 | // -------------------------------------------------------------------- 41 | 42 | /** 43 | * Number of fields in the result set 44 | * 45 | * @access public 46 | * @return integer 47 | */ 48 | function num_fields() 49 | { 50 | return @odbc_num_fields($this->result_id); 51 | } 52 | 53 | // -------------------------------------------------------------------- 54 | 55 | /** 56 | * Fetch Field Names 57 | * 58 | * Generates an array of column names 59 | * 60 | * @access public 61 | * @return array 62 | */ 63 | function list_fields() 64 | { 65 | $field_names = array(); 66 | for ($i = 0; $i < $this->num_fields(); $i++) 67 | { 68 | $field_names[] = odbc_field_name($this->result_id, $i); 69 | } 70 | 71 | return $field_names; 72 | } 73 | 74 | // -------------------------------------------------------------------- 75 | 76 | /** 77 | * Field data 78 | * 79 | * Generates an array of objects containing field meta-data 80 | * 81 | * @access public 82 | * @return array 83 | */ 84 | function field_data() 85 | { 86 | $retval = array(); 87 | for ($i = 0; $i < $this->num_fields(); $i++) 88 | { 89 | $F = new stdClass(); 90 | $F->name = odbc_field_name($this->result_id, $i); 91 | $F->type = odbc_field_type($this->result_id, $i); 92 | $F->max_length = odbc_field_len($this->result_id, $i); 93 | $F->primary_key = 0; 94 | $F->default = ''; 95 | 96 | $retval[] = $F; 97 | } 98 | 99 | return $retval; 100 | } 101 | 102 | // -------------------------------------------------------------------- 103 | 104 | /** 105 | * Free the result 106 | * 107 | * @return null 108 | */ 109 | function free_result() 110 | { 111 | if (is_resource($this->result_id)) 112 | { 113 | odbc_free_result($this->result_id); 114 | $this->result_id = FALSE; 115 | } 116 | } 117 | 118 | // -------------------------------------------------------------------- 119 | 120 | /** 121 | * Data Seek 122 | * 123 | * Moves the internal pointer to the desired offset. We call 124 | * this internally before fetching results to make sure the 125 | * result set starts at zero 126 | * 127 | * @access private 128 | * @return array 129 | */ 130 | function _data_seek($n = 0) 131 | { 132 | return FALSE; 133 | } 134 | 135 | // -------------------------------------------------------------------- 136 | 137 | /** 138 | * Result - associative array 139 | * 140 | * Returns the result set as an array 141 | * 142 | * @access private 143 | * @return array 144 | */ 145 | function _fetch_assoc() 146 | { 147 | if (function_exists('odbc_fetch_object')) 148 | { 149 | return odbc_fetch_array($this->result_id); 150 | } 151 | else 152 | { 153 | return $this->_odbc_fetch_array($this->result_id); 154 | } 155 | } 156 | 157 | // -------------------------------------------------------------------- 158 | 159 | /** 160 | * Result - object 161 | * 162 | * Returns the result set as an object 163 | * 164 | * @access private 165 | * @return object 166 | */ 167 | function _fetch_object() 168 | { 169 | if (function_exists('odbc_fetch_object')) 170 | { 171 | return odbc_fetch_object($this->result_id); 172 | } 173 | else 174 | { 175 | return $this->_odbc_fetch_object($this->result_id); 176 | } 177 | } 178 | 179 | 180 | /** 181 | * Result - object 182 | * 183 | * subsititutes the odbc_fetch_object function when 184 | * not available (odbc_fetch_object requires unixODBC) 185 | * 186 | * @access private 187 | * @return object 188 | */ 189 | function _odbc_fetch_object(& $odbc_result) { 190 | $rs = array(); 191 | $rs_obj = FALSE; 192 | if (odbc_fetch_into($odbc_result, $rs)) { 193 | foreach ($rs as $k=>$v) { 194 | $field_name= odbc_field_name($odbc_result, $k+1); 195 | $rs_obj->$field_name = $v; 196 | } 197 | } 198 | return $rs_obj; 199 | } 200 | 201 | 202 | /** 203 | * Result - array 204 | * 205 | * subsititutes the odbc_fetch_array function when 206 | * not available (odbc_fetch_array requires unixODBC) 207 | * 208 | * @access private 209 | * @return array 210 | */ 211 | function _odbc_fetch_array(& $odbc_result) { 212 | $rs = array(); 213 | $rs_assoc = FALSE; 214 | if (odbc_fetch_into($odbc_result, $rs)) { 215 | $rs_assoc=array(); 216 | foreach ($rs as $k=>$v) { 217 | $field_name= odbc_field_name($odbc_result, $k+1); 218 | $rs_assoc[$field_name] = $v; 219 | } 220 | } 221 | return $rs_assoc; 222 | } 223 | 224 | } 225 | 226 | 227 | /* End of file odbc_result.php */ 228 | /* Location: ./system/database/drivers/odbc/odbc_result.php */ --------------------------------------------------------------------------------