Advertisement
Guest User

Untitled

a guest
Feb 21st, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by deZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 1.1.3.0
  8. * @ Author : DeZender
  9. * @ Release on : 17.05.2011
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. if (!( defined( '_JEXEC' ))) {
  15. exit( 'Restricted access' );
  16. (bool)true;
  17. }
  18.  
  19. class NgrabnewsControllerFilters extends NgrabnewsController {
  20. function __construct() {
  21. parent::( );
  22. $this->registerTask( 'add', 'edit' );
  23. $this->registerTask( 'apply', 'save' );
  24. $file = JRequest::getvar( 'Filedata', '', 'files', 'array' );
  25. jimport( 'joomla.filesystem.file' );
  26. $file['name'] = JFile::makesafe( $file['name'] );
  27.  
  28. if (( isset( $file['name'] ) && $file['name'] != '' )) {
  29. $format = strtolower( JFile::getext( $file['name'] ) );
  30.  
  31. if ($format == 'txt') {
  32. $filecontent = JFile::read( $file['tmp_name'] );
  33.  
  34. if (( ( ( ( ( ( ( ( ( strrpos( $filecontent, 'BEGIN HEADER' ) === false || strrpos( $filecontent, 'BEGIN DO' ) === false ) || strrpos( $filecontent, 'BEGIN INFORMATION' ) === false ) || strrpos( $filecontent, 'BEGIN ACTION' ) === false ) || strrpos( $filecontent, 'nntitle=' ) === false ) || strrpos( $filecontent, 'nntype=' ) === false ) || strrpos( $filecontent, 'nnunique=' ) === false ) || strrpos( $filecontent, 'nntrack=' ) === false ) || strrpos( $filecontent, 'nntop=' ) === false ) || strrpos( $filecontent, 'nnbot=' ) === false )) {
  35. JError::raisewarning( 400, JText::_( 'The content of file is not filter format' ) );
  36. return null;
  37. }
  38.  
  39. $database = &JFactory::getdbo( );
  40. $my = &JFactory::getuser( );
  41.  
  42. $limitarr = NgrabnewsHelper::loadlimitlic( );
  43. $query = 'SELECT count(*) FROM #__ngrab_filter';
  44. $database->setQuery( $query );
  45. $countfillter = $database->loadResult( );
  46. $contentarr = explode( '
  47. ', $filecontent );
  48. $c = 0;
  49. $pharsecontent = array( );
  50. $i = 0;
  51.  
  52. while ($i <= count( $contentarr )) {
  53. if (strrpos( $contentarr[$i], 'nntitle=' ) !== false) {
  54. $c = 1;
  55. }
  56.  
  57. if (strrpos( $contentarr[$i], 'nntype=' ) !== false) {
  58. $c = 2;
  59. }
  60.  
  61. if (strrpos( $contentarr[$i], 'nnunique=' ) !== false) {
  62. $c = 3;
  63. }
  64.  
  65. if (strrpos( $contentarr[$i], 'nntrack=' ) !== false) {
  66. $c = 4;
  67. }
  68.  
  69. if (strrpos( $contentarr[$i], 'nntop=' ) !== false) {
  70. $c = 5;
  71. }
  72.  
  73. if (strrpos( $contentarr[$i], 'nnbot=' ) !== false) {
  74. $c = 6;
  75. }
  76.  
  77. $pharsecontent->$c .= $contentarr[$i] . '
  78. ';
  79. ++$i;
  80. }
  81.  
  82. $remote_num = intval( str_replace( 'nnunique=', '', trim( $pharsecontent[3] ) ) );
  83. $version_num = intval( str_replace( 'nntrack=', '', trim( $pharsecontent[4] ) ) );
  84. $query = 'SELECT id FROM #__ngrab_filter WHERE remote_num=' . $remote_num;
  85. $database->setQuery( $query );
  86. $foundID = $database->loadResult( );
  87. $query = 'SELECT * FROM #__ngrab_lic WHERE id = 1';
  88. $database->setQuery( $query );
  89. $ret = $database->loadObject( );
  90. $lic_data = pack( 'H' . strlen( $ret->license ), $ret->license );
  91. $nng = new NNewsGrabber( $ret->serial_number, $ret->license_key, $lic_data );
  92. $filter_spec = bin2hex( $nng->encrypt_filter( trim( $pharsecontent[0] ) ) );
  93. $filters = new stdClass( );
  94. $filters->user_id = $my->id;
  95. $filters->filter_name = str_replace( 'nntitle=', '', trim( $pharsecontent[1] ) );
  96. $filters->filter_spec = $filter_spec;
  97. $filters->inc_top = str_replace( 'nntop=', '', trim( $pharsecontent[5] ) );
  98. $filters->inc_bot = str_replace( 'nnbot=', '', trim( $pharsecontent[6] ) );
  99. $filters->filter_type = str_replace( 'nntype=', '', trim( $pharsecontent[2] ) );
  100. $filters->remote_num = $remote_num;
  101. $filters->version_num = $version_num;
  102. $filters->mdate = date( 'Y-m-d H:i:s' );
  103. $filters->cdate = date( 'Y-m-d H:i:s' );
  104.  
  105. if ($limitarr['limitfilter'] != 0 - 1) {
  106. if ($foundID) {
  107. if (( 0 < $limitarr['limitfilter'] && $limitarr['limitfilter'] < $countfillter )) {
  108. JError::raisewarning( 400, JText::_( 'You have reach the limit number of filter' ) );
  109. } else {
  110. $filters->id = $foundID;
  111. $database->updateObject( '#__ngrab_filter', $filters, 'id' );
  112. $msg = $filters->filter_name . ' ' . JText::_( 'updated successfull' );
  113. }
  114. } else {
  115. if (( 0 < $limitarr['limitfilter'] && $limitarr['limitfilter'] <= $countfillter )) {
  116. JError::raisewarning( 400, JText::_( 'You have reach the limit number of filter' ) );
  117. } else {
  118. $filters->id = NULL;
  119. $database->insertObject( '#__ngrab_filter', $filters, 'id' );
  120. $msg = $filters->filter_name . ' ' . JText::_( 'added successfull' );
  121. }
  122. }
  123. } else {
  124. JError::raisewarning( 500, JText::_( 'Can not load filter limit infomation' ) );
  125. }
  126. ...............................................
  127. ..........................
  128. .......
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement