Advertisement
Guest User

batch-import.php

a guest
Aug 29th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.84 KB | None | 0 0
  1. <?php
  2. if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
  3.  
  4. class nggAddGallery {
  5.  
  6.     /**
  7.      * PHP4 compatibility layer for calling the PHP5 constructor.
  8.      *
  9.      */
  10.     function nggAddGallery() {
  11.         return $this->__construct();
  12.     }
  13.  
  14.     /**
  15.      * nggAddGallery::__construct()
  16.      *
  17.      * @return void
  18.      */
  19.     function __construct() {
  20.  
  21.         // same as $_SERVER['REQUEST_URI'], but should work under IIS 6.0
  22.        $this->filepath    = admin_url() . 'admin.php?page=' . $_GET['page'];
  23.  
  24.         //Look for POST updates
  25.         //if ( !empty($_POST) )
  26.         //  $this->processor();
  27.            
  28.         //var_dump ($_POST);
  29.     }
  30.  
  31.     /**
  32.      * Perform the upload and add a new hook for plugins
  33.      *
  34.      * @return void
  35.      */
  36.     function processor() {
  37.         global $wpdb, $ngg, $nggdb;
  38.  
  39.        
  40.         if ( isset($_POST['confirm']) ){
  41.             //check_admin_referer('ngg_addgallery');
  42.  
  43.         if ( !nggGallery::current_user_can( 'NextGEN Add new gallery' ))
  44.             wp_die(__('Cheatin&#8217; uh?'));
  45.                
  46.                
  47.         include_once ( dirname (__FILE__) . '/csv.php' );
  48.         include_once ( dirname (__FILE__) . '/processor.php' );
  49.        
  50.         $p = new bg3giProcessor();
  51.         $p->ProcessOneLine();
  52.        
  53.         usleep(4*1000*1000); //do not stress host!
  54.  
  55.     }
  56.  
  57.  
  58.     }
  59.  
  60.     /**
  61.      * Render the page content
  62.      *
  63.      * @return void
  64.      */
  65.     function controller() {
  66.         global $ngg, $nggdb;
  67.        
  68.         if ( !empty($_POST) )
  69.         {
  70.             $this->processor();
  71.             return ;
  72.         }
  73.        
  74.         ?>
  75.        
  76.         <form name="confirm" action="<?php echo $PHP_SELF;?>" method="POST">
  77.             <div>
  78.                 <br/>
  79.                 <br/>
  80.                 Push start to begin import<br/>
  81.                 <br/>
  82.                 <input type="hidden" name="confirm" value="confirmed">
  83.                 <br><input type="submit" value="Start!"><br>
  84.             </div>
  85.         </form>
  86.        
  87.         <?
  88.        
  89.     }
  90. }
  91. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement