Пример #1
0
 function api_user()
 {
     $user_sso = $this->ci->facebook->user();
     if (isset($user_sso) && isset($user_sso->__resp) && !empty($user_sso->__resp->data)) {
         $user_sso = @$user_sso->__resp->data;
     } else {
         return array();
     }
     $user = array('sso_facebook' => $user_sso->id, 'username' => 'twitter_' . $user_sso->id);
     if ($this->facebook_download_picture) {
         $pic_types = array('small', 'normal', 'large', 'square');
         foreach ($pic_types as $pic_type) {
             @mkdir('data/user/image/' . $pic_type, 0777, true);
             fork('wget "http://graph.facebook.com/' . $user_sso->id . '/picture?type=' . $pic_type . '" -O "./data/user/image/' . $pic_type . '/fb_' . $user_sso->id . '"');
         }
         $user['image'] = 'user/image/fb_' . $user_sso->id;
     } else {
         $user['image'] = 'http://graph.facebook.com/' . $user_sso->id . '/picture';
     }
     $user['email'] = $user_sso->email;
     $user['first_name'] = $user_sso->first_name;
     $user['last_name'] = $user_sso->last_name;
     $user['address'] = $user_sso->location->name;
     $user['locale'] = $user_sso->locale;
     $user['sso_verified'] = $user_sso->verified;
     $genders = array('male' => 1, 'female' => 2);
     $user['gender'] = empty($user_sso->gender) ? 0 : $genders[$user_sso->gender];
     if (!empty($user_sso->timezone)) {
         $this->ci->load->helper('date');
         $timezones = timezones();
         if ($user_sso->timezone > 0) {
             $t = '+' . $user_sso->timezone;
         } else {
             $t = '-' . abs($user_sso->timezone);
         }
         $timezone = 'UTC';
         foreach ($timezones as $key => $val) {
             if ($t == $val) {
                 $timezone = $key;
                 break;
             }
         }
         $user['timezone'] = $timezone;
     } else {
         $user['timezone'] = 'UTC';
     }
     if (!empty($user_sso->birthday)) {
         $b = $user_sso->birthday;
         $e = explode('/', $b);
         if (count($e) == 3) {
             $user['dob'] = $e[2] . '-' . $e[0] . '-' . $e[1];
         } else {
             $user['dob'] = '';
         }
     }
     $db_user = $this->ci->_model('user')->get_login(array('sso_facebook' => $user['sso_facebook']));
     $user['row_status'] = empty($db_user) ? 'new' : 'existing';
     return $user;
 }
