コード例 #1
0
ファイル: ProfileController.php プロジェクト: eryx/labs
 public function indexAction()
 {
     $pf = NULL;
     if (preg_match('#^(.+)/profile/(.+)$#i', $this->reqs->uri, $regs)) {
         $uname = $regs[2];
         try {
             $this->initdb();
             $_profile = Core_Dao::factory(array('name' => 'user_profile'));
             $user = $_profile->getList(array('uname' => $uname));
             if (isset($user[0]['id'])) {
                 $des = str_split($uname);
                 $path = '/data/user/' . $des['0'] . '/' . $des['1'] . '/' . $des['2'] . '/' . $uname;
                 if (!file_exists(SYS_ROOT . $path . "/w100.png")) {
                     $path = '/data/user';
                 }
                 $pf = $user[0];
                 $pf['photo_path'] = $path;
                 $pf['content'] = Core_Util_Format::richEditFilter($pf['content']);
             }
         } catch (Exception $e) {
             //
         }
     }
     if ($pf === NULL) {
         $this->view->message = Core_Message::get('error', 'Profile not found');
     } else {
         $this->view->profile = $pf;
         $this->view->content = $this->view->render('profile/index');
         unset($pf, $this->view->profile);
     }
     $this->response('layout');
 }
コード例 #2
0
ファイル: entry.php プロジェクト: eryx/labs
//print_r($entry);
//echo "</pre>";
if ($entry['cat'] > 0) {
    $db = Core_Dao::factory(array('name' => 'taxonomy_term_user'));
    $cat_entry = $db->getById($entry['cat']);
} else {
    $cat_entry = array();
}
if (strlen($entry['terms'])) {
    $entry['terms'] = explode(",", $entry['terms']);
} else {
    $entry['terms'] = array();
}
$entry['published'] = date("Y:m:d h:i", strtotime($entry['published']));
$entry['updated'] = date("Y:m:d h:i", strtotime($entry['updated']));
$entry['content'] = Core_Util_Format::ubb2html(Core_Util_Format::textHtmlFilter($entry['content']));
$this->headtitle = $entry['title'];
?>

<div class="entry-view">
    <div class="entry-header">
        <h1 class="entry-title"><?php 
echo $entry['title'];
?>
</h1>
   	    <div class="entry-info">
   	        <img src="/_cm/img/date.png" align="absmiddle" title="Created" /> <?php 
echo $entry['published'];
?>
&nbsp;&nbsp;
            <?php 
コード例 #3
0
ファイル: feed.php プロジェクト: eryx/labs
$feed = $db->getList($where, $order, $limit, ($p - 1) * $limit);
$count = $db->getCount($where);
$pager = Core_Util_Pager::get($p, $count, $limit);
foreach ($feed as $key => $entry) {
    $feed[$key]['link'] = "/{$this->inst}/view/?id={$entry['id']}";
    // TODO
    $feed[$key]['avatar'] = "/user/profile/avatar/{$entry['uname']}-w40.png";
    $feed[$key]['link_profile'] = "/user/profile/{$entry['uname']}";
    $feed[$key]['terms'] = explode(",", $entry['terms']);
    if ($entry['cat'] > 0) {
        $feed[$key]['_cat_entry'] = $dbterm->getById($entry['cat']);
    }
    if (strlen($entry['summary']) > 1) {
        $feed[$key]['summary'] = Core_Util_Format::ubb2html(Core_Util_Format::textHtmlFilter($entry['summary']));
    } else {
        $feed[$key]['summary'] = Core_Util_Format::autoParagraph(Core_Util_Format::cutstr(Core_Util_Format::ubbClear($entry['content']), 400));
    }
}
?>

<dl class="entrylist">
  <?php 
foreach ($feed as $entry) {
    ?>
  <dt>
    <a href="<?php 
    echo $entry['link'];
    ?>
" target="_blank"><?php 
    echo $entry['title'];
    ?>
コード例 #4
0
ファイル: ProfileManageController.php プロジェクト: eryx/labs
 public function doAction()
 {
     $vars = get_object_vars($this->reqs);
     if (User_Model_Profile_Validate::isValid($vars, $message)) {
         try {
             $_pf = Core_Dao::factory(array('name' => 'user_profile'));
             $item = $_pf->getById($this->session->uid);
             if (isset($item['id'])) {
                 $where = array('id' => $this->session->uid);
                 $_pf->update($vars, $where);
             } else {
                 $vars['id'] = $this->session->uid;
                 $vars['uname'] = $this->session->uname;
                 $_pf->insert($vars);
             }
             $msg = Core_Message::get('success', 'OK');
         } catch (Exception $e) {
             $msg = Core_Message::get('error', 'ERROR' . $e->getMessage());
         }
     } else {
         $msg = Core_Message::get('error', $message);
     }
     $vars['content'] = Core_Util_Format::richEditFilter($vars['content']);
     $vars['content'] = htmlspecialchars($vars['content'], ENT_NOQUOTES);
     $this->view->profile = $vars;
     if (isset($msg)) {
         $this->view->message = $msg;
     }
     $entry = new Core_Object();
     foreach ($vars as $key => $val) {
         $entry->{$key} = $val;
     }
     $this->view->content = $this->view->render('profile-manage/index', array('entry' => $entry));
     $this->response('layout');
 }