function fetchSummary($external_link_id)
 {
     $db =& Database::getInstance();
     $myts =& MyTextsanitizer::getInstance();
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname($this->mydirname);
     $storyid = intval($external_link_id);
     $mydirname = $this->mydirname;
     if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
         die('Invalid mydirname');
     }
     $mytrustdirpath = dirname(dirname(__FILE__));
     require_once dirname(dirname(__FILE__)) . '/class/bulletin.php';
     if (Bulletin::isPublishedExists($mydirname, $storyid)) {
         $article = new Bulletin($mydirname, $storyid);
         $subject4assign = $article->getVar('title');
         $summary = $article->getVar('hometext');
         if (function_exists('easiestml')) {
             $summary = easiestml($summary);
         }
         $summary4assign = htmlspecialchars(xoops_substr($this->unhtmlspecialchars(strip_tags($summary)), 0, 255), ENT_QUOTES);
     } else {
         $subject4assign = '';
         $summary4assign = '';
     }
     return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $subject4assign, 'uri' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?page=article&storyid=' . $storyid, 'summary' => $summary4assign);
 }
function bulletin_com_update($story_id, $total_num)
{
    $mydirname = preg_replace('/[^0-9a-zA-Z_-]/', '', $GLOBALS['mydirname']);
    $article = new Bulletin($mydirname, $story_id);
    if (!$article->updateComments($total_num)) {
        return false;
    }
    return true;
}
Beispiel #3
0
 /**
  * Save video to youtube.
  * @param Bulletin $model
  * @param CUploadedFile $video
  */
 public static function processBulletin($model, $video)
 {
     if (!empty($video)) {
         if (is_array($video)) {
             $video = current($video);
         }
         $youtube_id = Upload($video, $model->name, $model->text, 'Animals', 'Tags');
         if (!empty($youtube_id)) {
             $model->youtube_id = $youtube_id;
             $model->save();
         }
     }
 }
Beispiel #4
0
	function getRSSItems( &$items )
	{
		// check module_read permission
		$module_handler =& xoops_gethandler( 'module' ) ;
		$module =& $module_handler->getByDirname( $this->mydirname ) ;
		$gperm_handler =& xoops_gethandler( 'groupperm' ) ;
		$can_read = $gperm_handler->checkRight( 'module_read' , $module->getVar('mid') , XOOPS_GROUP_ANONYMOUS ) ;
		if( ! $can_read ) return ;

		// check config (feed_as_backend)
		$config_handler =& xoops_gethandler( 'config' ) ;
		$mod_config =& $config_handler->getConfigsByCat( 0 , $module->getVar( 'mid' ) ) ;
		if( empty( $mod_config['feed_as_backend'] ) ) {
			return ;
		}

		$myts =& MyTextSanitizer::getInstance();
		$articles = Bulletin::getAllPublished( $this->mydirname , 10 , 0 , 0 , 1 , true, true, true) ;//ver3.0 changed
		foreach( $articles as $article ) {
			$hometext = $article->getVar('hometext','n') ;
			if( function_exists( 'easiestml' ) ) {
				$hometext = easiestml( $hometext ) ;
			}
			$items[] = array(
				'pubdate' => $article->getVar('published') ,
				'title' => htmlspecialchars(bulletin_utf8_encode($article->getVar('title', 'n')), ENT_QUOTES),
				'category' => htmlspecialchars(bulletin_utf8_encode($article->newstopic->topic_title), ENT_QUOTES),
				'link' => XOOPS_URL.'/modules/'.$this->mydirname.'/index.php?page=article&storyid='.$article->getVar('storyid') ,
				'guid' => XOOPS_URL.'/modules/'.$this->mydirname.'/index.php?page=article&storyid='.$article->getVar('storyid') ,
				'description' => bulletin_utf8_encode(htmlspecialchars(strip_tags($myts->xoopsCodeDecode($hometext)), ENT_QUOTES)),
			) ;
		}
	}
