[eluser]evil_penguin[/eluser]
the library is :
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class importer
{
var $ci;
var $imported;
public function __construct()
{
$this->ci=&get;_instance();
}
public function grab_contacts($plugin,$username,$password)
{
require_once($this->ci->config->item('base_url').'libraries/openinviter/openinviter.php');
$oi = new OpenInviter();
$oi->startPlugin($plugin);
$oi->login($username,$password);
$array = $oi->getMyContacts();
if(is_array($array) && count($array)>=1)
{
$this->imported = $array;
$this->_store_invited();
return($this->imported);
}else{
return;
}
}
private function _store_invited()
{
foreach($this->imported as $mail=>$name)
{
$a = array( 'user_id' => ospc_user_id(),
'name' => $name,
'email_address' => $mail,
'status' => 0,
'time_imported' => time() );
$this->ci->db->insert('ospc_imported',$a);
unset($a);
}
}
}
?>
and this is the controller where i m loading it...
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
$this->load->helper('url');
}
function index()
{
//$this->load->view('example');
$this->load->library('email');
$this->load->library('importer');
$this->load->view('postinstall');
//$this->load->view('example');
}
}
/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */