Exemplo n.º 1
0
 function attachfile_check_download_permission_plugin($target_id)
 {
     //$mydirname , $module_dirname , $mytrustdirname , $targettrustdirname
     // emulate d3diary
     $mytrustdirname = $this->target_trustdirname;
     $mytrustdirpath = XOOPS_TRUST_PATH . '/modules/' . $mytrustdirname;
     $mydirname = $this->target_dirname;
     include_once $mytrustdirpath . '/class/diary.class.php';
     include_once $mytrustdirpath . '/class/category.class.php';
     include_once $mytrustdirpath . '/class/d3diaryConf.class.php';
     $diary = new D3diaryDiary();
     $cat = new D3diaryCategory();
     $diary->bid = $target_id;
     $diary->readdb($mydirname);
     if (empty($diary->uid)) {
         return false;
     }
     $d3dConf =& D3diaryConf::getInstance($mydirname, (int) $diary->uid, "attachfile");
     $d3dConf->mPerm->get_allowed_openarea();
     $uid = $d3dConf->uid;
     $cat->uid = $diary->uid;
     $cat->cid = $cid = $diary->cid;
     $cat->getchildren($mydirname);
     $_tmp_isfriend = $d3dConf->mPerm->check_is_friend($diary->uid);
     $_tmp_isfriend2 = $d3dConf->mPerm->check_is_friend2($diary->uid);
     $_tmp_op = intval($d3dConf->dcfg->openarea);
     list($_got_op, $_slctd_op, $_tmp_gperms, $_tmp_pperms) = $d3dConf->mPerm->override_openarea($_tmp_op, intval($diary->openarea), intval($cat->openarea), $diary->vgids, $diary->vpids, $cat->vgids, $cat->vpids);
     $yd_data['openarea'] = $_got_op;
     // var_dump($_tmp_gperms); var_dump($_tmp_pperms);
     $yd_data['can_disp'] = $d3dConf->mPerm->can_display($diary->uid, $_got_op, $diary->create_time, $_tmp_isfriend, $_tmp_isfriend2, $_tmp_gperms, $_tmp_pperms);
     return $yd_data['can_disp'];
 }
Exemplo n.º 2
0
<?php

