Esempio n. 1
0
 function add($data)
 {
     if (is_array($data)) {
         if (array_key_exists('u_username', $data)) {
             if ($this->user->_checkUsername($data['u_username'], $data['u_email'], true, false)) {
                 include_once PATH_CLASS . '/CIdat.php';
                 // need for Idat
                 include_once PATH_INCLUDE . '/functions.php';
                 // need for randomString()
                 $idat =& CIdat::getInstance();
                 $_randId = $idat->nextID('fotoflix.user_id');
                 $data['u_key'] = substr($_randId . randomString(), 0, 32);
                 $status = $data['u_status'];
                 //$data['u_password'] = md5($data['u_password']);
                 $data = $this->dbh->asql_safe($data);
                 $keys = array_keys($data);
                 $sql = 'INSERT INTO users(' . implode(', ', $keys) . ', u_dateCreated, u_dateModified) ' . 'VALUES(' . implode(', ', $data) . ', NOW(), NOW())';
                 $this->dbh->execute($sql);
                 $return = $this->dbh->insert_id();
                 $sql = 'DELETE FROM user_incompletes WHERE u_key = ' . $data['u_key'] . ' ';
                 $this->dbh->execute($sql);
                 if ($status == 'Pending') {
                     $key = $this->dbh->sql_safe(md5(uniqid(rand(), true)));
                     $this->dbh->execute($sql = 'INSERT INTO user_activation(ua_u_id, ua_key) VALUES(' . $return . ', ' . $key . ')');
                 }
                 return $return;
             } else {
                 array_push($this->error, 'Username / Email (' . $data['u_username'] . ' / ' . $data['u_email'] . ') contained invalid characters.');
             }
         } else {
             array_push($this->error, 'No username was specified.');
         }
     } else {
         array_push($this->error, 'Malformed data sent to update user.');
         return false;
     }
 }
Esempio n. 2
0
 function copy($foto_id = false, $user_id = false, $group = false)
 {
     $retval = false;
     if ($foto_id !== false) {
         include_once PATH_INCLUDE . '/functions.php';
         // needed for randomString()
         include_once PATH_CLASS . '/CIdat.php';
         include_once PATH_CLASS . '/CFotobox.php';
         $id =& CIdat::getInstance();
         $fb =& CFotobox::getInstance();
         $foto_data = $fb->fotoData($foto_id);
         if ($user_id === false) {
             $user_id = $foto_data['P_U_ID'];
         }
         $newName = preg_replace('/\\/thumbnail\\/\\d{6}\\/\\d+/', '/' . $this->stamp . '/' . NOW, $foto_data['P_THUMB_PATH']);
         copy(PATH_FOTOROOT . $foto_data['P_THUMB_PATH'], PATH_FOTOROOT . '/original' . $newName);
         // duplicate original
         copy(PATH_FOTOROOT . $foto_data['P_THUMB_PATH'], PATH_FOTOROOT . '/thumbnail' . $newName);
         // duplicate thumb
         $add_data = $this->dbh->query_first('SELECT * FROM user_fotos WHERE up_id = ' . intval($foto_id));
         // up_web_path, up_flix_path can be removed once the columns are dropped
         unset($add_data['up_id'], $add_data['up_u_id'], $add_data['up_key'], $add_data['up_created_at'], $add_data['up_modified_at'], $add_data['up_web_path'], $add_data['up_flix_path']);
         $add_data['up_u_id'] = intval($user_id);
         // new user id
         $add_data['up_key'] = $id->nextID(FF_IMAGE_KEY) . randomString();
         //if($group !== false)
         //{
         //$add_data['up_status'] = 'pending';
         //}
         $retval = $this->add($add_data);
     }
     return $retval;
 }
Esempio n. 3
0
    case 'live':
        $oldDB = 'fotoflix_live';
        $newDB = 'photagious_live';
        $oldPhotoPath = '/www/www.fotoflix.com/html/fotos';
        $newPhotoPath = '/www/photagious.com/www/html/photos';
        break;
    default:
        echo 'no mode';
        die;
        break;
}
$u =& CUser::getInstance();
$um =& CUserManage::getInstance();
$fb =& CFotobox::getInstance();
$fbm =& CFotoboxManage::getInstance();
$idat =& CIdat::getInstance();
$fl =& CFlix::getInstance();
$flm =& CFlixManage::getInstance();
$accounts = "'premium_trial'";
if (isset($_GET['username'])) {
    $fotoflixUsers = $GLOBALS['dbh']->query_all($sql = 'SELECT u_username, u_accountType FROM ' . $oldDB . '.users WHERE u_username = '******'dbh']->sql_safe($_GET['username']) . ' AND u_dateExpires > NOW() AND u_status = \'active\'');
} else {
    if ($mode == 'live') {
        $fotoflixUsers = $GLOBALS['dbh']->query_all($sql = 'SELECT u_username, u_accountType FROM ' . $oldDB . '.users WHERE u_accountType IN(' . $accounts . ') AND u_dateExpires > NOW() AND u_status = \'active\'');
    } else {
        $fotoflixUsers = $GLOBALS['dbh']->query_all($sql = 'SELECT u_username, u_accountType FROM ' . $oldDB . '.users WHERE u_accountType IN(' . $accounts . ') AND u_dateExpires > NOW()  AND u_status = \'active\'');
    }
}
print_r($fotoflixUsers);
foreach ($fotoflixUsers as $ffUser) {
    $username = $ffUser['u_username'];
Esempio n. 4
0
 function CSession($sess_identifier = false, $user_id = false)
 {
     include_once PATH_CLASS . '/CIdat.php';
     $this->dbh =& $GLOBALS['dbh'];
     $this->Idat =& CIdat::getInstance();
     if (is_numeric($sess_identifier)) {
         $ar = $this->dbh->fetch_assoc($this->dbh->query("SELECT us_hash FROM user_session WHERE us_id = '{$sess_identifier}'"));
         $this->sess_id = $sess_id;
         $this->sess_hash = $ar['us_hash'];
     } else {
         if (strlen($sess_identifier) === 13) {
             $ar = $this->dbh->fetch_assoc($this->dbh->query($sql = "SELECT us_id FROM user_session WHERE us_hash = '{$sess_identifier}'"));
             $this->sess_hash = $sess_identifier;
             $this->sess_id = $ar['us_id'];
         } else {
             $this->sess_hash = false;
             $this->sess_id = false;
         }
     }
     if ($user_id === false) {
         $ar = $this->dbh->fetch_assoc($this->dbh->query("SELECT us_ud_id FROM user_session WHERE us_id = '{$this->sess_id}'"));
         $this->user_id = $ar['us_ud_id'];
     } else {
         $this->user_id = $user_id;
     }
     $this->sess_data = array();
 }