Пример #2
0
force_authentication();
do_header(_("editar noticia"), "post");
do_banner_top();
echo '<div id="container-wide">' . "\n";
echo '<div id="genericform-contents">' . "\n";
if (!empty($_REQUEST['id']) && is_numeric($_REQUEST['id'])) {
    $linkres = new Link();
    $linkres->id = $link_id = intval($_REQUEST['id']);
    $linkres->read();
    if (!$linkres->is_editable() || intval($_GET['user'] != $current_user->user_id)) {
        echo '<div class="form-error-submit">&nbsp;&nbsp;' . _("noticia no modificable") . '</div>' . "\n";
        return;
    }
    if ($_POST['phase'] == "1") {
        do_save();
        fork("backend/send_pingbacks.php?id={$linkres->id}");
    } else {
        do_edit();
    }
} else {
    echo '<div class="form-error-submit">&nbsp;&nbsp;' . _("¿duh?") . '</div>';
}
echo "</div>";
do_footer();
function do_edit()
{
    global $linkres, $dblang, $db, $current_user;
    $link_title = trim($linkres->title);
    $link_content = trim($linkres->content);
    $link_tags = htmlspecialchars(trim($linkres->tags));
    $link_url = $linkres->url;
Пример #3
0
function do_submit3() {
	global $db, $current_user;

	$linkres=new Link;

	$linkres->id=$link_id = intval($_POST['id']);

	if(!check_link_key() || !$linkres->read()) die;

	// Check it is not in the queue already
	if ($linkres->duplicates($linkres->url)) {
		// Write headers, they were not printed yet
		do_header(_("enviar noticia"), "post");
		echo '<div id="singlewrap">' . "\n";
		report_dupe($linkres->url);
		return;
	}

	// Check this one was not already queued
	if($linkres->votes == 0 && $linkres->status != 'queued') {
		$db->transaction();
		$linkres->status='queued';
		$linkres->sent_date = $linkres->date=time();
		$linkres->get_uri();
		$linkres->store();
		$linkres->insert_vote($current_user->user_karma);
		$db->commit();

		// Add the new link log/event
		require_once(mnminclude.'log.php');
		log_conditional_insert('link_new', $linkres->id, $linkres->author);

		$db->query("delete from links where link_author = $linkres->author and link_date > date_sub(now(), interval 30 minute) and link_status='discard' and link_votes=0");
		if(!empty($_POST['trackback'])) {
			$trackres = new Trackback;
			$trackres->url=clean_input_url($_POST['trackback']);
			$trackres->link_id=$linkres->id;
			$trackres->link=$linkres->url;
			$trackres->author=$linkres->author;
			$trackres->status = 'pendent';
			$trackres->store();
		}
		fork("backend/send_pingbacks.php?id=$linkres->id");
	}

	header('Location: '. $linkres->get_permalink());
	die;
	
}
Пример #4
0
function controllerRouterFork($routerId, $mode, $userid = false)
{
    $result = fork("./updaterouter.php", "{$routerId} {$mode} {$userid}");
    $colonPos = strpos($result, '::');
    $resultType = substr($result, 0, $colonPos);
    $resultValue = substr($result, $colonPos + 2);
    switch ($resultType) {
        case 'array':
        case 'object':
            $resultValue = json_decode($resultValue);
            break;
        case 'bool':
            $resultValue = $resultValue === 'true';
            break;
        case 'integer':
        case 'double':
            $resultValue = floatval($resultValue);
            break;
        case 'NULL':
            $resultValue = null;
            break;
    }
    return $resultValue;
}
    // Write the data to the sync file for the parent process to read from
    file_put_contents(SYNC_FILE, serialize(array('assetids' => $batched_assetids, 'contextids' => $contextids)));
    exit;
}
//end child process
// Get the assetid data from the child process
$data = unserialize(file_get_contents(SYNC_FILE));
$batched_assetids = $data['assetids'];
$all_contextids = $data['contextids'];
echo "Batch size: " . $BATCH_SIZE . "\n";
echo "Total assets to reindex: " . (count($batched_assetids, COUNT_RECURSIVE) - count($batched_assetids)) . "\n\n";
if (!empty($batched_assetids)) {
    echo "Reindexing ...";
    // Reindex each batch in the seperate process
    foreach ($batched_assetids as $assetids) {
        $pid = fork();
        if (!$pid) {
            require_once $SYSTEM_ROOT . '/core/include/init.inc';
            $root_user = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_user');
            $GLOBALS['SQ_SYSTEM']->setCurrentUser($root_user);
            $sm = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('search_manager');
            // Child process
            foreach ($all_contextids as $contextid) {
                $GLOBALS['SQ_SYSTEM']->changeContext($contextid);
                foreach ($assetids as $assetid) {
                    $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
                    if (is_null($asset)) {
                        continue;
                    }
                    $GLOBALS['SQ_SYSTEM']->changeDatabaseConnection('db2');
                    $GLOBALS['SQ_SYSTEM']->doTransaction('BEGIN');
Пример #6
0
use function jubianchi\async\time\{delay};
use jubianchi\async\socket;
$address = '0.0.0.0';
$port = $_SERVER['argv'][1] ?? 1337;
$queue = [];
$start = function ($socket, $address, $port) use(&$queue) {
    socket_bind($socket, $address, $port);
    socket_listen($socket, 0);
    socket_set_nonblock($socket);
    $index = 0;
    $cancel = false;
    while ($cancel == false) {
        $client = socket_accept($socket);
        if ($client) {
            echo '> Got client...' . PHP_EOL;
            $queue[] = (function () use($index, $client, $address, $port) {
                echo '> Handling request #' . $index . '...' . PHP_EOL;
                $response = 'Hello World!';
                $output = 'HTTP/1.1 200 OK' . "\r\n" . 'Date: ' . date("D, j M Y G:i:s T") . "\r\n" . 'Server: AsyncGenerator/1.0.0 (PHP ' . phpversion() . ')' . "\r\n" . 'Content-Length: ' . strlen($response) . "\r\n" . 'Content-Type: text/plain' . "\r\n" . "\r\n" . $response . "\r\n";
                yield from delay(1000);
                yield from socket\write($client, $output, 5);
                socket_close($client);
            })();
            echo '> Client request #' . $index++ . ' queued...' . PHP_EOL;
        }
        $cancel = yield;
    }
    socket_close($socket);
};
await(race($start(socket_create(AF_INET, SOCK_STREAM, 0), $address, $port), fork($queue)));
/**
* Regenerate the content files in the file system
*
* @param array	$assets_data	Asset that needs content regeneration
* Array(
*	'bodycopy_content_file' => Array(<bodycopy container assetids>),
*	'metadata_file' => Array(<assetids>),
*	'design_file' => Array(<design assetids>),
*   )
* @param array	$contextids
*
* @return void
*/
function regenerate_filesystem_content($assets_data, $contextids)
{
    global $SYSTEM_ROOT;
    echo "\n";
    foreach ($assets_data as $type => $assets_batch) {
        if (empty($assets_batch)) {
            continue;
        }
        echo "Regenerating the " . str_replace('_', ' ', $type) . " ...";
        foreach ($assets_batch as $assetids) {
            $pid = fork();
            if (!$pid) {
                // Do the stuff in the child process
                require_once $SYSTEM_ROOT . '/core/include/init.inc';
                $root_user = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_user');
                $GLOBALS['SQ_SYSTEM']->setCurrentUser($root_user);
                $mm = $GLOBALS['SQ_SYSTEM']->getMetadataManager();
                $GLOBALS['SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
                $processed_design_assetids = array();
                foreach ($contextids as $contextid) {
                    $GLOBALS['SQ_SYSTEM']->changeContext($contextid);
                    foreach ($assetids as $assetid) {
                        $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid);
                        if (is_null($asset)) {
                            continue;
                        }
                        if ($type == 'bodycopy_content_file') {
                            // Its a bodycopy container asset
                            $bodycopy_container_edit_fns = $asset->getEditFns();
                            $bodycopy_container_edit_fns->generateContentFile($asset);
                        } else {
                            if ($type == 'metadata_file') {
                                // Do not trigger "update asset" event when regenerating metadata
                                $mm->regenerateMetadata($assetid, NULL, FALSE);
                            } else {
                                // Design parse file are not contextable, so just go for once for design parse file generation
                                if (isset($processed_design_assetids[$assetid])) {
                                    continue;
                                }
                                // If we're not a design for some reason, continue
                                if (!$asset instanceof Design) {
                                    continue;
                                }
                                $design_edit_fns = $asset->getEditFns();
                                // Take care of parse file contents
                                $parse_file = $asset->data_path . '/parse.txt';
                                if (is_file($parse_file)) {
                                    $parse_file_content = file_get_contents($parse_file);
                                    if (isValidValue($parse_file_content)) {
                                        // If file content is already valid, we are done here
                                        continue;
                                    }
                                    $converted_content = @iconv(SYS_OLD_ENCODING, SYS_NEW_ENCODING . '//IGNORE', $parse_file_content);
                                    if (isValidValue($converted_content)) {
                                        if (!file_put_contents($parse_file, $converted_content)) {
                                            echo "\nCould not update the parse file content for the asset #" . $asset->id . "\n";
                                        }
                                    } else {
                                        echo "\nCould not convert the parse file content for the asset #" . $asset->id . "\n";
                                    }
                                }
                                // Parse and process the design, if successful generate the design file
                                if (@$design_edit_fns->parseAndProcessFile($asset)) {
                                    @$asset->generateDesignFile(false);
                                }
                                // Update respective design customisations
                                $customisation_links = $GLOBALS['SQ_SYSTEM']->am->getLinks($assetid, SQ_LINK_TYPE_2, 'design_customisation', true, 'major', 'customisation');
                                foreach ($customisation_links as $link) {
                                    $customisation = $GLOBALS['SQ_SYSTEM']->am->getAsset($link['minorid'], $link['minor_type_code']);
                                    if (is_null($customisation)) {
                                        continue;
                                    }
                                    @$customisation->updateFromParent($asset);
                                    $GLOBALS['SQ_SYSTEM']->am->forgetAsset($customisation);
                                }
                                // Mark that we have processed the affected design's the parse file
                                $processed_design_assetids[$asset->id] = 1;
                            }
                        }
                        $asset = $GLOBALS['SQ_SYSTEM']->am->forgetAsset($asset);
                        echo ".";
                    }
                    //end foreach assetids
                    $GLOBALS['SQ_SYSTEM']->restoreContext();
                }
                //end foreach contexts
                $GLOBALS['SQ_SYSTEM']->restoreRunLevel();
                $GLOBALS['SQ_SYSTEM']->restoreCurrentUser();
                exit;
            }
            //end child process
        }
        //end foreach asset batch
        echo " done.\n";
    }
    //end foreach type
}
Пример #8
0
 function enqueue()
 {
     global $db, $globals, $current_user;
     // Check this one was not already queued
     if ($this->votes == 0 && $this->author == $current_user->user_id && $this->status != 'queued') {
         $this->status = 'queued';
         $this->sent_date = $this->date = time();
         $this->get_uri();
         $db->transaction();
         if (!$this->store()) {
             $db->rollback();
             return false;
         }
         $this->insert_vote($current_user->user_karma);
         // Add the new link log/event
         Log::conditional_insert('link_new', $this->id, $this->author);
         $db->query("delete from links where link_author = {$this->author} and link_date > date_sub(now(), interval 30 minute) and link_status='discard' and link_votes=0");
         if (!empty($_POST['trackback'])) {
             $trackres = new Trackback();
             $trackres->url = clean_input_url($_POST['trackback']);
             $trackres->link_id = $this->id;
             $trackres->link = $this->url;
             $trackres->author = $this->author;
             $trackres->status = 'pendent';
             $trackres->store();
         }
         $db->commit();
         fork("backend/send_pingbacks.php?id={$this->id}");
     }
 }
http://www.gnu.org/licenses

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program; if not, see http://www.gnu.org/licenses
or write to the Free Software Foundation, Inc., 51 Franklin Street,
Fifth Floor, Boston, MA 02110-1301 USA
--> */
include 'fork.php';
$filename = Nexista_Path::get('_files/file/name', 'flow');
/* FIXME */
$file = '';
$c_root = $b_path . '$filename';
$c_ppm = $c_root . '-000001.ppm';
$ext = '.png';
$bitmap_file = $file . $ext;
$bitmap_filename = $filename . $ext;
Nexista_Flow::add('bitmap_filename', $filename);
/* This requires pdftoppm, from xpdf */
$my_commands = "pdftoppm {$file} -r 288 {$c_root} && \\\nconvert {$c_ppm} -resize 25% -quality 75% -interlace none {$bitmap_file} && \\\nrm {$c_ppm}";
fork($my_commands);
Пример #10
0
function updateAddon($curseAddonID)
{
    global $debug, $baseURL, $currentDateTime, $addonName, $ourAddonName, $zipURL, $addonURL, $currentVersion, $currentDownloadID;
    require 'config.php';
    $addonInfo = parseXML(fetchAddonXML($curseAddonID));
    $addonName = $addonInfo[0];
    $addonURL = $addonInfo[1];
    $currentDownloadID = $addonInfo[2];
    $currentVersion = $addonInfo[3];
    $zipURL = $addonInfo[4];
    $currentDateTime = getDateTime();
    $query = "SELECT lastDownloadID from amz_addonsList WHERE curseAddonID=" . $curseAddonID;
    $result = mysql_query($query);
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $lastDownloadID = trim($row['lastDownloadID']);
    }
    $query = "UPDATE amz_addonsList SET addonName='{$addonName}', addonURL='{$addonURL}', version='{$currentVersion}', lastUpdateDateTime='{$currentDateTime['0']}', lastUpdateDateTimeHuman='{$currentDateTime['1']}' WHERE curseAddonID={$curseAddonID}";
    if ($debug) {
        echo $query . "<br />";
    }
    $updatesult = mysql_query($query);
    if ($debug && !$updateResult) {
        die('Invalid query: ' . mysql_error());
    }
    if ($currentDownloadID != $lastDownloadID) {
        $updatedNeeded = true;
    }
    if (!file_exists($baseURL . 'cachedZips/' . $addonName . '.zip')) {
        $updatedNeeded = true;
    }
    if (!file_exists($baseURL . 'cachedZips/' . $addonName . '.dir') && !$updatedNeeded) {
        fork('unzip -d "' . $baseURL . 'cachedZips/' . $addonName . '.dir" "' . $baseURL . 'cachedZips/' . $addonName . '.zip"');
    }
    if (!file_exists($baseURL . 'cachedZips/' . $addonName . '.dir/versions/' . $addonName . '.md5') && !$updatedNeeded) {
        md5Addon($addonName);
    }
    if (!$updatedNeeded) {
        return false;
    }
    $_SESSION['addonName'] = $addonName;
    $_SESSION['curseAddonID'] = $curseAddonID;
    $_SESSION['addonSize'] = getContentLength($zipURL);
    touch($baseURL . $curseAddonID . "InProgress");
    fork('wget -O "' . $baseURL . 'cachedZips/' . $addonName . '.zip" ' . $zipURL . ' && rm ' . $baseURL . $curseAddonID . 'InProgress && rm -rf "' . $baseURL . 'cachedZips/' . $addonName . '.dir"; unzip -d "' . $baseURL . 'cachedZips/' . $addonName . '.dir" "' . $baseURL . 'cachedZips/' . $addonName . '.zip" && md5 "' . $baseURL . 'cachedZips/' . $addonName . '.zip" -out "' . $baseURL . 'cachedZips/' . $addonName . '.dir/md5checksum.txt"');
    if (addonExists($curseAddonID)) {
        $query = "UPDATE amz_addonsList SET addonName='{$addonName}', version='{$currentVersion}', addonURL='{$addonURL}', lastDownloadID={$currentDownloadID}, lastDownloadDateTime='{$currentDateTime['0']}', lastDownloadDateTimeHuman='{$currentDateTime['1']}', lastUpdateDateTime='{$currentDateTime['0']}', lastUpdateDateTimeHuman='{$currentDateTime['1']}' WHERE curseAddonID={$curseAddonID}";
    } else {
        $query = "INSERT INTO amz_addonsList (curseAddonID, addonName, version, addonURL, lastDownloadID, lastDownloadDateTime, lastDownloadDateTimeHuman, lastUpdateDateTime, lastUpdateDateTimeHuman) VALUES ({$curseAddonID}, '{$addonName}', '{$currentVersion}', '{$addonURL}', {$currentDownloadID}, '{$currentDateTime['0']}', '{$currentDateTime['1']}', '{$currentDateTime['0']}', '{$currentDateTime['1']}')";
    }
    $result = mysql_query($query);
    if ($debug && !$result) {
        die('Invalid query: ' . mysql_error());
    }
    return true;
}
Пример #11
0
function do_submit3()
{
    global $db, $current_user;
    $linkres = new Link();
    $linkres->id = $link_id = intval($_POST['id']);
    if (!check_link_key() || !$linkres->read()) {
        die;
    }
    // Check it is not in the queue already
    if ($linkres->votes == 0 && $linkres->status != 'queued') {
        $linkres->status = 'queued';
        $linkres->sent_date = $linkres->date = time();
        $linkres->get_uri();
        $linkres->store();
        $linkres->insert_vote($current_user->user_id, $current_user->user_karma);
        // Add the new link log/event
        require_once mnminclude . 'log.php';
        log_conditional_insert('link_new', $linkres->id, $linkres->author);
        $db->query("delete from links where link_author = {$linkres->author} and link_date > date_sub(now(), interval 30 minute) and link_status='discard' and link_votes=0");
        if (!empty($_POST['trackback'])) {
            require_once mnminclude . 'trackback.php';
            $trackres = new Trackback();
            $trackres->url = clean_input_url($_POST['trackback']);
            $trackres->link_id = $linkres->id;
            $trackres->link = $linkres->url;
            //$trackres->title=$linkres->title;
            $trackres->author = $linkres->author;
            //$trackres->content=$linkres->content;
            $res = $trackres->send($linkres);
        }
        fork("backend/send_pingbacks.php?id={$linkres->id}");
    }
    header('Location: ' . $linkres->get_permalink());
    die;
}
Пример #12
0
 function try_login($login, $password, $mode)
 {
     $CI =& get_instance();
     $method = empty($mode) ? 'login' : 'login_' . $mode;
     if ($mode == 'facebook') {
         $CI->load->library('facebook');
         if (!$CI->facebook->logged_in()) {
             $continue = $CI->_get_redirect();
             $CI->session->set_userdata('continue', $continue);
             $CI->facebook->login();
             exit;
         } else {
             $user_sso = $CI->facebook->user();
             $pic_types = array('small', 'normal', 'large', 'square');
             foreach ($pic_types as $pic_type) {
                 @mkdir('data/user/image/' . $pic_type, 0777, true);
                 fork('wget "http://graph.facebook.com/' . $user_sso->id . '/picture?type=' . $pic_type . '" -O "./data/user/image/' . $pic_type . '/fb_' . $user_sso->id . '"');
             }
             $data = array('sso_facebook' => $user_sso->id, 'email' => $user_sso->email, 'image' => 'user/image/fb_' . $user_sso->id);
             if (@$user_sso->username != NULL) {
                 $data['username'] = $user_sso->username;
             }
             if (@$user_sso->first_name != NULL) {
                 $data['first_name'] = $user_sso->first_name;
             }
             if (@$user_sso->last_name != NULL) {
                 $data['last_name'] = $user_sso->last_name;
             }
             if (@$user_sso->location != NULL && $user_sso->location->name != NULL) {
                 $data['address'] = $user_sso->location->name;
             }
             if (@$user_sso->gender != NULL) {
                 $data['gender'] = $user_sso->gender;
             }
             if (@$user_sso->timezone != NULL) {
                 $data['timezone'] = $user_sso->timezone;
             }
             if (@$user_sso->locale != NULL) {
                 $data['locale'] = $user_sso->locale;
             }
             if (@$user_sso->birthday != NULL) {
                 $b = $user_sso->birthday;
                 $e = explode('/', $b);
                 $data['dob'] = @$e[2] . '-' . @$e[0] . '-' . @$e[1];
             }
             $user = $CI->_model('user')->{$method}($user_sso->id);
             if (!empty($user)) {
                 if (empty($user['status'])) {
                     redirect('user/denied');
                     exit;
                 }
                 $CI->_model('user')->save($data, $user['id']);
                 foreach ($data as $key => $value) {
                     $user[$key] = $value;
                 }
                 return $user;
             } else {
                 if (@$user_sso->username == NULL) {
                     $data['username'] = uniqid();
                 }
                 // FIXME reekoheek to get user by email
                 // username will always be overrided as above
                 $data['password'] = uniqid();
                 $id = $CI->_model('user')->save($data);
                 $CI->_model('user')->add_user_role($id, 2);
                 $user = $CI->_model('user')->{$method}($user_sso->id);
                 if (!empty($this->hook_after_register)) {
                     foreach ($this->hook_after_register as $cb) {
                         call_user_func($cb, $user);
                     }
                 }
                 return $user;
             }
         }
     } else {
         if ($mode == 'twitter') {
             $CI->load->library('tweet');
             if (!$CI->tweet->logged_in()) {
                 $CI->tweet->login();
                 exit;
             } else {
                 $user_sso = $CI->tweet->call('get', 'account/verify_credentials');
                 $user = $CI->_model('user')->{$method}($user_sso->id);
                 if (!empty($user)) {
                     return $user;
                 }
                 $name = explode(' ', $user_sso->name);
                 if (empty($name)) {
                     $name = $user_sso->screen_name;
                 }
                 // calback
                 $data = array('sso_twitter' => $user_sso->id, 'username' => uniqid(), 'password' => '', 'first_name' => $name[0], 'last_name' => $name[count($name) - 1]);
                 $CI->_model('user')->save($data);
                 return $CI->_model('user')->{$method}($user_sso->id);
             }
         }
     }
     return $CI->_model('user')->{$method}($login, $password);
 }