//--------------------------------------------------------------------
// Config
//--------------------------------------------------------------------
include_once dirname(dirname(__FILE__)) . '/class/category.class.php';
include_once dirname(dirname(__FILE__)) . '/class/d3diaryConf.class.php';
$category =& D3diaryCategory::getInstance();
global $xoopsUser;
if (is_object(@$xoopsUser)) {
    $uid = (int) $xoopsUser->getVar('uid');
} else {
    $uid = 0;
}
if ($uid <= 0) {
    redirect_header(XOOPS_URL . '/user.php', 2, _MD_IVUID_ERR);
    exit;
}
$d3dConf =& D3diaryConf::getInstance($mydirname, 0, "editcategory");
$func =& $d3dConf->func;
$myts =& $d3dConf->myts;
$mPerm =& $d3dConf->mPerm;
$gPerm =& $d3dConf->gPerm;
$mod_config =& $d3dConf->mod_config;
//--------------------------------------------------------------------
// GET Initial Values
//--------------------------------------------------------------------
$myname = "editcategory.php";
if ($uid <= 0) {
    redirect_header(XOOPS_URL . '/user.php', 2, _MD_IVUID_ERR);
    exit;
Exemplo n.º 3
0
function d3diary_showform($mydirname){
	global $photoObj, $diary, $xoopsOption, $func, $myts, $mPerm, $gPerm, $eparam, $d3diary_header ;
	global $yd_data, $del_pname, $form_photos, $_oe, $mod_config;

		$yd_data['bid'] = $diary->bid;
		$yd_data['uid'] = $diary->uid;

	// preview or photodel
	if( $eparam['is_prev']==1 ){
		$yd_data['cid']=$func->getpost_param('cid');
		if($yd_data['cid']>0){
			$category =& D3diaryCategory::getInstance();
			$category->uid = $diary->uid;
			$category->cid = intval($yd_data['cid']);
			$category->readdb($mydirname);
			$yd_data['cname'] = htmlSpecialChars($category->cname, ENT_QUOTES);
		}else{
			$yd_data['cname'] = htmlSpecialChars($myts->stripslashesGPC($func->getpost_param('cname')), ENT_QUOTES);
		}
		$yd_data['title'] = htmlSpecialChars($myts->stripslashesGPC($func->getpost_param('title')), ENT_QUOTES);
		$yd_data['openarea'] = $func->getpost_param('openarea');
		$yd_data['dohtml'] = $func->getpost_param('dohtml');
		$yd_data['update_ping'] = intval($func->getpost_param('update_ping'));

		$yd_data['diary'] = $func->stripPb_Tarea($myts->stripslashesGPC($func->getpost_param('diary')), $yd_data['dohtml']);
		$yd_data['diary4edit']= htmlSpecialChars($myts->stripslashesGPC($func->getpost_param('diary')), ENT_QUOTES);

	} else {
		$yd_data['cid'] = $diary->cid;
		$yd_data['title'] = htmlSpecialChars($diary->title, ENT_QUOTES);
		$yd_data['diary'] = $yd_data['diary4edit'] =htmlSpecialChars($diary->diary, ENT_QUOTES);
		$yd_data['openarea']=$diary->openarea;	// naao added
		$yd_data['dohtml'] = $diary->dohtml;
	}

	if ($func->getpost_param('reg_time')) {	//post by specified time
		$yd_data['reg_time']   = 1;
		d3diary_reg_time();
		$tmp_time = $yd_data['create_time_unformat'];
	} elseif(!empty($diary->create_time)){		//existing posted time
		$yd_data['create_time']   = $diary->create_time;
		$ctime = preg_split("/[-: ]/", $diary->create_time);
		$tmp_time = mktime($ctime[3],$ctime[4],$ctime[5],$ctime[1],$ctime[2],$ctime[0]);
		$yd_data['create_time_unformat'] = $tmp_time;
	} else {
		$tmp_time = time();
	}
		$week = intval($func->myformatTimestamp($tmp_time, "w"));
		$yd_data['year']   = $func->myformatTimestamp($tmp_time, "Y");
		$yd_data['month']   = intval($func->myformatTimestamp($tmp_time, "m"));
		$yd_data['day']   = intval($func->myformatTimestamp($tmp_time, "d"));
		$yd_data['time']   = $func->myformatTimestamp($tmp_time, "H:i");

		list( $arr_weeks, $arr_monthes, $arr_dclass, $arr_wclass ) = $func->initBoxArr();
		$yd_data['week'] = $arr_weeks [$week];
		$yd_data['b_month'] = $arr_monthes [$yd_data['month'] -1];
		$yd_data['dclass'] = $arr_dclass [$week];
		$yd_data['wclass'] = $arr_wclass [$week];

		$yd_data['group_list'] = array();
		$_oe = (int)$mod_config['use_open_entry'];
		if( $_oe == 10 || $_oe == 20 ) {
			$g_selcted = explode( "|", trim( $diary->vgids ,"|" ) );
			$group_list = array();
			foreach ( $gPerm->group_list as $_gid => $_name) {
		    	    if($_gid >= 4 && (in_array($_gid, $mPerm->mygids) || $mPerm->isadmin)){
				$group_list[$_gid]['gname'] = $_name;
				$group_list[$_gid]['gsel'] = (in_array( $_gid, $g_selcted )) ? 1 : 0;
			    }
			}
			$yd_data['group_list'] = $group_list;
		}

		if( $_oe == 20 ) {
			$p_selcted = array_map("intval", explode( "|", trim( $diary->vpids ,"|" )) );
			$pperm_list = implode( "," , $p_selcted ) ;
			$yd_data['pperm_list'] = $pperm_list;
			$unames = array(); $names = array();

			foreach ($p_selcted as $vpid) {
				if( $vpid >1 ) {
					$rtn = $func->get_xoopsuname($vpid);
					$uname = $rtn['uname'];
					$name = (!empty($rtn['name'])) ? $rtn['name'] : "" ;
					$unames[] = htmlspecialchars( $uname.'['.$vpid.'] ', ENT_QUOTES );
					$names[] = htmlspecialchars( $name.'['.$vpid.'] ', ENT_QUOTES );
				}
			}
			if( $mod_config['use_name'] == 1 ) {
				$yd_data['pperm_names'] = $names;
			} else {
				$yd_data['pperm_names'] = $unames;
			}
		}
}