-
Lorem Ipsum
+
+
+
+ Zeidhyx Project
+
+
+
+
+ Eclipse Neon download: Win64|32.
+ Téléchargement du workspace Eclipse ici :
+
+
+
+
+
+
+
+ Courbe de Bézier
+
+
+
+
+ - \(N \in \mathbb{N}^*\) : nombre de point nécessaire pour décrire la courbe.
+ - \(p \in \mathbb{R}^N\) : tableau de points ordonnés décrivant la courbe (indices allant de 0 à N-1).
+ - \(t \in [0;1]\) : paramètre de l'équation paramétrique.
+ - \(n\) et \(m \in \mathbb{N}\) : variables itératives des sommations.
+
+
+ $$bézier(t, P) = \frac{\displaystyle\sum_{n=0}^{N-1}{\frac{t^{N-n-1} n! \displaystyle\sum_{m=0}^{N-1}{\frac{(-1)^{m-n-1}m!p_{N-m-1}}{(N-m-1)!(N-2m-1)!}}}{(N-n-1)!}}}{(N-1)!}$$
- Nihil morati post haec militares avidi saepe turbarum adorti sunt Montium primum, qui divertebat in proximo, levi corpore senem
- atque morbosum, et hirsutis resticulis cruribus eius innexis divaricaturn sine spiramento ullo ad usque praetorium traxere praefecti.Alii summum decus in
- carruchis solito altioribus et ambitioso vestium cultu ponentes sudant sub ponderibus lacernarum, quas in collis insertas cingulis ipsis adnectunt nimia
- subtegminum tenuitate perflabiles, expandentes eas crebris agitationibus maximeque sinistra, ut longiores fimbriae tunicaeque perspicue luceant varietate
- liciorum effigiatae in species animalium multiformes.Haec dum oriens diu perferret, caeli reserato tepore Constantius consulatu suo septies et Caesaris
- ter egressus Arelate Valentiam petit, in Gundomadum et Vadomarium fratres Alamannorum reges arma moturus, quorum crebris excursibus vastabantur confines
- limitibus terrae Gallorum.Constituendi autem sunt qui sint in amicitia fines et quasi termini diligendi.De quibus tres video sententias ferri, quarum
- nullam probo, unam, ut eodem modo erga amicum adfecti simus, quo erga nosmet ipsos, alteram, ut nostra in amicos benevolentia illorum erga nos
- benevolentiae pariter aequaliterque respondeat, tertiam, ut, quanti quisque se ipse facit, tanti fiat ab amicis.Quid enim tam absurdum quam delectari
- multis inanimis rebus, ut honore, ut gloria, ut aedificio, ut vestitu cultuque corporis, animante virtute praedito, eo qui vel amare vel, ut ita dicam,
- redamare possit, non admodum delectari? Nihil est enim remuneratione benevolentiae, nihil vicissitudine studiorum officiorumque iucundius.Accenderat
- super his incitatum propositum ad nocendum aliqua mulier vilis, quae ad palatium ut poposcerat intromissa insidias ei latenter obtendi prodiderat a
- militibus obscurissimis.quam Constantina exultans ut in tuto iam locata mariti salute muneratam vehiculoque inpositam per regiae ianuas emisit in
- publicum, ut his inlecebris alios quoque ad indicanda proliceret paria vel maiora.Haec igitur Epicuri non probo, inquam.De cetero vellem equidem aut
- ipse doctrinis fuisset instructior est enim, quod tibi ita videri necesse est, non satis politus iis artibus, quas qui tenent, eruditi appellantur aut ne
- deterruisset alios a studiis.quamquam te quidem video minime esse deterritum.Cuius acerbitati uxor grave accesserat incentivum, germanitate Augusti
- turgida supra modum, quam Hannibaliano regi fratris filio antehac Constantinus iunxerat pater, Megaera quaedam mortalis, inflammatrix saevientis adsidua,
- humani cruoris avida nihil mitius quam maritus; qui paulatim eruditiores facti processu temporis ad nocendum per clandestinos versutosque rumigerulos
- conpertis leviter addere quaedam male suetos falsa et placentia sibi discentes, adfectati regni vel artium nefandarum calumnias insontibus adfligebant.
- Quibus ita sceleste patratis Paulus cruore perfusus reversusque ad principis castra multos coopertos paene catenis adduxit in squalorem deiectos atque
- maestitiam, quorum adventu intendebantur eculei uncosque parabat carnifex et tormenta.et ex is proscripti sunt plures actique in exilium alii, non nullos
- gladii consumpsere poenales.nec enim quisquam facile meminit sub Constantio, ubi susurro tenus haec movebantur, quemquam absolutum.Sed quid est quod in
- hac causa maxime homines admirentur et reprehendant meum consilium, cum ego idem antea multa decreverim, que magis ad hominis dignitatem quam ad rei
- publicae necessitatem pertinerent? Supplicationem quindecim dierum decrevi sententia mea.Rei publicae satis erat tot dierum quot C.Mario ; dis
- immortalibus non erat exigua eadem gratulatio quae ex maximis bellis.Ergo ille cumulus dierum hominis est dignitati tributus.Sed maximum est in amicitia
- parem esse inferiori.Saepe enim excellentiae quaedam sunt, qualis erat Scipionis in nostro, ut ita dicam, grege.Numquam se ille Philo, numquam Rupilio,
- numquam Mummio anteposuit, numquam inferioris ordinis amicis, Q.vero Maximum fratrem, egregium virum omnino, sibi nequaquam parem, quod is anteibat aetate,
- tamquam superiorem colebat suosque omnes per se posse esse ampliores volebat.Dum haec in oriente aguntur, Arelate hiemem agens Constantius post theatralis
- ludos atque circenses ambitioso editos apparatu diem sextum idus Octobres, qui imperii eius annum tricensimum terminabat, insolentiae pondera gravius
- librans, siquid dubium deferebatur aut falsum, pro liquido accipiens et conperto, inter alia excarnificatum Gerontium Magnentianae comitem partis exulari
- maerore multavit.Haec et huius modi quaedam innumerabilia ultrix facinorum impiorum bonorumque praemiatrix aliquotiens operatur Adrastia atque utinam
- semper quam vocabulo duplici etiam Nemesim appellamus: ius quoddam sublime numinis efficacis, humanarum mentium opinione lunari circulo superpositum,
- el ut definiunt alii, substantialis tutela generali potentia partilibus praesidens fatis, quam theologi veteres fingentes Iustitiae filiam ex abdita
- quadam aeternitate tradunt omnia despectare terrena.Adolescebat autem obstinatum propositum erga haec et similia multa scrutanda, stimulos admovente
- regina, quae abrupte mariti fortunas trudebat in exitium praeceps, cum eum potius lenitate feminea ad veritatis humanitatisque viam reducere utilia
- suadendo deberet, ut in Gordianorum actibus factitasse Maximini truculenti illius imperatoris rettulimus coniugem.Quam ob rem ut ii qui superiores
- suntubmittere se debent in amicitia, sic quodam modo inferiores extollere.Sunt enim quidam qui molestas amicitias faciunt, cum ipsi se contemni putant;
- quod non fere contingit nisi iis qui etiam contemnendos se arbitrantur; qui hac opinione non modo verbis sed etiam opere levandi sunt.Auxerunt haec vulgi
- sordidioris audaciam, quod cum ingravesceret penuria commeatuum, famis et furoris inpulsu Eubuli cuiusdam inter suos clari domum ambitiosam ignibus
- subditis inflammavit rectoremque ut sibi iudicio imperiali addictum calcibus incessens et pugnis conculcans seminecem laniatu miserando discerpsit.post
- cuius lacrimosum interitum in unius exitio quisque imaginem periculi sui considerans documento recenti similia formidabat.Utque aegrum corpus quassari
- etiam levibus solet offensis, ita animus eius angustus et tener, quicquid increpuisset, ad salutis suae dispendium existimans factum aut cogitatum,
- insontium caedibus fecit victoriam luctuosam.Proinde concepta rabie saeviore, quam desperatio incendebat et fames, amplificatis viribus ardore incohibili
- in excidium urbium matris Seleuciae efferebantur, quam comes tuebatur Castricius tresque legiones bellicis sudoribus induratae.Eius populus ab
- incunabulis primis ad usque pueritiae tempus extremum, quod annis circumcluditur fere trecentis, circummurana pertulit bella, deinde aetatem ingressus
- adultam post multiplices bellorum aerumnas Alpes transcendit et fretum, in iuvenem erectus et virum ex omni plaga quam orbis ambit inmensus, reportavit
- laureas et triumphos, iamque vergens in senium et nomine solo aliquotiens vincens ad tranquilliora vitae discessit.Incenderat autem audaces usque ad
- insaniam homines ad haec, quae nefariis egere conatibus, Luscus quidam curator urbis subito visus: eosque ut heiulans baiolorum praecentor ad expediendum
- quod orsi sunt incitans vocibus crebris.qui haut longe postea ideo vivus exustus est.
+
+ - Avec 1 point, la courbe est ce point.
+ - Avec 2 points, la courbe est un fragment de droite, le segment reliant ces deux points.
+ - Avec N points, la courbe est un fragment de courbe de degré N-1, commançant au point 0 et se terminant au point N-1.
+
+
+
Geogebra tester in works :
download (version 201603121831)
+
+ Pour ceux qui préfèrent, voici un petit algorithme récursif fonctionnant normalement pour 2 dimensions.
+
+
+ public static Point recursiveBezier(double t,Point... p){
+ Point[] out = new Point[points.length-1];
+ for(int i = 1; i < p.length; i++)
+ out[i-1] = p[i-1].set(p[i-1].x + t*(p[i].x-p[i-1].x), p[i-1].y + t*(p[i].y-p[i-1].y));
+ return (out.lenght == 1) ? out[0] : recursiveBezier(t, out);
+ }
+
+
+
+
+
+
+
+
+ Administration
+
+
+
+ - Coming soon (or not)
+ - Possibilité de créer des discussions
+ - Coming soon (or not)
+ - Coming soon (or not)
+ - Coming soon (or not)
+ - Possibilité d'editer ou de supprimer n'importe quel message
+ - Coming soon (or not)
+ - Coming soon (or not)
+ - Coming soon (or not)
+ - Coming soon (or not)
+ - Coming soon (or not)
+ - Accès en téléchargement des fichiers des projets même privés
+ - Coming soon (or not)
+ - Accèder à toutes les discussions (même privées)
+ - Accès à la passée console d'administration
+
+
+
+
+
+ Formules en vrac
+
+
+
+ - \(e^{i\pi} + 1 = 0\)
+ - \(\pi = \frac{9801}{2\sqrt{2} \displaystyle\sum^{+\infty}_{n=0} \frac{(4n)!}{(n!)^4} \times \frac{[1103 + 26390n]}{(4 \times 99)^{4n}}} = 6\displaystyle\sum^{+\infty}_{n=1}{\frac{1}{n^2}}\)
+ - \(\begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos \alpha & -\sin \alpha \\ 0 & \sin \alpha & \cos \alpha \\ \end{pmatrix} \begin{pmatrix} \cos \beta & 0 & \sin \beta \\ 0 & 1 & 0 \\ -\sin \beta & 0 & \cos \beta \\ \end{pmatrix} \begin{pmatrix} \cos \gamma & -\sin \gamma & 0 \\ \sin \gamma & \cos \gamma & 0 \\ 0 & 0 & 1 \\ \end{pmatrix}\), la matrice de rotation dans \(\mathbb{R}^3\) d'angle \(\alpha\) autour de l'axe x, \(\beta\) autour de y et \(\gamma\) autour de z.
+
-
- alert('Connexion effectuee avec succes !')";
- }
- }
- ?>
\ No newline at end of file
diff --git a/inter.php b/inter.php
new file mode 100644
index 0000000..60487ea
--- /dev/null
+++ b/inter.php
@@ -0,0 +1,262 @@
+prepare ( 'SELECT * FROM users WHERE ID=?' );
+ $req->execute ( array (
+ $sid
+ ) );
+ if ($rep = $req->fetch ()) {
+ $connected = password_verify ( $mdp, $rep ['mdp'] );
+ } else {
+ $connected = FALSE;
+ }
+ $req->closeCursor ();
+ return $connected;
+}
+function getAdminLevel($sid = NULL, $mdp = NULL) {
+ if (! isset ( $sid ) or ! isset ( $mdp )) {
+ $sid = $_SESSION ['session_id'];
+ $mdp = $_SESSION ['session_mdp'];
+ }
+ if (! isConnected ( $sid, $mdp ))
+ return - 1;
+ $req = $GLOBALS ['bdd']->prepare ( 'SELECT * FROM users WHERE ID=?' );
+ $req->execute ( array (
+ $sid
+ ) );
+ if ($result = $req->fetch ()) {
+ $adminLevel = $result ['administration'];
+ } else {
+ $adminLevel = - 1;
+ }
+ $req->closeCursor ();
+ return $adminLevel;
+}
+function getPseudo($sid = NULL, $mdp = NULL) {
+ if (! isset ( $sid ) or ! isset ( $mdp )) {
+ $sid = $_SESSION ['session_id'];
+ $mdp = $_SESSION ['session_mdp'];
+ }
+ if (! isConnected ( $sid, $mdp ))
+ return "neant";
+ $req = $GLOBALS ['bdd']->prepare ( 'SELECT * FROM users WHERE ID=?' );
+ $req->execute ( array (
+ $sid
+ ) );
+ $pseudo = $req->fetch () ['pseudo'];
+ $req->closeCursor ();
+ return $pseudo;
+}
+function getPseudoOf($sid) {
+ $req = $GLOBALS ['bdd']->prepare ( 'SELECT * FROM users WHERE ID=?' );
+ $req->execute ( array (
+ $sid
+ ) );
+ $pseudo = $req->fetch () ['pseudo'];
+ $req->closeCursor ();
+ return $pseudo;
+}
+function tryToConnect($pseudo = NULL, $mdp = NULL) {
+ if (! isset ( $pseudo ) or ! isset ( $mdp )) {
+ $pseudo = $_POST ['pseudo'];
+ $mdp = $_POST ['mdp'];
+ }
+ $req = $GLOBALS ['bdd']->prepare ( 'SELECT * FROM users WHERE pseudo=?' );
+ $req->execute ( array (
+ $pseudo
+ ) );
+ $reponce = $req->fetch ();
+ if ($reponce != NULL) {
+ if (password_verify ( $mdp, $reponce ['mdp'] )) {
+ $req->closeCursor ();
+ return $reponce ['ID'];
+ } else {
+ $req->closeCursor ();
+ return 'errormdp';
+ }
+ } else {
+ $req->closeCursor ();
+ return 'errorpseudo';
+ }
+}
+function getProjectVersionData($project = NULL, $version = NULL) {
+ if (! isset ( $project ) or ! isset ( $version )) {
+ $project = $_GET ['id'];
+ $version = $_GET ['v'];
+ }
+ $req = $GLOBALS ['bdd']->prepare ( 'SELECT p.ID AS pID ,' . ' ' . 'v.versionAbs AS versionAbs , ' . ' ' . 'p.name AS name ,' . ' ' . 'v.version AS version ,' . ' ' . 'v.language AS language ,' . ' ' . 'p.permissions AS permissions ,' . ' ' . 'p.ownersID AS owners' . ' ' . 'FROM projets AS p' . ' ' . 'INNER JOIN versions AS v' . ' ' . 'ON v.project_id = p.ID' . ' ' . 'WHERE v.project_id = ? AND v.versionAbs = ?' );
+ $req->execute ( array (
+ $project,
+ $version
+ ) );
+ if (($data = $req->fetch ())) {
+ $req->closeCursor ();
+ return $data;
+ } else {
+ $req->closeCursor ();
+ return NULL;
+ }
+}
+function getProjectData($project = NULL) {
+ if (! isset ( $project )) {
+ $project = $_GET ['id'];
+ }
+ $req = $GLOBALS ['bdd']->prepare ( 'SELECT p.ID AS ID ,' . ' ' . 'p.name AS name ,' . ' ' . 'p.permissions AS permissions ,' . ' ' . 'p.ownersID AS owners' . ' ' . 'FROM projets AS p' . ' ' . 'WHERE p.ID = ?' );
+ $req->execute ( array (
+ $project
+ ) );
+ if (($data = $req->fetch ())) {
+ $req->closeCursor ();
+ return $data;
+ } else {
+ $req->closeCursor ();
+ return NULL;
+ }
+}
+function getPermissions($data) {
+ $permissions = array (
+ FALSE,
+ FALSE,
+ FALSE,
+ FALSE
+ );
+ $permissions [0] = preg_match ( '#^1#', $data ['permissions'] );
+ $permissions [1] = preg_match ( '#^(0|1)1#', $data ['permissions'] );
+ $permissions [2] = preg_match ( '#^(0|1){2}1#', $data ['permissions'] );
+ $permissions [3] = preg_match ( '#^(0|1){3}1#', $data ['permissions'] );
+ return $permissions;
+}
+function getProjectsWithFirstPermission() {
+ $requete = 'SELECT p.ID AS projectID , v.versionAbs AS versionAbs , p.name AS projectName , v.version AS versionName ' . 'FROM projets AS p ' . 'INNER JOIN versions AS v ' . 'ON v.project_id = p.ID ' . 'WHERE p.permissions LIKE "1%" ';
+ $req = $GLOBALS ['bdd']->query ( $requete );
+ $projects = array ();
+
+ while ( $rep = $req->fetch () ) {
+ if (! isset ( $projects [$rep ['projectID']] )) {
+ $projects [$rep ['projectID']] = $rep;
+ } else if ($projects [$rep ['projectID']] ['versionAbs'] < $rep ['versionAbs']) {
+ $projects [$rep ['projectID']] = $rep;
+ }
+ }
+ $req->closeCursor ();
+ return $projects;
+}
+function getVersions($pid = NULL) {
+ if (! isset ( $pid )) {
+ $pid = $_GET ['id'];
+ }
+
+ $requete = 'SELECT * FROM versions WHERE project_id = ?';
+ $req = $GLOBALS ['bdd']->prepare ( $requete );
+ $req->execute ( array (
+ $pid
+ ) );
+ // ADDPOINT langage
+ $versions = array (
+ array (),
+ array ()
+ );
+ while ( $rep = $req->fetch () ) {
+ $versions [$rep ['language']] [] = array (
+ 'versionAbs' => $rep ['versionAbs'],
+ 'versionName' => $rep ['version']
+ );
+ }
+ $req->closeCursor ();
+ return $versions;
+}
+function getOwnersisProjects($sid = NULL) {
+ if (! isset ( $sid )) {
+ $sid = $_SESSION ['session_id'];
+ }
+ $requete = 'SELECT p.ownersID AS ownersID , p.ID AS projectID , v.versionAbs AS versionAbs , p.name AS projectName , v.version AS versionName ' . 'FROM projets AS p ' . 'INNER JOIN versions AS v ' . 'ON v.project_id = p.ID ' . 'WHERE p.ownersID REGEXP \'[^0-9]?' . $sid . '[^0-9]?\' ';
+ $req = $GLOBALS ['bdd']->query ( $requete );
+ $projects = array ();
+ while ( $rep = $req->fetch () ) {
+ if (! isset ( $projects [$rep ['projectID']] )) {
+ $projects [$rep ['projectID']] = $rep;
+ } else if ($projects [$rep ['projectID']] ['versionAbs'] < $rep ['versionAbs']) {
+ $projects [$rep ['projectID']] = $rep;
+ }
+ }
+ return $projects;
+}
+function registerPerson($pseudo, $mdp) {
+ $req = $GLOBALS ['bdd']->prepare ( "SELECT * FROM users WHERE pseudo=?" );
+ $req->execute ( array (
+ $_POST ['pseudo']
+ ) );
+ if ($req->fetch ()) {
+ return 'usedPseudo';
+ } else {
+ $req = $GLOBALS ['bdd']->prepare ( 'INSERT INTO users(pseudo,mdp,date_creation) VALUES (?,?,NOW())' );
+ $req->execute ( array (
+ $_POST ['pseudo'],
+ password_hash ( $_POST ['mdp'], PASSWORD_DEFAULT )
+ ) );
+ return 'ok';
+ }
+}
+function getMessages($discut = NULL) {
+ if (! isset ( $discut )) {
+ $discut = $_GET ['d'];
+ }
+ $req = $GLOBALS ['bdd']->prepare ( "SELECT * FROM messages WHERE discussion_id=? ORDER BY sendTime DESC" );
+ $req->execute ( array (
+ $discut
+ ) );
+ $rep = array ();
+ while ( $rep [] = $req->fetch () )
+ ;
+ if (count ( $rep ) <= 0)
+ $rep = NULL;
+ $req->closeCursor ();
+ return array_slice ( $rep, 0, - 1, TRUE );
+}
+function getDiscuts() {
+ $req = $GLOBALS ['bdd']->query ( "SELECT * FROM discussions ORDER BY date_creation DESC" );
+ $rep = array ();
+ while ( $rep [] = $req->fetch () )
+ ;
+ if (count ( $rep ) <= 1)
+ $rep = NULL;
+ $req->closeCursor ();
+ return array_slice ( $rep, 0, - 1, TRUE );
+}
+function getDiscutInfos($did = NULL) {
+ if(!isset($did)){
+ $did = $_GET['d'];
+ }
+ $req = $GLOBALS ['bdd']->query ( "SELECT * FROM discussions WHERE ID=?" );
+ return $req->fetch();
+}
+function sendMessage($discut = NULL, $text = NULL, $sender = NULL) {
+ if (! isset ( $discut ) || ! isset ( $text ) || ! isset ( $sender )) {
+ $discut = $_GET ['d'];
+ $text = $_POST ['msg'];
+ $sender = $_SESSION ['session_id'];
+ }
+ $req = $GLOBALS ['bdd']->prepare ( 'INSERT INTO messages(discussion_id,texte,senderID,sendTime) VALUES (?,?,?,NOW())' );
+ $req->execute ( array (
+ $discut,
+ htmlspecialchars ( $text ),
+ $sender
+ ) );
+ return 'ok';
+}
+function createDiscut($name = NULL, $owner = NULL) {
+ if (! isset ( $name ) || ! isset ( $owner )) {
+ $name = $_POST ['name'];
+ $owner = $_SESSION ['session_id'];
+ }
+ $req = $GLOBALS ['bdd']->prepare ( 'INSERT INTO discussions(name,creator_id,date_creation) VALUES (?,?,NOW())' );
+ $req->execute ( array (
+ $name,
+ $owner
+ ) );
+ return 'ok';
+}
diff --git a/logging.php b/logging.php
index c74a1cb..c9a6930 100644
--- a/logging.php
+++ b/logging.php
@@ -1,26 +1,25 @@
prepare('SELECT * FROM users WHERE pseudo=?');
-$req->execute(array($_POST['pseudo']));
-$reponce=$req->fetch();
-
-if($reponce != null){
- if($reponce['mdp']===$_POST['mdp']){
- $_SESSION['session_id'] = $reponce['ID'];
- $_SESSION['session_mdp'] = $reponce['mdp'];
- header('Location:index.php?i=0');
- }else{
- header('Location:login.php?i=2');
- }
-}else{
- header('Location:login.php?i=1');
-}
+$result = tryToConnect();
+switch($result){
+ case 'errormdp':
+ header('Location:login.php');
+ $_SESSION['current_error'] = 'Mot de passe incorrect ...';
+ break;
+ case 'errorpseudo':
+ header('Location:login.php');
+ $_SESSION['current_error'] = 'Nom d\'utilisateur incorrect ...';
+ break;
+ default:
+ echo $result;
+ echo $_POST['mdp'];
+ $_SESSION['session_id'] = $result;
+ $_SESSION['session_mdp'] = $_POST['mdp'];
+ $_SESSION['current_error'] = 'Vous êtes bien connecté (vous l\'avez été et le serez également)!';
+ header('Location:index.php');
+ break;
-
-$req->closeCursor();
-?>
\ No newline at end of file
+}
diff --git a/login.php b/login.php
index 40fc80b..86283c7 100644
--- a/login.php
+++ b/login.php
@@ -11,15 +11,15 @@
-
+
+
+
+
+
+
+
+
+
+
+
+ BIS
+
\ No newline at end of file
diff --git a/megaProcess/downloadJar.php b/megaProcess/downloadJar.php
new file mode 100644
index 0000000..0cc041a
--- /dev/null
+++ b/megaProcess/downloadJar.php
@@ -0,0 +1,47 @@
+login("bernard.lafayette63@gmail.com", "*******************");
+$node = $megaapi->getNodeByPath('imageFinal.jpg', $megaapi->getRootNode());
+$megaapi->startDownload($node, './');
+
+end:
\ No newline at end of file
diff --git a/megaProcess/mega.php b/megaProcess/mega.php
new file mode 100644
index 0000000..57cca5d
--- /dev/null
+++ b/megaProcess/mega.php
@@ -0,0 +1,3618 @@
+_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function readBitmap($path) {
+ return MegaGfxProcessor_readBitmap($this->_cPtr,$path);
+ }
+
+ function getWidth() {
+ return MegaGfxProcessor_getWidth($this->_cPtr);
+ }
+
+ function getHeight() {
+ return MegaGfxProcessor_getHeight($this->_cPtr);
+ }
+
+ function getBitmapDataSize($width,$height,$px,$py,$rw,$rh) {
+ return MegaGfxProcessor_getBitmapDataSize($this->_cPtr,$width,$height,$px,$py,$rw,$rh);
+ }
+
+ function getBitmapData($bitmapData,$size) {
+ return MegaGfxProcessor_getBitmapData($this->_cPtr,$bitmapData,$size);
+ }
+
+ function freeBitmap() {
+ MegaGfxProcessor_freeBitmap($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaGfxProcessor') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'MegaGfxProcessor') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_MegaGfxProcessor($_this);
+ }
+}
+
+class MegaProxy {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const PROXY_NONE = 0;
+
+ const PROXY_AUTO = 1;
+
+ const PROXY_CUSTOM = 2;
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaProxy') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaProxy();
+ }
+
+ function setProxyType($proxyType) {
+ MegaProxy_setProxyType($this->_cPtr,$proxyType);
+ }
+
+ function setProxyURL($proxyURL) {
+ MegaProxy_setProxyURL($this->_cPtr,$proxyURL);
+ }
+
+ function setCredentials($username,$password) {
+ MegaProxy_setCredentials($this->_cPtr,$username,$password);
+ }
+
+ function getProxyType() {
+ return MegaProxy_getProxyType($this->_cPtr);
+ }
+
+ function getProxyURL() {
+ return MegaProxy_getProxyURL($this->_cPtr);
+ }
+
+ function credentialsNeeded() {
+ return MegaProxy_credentialsNeeded($this->_cPtr);
+ }
+
+ function getUsername() {
+ return MegaProxy_getUsername($this->_cPtr);
+ }
+
+ function getPassword() {
+ return MegaProxy_getPassword($this->_cPtr);
+ }
+}
+
+class MegaLogger {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function log($time,$loglevel,$source,$message) {
+ MegaLogger_log($this->_cPtr,$time,$loglevel,$source,$message);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaLogger') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'MegaLogger') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_MegaLogger($_this);
+ }
+}
+
+class MegaNode {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const TYPE_UNKNOWN = -1;
+
+ const TYPE_FILE = 0;
+
+ const TYPE_FOLDER = MegaNode_TYPE_FOLDER;
+
+ const TYPE_ROOT = MegaNode_TYPE_ROOT;
+
+ const TYPE_INCOMING = MegaNode_TYPE_INCOMING;
+
+ const TYPE_RUBBISH = MegaNode_TYPE_RUBBISH;
+
+ const CHANGE_TYPE_REMOVED = MegaNode_CHANGE_TYPE_REMOVED;
+
+ const CHANGE_TYPE_ATTRIBUTES = MegaNode_CHANGE_TYPE_ATTRIBUTES;
+
+ const CHANGE_TYPE_OWNER = MegaNode_CHANGE_TYPE_OWNER;
+
+ const CHANGE_TYPE_TIMESTAMP = MegaNode_CHANGE_TYPE_TIMESTAMP;
+
+ const CHANGE_TYPE_FILE_ATTRIBUTES = MegaNode_CHANGE_TYPE_FILE_ATTRIBUTES;
+
+ const CHANGE_TYPE_INSHARE = MegaNode_CHANGE_TYPE_INSHARE;
+
+ const CHANGE_TYPE_OUTSHARE = MegaNode_CHANGE_TYPE_OUTSHARE;
+
+ const CHANGE_TYPE_PARENT = MegaNode_CHANGE_TYPE_PARENT;
+
+ const CHANGE_TYPE_PENDINGSHARE = MegaNode_CHANGE_TYPE_PENDINGSHARE;
+
+ const CHANGE_TYPE_PUBLIC_LINK = MegaNode_CHANGE_TYPE_PUBLIC_LINK;
+
+ const INVALID_DURATION = MegaNode_INVALID_DURATION;
+
+ static function INVALID_COORDINATE() {
+ return MegaNode_INVALID_COORDINATE_get();
+ }
+
+ function copy() {
+ $r=MegaNode_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function getType() {
+ return MegaNode_getType($this->_cPtr);
+ }
+
+ function getName() {
+ return MegaNode_getName($this->_cPtr);
+ }
+
+ function getFingerprint() {
+ return MegaNode_getFingerprint($this->_cPtr);
+ }
+
+ function hasCustomAttrs() {
+ return MegaNode_hasCustomAttrs($this->_cPtr);
+ }
+
+ function getCustomAttrNames() {
+ $r=MegaNode_getCustomAttrNames($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaStringList($r);
+ }
+ return $r;
+ }
+
+ function getCustomAttr($attrName) {
+ return MegaNode_getCustomAttr($this->_cPtr,$attrName);
+ }
+
+ function getDuration() {
+ return MegaNode_getDuration($this->_cPtr);
+ }
+
+ function getLatitude() {
+ return MegaNode_getLatitude($this->_cPtr);
+ }
+
+ function getLongitude() {
+ return MegaNode_getLongitude($this->_cPtr);
+ }
+
+ function getBase64Handle() {
+ return MegaNode_getBase64Handle($this->_cPtr);
+ }
+
+ function getSize() {
+ return MegaNode_getSize($this->_cPtr);
+ }
+
+ function getCreationTime() {
+ return MegaNode_getCreationTime($this->_cPtr);
+ }
+
+ function getModificationTime() {
+ return MegaNode_getModificationTime($this->_cPtr);
+ }
+
+ function getHandle() {
+ return MegaNode_getHandle($this->_cPtr);
+ }
+
+ function getParentHandle() {
+ return MegaNode_getParentHandle($this->_cPtr);
+ }
+
+ function getBase64Key() {
+ return MegaNode_getBase64Key($this->_cPtr);
+ }
+
+ function getTag() {
+ return MegaNode_getTag($this->_cPtr);
+ }
+
+ function getExpirationTime() {
+ return MegaNode_getExpirationTime($this->_cPtr);
+ }
+
+ function getPublicHandle() {
+ return MegaNode_getPublicHandle($this->_cPtr);
+ }
+
+ function getPublicNode() {
+ $r=MegaNode_getPublicNode($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function getPublicLink() {
+ return MegaNode_getPublicLink($this->_cPtr);
+ }
+
+ function isFile() {
+ return MegaNode_isFile($this->_cPtr);
+ }
+
+ function isFolder() {
+ return MegaNode_isFolder($this->_cPtr);
+ }
+
+ function isRemoved() {
+ return MegaNode_isRemoved($this->_cPtr);
+ }
+
+ function hasChanged($changeType) {
+ return MegaNode_hasChanged($this->_cPtr,$changeType);
+ }
+
+ function getChanges() {
+ return MegaNode_getChanges($this->_cPtr);
+ }
+
+ function hasThumbnail() {
+ return MegaNode_hasThumbnail($this->_cPtr);
+ }
+
+ function hasPreview() {
+ return MegaNode_hasPreview($this->_cPtr);
+ }
+
+ function isPublic() {
+ return MegaNode_isPublic($this->_cPtr);
+ }
+
+ function isShared() {
+ return MegaNode_isShared($this->_cPtr);
+ }
+
+ function isOutShare() {
+ return MegaNode_isOutShare($this->_cPtr);
+ }
+
+ function isInShare() {
+ return MegaNode_isInShare($this->_cPtr);
+ }
+
+ function isExported() {
+ return MegaNode_isExported($this->_cPtr);
+ }
+
+ function isExpired() {
+ return MegaNode_isExpired($this->_cPtr);
+ }
+
+ function isTakenDown() {
+ return MegaNode_isTakenDown($this->_cPtr);
+ }
+
+ function isForeign() {
+ return MegaNode_isForeign($this->_cPtr);
+ }
+
+ function setPrivateAuth($privateAuth) {
+ MegaNode_setPrivateAuth($this->_cPtr,$privateAuth);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaNode') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaNode();
+ }
+}
+
+class MegaUser {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const VISIBILITY_UNKNOWN = -1;
+
+ const VISIBILITY_HIDDEN = 0;
+
+ const VISIBILITY_VISIBLE = 1;
+
+ const VISIBILITY_INACTIVE = 2;
+
+ const VISIBILITY_BLOCKED = 3;
+
+ function copy() {
+ $r=MegaUser_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaUser($r);
+ }
+ return $r;
+ }
+
+ function getEmail() {
+ return MegaUser_getEmail($this->_cPtr);
+ }
+
+ function getHandle() {
+ return MegaUser_getHandle($this->_cPtr);
+ }
+
+ function getVisibility() {
+ return MegaUser_getVisibility($this->_cPtr);
+ }
+
+ function getTimestamp() {
+ return MegaUser_getTimestamp($this->_cPtr);
+ }
+
+ const CHANGE_TYPE_AUTHRING = MegaUser_CHANGE_TYPE_AUTHRING;
+
+ const CHANGE_TYPE_LSTINT = MegaUser_CHANGE_TYPE_LSTINT;
+
+ const CHANGE_TYPE_AVATAR = MegaUser_CHANGE_TYPE_AVATAR;
+
+ const CHANGE_TYPE_FIRSTNAME = MegaUser_CHANGE_TYPE_FIRSTNAME;
+
+ const CHANGE_TYPE_LASTNAME = MegaUser_CHANGE_TYPE_LASTNAME;
+
+ const CHANGE_TYPE_EMAIL = MegaUser_CHANGE_TYPE_EMAIL;
+
+ const CHANGE_TYPE_KEYRING = MegaUser_CHANGE_TYPE_KEYRING;
+
+ const CHANGE_TYPE_COUNTRY = MegaUser_CHANGE_TYPE_COUNTRY;
+
+ const CHANGE_TYPE_BIRTHDAY = MegaUser_CHANGE_TYPE_BIRTHDAY;
+
+ const CHANGE_TYPE_PUBKEY_CU255 = MegaUser_CHANGE_TYPE_PUBKEY_CU255;
+
+ const CHANGE_TYPE_PUBKEY_ED255 = MegaUser_CHANGE_TYPE_PUBKEY_ED255;
+
+ const CHANGE_TYPE_SIG_PUBKEY_RSA = MegaUser_CHANGE_TYPE_SIG_PUBKEY_RSA;
+
+ const CHANGE_TYPE_SIG_PUBKEY_CU25 = MegaUser_CHANGE_TYPE_SIG_PUBKEY_CU25;
+
+ function hasChanged($changeType) {
+ return MegaUser_hasChanged($this->_cPtr,$changeType);
+ }
+
+ function getChanges() {
+ return MegaUser_getChanges($this->_cPtr);
+ }
+
+ function isOwnChange() {
+ return MegaUser_isOwnChange($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaUser') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaUser();
+ }
+}
+
+class MegaShare {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const ACCESS_UNKNOWN = -1;
+
+ const ACCESS_READ = 0;
+
+ const ACCESS_READWRITE = MegaShare_ACCESS_READWRITE;
+
+ const ACCESS_FULL = MegaShare_ACCESS_FULL;
+
+ const ACCESS_OWNER = MegaShare_ACCESS_OWNER;
+
+ function copy() {
+ $r=MegaShare_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaShare($r);
+ }
+ return $r;
+ }
+
+ function getUser() {
+ return MegaShare_getUser($this->_cPtr);
+ }
+
+ function getNodeHandle() {
+ return MegaShare_getNodeHandle($this->_cPtr);
+ }
+
+ function getAccess() {
+ return MegaShare_getAccess($this->_cPtr);
+ }
+
+ function getTimestamp() {
+ return MegaShare_getTimestamp($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaShare') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaShare();
+ }
+}
+
+class MegaStringMap {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function copy() {
+ $r=MegaStringMap_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaStringMap($r);
+ }
+ return $r;
+ }
+
+ function get($key) {
+ return MegaStringMap_get($this->_cPtr,$key);
+ }
+
+ function getKeys() {
+ $r=MegaStringMap_getKeys($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaStringList($r);
+ }
+ return $r;
+ }
+
+ function set($key,$value) {
+ MegaStringMap_set($this->_cPtr,$key,$value);
+ }
+
+ function size() {
+ return MegaStringMap_size($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaStringMap') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaStringMap();
+ }
+}
+
+class MegaStringList {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function copy() {
+ $r=MegaStringList_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaStringList($r);
+ }
+ return $r;
+ }
+
+ function get($i) {
+ return MegaStringList_get($this->_cPtr,$i);
+ }
+
+ function size() {
+ return MegaStringList_size($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaStringList') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaStringList();
+ }
+}
+
+class MegaNodeList {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function copy() {
+ $r=MegaNodeList_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNodeList($r);
+ }
+ return $r;
+ }
+
+ function get($i) {
+ $r=MegaNodeList_get($this->_cPtr,$i);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function size() {
+ return MegaNodeList_size($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaNodeList') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaNodeList();
+ }
+}
+
+class MegaUserList {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function copy() {
+ $r=MegaUserList_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaUserList($r);
+ }
+ return $r;
+ }
+
+ function get($i) {
+ $r=MegaUserList_get($this->_cPtr,$i);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaUser($r);
+ }
+ return $r;
+ }
+
+ function size() {
+ return MegaUserList_size($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaUserList') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaUserList();
+ }
+}
+
+class MegaShareList {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function get($i) {
+ $r=MegaShareList_get($this->_cPtr,$i);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaShare($r);
+ }
+ return $r;
+ }
+
+ function size() {
+ return MegaShareList_size($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaShareList') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaShareList();
+ }
+}
+
+class MegaTransferList {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function get($i) {
+ $r=MegaTransferList_get($this->_cPtr,$i);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaTransfer($r);
+ }
+ return $r;
+ }
+
+ function size() {
+ return MegaTransferList_size($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaTransferList') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaTransferList();
+ }
+}
+
+class MegaContactRequestList {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function copy() {
+ $r=MegaContactRequestList_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaContactRequestList($r);
+ }
+ return $r;
+ }
+
+ function get($i) {
+ $r=MegaContactRequestList_get($this->_cPtr,$i);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaContactRequest($r);
+ }
+ return $r;
+ }
+
+ function size() {
+ return MegaContactRequestList_size($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaContactRequestList') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaContactRequestList();
+ }
+}
+
+class MegaRequest {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const TYPE_LOGIN = 0;
+
+ const TYPE_CREATE_FOLDER = MegaRequest_TYPE_CREATE_FOLDER;
+
+ const TYPE_MOVE = MegaRequest_TYPE_MOVE;
+
+ const TYPE_COPY = MegaRequest_TYPE_COPY;
+
+ const TYPE_RENAME = MegaRequest_TYPE_RENAME;
+
+ const TYPE_REMOVE = MegaRequest_TYPE_REMOVE;
+
+ const TYPE_SHARE = MegaRequest_TYPE_SHARE;
+
+ const TYPE_IMPORT_LINK = MegaRequest_TYPE_IMPORT_LINK;
+
+ const TYPE_EXPORT = MegaRequest_TYPE_EXPORT;
+
+ const TYPE_FETCH_NODES = MegaRequest_TYPE_FETCH_NODES;
+
+ const TYPE_ACCOUNT_DETAILS = MegaRequest_TYPE_ACCOUNT_DETAILS;
+
+ const TYPE_CHANGE_PW = MegaRequest_TYPE_CHANGE_PW;
+
+ const TYPE_UPLOAD = MegaRequest_TYPE_UPLOAD;
+
+ const TYPE_LOGOUT = MegaRequest_TYPE_LOGOUT;
+
+ const TYPE_GET_PUBLIC_NODE = MegaRequest_TYPE_GET_PUBLIC_NODE;
+
+ const TYPE_GET_ATTR_FILE = MegaRequest_TYPE_GET_ATTR_FILE;
+
+ const TYPE_SET_ATTR_FILE = MegaRequest_TYPE_SET_ATTR_FILE;
+
+ const TYPE_GET_ATTR_USER = MegaRequest_TYPE_GET_ATTR_USER;
+
+ const TYPE_SET_ATTR_USER = MegaRequest_TYPE_SET_ATTR_USER;
+
+ const TYPE_RETRY_PENDING_CONNECTIONS = MegaRequest_TYPE_RETRY_PENDING_CONNECTIONS;
+
+ const TYPE_REMOVE_CONTACT = MegaRequest_TYPE_REMOVE_CONTACT;
+
+ const TYPE_CREATE_ACCOUNT = MegaRequest_TYPE_CREATE_ACCOUNT;
+
+ const TYPE_CONFIRM_ACCOUNT = MegaRequest_TYPE_CONFIRM_ACCOUNT;
+
+ const TYPE_QUERY_SIGNUP_LINK = MegaRequest_TYPE_QUERY_SIGNUP_LINK;
+
+ const TYPE_ADD_SYNC = MegaRequest_TYPE_ADD_SYNC;
+
+ const TYPE_REMOVE_SYNC = MegaRequest_TYPE_REMOVE_SYNC;
+
+ const TYPE_REMOVE_SYNCS = MegaRequest_TYPE_REMOVE_SYNCS;
+
+ const TYPE_PAUSE_TRANSFERS = MegaRequest_TYPE_PAUSE_TRANSFERS;
+
+ const TYPE_CANCEL_TRANSFER = MegaRequest_TYPE_CANCEL_TRANSFER;
+
+ const TYPE_CANCEL_TRANSFERS = MegaRequest_TYPE_CANCEL_TRANSFERS;
+
+ const TYPE_DELETE = MegaRequest_TYPE_DELETE;
+
+ const TYPE_REPORT_EVENT = MegaRequest_TYPE_REPORT_EVENT;
+
+ const TYPE_CANCEL_ATTR_FILE = MegaRequest_TYPE_CANCEL_ATTR_FILE;
+
+ const TYPE_GET_PRICING = MegaRequest_TYPE_GET_PRICING;
+
+ const TYPE_GET_PAYMENT_ID = MegaRequest_TYPE_GET_PAYMENT_ID;
+
+ const TYPE_GET_USER_DATA = MegaRequest_TYPE_GET_USER_DATA;
+
+ const TYPE_LOAD_BALANCING = MegaRequest_TYPE_LOAD_BALANCING;
+
+ const TYPE_KILL_SESSION = MegaRequest_TYPE_KILL_SESSION;
+
+ const TYPE_SUBMIT_PURCHASE_RECEIPT = MegaRequest_TYPE_SUBMIT_PURCHASE_RECEIPT;
+
+ const TYPE_CREDIT_CARD_STORE = MegaRequest_TYPE_CREDIT_CARD_STORE;
+
+ const TYPE_UPGRADE_ACCOUNT = MegaRequest_TYPE_UPGRADE_ACCOUNT;
+
+ const TYPE_CREDIT_CARD_QUERY_SUBSCRIPTIONS = MegaRequest_TYPE_CREDIT_CARD_QUERY_SUBSCRIPTIONS;
+
+ const TYPE_CREDIT_CARD_CANCEL_SUBSCRIPTIONS = MegaRequest_TYPE_CREDIT_CARD_CANCEL_SUBSCRIPTIONS;
+
+ const TYPE_GET_SESSION_TRANSFER_URL = MegaRequest_TYPE_GET_SESSION_TRANSFER_URL;
+
+ const TYPE_GET_PAYMENT_METHODS = MegaRequest_TYPE_GET_PAYMENT_METHODS;
+
+ const TYPE_INVITE_CONTACT = MegaRequest_TYPE_INVITE_CONTACT;
+
+ const TYPE_REPLY_CONTACT_REQUEST = MegaRequest_TYPE_REPLY_CONTACT_REQUEST;
+
+ const TYPE_SUBMIT_FEEDBACK = MegaRequest_TYPE_SUBMIT_FEEDBACK;
+
+ const TYPE_SEND_EVENT = MegaRequest_TYPE_SEND_EVENT;
+
+ const TYPE_CLEAN_RUBBISH_BIN = MegaRequest_TYPE_CLEAN_RUBBISH_BIN;
+
+ const TYPE_SET_ATTR_NODE = MegaRequest_TYPE_SET_ATTR_NODE;
+
+ const TYPE_CHAT_CREATE = MegaRequest_TYPE_CHAT_CREATE;
+
+ const TYPE_CHAT_FETCH = MegaRequest_TYPE_CHAT_FETCH;
+
+ const TYPE_CHAT_INVITE = MegaRequest_TYPE_CHAT_INVITE;
+
+ const TYPE_CHAT_REMOVE = MegaRequest_TYPE_CHAT_REMOVE;
+
+ const TYPE_CHAT_URL = MegaRequest_TYPE_CHAT_URL;
+
+ const TYPE_CHAT_GRANT_ACCESS = MegaRequest_TYPE_CHAT_GRANT_ACCESS;
+
+ const TYPE_CHAT_REMOVE_ACCESS = MegaRequest_TYPE_CHAT_REMOVE_ACCESS;
+
+ const TYPE_USE_HTTPS_ONLY = MegaRequest_TYPE_USE_HTTPS_ONLY;
+
+ const TYPE_SET_PROXY = MegaRequest_TYPE_SET_PROXY;
+
+ const TYPE_GET_RECOVERY_LINK = MegaRequest_TYPE_GET_RECOVERY_LINK;
+
+ const TYPE_QUERY_RECOVERY_LINK = MegaRequest_TYPE_QUERY_RECOVERY_LINK;
+
+ const TYPE_CONFIRM_RECOVERY_LINK = MegaRequest_TYPE_CONFIRM_RECOVERY_LINK;
+
+ const TYPE_GET_CANCEL_LINK = MegaRequest_TYPE_GET_CANCEL_LINK;
+
+ const TYPE_CONFIRM_CANCEL_LINK = MegaRequest_TYPE_CONFIRM_CANCEL_LINK;
+
+ const TYPE_GET_CHANGE_EMAIL_LINK = MegaRequest_TYPE_GET_CHANGE_EMAIL_LINK;
+
+ const TYPE_CONFIRM_CHANGE_EMAIL_LINK = MegaRequest_TYPE_CONFIRM_CHANGE_EMAIL_LINK;
+
+ const TYPE_CHAT_UPDATE_PERMISSIONS = MegaRequest_TYPE_CHAT_UPDATE_PERMISSIONS;
+
+ const TYPE_CHAT_TRUNCATE = MegaRequest_TYPE_CHAT_TRUNCATE;
+
+ function copy() {
+ $r=MegaRequest_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaRequest($r);
+ }
+ return $r;
+ }
+
+ function getType() {
+ return MegaRequest_getType($this->_cPtr);
+ }
+
+ function getRequestString() {
+ return MegaRequest_getRequestString($this->_cPtr);
+ }
+
+ function toString() {
+ return MegaRequest_toString($this->_cPtr);
+ }
+
+ function __str__() {
+ return MegaRequest___str__($this->_cPtr);
+ }
+
+ function __toString() {
+ return MegaRequest___toString($this->_cPtr);
+ }
+
+ function getNodeHandle() {
+ return MegaRequest_getNodeHandle($this->_cPtr);
+ }
+
+ function getLink() {
+ return MegaRequest_getLink($this->_cPtr);
+ }
+
+ function getParentHandle() {
+ return MegaRequest_getParentHandle($this->_cPtr);
+ }
+
+ function getSessionKey() {
+ return MegaRequest_getSessionKey($this->_cPtr);
+ }
+
+ function getName() {
+ return MegaRequest_getName($this->_cPtr);
+ }
+
+ function getEmail() {
+ return MegaRequest_getEmail($this->_cPtr);
+ }
+
+ function getPassword() {
+ return MegaRequest_getPassword($this->_cPtr);
+ }
+
+ function getNewPassword() {
+ return MegaRequest_getNewPassword($this->_cPtr);
+ }
+
+ function getPrivateKey() {
+ return MegaRequest_getPrivateKey($this->_cPtr);
+ }
+
+ function getAccess() {
+ return MegaRequest_getAccess($this->_cPtr);
+ }
+
+ function getFile() {
+ return MegaRequest_getFile($this->_cPtr);
+ }
+
+ function getNumRetry() {
+ return MegaRequest_getNumRetry($this->_cPtr);
+ }
+
+ function getPublicNode() {
+ $r=MegaRequest_getPublicNode($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function getPublicMegaNode() {
+ $r=MegaRequest_getPublicMegaNode($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function getParamType() {
+ return MegaRequest_getParamType($this->_cPtr);
+ }
+
+ function getText() {
+ return MegaRequest_getText($this->_cPtr);
+ }
+
+ function getNumber() {
+ return MegaRequest_getNumber($this->_cPtr);
+ }
+
+ function getFlag() {
+ return MegaRequest_getFlag($this->_cPtr);
+ }
+
+ function getTransferredBytes() {
+ return MegaRequest_getTransferredBytes($this->_cPtr);
+ }
+
+ function getTotalBytes() {
+ return MegaRequest_getTotalBytes($this->_cPtr);
+ }
+
+ function getMegaAccountDetails() {
+ $r=MegaRequest_getMegaAccountDetails($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaAccountDetails($r);
+ }
+ return $r;
+ }
+
+ function getPricing() {
+ $r=MegaRequest_getPricing($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaPricing($r);
+ }
+ return $r;
+ }
+
+ function getTransferTag() {
+ return MegaRequest_getTransferTag($this->_cPtr);
+ }
+
+ function getNumDetails() {
+ return MegaRequest_getNumDetails($this->_cPtr);
+ }
+
+ function getTag() {
+ return MegaRequest_getTag($this->_cPtr);
+ }
+
+ function getMegaStringMap() {
+ $r=MegaRequest_getMegaStringMap($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaStringMap($r);
+ }
+ return $r;
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaRequest') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaRequest();
+ }
+}
+
+class MegaTransfer {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const TYPE_DOWNLOAD = 0;
+
+ const TYPE_UPLOAD = MegaTransfer_TYPE_UPLOAD;
+
+ const TYPE_LOCAL_HTTP_DOWNLOAD = MegaTransfer_TYPE_LOCAL_HTTP_DOWNLOAD;
+
+ function copy() {
+ $r=MegaTransfer_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaTransfer($r);
+ }
+ return $r;
+ }
+
+ function getType() {
+ return MegaTransfer_getType($this->_cPtr);
+ }
+
+ function getTransferString() {
+ return MegaTransfer_getTransferString($this->_cPtr);
+ }
+
+ function toString() {
+ return MegaTransfer_toString($this->_cPtr);
+ }
+
+ function __str__() {
+ return MegaTransfer___str__($this->_cPtr);
+ }
+
+ function __toString() {
+ return MegaTransfer___toString($this->_cPtr);
+ }
+
+ function getStartTime() {
+ return MegaTransfer_getStartTime($this->_cPtr);
+ }
+
+ function getTransferredBytes() {
+ return MegaTransfer_getTransferredBytes($this->_cPtr);
+ }
+
+ function getTotalBytes() {
+ return MegaTransfer_getTotalBytes($this->_cPtr);
+ }
+
+ function getPath() {
+ return MegaTransfer_getPath($this->_cPtr);
+ }
+
+ function getParentPath() {
+ return MegaTransfer_getParentPath($this->_cPtr);
+ }
+
+ function getNodeHandle() {
+ return MegaTransfer_getNodeHandle($this->_cPtr);
+ }
+
+ function getParentHandle() {
+ return MegaTransfer_getParentHandle($this->_cPtr);
+ }
+
+ function getStartPos() {
+ return MegaTransfer_getStartPos($this->_cPtr);
+ }
+
+ function getEndPos() {
+ return MegaTransfer_getEndPos($this->_cPtr);
+ }
+
+ function getFileName() {
+ return MegaTransfer_getFileName($this->_cPtr);
+ }
+
+ function getNumRetry() {
+ return MegaTransfer_getNumRetry($this->_cPtr);
+ }
+
+ function getMaxRetries() {
+ return MegaTransfer_getMaxRetries($this->_cPtr);
+ }
+
+ function getTag() {
+ return MegaTransfer_getTag($this->_cPtr);
+ }
+
+ function getSpeed() {
+ return MegaTransfer_getSpeed($this->_cPtr);
+ }
+
+ function getDeltaSize() {
+ return MegaTransfer_getDeltaSize($this->_cPtr);
+ }
+
+ function getUpdateTime() {
+ return MegaTransfer_getUpdateTime($this->_cPtr);
+ }
+
+ function getPublicMegaNode() {
+ $r=MegaTransfer_getPublicMegaNode($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function isSyncTransfer() {
+ return MegaTransfer_isSyncTransfer($this->_cPtr);
+ }
+
+ function isStreamingTransfer() {
+ return MegaTransfer_isStreamingTransfer($this->_cPtr);
+ }
+
+ function getLastBytes() {
+ return MegaTransfer_getLastBytes($this->_cPtr);
+ }
+
+ function isFolderTransfer() {
+ return MegaTransfer_isFolderTransfer($this->_cPtr);
+ }
+
+ function getFolderTransferTag() {
+ return MegaTransfer_getFolderTransferTag($this->_cPtr);
+ }
+
+ function getAppData() {
+ return MegaTransfer_getAppData($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaTransfer') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaTransfer();
+ }
+}
+
+class MegaContactRequest {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const STATUS_UNRESOLVED = 0;
+
+ const STATUS_ACCEPTED = MegaContactRequest_STATUS_ACCEPTED;
+
+ const STATUS_DENIED = MegaContactRequest_STATUS_DENIED;
+
+ const STATUS_IGNORED = MegaContactRequest_STATUS_IGNORED;
+
+ const STATUS_DELETED = MegaContactRequest_STATUS_DELETED;
+
+ const STATUS_REMINDED = MegaContactRequest_STATUS_REMINDED;
+
+ const REPLY_ACTION_ACCEPT = 0;
+
+ const REPLY_ACTION_DENY = MegaContactRequest_REPLY_ACTION_DENY;
+
+ const REPLY_ACTION_IGNORE = MegaContactRequest_REPLY_ACTION_IGNORE;
+
+ const INVITE_ACTION_ADD = 0;
+
+ const INVITE_ACTION_DELETE = MegaContactRequest_INVITE_ACTION_DELETE;
+
+ const INVITE_ACTION_REMIND = MegaContactRequest_INVITE_ACTION_REMIND;
+
+ function copy() {
+ $r=MegaContactRequest_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaContactRequest($r);
+ }
+ return $r;
+ }
+
+ function getHandle() {
+ return MegaContactRequest_getHandle($this->_cPtr);
+ }
+
+ function getSourceEmail() {
+ return MegaContactRequest_getSourceEmail($this->_cPtr);
+ }
+
+ function getSourceMessage() {
+ return MegaContactRequest_getSourceMessage($this->_cPtr);
+ }
+
+ function getTargetEmail() {
+ return MegaContactRequest_getTargetEmail($this->_cPtr);
+ }
+
+ function getCreationTime() {
+ return MegaContactRequest_getCreationTime($this->_cPtr);
+ }
+
+ function getModificationTime() {
+ return MegaContactRequest_getModificationTime($this->_cPtr);
+ }
+
+ function getStatus() {
+ return MegaContactRequest_getStatus($this->_cPtr);
+ }
+
+ function isOutgoing() {
+ return MegaContactRequest_isOutgoing($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaContactRequest') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaContactRequest();
+ }
+}
+
+class MegaError {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const API_OK = 0;
+
+ const API_EINTERNAL = -1;
+
+ const API_EARGS = -2;
+
+ const API_EAGAIN = -3;
+
+ const API_ERATELIMIT = -4;
+
+ const API_EFAILED = -5;
+
+ const API_ETOOMANY = -6;
+
+ const API_ERANGE = -7;
+
+ const API_EEXPIRED = -8;
+
+ const API_ENOENT = -9;
+
+ const API_ECIRCULAR = -10;
+
+ const API_EACCESS = -11;
+
+ const API_EEXIST = -12;
+
+ const API_EINCOMPLETE = -13;
+
+ const API_EKEY = -14;
+
+ const API_ESID = -15;
+
+ const API_EBLOCKED = -16;
+
+ const API_EOVERQUOTA = -17;
+
+ const API_ETEMPUNAVAIL = -18;
+
+ const API_ETOOMANYCONNECTIONS = -19;
+
+ const API_EWRITE = -20;
+
+ const API_EREAD = -21;
+
+ const API_EAPPKEY = -22;
+
+ const API_ESSL = -23;
+
+ const PAYMENT_ECARD = -101;
+
+ const PAYMENT_EBILLING = -102;
+
+ const PAYMENT_EFRAUD = -103;
+
+ const PAYMENT_ETOOMANY = -104;
+
+ const PAYMENT_EBALANCE = -105;
+
+ const PAYMENT_EGENERIC = -106;
+
+ function __construct($errorCode_or_megaError=null,$value=null) {
+ if (is_resource($errorCode_or_megaError) && get_resource_type($errorCode_or_megaError) === '_p_mega__MegaError') {
+ $this->_cPtr=$errorCode_or_megaError;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_MegaError(); break;
+ case 1: $this->_cPtr=new_MegaError($errorCode_or_megaError); break;
+ default: $this->_cPtr=new_MegaError($errorCode_or_megaError,$value);
+ }
+ }
+
+ function copy() {
+ $r=MegaError_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaError($r);
+ }
+ return $r;
+ }
+
+ function getErrorCode() {
+ return MegaError_getErrorCode($this->_cPtr);
+ }
+
+ function getValue() {
+ return MegaError_getValue($this->_cPtr);
+ }
+
+ function toString() {
+ return MegaError_toString($this->_cPtr);
+ }
+
+ function __str__() {
+ return MegaError___str__($this->_cPtr);
+ }
+
+ function __toString() {
+ return MegaError___toString($this->_cPtr);
+ }
+
+ static function getErrorString($self_or_errorCode) {
+ return MegaError_getErrorString($self_or_errorCode);
+ }
+}
+
+class MegaTreeProcessor {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function processMegaNode($node) {
+ return MegaTreeProcessor_processMegaNode($this->_cPtr,$node);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaTreeProcessor') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'MegaTreeProcessor') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_MegaTreeProcessor($_this);
+ }
+}
+
+class MegaRequestListener {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function onRequestStart($api,$request) {
+ MegaRequestListener_onRequestStart($this->_cPtr,$api,$request);
+ }
+
+ function onRequestFinish($api,$request,$e) {
+ MegaRequestListener_onRequestFinish($this->_cPtr,$api,$request,$e);
+ }
+
+ function onRequestUpdate($api,$request) {
+ MegaRequestListener_onRequestUpdate($this->_cPtr,$api,$request);
+ }
+
+ function onRequestTemporaryError($api,$request,$error) {
+ MegaRequestListener_onRequestTemporaryError($this->_cPtr,$api,$request,$error);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaRequestListener') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'MegaRequestListener') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_MegaRequestListener($_this);
+ }
+}
+
+class MegaTransferListener {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function onTransferStart($api,$transfer) {
+ MegaTransferListener_onTransferStart($this->_cPtr,$api,$transfer);
+ }
+
+ function onTransferFinish($api,$transfer,$error) {
+ MegaTransferListener_onTransferFinish($this->_cPtr,$api,$transfer,$error);
+ }
+
+ function onTransferUpdate($api,$transfer) {
+ MegaTransferListener_onTransferUpdate($this->_cPtr,$api,$transfer);
+ }
+
+ function onTransferTemporaryError($api,$transfer,$error) {
+ MegaTransferListener_onTransferTemporaryError($this->_cPtr,$api,$transfer,$error);
+ }
+
+ function onTransferData($api,$transfer,$buffer,$size) {
+ return MegaTransferListener_onTransferData($this->_cPtr,$api,$transfer,$buffer,$size);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaTransferListener') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'MegaTransferListener') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_MegaTransferListener($_this);
+ }
+}
+
+class MegaGlobalListener {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function onUsersUpdate($api,$users) {
+ MegaGlobalListener_onUsersUpdate($this->_cPtr,$api,$users);
+ }
+
+ function onNodesUpdate($api,$nodes) {
+ MegaGlobalListener_onNodesUpdate($this->_cPtr,$api,$nodes);
+ }
+
+ function onAccountUpdate($api) {
+ MegaGlobalListener_onAccountUpdate($this->_cPtr,$api);
+ }
+
+ function onContactRequestsUpdate($api,$requests) {
+ MegaGlobalListener_onContactRequestsUpdate($this->_cPtr,$api,$requests);
+ }
+
+ function onReloadNeeded($api) {
+ MegaGlobalListener_onReloadNeeded($this->_cPtr,$api);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaGlobalListener') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'MegaGlobalListener') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_MegaGlobalListener($_this);
+ }
+}
+
+class MegaListener {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function onRequestStart($api,$request) {
+ MegaListener_onRequestStart($this->_cPtr,$api,$request);
+ }
+
+ function onRequestFinish($api,$request,$e) {
+ MegaListener_onRequestFinish($this->_cPtr,$api,$request,$e);
+ }
+
+ function onRequestUpdate($api,$request) {
+ MegaListener_onRequestUpdate($this->_cPtr,$api,$request);
+ }
+
+ function onRequestTemporaryError($api,$request,$error) {
+ MegaListener_onRequestTemporaryError($this->_cPtr,$api,$request,$error);
+ }
+
+ function onTransferStart($api,$transfer) {
+ MegaListener_onTransferStart($this->_cPtr,$api,$transfer);
+ }
+
+ function onTransferFinish($api,$transfer,$error) {
+ MegaListener_onTransferFinish($this->_cPtr,$api,$transfer,$error);
+ }
+
+ function onTransferUpdate($api,$transfer) {
+ MegaListener_onTransferUpdate($this->_cPtr,$api,$transfer);
+ }
+
+ function onTransferTemporaryError($api,$transfer,$error) {
+ MegaListener_onTransferTemporaryError($this->_cPtr,$api,$transfer,$error);
+ }
+
+ function onUsersUpdate($api,$users) {
+ MegaListener_onUsersUpdate($this->_cPtr,$api,$users);
+ }
+
+ function onNodesUpdate($api,$nodes) {
+ MegaListener_onNodesUpdate($this->_cPtr,$api,$nodes);
+ }
+
+ function onAccountUpdate($api) {
+ MegaListener_onAccountUpdate($this->_cPtr,$api);
+ }
+
+ function onContactRequestsUpdate($api,$requests) {
+ MegaListener_onContactRequestsUpdate($this->_cPtr,$api,$requests);
+ }
+
+ function onReloadNeeded($api) {
+ MegaListener_onReloadNeeded($this->_cPtr,$api);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaListener') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'MegaListener') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_MegaListener($_this);
+ }
+}
+
+class MegaInputStream {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function getSize() {
+ return MegaInputStream_getSize($this->_cPtr);
+ }
+
+ function read($buffer,$size) {
+ return MegaInputStream_read($this->_cPtr,$buffer,$size);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaInputStream') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaInputStream();
+ }
+}
+
+class MegaApi {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const STATE_NONE = 0;
+
+ const STATE_SYNCED = MegaApi_STATE_SYNCED;
+
+ const STATE_PENDING = MegaApi_STATE_PENDING;
+
+ const STATE_SYNCING = MegaApi_STATE_SYNCING;
+
+ const STATE_IGNORED = MegaApi_STATE_IGNORED;
+
+ const LOG_LEVEL_FATAL = 0;
+
+ const LOG_LEVEL_ERROR = MegaApi_LOG_LEVEL_ERROR;
+
+ const LOG_LEVEL_WARNING = MegaApi_LOG_LEVEL_WARNING;
+
+ const LOG_LEVEL_INFO = MegaApi_LOG_LEVEL_INFO;
+
+ const LOG_LEVEL_DEBUG = MegaApi_LOG_LEVEL_DEBUG;
+
+ const LOG_LEVEL_MAX = MegaApi_LOG_LEVEL_MAX;
+
+ const ATTR_TYPE_THUMBNAIL = 0;
+
+ const ATTR_TYPE_PREVIEW = 1;
+
+ const USER_ATTR_AVATAR = 0;
+
+ const USER_ATTR_FIRSTNAME = 1;
+
+ const USER_ATTR_LASTNAME = 2;
+
+ const USER_ATTR_AUTHRING = 3;
+
+ const USER_ATTR_LAST_INTERACTION = 4;
+
+ const USER_ATTR_ED25519_PUBLIC_KEY = 5;
+
+ const USER_ATTR_CU25519_PUBLIC_KEY = 6;
+
+ const USER_ATTR_KEYRING = 7;
+
+ const USER_ATTR_SIG_RSA_PUBLIC_KEY = 8;
+
+ const USER_ATTR_SIG_CU255_PUBLIC_KEY = 9;
+
+ const NODE_ATTR_DURATION = 0;
+
+ const NODE_ATTR_COORDINATES = 1;
+
+ const PAYMENT_METHOD_BALANCE = 0;
+
+ const PAYMENT_METHOD_PAYPAL = 1;
+
+ const PAYMENT_METHOD_ITUNES = 2;
+
+ const PAYMENT_METHOD_GOOGLE_WALLET = 3;
+
+ const PAYMENT_METHOD_BITCOIN = 4;
+
+ const PAYMENT_METHOD_UNIONPAY = 5;
+
+ const PAYMENT_METHOD_FORTUMO = 6;
+
+ const PAYMENT_METHOD_CREDIT_CARD = 8;
+
+ const PAYMENT_METHOD_CENTILI = 9;
+
+ const PAYMENT_METHOD_WINDOWS_STORE = 13;
+
+ const TRANSFER_METHOD_NORMAL = 0;
+
+ const TRANSFER_METHOD_ALTERNATIVE_PORT = 1;
+
+ const TRANSFER_METHOD_AUTO = 2;
+
+ const TRANSFER_METHOD_AUTO_NORMAL = 3;
+
+ const TRANSFER_METHOD_AUTO_ALTERNATIVE = 4;
+
+ function __construct($appKey,$basePath_or_processor=null,$userAgent_or_basePath=null,$userAgent=null) {
+ if (is_resource($appKey) && get_resource_type($appKey) === '_p_mega__MegaApi') {
+ $this->_cPtr=$appKey;
+ return;
+ }
+ switch (func_num_args()) {
+ case 1: $this->_cPtr=new_MegaApi($appKey); break;
+ case 2: $this->_cPtr=new_MegaApi($appKey,$basePath_or_processor); break;
+ case 3: $this->_cPtr=new_MegaApi($appKey,$basePath_or_processor,$userAgent_or_basePath); break;
+ default: $this->_cPtr=new_MegaApi($appKey,$basePath_or_processor,$userAgent_or_basePath,$userAgent);
+ }
+ }
+
+ function addListener($listener) {
+ MegaApi_addListener($this->_cPtr,$listener);
+ }
+
+ function addRequestListener($listener) {
+ MegaApi_addRequestListener($this->_cPtr,$listener);
+ }
+
+ function addTransferListener($listener) {
+ MegaApi_addTransferListener($this->_cPtr,$listener);
+ }
+
+ function addGlobalListener($listener) {
+ MegaApi_addGlobalListener($this->_cPtr,$listener);
+ }
+
+ function removeListener($listener) {
+ MegaApi_removeListener($this->_cPtr,$listener);
+ }
+
+ function removeRequestListener($listener) {
+ MegaApi_removeRequestListener($this->_cPtr,$listener);
+ }
+
+ function removeTransferListener($listener) {
+ MegaApi_removeTransferListener($this->_cPtr,$listener);
+ }
+
+ function removeGlobalListener($listener) {
+ MegaApi_removeGlobalListener($this->_cPtr,$listener);
+ }
+
+ function getCurrentRequest() {
+ $r=MegaApi_getCurrentRequest($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaRequest($r);
+ }
+ return $r;
+ }
+
+ function getCurrentTransfer() {
+ $r=MegaApi_getCurrentTransfer($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaTransfer($r);
+ }
+ return $r;
+ }
+
+ function getCurrentError() {
+ $r=MegaApi_getCurrentError($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaError($r);
+ }
+ return $r;
+ }
+
+ function getCurrentNodes() {
+ $r=MegaApi_getCurrentNodes($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNodeList($r);
+ }
+ return $r;
+ }
+
+ function getCurrentUsers() {
+ $r=MegaApi_getCurrentUsers($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaUserList($r);
+ }
+ return $r;
+ }
+
+ function getBase64PwKey($password) {
+ return MegaApi_getBase64PwKey($this->_cPtr,$password);
+ }
+
+ function getStringHash($base64pwkey,$email) {
+ return MegaApi_getStringHash($this->_cPtr,$base64pwkey,$email);
+ }
+
+ function getSessionTransferURL($path,$listener=null) {
+ MegaApi_getSessionTransferURL($this->_cPtr,$path,$listener);
+ }
+
+ static function base32ToHandle($base32Handle) {
+ return MegaApi_base32ToHandle($base32Handle);
+ }
+
+ static function base64ToHandle($base64Handle) {
+ return MegaApi_base64ToHandle($base64Handle);
+ }
+
+ static function handleToBase64($handle) {
+ return MegaApi_handleToBase64($handle);
+ }
+
+ static function userHandleToBase64($handle) {
+ return MegaApi_userHandleToBase64($handle);
+ }
+
+ static function addEntropy($data,$size) {
+ MegaApi_addEntropy($data,$size);
+ }
+
+ function retryPendingConnections($disconnect=false,$includexfers=false,$listener=null) {
+ MegaApi_retryPendingConnections($this->_cPtr,$disconnect,$includexfers,$listener);
+ }
+
+ function login($email,$password,$listener=null) {
+ MegaApi_login($this->_cPtr,$email,$password,$listener);
+ }
+
+ function loginToFolder($megaFolderLink,$listener=null) {
+ MegaApi_loginToFolder($this->_cPtr,$megaFolderLink,$listener);
+ }
+
+ function fastLogin($email_or_session,$stringHash_or_listener=null,$base64pwkey=null,$listener=null) {
+ switch (func_num_args()) {
+ case 1: case 2: MegaApi_fastLogin($this->_cPtr,$email_or_session,$stringHash_or_listener); break;
+ default: MegaApi_fastLogin($this->_cPtr,$email_or_session,$stringHash_or_listener,$base64pwkey,$listener);
+ }
+ }
+
+ function killSession($sessionHandle,$listener=null) {
+ MegaApi_killSession($this->_cPtr,$sessionHandle,$listener);
+ }
+
+ function getUserData($listener_or_user=null,$listener=null) {
+ switch (func_num_args()) {
+ case 0: MegaApi_getUserData($this->_cPtr); break;
+ case 1: MegaApi_getUserData($this->_cPtr,$listener_or_user); break;
+ default: MegaApi_getUserData($this->_cPtr,$listener_or_user,$listener);
+ }
+ }
+
+ function dumpSession() {
+ return MegaApi_dumpSession($this->_cPtr);
+ }
+
+ function dumpXMPPSession() {
+ return MegaApi_dumpXMPPSession($this->_cPtr);
+ }
+
+ function getAccountAuth() {
+ return MegaApi_getAccountAuth($this->_cPtr);
+ }
+
+ function setAccountAuth($auth) {
+ MegaApi_setAccountAuth($this->_cPtr,$auth);
+ }
+
+ function createAccount($email,$password,$name_or_firstname,$listener_or_lastname=null,$listener=null) {
+ switch (func_num_args()) {
+ case 3: MegaApi_createAccount($this->_cPtr,$email,$password,$name_or_firstname); break;
+ case 4: MegaApi_createAccount($this->_cPtr,$email,$password,$name_or_firstname,$listener_or_lastname); break;
+ default: MegaApi_createAccount($this->_cPtr,$email,$password,$name_or_firstname,$listener_or_lastname,$listener);
+ }
+ }
+
+ function fastCreateAccount($email,$base64pwkey,$name,$listener=null) {
+ MegaApi_fastCreateAccount($this->_cPtr,$email,$base64pwkey,$name,$listener);
+ }
+
+ function querySignupLink($link,$listener=null) {
+ MegaApi_querySignupLink($this->_cPtr,$link,$listener);
+ }
+
+ function confirmAccount($link,$password,$listener=null) {
+ MegaApi_confirmAccount($this->_cPtr,$link,$password,$listener);
+ }
+
+ function fastConfirmAccount($link,$base64pwkey,$listener=null) {
+ MegaApi_fastConfirmAccount($this->_cPtr,$link,$base64pwkey,$listener);
+ }
+
+ function resetPassword($email,$hasMasterKey,$listener=null) {
+ MegaApi_resetPassword($this->_cPtr,$email,$hasMasterKey,$listener);
+ }
+
+ function queryResetPasswordLink($link,$listener=null) {
+ MegaApi_queryResetPasswordLink($this->_cPtr,$link,$listener);
+ }
+
+ function confirmResetPassword($link,$newPwd,$masterKey=null,$listener=null) {
+ switch (func_num_args()) {
+ case 2: MegaApi_confirmResetPassword($this->_cPtr,$link,$newPwd); break;
+ default: MegaApi_confirmResetPassword($this->_cPtr,$link,$newPwd,$masterKey,$listener);
+ }
+ }
+
+ function cancelAccount($listener=null) {
+ MegaApi_cancelAccount($this->_cPtr,$listener);
+ }
+
+ function confirmCancelAccount($link,$pwd,$listener=null) {
+ MegaApi_confirmCancelAccount($this->_cPtr,$link,$pwd,$listener);
+ }
+
+ function changeEmail($email,$listener=null) {
+ MegaApi_changeEmail($this->_cPtr,$email,$listener);
+ }
+
+ function queryChangeEmailLink($link,$listener=null) {
+ MegaApi_queryChangeEmailLink($this->_cPtr,$link,$listener);
+ }
+
+ function confirmChangeEmail($link,$pwd,$listener=null) {
+ MegaApi_confirmChangeEmail($this->_cPtr,$link,$pwd,$listener);
+ }
+
+ function setProxySettings($proxySettings) {
+ MegaApi_setProxySettings($this->_cPtr,$proxySettings);
+ }
+
+ function getAutoProxySettings() {
+ $r=MegaApi_getAutoProxySettings($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaProxy($r);
+ }
+ return $r;
+ }
+
+ function isLoggedIn() {
+ return MegaApi_isLoggedIn($this->_cPtr);
+ }
+
+ function getMyEmail() {
+ return MegaApi_getMyEmail($this->_cPtr);
+ }
+
+ function getMyUserHandle() {
+ return MegaApi_getMyUserHandle($this->_cPtr);
+ }
+
+ function getMyUser() {
+ $r=MegaApi_getMyUser($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaUser($r);
+ }
+ return $r;
+ }
+
+ function getMyXMPPJid() {
+ return MegaApi_getMyXMPPJid($this->_cPtr);
+ }
+
+ static function setLogLevel($logLevel) {
+ MegaApi_setLogLevel($logLevel);
+ }
+
+ static function setLoggerObject($megaLogger) {
+ MegaApi_setLoggerObject($megaLogger);
+ }
+
+ static function log($logLevel,$message,$filename="",$line=-1) {
+ MegaApi_log($logLevel,$message,$filename,$line);
+ }
+
+ function createFolder($name,$parent,$listener=null) {
+ MegaApi_createFolder($this->_cPtr,$name,$parent,$listener);
+ }
+
+ function moveNode($node,$newParent,$listener=null) {
+ MegaApi_moveNode($this->_cPtr,$node,$newParent,$listener);
+ }
+
+ function copyNode($node,$newParent,$listener_or_newName=null,$listener=null) {
+ switch (func_num_args()) {
+ case 2: MegaApi_copyNode($this->_cPtr,$node,$newParent); break;
+ case 3: MegaApi_copyNode($this->_cPtr,$node,$newParent,$listener_or_newName); break;
+ default: MegaApi_copyNode($this->_cPtr,$node,$newParent,$listener_or_newName,$listener);
+ }
+ }
+
+ function renameNode($node,$newName,$listener=null) {
+ MegaApi_renameNode($this->_cPtr,$node,$newName,$listener);
+ }
+
+ function remove($node,$listener=null) {
+ MegaApi_remove($this->_cPtr,$node,$listener);
+ }
+
+ function cleanRubbishBin($listener=null) {
+ MegaApi_cleanRubbishBin($this->_cPtr,$listener);
+ }
+
+ function sendFileToUser($node,$user_or_email,$listener=null) {
+ MegaApi_sendFileToUser($this->_cPtr,$node,$user_or_email,$listener);
+ }
+
+ function share($node,$user_or_email,$level,$listener=null) {
+ MegaApi_share($this->_cPtr,$node,$user_or_email,$level,$listener);
+ }
+
+ function importFileLink($megaFileLink,$parent,$listener=null) {
+ MegaApi_importFileLink($this->_cPtr,$megaFileLink,$parent,$listener);
+ }
+
+ function getPublicNode($megaFileLink,$listener=null) {
+ MegaApi_getPublicNode($this->_cPtr,$megaFileLink,$listener);
+ }
+
+ function getThumbnail($node,$dstFilePath,$listener=null) {
+ MegaApi_getThumbnail($this->_cPtr,$node,$dstFilePath,$listener);
+ }
+
+ function getPreview($node,$dstFilePath,$listener=null) {
+ MegaApi_getPreview($this->_cPtr,$node,$dstFilePath,$listener);
+ }
+
+ function getUserAvatar($user_or_email_or_handle_or_dstFilePath,$dstFilePath_or_listener=null,$listener=null) {
+ MegaApi_getUserAvatar($this->_cPtr,$user_or_email_or_handle_or_dstFilePath,$dstFilePath_or_listener,$listener);
+ }
+
+ function getUserAvatarColor($user_or_userhandle) {
+ return MegaApi_getUserAvatarColor($this->_cPtr,$user_or_userhandle);
+ }
+
+ function getUserAttribute($user_or_email_or_handle_or_type,$type_or_listener=null,$listener=null) {
+ MegaApi_getUserAttribute($this->_cPtr,$user_or_email_or_handle_or_type,$type_or_listener,$listener);
+ }
+
+ function cancelGetThumbnail($node,$listener=null) {
+ MegaApi_cancelGetThumbnail($this->_cPtr,$node,$listener);
+ }
+
+ function cancelGetPreview($node,$listener=null) {
+ MegaApi_cancelGetPreview($this->_cPtr,$node,$listener);
+ }
+
+ function setThumbnail($node,$srcFilePath,$listener=null) {
+ MegaApi_setThumbnail($this->_cPtr,$node,$srcFilePath,$listener);
+ }
+
+ function setPreview($node,$srcFilePath,$listener=null) {
+ MegaApi_setPreview($this->_cPtr,$node,$srcFilePath,$listener);
+ }
+
+ function setAvatar($srcFilePath,$listener=null) {
+ MegaApi_setAvatar($this->_cPtr,$srcFilePath,$listener);
+ }
+
+ function setUserAttribute($type,$value,$listener=null) {
+ MegaApi_setUserAttribute($this->_cPtr,$type,$value,$listener);
+ }
+
+ function setCustomNodeAttribute($node,$attrName,$value,$listener=null) {
+ MegaApi_setCustomNodeAttribute($this->_cPtr,$node,$attrName,$value,$listener);
+ }
+
+ function setNodeDuration($node,$duration,$listener=null) {
+ MegaApi_setNodeDuration($this->_cPtr,$node,$duration,$listener);
+ }
+
+ function setNodeCoordinates($node,$latitude,$longitude,$listener=null) {
+ MegaApi_setNodeCoordinates($this->_cPtr,$node,$latitude,$longitude,$listener);
+ }
+
+ function exportNode($node,$listener_or_expireTime=null,$listener=null) {
+ switch (func_num_args()) {
+ case 1: MegaApi_exportNode($this->_cPtr,$node); break;
+ case 2: MegaApi_exportNode($this->_cPtr,$node,$listener_or_expireTime); break;
+ default: MegaApi_exportNode($this->_cPtr,$node,$listener_or_expireTime,$listener);
+ }
+ }
+
+ function disableExport($node,$listener=null) {
+ MegaApi_disableExport($this->_cPtr,$node,$listener);
+ }
+
+ function fetchNodes($listener=null) {
+ MegaApi_fetchNodes($this->_cPtr,$listener);
+ }
+
+ function getAccountDetails($listener=null) {
+ MegaApi_getAccountDetails($this->_cPtr,$listener);
+ }
+
+ function getExtendedAccountDetails($sessions=false,$purchases=false,$transactions=false,$listener=null) {
+ MegaApi_getExtendedAccountDetails($this->_cPtr,$sessions,$purchases,$transactions,$listener);
+ }
+
+ function getPricing($listener=null) {
+ MegaApi_getPricing($this->_cPtr,$listener);
+ }
+
+ function getPaymentId($productHandle,$listener=null) {
+ MegaApi_getPaymentId($this->_cPtr,$productHandle,$listener);
+ }
+
+ function upgradeAccount($productHandle,$paymentMethod,$listener=null) {
+ MegaApi_upgradeAccount($this->_cPtr,$productHandle,$paymentMethod,$listener);
+ }
+
+ function submitPurchaseReceipt($receipt_or_gateway,$listener_or_receipt=null,$listener=null) {
+ switch (func_num_args()) {
+ case 1: MegaApi_submitPurchaseReceipt($this->_cPtr,$receipt_or_gateway); break;
+ case 2: MegaApi_submitPurchaseReceipt($this->_cPtr,$receipt_or_gateway,$listener_or_receipt); break;
+ default: MegaApi_submitPurchaseReceipt($this->_cPtr,$receipt_or_gateway,$listener_or_receipt,$listener);
+ }
+ }
+
+ function creditCardStore($address1,$address2,$city,$province,$country,$postalcode,$firstname,$lastname,$creditcard,$expire_month,$expire_year,$cv2,$listener=null) {
+ MegaApi_creditCardStore($this->_cPtr,$address1,$address2,$city,$province,$country,$postalcode,$firstname,$lastname,$creditcard,$expire_month,$expire_year,$cv2,$listener);
+ }
+
+ function creditCardQuerySubscriptions($listener=null) {
+ MegaApi_creditCardQuerySubscriptions($this->_cPtr,$listener);
+ }
+
+ function creditCardCancelSubscriptions($reason,$listener=null) {
+ MegaApi_creditCardCancelSubscriptions($this->_cPtr,$reason,$listener);
+ }
+
+ function getPaymentMethods($listener=null) {
+ MegaApi_getPaymentMethods($this->_cPtr,$listener);
+ }
+
+ function exportMasterKey() {
+ return MegaApi_exportMasterKey($this->_cPtr);
+ }
+
+ function changePassword($oldPassword,$newPassword,$listener=null) {
+ MegaApi_changePassword($this->_cPtr,$oldPassword,$newPassword,$listener);
+ }
+
+ function inviteContact($email,$message,$action,$listener=null) {
+ MegaApi_inviteContact($this->_cPtr,$email,$message,$action,$listener);
+ }
+
+ function replyContactRequest($request,$action,$listener=null) {
+ MegaApi_replyContactRequest($this->_cPtr,$request,$action,$listener);
+ }
+
+ function removeContact($user,$listener=null) {
+ MegaApi_removeContact($this->_cPtr,$user,$listener);
+ }
+
+ function logout($listener=null) {
+ MegaApi_logout($this->_cPtr,$listener);
+ }
+
+ function localLogout($listener=null) {
+ MegaApi_localLogout($this->_cPtr,$listener);
+ }
+
+ function submitFeedback($rating,$comment,$listener=null) {
+ MegaApi_submitFeedback($this->_cPtr,$rating,$comment,$listener);
+ }
+
+ function sendEvent($eventType,$message,$listener=null) {
+ MegaApi_sendEvent($this->_cPtr,$eventType,$message,$listener);
+ }
+
+ function reportDebugEvent($text,$listener=null) {
+ MegaApi_reportDebugEvent($this->_cPtr,$text,$listener);
+ }
+
+ function useHttpsOnly($httpsOnly) {
+ MegaApi_useHttpsOnly($this->_cPtr,$httpsOnly);
+ }
+
+ function usingHttpsOnly() {
+ return MegaApi_usingHttpsOnly($this->_cPtr);
+ }
+
+ function startUploadWithData($localPath,$parent,$appData,$listener_or_isSourceTemporary=null,$listener=null) {
+ switch (func_num_args()) {
+ case 3: MegaApi_startUploadWithData($this->_cPtr,$localPath,$parent,$appData); break;
+ case 4: MegaApi_startUploadWithData($this->_cPtr,$localPath,$parent,$appData,$listener_or_isSourceTemporary); break;
+ default: MegaApi_startUploadWithData($this->_cPtr,$localPath,$parent,$appData,$listener_or_isSourceTemporary,$listener);
+ }
+ }
+
+ function startUpload($localPath,$parent,$listener_or_mtime=null,$isSourceTemporary=null,$listener=null) {
+ switch (func_num_args()) {
+ case 2: MegaApi_startUpload($this->_cPtr,$localPath,$parent); break;
+ case 3: MegaApi_startUpload($this->_cPtr,$localPath,$parent,$listener_or_mtime); break;
+ case 4: MegaApi_startUpload($this->_cPtr,$localPath,$parent,$listener_or_mtime,$isSourceTemporary); break;
+ default: MegaApi_startUpload($this->_cPtr,$localPath,$parent,$listener_or_mtime,$isSourceTemporary,$listener);
+ }
+ }
+
+ function startDownload($node,$localPath,$listener=null) {
+ MegaApi_startDownload($this->_cPtr,$node,$localPath,$listener);
+ }
+
+ function startDownloadWithData($node,$localPath,$appData,$listener=null) {
+ MegaApi_startDownloadWithData($this->_cPtr,$node,$localPath,$appData,$listener);
+ }
+
+ function startStreaming($node,$startPos,$size,$listener) {
+ MegaApi_startStreaming($this->_cPtr,$node,$startPos,$size,$listener);
+ }
+
+ function cancelTransfer($transfer,$listener=null) {
+ MegaApi_cancelTransfer($this->_cPtr,$transfer,$listener);
+ }
+
+ function cancelTransferByTag($transferTag,$listener=null) {
+ MegaApi_cancelTransferByTag($this->_cPtr,$transferTag,$listener);
+ }
+
+ function cancelTransfers($type,$listener=null) {
+ MegaApi_cancelTransfers($this->_cPtr,$type,$listener);
+ }
+
+ function pauseTransfers($pause,$listener_or_direction=null,$listener=null) {
+ switch (func_num_args()) {
+ case 1: MegaApi_pauseTransfers($this->_cPtr,$pause); break;
+ case 2: MegaApi_pauseTransfers($this->_cPtr,$pause,$listener_or_direction); break;
+ default: MegaApi_pauseTransfers($this->_cPtr,$pause,$listener_or_direction,$listener);
+ }
+ }
+
+ function enableTransferResumption($loggedOutId=null) {
+ switch (func_num_args()) {
+ case 0: MegaApi_enableTransferResumption($this->_cPtr); break;
+ default: MegaApi_enableTransferResumption($this->_cPtr,$loggedOutId);
+ }
+ }
+
+ function disableTransferResumption($loggedOutId=null) {
+ switch (func_num_args()) {
+ case 0: MegaApi_disableTransferResumption($this->_cPtr); break;
+ default: MegaApi_disableTransferResumption($this->_cPtr,$loggedOutId);
+ }
+ }
+
+ function areTransfersPaused($direction) {
+ return MegaApi_areTransfersPaused($this->_cPtr,$direction);
+ }
+
+ function setUploadLimit($bpslimit) {
+ MegaApi_setUploadLimit($this->_cPtr,$bpslimit);
+ }
+
+ function setDownloadMethod($method) {
+ MegaApi_setDownloadMethod($this->_cPtr,$method);
+ }
+
+ function setUploadMethod($method) {
+ MegaApi_setUploadMethod($this->_cPtr,$method);
+ }
+
+ function getDownloadMethod() {
+ return MegaApi_getDownloadMethod($this->_cPtr);
+ }
+
+ function getUploadMethod() {
+ return MegaApi_getUploadMethod($this->_cPtr);
+ }
+
+ function getTransfersAll() {
+ $r=MegaApi_getTransfersAll($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaTransferList($r);
+ }
+ return $r;
+ }
+
+ function getStreamingTransfers() {
+ $r=MegaApi_getStreamingTransfers($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaTransferList($r);
+ }
+ return $r;
+ }
+
+ function getTransferByTag($transferTag) {
+ $r=MegaApi_getTransferByTag($this->_cPtr,$transferTag);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaTransfer($r);
+ }
+ return $r;
+ }
+
+ function getTransfers($type) {
+ $r=MegaApi_getTransfers($this->_cPtr,$type);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaTransferList($r);
+ }
+ return $r;
+ }
+
+ function getChildTransfers($transferTag) {
+ $r=MegaApi_getChildTransfers($this->_cPtr,$transferTag);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaTransferList($r);
+ }
+ return $r;
+ }
+
+ function update() {
+ MegaApi_update($this->_cPtr);
+ }
+
+ function isWaiting() {
+ return MegaApi_isWaiting($this->_cPtr);
+ }
+
+ function getNumPendingUploads() {
+ return MegaApi_getNumPendingUploads($this->_cPtr);
+ }
+
+ function getNumPendingDownloads() {
+ return MegaApi_getNumPendingDownloads($this->_cPtr);
+ }
+
+ function getTotalUploads() {
+ return MegaApi_getTotalUploads($this->_cPtr);
+ }
+
+ function getTotalDownloads() {
+ return MegaApi_getTotalDownloads($this->_cPtr);
+ }
+
+ function resetTotalDownloads() {
+ MegaApi_resetTotalDownloads($this->_cPtr);
+ }
+
+ function resetTotalUploads() {
+ MegaApi_resetTotalUploads($this->_cPtr);
+ }
+
+ function getTotalDownloadedBytes() {
+ return MegaApi_getTotalDownloadedBytes($this->_cPtr);
+ }
+
+ function getTotalUploadedBytes() {
+ return MegaApi_getTotalUploadedBytes($this->_cPtr);
+ }
+
+ function updateStats() {
+ MegaApi_updateStats($this->_cPtr);
+ }
+
+ function getNumNodes() {
+ return MegaApi_getNumNodes($this->_cPtr);
+ }
+
+ const ORDER_NONE = 0;
+
+ const ORDER_DEFAULT_ASC = MegaApi_ORDER_DEFAULT_ASC;
+
+ const ORDER_DEFAULT_DESC = MegaApi_ORDER_DEFAULT_DESC;
+
+ const ORDER_SIZE_ASC = MegaApi_ORDER_SIZE_ASC;
+
+ const ORDER_SIZE_DESC = MegaApi_ORDER_SIZE_DESC;
+
+ const ORDER_CREATION_ASC = MegaApi_ORDER_CREATION_ASC;
+
+ const ORDER_CREATION_DESC = MegaApi_ORDER_CREATION_DESC;
+
+ const ORDER_MODIFICATION_ASC = MegaApi_ORDER_MODIFICATION_ASC;
+
+ const ORDER_MODIFICATION_DESC = MegaApi_ORDER_MODIFICATION_DESC;
+
+ const ORDER_ALPHABETICAL_ASC = MegaApi_ORDER_ALPHABETICAL_ASC;
+
+ const ORDER_ALPHABETICAL_DESC = MegaApi_ORDER_ALPHABETICAL_DESC;
+
+ function getNumChildren($parent) {
+ return MegaApi_getNumChildren($this->_cPtr,$parent);
+ }
+
+ function getNumChildFiles($parent) {
+ return MegaApi_getNumChildFiles($this->_cPtr,$parent);
+ }
+
+ function getNumChildFolders($parent) {
+ return MegaApi_getNumChildFolders($this->_cPtr,$parent);
+ }
+
+ function getChildren($parent,$order=1) {
+ $r=MegaApi_getChildren($this->_cPtr,$parent,$order);
+ if (!is_resource($r)) return $r;
+ return new MegaNodeList($r);
+ }
+
+ function getIndex($node,$order=1) {
+ return MegaApi_getIndex($this->_cPtr,$node,$order);
+ }
+
+ function getChildNode($parent,$name) {
+ $r=MegaApi_getChildNode($this->_cPtr,$parent,$name);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function getParentNode($node) {
+ $r=MegaApi_getParentNode($this->_cPtr,$node);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function getNodePath($node) {
+ return MegaApi_getNodePath($this->_cPtr,$node);
+ }
+
+ function getNodeByPath($path,$n=null) {
+ $r=MegaApi_getNodeByPath($this->_cPtr,$path,$n);
+ if (!is_resource($r)) return $r;
+ return new MegaNode($r);
+ }
+
+ function getNodeByHandle($h) {
+ $r=MegaApi_getNodeByHandle($this->_cPtr,$h);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function getContactRequestByHandle($handle) {
+ $r=MegaApi_getContactRequestByHandle($this->_cPtr,$handle);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaContactRequest($r);
+ }
+ return $r;
+ }
+
+ function getContacts() {
+ $r=MegaApi_getContacts($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaUserList($r);
+ }
+ return $r;
+ }
+
+ function getContact($email) {
+ $r=MegaApi_getContact($this->_cPtr,$email);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaUser($r);
+ }
+ return $r;
+ }
+
+ function getInShares($user) {
+ $r=MegaApi_getInShares($this->_cPtr,$user);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNodeList($r);
+ }
+ return $r;
+ }
+
+ function getInSharesAll() {
+ $r=MegaApi_getInSharesAll($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNodeList($r);
+ }
+ return $r;
+ }
+
+ function getInSharesList() {
+ $r=MegaApi_getInSharesList($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaShareList($r);
+ }
+ return $r;
+ }
+
+ function isShared($node) {
+ return MegaApi_isShared($this->_cPtr,$node);
+ }
+
+ function isOutShare($node) {
+ return MegaApi_isOutShare($this->_cPtr,$node);
+ }
+
+ function isInShare($node) {
+ return MegaApi_isInShare($this->_cPtr,$node);
+ }
+
+ function isPendingShare($node) {
+ return MegaApi_isPendingShare($this->_cPtr,$node);
+ }
+
+ function getOutSharesAll() {
+ $r=MegaApi_getOutSharesAll($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaShareList($r);
+ }
+ return $r;
+ }
+
+ function getOutShares($node) {
+ $r=MegaApi_getOutShares($this->_cPtr,$node);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaShareList($r);
+ }
+ return $r;
+ }
+
+ function getPendingOutShares($node=null) {
+ if (!is_resource($r)) return $r;
+ return new MegaShareList($r);
+ }
+
+ function getPublicLinks() {
+ $r=MegaApi_getPublicLinks($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNodeList($r);
+ }
+ return $r;
+ }
+
+ function getIncomingContactRequests() {
+ $r=MegaApi_getIncomingContactRequests($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaContactRequestList($r);
+ }
+ return $r;
+ }
+
+ function getOutgoingContactRequests() {
+ $r=MegaApi_getOutgoingContactRequests($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaContactRequestList($r);
+ }
+ return $r;
+ }
+
+ function getAccess($node) {
+ return MegaApi_getAccess($this->_cPtr,$node);
+ }
+
+ function getSize($node) {
+ return MegaApi_getSize($this->_cPtr,$node);
+ }
+
+ function getFingerprint($filePath_or_node_or_inputStream,$mtime=null) {
+ return $r;
+ }
+
+ function getNodeByFingerprint($fingerprint,$parent=null) {
+ if (!is_resource($r)) return $r;
+ return new MegaNode($r);
+ }
+
+ function getNodesByFingerprint($fingerprint) {
+ $r=MegaApi_getNodesByFingerprint($this->_cPtr,$fingerprint);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNodeList($r);
+ }
+ return $r;
+ }
+
+ function getExportableNodeByFingerprint($fingerprint,$name=null) {
+ if (!is_resource($r)) return $r;
+ return new MegaNode($r);
+ }
+
+ function hasFingerprint($fingerprint) {
+ return MegaApi_hasFingerprint($this->_cPtr,$fingerprint);
+ }
+
+ function getCRCFromFingerprint($fingerprint) {
+ return MegaApi_getCRCFromFingerprint($this->_cPtr,$fingerprint);
+ }
+
+ function getCRC($filePath_or_node) {
+ return MegaApi_getCRC($this->_cPtr,$filePath_or_node);
+ }
+
+ function getNodeByCRC($crc,$parent) {
+ $r=MegaApi_getNodeByCRC($this->_cPtr,$crc,$parent);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function checkAccess($node,$level) {
+ $r=MegaApi_checkAccess($this->_cPtr,$node,$level);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaError($r);
+ }
+ return $r;
+ }
+
+ function checkMove($node,$target) {
+ $r=MegaApi_checkMove($this->_cPtr,$node,$target);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaError($r);
+ }
+ return $r;
+ }
+
+ function isFilesystemAvailable() {
+ return MegaApi_isFilesystemAvailable($this->_cPtr);
+ }
+
+ function getRootNode() {
+ $r=MegaApi_getRootNode($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function getInboxNode() {
+ $r=MegaApi_getInboxNode($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function getRubbishNode() {
+ $r=MegaApi_getRubbishNode($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function setDefaultFilePermissions($permissions) {
+ MegaApi_setDefaultFilePermissions($this->_cPtr,$permissions);
+ }
+
+ function getDefaultFilePermissions() {
+ return MegaApi_getDefaultFilePermissions($this->_cPtr);
+ }
+
+ function setDefaultFolderPermissions($permissions) {
+ MegaApi_setDefaultFolderPermissions($this->_cPtr,$permissions);
+ }
+
+ function getDefaultFolderPermissions() {
+ return MegaApi_getDefaultFolderPermissions($this->_cPtr);
+ }
+
+ function getBandwidthOverquotaDelay() {
+ return MegaApi_getBandwidthOverquotaDelay($this->_cPtr);
+ }
+
+ function search($node_or_searchString,$searchString=null,$recursive=true) {
+ if (!is_resource($r)) return $r;
+ return new MegaNodeList($r);
+ }
+
+ function processMegaTree($node,$processor,$recursive=true) {
+ return MegaApi_processMegaTree($this->_cPtr,$node,$processor,$recursive);
+ }
+
+ function authorizeNode($node) {
+ $r=MegaApi_authorizeNode($this->_cPtr,$node);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaNode($r);
+ }
+ return $r;
+ }
+
+ function getVersion() {
+ return MegaApi_getVersion($this->_cPtr);
+ }
+
+ function getUserAgent() {
+ return MegaApi_getUserAgent($this->_cPtr);
+ }
+
+ function changeApiUrl($apiURL,$disablepkp=false) {
+ MegaApi_changeApiUrl($this->_cPtr,$apiURL,$disablepkp);
+ }
+
+ function retrySSLerrors($enable) {
+ MegaApi_retrySSLerrors($this->_cPtr,$enable);
+ }
+
+ function setPublicKeyPinning($enable) {
+ MegaApi_setPublicKeyPinning($this->_cPtr,$enable);
+ }
+
+ function escapeFsIncompatible($filename) {
+ return MegaApi_escapeFsIncompatible($this->_cPtr,$filename);
+ }
+
+ function unescapeFsIncompatible($name) {
+ return MegaApi_unescapeFsIncompatible($this->_cPtr,$name);
+ }
+
+ function createThumbnail($imagePath,$dstPath) {
+ return MegaApi_createThumbnail($this->_cPtr,$imagePath,$dstPath);
+ }
+
+ function createPreview($imagePath,$dstPath) {
+ return MegaApi_createPreview($this->_cPtr,$imagePath,$dstPath);
+ }
+
+ static function base64ToBase32($base64) {
+ return MegaApi_base64ToBase32($base64);
+ }
+
+ static function base32ToBase64($base32) {
+ return MegaApi_base32ToBase64($base32);
+ }
+
+ static function strdup($buffer) {
+ return MegaApi_strdup($buffer);
+ }
+
+ static function removeRecursively($path) {
+ MegaApi_removeRecursively($path);
+ }
+
+ function isOnline() {
+ return MegaApi_isOnline($this->_cPtr);
+ }
+}
+
+class MegaAccountBalance {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function getAmount() {
+ return MegaAccountBalance_getAmount($this->_cPtr);
+ }
+
+ function getCurrency() {
+ return MegaAccountBalance_getCurrency($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaAccountBalance') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaAccountBalance();
+ }
+}
+
+class MegaAccountSession {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function getCreationTimestamp() {
+ return MegaAccountSession_getCreationTimestamp($this->_cPtr);
+ }
+
+ function getMostRecentUsage() {
+ return MegaAccountSession_getMostRecentUsage($this->_cPtr);
+ }
+
+ function getUserAgent() {
+ return MegaAccountSession_getUserAgent($this->_cPtr);
+ }
+
+ function getIP() {
+ return MegaAccountSession_getIP($this->_cPtr);
+ }
+
+ function getCountry() {
+ return MegaAccountSession_getCountry($this->_cPtr);
+ }
+
+ function isCurrent() {
+ return MegaAccountSession_isCurrent($this->_cPtr);
+ }
+
+ function isAlive() {
+ return MegaAccountSession_isAlive($this->_cPtr);
+ }
+
+ function getHandle() {
+ return MegaAccountSession_getHandle($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaAccountSession') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaAccountSession();
+ }
+}
+
+class MegaAccountPurchase {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function getTimestamp() {
+ return MegaAccountPurchase_getTimestamp($this->_cPtr);
+ }
+
+ function getHandle() {
+ return MegaAccountPurchase_getHandle($this->_cPtr);
+ }
+
+ function getCurrency() {
+ return MegaAccountPurchase_getCurrency($this->_cPtr);
+ }
+
+ function getAmount() {
+ return MegaAccountPurchase_getAmount($this->_cPtr);
+ }
+
+ function getMethod() {
+ return MegaAccountPurchase_getMethod($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaAccountPurchase') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaAccountPurchase();
+ }
+}
+
+class MegaAccountTransaction {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function getTimestamp() {
+ return MegaAccountTransaction_getTimestamp($this->_cPtr);
+ }
+
+ function getHandle() {
+ return MegaAccountTransaction_getHandle($this->_cPtr);
+ }
+
+ function getCurrency() {
+ return MegaAccountTransaction_getCurrency($this->_cPtr);
+ }
+
+ function getAmount() {
+ return MegaAccountTransaction_getAmount($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaAccountTransaction') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaAccountTransaction();
+ }
+}
+
+class MegaAccountDetails {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const ACCOUNT_TYPE_FREE = 0;
+
+ const ACCOUNT_TYPE_PROI = 1;
+
+ const ACCOUNT_TYPE_PROII = 2;
+
+ const ACCOUNT_TYPE_PROIII = 3;
+
+ const ACCOUNT_TYPE_LITE = 4;
+
+ const SUBSCRIPTION_STATUS_NONE = 0;
+
+ const SUBSCRIPTION_STATUS_VALID = 1;
+
+ const SUBSCRIPTION_STATUS_INVALID = 2;
+
+ function getProLevel() {
+ return MegaAccountDetails_getProLevel($this->_cPtr);
+ }
+
+ function getProExpiration() {
+ return MegaAccountDetails_getProExpiration($this->_cPtr);
+ }
+
+ function getSubscriptionStatus() {
+ return MegaAccountDetails_getSubscriptionStatus($this->_cPtr);
+ }
+
+ function getSubscriptionRenewTime() {
+ return MegaAccountDetails_getSubscriptionRenewTime($this->_cPtr);
+ }
+
+ function getSubscriptionMethod() {
+ return MegaAccountDetails_getSubscriptionMethod($this->_cPtr);
+ }
+
+ function getSubscriptionCycle() {
+ return MegaAccountDetails_getSubscriptionCycle($this->_cPtr);
+ }
+
+ function getStorageMax() {
+ return MegaAccountDetails_getStorageMax($this->_cPtr);
+ }
+
+ function getTransferMax() {
+ return MegaAccountDetails_getTransferMax($this->_cPtr);
+ }
+
+ function getTransferOwnUsed() {
+ return MegaAccountDetails_getTransferOwnUsed($this->_cPtr);
+ }
+
+ function getNumUsageItems() {
+ return MegaAccountDetails_getNumUsageItems($this->_cPtr);
+ }
+
+ function getStorageUsed($handle=null) {
+ switch (func_num_args()) {
+ case 0: $r=MegaAccountDetails_getStorageUsed($this->_cPtr); break;
+ default: $r=MegaAccountDetails_getStorageUsed($this->_cPtr,$handle);
+ }
+ return $r;
+ }
+
+ function getNumFiles($handle) {
+ return MegaAccountDetails_getNumFiles($this->_cPtr,$handle);
+ }
+
+ function getNumFolders($handle) {
+ return MegaAccountDetails_getNumFolders($this->_cPtr,$handle);
+ }
+
+ function copy() {
+ $r=MegaAccountDetails_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaAccountDetails($r);
+ }
+ return $r;
+ }
+
+ function getNumBalances() {
+ return MegaAccountDetails_getNumBalances($this->_cPtr);
+ }
+
+ function getBalance($i) {
+ $r=MegaAccountDetails_getBalance($this->_cPtr,$i);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaAccountBalance($r);
+ }
+ return $r;
+ }
+
+ function getNumSessions() {
+ return MegaAccountDetails_getNumSessions($this->_cPtr);
+ }
+
+ function getSession($i) {
+ $r=MegaAccountDetails_getSession($this->_cPtr,$i);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaAccountSession($r);
+ }
+ return $r;
+ }
+
+ function getNumPurchases() {
+ return MegaAccountDetails_getNumPurchases($this->_cPtr);
+ }
+
+ function getPurchase($i) {
+ $r=MegaAccountDetails_getPurchase($this->_cPtr,$i);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaAccountPurchase($r);
+ }
+ return $r;
+ }
+
+ function getNumTransactions() {
+ return MegaAccountDetails_getNumTransactions($this->_cPtr);
+ }
+
+ function getTransaction($i) {
+ $r=MegaAccountDetails_getTransaction($this->_cPtr,$i);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaAccountTransaction($r);
+ }
+ return $r;
+ }
+
+ function getTemporalBandwidthInterval() {
+ return MegaAccountDetails_getTemporalBandwidthInterval($this->_cPtr);
+ }
+
+ function getTemporalBandwidth() {
+ return MegaAccountDetails_getTemporalBandwidth($this->_cPtr);
+ }
+
+ function isTemporalBandwidthValid() {
+ return MegaAccountDetails_isTemporalBandwidthValid($this->_cPtr);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaAccountDetails') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaAccountDetails();
+ }
+}
+
+class MegaPricing {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function getNumProducts() {
+ return MegaPricing_getNumProducts($this->_cPtr);
+ }
+
+ function getHandle($productIndex) {
+ return MegaPricing_getHandle($this->_cPtr,$productIndex);
+ }
+
+ function getProLevel($productIndex) {
+ return MegaPricing_getProLevel($this->_cPtr,$productIndex);
+ }
+
+ function getGBStorage($productIndex) {
+ return MegaPricing_getGBStorage($this->_cPtr,$productIndex);
+ }
+
+ function getGBTransfer($productIndex) {
+ return MegaPricing_getGBTransfer($this->_cPtr,$productIndex);
+ }
+
+ function getMonths($productIndex) {
+ return MegaPricing_getMonths($this->_cPtr,$productIndex);
+ }
+
+ function getAmount($productIndex) {
+ return MegaPricing_getAmount($this->_cPtr,$productIndex);
+ }
+
+ function getCurrency($productIndex) {
+ return MegaPricing_getCurrency($this->_cPtr,$productIndex);
+ }
+
+ function getDescription($productIndex) {
+ return MegaPricing_getDescription($this->_cPtr,$productIndex);
+ }
+
+ function getIosID($productIndex) {
+ return MegaPricing_getIosID($this->_cPtr,$productIndex);
+ }
+
+ function getAndroidID($productIndex) {
+ return MegaPricing_getAndroidID($this->_cPtr,$productIndex);
+ }
+
+ function copy() {
+ $r=MegaPricing_copy($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new MegaPricing($r);
+ }
+ return $r;
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaPricing') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_MegaPricing();
+ }
+}
+
+
+?>
diff --git a/megaProcess/megaapi.php b/megaProcess/megaapi.php
new file mode 100644
index 0000000..ea8e7f7
--- /dev/null
+++ b/megaProcess/megaapi.php
@@ -0,0 +1,1115 @@
+megaApi = $megaApi;
+ $this->listener = $listener;
+ }
+
+ public function getUserListener()
+ {
+ return $this->listener;
+ }
+
+ public function onRequestStart($api, $request)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaRequest = $megaApi->getCurrentRequest()->copy();
+ $this->listener->onRequestStart($megaApi, $megaRequest);
+ }
+ }
+
+ public function onRequestFinish($api, $request, $error)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaRequest = $megaApi->getCurrentRequest()->copy();
+ $megaError = $megaApi->getCurrentError()->copy();
+
+ $this->listener->onRequestFinish($megaApi, $megaRequest, $megaError);
+ }
+ }
+
+ public function onRequestTemporaryError($api, $request, $error)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaRequest = $megaApi->getCurrentRequest()->copy();
+ $megaError = $megaApi->getCurrentError()->copy();
+
+ $this->listener->onRequestTemporaryError($megaApi, $megaRequest, $megaError);
+ }
+ }
+
+ public function onTransferStart($api, $transfer)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaTransfer = $megaApi->getCurrentTransfer()->copy();
+
+ $this->listener->onTransferStart($megaApi, $megaTransfer);
+ }
+ }
+
+ public function onTransferFinish($api, $transfer, $error)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaTransfer = $megaApi->getCurrentTransfer()->copy();
+ $megaError = $megaApi->getCurrentError()->copy();
+
+ $this->listener->onTransferFinish($megaApi, $megaTransfer, $megaError);
+ }
+ }
+
+ public function onTransferUpdate($api, $transfer)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaTransfer = $megaApi->getCurrentTransfer()->copy();
+
+ $this->listener->onTransferUpdate($megaApi, $megaTransfer);
+ }
+ }
+
+ public function onTransferTemporaryError($api, $request, $error)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaTransfer = $megaApi->getCurrentTransfer()->copy();
+ $megaError = $megaApi->getCurrentError()->copy();
+
+ $this->listener->onTransferTemporaryError($megaApi, $megaTransfer, $megaError);
+ }
+ }
+
+ public function onUsersUpdate($api, $users)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ if($megaApi->getCurrentUsers() != null)
+ {
+ $megaUsers = $megaApi->getCurrentUsers();
+ }
+ else
+ {
+ $megaUsers = null;
+ }
+
+ $this->listener->onUsersUpdate($megaApi, $megaUsers);
+ }
+ }
+
+ public function onNodesUpdate($api, $nodes)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ if($megaApi->getCurrentNodes() != null)
+ {
+ $megaNodes = $megaApi->getCurrentNodes();
+ }
+ else
+ {
+ $megaNodes = null;
+ }
+
+ $this->listener->onNodesUpdate ($megaApi, $megaNodes);
+ }
+ }
+
+ public function onReloadNeeded($api)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $this->listener->onReloadNeeded ($megaApi);
+ }
+ }
+}
+
+class MegaRequestListenerPHP extends MegaRequestListener
+{
+ var $megaApi;
+ var $listener;
+ var $sigleListener;
+
+ public function MegaRequestListenerPHP($megaApi, $listener, $single)
+ {
+ parent::__construct();
+
+ $this->megaApi = $megaApi;
+ $this->listener = $listener;
+ $this->sigleListener = $single;
+ }
+
+ public function getUserListener()
+ {
+ return $this->listener;
+ }
+
+ public function onRequestStart($api, $request)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaRequest = $megaApi->getCurrentRequest()->copy();
+
+ $this->listener->onRequestStart($megaApi, $megaRequest);
+ }
+ }
+
+ public function onRequestFinish($api, $request, $error)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaRequest = $megaApi->getCurrentRequest()->copy();
+ $megaError = $megaApi->getCurrentError()->copy();
+
+ $this->listener->onRequestFinish($megaApi, $megaRequest, $megaError);
+
+ if($this->singleListener == 1)
+ {
+ $megaApi->privateFreeRequestListener($this);
+ }
+ }
+ }
+
+ public function onRequestTemporaryError($api, $request, $error)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaRequest = $megaApi->getCurrentRequest()->copy();
+ $megaError = $megaApi->getCurrentError()->copy();
+
+ $this->listener->onRequestTemporaryError($megaApi, $megaRequest, $megaError);
+ }
+ }
+}
+
+class MegaTransferListenerPHP extends MegaTransferListener
+{
+ var $megaApi;
+ var $listener;
+ var $singleListener;
+
+ public function MegaTransferListenerPHP($megaApi, $listener, $single)
+ {
+ parent::__construct();
+
+ $this->megaApi = $megaApi;
+ $this->listener = $listener;
+ $this->sigleListener = $single;
+ }
+
+ public function getUserListener()
+ {
+ return $this->listener;
+ }
+
+ public function onTransferStart($api, $transfer)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaTransfer = $megaApi->getCurrentTransfer()->copy();
+
+ $this->listener->onTransferStart($megaApi, $megaTransfer);
+ }
+ }
+
+ public function onTransferFinish($api, $transfer, $error)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaTransfer = $megaApi->getCurrentTransfer()->copy();
+ $megaError = $megaApi->getCurrentError()->copy();
+
+ $this->listener->onTransferFinish($megaApi, $megaTransfer, $megaError);
+
+ if($this->singleListener == 1)
+ {
+ $megaApi->privateFreeTransferListener($this);
+ }
+ }
+ }
+
+ public function onTransferUpdate($api, $transfer)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaTransfer = $megaApi->getCurrentTransfer()->copy();
+
+ $this->listener->onTransferUpdate($megaApi, $megaTransfer);
+ }
+ }
+
+ public function onTransferTemporaryError($api, $request, $error)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $megaTransfer = $megaApi->getCurrentTransfer()->copy();
+ $megaError = $megaApi->getCurrentError()->copy();
+
+ $this->listener->onTransferTemporaryError($megaApi, $megaTransfer, $megaError);
+ }
+ }
+}
+
+class MegaGlobalListenerPHP extends MegaGlobalListener
+{
+ var $megaApi;
+ var $listener;
+
+ public function MegaGlobalListenerPHP($megaApi, $listener)
+ {
+ parent::__construct();
+
+ $this->megaApi = $megaApi;
+ $this->listener = $listener;
+ }
+
+ public function getUserListener()
+ {
+ return $this->listener;
+ }
+
+ public function onUsersUpdate($api, $users)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ if($megaApi->getCurrentUsers() != null)
+ {
+ $megaUsers = $megaApi->getCurrentUsers()->copy();
+ }
+ else
+ {
+ $megaUsers = null;
+ }
+
+ $this->listener->onUsersUpdate($megaApi, $megaUsers);
+ }
+ }
+
+ public function onNodesUpdate($api, $nodes)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ if($megaApi->getCurrentNodes() != null)
+ {
+ $megaNodes = $megaApi->getCurrentNodes()->copy();
+ }
+ else
+ {
+ $megaNodes = null;
+ }
+
+ $this->listener->onNodesUpdate ($megaApi, $megaNodes);
+ }
+ }
+
+ public function onReloadNeeded($api)
+ {
+ if($this->listener != null)
+ {
+ $megaApi = $this->megaApi;
+ $this->listener->onReloadNeeded ($megaApi);
+ }
+ }
+}
+
+class MegaApiPHP extends MegaApi
+{
+ private $megaApi;
+ private $activeMegaListeners = array();
+ private $activeMegaRequestListeners = array();
+ private $activeMegaTransferListeners = array();
+ private $activeMegaGlobalListeners = array();
+ private $semaphore;
+
+ public function MegaApiPHP($appKey, $userAgent, $basePath = null)
+ {
+ $this->megaApi = new MegaApi($appKey, $basePath, $userAgent);
+ $this->semaphore = sem_get("32462", 1, 0666, 1);
+ }
+
+ private function createDelegateMegaListener($listener)
+ {
+ if($listener == null)
+ {
+ return null;
+ }
+
+ $delegateListener = new MegaListenerPHP($this, $listener);
+
+ sem_acquire($this->semaphore);
+ array_push($this->activeMegaListeners, $delegateListener);
+ sem_release($this->semaphore);
+
+ return $delegateListener;
+ }
+
+ private function createDelegateRequestListener($listener, $singleListener = 1)
+ {
+ if($listener == null)
+ {
+ return null;
+ }
+
+ $delegateListener = new MegaRequestListenerPHP($this, $listener, $singleListener);
+
+ sem_acquire($this->semaphore);
+ array_push($this->activeMegaRequestListeners, $delegateListener);
+ sem_release($this->semaphore);
+
+ return $delegateListener;
+ }
+
+ private function createDelegateTransferListener($listener, $singleListener = 1)
+ {
+ if($listener == null)
+ {
+ return null;
+ }
+
+ $delegateListener = new MegaTransferListenerPHP($this, $listener, $singleListener);
+
+ sem_acquire($this->semaphore);
+ array_push($this->activeMegaTransferListeners, $delegateListener);
+ sem_release($this->semaphore);
+
+ return $delegateListener;
+ }
+
+ private function createDelegateGlobalListener($listener)
+ {
+ if($listener == null)
+ {
+ return null;
+ }
+
+ $delegateListener = new MegaGlobalListenerPHP($this, $listener);
+
+ sem_acquire($this->semaphore);
+ array_push($this->activeMegaGlobalListeners, $delegateListener);
+ sem_release($this->semaphore);
+
+ return $delegateListener;
+ }
+
+ function addListener($listener)
+ {
+ $this->megaApi->addListener($this->createDelegateMegaListener($listener));
+ }
+
+ function addRequestListener($listener)
+ {
+ $this->megaApi->addRequestListener($this->createDelegateRequestListener($listener, 0));
+ }
+
+ function addTransferListener($listener)
+ {
+ $this->megaApi->addTransferListener($this->createDelegateTransferListener($listener, 0));
+ }
+
+ function addGlobalListener($listener)
+ {
+ $this->megaApi->addGlobalListener($this->createDelegateGlobalListener($listener));
+ }
+
+
+ function removeListener($listener)
+ {
+ sem_acquire($this->semaphore);
+ foreach ($this->activeMegaListeners as $delegate)
+ {
+ if($delegate->getUserListener() == $listener)
+ {
+ $this->megaApi->removeListener($delegate);
+ unset($this->activeMegaListeners[$delegate]);
+ break;
+ }
+ }
+ sem_release($this->semaphore);
+ }
+
+ function removeRequestListener($listener)
+ {
+ sem_acquire($this->semaphore);
+ foreach ($this->activeMegaRequestListeners as $delegate)
+ {
+ if($delegate->getUserListener() == $listener)
+ {
+ $this->megaApi->removeRequestListener($delegate);
+ unset($this->activeMegaRequestListeners[$delegate]);
+ break;
+ }
+ }
+ sem_release($this->semaphore);
+ }
+
+ function removeTransferListener($listener)
+ {
+ sem_acquire($this->semaphore);
+ foreach ($this->activeMegaTransferListeners as $delegate)
+ {
+ if($delegate->getUserListener() == $listener)
+ {
+ $this->megaApi->removeTransferListener($delegate);
+ unset($this->activeMegaTransferListeners[$delegate]);
+ break;
+ }
+ }
+ sem_release($this->semaphore);
+ }
+
+ function removeGlobalListener($listener)
+ {
+ sem_acquire($this->semaphore);
+ foreach ($this->activeMegaGlobalListeners as $delegate)
+ {
+ if($delegate->getUserListener() == $listener)
+ {
+ $this->megaApi->removeGlobalListener($delegate);
+ unset($this->activeMegaGlobalListeners[$delegate]);
+ break;
+ }
+ }
+ sem_release($this->semaphore);
+ }
+
+ function getBase64PwKey($password)
+ {
+ return $this->megaApi->getBase64PwKey($password);
+ }
+
+ function getStringHash($base64pwkey, $email)
+ {
+ return $this->megaApi->getStringHash($base64pwkey, $email);
+ }
+
+ static function base64ToHandle($base64Handle)
+ {
+ return MegaApi::base64ToHandle($handle);
+ }
+
+ static function handleToBase64($handle)
+ {
+ return MegaApi::handleToBase64($handle);
+ }
+
+ static function userHandleToBase64($handle)
+ {
+ return MegaApi::userHandleToBase64($handle);
+ }
+
+ static function addEntropy($data, $size)
+ {
+ MegaApi::addEntropy($data, $size);
+ }
+
+ function retryPendingConnections($disconnect = false, $includexfers = false, $listener = null)
+ {
+ $this->megaApi->retryPendingConnections($disconnect, $includexfers, $this->createDelegateRequestListener($listener));
+ }
+
+ function login($email, $password, $listener = null)
+ {
+ $this->megaApi->login($email, $password, $this->createDelegateRequestListener($listener));
+ }
+
+ function loginToFolder($megaFolderLink, $listener = null)
+ {
+ $this->megaApi->loginToFolder($megaFolderLink, $this->createDelegateRequestListener($listener));
+ }
+
+ function dumpSession()
+ {
+ return $this->megaApi->dumpSession();
+ }
+
+ function dumpXMPPSession()
+ {
+ return $this->megaApi->dumpXMPPSession();
+ }
+
+ function createAccount($email, $password, $name, $listener = null)
+ {
+ $this->megaApi->createAccount($email, $password, $name, $this->createDelegateRequestListener($listener));
+ }
+
+ function fastCreateAccount($email, $base64pwkey, $name, $listener = null)
+ {
+ $this->megaApi->fastCreateAccount($email, $base64pwkey, $name, $this->createDelegateRequestListener($listener));
+ }
+
+ function querySignupLink($link, $listener = null)
+ {
+ $this->megaApi->querySignupLink($link, $this->createDelegateRequestListener($listener));
+ }
+
+ function confirmAccount($link, $password, $listener = null)
+ {
+ $this->megaApi->confirmAccount($link, $password, $this->createDelegateRequestListener($listener));
+ }
+
+ function fastConfirmAccount($link, $base64pwkey, $listener = null)
+ {
+ $this->megaApi->fastConfirmAccount($link, $base64pwkey, $this->createDelegateRequestListener($listener));
+ }
+
+ function setProxySettings($proxySettings)
+ {
+ $this->megaApi->setProxySettings($proxySettings);
+ }
+
+ function getAutoProxySettings()
+ {
+ return $this->megaApi->getAutoProxySettings();
+ }
+
+ function isLoggedIn()
+ {
+ return $this->megaApi->isLoggedIn();
+ }
+
+ function getMyEmail()
+ {
+ return $this->megaApi->getMyEmail();
+ }
+
+ static function setLogLevel($logLevel)
+ {
+ MegaApi::setLogLevel($logLevel);
+ }
+
+ static function setLoggerObject($megaLogger)
+ {
+ MegaApi::setLoggerObject($megaLogger);
+ }
+
+ static function log($logLevel, $message, $filename = "", $line = -1)
+ {
+ MegaApi::log($logLevel, $message, $filename, $line);
+ }
+
+ function createFolder($name, $parent, $listener = null)
+ {
+ $this->megaApi->createFolder($name, $parent, $this->createDelegateRequestListener($listener));
+ }
+
+ function moveNode($node, $newParent, $listener = null)
+ {
+ $this->megaApi->moveNode($node, $newParent, $this->createDelegateRequestListener($listener));
+ }
+
+ function copyNode($node, $newParent, $listener = null)
+ {
+ $this->megaApi->copyNode($node, $newParent, $this->createDelegateRequestListener($listener));
+ }
+
+ function renameNode($node, $newName, $listener = null)
+ {
+ $this->megaApi->renameNode($node, $newName, $this->createDelegateRequestListener($listener));
+ }
+
+ function remove($node, $listener = null)
+ {
+ $this->megaApi->remove($node, $this->createDelegateRequestListener($listener));
+ }
+
+ function sendFileToUser($node, $user, $listener = null)
+ {
+ $this->megaApi->sendFileToUser($node, $user, $this->createDelegateRequestListener($listener));
+ }
+
+ function share($node, $user_or_email, $level, $listener = null)
+ {
+ $this->megaApi->share($node, $user_or_email, $level, $this->createDelegateRequestListener($listener));
+ }
+
+ function importFileLink($megaFileLink, $parent, $listener = null)
+ {
+ $this->megaApi->importFileLink($megaFileLink, $parent, $this->createDelegateRequestListener($listener));
+ }
+
+ function getPublicNode($megaFileLink, $listener = null)
+ {
+ $this->megaApi->getPublicNode($megaFileLink, $this->createDelegateRequestListener($listener));
+ }
+
+ function getThumbnail($node, $dstFilePath, $listener = null)
+ {
+ $this->megaApi->getThumbnail($node, $dstFilePath, $this->createDelegateRequestListener($listener));
+ }
+
+ function getPreview($node, $dstFilePath, $listener = null)
+ {
+ $this->megaApi->getPreview($node, $dstFilePath, $this->createDelegateRequestListener($listener));
+ }
+
+ function getUserAvatar($user, $dstFilePath, $listener=null)
+ {
+ $this->megaApi->getUserAvatar($user, $dstFilePath, $this->createDelegateRequestListener($listener));
+ }
+
+ function cancelGetThumbnail($node, $listener = null)
+ {
+ $this->megaApi->cancelGetThumbnail($node, $this->createDelegateRequestListener($listener));
+ }
+
+ function cancelGetPreview($node, $listener = null)
+ {
+ $this->megaApi->cancelGetPreview($node, $this->createDelegateRequestListener($listener));
+ }
+
+ function setThumbnail($node, $srcFilePath, $listener = null)
+ {
+ $this->megaApi->setThumbnail($node, $srcFilePath, $this->createDelegateRequestListener($listener));
+ }
+
+ function setPreview($node, $srcFilePath, $listener = null)
+ {
+ $this->megaApi->setPreview($node, $srcFilePath, $this->createDelegateRequestListener($listener));
+ }
+
+ function setAvatar($srcFilePath, $listener = null)
+ {
+ $this->megaApi->setAvatar($srcFilePath, $this->createDelegateRequestListener($listener));
+ }
+
+ function exportNode($node, $listener = null)
+ {
+ $this->megaApi->exportNode($node, $this->createDelegateRequestListener($listener));
+ }
+
+ function disableExport($node, $listener = null)
+ {
+ $this->megaApi->disableExport($node, $this->createDelegateRequestListener($listener));
+ }
+
+ function fetchNodes($listener = null)
+ {
+ $this->megaApi->fetchNodes($this->createDelegateRequestListener($listener));
+ }
+
+ function getAccountDetails($listener = null)
+ {
+ $this->megaApi->getAccountDetails($this->createDelegateRequestListener($listener));
+ }
+
+ function getPricing($listener = null)
+ {
+ $this->megaApi->getPricing($this->createDelegateRequestListener($listener));
+ }
+
+ function getPaymentUrl($productHandle, $listener = null)
+ {
+ $this->megaApi->getPaymentUrl($productHandle, $this->createDelegateRequestListener($listener));
+ }
+
+ function exportMasterKey()
+ {
+ return $this->megaApi->exportMasterKey();
+ }
+
+ function changePassword($oldPassword, $newPassword, $listener = null)
+ {
+ $this->megaApi->changePassword($oldPassword, $newPassword, $this->createDelegateRequestListener($listener));
+ }
+
+ function inviteContact($user, $message, $action, $listener = null)
+ {
+ $this->megaApi->inviteContact($user, $message, $action, $this->createDelegateRequestListener($listener));
+ }
+
+ function removeContact($user, $listener = null)
+ {
+ $this->megaApi->removeContact($user, $this->createDelegateRequestListener($listener));
+ }
+
+ function logout($listener = null)
+ {
+ $this->megaApi->logout($this->createDelegateRequestListener($listener));
+ }
+
+ function submitFeedback($rating, $comment, $listener = null)
+ {
+ $this->megaApi->submitFeedback($rating, $comment, $this->createDelegateRequestListener($listener));
+ }
+
+ function reportDebugEvent($text, $listener = null)
+ {
+ $this->megaApi->reportDebugEvent($text, $this->createDelegateRequestListener($listener));
+ }
+
+ function startUpload($localPath, $parent, $listener = null)
+ {
+ $this->megaApi->startUpload($localPath, $parent, null, null, $this->createDelegateTransferListener($listener));
+ }
+
+ function startDownload($node, $localPath, $listener = null)
+ {
+ $this->megaApi->startDownload($node, $localPath, $this->createDelegateTransferListener($listener));
+ }
+
+ function cancelTransfer($transfer, $listener = null)
+ {
+ $this->megaApi->cancelTransfer($transfer, $this->createDelegateRequestListener($listener));
+ }
+
+ function cancelTransfers($type, $listener = null)
+ {
+ $this->megaApi->cancelTransfers($type, $this->createDelegateRequestListener($listener));
+ }
+
+ function pauseTransfers($pause, $listener = null)
+ {
+ $this->megaApi->pauseTransfers($pause, $this->createDelegateRequestListener($listener));
+ }
+
+ function setUploadLimit($bpslimit)
+ {
+ $this->megaApi->setUploadLimit($bpslimit);
+ }
+
+ function getTransfers($type = null)
+ {
+ if($type == null)
+ return $this->listToArray($this->megaApi->getTransfersAll());
+ else
+ return $this->listToArray($this->megaApi->getTransfers($type));
+ }
+
+ function update()
+ {
+ $this->megaApi->update();
+ }
+
+ function isWaiting()
+ {
+ return $this->megaApi->isWaiting();
+ }
+
+ function getNumPendingUploads()
+ {
+ return $this->megaApi->getNumPendingUploads();
+ }
+
+ function getNumPendingDownloads()
+ {
+ return $this->megaApi->getNumPendingDownloads();
+ }
+
+ function getTotalUploads()
+ {
+ return $this->megaApi->getTotalUploads();
+ }
+
+ function getTotalDownloads()
+ {
+ return $this->megaApi->getTotalDownloads();
+ }
+
+ function resetTotalDownloads()
+ {
+ $this->megaApi->resetTotalDownloads();
+ }
+
+ function resetTotalUploads()
+ {
+ $this->megaApi->resetTotalUploads();
+ }
+
+ function getTotalDownloadedBytes()
+ {
+ return $this->megaApi->getTotalDownloadedBytes();
+ }
+
+ function getTotalUploadedBytes()
+ {
+ return $this->megaApi->getTotalUploadedBytes();
+ }
+
+ function updateStats()
+ {
+ $this->megaApi->updateStats();
+ }
+
+ const ORDER_NONE = 0;
+ const ORDER_DEFAULT_ASC = MegaApi::ORDER_DEFAULT_ASC;
+ const ORDER_DEFAULT_DESC = MegaApi::ORDER_DEFAULT_DESC;
+ const ORDER_SIZE_ASC = MegaApi::ORDER_SIZE_ASC;
+ const ORDER_SIZE_DESC = MegaApi::ORDER_SIZE_DESC;
+ const ORDER_CREATION_ASC = MegaApi::ORDER_CREATION_ASC;
+ const ORDER_CREATION_DESC = MegaApi::ORDER_CREATION_DESC;
+ const ORDER_MODIFICATION_ASC = MegaApi::ORDER_MODIFICATION_ASC;
+ const ORDER_MODIFICATION_DESC = MegaApi::ORDER_MODIFICATION_DESC;
+ const ORDER_ALPHABETICAL_ASC = MegaApi::ORDER_ALPHABETICAL_ASC;
+ const ORDER_ALPHABETICAL_DESC = MegaApi::ORDER_ALPHABETICAL_DESC;
+
+ function getNumChildren($parent)
+ {
+ return $this->megaApi->getNumChildren($parent);
+ }
+
+ function getNumChildFiles($parent)
+ {
+ return $this->megaApi->getNumChildFiles($parent);
+ }
+
+ function getNumChildFolders($parent)
+ {
+ return $this->megaApi->getNumChildFolders($parent);
+ }
+
+ function getChildren($parent, $order = 1)
+ {
+ return $this->listToArray($this->megaApi->getChildren($parent, $order));
+ }
+
+ function getChildNode($parent, $name)
+ {
+ return $this->megaApi->getChildNode($parent, $name);
+ }
+
+ function getParentNode($node)
+ {
+ return $this->megaApi->getParentNode($node);
+ }
+
+ function getNodePath($node)
+ {
+ return $this->megaApi->getNodePath($node);
+ }
+
+ function getNodeByPath($path, $base = null)
+ {
+ return $this->megaApi->getNodeByPath($path, $base);
+ }
+
+ function getNodeByHandle($handle)
+ {
+ return $this->megaApi->getNodeByHandle($handle);
+ }
+
+ function getContacts()
+ {
+ return $this->listToArray($this->megaApi->getContacts());
+ }
+
+ function getContact($email)
+ {
+ return $this->megaApi->getContact($email);
+ }
+
+ function getInShares($user = null)
+ {
+ if($user == null)
+ return $this->listToArray($this->megaApi->getInSharesAll());
+ else
+ return $this->listToArray($this->megaApi->getInShares($user));
+ }
+
+ function isShared($node)
+ {
+ return $this->megaApi->isShared($node);
+ }
+
+ function getOutShares($node = null)
+ {
+ if($node == null)
+ return $this->listToArray($this->megaApi->getOutSharesAll());
+ else
+ return $this->listToArray($this->megaApi->getOutShares($node));
+ }
+
+ function getAccess($node)
+ {
+ return $this->megaApi->getAccess($node) ;
+ }
+
+ function getSize($node)
+ {
+ return $this->megaApi->getSize($node) ;
+ }
+
+ function getFingerprint($filePath_or_node)
+ {
+ return $this->megaApi->getFingerprint($filePath_or_node);
+ }
+
+ function getNodeByFingerprint($fingerprint)
+ {
+ return $this->megaApi->getNodeByFingerprint($fingerprint);
+ }
+
+ function hasFingerprint($fingerprint)
+ {
+ return $this->megaApi->hasFingerprint($fingerprint);
+ }
+
+ function checkAccess($node, $level)
+ {
+ return $this->megaApi->checkAccess($node, $level);
+ }
+
+ function checkMove($node, $target)
+ {
+ return $this->megaApi->checkMove($node, $target);
+ }
+
+ function getRootNode()
+ {
+ return $this->megaApi->getRootNode();
+ }
+
+ function getInboxNode()
+ {
+ return $this->megaApi->getInboxNode();
+ }
+
+ function getRubbishNode()
+ {
+ return $this->megaApi->getRubbishNode();
+ }
+
+ function search($node, $searchString, $recursive = true)
+ {
+ return $this->listToArray($this->megaApi->search($node, $searchString, $recursive));
+ }
+
+ function getCurrentRequest()
+ {
+ return $this->megaApi->getCurrentRequest();
+ }
+
+ function getCurrentTransfer()
+ {
+ return $this->megaApi->getCurrentTransfer();
+ }
+
+ function getCurrentError()
+ {
+ return $this->megaApi->getCurrentError();
+ }
+
+ function getCurrentNodes()
+ {
+ return $this->listToArray($this->megaApi->getCurrentNodes());
+ }
+
+ function getCurrentUsers()
+ {
+ return $this->listToArray($this->megaApi->getCurrentUsers());
+ }
+
+ private function listToArray($list)
+ {
+ if ($list == null)
+ {
+ return array();
+ }
+
+ $result = array();
+ for($i=0; $i<$list->size(); $i++)
+ {
+ array_push($result, $list->get($i)->copy());
+ }
+
+ return $result;
+ }
+
+ function privateFreeRequestListener($listener)
+ {
+ sem_acquire($this->semaphore);
+ activeRequestListeners.remove(listener);
+ sem_release($this->semaphore);
+ }
+
+ function privateFreeTransferListener($listener)
+ {
+ sem_acquire($this->semaphore);
+ activeTransferListeners.remove(listener);
+ sem_release($this->semaphore);
+ }
+
+ public function __destruct()
+ {
+ foreach($this->activeMegaListeners as $listener)
+ {
+ $this->megaApi->removeListener($listener);
+ }
+
+ foreach($this->activeMegaRequestListeners as $listener)
+ {
+ $this->megaApi->removeRequestListener($listener);
+ }
+
+ foreach($this->activeMegaTransferListeners as $listener)
+ {
+ $this->megaApi->removeTransferListener($listener);
+ }
+
+ foreach($this->activeMegaGlobalListeners as $listener)
+ {
+ $this->megaApi->removeGlobalListener($listener);
+ }
+
+ sem_remove($this->semaphore);
+ }
+}
+?>
\ No newline at end of file
diff --git a/megaProcess/megacli.php b/megaProcess/megacli.php
new file mode 100644
index 0000000..109db0f
--- /dev/null
+++ b/megaProcess/megacli.php
@@ -0,0 +1,688 @@
+#!/usr/bin/env php
+
+getErrorCode() != MegaError::API_OK)
+ {
+ print("INFO: Request finished with error ( " . $request . " ) Result: " . $error . "\n");
+ print("MEGA > ");
+ return;
+ }
+
+ $requestType = $request->getType();
+ if($requestType == MegaRequest::TYPE_LOGIN)
+ {
+ print("Fetchning nodes. Please wait...\n");
+ print("MEGA > ");
+ $megaApi->fetchNodes();
+ }
+ else if($requestType == MegaRequest::TYPE_FETCH_NODES)
+ {
+ print("Account correctly loaded\n");
+ print("MEGA > ");
+ $cwd = $megaApi->getRootNode();
+ }
+ else if($requestType == MegaRequest::TYPE_EXPORT)
+ {
+ print("INFO: Exported link: " . $request->getLink() . "\n");
+ print("MEGA > ");
+ }
+ else if($requestType == MegaRequest::TYPE_ACCOUNT_DETAILS)
+ {
+ $accountDetails = $request->getMegaAccountDetails();
+ print("INFO: Account details received\n");
+ print("Account e-mail: " . $megaApi->getMyEmail() . "\n");
+ print("Storage: " . $accountDetails->getStorageUsed() . " of " . $accountDetails->getStorageMax() .
+ " (" . (100 * $accountDetails->getStorageUsed() / $accountDetails->getStorageMax()) . "%)\n");
+ print("Pro level: " . $accountDetails->getProLevel() . "\n");
+ print("MEGA > ");
+ }
+ }
+
+ public function onRequestTemporaryError($megaApi, $request, $error)
+ {
+ print("INFO: Request temporary error ( " . $request . " ) Error: " + $error . "\n");
+ }
+
+ public function onTransferStart($megaApi, $transfer)
+ {
+ print("INFO: Transfer start ( " . $transfer . " " . $transfer->getFileName() . " )\n");
+ }
+
+ public function onTransferFinish($megaApi, $transfer, $error)
+ {
+ print("INFO: Transfer finished ( " . $transfer . " " . $transfer->getFileName() . " ) Result: " . $error . "\n");
+ print("MEGA > ");
+ }
+
+ public function onTransferUpdate($megaApi, $transfer)
+ {
+ print("INFO: Transfer update ( " . $transfer . " " . $transfer->getFileName() . " ) Progress: " . $transfer->getTransferredBytes()/1024 ." KB of " . $transfer->getTotalBytes()/1024 . " KB, " . $transfer->getSpeed()/1024 . " KB/s\n");
+ }
+
+ public function onTransferTemporaryError($megaApi, $request, $error)
+ {
+ print("INFO: Transfer temporary error ( " . $transfer . " " . $transfer->getFileName() . " ) Error: " . $error . "\n");
+ }
+
+ public function onUsersUpdate($megaApi, $users)
+ {
+ }
+
+ public function onNodesUpdate($megaApi, $nodes)
+ {
+ global $cwd;
+
+ if($nodes != NULL)
+ {
+ print("INFO: Nodes updated ( " . count($nodes) . " )\n");
+ print("MEGA > ");
+ }
+ else
+ $cwd = $megaApi->getRootNode();
+ }
+
+ public function onReloadNeeded($megaApi)
+ {
+
+ }
+}
+
+class LoginCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('login');
+ $this->setDescription('Log in to a MEGA account');
+ $this->addArgument('email', InputArgument::REQUIRED, 'Email of the account');
+ $this->addArgument('password', InputArgument::REQUIRED, 'Password of the account');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+
+ $email = $input->getArgument('email');
+ $password = $input->getArgument('password');
+ $megaapi->login($email, $password);
+ }
+}
+
+class LogoutCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('logout');
+ $this->setDescription('Log out a MEGA account');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ $megaapi->logout();
+ $cwd = null;
+ }
+}
+
+class LsCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('ls');
+ $this->setDescription('List a MEGA folder');
+ $this->addArgument('path', InputArgument::OPTIONAL, 'folder path');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $path = $input->getArgument('path');
+ if ($path)
+ {
+ $folder = $megaapi->getNodeByPath($path, $cwd);
+ }
+ else
+ {
+ $folder = $cwd;
+ }
+
+
+ $output->writeln(" .");
+ if($megaapi->getParentNode($folder) != NULL)
+ {
+ $output->writeln(" ..");
+ }
+
+ $children = $megaapi->getChildren($folder);
+ foreach($children as $node)
+ {
+ $output->write(" " . $node->getName());
+ if($node->getType() == MegaNode::TYPE_FILE)
+ {
+ $output->writeln(" (" . $node->getSize() . " bytes)");
+ }
+ else
+ {
+ $output->writeln(" (folder)");
+ }
+ }
+ }
+}
+
+class MkdirCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('mkdir');
+ $this->setDescription('Create a folder');
+ $this->addArgument('name', InputArgument::REQUIRED, 'folder name');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $name = $input->getArgument('name');
+ $megaapi->createFolder($name, $cwd);
+ }
+}
+
+class CdCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('cd');
+ $this->setDescription('Change the current directory');
+ $this->addArgument('path', InputArgument::REQUIRED, 'new current directory');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $path = $input->getArgument('path');
+ $new = $megaapi->getNodeByPath($path, $cwd);
+ if($new == null)
+ {
+ $output->writeln("Invalid path");
+ return;
+ }
+
+ $cwd = $new;
+ }
+}
+
+class MvCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('mv');
+ $this->setDescription('Move a file/folder');
+ $this->addArgument('source', InputArgument::REQUIRED, 'Source file/folder');
+ $this->addArgument('destination', InputArgument::REQUIRED, 'Destination file/folder');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $source = $input->getArgument('source');
+ $name = $input->getArgument('destination');
+
+ $srcNode = $megaapi->getNodeByPath($source, $cwd);
+ if($srcNode == null)
+ {
+ $output->writeln($source . ": No such file or directory");
+ return;
+ }
+
+ $dstNode = $megaapi->getNodeByPath($name, $cwd);
+ if(($dstNode != null) && $dstNode->isFile())
+ {
+ $output->writeln($name . ": Not a directory");
+ return;
+ }
+
+ if($dstNode != null)
+ {
+ $megaapi->moveNode($srcNode, $dstNode);
+ return;
+ }
+
+ if(strpos($name,"/") !== false || strpos($name,"\\") !== false)
+ {
+ $str1 = strrchr($name, "/");
+ $str2 = strrchr($name, "\\");
+ $index = null;
+
+ if($str2 == FALSE || strlen($str1) < strlen($str2))
+ {
+ echo "A\n";
+ $index = strlen($name) - strlen($str1);
+ }
+ else
+ {
+ echo "B\n";
+ $index = strlen($name) - strlen($str2);
+ }
+
+ $path = substr($name, 0, $index);
+ $base = $megaapi->getNodeByPath($path, $cwd);
+ $name = substr($name, $index+1);
+
+ echo "INDEX: " . $index . "\n";
+ echo "str1: " . $str1 . "\n";
+ echo "str2: " . $str2 . "\n";
+ echo "PATH: " . $path . "\n";
+ echo "NAME: " . $name . "\n";
+
+ if($base == null)
+ {
+ $output->writeln($path . ": Not such directory");
+ return;
+ }
+
+ if($base->isFile())
+ {
+ $output->writeln($path . ": Not a directory");
+ return;
+ }
+
+ $megaapi->moveNode($srcNode, $base);
+ if(strlen($name) != 0)
+ {
+ $megaapi->renameNode($srcNode, $name);
+ }
+ return;
+ }
+
+ if($dstNode == null)
+ {
+ $megaapi->renameNode($srcNode, $name);
+ }
+ }
+}
+
+class PwdCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('pwd');
+ $this->setDescription('Get the current working directory');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $output->writeln($megaapi->getNodePath($cwd));
+ }
+}
+
+class RmCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('rm');
+ $this->setDescription('Remove a file/folder');
+ $this->addArgument('path', InputArgument::REQUIRED, 'Path to file/folder to delete');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $path = $input->getArgument('path');
+ $node = $megaapi->getNodeByPath($path, $cwd);
+ if($node == null)
+ {
+ $output->writeln("Invalid path");
+ return;
+ }
+
+ $megaapi->remove($node);
+ }
+}
+
+class GetCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('get');
+ $this->setDescription('Download a file from MEGA');
+ $this->addArgument('path', InputArgument::REQUIRED, 'Path to the file');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $path = $input->getArgument('path');
+ $node = $megaapi->getNodeByPath($path, $cwd);
+ if($node == null)
+ {
+ $output->writeln("Invalid path");
+ return;
+ }
+
+ if(!$node->isFile())
+ {
+ $output->writeln("Not a file");
+ return;
+ }
+
+ $megaapi->startDownload($node, "./");
+ }
+}
+
+class PutCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('put');
+ $this->setDescription('Upload a file to MEGA');
+ $this->addArgument('path', InputArgument::REQUIRED, 'Path to the local file');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $path = $input->getArgument('path');
+ $megaapi->startUpload($path, $cwd);
+ }
+}
+
+class ExportCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('export');
+ $this->setDescription('Generate a public link');
+ $this->addArgument('path', InputArgument::REQUIRED, 'Path to the file/folder in MEGA');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $path = $input->getArgument('path');
+ $node = $megaapi->getNodeByPath($path, $cwd);
+ if($node == null)
+ {
+ $output->writeln("Invalid path");
+ return;
+ }
+
+ $megaapi->exportNode($node);
+ }
+}
+
+class ImportCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('import');
+ $this->setDescription('Import a MEGA public file link');
+ $this->addArgument('link', InputArgument::REQUIRED, 'Public MEGA file link');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $link = $input->getArgument('link');
+ $megaapi->importFileLink($link, $cwd);
+ }
+}
+
+class PasswdCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('passwd');
+ $this->setDescription('Change the access password');
+ $this->addArgument('current_password', InputArgument::REQUIRED, 'Current password');
+ $this->addArgument('new_password', InputArgument::REQUIRED, 'New password');
+ $this->addArgument('repeat_new_password', InputArgument::REQUIRED, 'New password');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $current_password = $input->getArgument('current_password');
+ $new_password = $input->getArgument('new_password');
+ $repeat_new_password = $input->getArgument('repeat_new_password');
+
+ if($new_password != $repeat_new_password)
+ {
+ $output->writeln("Error: Password mismatch");
+ return;
+ }
+
+ $megaapi->changePassword($current_password, $new_password);
+ }
+}
+
+class WhoamiCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('whoami');
+ $this->setDescription('Show info about the current user');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $output->writeln($megaapi->getMyEmail());
+ $megaapi->getAccountDetails();
+ }
+}
+
+class MountCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('mount');
+ $this->setDescription('Show incoming shares');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ global $megaapi;
+ global $cwd;
+
+ if($cwd == null)
+ {
+ $output->writeln("Not logged in");
+ return;
+ }
+
+ $output->writeln("INFO: INSHARES:");
+ $users = $megaapi->getContacts();
+ foreach($users as $user)
+ {
+ $megaapi->getInShares();
+ $inshares = $megaapi->getInShares($user);
+ foreach($inshares as $share)
+ {
+ $output->writeln("INFO: INSHARE on " . $user->getEmail() . " " . $share->getName() . " Access level: " . $megaapi->getAccess($share));
+ }
+ }
+ }
+}
+
+class ExitCommand extends Command
+{
+ protected function configure()
+ {
+ $this->setName('exit');
+ $this->setDescription('Exit the app');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ exit(0);
+ }
+}
+
+class QuitCommand extends ExitCommand
+{
+ protected function configure()
+ {
+ $this->setName('quit');
+ $this->setDescription('Exit the app');
+ }
+}
+
+MegaApi::setLogLevel(MegaApi::LOG_LEVEL_ERROR);
+$applistener = new AppListener();
+
+$megaapi = new MegaApiPHP("API_KEY", "PHP megacli");
+$megaapi->addListener($applistener);
+
+$application = new Application('MEGA', 'PHP');
+$application->add(new LoginCommand());
+$application->add(new LogoutCommand());
+$application->add(new LsCommand());
+$application->add(new MkdirCommand());
+$application->add(new CdCommand());
+$application->add(new PwdCommand());
+$application->add(new RmCommand());
+$application->add(new GetCommand());
+$application->add(new PutCommand());
+$application->add(new ExitCommand());
+$application->add(new QuitCommand());
+$application->add(new ExportCommand());
+$application->add(new ImportCommand());
+$application->add(new WhoamiCommand());
+$application->add(new PasswdCommand());
+$application->add(new MountCommand());
+$application->add(new MvCommand());
+
+$shell = new Shell($application);
+$shell->run();
+
+?>
+
+
diff --git a/newVersion.php b/newVersion.php
new file mode 100644
index 0000000..59e5f43
--- /dev/null
+++ b/newVersion.php
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/others.php b/others.php
index ffa03dc..083e5a1 100644
--- a/others.php
+++ b/others.php
@@ -12,23 +12,9 @@
Tous les projets
query($requete)or die(print_r($bdd->errorInfo()));
- $projects = array();
-
- while($rep = $req->fetch()){
- if(!isset($projects[$rep['projectID']])){
- $projects[$rep['projectID']] = $rep;
- }else if($projects[$rep['projectID']]['versionAbs'] < $rep['versionAbs']){
- $projects[$rep['projectID']] = $rep;
- }
- }
+ $projects = getProjectsWithFirstPermission();
foreach($projects as $project){
echo ('
Le projet ' . $project['projectName'] . ' en version ' . $project['versionName'] . '');
diff --git a/pictures/cercloid_cacahuete.png b/pictures/cercloid_cacahuete.png
new file mode 100644
index 0000000..838f1dd
Binary files /dev/null and b/pictures/cercloid_cacahuete.png differ
diff --git a/pictures/gebra_bezier_a_12.png b/pictures/gebra_bezier_a_12.png
new file mode 100644
index 0000000..efa262b
Binary files /dev/null and b/pictures/gebra_bezier_a_12.png differ
diff --git a/pictures/hexa_soucoupe.png b/pictures/hexa_soucoupe.png
new file mode 100644
index 0000000..0fc53d2
Binary files /dev/null and b/pictures/hexa_soucoupe.png differ
diff --git a/pictures/into_donut.png b/pictures/into_donut.png
new file mode 100644
index 0000000..648f87e
Binary files /dev/null and b/pictures/into_donut.png differ
diff --git a/pictures/lucas_president.png b/pictures/lucas_president.png
new file mode 100644
index 0000000..f44f805
Binary files /dev/null and b/pictures/lucas_president.png differ
diff --git a/pictures/water.jpg b/pictures/water.jpg
new file mode 100644
index 0000000..7e56f4c
Binary files /dev/null and b/pictures/water.jpg differ
diff --git a/posting_message.php b/posting_message.php
new file mode 100644
index 0000000..489bbbb
--- /dev/null
+++ b/posting_message.php
@@ -0,0 +1,16 @@
+=14){
+ header('Location:401.php');
+ goto end;
+}
+
+sendMessage();
+
+header('Location:discut.php?d='.$_GET['d']);
+end:
\ No newline at end of file
diff --git a/profile.php b/profile.php
index 154ef42..63f62d5 100644
--- a/profile.php
+++ b/profile.php
@@ -8,26 +8,21 @@
prepare('SELECT * FROM users WHERE ID=? AND mdp=?');
- if(isset($_SESSION['session_id']) && isset($_SESSION['session_mdp'])){
- $req->execute(array($_SESSION['session_id'],$_SESSION['session_mdp']));
- }
-
- if(isset($_SESSION['session_id']) && isset($_SESSION['session_mdp']) && $req->fetch() ){
+ if(isConnected()){
?>
diff --git a/projet.php b/projet.php
index 97fae50..42e1e37 100644
--- a/projet.php
+++ b/projet.php
@@ -1,156 +1,120 @@
-
-
+
+
-
+
-
+
-
+
Le projet en version
-
-
-
>
-
"
- alt="Télécharger le jar"
- title="Télécharger le jar"
- src="pictures/download_jar.png" />
+
+
+ 12){ echo( '"megaProcess/downloadJar.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
+
" alt="Télécharger le jar" title="Télécharger le jar" src="pictures/download_jar.png"/>
+
+
12){ echo( '"megaProcess/viewJavaSrc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
+
" alt="Voir la source" title="Voir la source" src="pictures/view_code.png"/>
+
+
12){ echo( '"megaProcess/downloadJavaSrc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
+
" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_code.png"/>
+
+
12){ echo( '"megaProcess/viewJavadoc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
+
" alt="Voir la doc" title="Voir la doc" src="pictures/view_javadoc.png"/>
+
+
12){ echo( '"megaProcess/downloadJavadoc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
+
" alt="Télecharger la doc" title="Télecharger la doc" src="pictures/download_javadoc.png"/>
+
-
-
>
-
"
- alt="Voir la source" title="Voir la source"
- src="pictures/view_code.png" />
-
-
-
>
-
"
- alt="Télécharger la source"
- title="Télécharger la source"
- src="pictures/download_code.png" />
-
-
-
>
-
"
- alt="Voir la doc" title="Voir la doc" src="pictures/view_javadoc.png" />
-
-
-
>
-
"
- alt="Télecharger la doc" title="Télecharger la doc"
- src="pictures/download_javadoc.png" />
-
-
-
-
-
-
>
-
"
- alt="Télécharger le xlsm"
- title="Télécharger le xlsm"
- src="pictures/download_xlsm.png" />
-
-
-
>
-
"
- alt="Voir la source" title="Voir la source" src="pictures/voir_vb.png" />
-
-
-
>
-
"
- alt="Télécharger la source"
- title="Télécharger la source"
- src="pictures/download_vb.png" />
-
-
+
+
+
12){ echo( '"megaProcess/downloadXlsm.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
+
" alt="Télécharger le xlsm" title="Télécharger le xlsm" src="pictures/download_xlsm.png"/>
+
+
12){ echo( '"megaProcess/viewVbSrc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
+
" alt="Voir la source" title="Voir la source" src="pictures/voir_vb.png"/>
+
+
12){ echo( '"megaProcess/downloadVbSrc.php?id='. $data[ 'pID'] . '&v='. $data[ 'versionAbs'] . '"');}else{ echo( "\"#\"");} ?>>
+
" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_vb.png"/>
+
-
-
-
Toutes les versions :
-
-
-
- | Version |
-
- prepare ( $requete );
- $req->execute ( array (
- $_GET ['id']
- ) );
- while ( $rep = $req->fetch () ) {
- ?>
-
- | >
- |
-
-
+
+
+ Toutes les versions :
+
+
+ 0){?>
+
-
-
-
-} else {
- header ( 'Location:403.php' );
- goto end;
- }
- ?>
+
+
+ 0){?>
+
+
+
+
+
+
+ Nouvelle version
+ Modifier la version
+ Supprimer la version
+ Modifier le projet
+ Supprimer le projet
+
+ }else{
+ header('Location:403.php');
+ goto end;
+ }?>
+ end:
+ ?>
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/projetV1.php b/projetV1.php
deleted file mode 100644
index 87c8f5e..0000000
--- a/projetV1.php
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- prepare('SELECT * FROM users WHERE ID=? AND mdp=?');
- if(isset($_SESSION['session_id']) && isset($_SESSION['session_mdp'])){
- $req->execute(array($_SESSION['session_id'],$_SESSION['session_mdp']));
- $connected = $req->fetch();
- }
- $req=$bdd->prepare('SELECT * FROM projets WHERE permissions LIKE "1___" AND ID=?');
- $req->execute(array($_GET['id']));
- $viewPerm = $req->fetch();
- if(($connected && isset($_SESSION['session_id']) && isset($_SESSION['session_mdp'])) || $viewPerm){
- $requete = 'SELECT p.ID AS projectID , v.versionAbs AS versionAbs , p.name AS projectName , v.version AS versionName , v.language AS projectLanguage , p.permissions AS permissions '.
- 'FROM projets AS p '.
- 'INNER JOIN versions AS v '.
- 'ON v.project_id = p.ID '.
- 'WHERE v.project_id = ? AND v.versionAbs = ?';
- $req = $bdd->prepare($requete);
- $req->execute(array($_GET['id'],$_GET['v']));
- $rep=$req->fetch();
- if($rep){
- $requete = 'SELECT p.ID AS projectID , v.versionAbs AS versionAbs , p.name AS projectName , v.version AS versionName '.
- 'FROM projets AS p '.
- 'INNER JOIN versions AS v '.
- 'ON v.project_id = p.ID '.
- 'WHERE v.project_id = ? AND v.versionAbs = ? AND (p.ownersID REGEXP \'[^0-9]?' . $_SESSION['session_id'] .'[^0-9]?\' OR p.permissions LIKE "1%")';
- $req = $bdd->prepare($requete);
- $req->execute(array($_GET['id'],$_GET['v']));
- $fsyuf = $req->fetch();
- $req = $bdd->prepare('SELECT p.ID AS projectID FROM projets AS p INNER JOIN versions AS v ON v.project_id = p.ID WHERE v.project_id = ? AND v.versionAbs = ? AND p.ownersID REGEXP \'[^0-9]?' . (isset($_SESSION['session_id']))?$_SESSION['session_id']:'err' .'[^0-9]?\'');
- $req->execute(array($_GET['id'],$_GET['v']));
- if($req->fetch()){
- $owner=TRUE;
- }else{
- $owner=FALSE;
- }
- echo($owner."###".$_SESSION['session_id']);
- $exeAccess = preg_match('#^11(0|1)*#',$rep['permissions']) || $owner;
- $docAccess = preg_match('#^111(0|1)*#',$rep['permissions']) || $owner;
- $srcAccess = preg_match('#^1111(0|1)*#',$rep['permissions']) || $owner;
- if($fsyuf){?>
- Le projet en version
-
-
- >
" alt="Télécharger le jar" title="Télécharger le jar" src="pictures/download_jar.png">
- >
" alt="Voir la source" title="Voir la source" src="pictures/view_code.png">
- >
" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_code.png">
- >
" alt="Voir la doc" title="Voir la doc" src="pictures/view_javadoc.png">
- >
" alt="Télecharger la doc" title="Télecharger la doc" src="pictures/download_javadoc.png">
-
-
- >
" alt="Télécharger le xlsm" title="Télécharger le xlsm" src="pictures/download_xlsm.png">
- >
" alt="Voir la source" title="Voir la source" src="pictures/voir_vb.png">
- >
" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_vb.png">
-
-
##################################
-
-
- Toutes les versions :
-
-
-
- | Version |
-
- prepare($requete);
- $req->execute(array($_GET['id']));
- while($rep = $req->fetch()){
- ?>
-
- | > |
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/projets.php b/projets.php
index cd228cc..5e28688 100644
--- a/projets.php
+++ b/projets.php
@@ -12,31 +12,11 @@
Mes projets
prepare('SELECT * FROM users WHERE ID=? AND mdp=?');
- if(isset($_SESSION['session_id']) && isset($_SESSION['session_mdp'])){
- $req->execute(array($_SESSION['session_id'],$_SESSION['session_mdp']));
- }
-
- if(isset($_SESSION['session_id']) && isset($_SESSION['session_mdp']) && $req->fetch() ){
+ if(isConnected()){
- $requete = 'SELECT p.ID AS projectID , v.versionAbs AS versionAbs , p.name AS projectName , v.version AS versionName '.
- 'FROM projets AS p '.
- 'INNER JOIN versions AS v '.
- 'ON v.project_id = p.ID '.
- 'WHERE p.ownersID REGEXP \'[^0-9]?' . $_SESSION['session_id'] .'[^0-9]?\' ';
- $req = $bdd->query($requete)or die(print_r($bdd->errorInfo()));
- //$req = $bdd->query('SELECT * FROM projets WHERE ownersID REGEXP \'[^0-9]?' . $_SESSION['session_id'] .'[^0-9]?\'');
- $projects = array();
- while($rep = $req->fetch()){
- if(!isset($projects[$rep['projectID']])){
- $projects[$rep['projectID']] = $rep;
- }else if($projects[$rep['projectID']]['versionAbs'] < $rep['versionAbs']){
- $projects[$rep['projectID']] = $rep;
- }
-
- }
+ $projects = getOwnersisProjects();
foreach($projects as $project){
echo ('Le projet ' . $project['projectName'] . ' en version ' . $project['versionName'] . '
');
}
diff --git a/register.php b/register.php
index 39358da..79c17f1 100644
--- a/register.php
+++ b/register.php
@@ -9,33 +9,15 @@
- alert('Vous n\\'avez pas rentré toutes les données !')";
- } elseif($_GET['i'] == 2){
- echo "";
- } elseif($_GET['i'] == 3){
- echo "";
- } elseif($_GET['i'] == 4){
- echo "";
- } elseif($_GET['i'] == 5){
- echo "";
- } elseif($_GET['i'] == 6){
- echo "";
- }
- }
- ?>
-
diff --git a/registering.php b/registering.php
index 98e0b40..34232f1 100644
--- a/registering.php
+++ b/registering.php
@@ -1,31 +1,38 @@
-prepare("SELECT * FROM users WHERE pseudo=?");
- $req->execute(array($_POST['pseudo']));
- if($req->fetch()){
- header('Location:register.php?i=5');
- }else{
- $req = $bdd->prepare('INSERT INTO users(pseudo,mdp,date_creation) VALUES (?,?,NOW())');
- $req->execute(array($_POST['pseudo'],$_POST['mdp']));
- $_SESSION['session_id'] = $reponce['ID'];
- $_SESSION['session_mdp'] = $reponce['mdp'];
- header('Location:register.php?i=6');
- }
- }else{
- header('Location:register.php?i=4');
- }
- }else{
- header('Location:register.php?i=3');
- }
- }else{
- header('Location:register.php?i=2');
- }
-}else{
- header('Location:register.php?i=1');
-}
+
\ No newline at end of file
+include_once 'includes/inter.php';
+
+if (isset ( $_POST ['pseudo'] ) && isset ( $_POST ['mdp'] ) && isset ( $_POST ['mdp2'] )) {
+
+ if ($_POST ['mdp'] === $_POST ['mdp2']) {
+
+ if (preg_match ( "#^[a-zA-Z0-9\\-_]+$#", $_POST ['pseudo'] )) {
+
+ if (preg_match ( "#^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\\-_&éèà ùçµ\"\\#'{}()[\\]|\\^@°+=\$¤£*!§:/;.,?²]+$#", $_POST ['mdp'] )) {
+
+ switch (registerPerson ( $_POST ['pseudo'], $_POST ['mdp'] )) {
+
+ case 'ok' :
+
+ $_SESSION ['current_error'] = 'Vous avez déjà été correctement inscrit sur bernard.com';
+ break;
+
+ case 'usedPseudo' :
+ $_SESSION ['current_error'] = 'Le pseudonyme est déjà utilisé (par une entité differente de vous)';
+ break;
+ }
+ } else {
+ $_SESSION ['current_error'] = 'Le mot de passe fut incorrect : Les seuls caractères autorisés sont :
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_&éèà ùçµ"#\'{}()[]|^@°+=$¤£*!§:/;.,?²';
+ }
+ } else {
+ $_SESSION ['current_error'] = 'Le pseudo sera incorrect : Les seuls caractères autorisés sont :
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_';
+ }
+ } else {
+ $_SESSION ['current_error'] = 'Tu auras du rentrer deux fois le même mot de passe (tu permet aussi de rendre le champs "Recopier le mot de passe" utile)';
+ }
+} else {
+
+ $_SESSION ['current_error'] = 'Quand on demande des données , on donne des données !!!';
+}
+header ( 'Location:register.php' );
\ No newline at end of file
diff --git a/sortBDD.php b/sortBDD.php
new file mode 100644
index 0000000..b6b51fc
--- /dev/null
+++ b/sortBDD.php
@@ -0,0 +1,108 @@
+';
+ /*-------------------- USERS --------------------*/
+ $idAssos = array();
+ echo '[' . date ( 'H:i:s' ) . ']' . 'Table users
';
+ $rep = $GLOBALS ['bdd']->query ( 'SELECT * FROM users ORDER BY ID' );
+ $users = array ();
+ while ( $user = $rep->fetch () ) {
+ echo '----' . $user ['ID'] . ':"' . $user ['pseudo'] . '";"' . $user ['mdp'] . '";' . $user ['date_creation'] . ';' . $user ['administration'] . '
';
+ $users [] = $user;
+ }
+ $rep->closeCursor ();
+ $GLOBALS ['bdd']->exec ( 'TRUNCATE TABLE users' );
+ echo '[' . date ( 'H:i:s' ) . ']' . 'Table users effacée
';
+ $currentID = 1;
+ foreach ( $users as $u ) {
+ $req = $GLOBALS['bdd']->prepare('INSERT INTO users(pseudo,mdp,date_creation,administration) VALUES (?,?,?,?)');
+ $req->execute(array($u ['pseudo'],$u ['mdp'], $u ['date_creation'], $u ['administration']));
+ $idAssos[$u['ID']] = $currentID;
+ $currentID +=1;
+ echo '----' . $u ['ID'] . '->' . $idAssos[$u['ID']] . '
';
+ }
+ echo '[' . date ( 'H:i:s' ) . ']' . 'Pseudos réinsérés triés par ID
';
+
+ /*-------------------- PROJETS --------------------*/
+
+ $pidAssos = array();
+ echo '[' . date ( 'H:i:s' ) . ']' . 'Table projets
';
+ $rep = $GLOBALS ['bdd']->query ( 'SELECT * FROM projets ORDER BY ID' );
+ $projects = array ();
+ while ( $project = $rep->fetch () ) {
+ echo '----' . $project ['ID'] . ':"' . $project['name'] . '";"' . $project ['ownersID'] . '";' . $project ['permissions'] . '
';
+ $projects[] = $project;
+ }
+ $rep->closeCursor();
+ $GLOBALS ['bdd']->exec ( 'TRUNCATE TABLE projets' );
+ echo '[' . date ( 'H:i:s' ) . ']' . 'Table projets effacée
';
+ $currentID = 1;
+ foreach ( $projects as $p ) {
+ $ownersID = explode(';',$p['ownersID']);
+ $ownersNewID = array();
+ foreach($ownersID AS $o){
+ if(isset($idAssos[$o])){
+ $ownersNewID[] = $idAssos[$o];
+ }
+ }
+ $newOwnersID = implode(';',$ownersNewID);
+ if(count($ownersNewID)<=0){
+ echo '####################' . 'Le projet '.print_r($p,TRUE).' n\'a aucun possésseur
';
+ }else{
+ echo '--------' . 'Owners :'.$p['ownersID'].' à '.$newOwnersID.'
';
+ }
+
+ $req = $GLOBALS['bdd']->prepare('INSERT INTO projets(name,ownersID,permissions) VALUES (?,?,?)');
+ $req->execute(array($p ['name'],$newOwnersID,$p['permissions']));
+ $pidAssos[$p['ID']] = $currentID;
+ $currentID +=1;
+ echo '----' . $p ['ID'] . '->' . $pidAssos[$p['ID']] . '
';
+ }
+ echo '[' . date ( 'H:i:s' ) . ']' . 'Projets réinsérés triés par ID
';
+
+
+ /*-------------------- VERSIONS --------------------*/
+
+ $vidAssos=array();
+ echo '[' . date ( 'H:i:s' ) . ']' . 'Table versions
';
+ $rep = $GLOBALS ['bdd']->query ( 'SELECT * FROM versions ORDER BY id' );
+ $versions = array ();
+ while ( $version = $rep->fetch () ) {
+ echo '----' . $version ['id'] . ':' . $version['project_id'] . ';"' . $version ['version'] . '";"' . $version ['versionAbs'].'";'.$version['language'] . '
';
+ $versions[] = $version;
+ }
+ $rep->closeCursor();
+ $GLOBALS ['bdd']->exec ( 'TRUNCATE TABLE versions' );
+ echo '[' . date ( 'H:i:s' ) . ']' . 'Table versions effacée
';
+ $currentID = 1;
+ foreach ( $versions as $v ) {
+
+ $newProjectId=$pidAssos[$v['project_id']];
+
+ $req = $GLOBALS['bdd']->prepare('INSERT INTO versions(project_id,version,versionAbs,language) VALUES (?,?,?,?)');
+ $req->execute(array($pidAssos,$v ['version'],$v['versionAbs'],$v ['language']));
+ $vidAssos[$v['id']] = $currentID;
+ $currentID +=1;
+ echo '----' . $v ['id'] . '->' . $vidAssos[$v['id']] . '
';
+ }
+ echo '[' . date ( 'H:i:s' ) . ']' . 'Versions réinsérés triés par ID
';
+
+
+
+
+ } catch ( Exception $e ) {
+ echo $GLOBALS['bdd']->error;
+ }
+}
+
+end:
+?>
\ No newline at end of file
diff --git a/tempPreMega/GebraBezierA12.png b/tempPreMega/GebraBezierA12.png
new file mode 100644
index 0000000..efa262b
Binary files /dev/null and b/tempPreMega/GebraBezierA12.png differ
diff --git a/tempPreMega/bezierN.ggb b/tempPreMega/bezierN.ggb
new file mode 100644
index 0000000..9fc47ed
Binary files /dev/null and b/tempPreMega/bezierN.ggb differ
diff --git a/tempPreMega/hexaSoucoupe.png b/tempPreMega/hexaSoucoupe.png
new file mode 100644
index 0000000..0fc53d2
Binary files /dev/null and b/tempPreMega/hexaSoucoupe.png differ
diff --git a/todo.list b/todo.list
new file mode 100644
index 0000000..cf13024
--- /dev/null
+++ b/todo.list
@@ -0,0 +1,7 @@
+discuts.php
+createDiscuts.php
+sendMessage.php
+
+
+MEGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+version edit + editing
\ No newline at end of file