my-simon 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/README.md +3 -20
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/my-simon.gemspec +3 -78
  5. metadata +2 -77
  6. data/DOC/Launch Check List.docx +0 -0
  7. data/DOC/Launch Check List.pdf +0 -0
  8. data/build/rakefile.rb +0 -12
  9. data/config.rb +0 -24
  10. data/scaffolding/simon/controller.tpl +0 -9
  11. data/scaffolding/simon/model.tpl +0 -10
  12. data/scaffolding/simon/view.tpl +0 -5
  13. data/scaffolding/standards/html_template.html +0 -44
  14. data/scaffolding/standards/html_template.php +0 -44
  15. data/scaffolding/standards/jquery_plugin_template.js +0 -45
  16. data/scaffolding/standards/js_template.js +0 -43
  17. data/www/.htaccess +0 -488
  18. data/www/404.html +0 -32
  19. data/www/crossdomain.xml +0 -25
  20. data/www/favicon.ico +0 -0
  21. data/www/index.php +0 -17
  22. data/www/lib/js/homePage.js +0 -43
  23. data/www/lib/js/jquery/JQbook.js +0 -809
  24. data/www/lib/js/jquery/jquery-1.8.0.min.js +0 -27
  25. data/www/lib/js/jquery/jquery.alphanumeric.js +0 -82
  26. data/www/lib/js/jquery/jquery.cookie.js +0 -96
  27. data/www/lib/js/jquery/jquery.easing.1.3.js +0 -207
  28. data/www/lib/js/main.js +0 -117
  29. data/www/lib/js/master.js +0 -6
  30. data/www/lib/js/plugins/handlebars-1.0.rc.1.js +0 -1920
  31. data/www/lib/js/plugins/modernizr-1.7.min.js +0 -2
  32. data/www/lib/js/plugins/swfobject.js +0 -777
  33. data/www/lib/js/plugins_mod/README.txt +0 -3
  34. data/www/lib/php/app.php +0 -53
  35. data/www/lib/php/controller/index.php +0 -10
  36. data/www/lib/php/controller/regex.php +0 -23
  37. data/www/lib/php/model/Book.php +0 -8
  38. data/www/lib/php/model/Model.php +0 -8
  39. data/www/lib/php/plugins/php-activerecord/ActiveRecord.php +0 -44
  40. data/www/lib/php/plugins/php-activerecord/lib/CallBack.php +0 -226
  41. data/www/lib/php/plugins/php-activerecord/lib/Column.php +0 -155
  42. data/www/lib/php/plugins/php-activerecord/lib/Config.php +0 -288
  43. data/www/lib/php/plugins/php-activerecord/lib/Connection.php +0 -456
  44. data/www/lib/php/plugins/php-activerecord/lib/ConnectionManager.php +0 -38
  45. data/www/lib/php/plugins/php-activerecord/lib/DateTime.php +0 -45
  46. data/www/lib/php/plugins/php-activerecord/lib/Exceptions.php +0 -137
  47. data/www/lib/php/plugins/php-activerecord/lib/Expressions.php +0 -183
  48. data/www/lib/php/plugins/php-activerecord/lib/Inflector.php +0 -115
  49. data/www/lib/php/plugins/php-activerecord/lib/Model.php +0 -1673
  50. data/www/lib/php/plugins/php-activerecord/lib/Reflections.php +0 -86
  51. data/www/lib/php/plugins/php-activerecord/lib/Relationship.php +0 -637
  52. data/www/lib/php/plugins/php-activerecord/lib/SQLBuilder.php +0 -396
  53. data/www/lib/php/plugins/php-activerecord/lib/Serialization.php +0 -302
  54. data/www/lib/php/plugins/php-activerecord/lib/Singleton.php +0 -57
  55. data/www/lib/php/plugins/php-activerecord/lib/Table.php +0 -547
  56. data/www/lib/php/plugins/php-activerecord/lib/Utils.php +0 -351
  57. data/www/lib/php/plugins/php-activerecord/lib/Validations.php +0 -833
  58. data/www/lib/php/plugins/php-activerecord/lib/adapters/MysqlAdapter.php +0 -73
  59. data/www/lib/php/plugins/php-activerecord/lib/adapters/OciAdapter.php +0 -121
  60. data/www/lib/php/plugins/php-activerecord/lib/adapters/PgsqlAdapter.php +0 -104
  61. data/www/lib/php/plugins/php-activerecord/lib/adapters/SqliteAdapter.php +0 -81
  62. data/www/lib/php/system/Config.php +0 -174
  63. data/www/lib/php/system/config.routes.php +0 -29
  64. data/www/lib/php/system/router.php +0 -220
  65. data/www/lib/php/template/footer.php +0 -59
  66. data/www/lib/php/template/header.php +0 -74
  67. data/www/lib/php/view/index.php +0 -5
  68. data/www/media/images/facebook_share.jpg +0 -0
  69. data/www/robots.txt +0 -5
  70. data/www/sandbox/readme.txt +0 -3
  71. data/www/sass/javascript.scss +0 -1
  72. data/www/sass/layout.scss +0 -128
  73. data/www/sass/master.scss +0 -4
  74. data/www/sass/reset.scss +0 -47
  75. data/www/sass/typography.scss +0 -24
  76. data/www/styles/javascript.css +0 -1
  77. data/www/styles/layout.css +0 -186
  78. data/www/styles/master.css +0 -4
  79. data/www/styles/reset.css +0 -60
  80. data/www/styles/typography.css +0 -24
