wheels 0.0.48 → 0.0.49

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. data/VERSION +1 -1
  2. data/app/controllers/access_control_entries_controller.rb +4 -4
  3. data/app/controllers/external_links_controller.rb +5 -0
  4. data/app/controllers/feedbacks_controller.rb +10 -0
  5. data/app/controllers/menus_controller.rb +2 -0
  6. data/app/controllers/pages_controller.rb +16 -29
  7. data/app/controllers/sitemaps_controller.rb +135 -0
  8. data/app/helpers/application_helper.rb +4 -3
  9. data/app/helpers/external_links_helper.rb +2 -0
  10. data/app/helpers/feedbacks_helper.rb +2 -0
  11. data/app/helpers/menus_helper.rb +2 -0
  12. data/app/helpers/sitemaps_helper.rb +12 -0
  13. data/app/mailers/feedback_mailer.rb +10 -0
  14. data/app/models/ability.rb +2 -1
  15. data/app/models/access_control_entry.rb +17 -15
  16. data/app/models/external_link.rb +4 -0
  17. data/app/models/feedback.rb +13 -0
  18. data/app/models/image.rb +1 -1
  19. data/app/models/menu.rb +4 -0
  20. data/app/models/page.rb +2 -5
  21. data/app/models/sitemap.rb +153 -0
  22. data/app/models/user.rb +7 -1
  23. data/app/validators/email_validator.rb +22 -0
  24. data/app/views/access_control_entries/_form.html.haml +1 -1
  25. data/app/views/access_control_entries/_index.html.haml +3 -3
  26. data/app/views/access_control_entries/_show.html.haml +1 -1
  27. data/app/views/external_links/_fields_for.html.haml +2 -0
  28. data/app/views/external_links/_form.html.haml +18 -0
  29. data/app/views/external_links/_show.html.haml +7 -0
  30. data/app/views/external_links/edit.html.haml +7 -0
  31. data/app/views/external_links/index.html.haml +23 -0
  32. data/app/views/external_links/new.html.haml +5 -0
  33. data/app/views/external_links/show.html.haml +2 -0
  34. data/app/views/feedback_mailer/submit_feedback.html.haml +22 -0
  35. data/app/views/feedbacks/_form.html.haml +37 -0
  36. data/app/views/feedbacks/index.html.haml +27 -0
  37. data/app/views/feedbacks/new.html.haml +5 -0
  38. data/app/views/feedbacks/show.html.haml +19 -0
  39. data/app/views/layouts/application.html.haml +21 -16
  40. data/app/views/layouts/bare.html.haml +2 -0
  41. data/app/views/loadbehind/_view.js.haml +1 -2
  42. data/app/views/menus/_form.html.haml +13 -0
  43. data/app/views/menus/edit.html.haml +7 -0
  44. data/app/views/menus/index.html.haml +19 -0
  45. data/app/views/menus/new.html.haml +5 -0
  46. data/app/views/menus/show.html.haml +7 -0
  47. data/app/views/pages/_child_pages_links.html.haml +1 -1
  48. data/app/views/pages/_control_panel.html.haml +1 -6
  49. data/app/views/pages/_form.html.haml +2 -2
  50. data/app/views/pages/_form_fields.html.haml +7 -2
  51. data/app/views/pages/_show.html.haml +4 -0
  52. data/app/views/pages/create.js.haml +2 -1
  53. data/app/views/pages/destroy.js.haml +3 -0
  54. data/app/views/pages/edit.js.haml +4 -0
  55. data/app/views/pages/index.html.haml +4 -2
  56. data/app/views/pages/index.js.haml +3 -0
  57. data/app/views/pages/new.js.haml +3 -0
  58. data/app/views/pages/show.html.haml +2 -10
  59. data/app/views/pages/show.js.haml +3 -0
  60. data/app/views/pages/update.js.haml +2 -2
  61. data/app/views/sitemaps/edit.html.haml +12 -0
  62. data/app/views/sitemaps/edit.js.erb +0 -0
  63. data/app/views/sitemaps/index.html.haml +93 -0
  64. data/app/views/sitemaps/index.json.erb +23 -0
  65. data/app/views/sitemaps/new.html.haml +8 -0
  66. data/app/views/sitemaps/new.js.erb +0 -0
  67. data/app/views/users/edit.html.haml +45 -0
  68. data/db/migrate/{add_fields_to_users.rb → 0010_add_fields_to_users.rb} +0 -0
  69. data/db/migrate/{create_blogs.rb → 0020_create_blogs.rb} +0 -0
  70. data/db/migrate/{create_galleries.rb → 0030_create_galleries.rb} +0 -0
  71. data/db/migrate/{create_images.rb → 0040_create_images.rb} +0 -0
  72. data/db/migrate/{create_profiles.rb → 0050_create_profiles.rb} +0 -0
  73. data/db/migrate/{insert_admin_user_and_roles.rb → 0060_insert_admin_user_and_roles.rb} +0 -0
  74. data/db/migrate/{create_pages.rb → 0070_create_pages.rb} +0 -0
  75. data/db/migrate/{create_forums.rb → 0080_create_forums.rb} +0 -0
  76. data/db/migrate/{create_discussions.rb → 0090_create_discussions.rb} +0 -0
  77. data/db/migrate/{create_forum_messages.rb → 0100_create_forum_messages.rb} +0 -0
  78. data/db/migrate/{create_access_control_entries.rb → 0110_create_access_control_entries.rb} +3 -3
  79. data/db/migrate/{create_attachments.rb → 0120_create_attachments.rb} +0 -4
  80. data/db/migrate/{create_roles.rb → 0130_create_roles.rb} +0 -0
  81. data/db/migrate/0140_create_feedbacks.rb +20 -0
  82. data/db/migrate/0150_create_external_links.rb +14 -0
  83. data/db/migrate/0160_create_sitemaps.rb +17 -0
  84. data/db/migrate/0170_create_menus.rb +14 -0
  85. data/lib/development_mail_interceptor.rb +7 -0
  86. data/lib/generators/wheels/recipes/wheels.rb +18 -12
  87. data/lib/wheels/base.rb +7 -0
  88. data/lib/wheels/routes.rb +8 -3
  89. data/lib/wheels.rb +2 -0
  90. data/public/javascripts/jquery-validate/additional-methods.js +259 -0
  91. data/public/javascripts/jquery-validate/changelog.txt +239 -0
  92. data/public/javascripts/jquery-validate/jquery.validate.js +1146 -0
  93. data/public/javascripts/jquery-validate/jquery.validate.min.js +16 -0
  94. data/public/javascripts/jquery-validate/jquery.validate.pack.js +15 -0
  95. data/public/javascripts/jquery-validate/lib/jquery-1.4.2.js +6240 -0
  96. data/public/javascripts/jquery-validate/lib/jquery.form.js +660 -0
  97. data/public/javascripts/jquery-validate/lib/jquery.js +4376 -0
  98. data/public/javascripts/jquery-validate/lib/jquery.metadata.js +122 -0
  99. data/public/javascripts/jquery-validate/localization/messages_ar.js +24 -0
  100. data/public/javascripts/jquery-validate/localization/messages_bg.js +23 -0
  101. data/public/javascripts/jquery-validate/localization/messages_cn.js +23 -0
  102. data/public/javascripts/jquery-validate/localization/messages_cs.js +23 -0
  103. data/public/javascripts/jquery-validate/localization/messages_da.js +20 -0
  104. data/public/javascripts/jquery-validate/localization/messages_de.js +20 -0
  105. data/public/javascripts/jquery-validate/localization/messages_el.js +24 -0
  106. data/public/javascripts/jquery-validate/localization/messages_es.js +23 -0
  107. data/public/javascripts/jquery-validate/localization/messages_fa.js +23 -0
  108. data/public/javascripts/jquery-validate/localization/messages_fi.js +21 -0
  109. data/public/javascripts/jquery-validate/localization/messages_fr.js +23 -0
  110. data/public/javascripts/jquery-validate/localization/messages_he.js +23 -0
  111. data/public/javascripts/jquery-validate/localization/messages_hu.js +20 -0
  112. data/public/javascripts/jquery-validate/localization/messages_it.js +23 -0
  113. data/public/javascripts/jquery-validate/localization/messages_kk.js +23 -0
  114. data/public/javascripts/jquery-validate/localization/messages_lt.js +23 -0
  115. data/public/javascripts/jquery-validate/localization/messages_lv.js +23 -0
  116. data/public/javascripts/jquery-validate/localization/messages_nl.js +23 -0
  117. data/public/javascripts/jquery-validate/localization/messages_no.js +23 -0
  118. data/public/javascripts/jquery-validate/localization/messages_pl.js +23 -0
  119. data/public/javascripts/jquery-validate/localization/messages_ptbr.js +23 -0
  120. data/public/javascripts/jquery-validate/localization/messages_ptpt.js +23 -0
  121. data/public/javascripts/jquery-validate/localization/messages_ro.js +23 -0
  122. data/public/javascripts/jquery-validate/localization/messages_ru.js +23 -0
  123. data/public/javascripts/jquery-validate/localization/messages_se.js +21 -0
  124. data/public/javascripts/jquery-validate/localization/messages_sk.js +20 -0
  125. data/public/javascripts/jquery-validate/localization/messages_tr.js +23 -0
  126. data/public/javascripts/jquery-validate/localization/messages_tw.js +23 -0
  127. data/public/javascripts/jquery-validate/localization/messages_ua.js +23 -0
  128. data/public/javascripts/jquery-validate/localization/methods_de.js +12 -0
  129. data/public/javascripts/jquery-validate/localization/methods_nl.js +9 -0
  130. data/public/javascripts/jquery-validate/localization/methods_pt.js +9 -0
  131. data/public/javascripts/jquery-validate/todo +172 -0
  132. data/public/javascripts/jquery.cookie.js +96 -0
  133. data/public/javascripts/jquery.filedrop.js +253 -0
  134. data/public/javascripts/jquery.hotkeys.js +99 -0
  135. data/public/javascripts/jquery.js +6240 -0
  136. data/public/javascripts/jquery.jstree.js +3510 -0
  137. data/public/javascripts/jquery.uploadify.js +26 -0
  138. data/public/javascripts/jquery.validate.js +1147 -0
  139. data/public/javascripts/sitemap_jstree.js +329 -0
  140. data/public/javascripts/swfobject.js +4 -0
  141. data/public/jstree/_demo/_dump.sql +20 -0
  142. data/public/jstree/_demo/_inc/__mysql_errors.log +0 -0
  143. data/public/jstree/_demo/_inc/class._database.php +146 -0
  144. data/public/jstree/_demo/_inc/class._database_i.php +152 -0
  145. data/public/jstree/_demo/_inc/class.tree.php +602 -0
  146. data/public/jstree/_demo/_install.txt +6 -0
  147. data/public/jstree/_demo/config.php +14 -0
  148. data/public/jstree/_demo/index.html +262 -0
  149. data/public/jstree/_demo/server.php +69 -0
  150. data/public/jstree/_docs/!style.css +37 -0
  151. data/public/jstree/_docs/_drive.png +0 -0
  152. data/public/jstree/_docs/_html_data.html +2 -0
  153. data/public/jstree/_docs/_json_data.json +4 -0
  154. data/public/jstree/_docs/_search_data.json +6 -0
  155. data/public/jstree/_docs/_search_result.json +1 -0
  156. data/public/jstree/_docs/_xml_flat.xml +12 -0
  157. data/public/jstree/_docs/_xml_nest.xml +18 -0
  158. data/public/jstree/_docs/checkbox.html +148 -0
  159. data/public/jstree/_docs/contextmenu.html +120 -0
  160. data/public/jstree/_docs/cookies.html +96 -0
  161. data/public/jstree/_docs/core.html +622 -0
  162. data/public/jstree/_docs/crrm.html +315 -0
  163. data/public/jstree/_docs/dnd.html +197 -0
  164. data/public/jstree/_docs/hotkeys.html +81 -0
  165. data/public/jstree/_docs/html_data.html +174 -0
  166. data/public/jstree/_docs/index.html +75 -0
  167. data/public/jstree/_docs/json_data.html +240 -0
  168. data/public/jstree/_docs/languages.html +138 -0
  169. data/public/jstree/_docs/search.html +114 -0
  170. data/public/jstree/_docs/sort.html +84 -0
  171. data/public/jstree/_docs/syntax/!script.js +2232 -0
  172. data/public/jstree/_docs/syntax/!style.css +511 -0
  173. data/public/jstree/_docs/syntax/clipboard.swf +0 -0
  174. data/public/jstree/_docs/syntax/help.png +0 -0
  175. data/public/jstree/_docs/syntax/magnifier.png +0 -0
  176. data/public/jstree/_docs/syntax/page_white_code.png +0 -0
  177. data/public/jstree/_docs/syntax/page_white_copy.png +0 -0
  178. data/public/jstree/_docs/syntax/printer.png +0 -0
  179. data/public/jstree/_docs/syntax/wrapping.png +0 -0
  180. data/public/jstree/_docs/themeroller.html +98 -0
  181. data/public/jstree/_docs/themes.html +126 -0
  182. data/public/jstree/_docs/types.html +173 -0
  183. data/public/jstree/_docs/ui.html +188 -0
  184. data/public/jstree/_docs/unique.html +70 -0
  185. data/public/jstree/_docs/xml_data.html +214 -0
  186. data/public/jstree/_lib/jquery.cookie.js +96 -0
  187. data/public/jstree/_lib/jquery.hotkeys.js +99 -0
  188. data/public/jstree/_lib/jquery.js +6240 -0
  189. data/public/jstree/jquery.jstree.js +3510 -0
  190. data/public/jstree/jstree.html +237 -0
  191. data/public/jstree/themes/apple/bg.jpg +0 -0
  192. data/public/jstree/themes/apple/d.png +0 -0
  193. data/public/jstree/themes/apple/dot_for_ie.gif +0 -0
  194. data/public/jstree/themes/apple/style.css +60 -0
  195. data/public/jstree/themes/apple/throbber.gif +0 -0
  196. data/public/jstree/themes/classic/d.png +0 -0
  197. data/public/jstree/themes/classic/dot_for_ie.gif +0 -0
  198. data/public/jstree/themes/classic/style.css +59 -0
  199. data/public/jstree/themes/classic/throbber.gif +0 -0
  200. data/public/jstree/themes/default/d.gif +0 -0
  201. data/public/jstree/themes/default/d.png +0 -0
  202. data/public/jstree/themes/default/style.css +73 -0
  203. data/public/jstree/themes/default/throbber.gif +0 -0
  204. data/public/jstree/themes/default-rtl/d.gif +0 -0
  205. data/public/jstree/themes/default-rtl/d.png +0 -0
  206. data/public/jstree/themes/default-rtl/dots.gif +0 -0
  207. data/public/jstree/themes/default-rtl/style.css +83 -0
  208. data/public/jstree/themes/default-rtl/throbber.gif +0 -0
  209. data/public/stylesheets/sass/dreamy.sass +21 -56
  210. data/public/stylesheets/sass/menu.sass +43 -9
  211. data/public/stylesheets/sass/uploadify.sass +52 -0
  212. data/public/stylesheets/ui-lightness/images/ui-icons_228ef1_256x240.png +0 -0
  213. data/public/stylesheets/ui-lightness/jquery-ui-1.8.4.custom.css +549 -0
  214. data/wheels.gemspec +187 -15
  215. metadata +188 -16
