PageRenderTime 50ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/setup/includes/controllers/install.php

http://xtraupload.googlecode.com/
PHP | 1558 lines | 1413 code | 93 blank | 52 comment | 9 complexity | f5449210894fb88f92f848b507b7a0e0 MD5 | raw file
Possible License(s): Apache-2.0
  1. <?php
  2. /**
  3. * XtraUpload
  4. *
  5. * A turn-key open source web 2.0 PHP file uploading package requiring PHP v5
  6. *
  7. * @package XtraUpload
  8. * @author Matthew Glinski
  9. * @copyright Copyright (c) 2006, XtraFile.com
  10. * @license http://xtrafile.com/docs/license
  11. * @link http://xtrafile.com
  12. * @since Version 2.0
  13. * @filesource
  14. */
  15. // ------------------------------------------------------------------------
  16. /**
  17. * XtraUpload Installer
  18. *
  19. * @package XtraUpload
  20. * @subpackage Installer
  21. * @category Controllers
  22. * @author Matthew Glinski
  23. * @link http://xtrafile.com/docs/pages/home
  24. */
  25. // ------------------------------------------------------------------------
  26. class Install extends Controller
  27. {
  28. private $_db_version = '';// filled on construct
  29. function Install()
  30. {
  31. parent::Controller();
  32. include('../xu_ver.php');
  33. $this->_db_version = $version;
  34. }
  35. function index()
  36. {
  37. $this->step1();
  38. }
  39. function step1()
  40. {
  41. $this->load->view('header');
  42. $this->load->view('install/step1');
  43. $this->load->view('footer');
  44. }
  45. function step2()
  46. {
  47. $this->load->view('header');
  48. $this->load->view('install/step2');
  49. $this->load->view('footer');
  50. }
  51. function step3()
  52. {
  53. $this->load->view('header');
  54. $this->load->view('install/step3');
  55. $this->load->view('footer');
  56. }
  57. function step4()
  58. {
  59. if($this->input->post('url'))
  60. {
  61. $cookie_prefix = $this->input->post('cookie_prefix');
  62. $encryption_key = $this->input->post('encryption_key');
  63. $seo = $this->input->post('seo');
  64. if(!empty($seo))
  65. {
  66. $seo = '';
  67. }
  68. else
  69. {
  70. $seo = 'index.php';
  71. }
  72. if($cookie_prefix == '')
  73. {
  74. $cookie_prefix = substr( uniqid(md5(rand(1,99999999))) , 0, -16);
  75. }
  76. if($encryption_key == '')
  77. {
  78. $encryption_key = uniqid(md5(rand(1,99999999)));
  79. }
  80. $url = $this->input->post('url');
  81. if (substr($url, -1) != '/')
  82. {
  83. $url .= '/';
  84. }
  85. $this->_writeConfig($cookie_prefix, $encryption_key, $seo, $url);
  86. $this->_writeDatabase();
  87. }
  88. $this->load->view('header');
  89. $this->load->view('install/step4', array('enc' => $encryption_key, 'url' => $url));
  90. $this->load->view('footer');
  91. }
  92. function step5()
  93. {
  94. $this->load->database();
  95. $this->load->dbforge();
  96. if($this->input->post('username'))
  97. {
  98. $this->_loadDatabase();
  99. }
  100. $this->load->view('header');
  101. $this->load->view('install/step5');
  102. $this->load->view('footer');
  103. }
  104. function _writeConfig($cookie_prefix, $encryption_key, $seo, $url)
  105. {
  106. $conf = '<'.'?php if ( ! defined("BASEPATH")) exit("No direct script access allowed");
  107. /*
  108. |--------------------------------------------------------------------------
  109. | Base Site URL
  110. |--------------------------------------------------------------------------
  111. |
  112. | URL to your CodeIgniter root. Typically this will be your base URL,
  113. | WITH a trailing slash:
  114. |
  115. | http://example.com/
  116. |
  117. */
  118. $config["base_url"] = "'.$url.'";
  119. /*
  120. |--------------------------------------------------------------------------
  121. | Index File
  122. |--------------------------------------------------------------------------
  123. |
  124. | Typically this will be your index.php file, unless you"ve renamed it to
  125. | something else. If you are using mod_rewrite to remove the page set this
  126. | variable so that it is blank.
  127. |
  128. */
  129. $config["index_page"] = "'.$seo.'";
  130. /*
  131. |--------------------------------------------------------------------------
  132. | URI PROTOCOL
  133. |--------------------------------------------------------------------------
  134. |
  135. | This item determines which server global should be used to retrieve the
  136. | URI string. The default setting of "AUTO" works for most servers.
  137. | If your links do not seem to work, try one of the other delicious flavors:
  138. |
  139. | "AUTO" Default - auto detects
  140. | "PATH_INFO" Uses the PATH_INFO
  141. | "QUERY_STRING" Uses the QUERY_STRING
  142. | "REQUEST_URI" Uses the REQUEST_URI
  143. | "ORIG_PATH_INFO" Uses the ORIG_PATH_INFO
  144. |
  145. */
  146. $config["uri_protocol"] = "AUTO";
  147. /*
  148. |--------------------------------------------------------------------------
  149. | URL suffix
  150. |--------------------------------------------------------------------------
  151. |
  152. | This option allows you to add a suffix to all URLs generated by CodeIgniter.
  153. | For more information please see the user guide:
  154. |
  155. | http://codeigniter.com/user_guide/general/urls.html
  156. */
  157. $config["url_suffix"] = "";
  158. /*
  159. |--------------------------------------------------------------------------
  160. | Default Language
  161. |--------------------------------------------------------------------------
  162. |
  163. | This determines which set of language files should be used. Make sure
  164. | there is an available translation if you intend to use something other
  165. | than english.
  166. |
  167. */
  168. $config["language"] = "english";
  169. /*
  170. |--------------------------------------------------------------------------
  171. | Default Character Set
  172. |--------------------------------------------------------------------------
  173. |
  174. | This determines which character set is used by default in various methods
  175. | that require a character set to be provided.
  176. |
  177. */
  178. $config["charset"] = "UTF-8";
  179. /*
  180. |--------------------------------------------------------------------------
  181. | Enable/Disable System Hooks
  182. |--------------------------------------------------------------------------
  183. |
  184. | If you would like to use the "hooks" feature you must enable it by
  185. | setting this variable to TRUE (boolean). See the user guide for details.
  186. |
  187. */
  188. $config["enable_hooks"] = FALSE;
  189. /*
  190. |--------------------------------------------------------------------------
  191. | Class Extension Prefix
  192. |--------------------------------------------------------------------------
  193. |
  194. | This item allows you to set the filename/classname prefix when extending
  195. | native libraries. For more information please see the user guide:
  196. |
  197. | http://codeigniter.com/user_guide/general/core_classes.html
  198. | http://codeigniter.com/user_guide/general/creating_libraries.html
  199. |
  200. */
  201. $config["subclass_prefix"] = "MY_";
  202. /*
  203. |--------------------------------------------------------------------------
  204. | Allowed URL Characters
  205. |--------------------------------------------------------------------------
  206. |
  207. | This lets you specify with a regular expression which characters are permitted
  208. | within your URLs. When someone tries to submit a URL with disallowed
  209. | characters they will get a warning message.
  210. |
  211. | As a security measure you are STRONGLY encouraged to restrict URLs to
  212. | as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-
  213. |
  214. | Leave blank to allow all characters -- but only if you are insane.
  215. |
  216. | DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
  217. |
  218. */
  219. $config["permitted_uri_chars"] = "a-z 0-9~%.:_\-";
  220. /*
  221. |--------------------------------------------------------------------------
  222. | Enable Query Strings
  223. |--------------------------------------------------------------------------
  224. |
  225. | By default CodeIgniter uses search-engine friendly segment based URLs:
  226. | example.com/who/what/where/
  227. |
  228. | You can optionally enable standard query string based URLs:
  229. | example.com?who=me&what=something&where=here
  230. |
  231. | Options are: TRUE or FALSE (boolean)
  232. |
  233. | The other items let you set the query string "words" that will
  234. | invoke your controllers and its functions:
  235. | example.com/index.php?c=controller&m=function
  236. |
  237. | Please note that some of the helpers won"t work as expected when
  238. | this feature is enabled, since CodeIgniter is designed primarily to
  239. | use segment based URLs.
  240. |
  241. */
  242. $config["enable_query_strings"] = FALSE;
  243. $config["directory_trigger"] = "d"; // experimental not currently in use
  244. $config["controller_trigger"] = "c";
  245. $config["function_trigger"] = "m";
  246. /*
  247. |--------------------------------------------------------------------------
  248. | Error Logging Threshold
  249. |--------------------------------------------------------------------------
  250. |
  251. | If you have enabled error logging, you can set an error threshold to
  252. | determine what gets logged. Threshold options are:
  253. | You can enable error logging by setting a threshold over zero. The
  254. | threshold determines what gets logged. Threshold options are:
  255. |
  256. | 0 = Disables logging, Error logging TURNED OFF
  257. | 1 = Error Messages (including PHP errors)
  258. | 2 = Debug Messages
  259. | 3 = Informational Messages
  260. | 4 = All Messages
  261. |
  262. | For a live site you"ll usually only enable Errors (1) to be logged otherwise
  263. | your log files will fill up very fast.
  264. |
  265. */
  266. $config["log_threshold"] = 1;
  267. /*
  268. |--------------------------------------------------------------------------
  269. | Error Logging Directory Path
  270. |--------------------------------------------------------------------------
  271. |
  272. | Leave this BLANK unless you would like to set something other than the default
  273. | system/logs/ folder. Use a full server path with trailing slash.
  274. |
  275. */
  276. $config["log_path"] = "";
  277. /*
  278. |--------------------------------------------------------------------------
  279. | Date Format for Logs
  280. |--------------------------------------------------------------------------
  281. |
  282. | Each item that is logged has an associated date. You can use PHP date
  283. | codes to set your own date formatting
  284. |
  285. */
  286. $config["log_date_format"] = "Y-m-d H:i:s";
  287. /*
  288. |--------------------------------------------------------------------------
  289. | Cache Directory Path
  290. |--------------------------------------------------------------------------
  291. |
  292. | Leave this BLANK unless you would like to set something other than the default
  293. | system/cache/ folder. Use a full server path with trailing slash.
  294. |
  295. */
  296. $config["cache_path"] = "";
  297. /*
  298. |--------------------------------------------------------------------------
  299. | Encryption Key
  300. |--------------------------------------------------------------------------
  301. |
  302. | If you use the Encryption class or the Sessions class with encryption
  303. | enabled you MUST set an encryption key. See the user guide for info.
  304. |
  305. */
  306. $config["encryption_key"] = "'.$encryption_key.'";
  307. /*
  308. |--------------------------------------------------------------------------
  309. | Session Variables
  310. |--------------------------------------------------------------------------
  311. |
  312. | "session_cookie_name" = the name you want for the cookie
  313. | "encrypt_sess_cookie" = TRUE/FALSE (boolean). Whether to encrypt the cookie
  314. | "session_expiration" = the number of SECONDS you want the session to last.
  315. | by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
  316. | "time_to_update" = how many seconds between CI refreshing Session Information
  317. |
  318. */
  319. $config["sess_cookie_name"] = "xu2";
  320. $config["sess_expiration"] = 7200;
  321. $config["sess_encrypt_cookie"] = TRUE;
  322. $config["sess_use_database"] = TRUE;
  323. $config["sess_table_name"] = "sessions";
  324. $config["sess_match_ip"] = FALSE;
  325. $config["sess_match_useragent"] = TRUE;
  326. $config["sess_time_to_update"] = 300;
  327. /*
  328. |--------------------------------------------------------------------------
  329. | Cookie Related Variables
  330. |--------------------------------------------------------------------------
  331. |
  332. | "cookie_prefix" = Set a prefix if you need to avoid collisions
  333. | "cookie_domain" = Set to .your-domain.com for site-wide cookies
  334. | "cookie_path" = Typically will be a forward slash
  335. |
  336. */
  337. $config["cookie_prefix"] = "'.$cookie_prefix.'";
  338. $config["cookie_domain"] = "";
  339. $config["cookie_path"] = "/";
  340. /*
  341. |--------------------------------------------------------------------------
  342. | Global XSS Filtering
  343. |--------------------------------------------------------------------------
  344. |
  345. | Determines whether the XSS filter is always active when GET, POST or
  346. | COOKIE data is encountered
  347. |
  348. */
  349. $config["global_xss_filtering"] = FALSE;
  350. /*
  351. |--------------------------------------------------------------------------
  352. | Output Compression
  353. |--------------------------------------------------------------------------
  354. |
  355. | Enables Gzip output compression for faster page loads. When enabled,
  356. | the output class will test whether your server supports Gzip.
  357. | Even if it does, however, not all browsers support compression
  358. | so enable only if you are reasonably sure your visitors can handle it.
  359. |
  360. | VERY IMPORTANT: If you are getting a blank page when compression is enabled it
  361. | means you are prematurely outputting something to your browser. It could
  362. | even be a line of whitespace at the end of one of your scripts. For
  363. | compression to work, nothing can be sent before the output buffer is called
  364. | by the output class. Do not "echo" any values with compression enabled.
  365. |
  366. */
  367. $config["compress_output"] = FALSE;
  368. /*
  369. |--------------------------------------------------------------------------
  370. | Master Time Reference
  371. |--------------------------------------------------------------------------
  372. |
  373. | Options are "local" or "gmt". This pref tells the system whether to use
  374. | your server"s local time as the master "now" reference, or convert it to
  375. | GMT. See the "date helper" page of the user guide for information
  376. | regarding date handling.
  377. |
  378. */
  379. $config["time_reference"] = "local";
  380. /*
  381. |--------------------------------------------------------------------------
  382. | Rewrite PHP Short Tags
  383. |--------------------------------------------------------------------------
  384. |
  385. | If your PHP installation does not have short tag support enabled CI
  386. | can rewrite the tags on-the-fly, enabling you to utilize that syntax
  387. | in your view files. Options are TRUE or FALSE (boolean)
  388. |
  389. */
  390. $config["rewrite_short_tags"] = FALSE;';
  391. file_put_contents('../system/application/config/config.php', $conf);
  392. }
  393. function _writeDatabase()
  394. {
  395. $conf = '<'.'?php if ( ! defined("BASEPATH")) exit("No direct script access allowed");
  396. /'.'*
  397. | -------------------------------------------------------------------
  398. | DATABASE CONNECTIVITY SETTINGS
  399. | -------------------------------------------------------------------
  400. | This file will contain the settings needed to access your database.
  401. |
  402. | For complete instructions please consult the "Database Connection"
  403. | page of the User Guide.
  404. |
  405. | -------------------------------------------------------------------
  406. | EXPLANATION OF VARIABLES
  407. | -------------------------------------------------------------------
  408. |
  409. | ["hostname"] The hostname of your database server.
  410. | ["username"] The username used to connect to the database
  411. | ["password"] The password used to connect to the database
  412. | ["database"] The name of the database you want to connect to
  413. | ["dbdriver"] The database type. ie: mysql. Currently supported:
  414. mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
  415. | ["dbprefix"] You can add an optional prefix, which will be added
  416. | to the table name when using the Active Record class
  417. | ["pconnect"] TRUE/FALSE - Whether to use a persistent connection
  418. | ["db_debug"] TRUE/FALSE - Whether database errors should be displayed.
  419. | ["cache_on"] TRUE/FALSE - Enables/disables query caching
  420. | ["cachedir"] The path to the folder where cache files should be stored
  421. | ["char_set"] The character set used in communicating with the database
  422. | ["dbcollat"] The character collation used in communicating with the database
  423. |
  424. | The $active_group variable lets you choose which connection group to
  425. | make active. By default there is only one group (the "default" group).
  426. |
  427. | The $active_record variables lets you determine whether or not to load
  428. | the active record class
  429. *'.'/
  430. $active_group = "default";
  431. $active_record = TRUE;
  432. $db["default"]["hostname"] = "'.$this->input->post('sql_server').'";
  433. $db["default"]["username"] = "'.$this->input->post('sql_user').'";
  434. $db["default"]["password"] = "'.$this->input->post('sql_pass').'";
  435. $db["default"]["database"] = "'.$this->input->post('sql_name').'";
  436. $db["default"]["dbdriver"] = "'.$this->input->post('sql_engine').'";
  437. $db["default"]["dbprefix"] = "'.$this->input->post('sql_prefix').'";
  438. $db["default"]["pconnect"] = TRUE;
  439. $db["default"]["db_debug"] = TRUE;
  440. $db["default"]["cache_on"] = FALSE;
  441. $db["default"]["cachedir"] = "";
  442. $db["default"]["char_set"] = "utf8";
  443. $db["default"]["dbcollat"] = "utf8_general_ci";
  444. /'.'* End of file database.php *'.'/
  445. /'.'* Location: ./system/application/config/database.php *'.'/';
  446. file_put_contents('../system/application/config/database.php', $conf);
  447. file_put_contents('includes/config/database.php', $conf);
  448. }
  449. function _loadDatabase()
  450. {
  451. // Bans Table
  452. $fields = array(
  453. 'id' => array(
  454. 'type' => 'INT',
  455. 'constraint' => 11,
  456. 'unsigned' => TRUE,
  457. 'auto_increment' => TRUE
  458. ),
  459. 'md5' => array(
  460. 'type' => 'VARCHAR',
  461. 'constraint' => '32'
  462. ),
  463. 'name' => array(
  464. 'type' =>'TEXT'
  465. ),
  466. 'type' => array(
  467. 'type' => 'VARCHAR',
  468. 'default' => 'file',
  469. 'constraint' => 30
  470. ),
  471. 'ip' => array(
  472. 'type' => 'VARCHAR',
  473. 'default' => '0.0.0.0',
  474. 'constraint' => 15
  475. ),
  476. 'user' => array(
  477. 'type' => 'VARCHAR',
  478. 'default' => 0,
  479. 'constraint' => 150
  480. ),
  481. 'time' => array(
  482. 'type' => 'VARCHAR',
  483. 'default' => 0,
  484. 'constraint' => 22
  485. ),
  486. );
  487. $this->dbforge->add_field($fields);
  488. $this->dbforge->add_key('id', true);
  489. $this->dbforge->add_key('md5', false);
  490. $this->dbforge->add_key('type', false);
  491. $this->dbforge->create_table('bans');
  492. // Captcha Table
  493. $fields = array(
  494. 'captcha_id' => array(
  495. 'type' => 'BIGINT',
  496. 'constraint' => 13,
  497. 'unsigned' => TRUE,
  498. 'auto_increment' => TRUE
  499. ),
  500. 'captcha_time' => array(
  501. 'type' => 'TEXT'
  502. ),
  503. 'ip_address' => array(
  504. 'type' => 'VARCHAR',
  505. 'constraint' => 15,
  506. 'default' => '0'
  507. ),
  508. 'word' => array(
  509. 'type' => 'VARCHAR',
  510. 'constraint' => 20,
  511. )
  512. );
  513. $this->dbforge->add_field($fields);
  514. $this->dbforge->add_key('captcha_id', true);
  515. $this->dbforge->add_key('word', false);
  516. $this->dbforge->create_table('captcha');
  517. // Config Table
  518. $fields = array(
  519. 'id' => array(
  520. 'type' => 'INT',
  521. 'constraint' => 11,
  522. 'unsigned' => TRUE,
  523. 'auto_increment' => TRUE
  524. ),
  525. 'name' => array(
  526. 'type' => 'VARCHAR',
  527. 'constraint' => 64
  528. ),
  529. 'value' => array(
  530. 'type' => 'VARCHAR',
  531. 'constraint' => 255
  532. ),
  533. 'description1' => array(
  534. 'type' => 'TEXT'
  535. ),
  536. 'description2' => array(
  537. 'type' => 'TEXT'
  538. ),
  539. 'group' => array(
  540. 'type' => 'VARCHAR',
  541. 'constraint' => 32,
  542. 'default' => '0'
  543. ),
  544. 'type' => array(
  545. 'type' => 'VARCHAR',
  546. 'constraint' => 12
  547. ),
  548. 'invincible' => array(
  549. 'type' => 'TINYINT',
  550. 'constraint' => 1,
  551. )
  552. );
  553. $this->dbforge->add_field($fields);
  554. $this->dbforge->add_key('id', true);
  555. $this->dbforge->create_table('config');
  556. // Main Settings => 0
  557. // INSERT initnal data
  558. $data = array('id' => NULL,'name' => 'sitename','value' => 'XtraUpload v2','description1' => 'Site Name:','description2' => '(Site Name)','group' => 0,'type' => 'text','invincible' => 1);
  559. $this->db->insert('config', $data);
  560. $data = array('id' => NULL,'name' => 'slogan','value' => 'Preview','description1' => 'Your Site Slogan','description2' => '','group' => 0,'type' => 'text','invincible' => 1);
  561. $this->db->insert('config', $data);
  562. $data = array( 'id' => NULL, 'name' => 'site_email', 'value' => 'admin@localhost', 'description1' => 'Site EMail', 'description2' => 'Email address used to send emails', 'group' => 0, 'type' => 'text', 'invincible' => 1);
  563. $this->db->insert('config', $data);
  564. $data = array( 'id' => NULL, 'name' => 'title_separator', 'value' => '-', 'description1' => 'Title Separator', 'description2' => '', 'group' => 0, 'type' => 'text', 'invincible' => 1);
  565. $this->db->insert('config', $data);
  566. $data = array('id' => NULL, 'name' => 'no_php_images', 'value' => '0', 'description1' => 'Use Static Image Links', 'description2' => 'Yes|-|No<br /><br />Use actual filesystem URLs to serve image thumbnails and direct images. Will save memory and server cycles on large sites.', 'group' => 0, 'type' => 'yesno', 'invincible' => 1);
  567. $this->db->insert('config', $data);
  568. $data = array('id' => NULL, 'name' => 'allow_version_check', 'value' => '1', 'description1' => 'Allow Version Check', 'description2' => 'Yes|-|No<br /><br />Allow XtraUpload to call home to check for new versions and security updates?', 'group' => 0, 'type' => 'yesno', 'invincible' => 1);
  569. $this->db->insert('config', $data);
  570. $data = array('id' => NULL, 'name' => 'home_info_msg', 'value' => NULL, 'description1' => 'Home Page Message', 'description2' => 'Message to display to all your users on the home page. Like an announcement', 'group' => 0, 'type' => 'box', 'invincible' => 1);
  571. $this->db->insert('config', $data);
  572. $data = array('id' => NULL, 'name' => 'show_preview', 'value' => '1', 'description1' => 'Show File Preview', 'description2' => 'Yes|-|No<br /><br />Show a preview of some file types on download(mp3, wmv, mov) and an embed code.', 'group' => 0, 'type' => 'yesno', 'invincible' => 1);
  573. $this->db->insert('config', $data);
  574. $data = array('id' => NULL, 'name' => 'show_recent_uploads', 'value' => '1', 'description1' => 'Show Recent Uploads', 'description2' => 'Yes|-|No<br /><br />Show a list of the 5 most recently uploaded files?', 'group' => 0, 'type' => 'yesno', 'invincible' => 1);
  575. $this->db->insert('config', $data);
  576. $data = array('id' => NULL, 'name' => '_db_version', 'value' => $this->_db_version, 'description1' => '', 'description2' => '', 'group' => 0, 'type' => 'text', 'invincible' => 1);
  577. $this->db->insert('config', $data);
  578. // counters Table
  579. $fields = array(
  580. 'id' => array(
  581. 'type' => 'INT',
  582. 'constraint' => 11,
  583. 'unsigned' => TRUE,
  584. 'auto_increment' => TRUE
  585. ),
  586. 'downloads' => array(
  587. 'type' => 'VARCHAR',
  588. 'constraint' => 8
  589. ),
  590. 'bandwidth' => array(
  591. 'type' => 'VARCHAR',
  592. 'constraint' => 8
  593. )
  594. );
  595. $this->dbforge->add_field($fields);
  596. $this->dbforge->add_key('id', true);
  597. $this->dbforge->create_table('counters');
  598. // dlinks Table
  599. $fields = array(
  600. 'id' => array(
  601. 'type' => 'INT',
  602. 'constraint' => 11,
  603. 'unsigned' => TRUE,
  604. 'auto_increment' => TRUE
  605. ),
  606. 'fid' => array(
  607. 'type' => 'VARCHAR',
  608. 'constraint' => 16
  609. ),
  610. 'time' => array(
  611. 'type' => 'VARCHAR',
  612. 'constraint' => 22
  613. ),
  614. 'name' => array(
  615. 'type' => 'VARCHAR',
  616. 'constraint' => 255
  617. ),
  618. 'ip' => array(
  619. 'type' => 'VARCHAR',
  620. 'constraint' => 15
  621. ),
  622. 'stream' => array(
  623. 'type' => 'TINYINT',
  624. 'constraint' => 1
  625. )
  626. );
  627. $this->dbforge->add_field($fields);
  628. $this->dbforge->add_key('id', true);
  629. $this->dbforge->create_table('dlinks');
  630. // dlsessions Table
  631. $fields = array(
  632. 'id' => array(
  633. 'type' => 'INT',
  634. 'constraint' => 11,
  635. 'unsigned' => TRUE,
  636. 'auto_increment' => TRUE
  637. ),
  638. 'fid' => array(
  639. 'type' => 'VARCHAR',
  640. 'constraint' => 16
  641. ),
  642. 'ip' => array(
  643. 'type' => 'VARCHAR',
  644. 'constraint' => 15
  645. ),
  646. 'user' => array(
  647. 'type' => 'INT',
  648. 'constraint' => 11
  649. )
  650. );
  651. $this->dbforge->add_field($fields);
  652. $this->dbforge->add_key('id', true);
  653. $this->dbforge->add_key('fid');
  654. $this->dbforge->add_key('ip');
  655. $this->dbforge->create_table('dlsessions');
  656. // Downloads Table
  657. $fields = array(
  658. 'id' => array(
  659. 'type' => 'INT',
  660. 'constraint' => 11,
  661. 'unsigned' => TRUE,
  662. 'auto_increment' => TRUE
  663. ),
  664. 'file_id' => array(
  665. 'type' => 'VARCHAR',
  666. 'constraint' => 16
  667. ),
  668. 'user' => array(
  669. 'type' => 'VARCHAR',
  670. 'constraint' => 20
  671. ),
  672. 'ip' => array(
  673. 'type' => 'VARCHAR',
  674. 'constraint' => 15
  675. ),
  676. 'size' => array(
  677. 'type' => 'VARCHAR',
  678. 'constraint' => 50
  679. ),
  680. 'sent' => array(
  681. 'type' => 'VARCHAR',
  682. 'constraint' => 50
  683. ),
  684. 'time' => array(
  685. 'type' => 'VARCHAR',
  686. 'constraint' => 25
  687. )
  688. );
  689. $this->dbforge->add_field($fields);
  690. $this->dbforge->add_key('id', true);
  691. $this->dbforge->add_key('file_id');
  692. $this->dbforge->add_key('user');
  693. $this->dbforge->add_key('ip');
  694. $this->dbforge->create_table('downloads');
  695. // Extend Table
  696. $fields = array(
  697. 'id' => array(
  698. 'type' => 'INT',
  699. 'constraint' => 11,
  700. 'unsigned' => TRUE,
  701. 'auto_increment' => TRUE
  702. ),
  703. 'file_name' => array(
  704. 'type' => 'VARCHAR',
  705. 'constraint' => 100
  706. ),
  707. 'data' => array(
  708. 'type' => 'TEXT'
  709. ),
  710. 'date' => array(
  711. 'type' => 'VARCHAR',
  712. 'constraint' => 22
  713. ),
  714. 'uid' => array(
  715. 'type' => 'INT',
  716. 'constraint' => 11,
  717. 'unsigned' => TRUE
  718. ),
  719. 'active' => array(
  720. 'type' => 'TINYINT',
  721. 'constraint' => 1
  722. )
  723. );
  724. $this->dbforge->add_field($fields);
  725. $this->dbforge->add_key('id', true);
  726. $this->dbforge->add_key('file_name');
  727. $this->dbforge->create_table('extend');
  728. // Files Table
  729. $fields = array(
  730. 'id' => array(
  731. 'type' => 'INT',
  732. 'constraint' => 11,
  733. 'unsigned' => TRUE,
  734. 'auto_increment' => TRUE
  735. ),
  736. 'filename' => array(
  737. 'type' => 'TEXT'
  738. ),
  739. 'size' => array(
  740. 'type' => 'INT',
  741. 'constraint' => 11
  742. ),
  743. 'md5' => array(
  744. 'type' => 'VARCHAR',
  745. 'constraint' => 32
  746. ),
  747. 'status' => array(
  748. 'type' => 'TINYINT',
  749. 'constraint' => 4
  750. ),
  751. 'type' => array(
  752. 'type' => 'VARCHAR',
  753. 'constraint' => 10
  754. ),
  755. 'prefix' => array(
  756. 'type' => 'VARCHAR',
  757. 'constraint' => 2
  758. ),
  759. 'is_image' => array(
  760. 'type' => 'TINYINT',
  761. 'constraint' => 1
  762. ),
  763. 'thumb' => array(
  764. 'type' => 'TEXT'
  765. ),
  766. 'server' => array(
  767. 'type' => 'VARCHAR',
  768. 'constraint' => 255
  769. ),
  770. 'mirror' => array(
  771. 'type' => 'TINYINT',
  772. 'constraint' => 1
  773. ),
  774. 'server' => array(
  775. 'type' => 'TEXT'
  776. )
  777. );
  778. $this->dbforge->add_field($fields);
  779. $this->dbforge->add_key('id', true);
  780. $this->dbforge->add_key('prefix');
  781. $this->dbforge->add_key('md5');
  782. $this->dbforge->create_table('files');
  783. // Folder Table
  784. $fields = array(
  785. 'id' => array(
  786. 'type' => 'INT',
  787. 'constraint' => 11,
  788. 'unsigned' => TRUE,
  789. 'auto_increment' => TRUE
  790. ),
  791. 'f_id' => array(
  792. 'type' => 'VARCHAR',
  793. 'constraint' => 15
  794. ),
  795. 'name' => array(
  796. 'type' => 'TEXT'
  797. ),
  798. 'descr' => array(
  799. 'type' => 'TEXT'
  800. ),
  801. 'pass' => array(
  802. 'type' => 'VARCHAR',
  803. 'constraint' => 150,
  804. )
  805. );
  806. $this->dbforge->add_field($fields);
  807. $this->dbforge->add_key('id', true);
  808. $this->dbforge->add_key('f_id', false);
  809. $this->dbforge->create_table('folder');
  810. // Galleries Table
  811. $fields = array(
  812. 'id' => array(
  813. 'type' => 'INT',
  814. 'constraint' => 11,
  815. 'unsigned' => TRUE,
  816. 'auto_increment' => TRUE
  817. ),
  818. 'g_id' => array(
  819. 'type' => 'VARCHAR',
  820. 'constraint' => 15
  821. ),
  822. 'name' => array(
  823. 'type' => 'TEXT'
  824. ),
  825. 'descr' => array(
  826. 'type' => 'TEXT'
  827. ),
  828. 'pass' => array(
  829. 'type' => 'VARCHAR',
  830. 'constraint' => 150,
  831. )
  832. );
  833. $this->dbforge->add_field($fields);
  834. $this->dbforge->add_key('id', true);
  835. $this->dbforge->add_key('g_id', false);
  836. $this->dbforge->create_table('gallery');
  837. // g_items Table
  838. $fields = array(
  839. 'id' => array(
  840. 'type' => 'INT',
  841. 'constraint' => 11,
  842. 'unsigned' => TRUE,
  843. 'auto_increment' => TRUE
  844. ),
  845. 'gid' => array(
  846. 'type' => 'VARCHAR',
  847. 'constraint' => 8
  848. ),
  849. 'thumb' => array(
  850. 'type' => 'TEXT'
  851. ),
  852. 'direct' => array(
  853. 'type' => 'TEXT'
  854. ),
  855. 'fid' => array(
  856. 'type' => 'VARCHAR',
  857. 'constraint' => 16
  858. ),
  859. 'view' => array(
  860. 'type' => 'TEXT'
  861. )
  862. );
  863. $this->dbforge->add_field($fields);
  864. $this->dbforge->add_key('id', true);
  865. $this->dbforge->add_key('gid', false);
  866. $this->dbforge->create_table('g_items');
  867. // groups Table
  868. $fields = array(
  869. 'id' => array(
  870. 'type' => 'INT',
  871. 'constraint' => 11,
  872. 'unsigned' => TRUE,
  873. 'auto_increment' => TRUE
  874. ),
  875. 'name' => array(
  876. 'type' => 'VARCHAR',
  877. 'constraint' => 100
  878. ),
  879. 'status' => array(
  880. 'type' => 'TINYINT',
  881. 'constraint' => 1
  882. ),
  883. 'descr' => array(
  884. 'type' => 'TEXT'
  885. ),
  886. 'price' => array(
  887. 'type' => 'VARCHAR',
  888. 'constraint' => 8
  889. ),
  890. 'repeat_billing' => array(
  891. 'type' => 'VARCHAR',
  892. 'constraint' => 5
  893. ),
  894. 'speed_limit' => array(
  895. 'type' => 'VARCHAR',
  896. 'constraint' => 10
  897. ),
  898. 'upload_size_limit' => array(
  899. 'type' => 'VARCHAR',
  900. 'constraint' => 15
  901. ),
  902. 'wait_time' => array(
  903. 'type' => 'VARCHAR',
  904. 'constraint' => 10
  905. ),
  906. 'files_types' => array(
  907. 'type' => 'TEXT'
  908. ),
  909. 'file_types_allow_deny' => array(
  910. 'type' => 'TINYINT',
  911. 'constraint' => 1
  912. ),
  913. 'download_captcha' => array(
  914. 'type' => 'TINYINT',
  915. 'constraint' => 1
  916. ),
  917. 'auto_download' => array(
  918. 'type' => 'TINYINT',
  919. 'constraint' => 1
  920. ),
  921. 'upload_num_limit' => array(
  922. 'type' => 'INT',
  923. 'constraint' => 11
  924. ),
  925. 'storage_limit' => array(
  926. 'type' => 'VARCHAR',
  927. 'constraint' => 50
  928. ),
  929. 'can_search' => array(
  930. 'type' => 'TINYINT',
  931. 'default' => '0',
  932. 'constraint' => 1
  933. ),
  934. 'can_flash_upload' => array(
  935. 'type' => 'TINYINT',
  936. 'default' => '1',
  937. 'constraint' => 1
  938. ),
  939. 'can_url_upload' => array(
  940. 'type' => 'TINYINT',
  941. 'default' => '1',
  942. 'constraint' => 1
  943. ),
  944. 'file_expire' => array(
  945. 'type' => 'INT',
  946. 'default' => '30',
  947. 'constraint' => 11
  948. ),
  949. 'admin' => array(
  950. 'type' => 'TINYINT',
  951. 'constraint' => 1,
  952. 'default' => '0'
  953. )
  954. );
  955. $this->dbforge->add_field($fields);
  956. $this->dbforge->add_key('id', true);
  957. $this->dbforge->create_table('groups');
  958. // Insert Free Group
  959. $data = array(
  960. 'id' => '1',
  961. 'name' => 'Free',
  962. 'status' => 1,
  963. 'price' => 0,
  964. 'descr' => 'Free Users',
  965. 'admin' => 0,
  966. 'speed_limit' => '250',
  967. 'upload_size_limit' => '100',
  968. 'wait_time' => '10',
  969. 'files_types' => 'exe|php|sh|bat|cgi|pl',
  970. 'file_types_allow_deny' => 0,
  971. 'download_captcha' => 1,
  972. 'auto_download' => 0,
  973. 'can_search' => '0',
  974. 'can_flash_upload' => '1',
  975. 'can_url_upload' => '1',
  976. 'file_expire' => '30',
  977. 'upload_num_limit' => 10
  978. );
  979. $this->db->insert('groups', $data);
  980. // Insert Admin Group
  981. $data = array(
  982. 'id' => '2',
  983. 'name' => 'Admins',
  984. 'status' => 0,
  985. 'price' => 0,
  986. 'descr' => 'Administrators',
  987. 'admin' => 1,
  988. 'speed_limit' => '2500',
  989. 'upload_size_limit' => '500',
  990. 'wait_time' => '1',
  991. 'files_types' => '',
  992. 'file_types_allow_deny' => 0,
  993. 'download_captcha' => 0,
  994. 'auto_download' => 1,
  995. 'can_search' => 1,
  996. 'can_flash_upload' => 1,
  997. 'can_url_upload' => 1,
  998. 'file_expire' => '0',
  999. 'upload_num_limit' => 500
  1000. );
  1001. $this->db->insert('groups', $data);
  1002. // Insert Admin Group
  1003. $data = array(
  1004. 'id' => '3',
  1005. 'name' => 'Premium',
  1006. 'status' => 1,
  1007. 'price' => 9.99,
  1008. 'descr' => 'Premium Users',
  1009. 'admin' => 0,
  1010. 'repeat_billing' => 'm',
  1011. 'speed_limit' => '500',
  1012. 'upload_size_limit' => '250',
  1013. 'wait_time' => '1',
  1014. 'files_types' => '',
  1015. 'file_types_allow_deny' => 0,
  1016. 'download_captcha' => 0,
  1017. 'auto_download' => 0,
  1018. 'can_search' => 0,
  1019. 'can_flash_upload' => 1,
  1020. 'can_url_upload' => 1,
  1021. 'file_expire' => '90',
  1022. 'upload_num_limit' => 50
  1023. );
  1024. $this->db->insert('groups', $data);
  1025. // f_items Table
  1026. $fields = array(
  1027. 'id' => array(
  1028. 'type' => 'INT',
  1029. 'constraint' => 11,
  1030. 'unsigned' => TRUE,
  1031. 'auto_increment' => TRUE
  1032. ),
  1033. 'folder_id' => array(
  1034. 'type' => 'VARCHAR',
  1035. 'constraint' => 8
  1036. ),
  1037. 'file_id' => array(
  1038. 'type' => 'VARCHAR',
  1039. 'constraint' => 16
  1040. ),
  1041. 'view' => array(
  1042. 'type' => 'TEXT'
  1043. )
  1044. );
  1045. $this->dbforge->add_field($fields);
  1046. $this->dbforge->add_key('id', true);
  1047. $this->dbforge->add_key('folder_id', false);
  1048. $this->dbforge->create_table('f_items');
  1049. // progress Table
  1050. $fields = array(
  1051. 'id' => array(
  1052. 'type' => 'INT',
  1053. 'constraint' => 11,
  1054. 'unsigned' => TRUE,
  1055. 'auto_increment' => TRUE
  1056. ),
  1057. 'progress' => array(
  1058. 'type' => 'BIGINT',
  1059. 'constraint' => 1
  1060. ),
  1061. 'curr_time' => array(
  1062. 'type' => 'TEXT'
  1063. ),
  1064. 'total' => array(
  1065. 'type' => 'VARCHAR',
  1066. 'constraint' => 50
  1067. ),
  1068. 'start_time' => array(
  1069. 'type' => 'TEXT'
  1070. ),
  1071. 'fid' => array(
  1072. 'type' => 'VARCHAR',
  1073. 'constraint' => 16
  1074. )
  1075. );
  1076. $this->dbforge->add_field($fields);
  1077. $this->dbforge->add_key('id', true);
  1078. $this->dbforge->add_key('fid', false);
  1079. $this->dbforge->create_table('progress');
  1080. // Refrence Table
  1081. $fields = array(
  1082. 'id' => array(
  1083. 'type' => 'INT',
  1084. 'constraint' => '11',
  1085. 'unsigned' => true,
  1086. 'auto_increment' => true
  1087. ),
  1088. 'file_id' => array(
  1089. 'type' => 'VARCHAR',
  1090. 'constraint' => '16'
  1091. ),
  1092. 'descr' => array(
  1093. 'type' => 'TEXT'
  1094. ),
  1095. 'password' => array(
  1096. 'type' => 'VARCHAR',
  1097. 'constraint' => '32'
  1098. ),
  1099. 'o_filename' => array(
  1100. 'type' => 'TEXT'
  1101. ),
  1102. 'secid' => array(
  1103. 'type' => 'VARCHAR',
  1104. 'constraint' => '32'
  1105. ),
  1106. 'status' => array(
  1107. 'type' => 'TINYINT',
  1108. 'constraint' => '32'
  1109. ),
  1110. 'ip' => array(
  1111. 'type' => 'VARCHAR',
  1112. 'constraint' => '15'
  1113. ),
  1114. 'link_name' => array(
  1115. 'type' => 'TEXT'
  1116. ),
  1117. 'feature' => array(
  1118. 'type' => 'TINYINT',
  1119. 'constraint' => '32'
  1120. ),
  1121. 'user' => array(
  1122. 'type' => 'INT',
  1123. 'constraint' => '11'
  1124. ),
  1125. 'type' => array(
  1126. 'type' => 'VARCHAR',
  1127. 'constraint' => '10'
  1128. ),
  1129. 'time' => array(
  1130. 'type' => 'VARCHAR',
  1131. 'constraint' => '20'
  1132. ),
  1133. 'pass' => array(
  1134. 'type' => 'VARCHAR',
  1135. 'constraint' => '32'
  1136. ),
  1137. 'rate_num' => array(
  1138. 'type' => 'INT',
  1139. 'constraint' => '32'
  1140. ),
  1141. 'rate_total' => array(
  1142. 'type' => 'INT',
  1143. 'constraint' => '11'
  1144. ),
  1145. 'is_image' => array(
  1146. 'type' => 'TINYINT',
  1147. 'constraint' => '32'
  1148. ),
  1149. 'link_id' => array(
  1150. 'type' => 'VARCHAR',
  1151. 'constraint' => '16'
  1152. ),
  1153. 'downloads' => array(
  1154. 'type' => 'INT',
  1155. 'constraint' => '11'
  1156. ),
  1157. 'featured' => array(
  1158. 'type' => 'TINYINT',
  1159. 'constraint' => '32'
  1160. ),
  1161. 'remote' => array(
  1162. 'type' => 'TINYINT',
  1163. 'constraint' => '1',
  1164. 'default' => '0'
  1165. ),
  1166. 'last_download' => array(
  1167. 'type' => 'VARCHAR',
  1168. 'constraint' => '22'
  1169. ),
  1170. 'direct_bw' => array(
  1171. 'type' => 'VARCHAR',
  1172. 'constraint' => '50'
  1173. ),
  1174. 'direct' => array(
  1175. 'type' => 'TINYINT',
  1176. 'constraint' => '1',
  1177. 'default' => '0'
  1178. )
  1179. );
  1180. $this->dbforge->add_field($fields);
  1181. $this->dbforge->add_key('id', true);
  1182. $this->dbforge->add_key('feature');
  1183. $this->dbforge->add_key('file_id');
  1184. $this->dbforge->create_table('refrence');
  1185. // Servers Table
  1186. $fields = array(
  1187. 'id' => array(
  1188. 'type' => 'INT',
  1189. 'constraint' => 11,
  1190. 'unsigned' => true,
  1191. 'auto_increment' => true
  1192. ),
  1193. 'name' => array(
  1194. 'type' => 'VARCHAR',
  1195. 'constraint' => 150
  1196. ),
  1197. 'url' => array(
  1198. 'type' => 'VARCHAR',
  1199. 'constraint' => 255
  1200. ),
  1201. 'status' => array(
  1202. 'type' => 'INT',
  1203. 'default' => '0',
  1204. 'constraint' => 4
  1205. )
  1206. );
  1207. $this->dbforge->add_field($fields);
  1208. $this->dbforge->add_key('id', true);
  1209. $this->dbforge->create_table('servers');
  1210. $data = array('id' => NULL, 'name' => 'main', 'url' => $this->input->post('url'), 'status' => 1);
  1211. $this->db->insert('servers', $data);
  1212. // Skins Table
  1213. $fields = array(
  1214. 'id' => array(
  1215. 'type' => 'INT',
  1216. 'constraint' => 11,
  1217. 'unsigned' => true,
  1218. 'auto_increment' => true
  1219. ),
  1220. 'name' => array(
  1221. 'type' => 'TEXT',
  1222. ),
  1223. 'active' => array(
  1224. 'type' => 'TINYINT',
  1225. 'unsigned' => TRUE,
  1226. 'default' => '0',
  1227. 'constraint' => 1
  1228. )
  1229. );
  1230. $this->dbforge->add_field($fields);
  1231. $this->dbforge->add_key('id', true);
  1232. $this->dbforge->create_table('skin');
  1233. $data = array('id' => NULL, 'name' => 'default', 'active' => 1);
  1234. $this->db->insert('skin', $data);
  1235. $data = array('id' => NULL, 'name' => 'vector_lover', 'active' => 0);
  1236. $this->db->insert('skin', $data);
  1237. $data = array('id' => NULL, 'name' => 'urban_artist', 'active' => 0);
  1238. $this->db->insert('skin', $data);
  1239. $data = array('id' => NULL, 'name' => 'tech_junkie', 'active' => 0);
  1240. $this->db->insert('skin', $data);
  1241. $data = array('id' => NULL, 'name' => 'citrus_island', 'active' => 0);
  1242. $this->db->insert('skin', $data);
  1243. $data = array('id' => NULL, 'name' => 'style_vantage_orange', 'active' => 0);
  1244. $this->db->insert('skin', $data);
  1245. $data = array('id' => NULL, 'name' => 'style_vantage_blue', 'active' => 0);
  1246. $this->db->insert('skin', $data);
  1247. $data = array('id' => NULL, 'name' => 'style_vantage_green', 'active' => 0);
  1248. $this->db->insert('skin', $data);
  1249. // Sessions Table
  1250. $fields = array(
  1251. 'id' => array(
  1252. 'type' => 'INT',
  1253. 'constraint' => 11,
  1254. 'unsigned' => TRUE,
  1255. 'auto_increment' => TRUE
  1256. ),
  1257. 'username' => array(
  1258. 'type' => 'VARCHAR',
  1259. 'constraint' => 16
  1260. ),
  1261. 'password' => array(
  1262. 'type' => 'VARCHAR',
  1263. 'constraint' => 32
  1264. ),
  1265. 'time' => array(
  1266. 'type' => 'INT',
  1267. 'constraint' => 11
  1268. ),
  1269. 'lastLogin' => array(
  1270. 'type' => 'INT',
  1271. 'constraint' => 11
  1272. ),
  1273. 'status' => array(
  1274. 'type' => 'INT',
  1275. 'constraint' => 11
  1276. ),
  1277. 'ip' => array(
  1278. 'type' => 'VARCHAR',
  1279. 'constraint' => 15
  1280. ),
  1281. 'email' => array(
  1282. 'type' => 'VARCHAR',
  1283. 'constraint' => 255
  1284. ),
  1285. 'group' => array(
  1286. 'type' => 'TINYINT',
  1287. 'constraint' => 4
  1288. ),
  1289. 'gateway' => array(
  1290. 'type' => 'INT',
  1291. 'constraint' => 11,
  1292. 'unsigned' => TRUE.
  1293. 'default' => '0'
  1294. ),
  1295. 'public' => array(
  1296. 'type' => 'TINYINT',
  1297. 'default' => 0,
  1298. 'constraint' => 1
  1299. )
  1300. );
  1301. $this->dbforge->add_field($fields);
  1302. $this->dbforge->add_key('id', true);
  1303. $this->dbforge->add_key('email');
  1304. $this->dbforge->add_key('group');
  1305. $this->dbforge->create_table('users');
  1306. // Insert Admin User
  1307. $data = array(
  1308. 'id' => NULL,
  1309. 'username' => $this->input->post('username'),
  1310. 'password' => md5($this->input->post('enc').$this->input->post('password')),
  1311. 'time' => time(),
  1312. 'lastLogin' => 0,
  1313. 'status' => 1,
  1314. 'public' => 0,
  1315. 'gateway' => '0',
  1316. 'ip' => $this->input->ip_address(),
  1317. 'email' => $this->input->post('email'),
  1318. 'group' => 2
  1319. );
  1320. $this->db->insert('users', $data);
  1321. // Gateways Table
  1322. $fields = array(
  1323. 'id' => array(
  1324. 'type' => 'INT',
  1325. 'constraint' => 11,
  1326. 'unsigned' => TRUE,
  1327. 'auto_increment' => TRUE
  1328. ),
  1329. 'name' => array(
  1330. 'type' => 'VARCHAR',
  1331. 'constraint' => 150
  1332. ),
  1333. 'status' => array(
  1334. 'type' => 'TINYINT',
  1335. 'constraint' => 1
  1336. ),
  1337. 'config' => array(
  1338. 'type' => 'TEXT'
  1339. ),
  1340. 'settings' => array(
  1341. 'type' => 'TEXT'
  1342. ),
  1343. 'slug' => array(
  1344. 'type' => 'VARCHAR',
  1345. 'constraint' => 20,
  1346. 'default' => '0'
  1347. ),
  1348. 'default' => array(
  1349. 'type' => 'TINYINT',
  1350. 'constraint' => 1
  1351. ),
  1352. 'display_name' => array(
  1353. 'type' => 'TEXT',
  1354. 'constraint' => 1,
  1355. )
  1356. );
  1357. $this->dbforge->add_field($fields);
  1358. $this->dbforge->add_key('id', true);
  1359. $this->dbforge->create_table('gateways');
  1360. $data = array('id' => 1, 'name' => 'paypal', 'status' => 1, 'config' => 'a:2:{s:5:"email";s:4:"text";s:8:"currency";s:4:"text";}', 'settings' => 'a:2:{s:5:"email";s:20:"PAYPAL_EMAIL_ADDRESS";s:8:"currency";s:3:"USD";}', 'slug' => 'paypal', 'default' => 1, 'display_name' => 'PayPal'
  1361. );
  1362. $this->db->insert('gateways', $data);
  1363. $data = array('id' => 2, 'name' => 'authorize', 'status' => 1, 'config' => 'a:2:{s:5:"login";s:4:"text";s:6:"secret";s:4:"text";}', 'settings' => 'a:2:{s:5:"login";s:8:"LOGIN_ID";s:6:"secret";s:11:"SECRET_CODE";}', 'slug' => 'auth', 'default' => 0, 'display_name' => 'Authorize.net'
  1364. );
  1365. $this->db->insert('gateways', $data);
  1366. $data = array('id' => 3, 'name' => '2co', 'status' => 1, 'config' => 'a:2:{s:9:"vendor_id";s:4:"text";s:8:"currency";s:4:"text";}', 'settings' => 'a:2:{s:9:"vendor_id";s:9:"VENDOR_ID";s:8:"currency";s:3:"USD";}', 'slug' => 'twoco', 'default' => 0, 'display_name' => '2CheckOut'
  1367. );
  1368. $this->db->insert('gateways', $data);
  1369. // Transactions Table
  1370. $fields = array(
  1371. 'id' => array(
  1372. 'type' => 'INT',
  1373. 'constraint' => 11,
  1374. 'unsigned' => TRUE,
  1375. 'auto_increment' => TRUE
  1376. ),
  1377. 'time' => array(
  1378. 'type' => 'VARCHAR',
  1379. 'constraint' => 20
  1380. ),
  1381. 'config' => array(
  1382. 'type' => 'TEXT'
  1383. ),
  1384. 'settings' => array(
  1385. 'type' => 'TEXT'
  1386. ),
  1387. 'gateway' => array(
  1388. 'type' => 'VARCHAR',
  1389. 'constraint' => 20
  1390. ),
  1391. 'status' => array(
  1392. 'type' => 'TINYINT',
  1393. 'constraint' => 1
  1394. ),
  1395. 'ammount' => array(
  1396. 'type' => 'VARCHAR',
  1397. 'constraint' => 10
  1398. ),
  1399. 'user' => array(
  1400. 'type' => 'INT',
  1401. 'constraint' => 11,
  1402. 'unsigned' => TRUE
  1403. )
  1404. );
  1405. $this->dbforge->add_field($fields);
  1406. $this->dbforge->add_key('id', true);
  1407. $this->dbforge->create_table('transactions');
  1408. // upload_failures Table
  1409. $fields = array(
  1410. 'id' => array(
  1411. 'type' => 'INT',
  1412. 'constraint' => 11,
  1413. 'unsigned' => TRUE,
  1414. 'auto_increment' => TRUE
  1415. ),
  1416. 'secid' => array(
  1417. 'type' => 'VARCHAR',
  1418. 'constraint' => 32
  1419. ),
  1420. 'date' => array(
  1421. 'type' => 'INT',
  1422. 'constraint' => 16,
  1423. ),
  1424. 'reason' => array(
  1425. 'type' => 'VARCHAR',
  1426. 'constraint' => 50,
  1427. )
  1428. );
  1429. $this->dbforge->add_field($fields);
  1430. $this->dbforge->add_key('id', true);
  1431. $this->dbforge->add_key('date', false);
  1432. $this->dbforge->add_key('secid', false);
  1433. $this->dbforge->create_table('upload_failures');
  1434. }
  1435. }