XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
xoops_version.php
Go to the documentation of this file.
1 <?php
2 // $Id: xoops_version.php 1056 2012-09-12 15:43:20Z i.bitcero $
3 // --------------------------------------------------------------
4 // Red México Common Utilities
5 // A framework for Red México Modules
6 // Author: Eduardo Cortés <i.bitcero@gmail.com>
7 // Email: i.bitcero@gmail.com
8 // License: GPL 2.0
9 // --------------------------------------------------------------
10 
11 if (!function_exists("__")){
12  function __($text, $d){
13  return $text;
14  }
15 }
16 
17 $modversion['name'] = 'Common Utilities';
18 $modversion['version'] = 2.1;
19 $modversion['releasedate'] = "";
20 $modversion['status'] = "Beta";
21 $modversion['description'] = 'Container a lot of clases and functions used by Red México Modules';
22 $modversion['author'] = "BitC3R0";
23 $modversion['authormail'] = "i.bitcero@gmail.com";
24 $modversion['authorweb'] = "Red México";
25 $modversion['authorurl'] = "http://redmexico.com.mx";
26 $modversion['updateurl'] = "http://www.xoopsmexico.net/modules/vcontrol/?action=check&id=1";
27 $modversion['credits'] = "Red México, BitC3R0";
28 $modversion['help'] = "http://www.redmexico.com.mx/docs/common-utilities/";
29 $modversion['license'] = "GPL 2";
30 $modversion['official'] = 0;
31 $modversion['image'] = "images/logo.png";
32 $modversion['dirname'] = "rmcommon";
33 $modversion['icon16'] = "images/rmc16.png";
34 $modversion['icon24'] = 'images/rmc24.png';
35 $modversion['icon48'] = 'images/icon48.png';
36 $modversion['rmnative'] = 1;
37 $modversion['rmversion'] = array('major'=>2,'minor'=>1,'revision'=>89.1,'stage'=>-1,'name'=>'Common Utilities');
38 $modversion['onUninstall'] = 'include/install.php';
39 $modversion['onInstall'] = 'include/install.php';
40 
41 $modversion['social'][0] = array('title' => __('Twitter', 'rmcommon'),'type' => 'twitter','url' => 'http://www.twitter.com/bitcero/');
42 $modversion['social'][1] = array('title' => __('LinkedIn', 'rmcommon'),'type' => 'linkedin','url' => 'http://www.linkedin.com/bitcero/');
43 $modversion['social'][2] = array('title' => __('Red México Twitter', 'rmcommon'),'type' => 'twitter','url' => 'http://www.twitter.com/redmexico/');
44 $modversion['social'][3] = array('title' => __('Red México Facebook', 'rmcommon'),'type' => 'facebook','url' => 'http://www.facebook.com/redmexico/');
45 
46 $modversion['hasAdmin'] = 1;
47 $modversion['adminindex'] = "index.php";
48 $modversion['adminmenu'] = "menu.php";
49 
50 $modversion['hasMain'] = 1;
51 
52 $modversion['sqlfile']['mysql'] = "sql/mysql.sql";
53 
54 $modversion['tables'][0] = 'rmc_img_cats';
55 $modversion['tables'][1] = 'rmc_comments';
56 $modversion['tables'][2] = 'rmc_comusers';
57 $modversion['tables'][3] = 'rmc_images';
58 $modversion['tables'][4] = 'rmc_plugins';
59 $modversion['tables'][5] = 'rmc_settings';
60 $modversion['tables'][6] = 'rmc_blocks';
61 $modversion['tables'][7] = 'rmc_blocks_positions';
62 $modversion['tables'][8] = 'rmc_bkmod';
63 
64 // Templates
65 $modversion['templates'][1]['file'] = 'rmc_comments_display.html';
66 $modversion['templates'][1]['description'] = 'Comments list';
67 $modversion['templates'][2]['file'] = 'rmc_comments_form.html';
68 $modversion['templates'][2]['description'] = 'Shows the comments form';
69 
74 $files = XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH.'/modules/rmcommon/lang', '');
75 $options = array();
76 $options['en_US'] = 'en';
77 foreach($files as $file => $v){
78 
79  if(substr($file, -3)!='.mo') continue;
80 
81  $options[substr($file, 0, -3)] = substr($file, 0, -3);
82 
83 }
84 $modversion['config'][] = array(
85  'name' => 'lang',
86  'title' => '_MI_RMC_LANG',
87  'description' => '',
88  'formtype' => 'select',
89  'valuetype' => 'text',
90  'default' => 'en',
91  'options' => $options
92 );
93 
94 // Update config options
95 $fct = isset($_GET['fct']) ? $_GET['fct'] : '';
96 $mid = isset($_GET['mod']) ? $_GET['mod'] : '';
97 
98 $mh = xoops_gethandler('module');
99 $mod = $mh->getByDirname('rmcommon');
100 
101 if($fct=='preferences' && $mid==$mod->mid()){
102  $db = XoopsDatabaseFactory::getDatabaseConnection();
103 
104  $sql = "SELECT conf_id FROM ".$db->prefix("config")." WHERE conf_modid=".$mod->mid()." AND conf_name='lang'";
105 
106  list($id) = $db->fetchRow($db->query($sql));
107  if($id>0){
108  $db->queryF("DELETE FROM ".$db->prefix("configoption")." WHERE conf_id=$id");
109  $sql = "INSERT INTO ".$db->prefix("configoption")." (`confop_name`,`confop_value`,`conf_id`) VALUES ";
110  foreach($options as $opt){
111  $sql .= "('$opt','$opt','$id'),";
112  }
113  $db->queryF(rtrim($sql,','));
114  }
115 }
116 unset($options, $files, $file, $v);
117 
118 // Available themes
119 $dirs = XoopsLists::getDirListAsArray(XOOPS_ROOT_PATH.'/modules/rmcommon/themes', '');
120 $options = array();
121 foreach($dirs as $dir => $v){
122 
123  if(!file_exists(XOOPS_ROOT_PATH.'/modules/rmcommon/themes/'.$dir.'/admin_gui.php')) continue;
124 
125  $options[$dir] = $dir;
126 
127 }
128 
129 $modversion['config'][] = array(
130  'name' => 'theme',
131  'title' => '_MI_RMC_ADMTHEME',
132  'description' => '',
133  'formtype' => 'select',
134  'valuetype' => 'text',
135  'default' => 'twop6',
136  'options' => $options
137 );
138 
139 // Update config options
140 $fct = isset($_GET['fct']) ? $_GET['fct'] : '';
141 $mid = isset($_GET['mod']) ? $_GET['mod'] : '';
142 
143 $mh = xoops_gethandler('module');
144 $mod = $mh->getByDirname('rmcommon');
145 
146 if($fct=='preferences' && $mid==$mod->mid()){
147  $db = XoopsDatabaseFactory::getDatabaseConnection();
148 
149  $sql = "SELECT conf_id FROM ".$db->prefix("config")." WHERE conf_modid=".$mod->mid()." AND conf_name='theme'";
150 
151  list($id) = $db->fetchRow($db->query($sql));
152  if($id>0){
153  $db->queryF("DELETE FROM ".$db->prefix("configoption")." WHERE conf_id=$id");
154  $sql = "INSERT INTO ".$db->prefix("configoption")." (`confop_name`,`confop_value`,`conf_id`) VALUES ";
155  foreach($options as $opt){
156  $sql .= "('$opt','$opt','$id'),";
157  }
158  $db->queryF(rtrim($sql,','));
159  }
160 }
161 unset($options, $files, $file, $v);
162 
163 $modversion['config'][] = array(
164  'name' => 'gui_disable',
165  'title' => '_MI_RMC_GUIENABLE',
166  'description' => '',
167  'formtype' => 'yesno',
168  'valuetype' => 'int',
169  'default' => 1
170 );
171 
172 // Editor
173 $modversion['config'][] = array(
174  'name' => 'editor_type',
175  'title' => '_MI_RMC_EDITOR',
176  'description' => '',
177  'formtype' => 'select',
178  'valuetype' => 'text',
179  'default' => 'tiny',
180  'options' => array('_MI_RMC_EDITOR_VISUAL'=>'tiny','_MI_RMC_EDITOR_HTML'=>'html','_MI_RMC_EDITOR_XOOPS'=>'xoops','_MI_RMC_EDITOR_SIMPLE'=>'simple')
181 );
182 
183 // JQuery inclusion
184 $modversion['config'][] = array(
185  'name' => 'jquery',
186  'title' => '_MI_RMC_ADDJQUERY',
187  'description' => '_MI_RMC_ADDJQUERYD',
188  'formtype' => 'yesno',
189  'valuetype' => 'int',
190  'default' => '1'
191 );
192 
193 // Images store type
194 $modversion['config'][] = array(
195  'name' => 'imagestore',
196  'title' => '_MI_RMC_IMAGESTORE',
197  'description' => '',
198  'formtype' => 'yesno',
199  'valuetype' => 'int',
200  'default' => 1
201 );
202 
203 // Images Categories list limit number
204 $modversion['config'][] = array(
205  'name' => 'catsnumber',
206  'title' => '_MI_RMC_IMGCATSNUMBER',
207  'description' => '',
208  'formtype' => 'textbox',
209  'valuetype' => 'int',
210  'default' => 10
211 );
212 
213 $modversion['config'][] = array(
214  'name' => 'imgsnumber',
215  'title' => '_MI_RMC_IMGSNUMBER',
216  'description' => '',
217  'formtype' => 'textbox',
218  'valuetype' => 'int',
219  'default' => 20
220 );
221 
222 // Secure Key
223 if (!isset($xoopsSecurity)) $xoopsSecurity = new XoopsSecurity();
224 $modversion['config'][] = array(
225  'name' => 'secretkey',
226  'title' => '_MI_RMC_SECREY',
227  'description' => '_MI_RMC_SECREYD',
228  'formtype' => 'textbox',
229  'valuetype' => 'text',
230  'default' => $xoopsSecurity->createToken()
231 );
232 
233 // Formato HTML5
234 $modversion['config'][] = array(
235  'name' => 'dohtml',
236  'title' => '_MI_RMC_DOHTML',
237  'description' => '',
238  'formtype' => 'yesno',
239  'valuetype' => 'int',
240  'default' => 1
241 );
242 
243 $modversion['config'][] = array(
244  'name' => 'dosmileys',
245  'title' => '_MI_RMC_DOSMILE',
246  'description' => '',
247  'formtype' => 'yesno',
248  'valuetype' => 'int',
249  'default' => 1
250 );
251 
252 $modversion['config'][] = array(
253  'name' => 'doxcode',
254  'title' => '_MI_RMC_DOXCODE',
255  'description' => '',
256  'formtype' => 'yesno',
257  'valuetype' => 'int',
258  'default' => 1
259 );
260 
261 $modversion['config'][] = array(
262  'name' => 'doimage',
263  'title' => '_MI_RMC_DOIMAGE',
264  'description' => '',
265  'formtype' => 'yesno',
266  'valuetype' => 'int',
267  'default' => 0
268 );
269 
270 $modversion['config'][] = array(
271  'name' => 'dobr',
272  'title' => '_MI_RMC_DOBR',
273  'description' => '',
274  'formtype' => 'yesno',
275  'valuetype' => 'int',
276  'default' => 0
277 );
278 
279 // Comments
280 $modversion['config'][] = array(
281  'name' => 'enable_comments',
282  'title' => '_MI_RMC_ENABLECOMS',
283  'description' => '',
284  'formtype' => 'yesno',
285  'valuetype' => 'int',
286  'default' => 1
287 );
288 
289 $modversion['config'][] = array(
290  'name' => 'anonymous_comments',
291  'title' => '_MI_RMC_ANONCOMS',
292  'description' => '',
293  'formtype' => 'yesno',
294  'valuetype' => 'int',
295  'default' => 1
296 );
297 
298 $modversion['config'][] = array(
299  'name' => 'approve_reg_coms',
300  'title' => '_MI_RMC_APPROVEREG',
301  'description' => '',
302  'formtype' => 'yesno',
303  'valuetype' => 'int',
304  'default' => 1
305 );
306 
307 $modversion['config'][] = array(
308  'name' => 'approve_anon_coms',
309  'title' => '_MI_RMC_APPROVEANON',
310  'description' => '',
311  'formtype' => 'yesno',
312  'valuetype' => 'int',
313  'default' => 0
314 );
315 
316 $modversion['config'][] = array(
317  'name' => 'allow_edit',
318  'title' => '_MI_RMC_ALLOWEDIT',
319  'description' => '',
320  'formtype' => 'yesno',
321  'valuetype' => 'int',
322  'default' => 0
323 );
324 
325 $modversion['config'][] = array(
326  'name' => 'edit_limit',
327  'title' => '_MI_RMC_EDITLIMIT',
328  'description' => '',
329  'formtype' => 'textbox',
330  'valuetype' => 'int',
331  'default' => 1
332 );
333 
334 $modversion['config'][] = array(
335  'name' => 'mods_number',
336  'title' => '_MI_RMC_MODSNUMBER',
337  'description' => '',
338  'formtype' => 'textbox',
339  'valuetype' => 'int',
340  'default' => 6
341 );
342 
343 
344 $modversion['config'][] = array(
345  'name' => 'rssimage',
346  'title' => '_MI_RMC_RSSIMAGE',
347  'description' => '',
348  'formtype' => 'textbox',
349  'valuetype' => 'text',
350  'default' => XOOPS_URL.'/modules/rmcommon/images/rssimage.png'
351 );
352 
354 $modversion['config'][] = array(
355  'name' => 'transport',
356  'title' => '_MI_RMC_MAILERMETH',
357  'description' => '_MI_RMC_MAILERMETHD',
358  'formtype' => 'select',
359  'valuetype' => 'text',
360  'options' => array('_MI_RMC_PHPMAIL'=>'mail','_MI_RMC_SMTP'=>'smtp', '_MI_RMC_SENDMAIL'=>'sendmail'),
361  'default' => XOOPS_URL.'/modules/rmcommon/images/rssimage.png'
362 );
363 
364 $modversion['config'][] = array(
365  'name' => 'smtp_server',
366  'title' => '_MI_RMC_SMTPSERVER',
367  'description' => '_MI_RMC_SMTPSERVERD',
368  'formtype' => 'textbox',
369  'valuetype' => 'text',
370  'default' => ''
371 );
372 
373 $modversion['config'][] = array(
374  'name' => 'smtp_crypt',
375  'title' => '_MI_RMC_ENCRYPT',
376  'description' => '_MI_RMC_ENCRYPTD',
377  'formtype' => 'select',
378  'valuetype' => 'text',
379  'options' => array('_MI_RMC_CRYPTNONE'=>'none', '_MI_RMC_CRYPTSSL'=>'ssl', '_MI_RMC_CRYPTTLS'=>'tls'),
380  'default' => 'none'
381 );
382 
383 $modversion['config'][] = array(
384  'name' => 'smtp_port',
385  'title' => '_MI_RMC_SMTPPORT',
386  'description' => '_MI_RMC_SMTPPORTD',
387  'formtype' => 'textbox',
388  'valuetype' => 'text',
389  'default' => 25
390 );
391 
392 $modversion['config'][] = array(
393  'name' => 'smtp_user',
394  'title' => '_MI_RMC_SMTPUSER',
395  'description' => '',
396  'formtype' => 'textbox',
397  'valuetype' => 'text',
398  'default' => ''
399 );
400 
401 $modversion['config'][] = array(
402  'name' => 'smtp_pass',
403  'title' => '_MI_RMC_SMTPPASS',
404  'description' => '',
405  'formtype' => 'password',
406  'valuetype' => 'text',
407  'default' => ''
408 );
409 
410 $modversion['config'][] = array(
411  'name' => 'sendmail_path',
412  'title' => '_MI_RMC_SENDMAILPATH',
413  'description' => '',
414  'formtype' => 'textbox',
415  'valuetype' => 'text',
416  'default' => '/usr/sbin/sendmail -bs'
417 );
418 
419 $modversion['config'][] = array(
420  'name' => 'rss_enable',
421  'title' => '_MI_RMC_RSSENABLE',
422  'description' => '',
423  'formtype' => 'yesno',
424  'valuetype' => 'int',
425  'default' => 1
426 );
427 
428 $modversion['config'][] = array(
429  'name' => 'blocks_enable',
430  'title' => '_MI_RMC_BLOCKSENABLE',
431  'description' => '',
432  'formtype' => 'yesno',
433  'valuetype' => 'int',
434  'default' => 0
435 );
436 
437 $modversion['config'][] = array(
438  'name' => 'updates',
439  'title' => '_MI_RMC_UPDATES',
440  'description' => '_MI_RMC_UPDATESD',
441  'formtype' => 'yesno',
442  'valuetype' => 'int',
443  'default' => 1
444 );
445 
446 $modversion['config'][] = array(
447  'name' => 'updatesinterval',
448  'title' => '_MI_RMC_UPDATESINTERVAL',
449  'description' => '',
450  'formtype' => 'textbox',
451  'valuetype' => 'int',
452  'default' => 1
453 );
454 
455 // BLOCKS
456 
457 $modversion['blocks'][] = array(
458  'file' => "comments.php",
459  'name' => __('Comments','rmcommon'),
460  'description' => __('Show comments from internal comments system','rmcommon'),
461  'show_func' => "rmc_bkcomments_show",
462  'edit_func' => "rmc_bkcomments_edit",
463  'template' => 'rmc_bk_comments.html',
464  'options' => "5|1|1|1|1"
465 );
466 
467 $modversion['blocks'][] = array(
468  'file' => "custom.php",
469  'name' => __('Custom Block','rmcommon'),
470  'description' => __('Allows to create a block with custom content.','rmcommon'),
471  'show_func' => "",
472  'type' => 'custom'
473 );
474 
475 $amod = xoops_getActiveModules();
476 if(in_array("rmcommon",$amod)){
478  foreach($plugins as $plugin){
479  $p = RMFunctions::load_plugin($plugin);
480  if(!method_exists($p, 'blocks')) continue;
481  foreach($p->blocks() as $block){
482  $block['plugin'] = 1;
483  $modversion['blocks'][] = $block;
484  }
485 
486  }
487 
488 }