Beispiel #5
0
 /**
  * Process uploaded images.
  * Save to gallery.
  * @param Bulletin $model
  * @param CUploadedFile[] $images
  */
 public static function processImages($model, $images)
 {
     if (isset($images) && count($images) > 0) {
         // configure and save gallery model
         $gallery = new Gallery();
         $gallery->name = false;
         $gallery->description = false;
         $gallery->versions = array('small' => array('resize' => array(150, null)), 'medium' => array('resize' => array(800, null)));
         $gallery->save();
         $model->gallery_id = $gallery->id;
         $model->save();
         // go through each uploaded image
         foreach ($images as $imageFile) {
             $galleryPhoto = new GalleryPhoto();
             $galleryPhoto->gallery_id = $gallery->id;
             $galleryPhoto->name = '';
             $galleryPhoto->description = '';
             $galleryPhoto->file_name = $imageFile->getName();
             $galleryPhoto->save();
             $galleryPhoto->setImage($imageFile->getTempName());
         }
     }
 }
Beispiel #6
0
	if ( !empty( $_POST['ok'] ) ){

		//check ticket
		if ( ! $xoopsGTicket->check() ) {
			die('Ticket Error');
			exit();
		}

		$storyid = isset( $_POST['storyid'] ) ? intval( $_POST['storyid'] ) : 0 ;

		if ( empty($storyid) ){
			die( _MD_EMPTYNODELETE );
			exit();
		}
		$story = new Bulletin( $mydirname , $storyid );
		if (!$story){
			die( _MD_EMPTYNODELETE );
			exit();
		}
		// Remove the related articles
		$story->relation->queryUnlinkById($storyid);
		$story->relation->queryDelete(1);
		$story -> delete();
		xoops_comment_delete( $xoopsModule->getVar('mid'), $storyid );
		xoops_notification_deletebyitem( $xoopsModule->getVar('mid'), 'story', $storyid );
		if( $return == 1){
			redirect_header( $mydirurl.'/index.php?mode=admin&op=list', 1, _MD_DBPUDATED );
		}else{
			redirect_header( $mydirurl.'/index.php', 1, _MD_DBPUDATED );
		}
Beispiel #7
0
<?php

$storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0;
// If there are no articles
if (!Bulletin::isPublishedExists($mydirname, $storyid)) {
    redirect_header($mydirurl . '/index.php', 2, _MD_NOSTORY);
    exit;
}
require_once XOOPS_ROOT_PATH . '/class/template.php';
$article = new Bulletin($mydirname, $storyid);
$gperm =& BulletinGP::getInstance($mydirname);
if (!$gperm->proceed4topic('can_read', $article->getVar('topicid'))) {
    //	redirect_header($mydirurl.'/index.php',2,_NOPERM);
    exit;
}
$datetime = formatTimestamp($article->getVar('published'), $bulletin_date_format);
$tpl = new XoopsTpl();
$tpl->xoops_setTemplateDir(XOOPS_ROOT_PATH . '/themes');
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(0);
$tpl->assign('charset', _CHARSET);
$tpl->assign('sitename', htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
$tpl->assign('sitename', htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
$tpl->assign('slogan', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES));
$tpl->assign('xoops_version', htmlspecialchars(XOOPS_VERSION, ENT_QUOTES));
$tpl->assign('site_image', htmlspecialchars($bulletin_imgurl_on_print, ENT_QUOTES));
$tpl->assign('story_title', $article->getVar('title'));
$tpl->assign('story_date', $datetime);
$tpl->assign('story_topic', $article->topic_title());
$tpl->assign('story_hometext', $article->getVar('hometext'));
$tpl->assign('story_id', $storyid);
    $years[$i]['string'] = sprintf(_MD_YEAR_X, $caly);
    $years[$i]['months'] = $months;
    $i++;
}
$xoopsTpl->assign('years', $years);
// 記事のリストassign
if ($fromyear != 0 && $frommonth != 0) {
    $xoopsTpl->assign('show_articles', true);
    $xoopsTpl->assign('currentmonth', $months_arr[$frommonth]);
    $xoopsTpl->assign('currentyear', $fromyear);
    // must adjust the selected time to server timestamp
    $timeoffset = $useroffset - $xoopsConfig['server_TZ'];
    $monthstart = mktime(0 - $timeoffset, 0, 0, $frommonth, 1, $fromyear);
    $monthend = mktime(23 - $timeoffset, 59, 59, $frommonth + 1, 0, $fromyear);
    $monthend = $monthend > time() ? time() : $monthend;
    $article = Bulletin::getArchives($mydirname, $monthstart, $monthend);
    $scount = count($article);
    for ($i = 0; $i < $scount; $i++) {
        $story = array();
        $story['id'] = $article[$i]->getVar('storyid');
        $story['topic'] = $article[$i]->topic_title();
        $story['topicid'] = $article[$i]->getVar('topicid');
        $story['title'] = $article[$i]->getVar('title');
        $story['counter'] = $article[$i]->getVar('counter');
        $story['date'] = formatTimestamp($article[$i]->getVar('published'), $bulletin_date_format, $useroffset);
        $story['print_link'] = 'index.php?page=print&amp;storyid=' . $article[$i]->getVar('storyid');
        // Tell A Frined使用する場合
        if ($bulletin_use_tell_a_frined) {
            $story['mail_link'] = XOOPS_URL . '/modules/tellafriend/index.php?target_uri=' . rawurlencode("{$mydirurl}/index.php?page=article&amp;storyid=" . $article[$i]->getVar('storyid')) . '&amp;subject=' . rawurlencode(sprintf(_MD_INTARTFOUND, $xoopsConfig['sitename']));
        } else {
            $story['mail_link'] = 'mailto:?subject=' . sprintf(_MD_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_MD_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . $mydirurl . '/index.php?page=article&amp;storyid=' . $article[$i]->getVar('storyid');
Beispiel #9
0
<?php

$com_itemid = isset($_GET['com_itemid']) ? intval($_GET['com_itemid']) : 0 ;

// If there are no articles
if( !Bulletin::isPublishedExists( $mydirname , $com_itemid) ){
	redirect_header($mydirurl.'/index.php',2,_MD_NOSTORY);
	exit();
}

$article = new Bulletin( $mydirname , $com_itemid);

$gperm =& BulletinGP::getInstance($mydirname) ;
if( ! $gperm->proceed4topic('can_read',$article->getVar('topicid')) ){
	redirect_header($mydirurl.'/index.php',2,_NOPERM);
	exit();
}

$com_replytext = _POSTEDBY.'&nbsp;<b>'.$article->getUname().'</b>&nbsp;'._DATE.'&nbsp;<b>'.formatTimestamp($article->getvar('published')).'</b><br /><br />'.$article->getVar('hometext');
$bodytext = $article->getDividedBodytext();
if ($bodytext != '') {
	$com_replytext .= '<br /><br />'.$bodytext.'';
}
$com_replytitle = $article->getVar('title');

$_GET['page'] = 'article';
require XOOPS_ROOT_PATH.'/include/comment_new.php';

?>
Beispiel #10
0
	// Icon image
	if ( $articles[$i]->showTopicimg() ) {
		$story['topic_url'] = $articles[$i]->imglink($bulletin_topicon_path);
		$story['align']     = $articles[$i]->getTopicalign();
	}

	$xoopsTpl->append('stories', $story);
}

// Page Navigation
if( !empty($caldate) && preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2})/', $caldate, $datearr) ){
	$totalcount = Bulletin::countPublishedByDate( $mydirname , $caldate , true);
	$query      = 'caldate='.$caldate;
}else{
	$totalcount = Bulletin::countPublished( $mydirname , $storytopic , true ,true);
	$query      = 'storytopic='.$storytopic;
}
if ( $totalcount > $scount ) {
	require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
	$pagenav = new XoopsPageNav($totalcount, $storynum, $start, 'start', $query);
	$xoopsTpl->assign('pagenav', $pagenav->renderNav());

} else {
	$xoopsTpl->assign('pagenav', '');
}

$xoopsTpl->assign($assing_array);

if($bulletin_assing_rssurl_head){
	$xoopsTpl->assign('xoops_module_header', $rss_feed . $xoopsTpl->get_template_vars( "xoops_module_header" ));
Beispiel #11
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Bulletin $value A Bulletin object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Bulletin $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Beispiel #12
0
<?php

require_once XOOPS_ROOT_PATH.'/class/template.php';

$myts =& MyTextSanitizer::getInstance();

if (function_exists('mb_http_output')) {
	mb_http_output('pass');
}
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(0);
if (!$tpl->is_cached("db:{$mydirname}_rss.html")) {
	$articles = Bulletin::getAllPublished( $mydirname , 10 , 0 , 0 , 1 , true , true ,true ) ;//ver3.0 changed
	if (is_array($articles)) {
		$tpl->assign('channel_title', bulletin_utf8_encode(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
		$tpl->assign('channel_link', XOOPS_URL.'/');
		$tpl->assign('channel_desc', bulletin_utf8_encode(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
		// $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
		$tpl->assign('channel_lastbuild', date( 'r' ) ) ; // GIJ
		$tpl->assign('channel_webmaster', $xoopsConfig['adminmail']);
		$tpl->assign('channel_editor', $xoopsConfig['adminmail']);
		$tpl->assign('channel_category', 'News');
		$tpl->assign('channel_generator', 'XOOPS');
		$tpl->assign('channel_language', _LANGCODE);
		$tpl->assign('image_url', XOOPS_URL.'/images/logo.gif');
		$dimention = getimagesize(XOOPS_ROOT_PATH.'/images/logo.gif');
		if (empty($dimention[0])) {
			$width = 88;
		} else {
			$width = ($dimention[0] > 144) ? 144 : $dimention[0];
Beispiel #13
0
		case 'addCommentaire':
			//idEleve: idEleve, idMatiere: idMatiere, idNiveau: idNiveau, idTrimestre:idTrimestre, idBulletin: idBulletin, commBulletin: commBulletin, action: 'addCommentaire'
			$trimestre = Trimestre::getById($_GET['idTrimestre']);
			$matiereNiveau = MatiereNiveau::getByMatiereNiveau($_GET['idMatiere'], $_GET['idNiveau']);
			$eleve = Eleve::getById($_GET['idEleve']);

			$bulletin = new Bulletin();
			if ($_GET['idBulletin'] == 0){
				$bulletin->setIdEleve($eleve->getIdUtilisateur());
				$bulletin->setIdMatiereNiveau($matiereNiveau->getIdMatiereNiveau());
				$bulletin->setContenuBulletin($_GET['commBulletin']);
				$bulletin->setDateRedacton(date('Y-m-d'));
				$bulletin->insert();
			}
			else {
				$bulletin = Bulletin::getById($_GET['idBulletin']);
				$bulletin->setContenuBulletin($_GET['commBulletin']);
				//$bulletin->setDateRedacton(date('Y-m-d'));
				$bulletin->update();
			}

			echo json_encode($bulletin->toArray());
			break;
		case 'addNivCpt' :
			//idEleve: idEleve, idTrimestre:idTrimestre, idPtCpt: idPtCpt, idNivCpt: idNivCpt, action: 'addNivCpt'
			$pointCptEleve = PointCptEleve::getById($_GET['idPtCpt'], $_GET['idEleve'], $_GET['idTrimestre']);

			// il n'existe pas, on le cr�e
			if (is_null($pointCptEleve->getIdPointCpt())){
				$pointCptEleve->setIdEleve($_GET['idEleve']);
				$pointCptEleve->setIdPointCpt($_GET['idPtCpt']);
 function countPublishedByDate($mydirname, $caldate)
 {
     if (preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2})/', $caldate, $datearr)) {
         $year = $datearr[1];
         $month = $datearr[2];
         $day = $datearr[3];
         $startday4sql = mktime(0, 0, 0, $month, $day, $year);
         $endday4sql = mktime(0, 0, 0, $month, $day + 1, $year);
         $criteria = array();
         $criteria[] = 'type > 0';
         $criteria[] = 'published > 0';
         $criteria[] = 'published <= ' . time();
         $criteria[] = '(expired = 0 OR expired > ' . time() . ')';
         $criteria[] = $startday4sql . ' <= published';
         $criteria[] = 'published < ' . $endday4sql;
         return Bulletin::countAll($mydirname, $criteria);
     }
     return false;
 }
 /**
  * 判断是否可修改
  * @access private
  * @return true|false
  */
 private function verify($status = '10000')
 {
     $id = get_post_value('bulletin_id');
     $m = new Bulletin();
     $m->clear();
     $m->setTable('vcb_bulletin');
     $m->setWhere('bulletin_id', '=', $id);
     $m->setWhere('status', '=', $status);
     $data = $m->getFieldValue('COUNT(*)');
     return $data > 0 ? false : true;
 }
Beispiel #16
0
<?php

require_once XOOPS_ROOT_PATH . '/class/template.php';
$myts =& MyTextSanitizer::getInstance();
if (function_exists('mb_http_output')) {
    mb_http_output('pass');
}
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(0);
if (!$tpl->is_cached("db:{$mydirname}_rss.html")) {
    $articles = Bulletin::getAllPublished($mydirname, 10, 0);
    if (is_array($articles)) {
        $tpl->assign('channel_title', bulletin_utf8_encode(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
        $tpl->assign('channel_link', XOOPS_URL . '/');
        $tpl->assign('channel_desc', bulletin_utf8_encode(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
        // $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
        $tpl->assign('channel_lastbuild', date('r'));
        // GIJ
        $tpl->assign('channel_webmaster', $xoopsConfig['adminmail']);
        $tpl->assign('channel_editor', $xoopsConfig['adminmail']);
        $tpl->assign('channel_category', 'News');
        $tpl->assign('channel_generator', 'XOOPS');
        $tpl->assign('channel_language', _LANGCODE);
        $tpl->assign('image_url', XOOPS_URL . '/images/logo.gif');
        $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.gif');
        if (empty($dimention[0])) {
            $width = 88;
        } else {
            $width = $dimention[0] > 144 ? 144 : $dimention[0];
        }
Beispiel #17
0
 function countPublishedByDate($mydirname, $caldate, $gpermited = false)
 {
     $gperm =& BulletinGP::getInstance($mydirname);
     if (preg_match('/([0-9]{4})-([0-9]{2})-([0-9]{2})/', $caldate, $datearr)) {
         $year = $datearr[1];
         $month = $datearr[2];
         $day = $datearr[3];
         $startday4sql = mktime(0, 0, 0, $month, $day, $year);
         $endday4sql = mktime(0, 0, 0, $month, $day + 1, $year);
         $criteria = array();
         //ver2.0	$criteria[] = 'type > 0';
         //ver3.0
         if ($gpermited && !$gperm->group_perm(2)) {
             $criteria[] = 'type > 0';
         } else {
             $criteria[] = 'type > 0';
         }
         $criteria[] = 'published > 0';
         $criteria[] = 'published <= ' . time();
         $criteria[] = '(expired = 0 OR expired > ' . time() . ')';
         $criteria[] = $startday4sql . ' <= published';
         $criteria[] = 'published < ' . $endday4sql;
         //ver3.0
         if ($gpermited) {
             $can_read_topic_ids = $gperm->makeOnTopics('can_read');
             $criteria[] = "topicid IN (" . implode(',', $can_read_topic_ids) . ")";
         }
         return Bulletin::countAll($mydirname, $criteria);
     }
     return false;
 }
     die(_NOPERM);
     exit;
 }
 $storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0;
 if (!empty($_POST['ok'])) {
     //check ticket
     if (!$xoopsGTicket->check()) {
         die('Ticket Error');
         exit;
     }
     $storyid = isset($_POST['storyid']) ? intval($_POST['storyid']) : 0;
     if (empty($storyid)) {
         die(_MD_EMPTYNODELETE);
         exit;
     }
     $story = new Bulletin($mydirname, $storyid);
     if (!$story) {
         die(_MD_EMPTYNODELETE);
         exit;
     }
     // 関連記事削除
     $story->relation->queryUnlinkById($storyid);
     $story->relation->queryDelete(1);
     $story->delete();
     xoops_comment_delete($xoopsModule->getVar('mid'), $storyid);
     xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'story', $storyid);
     if ($return == 1) {
         redirect_header($mydirurl . '/index.php?mode=admin&op=list', 1, _MD_DBPUDATED);
     } else {
         redirect_header($mydirurl . '/index.php', 1, _MD_DBPUDATED);
     }
Beispiel #19
0
function newSubmissions($action, $limit = 5, $start = 0)
{
    global $mydirname;
    switch ($action) {
        case 'newSubmissions':
            $articles = Bulletin::getAllSubmitted($mydirname);
            break;
        case 'autoStories':
            $articles = Bulletin::getAllAutoStory($mydirname);
            break;
        case 'Published':
            $articles = Bulletin::getAllPublished($mydirname, $limit, $start, 0, 0);
            break;
        case 'Expired':
            $articles = Bulletin::getAllExpired($mydirname, $limit, $start, 0, 0);
            break;
    }
    $ret = array();
    if (count($articles) > 0) {
        $i = 0;
        foreach ($articles as $article) {
            $ret[$i]['storyid'] = $article->getVar('storyid');
            $ret[$i]['title'] = RENDER_NEWS_TITLE($article);
            $ret[$i]['topic'] = $article->topic_title();
            $ret[$i]['uid'] = $article->getVar('uid');
            $ret[$i]['uname'] = $article->getUname();
            $ret[$i]['created'] = formatTimestamp($article->getVar('created'));
            $ret[$i]['published'] = formatTimestamp($article->getVar('published'));
            $ret[$i]['expired'] = $article->getVar('expired') > 0 ? formatTimestamp($article->getVar('expired')) : '---';
            $i++;
        }
    }
    return $ret;
}
Beispiel #20
0
}
$xoopsTpl->assign('years', $years);

// Assign list of articles
if ($fromyear != 0 && $frommonth != 0) {
	$xoopsTpl->assign('show_articles', true);
	$xoopsTpl->assign('currentmonth', $months_arr[$frommonth]);
	$xoopsTpl->assign('currentyear', $fromyear);

	// must adjust the selected time to server timestamp
	$timeoffset = $useroffset - $xoopsConfig['server_TZ'];
	$monthstart = mktime(0 - $timeoffset, 0, 0, $frommonth, 1, $fromyear);
	$monthend   = mktime(23 - $timeoffset, 59, 59, $frommonth + 1, 0, $fromyear);
	$monthend   = ($monthend > time()) ? time() : $monthend;

	$article = Bulletin::getArchives( $mydirname , $monthstart , $monthend , 0 , 0 , true ,true );
	$scount = count($article);

	for ( $i = 0; $i < $scount; $i++ ) {
		$story = array();
	    	$story['id']         = $article[$i]->getVar('storyid');
	    	$story['topic']      = $article[$i]->topic_title();
	    	$story['topicid']    = $article[$i]->getVar('topicid');
	    	$story['title']      = $article[$i]->getVar('title');
		$story['counter']    = $article[$i]->getVar('counter');
		$story['date']       = formatTimestamp($article[$i]->getVar('published'), $bulletin_date_format, $useroffset);
		$story['print_link'] = 'index.php?page=print&amp;storyid='.$article[$i]->getVar('storyid');

		// If you are using Tell A Frined module
		if($bulletin_use_tell_a_frined){
			$story['mail_link'] = XOOPS_URL.'/modules/tellafriend/index.php?target_uri='.rawurlencode( "$mydirurl/index.php?page=article&amp;storyid=".$article[$i]->getVar('storyid') ).'&amp;subject='.rawurlencode(sprintf(_MD_INTARTFOUND,$xoopsConfig['sitename'])) ;
Beispiel #21
0
<?php

$storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0;
$storypage = isset($_GET['storypage']) ? intval($_GET['storypage']) : 0;
// If there are no articles
if (empty($storyid) || !Bulletin::isPublishedExists($mydirname, $storyid)) {
    redirect_header($mydirurl . '/index.php', 2, _MD_NOSTORY);
    exit;
}
//Template
$xoopsOption['template_main'] = "{$mydirname}_article.html";
require_once XOOPS_ROOT_PATH . '/header.php';
$article = new Bulletin($mydirname, $storyid);
$gperm =& BulletinGP::getInstance($mydirname);
if (!$gperm->proceed4topic('can_read', $article->getVar('topicid'))) {
    redirect_header($mydirurl . '/index.php', 2, _NOPERM);
    exit;
}
$story['id'] = $storyid;
$story['posttime'] = formatTimestamp($article->getVar('published'), $bulletin_date_format);
$story['topicid'] = $article->getVar('topicid');
$story['topic'] = $article->topic_title();
$story['title'] = $article->getVar('title');
$story['text'] = $article->getVar('hometext');
$story['hits'] = $article->getVar('counter') + 1;
// To disp real view
$bodytext = $article->getVar('bodytext');
if ($bodytext != '') {
    $articletext = explode('[pagebreak]', $bodytext);
    $story_pages = count($articletext);
    $storypage = $story_pages - 1 >= $storypage ? $storypage : 0;
Beispiel #22
0
    $is_member = in_array($cid, $all_roles);
    if ($is_super || $is_member) {
        $bulletins = \Bulletin::orderBy('timestamp_queued', 'DESC')->where('company_id', '=', $cid)->get();
        $app->response->setStatus(200);
        echo $bulletins->toJson();
    } else {
        $app->response->setStatus(401);
    }
});
$app->post('/bulletin', function () use($app) {
    //admins and super admins can post bulletins
    $posty = $app->request->post();
    $is_admin = in_array($posty['company_id'], $app->jwt->role_admin);
    $is_super = is_super_admin();
    if ($is_super || $is_admin) {
        $bulletin = new \Bulletin();
        $bulletin->company_id = $posty['company_id'];
        $bulletin->from_user_id = $posty['sender_uid'];
        $bulletin->message_content = $posty['message_content'];
        $bulletin->timestamp_queued = time();
        $bulletin->timestamp_dequeued = time();
        $bulletin->save();
        $app->response->setStatus(200);
        //XXX XXX XXX
        ##    $app_id = '140562';
        ##    $app_key = '95129dfbfbc16ec4a811';
        ##    $app_secret = '1a5dac7bf5d8f1fd9c33';
        ##    $pusher = new Pusher( $app_key, $app_secret, $app_id );
        ##    $pusher->trigger( 'my_channel'.$posty['recipient_uid'], 'my_event', $posty['message_content']);
        // Send push notification to every member of the company
        $company = \Company::find($bulletin->company_id);
Beispiel #23
0
    <p class="note"><?php 
echo Yii::t('lang', 'Fields with <span class="required">*</span> are required.');
?>
</p>

	<?php 
echo $form->errorSummary($model);
?>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'top');
?>
        <?php 
$bulletins = Yii::app()->db->createCommand()->select('id, name')->from(Bulletin::model()->tableName())->queryAll();
echo $form->listBox($model, 'top', CHtml::listData($bulletins, 'id', 'name'), array('multiple' => 'true', 'size' => 10));
?>
        <?php 
echo $form->error($model, 'top');
?>
	</div>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'answer');
?>
        <?php 
$users = Yii::app()->db->createCommand()->select('id, username')->from(User::model()->tableName())->queryAll();
echo $form->listBox($model, 'answer', CHtml::listData($users, 'id', 'username'), array('multiple' => 'true', 'size' => 10));
?>
<?php

$storyid = isset($_GET['storyid']) ? intval($_GET['storyid']) : 0;
// 記事が存在しない場合
if (!Bulletin::isPublishedExists($mydirname, $storyid)) {
    redirect_header($mydirurl . '/index.php', 2, _MD_NOSTORY);
    exit;
}
require_once XOOPS_ROOT_PATH . '/class/template.php';
$article = new Bulletin($mydirname, $storyid);
$datetime = formatTimestamp($article->getVar('published'), $bulletin_date_format);
$tpl = new XoopsTpl();
$tpl->xoops_setTemplateDir(XOOPS_ROOT_PATH . '/themes');
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(0);
$tpl->assign('charset', _CHARSET);
$tpl->assign('sitename', htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
$tpl->assign('sitename', htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
$tpl->assign('slogan', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES));
$tpl->assign('xoops_version', htmlspecialchars(XOOPS_VERSION, ENT_QUOTES));
$tpl->assign('site_image', htmlspecialchars($bulletin_imgurl_on_print, ENT_QUOTES));
$tpl->assign('story_title', $article->getVar('title'));
$tpl->assign('story_date', $datetime);
$tpl->assign('story_topic', $article->topic_title());
$tpl->assign('story_hometext', $article->getVar('hometext'));
$tpl->assign('story_id', $storyid);
$tpl->assign('story_bodytext', $article->getDividedBodytext());
$tpl->assign('this_comes_from', sprintf(_MD_THISCOMESFROM, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
$tpl->assign($assing_array);
$tpl->display("db:{$mydirname}_print.html");
Beispiel #25
0
$bulletins = Bulletin::getByEleveTrimestreMatiere($eleve->getIdEleve(), $trimestre->getIdTrimestre(), 9);
foreach ($bulletins as $bulletin) {
    echo str_replace("\n", "<br>", $bulletin->getContenuBulletin()) . '<br>';
}
?>
			</td>
		</tr>
	</table>
	<br>
	<table width="100%" style="border: solid 2px black;">
		<col width="100%">
		<tr>
			<td width="100%">
				<u>Avis de l'&eacute;quipe &eacute;ducative : </u>
				<br>
			</td>
		</tr>
		<tr>
			<td>
				<?php 
$bulletins = Bulletin::getByEleveTrimestreMatiere($eleve->getIdEleve(), $trimestre->getIdTrimestre(), 20);
foreach ($bulletins as $bulletin) {
    echo str_replace("\n", "<br>", $bulletin->getContenuBulletin()) . '<br>';
}
?>
			</td>
		</tr>
	</table>

</page>
<?php

$com_itemid = isset($_GET['com_itemid']) ? intval($_GET['com_itemid']) : 0;
// 記事が無い場合
if (!Bulletin::isPublishedExists($mydirname, $com_itemid)) {
    redirect_header($mydirurl . '/index.php', 2, _MD_NOSTORY);
    exit;
}
$article = new Bulletin($mydirname, $com_itemid);
$com_replytext = _POSTEDBY . '&nbsp;<b>' . $article->getUname() . '</b>&nbsp;' . _DATE . '&nbsp;<b>' . formatTimestamp($article->getvar('published')) . '</b><br /><br />' . $article->getVar('hometext');
$bodytext = $article->getDividedBodytext();
if ($bodytext != '') {
    $com_replytext .= '<br /><br />' . $bodytext . '';
}
$com_replytitle = $article->getVar('title');
$_GET['page'] = 'article';
require XOOPS_ROOT_PATH . '/include/comment_new.php';