Exemplo n.º 1
0
 public function savedata()
 {
     $collection = EDMSQuery::instance("feedback");
     $feedbackid = EDMSSequence::nextVal('feedbackid', 1, 'counters');
     $newfeedback = array("feedbackid" => intval($feedbackid), "name" => $this->name, "message" => $this->message, "email" => $this->email, "insertdatetime" => new MongoDate());
     $result = $collection->insert($newfeedback, array('safe' => true));
 }
Exemplo n.º 2
0
 public function saveData()
 {
     $collection = EDMSQuery::instance("scripts");
     if (empty($this->scriptid)) {
         $scriptid = EDMSSequence::nextVal('scriptid', 1, 'counters');
         $lastinsertid = $scriptid;
         $createdate = new MongoDate();
         $tags = explode(',', $this->tags);
         $tags = array_map('trim', $tags);
         $tags = array_map('strtolower', $tags);
         $urltitle = str_replace(" ", "-", $this->title);
         $newscript = array("scriptid" => intval($scriptid), "memberid" => intval($this->memberid), "title" => $this->title, "urltitle" => $urltitle, "category" => $this->category, "tags" => $tags, "script" => $this->script, "scriptdesc" => $this->scriptdesc, "isprivate" => 0, "isfav" => 0, "createdate" => $createdate, "lastmodifieddate" => $createdate, "membername" => $this->membername, "memberemail" => $this->memberemail, "memberrealname" => $this->memberrealname, "votes" => 0, "views" => 0, "profilephoto" => $this->profilephoto);
         $result = $collection->insert($newscript, array('safe' => true));
     } else {
         $scriptid = $this->scriptid;
         $tags = explode(',', $this->tags);
         $tags = array_map('trim', $tags);
         $tags = array_map('strtolower', $tags);
         $lastinsertid = '';
         $createdate = $this->createdate;
         $result = $collection->update(array("scriptid" => intval($scriptid)), array("title" => $this->title, "membername" => $this->membername, "memberrealname" => $this->memberrealname, "profilephoto" => $this->profilephoto, "memberemail" => $this->memberemail, "category" => $this->category, "tags" => $tags, "script" => $this->script, "scriptdesc" => $this->scriptdesc, "isprivate" => 0, "isfav" => 0, "createdate" => $createdate, "lastmodifieddate" => new MongoDate()), '$set', array('safe' => true));
     }
     if (empty($result["err"])) {
         $this->InsertTags($scriptid, $tags);
     }
     return $result;
 }
Exemplo n.º 3
0
 public function saveData()
 {
     $collection = EDMSQuery::instance("members");
     $memberid = EDMSSequence::nextVal('memberid', 1, 'counters');
     $newmember = array("memberid" => intval($memberid), "realname" => $this->realname, "email" => $this->email, "location" => '', "password" => $this->encrypt($this->password), "createdatetime" => new MongoDate(), "lastlogintime" => new MongoDate(), "oauthid" => $this->oauthid, "oauthprovider" => $this->oauthprovider);
     if (empty($this->oauthprovider)) {
         $active = array("active" => 1, 'membername' => $this->membername);
     } else {
         $active = array("active" => 0, 'membername' => $this->membername . $memberid);
     }
     $newmember = array_merge($newmember, $active);
     $result = $collection->insert($newmember, array('safe' => true));
     $this->memberid = $memberid;
     return $result["ok"];
 }