@@ -0,0 +1,329 @@
1
+ function array_print(_name, arr) {
2
+ ret = _name + ": {\n";
3
+ for(key in arr) {
4
+ ret += " " + key.toString() + ":" + (arr[key] ? arr[key].toString() : '') + "\n"
5
+ }
6
+ ret += "}";
7
+ console.log(ret);
8
+ return ret;
9
+ }
10
+
11
+ function sitemapJsTreeConfig(){
12
+ return {
13
+ // the list of plugins to include
14
+ "plugins" : [ "themes", "json_data", "ui", "crrm", "cookies", "dnd", "search", "types", "hotkeys", "contextmenu" ],
15
+ // Plugin configuration
16
+
17
+ // I usually configure the plugin that handles the data first - in this case JSON as it is most common
18
+ "json_data" : {
19
+ // I chose an ajax enabled tree - again - as this is most common, and maybe a bit more complex
20
+ // All the options are the same as jQuery's except for `data` which CAN (not should) be a function
21
+ "ajax" : {
22
+ // the URL to fetch the data
23
+ "url" : "/sitemaps.json",
24
+ // this function is executed in the instance's scope (this refers to the tree instance)
25
+ // the parameter is the node being loaded (may be -1, 0, or undefined when loading the root nodes)
26
+ "data" : function (n) {
27
+ // the result is fed to the AJAX request `data` option
28
+ return n.attr ?
29
+ {"parent_id" : n.attr("id").replace("node_","")} :
30
+ {};
31
+ }
32
+ }
33
+ },
34
+ "themes" : {
35
+ "theme" : "default",
36
+ },
37
+ // Using types - most of the time this is an overkill
38
+ // Still meny people use them - here is how
39
+ "types" : {
40
+ // I set both options to -2, as I do not need depth and children count checking
41
+ // Those two checks may slow jstree a lot, so use only when needed
42
+ "max_depth" : -2,
43
+ "max_children" : -2,
44
+ // I want only `drive` nodes to be root nodes
45
+ // This will prevent moving or creating any other type as a root node
46
+ "valid_children" : [ "drive" ],
47
+ "types" : {
48
+ // The default type
49
+ "page" : {
50
+ // I want this type to have no children (so only leaf nodes)
51
+ // In my case - those are files
52
+ "valid_children" : ["page", "external_link"],
53
+ // If we specify an icon for the default type it WILL OVERRIDE the theme icons
54
+ "icon" : {
55
+ "image" : "/images/jstree/file.png"
56
+ }
57
+ },
58
+ // The `folder` type
59
+ "external_link" : {
60
+ // can have files and other folders inside of it, but NOT `drive` nodes
61
+ "valid_children" : "none",
62
+ "icon" : {
63
+ "image" : "/images/jstree/folder.png"
64
+ }
65
+ },
66
+ // The `drive` nodes
67
+ "menu" : {
68
+ // can have files and folders inside, but NOT other `drive` nodes
69
+ "valid_children" : [ "page", "external_link" ],
70
+ "icon" : {
71
+ "image" : "/images/jstree/root.png"
72
+ },
73
+ // those options prevent the functions with the same name to be used on the `drive` type nodes
74
+ // internally the `before` event is used
75
+ "start_drag" : false,
76
+ "move_node" : false,
77
+ "delete_node" : false,
78
+ "remove" : false
79
+ }
80
+ }
81
+ },
82
+
83
+ "contextmenu" : {
84
+ items : contextMenuItems
85
+ },
86
+ // For UI & core - the nodes to initially select and open will be overwritten by the cookie plugin
87
+
88
+ // the UI plugin - it handles selecting/deselecting/hovering nodes
89
+ "ui" : {
90
+ "initially_select" : [ "node_1" ]
91
+ },
92
+ // the core plugin - not many options here
93
+ "core" : {
94
+ // just open those two nodes up
95
+ // as this is an AJAX enabled tree, both will be downloaded from the server
96
+ // "initially_open" : [ "node_2" , "node_3" ]
97
+ }
98
+ }
99
+ }
100
+
101
+ function jstreeEventDeclarations(){
102
+ if (!__eventDeclarations) {
103
+ var __eventDeclarations = {
104
+ "create.jstree" : function (e, data) {
105
+ createSiteMap({
106
+ 'menu_text' : data.rslt.name,
107
+ 'position' : data.rslt.position,
108
+ 'resource_type' : data.rslt.obj.attr("data_resource_type"),
109
+ 'resource_id' : data.rslt.obj.attr("data_resource_id"),
110
+ 'parent_id' : data.rslt.parent.attr("id").replace("node_",""),
111
+ },
112
+ function (r) {
113
+ if(r.status) {
114
+ $(data.rslt.obj).attr("id", "node_" + r.id);
115
+ $(data.rslt.obj).attr("data_menu_text", data.rslt.name);
116
+ }
117
+ else {
118
+ $.jstree.rollback(data.rlbk);
119
+ }
120
+ });
121
+ },
122
+ "remove.jstree" : function (e, data) {
123
+ data.rslt.obj.each(function () {
124
+ deleteSiteMap(this.id.replace("node_",""),
125
+ function (r) {
126
+ if(!r.status) {
127
+ data.inst.refresh();
128
+ }
129
+ }
130
+ );
131
+ });
132
+ },
133
+ "rename.jstree" : function (e, data) {
134
+ array_print('data.rslt', data.rslt);
135
+ array_print('data.args', data.args);
136
+
137
+ updateSiteMap(
138
+ {
139
+ 'id' : $(data.rslt.obj).attr("data_id"),
140
+ 'menu_text' : data.rslt.new_name,
141
+ },
142
+ function (r) {
143
+ if(!r.status) {
144
+ $(data.rslt.obj).attr("data_menu_text", data.rslt.new_name);
145
+ $.jstree.rollback(data.rlbk);
146
+ }
147
+ }
148
+ );
149
+ },
150
+ "move_node.jstree" : function (e, data) {
151
+ data.rslt.o.each(function (i, node) {
152
+ $node = $(node);
153
+ if (data.rslt.cy) {
154
+ createSiteMap(
155
+ {
156
+ 'parent_id' : data.rslt.np.attr("id").replace("node_",""),
157
+ 'position' : data.rslt.cp + i,
158
+ 'menu_text' : $node.attr("data_menu_text"),
159
+ 'resource_type' : $node.attr("data_resource_type"),
160
+ 'resource_id' : $node.attr("data_resource_id"),
161
+ },
162
+ moveNodeCallback(data)
163
+ );
164
+ } else {
165
+ updateSiteMap(
166
+ {
167
+ 'id' : $(this).attr("id").replace("node_",""),
168
+ 'parent_id' : data.rslt.np.attr("id").replace("node_",""),
169
+ 'position' : (data.rslt.cp ? data.rslt.cp : 0) + i
170
+ },
171
+ moveNodeCallback(data)
172
+ );
173
+ }
174
+ });
175
+ }
176
+ } // Close the data array.
177
+ return __eventDeclarations;
178
+ }
179
+ }
180
+
181
+ function moveNodeCallback(data){
182
+ return function(r) {
183
+ if(!r.status) {
184
+ $.jstree.rollback(data.rlbk);
185
+ }
186
+ else {
187
+ $(data.rslt.oc).attr("id", "node_" + r.id);
188
+ $(data.rslt.oc).attr("data_id", r.id);
189
+ if(data.rslt.cy && $(data.rslt.oc).children("UL").length) {
190
+ data.inst.refresh(data.inst._get_parent(data.rslt.oc));
191
+ }
192
+ }
193
+ };
194
+ }
195
+
196
+
197
+ function contextMenuItems($node){
198
+ rc = $node.attr('data_resource_type')
199
+ if (rc=="ExternalLink") {
200
+ return {"edit_link" : __cm_edit_link(),
201
+ "remove" : __cm_remove(),
202
+ "ccp" : __cm_ccp()};
203
+ } else if (rc=="Menu") {
204
+ return {"new_page" : __cm_new_page(),
205
+ "new_link" : __cm_new_link()};
206
+ } else if (rc=="Page") {
207
+ return {"new_page" : __cm_new_page(),
208
+ "new_link" : __cm_new_link(),
209
+ "edit_page": __cm_edit_page(),
210
+ "ccp" : __cm_ccp()};
211
+ }
212
+ }
213
+
214
+ function __cm_new_page(){
215
+ return {
216
+ "separator_before" : false,
217
+ "separator_after" : true,
218
+ "label" : "New Page",
219
+ "action" : function (obj) {
220
+ this.create(obj, "last", {
221
+ "attr" : {
222
+ "data_resource_type" : "Page",
223
+ "rel" : "page"
224
+ }
225
+ });
226
+ }
227
+ };
228
+ }
229
+ function __cm_new_link(){
230
+ return {
231
+ "separator_before" : false,
232
+ "separator_after" : true,
233
+ "label" : "New Link",
234
+ "action" : function (obj) {
235
+ this.create(obj, "last", {
236
+ "attr" : {
237
+ "data_resource_type" : "ExternalLink",
238
+ "rel" : "external_link"
239
+ }
240
+ });
241
+ }
242
+ };
243
+ }
244
+
245
+ function __cm_rename(){
246
+ return {
247
+ "separator_before" : false,
248
+ "separator_after" : false,
249
+ "label" : "Rename",
250
+ "action" : function (obj) { this.rename(obj); }
251
+ };
252
+ }
253
+
254
+ function __cm_remove(){
255
+ return {
256
+ "separator_before" : false,
257
+ "icon" : false,
258
+ "separator_after" : false,
259
+ "label" : "Delete",
260
+ "action" : function (obj) { this.remove(obj); }
261
+ };
262
+ }
263
+
264
+ function __cm_edit_link(){
265
+ return {
266
+ "separator_before" : false,
267
+ "icon" : false,
268
+ "separator_after" : false,
269
+ "label" : "Edit Link",
270
+ "action" : function (obj) {
271
+ $.ajax({
272
+ url : "/external_links/" + obj.attr('resource_id') + "/edit.js",
273
+ data: {container: 'content_pane', ajax_function: 'html'},
274
+ dataType : "script"
275
+ });
276
+ }
277
+ };
278
+ }
279
+
280
+ function __cm_edit_page(){
281
+ return {
282
+ "separator_before" : false,
283
+ "icon" : false,
284
+ "separator_after" : false,
285
+ "label" : "Edit Page",
286
+ "action" : function (obj) {
287
+ $.ajax({
288
+ url : "/pages/" + obj.attr('data_resource_id') + "/edit.js",
289
+ data: {container: 'content_pane', ajax_function: 'html'},
290
+ dataType : "script"
291
+ });
292
+ }
293
+ };
294
+ }
295
+
296
+
297
+
298
+ function __cm_ccp(){
299
+ return {
300
+ "separator_before" : true,
301
+ "icon" : false,
302
+ "separator_after" : false,
303
+ "label" : "Edit",
304
+ "action" : false,
305
+ "submenu" : {
306
+ "cut" : {
307
+ "separator_before" : false,
308
+ "separator_after" : false,
309
+ "label" : "Cut",
310
+ "action" : function (obj) { this.cut(obj); }
311
+ },
312
+ "copy" : {
313
+ "separator_before" : false,
314
+ "icon" : false,
315
+ "separator_after" : false,
316
+ "label" : "Copy",
317
+ "action" : function (obj) { this.copy(obj); }
318
+ },
319
+ "paste" : {
320
+ "separator_before" : false,
321
+ "icon" : false,
322
+ "separator_after" : false,
323
+ "label" : "Paste",
324
+ "action" : function (obj) { this.paste(obj); }
325
+ }
326
+ }
327
+ };
328
+ }
329
+
@@ -0,0 +1,4 @@
1
+ /* SWFObject v2.2 <http://code.google.com/p/swfobject/>
2
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
3
+ */
4
+ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
@@ -0,0 +1,20 @@
1
+ CREATE TABLE IF NOT EXISTS `tree` (
2
+ `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
3
+ `parent_id` bigint(20) unsigned NOT NULL,
4
+ `position` bigint(20) unsigned NOT NULL,
5
+ `left` bigint(20) unsigned NOT NULL,
6
+ `right` bigint(20) unsigned NOT NULL,
7
+ `level` bigint(20) unsigned NOT NULL,
8
+ `title` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
9
+ `type` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
10
+ PRIMARY KEY (`id`)
11
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ;
12
+
13
+ INSERT INTO `tree` (`id`, `parent_id`, `position`, `left`, `right`, `level`, `title`, `type`) VALUES
14
+ (1, 0, 2, 1, 14, 0, 'ROOT', ''),
15
+ (2, 1, 0, 2, 11, 1, 'C:', 'drive'),
16
+ (3, 2, 0, 3, 6, 2, '_demo', 'folder'),
17
+ (4, 3, 0, 4, 5, 3, 'index.html', 'default'),
18
+ (5, 2, 1, 7, 10, 2, '_docs', 'folder'),
19
+ (6, 1, 1, 12, 13, 1, 'D:', 'drive'),
20
+ (12, 5, 0, 8, 9, 3, 'zmei.html', 'default');
File without changes
@@ -0,0 +1,146 @@
1
+ <?php
2
+ class _database {
3
+ private $link = false;
4
+ private $result = false;
5
+ private $row = false;
6
+
7
+ public $settings = array(
8
+ "servername"=> "localhost",
9
+ "serverport"=> "3306",
10
+ "username" => false,
11
+ "password" => false,
12
+ "database" => false,
13
+ "persist" => false,
14
+ "dieonerror"=> false,
15
+ "showerror" => false,
16
+ "error_file"=> true
17
+ );
18
+
19
+ function __construct() {
20
+ global $db_config;
21
+ $this->settings = array_merge($this->settings, $db_config);
22
+ if($this->settings["error_file"] === true) $this->settings["error_file"] = dirname(__FILE__)."/__mysql_errors.log";
23
+ }
24
+
25
+ function connect() {
26
+ if (!$this->link) {
27
+ $this->link = ($this->settings["persist"]) ?
28
+ mysql_pconnect(
29
+ $this->settings["servername"].":".$this->settings["serverport"],
30
+ $this->settings["username"],
31
+ $this->settings["password"]
32
+ ) :
33
+ mysql_connect(
34
+ $this->settings["servername"].":".$this->settings["serverport"],
35
+ $this->settings["username"],
36
+ $this->settings["password"]
37
+ ) or $this->error();
38
+ }
39
+ if (!mysql_select_db($this->settings["database"], $this->link)) $this->error();
40
+ if($this->link) mysql_query("SET NAMES 'utf8'");
41
+ return ($this->link) ? true : false;
42
+ }
43
+
44
+ function query($sql) {
45
+ if (!$this->link && !$this->connect()) $this->error();
46
+ if (!($this->result = mysql_query($sql, $this->link))) $this->error($sql);
47
+ return ($this->result) ? true : false;
48
+ }
49
+
50
+ function nextr() {
51
+ if(!$this->result) {
52
+ $this->error("No query pending");
53
+ return false;
54
+ }
55
+ unset($this->row);
56
+ $this->row = mysql_fetch_array($this->result, MYSQL_BOTH);
57
+ return ($this->row) ? true : false ;
58
+ }
59
+
60
+ function get_row($mode = "both") {
61
+ if(!$this->row) return false;
62
+
63
+ $return = array();
64
+ switch($mode) {
65
+ case "assoc":
66
+ foreach($this->row as $k => $v) {
67
+ if(!is_int($k)) $return[$k] = $v;
68
+ }
69
+ break;
70
+ case "num":
71
+ foreach($this->row as $k => $v) {
72
+ if(is_int($k)) $return[$k] = $v;
73
+ }
74
+ break;
75
+ default:
76
+ $return = $this->row;
77
+ break;
78
+ }
79
+ return array_map("stripslashes",$return);
80
+ }
81
+
82
+ function get_all($mode = "both", $key = false) {
83
+ if(!$this->result) {
84
+ $this->error("No query pending");
85
+ return false;
86
+ }
87
+ $return = array();
88
+ while($this->nextr()) {
89
+ if($key !== false) $return[$this->f($key)] = $this->get_row($mode);
90
+ else $return[] = $this->get_row($mode);
91
+ }
92
+ return $return;
93
+ }
94
+
95
+ function f($index) {
96
+ return stripslashes($this->row[$index]);
97
+ }
98
+
99
+ function go_to($row) {
100
+ if(!$this->result) {
101
+ $this->error("No query pending");
102
+ return false;
103
+ }
104
+ if(!mysql_data_seek($this->result, $row)) $this->error();
105
+ }
106
+
107
+ function nf() {
108
+ if ($numb = mysql_num_rows($this->result) === false) $this->error();
109
+ return mysql_num_rows($this->result);
110
+ }
111
+ function af() {
112
+ return mysql_affected_rows();
113
+ }
114
+ function error($string="") {
115
+ $error = mysql_error();
116
+ if($this->settings["show_error"]) echo $error;
117
+ if($this->settings["error_file"] !== false) {
118
+ $handle = @fopen($this->settings["error_file"], "a+");
119
+ if($handle) {
120
+ @fwrite($handle, "[".date("Y-m-d H:i:s")."] ".$string." <".$error.">\n");
121
+ @fclose($handle);
122
+ }
123
+ }
124
+ if($this->settings["dieonerror"]) {
125
+ if(isset($this->result)) mysql_free_result($this->result);
126
+ mysql_close($this->link);
127
+ die();
128
+ }
129
+ }
130
+ function insert_id() {
131
+ if(!$this->link) return false;
132
+ return mysql_insert_id();
133
+ }
134
+ function escape($string){
135
+ if(!$this->link) return addslashes($string);
136
+ return mysql_real_escape_string($string);
137
+ }
138
+
139
+ function destroy(){
140
+ if (isset($this->result)) mysql_free_result($this->result);
141
+ if (isset($this->link)) mysql_close($this->link);
142
+ }
143
+
144
+
145
+ }
146
+ ?>
@@ -0,0 +1,152 @@
1
+ <?php
2
+ class _database {
3
+ private $data = false;
4
+ private $result = false;
5
+ private $row = false;
6
+
7
+ public $settings = array(
8
+ "servername"=> "localhost",
9
+ "serverport"=> "3306",
10
+ "username" => false,
11
+ "password" => false,
12
+ "database" => false,
13
+ "persist" => false,
14
+ "dieonerror"=> false,
15
+ "showerror" => false,
16
+ "error_file"=> true
17
+ );
18
+
19
+ function __construct() {
20
+ global $db_config;
21
+ $this->settings = array_merge($this->settings, $db_config);
22
+ if($this->settings["error_file"] === true) $this->settings["error_file"] = dirname(__FILE__)."/__mysql_errors.log";
23
+ }
24
+
25
+ function connect() {
26
+ $this->data = new mysqli(
27
+ $this->settings["servername"],
28
+ $this->settings["username"],
29
+ $this->settings["password"],
30
+ $this->settings["database"],
31
+ $this->settings["serverport"]
32
+ );
33
+
34
+ if(mysqli_connect_errno()) {
35
+ $this->error("Connection error: ".mysqli_connect_error() );
36
+ return false;
37
+ }
38
+ if(!$this->data->set_charset("utf8")) {
39
+ $this->error("Error loading character set utf8");
40
+ return false;
41
+ }
42
+ return true;
43
+ }
44
+
45
+ function query($sql) {
46
+ if(!$this->data && !$this->connect()) {
47
+ $this->error("Could node connect for query: ".$sql);
48
+ return false;
49
+ }
50
+ //echo $sql."<br />:";
51
+ if(!($this->result = $this->data->query($sql))) $this->error($sql);
52
+ return ($this->result) ? true : false;
53
+ }
54
+
55
+ function nextr(){
56
+ if(!$this->result) {
57
+ $this->error("No query pending");
58
+ return false;
59
+ }
60
+ unset($this->row);
61
+ $this->row = $this->result->fetch_array(MYSQL_BOTH);
62
+ return ($this->row) ? true : false ;
63
+ }
64
+
65
+ function get_row($mode = "both") {
66
+ if(!$this->row) return false;
67
+
68
+ $return = array();
69
+ switch($mode) {
70
+ case "assoc":
71
+ foreach($this->row as $k => $v) {
72
+ if(!is_int($k)) $return[$k] = $v;
73
+ }
74
+ break;
75
+ case "num":
76
+ foreach($this->row as $k => $v) {
77
+ if(is_int($k)) $return[$k] = $v;
78
+ }
79
+ break;
80
+ default:
81
+ $return = $this->row;
82
+ break;
83
+ }
84
+ return array_map("stripslashes",$return);
85
+ }
86
+
87
+ function get_all($mode = "both", $key = false) {
88
+ if(!$this->result) {
89
+ $this->error("No query pending");
90
+ return false;
91
+ }
92
+ $return = array();
93
+ while($this->nextr()) {
94
+ if($key !== false) $return[$this->f($key)] = $this->get_row($mode);
95
+ else $return[] = $this->get_row($mode);
96
+ }
97
+ return $return;
98
+ }
99
+
100
+ function f($index) {
101
+ return stripslashes($this->row[$index]);
102
+ }
103
+
104
+ function go_to($row) {
105
+ if(!$this->result) {
106
+ $this->error("No query pending");
107
+ return false;
108
+ }
109
+ if(!$this->data->data_seek($row)) $this->error();
110
+ }
111
+
112
+ function nf() {
113
+ if (!$this->result) {
114
+ $this->error("nf: no result set");
115
+ return false;
116
+ }
117
+ return $this->result->num_rows;
118
+ }
119
+ function af() {
120
+ return $this->data->affected_rows;
121
+ }
122
+ function error($string = "") {
123
+ $error = $this->data->error;
124
+ if($this->settings["show_error"]) echo $error;
125
+ if($this->settings["error_file"] !== false) {
126
+ $handle = @fopen($this->settings["error_file"], "a+");
127
+ if($handle) {
128
+ @fwrite($handle, "[".date("Y-m-d H:i:s")."] ".$string." <".$error.">\n");
129
+ @fclose($handle);
130
+ }
131
+ }
132
+ if($this->settings["dieonerror"]) {
133
+ if(isset($this->result)) $this->result->free();
134
+ @$this->data->close();
135
+ die();
136
+ }
137
+ }
138
+ function insert_id() {
139
+ return $this->data->insert_id;
140
+ }
141
+ function escape($string) {
142
+ if(!$this->data) return addslashes($string);
143
+ return $this->data->escape_string($string);
144
+ }
145
+
146
+ function destroy() {
147
+ if(isset($this->result)) $this->result->free();
148
+ if($this->data) $this->data->close();
149
+ }
150
+
151
+
152
+ }