public function login($struct)
 {
     $this->_auth($struct);
     $profile = tprofile::i();
     $result = array('userid' => 1, 'fullname' => $profile->nick, 'friendgroups' => array());
     return $result;
 }
Esempio n. 2
0
 protected function getprofile()
 {
     $profile = tprofile::i();
     return array('nick' => $profile->nick, 'url' => litepublisher::$site->url . litepublisher::$site->home, 'foafurl' => litepublisher::$site->url . '/foaf.xml');
 }
Esempio n. 3
0
 public function processform()
 {
     $foaf = tfoaf::i();
     $html = $this->html;
     switch ($this->name) {
         case 'foaf':
             if (!isset($_POST['foaftable'])) {
                 extract($_POST, EXTR_SKIP);
                 if ($this->action == 'edit') {
                     $id = $this->idget();
                     if (!$foaf->itemexists($id)) {
                         return '';
                     }
                     $status = $_POST["status-{$id}"];
                     $foaf->edit($id, $nick, $url, $foafurl, $status);
                     return $html->h2->successedit;
                 } else {
                     if (empty($url)) {
                         return '';
                     }
                     if ($foaf->hasfriend($url)) {
                         return $html->h2->erroradd;
                     }
                     $foaf->addurl($url);
                     return $html->h2->successadd;
                 }
             } else {
                 $status = isset($_POST['approve']) ? 'approved' : (isset($_POST['hold']) ? 'hold' : 'delete');
                 $foaf->lock();
                 foreach ($_POST as $key => $id) {
                     if (!is_numeric($id)) {
                         continue;
                     }
                     $id = (int) $id;
                     if ($status == 'delete') {
                         $foaf->delete($id);
                     } else {
                         $foaf->changestatus($id, $status);
                     }
                 }
                 $foaf->unlock();
                 return $html->h2->successmoderate;
             }
         case 'profile':
             $profile = tprofile::i();
             foreach ($_POST as $key => $value) {
                 if (isset($profile->data[$key])) {
                     $profile->data[$key] = $value;
                 }
             }
             $profile->gender = isset($_POST['gender']) ? 'male' : 'female';
             $profile->save();
             return $html->h2->successprofile;
         case 'profiletemplate':
             $profile = tprofile::i();
             $profile->template = $_POST['template'];
             $profile->save();
             return $html->h2->successprofile;
     }
     return '';
 }
Esempio n. 4
0
 private function GetReg($key)
 {
     $profile = tprofile::i();
     switch ($key) {
         case 'nickname':
         case 'fullname':
             return $profile->nick;
         case 'email':
             return $profile->mbox;
         case 'gender':
             return $profile->gender;
         case 'country':
             return $profile->country;
         case 'dob':
             return $profile->dateOfBirth;
         default:
             return false;
     }
 }
Esempio n. 5
0
 public function addpost(tpost $post)
 {
     $item = $this->domrss->AddItem();
     tnode::addvalue($item, 'title', $post->title);
     tnode::addvalue($item, 'link', $post->link);
     tnode::addvalue($item, 'comments', $post->link . '#comments');
     tnode::addvalue($item, 'pubDate', $post->pubdate);
     $guid = tnode::addvalue($item, 'guid', $post->link);
     tnode::attr($guid, 'isPermaLink', 'true');
     if (class_exists('tprofile')) {
         $profile = tprofile::i();
         tnode::addvalue($item, 'dc:creator', $profile->nick);
     } else {
         tnode::addvalue($item, 'dc:creator', 'admin');
     }
     $categories = tcategories::i();
     $names = $categories->getnames($post->categories);
     foreach ($names as $name) {
         if (empty($name)) {
             continue;
         }
         tnode::addcdata($item, 'category', $name);
     }
     $tags = ttags::i();
     $names = $tags->getnames($post->tags);
     foreach ($names as $name) {
         if (empty($name)) {
             continue;
         }
         tnode::addcdata($item, 'category', $name);
     }
     $content = '';
     $this->callevent('beforepost', array($post->id, &$content));
     if ($this->template == '') {
         $content .= $post->replacemore($post->rss, true);
     } else {
         $content .= ttheme::parsevar('post', $post, $this->template);
     }
     $this->callevent('afterpost', array($post->id, &$content));
     tnode::addcdata($item, 'content:encoded', $content);
     tnode::addcdata($item, 'description', strip_tags($content));
     tnode::addvalue($item, 'wfw:commentRss', $post->rsscomments);
     if (count($post->files) > 0) {
         $files = tfiles::i();
         $files->loaditems($post->files);
         foreach ($post->files as $idfile) {
             $file = $files->getitem($idfile);
             $enclosure = tnode::add($item, 'enclosure');
             tnode::attr($enclosure, 'url', litepublisher::$site->files . '/files/' . $file['filename']);
             tnode::attr($enclosure, 'length', $file['size']);
             tnode::attr($enclosure, 'type', $file['mime']);
         }
     }
     $post->onrssitem($item);
     $this->onpostitem($item, $post);
     return $item;
 }