@@ -1,73 +0,0 @@
1
- <?php
2
- /**
3
- * @package ActiveRecord
4
- */
5
- namespace ActiveRecord;
6
-
7
- /**
8
- * Adapter for MySQL.
9
- *
10
- * @package ActiveRecord
11
- */
12
- class MysqlAdapter extends Connection
13
- {
14
- static $DEFAULT_PORT = 3306;
15
-
16
- public function limit($sql, $offset, $limit)
17
- {
18
- $offset = intval($offset);
19
- $limit = intval($limit);
20
- return "$sql LIMIT $offset,$limit";
21
- }
22
-
23
- public function query_column_info($table)
24
- {
25
- return $this->query("SHOW COLUMNS FROM $table");
26
- }
27
-
28
- public function query_for_tables()
29
- {
30
- return $this->query('SHOW TABLES');
31
- }
32
-
33
- public function create_column(&$column)
34
- {
35
- $c = new Column();
36
- $c->inflected_name = Inflector::instance()->variablize($column['field']);
37
- $c->name = $column['field'];
38
- $c->nullable = ($column['null'] === 'YES' ? true : false);
39
- $c->pk = ($column['key'] === 'PRI' ? true : false);
40
- $c->auto_increment = ($column['extra'] === 'auto_increment' ? true : false);
41
-
42
- if ($column['type'] == 'timestamp' || $column['type'] == 'datetime')
43
- {
44
- $c->raw_type = 'datetime';
45
- $c->length = 19;
46
- }
47
- elseif ($column['type'] == 'date')
48
- {
49
- $c->raw_type = 'date';
50
- $c->length = 10;
51
- }
52
- elseif ($column['type'] == 'time')
53
- {
54
- $c->raw_type = 'time';
55
- $c->length = 8;
56
- }
57
- else
58
- {
59
- preg_match('/^([A-Za-z0-9_]+)(\(([0-9]+(,[0-9]+)?)\))?/',$column['type'],$matches);
60
-
61
- $c->raw_type = (count($matches) > 0 ? $matches[1] : $column['type']);
62
-
63
- if (count($matches) >= 4)
64
- $c->length = intval($matches[3]);
65
- }
66
-
67
- $c->map_raw_type();
68
- $c->default = $c->cast($column['default'],$this);
69
-
70
- return $c;
71
- }
72
- }
73
- ?>
@@ -1,121 +0,0 @@
1
- <?php
2
- /**
3
- * @package ActiveRecord
4
- */
5
- namespace ActiveRecord;
6
-
7
- use PDO;
8
-
9
- /**
10
- * Adapter for OCI (not completed yet).
11
- *
12
- * @package ActiveRecord
13
- */
14
- class OciAdapter extends Connection
15
- {
16
- static $QUOTE_CHARACTER = '';
17
- static $DEFAULT_PORT = 1521;
18
-
19
- protected function __construct($info)
20
- {
21
- try {
22
- $this->connection = new PDO("oci:dbname=//$info->host/$info->db",$info->user,$info->pass,static::$PDO_OPTIONS);
23
- } catch (PDOException $e) {
24
- throw new DatabaseException($e);
25
- }
26
- }
27
-
28
- public function supports_sequences() { return true; }
29
-
30
- public function get_next_sequence_value($sequence_name)
31
- {
32
- return $this->query_and_fetch_one('SELECT ' . $this->next_sequence_value($sequence_name) . ' FROM dual');
33
- }
34
-
35
- public function next_sequence_value($sequence_name)
36
- {
37
- return "$sequence_name.nextval";
38
- }
39
-
40
- public function date_to_string($datetime)
41
- {
42
- return $datetime->format('d-M-Y');
43
- }
44
-
45
- public function datetime_to_string($datetime)
46
- {
47
- return $datetime->format('d-M-Y h:i:s A');
48
- }
49
-
50
- // $string = DD-MON-YYYY HH12:MI:SS(\.[0-9]+) AM
51
- public function string_to_datetime($string)
52
- {
53
- return parent::string_to_datetime(str_replace('.000000','',$string));
54
- }
55
-
56
- public function limit($sql, $offset, $limit)
57
- {
58
- $offset = intval($offset);
59
- $stop = $offset + intval($limit);
60
- return
61
- "SELECT * FROM (SELECT a.*, rownum ar_rnum__ FROM ($sql) a " .
62
- "WHERE rownum <= $stop) WHERE ar_rnum__ > $offset";
63
- }
64
-
65
- public function query_column_info($table)
66
- {
67
- $sql =
68
- "SELECT c.column_name, c.data_type, c.data_length, c.data_scale, c.data_default, c.nullable, " .
69
- "(SELECT a.constraint_type " .
70
- "FROM all_constraints a, all_cons_columns b " .
71
- "WHERE a.constraint_type='P' " .
72
- "AND a.constraint_name=b.constraint_name " .
73
- "AND a.table_name = t.table_name AND b.column_name=c.column_name) AS pk " .
74
- "FROM user_tables t " .
75
- "INNER JOIN user_tab_columns c on(t.table_name=c.table_name) " .
76
- "WHERE t.table_name=?";
77
-
78
- $values = array(strtoupper($table));
79
- return $this->query($sql,$values);
80
- }
81
-
82
- public function query_for_tables()
83
- {
84
- return $this->query("SELECT table_name FROM user_tables");
85
- }
86
-
87
- public function create_column(&$column)
88
- {
89
- $column['column_name'] = strtolower($column['column_name']);
90
- $column['data_type'] = strtolower(preg_replace('/\(.*?\)/','',$column['data_type']));
91
-
92
- if ($column['data_default'] !== null)
93
- $column['data_default'] = trim($column['data_default'],"' ");
94
-
95
- if ($column['data_type'] == 'number')
96
- {
97
- if ($column['data_scale'] > 0)
98
- $column['data_type'] = 'decimal';
99
- elseif ($column['data_scale'] == 0)
100
- $column['data_type'] = 'int';
101
- }
102
-
103
- $c = new Column();
104
- $c->inflected_name = Inflector::instance()->variablize($column['column_name']);
105
- $c->name = $column['column_name'];
106
- $c->nullable = $column['nullable'] == 'Y' ? true : false;
107
- $c->pk = $column['pk'] == 'P' ? true : false;
108
- $c->length = $column['data_length'];
109
-
110
- if ($column['data_type'] == 'timestamp')
111
- $c->raw_type = 'datetime';
112
- else
113
- $c->raw_type = $column['data_type'];
114
-
115
- $c->map_raw_type();
116
- $c->default = $c->cast($column['data_default'],$this);
117
-
118
- return $c;
119
- }
120
- };
121
- ?>
@@ -1,104 +0,0 @@
1
- <?php
2
- /**
3
- * @package ActiveRecord
4
- */
5
- namespace ActiveRecord;
6
-
7
- /**
8
- * Adapter for Postgres (not completed yet)
9
- *
10
- * @package ActiveRecord
11
- */
12
- class PgsqlAdapter extends Connection
13
- {
14
- static $QUOTE_CHARACTER = '"';
15
- static $DEFAULT_PORT = 5432;
16
-
17
- public function supports_sequences() { return true; }
18
-
19
- public function get_sequence_name($table, $column_name)
20
- {
21
- return "{$table}_{$column_name}_seq";
22
- }
23
-
24
- public function next_sequence_value($sequence_name)
25
- {
26
- return "nextval('" . str_replace("'","\\'",$sequence_name) . "')";
27
- }
28
-
29
- public function limit($sql, $offset, $limit)
30
- {
31
- return $sql . ' LIMIT ' . intval($limit) . ' OFFSET ' . intval($offset);
32
- }
33
-
34
- public function query_column_info($table)
35
- {
36
- $sql = <<<SQL
37
- SELECT a.attname AS field, a.attlen,
38
- REPLACE(pg_catalog.format_type(a.atttypid, a.atttypmod),'character varying','varchar') AS type,
39
- a.attnotnull AS not_nullable,
40
- i.indisprimary as pk,
41
- REGEXP_REPLACE(REGEXP_REPLACE(REGEXP_REPLACE(s.column_default,'::[a-z_ ]+',''),'\'$',''),'^\'','') AS default
42
- FROM pg_catalog.pg_attribute a
43
- LEFT JOIN pg_catalog.pg_class c ON(a.attrelid=c.oid)
44
- LEFT JOIN pg_catalog.pg_index i ON(c.oid=i.indrelid AND a.attnum=any(i.indkey))
45
- LEFT JOIN information_schema.columns s ON(s.table_name=? AND a.attname=s.column_name)
46
- WHERE a.attrelid = (select c.oid from pg_catalog.pg_class c inner join pg_catalog.pg_namespace n on(n.oid=c.relnamespace) where c.relname=? and pg_catalog.pg_table_is_visible(c.oid))
47
- AND a.attnum > 0
48
- AND NOT a.attisdropped
49
- ORDER BY a.attnum
50
- SQL;
51
- $values = array($table,$table);
52
- return $this->query($sql,$values);
53
- }
54
-
55
- public function query_for_tables()
56
- {
57
- return $this->query("SELECT tablename FROM pg_tables WHERE schemaname NOT IN('information_schema','pg_catalog')");
58
- }
59
-
60
- public function create_column(&$column)
61
- {
62
- $c = new Column();
63
- $c->inflected_name = Inflector::instance()->variablize($column['field']);
64
- $c->name = $column['field'];
65
- $c->nullable = ($column['not_nullable'] ? false : true);
66
- $c->pk = ($column['pk'] ? true : false);
67
- $c->auto_increment = false;
68
-
69
- if (substr($column['type'],0,9) == 'timestamp')
70
- {
71
- $c->raw_type = 'datetime';
72
- $c->length = 19;
73
- }
74
- elseif ($column['type'] == 'date')
75
- {
76
- $c->raw_type = 'date';
77
- $c->length = 10;
78
- }
79
- else
80
- {
81
- preg_match('/^([A-Za-z0-9_]+)(\(([0-9]+(,[0-9]+)?)\))?/',$column['type'],$matches);
82
-
83
- $c->raw_type = (count($matches) > 0 ? $matches[1] : $column['type']);
84
- $c->length = count($matches) >= 4 ? intval($matches[3]) : intval($column['attlen']);
85
-
86
- if ($c->length < 0)
87
- $c->length = null;
88
- }
89
-
90
- $c->map_raw_type();
91
-
92
- if ($column['default'])
93
- {
94
- preg_match("/^nextval\('(.*)'\)$/",$column['default'],$matches);
95
-
96
- if (count($matches) == 2)
97
- $c->sequence = $matches[1];
98
- else
99
- $c->default = $c->cast($column['default'],$this);
100
- }
101
- return $c;
102
- }
103
- };
104
- ?>
@@ -1,81 +0,0 @@
1
- <?php
2
- /**
3
- * @package ActiveRecord
4
- */
5
- namespace ActiveRecord;
6
-
7
- use PDO;
8
-
9
- /**
10
- * Adapter for SQLite.
11
- *
12
- * @package ActiveRecord
13
- */
14
- class SqliteAdapter extends Connection
15
- {
16
- protected function __construct($info)
17
- {
18
- if (!file_exists($info->host))
19
- throw new DatabaseException("Could not find sqlite db: $info->host");
20
-
21
- $this->connection = new PDO("sqlite:$info->host",null,null,static::$PDO_OPTIONS);
22
- }
23
-
24
- public function limit($sql, $offset, $limit)
25
- {
26
- $offset = intval($offset);
27
- $limit = intval($limit);
28
- return "$sql LIMIT $offset,$limit";
29
- }
30
-
31
- public function query_column_info($table)
32
- {
33
- return $this->query("pragma table_info($table)");
34
- }
35
-
36
- public function query_for_tables()
37
- {
38
- return $this->query("SELECT name FROM sqlite_master");
39
- }
40
-
41
- public function create_column($column)
42
- {
43
- $c = new Column();
44
- $c->inflected_name = Inflector::instance()->variablize($column['name']);
45
- $c->name = $column['name'];
46
- $c->nullable = $column['notnull'] ? false : true;
47
- $c->pk = $column['pk'] ? true : false;
48
- $c->auto_increment = $column['type'] == 'INTEGER' && $c->pk;
49
-
50
- $column['type'] = preg_replace('/ +/',' ',$column['type']);
51
- $column['type'] = str_replace(array('(',')'),' ',$column['type']);
52
- $column['type'] = Utils::squeeze(' ',$column['type']);
53
- $matches = explode(' ',$column['type']);
54
-
55
- if (!empty($matches))
56
- {
57
- $c->raw_type = strtolower($matches[0]);
58
-
59
- if (count($matches) > 1)
60
- $c->length = intval($matches[1]);
61
- }
62
-
63
- $c->map_raw_type();
64
-
65
- if ($c->type == Column::DATETIME)
66
- $c->length = 19;
67
- elseif ($c->type == Column::DATE)
68
- $c->length = 10;
69
-
70
- // From SQLite3 docs: The value is a signed integer, stored in 1, 2, 3, 4, 6,
71
- // or 8 bytes depending on the magnitude of the value.
72
- // so is it ok to assume it's possible an int can always go up to 8 bytes?
73
- if ($c->type == Column::INTEGER && !$c->length)
74
- $c->length = 8;
75
-
76
- $c->default = $c->cast($column['dflt_value'],$this);
77
-
78
- return $c;
79
- }
80
- };
81
- ?>
@@ -1,174 +0,0 @@
1
- <?php
2
- error_reporting(E_ALL);
3
- ini_set('display_errors', '1');
4
-
5
- // =======================
6
- // = constants =
7
- // =======================
8
- define("LOCAL", "local_host_environment");
9
- define("DEV", "dev_host_environment");
10
- define("STAGE", "stage_host_environment");
11
- define("PROD", "production_host_environment");
12
-
13
- require_once DIR_PLUGINS.'/php-activerecord/ActiveRecord.php';
14
-
15
- class Config {
16
-
17
-
18
- private static $instance;
19
-
20
-
21
- // =====================
22
- // = production variables =
23
- // =====================
24
-
25
- var $environment;
26
- var $dbhost;
27
- var $dbuser;
28
- var $dbpass;
29
- var $dbname;
30
- var $dbport;
31
- var $cdn_path;
32
- var $base_url;
33
- var $use_min;
34
- var $debug;
35
- var $server_name;
36
- var $analytics_id = "%google_id%";
37
- var $protocol;
38
- var $facebook_app_id;
39
- var $page;
40
- var $title = "Evolution Bureau |";
41
-
42
- private function __construct($server_name = '') {
43
-
44
- $this->_setprotocol();
45
-
46
- $this->server_name = $server_name == ''?$_SERVER['SERVER_NAME']:$server_name;
47
-
48
-
49
- switch($this->server_name) {
50
- case "boiler.evb.com":
51
-
52
- $this->environment = LOCAL;
53
- $this->dbhost = '%l_host%';
54
- $this->dbuser = "%l_user%";
55
- $this->dbpass = "%l_pass%";
56
- $this->dbname = "%l_dbname%";
57
- $this->cdn_path = "/";
58
- $this->base_url = "/";
59
- $this->use_min = FALSE;
60
- $this->debug = FALSE;
61
- $this->facebook_app_id = "";
62
-
63
- break;
64
-
65
- case "production_url.com":
66
- //turn off error reporting for production
67
- error_reporting(0);
68
- ini_set('display_errors', '0');
69
- $this->environment = PROD;
70
- $this->dbhost = 'localhost';
71
- $this->dbuser = "root";
72
- $this->dbpass = "root";
73
- $this->dbname = "DATABASE_NAME";
74
- $this->cdn_path = "";
75
- $this->base_url = "/";
76
- $this->use_min = FALSE;
77
- $this->debug = FALSE;
78
- $this->facebook_app_id = "";
79
-
80
- break;
81
-
82
- default:
83
- trigger_error('No environment domain has been setup. (e.g. local, development, stage) ', E_USER_ERROR);
84
- // =================================================================================
85
- // = Please copy and paste a case in the switch statment for your local enviroment =
86
- // =================================================================================
87
- break;
88
- }
89
-
90
- $this->_setup_db();
91
- }
92
-
93
-
94
-
95
-
96
- public static function getInstance() {
97
- if (!isset(self::$instance)) {
98
- $c = __CLASS__;
99
- self::$instance = new $c;
100
- }
101
-
102
- return self::$instance;
103
- }
104
-
105
- public function app_vars_JSON(){
106
- $ar = array(
107
- "environment" => $this->environment,
108
- "cdn_path" => $this->cdn_path,
109
- "facebook_app_id" => $this->facebook_app_id,
110
- "debug" => $this->debug,
111
- "page" => $this->page,
112
- "title" => $this->title,
113
- "base_url" => $this->base_url,
114
- );
115
- return json_encode($ar);
116
- }
117
-
118
- public function setPage($p_page){
119
-
120
- $this->page = $p_page;
121
- }
122
-
123
- public function getPageTitle(){
124
-
125
- echo $this->title.'-> '.$this->page;
126
- }
127
-
128
- public function getBaseUrl() {
129
-
130
- return $this->base_url;
131
-
132
- }
133
-
134
-
135
- public function getConnectionSettings() {
136
- return array(
137
- 'hostname' => $this->dbhost,
138
- 'port' => $this->dbport, //'3306'
139
- 'username' => $this->dbuser,
140
- 'password' => $this->dbpass,
141
- 'database' => $this->dbname,
142
- 'debug' => $this->debug
143
- );
144
- }
145
-
146
- private function _setprotocol(){
147
-
148
- if($_SERVER['SERVER_PORT'] == 80){
149
- $this->protocol = "http";
150
- }else{
151
- $this->protocol = "https";
152
- }
153
- }
154
-
155
- private function _setup_db(){
156
-
157
- $connections = array(
158
- 'development' => 'mysql://'.$this->dbuser.':'.$this->dbpass.'@'.$this->dbhost.'/'.$this->dbname
159
- );
160
-
161
- # must issue a "use" statement in your closure if passing variables
162
- ActiveRecord\Config::initialize(function($cfg) use ($connections)
163
- {
164
- $cfg->set_model_directory($_SERVER['DOCUMENT_ROOT'].'/lib/php/model');
165
- $cfg->set_connections($connections);
166
- $cfg->set_default_connection('development');
167
- });
168
- }
169
-
170
-
171
- }
172
-
173
-
174
- ?>