Пример #1
0
function tellafriend_isAdminModule()
{
    global $xoopsUser, $xoopsModule, $xoopsmod;
    $bolOk = false;
    if ($xoopsUser) {
        $xoopsModule = XoopsModule::getByDirname("tellafriend");
        $bolOk = $xoopsUser->isAdmin($xoopsModule->mid());
    }
    return $bolOk;
}
Пример #2
0
function xwords_search_base( $mydirname, $queryarray, $andor, $limit, $offset, $userid )
	{
	include_once XOOPS_ROOT_PATH."/modules/$mydirname/class/xwords.textsanitizer.php" ;
	$myts =& XwordsTextSanitizer::getInstance();
	$xoopsDB =& Database::getInstance();
	$xoopsModule = XoopsModule::getByDirname("{$mydirname}");

	$ret = array();
	// XOOPS Search module
	$showcontext = empty( $_GET['showcontext'] ) ? 0 : 1 ;
	$select4con = $showcontext ? "definition, html, smiley, xcodes, breaks, " : "" ;

	$sql = "SELECT entryID, categoryID, term, $select4con uid, datesub FROM " . $xoopsDB -> prefix( "{$mydirname}_ent" ) . " WHERE datesub < '".time()."' AND datesub > '0' AND submit = '0' AND offline = '0' AND request = '0' "; 

	if ( $userid != 0 && strlen($userid) < 9) {
		$sql .= " AND uid = '".$userid."' ";
	}
	// because count() returns 1 even if a supplied variable
	// is not an array, we must check if $querryarray is really an array
	$count = count( $queryarray );
	if ( $count > 0 && is_array( $queryarray ) )
		{
		$sql .= "AND (";
		for ( $i = 0; $i < $count; $i++ )
			{
			$binary = (preg_match('/^[[:alnum:]]+$/',$queryarray[$i])) ? "":"BINARY";
			$sql .= ($i > 0) ? " $andor " : "";
			$sql .= (strlen($userid) > 8) ? "(term LIKE $binary '%$queryarray[$i]%')" : "(term LIKE $binary '%$queryarray[$i]%' OR proc LIKE $binary '%,%$queryarray[$i]%' OR definition LIKE $binary '%$queryarray[$i]%')" ;
			}
		$sql .= ') ';
		}
	$sql .= 'ORDER BY entryID DESC';
	$result = $xoopsDB -> query( $sql, $limit, $offset );
	$ret = array() ;
	$context = '' ;
	$i = 0;
	while ( $myrow = $xoopsDB -> fetchArray( $result ) )
		{
		$ret[$i]['image'] = 'images/xw.gif';
		$ret[$i]['link'] = 'entry.php?entryID='.$myrow['entryID'].'&amp;categoryID='.$myrow['categoryID'];
		$ret[$i]['title'] = $myrow['term'];
		$ret[$i]['time'] = $myrow['datesub'];
		$ret[$i]['uid'] = $myrow['uid'];
		if( function_exists( 'search_make_context' ) && $showcontext )
			{
			$context = strip_tags($myts->displayTarea($myrow['definition'], intval($myrow['html']), intval($myrow['smiley']), intval($myrow['xcodes']), 1, intval($myrow['breaks'])));
			$ret[$i]['context'] = search_make_context($context,$queryarray);
			}
		$i++;
		}
	return $ret;
	}
Пример #3
0
	function xwords_autolink_base($mydirname,$queryarray,$entryID)
		{
		$xoopsDB =& Database::getInstance();
		$ent_table = $xoopsDB -> prefix ("{$mydirname}_ent") ;
		$xoopsModule = XoopsModule::getByDirname("$mydirname");

		$searchtype = "";
		$count = 0;
		if ( is_array($queryarray) && $count = count($queryarray) )
			{
			if (preg_match('/^[[:alnum:]]+$/',$queryarray[0]))
				{
				$searchtype = " ((term LIKE '$queryarray[0]')";
				}
			else
				{
				$searchtype = " ((term LIKE BINARY '$queryarray[0]')";
				}
			for ( $i = 1; $i < $count; $i++ )
				{
				if (preg_match('/^[[:alnum:]]+$/',$queryarray[$i]))
					{
					$searchtype .= " OR (term LIKE '$queryarray[$i]')";
					}
				else
					{
					$searchtype .= " OR (term LIKE BINARY '$queryarray[$i]')";
					}
				}
			$searchtype .= ")";

			}

		$i = 0;
		$glossaryterms = array();
		$searchquery = $xoopsDB -> query ("SELECT * FROM $ent_table WHERE entryID != '$entryID' AND datesub < '".time()."' AND datesub > '0' AND submit = '0' AND offline = '0' AND request = '0' AND $searchtype ORDER BY term");
		$results = $xoopsDB -> getRowsNum ( $searchquery );
		if ($results)
			{
			$queryA = $xoopsDB -> query ("SELECT entryID, categoryID, term FROM $ent_table WHERE entryID != '$entryID' AND datesub < '".time()."' AND datesub > '0' AND submit = '0' AND offline = '0' AND request = '0' AND $searchtype ORDER BY term");
			while ( list( $glossaryentryID, $categoryID, $glossaryterm ) = $xoopsDB->fetchRow($queryA))
				{
				$glossaryterms[$i]['image'] = 'images/xw.gif';
				$glossaryterms[$i]['title'] = $glossaryterm;
				$glossaryterms[$i]['link'] = "entry.php?entryID=".$glossaryentryID."&amp;categoryID=".$categoryID;
				$i++;
				}
			}
		return $glossaryterms;
Пример #4
0
function uri_to_name($uri)
{
    if ($uri == URI_BASE) {
        return _TB_TOPPAGE;
    }
    if (preg_match(REG_MOD, $uri, $d)) {
        // module pages
        $mod = XoopsModule::getByDirname($d[1]);
        $name = is_object($mod) ? $mod->getVar("name") : $d[1];
        $rest = myurldecode(preg_replace(REG_MOD, '', $uri));
        $rest = str_replace("index.php?", "", $rest);
        return $name . ($rest == "" ? "" : " - ") . $rest;
    }
    return $uri;
}
Пример #5
0
function b_search_xwords($queryarray, $andor, $limit, $offset, $userid)
{
    $xoopsDB =& Database::getInstance();
    $xoopsModule = XoopsModule::getByDirname("xwords");
    $ret = array();
    if ($userid != 0) {
        return $ret;
    }
    $showcontext = isset($_GET['showcontext']) ? $_GET['showcontext'] : 0;
    if ($showcontext == 1) {
        $sql = "SELECT entryID, term, proc, definition, uid, datesub FROM " . $xoopsDB->prefix("xwords_ent") . " WHERE submit = 0 AND offline = 0 ";
    } else {
        $sql = "SELECT entryID, term, proc, uid, datesub FROM " . $xoopsDB->prefix("xwords_ent") . " WHERE submit = 0 AND offline = 0 ";
    }
    // because count() returns 1 even if a supplied variable
    // is not an array, we must check if $querryarray is really an array
    $count = count($queryarray);
    if ($count > 0 && is_array($queryarray)) {
        $sql .= "AND ((term LIKE '%{$queryarray['0']}%' OR proc LIKE '%,%{$queryarray['0']}%' OR definition LIKE '%{$queryarray['0']}%')";
        for ($i = 1; $i < $count; $i++) {
            $sql .= " {$andor} ";
            $sql .= "(term LIKE '%{$queryarray[$i]}%' OR proc LIKE '%,%{$queryarray[$i]}%' OR definition LIKE '%{$queryarray[$i]}%')";
        }
        $sql .= ") ";
    }
    $sql .= "ORDER BY entryID DESC";
    $result = $xoopsDB->query($sql, $limit, $offset);
    $i = 0;
    $myts =& MyTextSanitizer::getInstance();
    while ($myrow = $xoopsDB->fetchArray($result)) {
        $ret[$i]['image'] = 'images/wb.png';
        $ret[$i]['link'] = 'entry.php?entryID=' . $myrow['entryID'];
        $ret[$i]['title'] = $myrow['term'];
        $ret[$i]['time'] = $myrow['datesub'];
        $ret[$i]['uid'] = $myrow['uid'];
        if (!empty($myrow['definition'])) {
            $context = $myrow['definition'];
            $context = strip_tags($myts->displayTarea(strip_tags($context)));
            $ret[$i]['context'] = search_make_context($context, $queryarray);
        }
        $i++;
    }
    return $ret;
}
Пример #6
0
function langDropdown()
{
    $content = '';
    $time = time();
    if (!isset($_SESSION['XoopsMLcontent']) && @$_SESSION['XoopsMLcontent_expire'] < $time) {
        include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
        $xlanguage =& XoopsModule::getByDirname("xlanguage");
        if (is_object($xlanguage) && $xlanguage->getVar('isactive')) {
            include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/vars.php';
            include_once XOOPS_ROOT_PATH . '/modules/xlanguage/include/functions.php';
            $xlanguage_handler =& xoops_getmodulehandler('language', 'xlanguage');
            $xlanguage_handler->loadConfig();
            $lang_list =& $xlanguage_handler->getAllList();
            $content .= '<select name="mlanguages" id="mlanguages">';
            $content .= '<option value="">{#xoopsmlcontent_dlg.sellang}</option>';
            if (is_array($lang_list) && count($lang_list) > 0) {
                foreach (array_keys($lang_list) as $lang_name) {
                    $lang =& $lang_list[$lang_name];
                    $content .= '<option value="' . $lang['base']->getVar('lang_code') . '">' . $lang['base']->getVar('lang_name') . '</option>';
                }
            }
            $content .= '</select>';
        } elseif (defined('EASIESTML_LANGS') && defined('EASIESTML_LANGNAMES')) {
            $easiestml_langs = explode(',', EASIESTML_LANGS);
            $langnames = explode(',', EASIESTML_LANGNAMES);
            $lang_options = '';
            $content .= '<select name="mlanguages" id="mlanguages">';
            $content .= '<option value="">{#xoopsmlcontent_dlg.sellang}</option>';
            foreach ($easiestml_langs as $l => $lang) {
                $content .= '<option value="' . $lang . '">' . $langnames[$l] . '</option>';
            }
            $content .= '</select>';
        } else {
            $content .= '<input type="text" name="mlanguages" />';
        }
        $_SESSION['XoopsMLcontent'] = $content;
        $_SESSION['XoopsMLcontent_expire'] = $time + 300;
    }
    echo $_SESSION['XoopsMLcontent'];
}
Пример #7
0
 /**
  * Outputs an html selectbox 
  *
  * Outputs an html selectbox containing the whole tree ($root=0) or a specified sub-tree.
  * If $recurse is false, the box will only contain direct children of the specified <i>$root</i>.
  *
  * @param string  $title Database field to use for elements title
  * @param string  $order Database field to use for ordering elements
  * @param integer $root Element to use as root (0 for all the tree)
  * @param boolean $recurse
  * @param integer $preset_id Originally selected element
  * @param boolean $showroot Show root element as first one
  * @param string  $sel_name HTML select element name
  * @param string  $onchange Value of HTML onchange attribute
  * @author Kazumi Ono
  * @author Catzwolf
  * @author Skalpa Keo
  */
 function makeMyRootedSelBox($title, $order = "", $root = 0, $recurse = false, $preset_id = 0, $showroot = 0, $sel_name = "", $onchange = "")
 {
     global $xoopsUser, $xoopsModule;
     $admincheck = true;
     if (empty($sel_name)) {
         $sel_name = $this->id;
     }
     $myts =& MyTextSanitizer::getInstance();
     echo "<select name='" . $sel_name . "'";
     if ($onchange != "") {
         echo ' onchange="' . $onchange . '"';
     }
     echo ">\n";
     // Get root category name and check for access
     if ($root == 0) {
         $roottitle = '-----------';
         $rootaccess = 1;
     } else {
         $rootres = $this->db->query("SELECT {$title}, groupid, editaccess FROM {$this->table} WHERE {$this->id}={$root}");
         if (list($roottitle, $rootaccess) = $this->db->fetchRow($rootres)) {
             $rootaccess = checkAccess($rootaccess);
         } else {
             $rootaccess = 0;
         }
     }
     if ($rootaccess) {
         if ($showroot) {
             echo "<option value='{$root}'>{$roottitle}</option>\n";
         }
         $xoopsModule = XoopsModule::getByDirname("wfsection");
         $sql = "SELECT {$this->id}, {$title}, groupid, editaccess  FROM {$this->table} WHERE {$this->pid}={$root}";
         if ($order != "") {
             $sql .= " ORDER BY {$order}";
         }
         $result = $this->db->query($sql);
         while (list($catid, $name, $groupid, $editaccess) = $this->db->fetchRow($result)) {
             echo $string;
             if (checkAccess($groupid)) {
                 $sel = $catid == $preset_id ? " selected='selected'" : "";
                 if ($root != 0 && $showroot) {
                     $name = "--&nbsp;{$name}";
                 }
                 echo "<option value='{$catid}'{$sel}>{$name}</option>\n";
                 if ($recurse) {
                     $arr = $this->getChildTreeArray($catid, $order);
                     foreach ($arr as $option) {
                         $option['prefix'] = str_replace(".", "--", $option['prefix']);
                         $catpath = $option['prefix'] . "&nbsp;" . $myts->makeTboxData4Show($option[$title]);
                         if ($root != 0 && $showroot) {
                             $catpath = "--{$catpath}";
                         }
                         $sel = $option[$this->id] == $preset_id ? " selected='selected'" : "";
                         echo "<option value='{$option[$this->id]}'{$sel}>{$catpath}</option>\n";
                     }
                 }
             }
         }
     }
     echo "</select>\n";
 }
 * @license     	GNU GPL 3 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
 * @author      	Simon Antony Roberts (wishcraft) <*****@*****.**>
 * @category  		resources
 * @description 	Module & Theme Resource Download Harvester and Loader
 * @version			1.0.1
 * @see				1.0.1
 * @link        	https://github.com/ChronolabsCooperative/Xoops25ModuleResources
 * @link        	https://github.com/ChronolabsCooperative/Xoops26ModuleResources
 * @see				http://internetfounder.wordpress.com
 */
// Include XOOPS control panel header
include_once dirname(dirname(dirname(__FILE__))) . '/include/cp_header.php';
// Check user rights
if (is_object($xoopsUser)) {
    $admintest = 0;
    $xoopsModule =& XoopsModule::getByDirname(basename(__DIR__));
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL, 3, _NOPERM);
        exit;
    }
    $admintest = 1;
} else {
    redirect_header(XOOPS_URL, 3, _NOPERM);
    exit;
}
// XOOPS Class
include_once $GLOBALS['xoops']->path('/class/pagenav.php');
include_once $GLOBALS['xoops']->path('/class/template.php');
include_once $GLOBALS['xoops']->path('/class/xoopsformloader.php');
include_once $GLOBALS['xoops']->path('/class/xoopslists.php');
include_once $GLOBALS['xoops']->path('/class/xoopsrequest.php');
Пример #9
0
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
// Author: Simon Roberts (AKA wishcraft)                                     //
// URL: http://www.chronolabs.org.au                                         //
// Project: The XOOPS Project                                                //
// ------------------------------------------------------------------------- //
include_once "../../../mainfile.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
include_once XOOPS_ROOT_PATH . "/include/cp_functions.php";
include_once '../include/functions.php';
if ($xoopsUser) {
    $xoopsModule = XoopsModule::getByDirname('spiders');
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL . "/", 3, _NOPERM);
        exit;
    }
} else {
    redirect_header(XOOPS_URL . "/", 3, _NOPERM);
    exit;
}
if (file_exists("../language/" . $xoopsConfig['language'] . "/admin.php")) {
    include_once "../language/" . $xoopsConfig['language'] . "/admin.php";
} else {
    include_once "../language/english/admin.php";
}
$myts =& MyTextSanitizer::getInstance();
Пример #10
0
<?php

include "../../../mainfile.php";
include_once XOOPS_ROOT_PATH . "/" . "include/cp_functions.php";
include_once XOOPS_ROOT_PATH . "/" . "class/xoopsmodule.php";
if ($xoopsUser) {
    $xoopsModule = XoopsModule::getByDirname("uskolaxgallery");
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL . "/", 3, _NOPERM);
        exit;
    }
} else {
    redirect_header(XOOPS_URL . "/", 3, _NOPERM);
    exit;
}
if (file_exists("../language/" . $xoopsConfig['language'] . "/admin.php")) {
    include "../language/" . $xoopsConfig['language'] . "/admin.php";
} else {
    include "../language/english/admin.php";
}
Пример #11
0
<?php

include "../../../mainfile.php";
include XOOPS_ROOT_PATH . "/include/cp_functions.php";
include_once XOOPS_ROOT_PATH . "/modules/tutorials/include/functions.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
if ($xoopsUser) {
    $xoopsModule = XoopsModule::getByDirname("tutorials");
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL . "/", 3, _NOPERM);
        exit;
    }
} else {
    redirect_header(XOOPS_URL . "/", 3, _NOPERM);
    exit;
}
if (file_exists("../language/" . $xoopsConfig['language'] . "/main.php")) {
    include "../language/" . $xoopsConfig['language'] . "/main.php";
} else {
    include "../language/english/main.php";
}
Пример #12
0
    redirect_header(XOOPS_URL, 2, _NOPERM);
}
echo "<style> \n\t\t\t\t\t.encours {background-color: #E6FFE6; padding: 5px;}\n\t\t\t\t\t.solde {background-color: #CAFAFF; padding: 5px;}\n\t\t\t\t\t.archive {background-color: #CAE2FF; padding: 5px;}\n\t\t\t\t\t</style>";
if ($etat == 0) {
    $etat_des = _MD_INTER_ENCOURS;
    $style = 'encours';
}
if ($etat == 1) {
    $etat_des = _MD_INTER_SOLDEES;
    $style = 'solde';
}
if ($etat == 2) {
    $etat_des = _MD_INTER_ARCHIVEES;
    $style = 'archive';
}
$xoopsModule = XoopsModule::getByDirname("repair");
if ($xoopsUser) {
    if ($xoopsUser->isAdmin($xoopsModule->mid())) {
        echo "<table width='100%'><tr><td align='center'><img src='images/logo.jpg' alt='' title=''></td><a href='admin/index.php' target='_blanck'><img src='images/admin.gif' alt='Admin'></a></tr></table><br />\n";
    } else {
        echo "<table width='100%'><tr><td align='center'><img src='images/logo.jpg' alt='' title=''></td></tr></table><br />\n";
    }
} else {
    echo "<table width='100%'><tr><td align='center'><img src='images/logo.jpg' alt='' title=''></td></tr></table><br />\n";
}
echo "<h1>" . $etat_des . "</h1>";
// on affiche les interventions en cours
$result = $xoopsDB->query("SELECT id, id_voiture, date_debut, date_fin, delai, solde  FROM " . $xoopsDB->prefix("garage_intervention") . " WHERE solde =" . $etat);
echo "<table class=\"outer\" width=\"100%\">\n" . "<th><center>" . _MD_INTER_DELAI . "</center></th>\n" . "<th><center>" . _MD_VEHICULE . "</center></th>\n" . "<th><center>" . _MD_VEHICULE_PROPRIETAIRE . "</center></th>\n" . "<th colspan=\"2\"><center>" . _MD_ACTION . "</center></th>\n";
while ((list($id_inter, $id_voiture, $date_debut, $date_fin, $delai, $solde) = $xoopsDB->fetchRow($result)) != false) {
    // recup des infos du vehicule et proprio
Пример #13
0
//                XOOPS - PHP Content Management System    				//
//                    Copyright (c) 2004 XOOPS.org                       	//
//                       <http://www.xoops.org/>                              //
//                   										//
//                  Authors :									//
//						- solo (www.wolfpackclan.com)         	//
//						- christian (www.edom.org)		 	//
//						- herve (www.herve-thouzard.com)   		//
//                  edito v2.2								//
//  ------------------------------------------------------------------------ 	//
include_once "../../../mainfile.php";
include_once '../../../include/cp_header.php';
//include_once("'../../../include/cp_header.php");
include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/include/xoopscodes.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
include_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php';
$eh = new ErrorHandler();
if (is_object($xoopsUser)) {
    $xoopsModule = XoopsModule::getByDirname("multiMenu");
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL . "/", 1, _NOPERM);
        exit;
    }
} else {
    redirect_header(XOOPS_URL . "/", 1, _NOPERM);
    exit;
}
$myts =& MyTextSanitizer::getInstance();
Пример #14
0
function categoryEdit( $categoryID = '' )
	{
	global $mydirname,$MYDIRNAME,$cat_table,$ent_table,$xoopsConfig,$xoopsGTicket; 
	$xoopsDB =& Database::getInstance();
	$xoopsModule = XoopsModule::getByDirname("$mydirname");
	$myts =& MyTextSanitizer::getInstance();

	$categoryID = !empty( $_GET['categoryID'] ) ? intval($_GET['categoryID']) : '';
	// If there is a parameter, and the id exists, retrieve data: were editing a column
	if ( $categoryID > 0 )
		{
		$result = $xoopsDB -> query( "SELECT categoryID, name, description, total, weight FROM $cat_table WHERE categoryID = '$categoryID'" );
		if ( $xoopsDB -> getRowsNum( $result ) == 0 )
			{
			redirect_header( "index.php", 1, constant("_AM_{$MYDIRNAME}_NOTUPDATED") );
			}

		list( $categoryID, $name, $description, $total, $weight ) = $xoopsDB -> fetchrow( $result );

		$categoryID = intval($categoryID);
		$name = $myts -> htmlSpecialChars( $name );
		$description = $myts -> htmlSpecialChars( $description );
		$total = intval($total);
		$weight = intval($weight);

		xoops_cp_header();
		adminMenu(1, constant("_AM_{$MYDIRNAME}_CATS")."&nbsp;&raquo;&nbsp;".constant("_AM_{$MYDIRNAME}_MODIFY"));
		include('./mymenu.php');
		echo "<fieldset style='margin:1em 0em 0em 0em;border:1px solid #778;'><legend style='font-weight: bold; color: #900;'>" . constant("_AM_{$MYDIRNAME}_CATS") . "</legend><br />\n";
		$sform = new XoopsThemeForm( constant("_AM_{$MYDIRNAME}_MODCAT") . ": $name" , "op", xoops_getenv( 'PHP_SELF' ) );
		}
	else
		{
		$weight = 1;
		$name = $description = '';

		xoops_cp_header();
		adminMenu(1, constant("_AM_{$MYDIRNAME}_CATS")."&nbsp;&raquo;&nbsp;".constant("_AM_{$MYDIRNAME}_CREATE"));
		include('./mymenu.php');
		echo "<fieldset style='margin:1em 0em 0em 0em;border:1px solid #778;'><legend style='font-weight: bold; color: #900;'>" . constant("_AM_{$MYDIRNAME}_CATS") . "</legend><br />\n";
		$sform = new XoopsThemeForm( constant("_AM_{$MYDIRNAME}_NEWCAT"), "op", xoops_getenv( 'PHP_SELF' ) );
		}

	$sform -> setExtra( 'enctype="multipart/form-data"' );
	$sform -> addElement( new XoopsFormText( constant("_AM_{$MYDIRNAME}_CATNAME"), 'name', 50, 80, $name ), true );
	$sform -> addElement( new XoopsFormDhtmlTextArea( constant("_AM_{$MYDIRNAME}_CATDESCRIPT"), 'description', $description, 7, 60 ) );
//	$sform -> addElement( new XoopsFormTextArea( constant("_AM_{$MYDIRNAME}_CATDESCRIPT"), 'description', $description, 7, 60 ) );
	$sform -> addElement( new XoopsFormText( constant("_AM_{$MYDIRNAME}_CATPOSIT"), 'weight', 4, 4, $weight ), true );
	$sform -> addElement( new XoopsFormHidden( 'categoryID', $categoryID ) );

	$button_tray = new XoopsFormElementTray( '', '' );
	$hidden = new XoopsFormHidden( 'op', 'addcat' );
	$button_tray -> addElement( $hidden );

	// No ID for column -- then itz new column, button says 'Create'
	if ( !$categoryID )
		{
		$butt_create = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CREATE"), 'submit' );
		$butt_create->setExtra('onclick="this.form.elements.op.value=\'addcat\'"');
		$button_tray->addElement( $butt_create );

		$butt_clear = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CLEAR"), 'reset' );
		$button_tray->addElement( $butt_clear );

		$butt_cancel = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CANCEL"), 'button' );
		$butt_cancel->setExtra('onclick="history.go(-1)"');
		$button_tray->addElement( $butt_cancel );
		}
	else // button says 'Update'
		{
		$butt_create = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_MODIFY"), 'submit' );
		$butt_create->setExtra('onclick="this.form.elements.op.value=\'addcat\'"');
		$button_tray->addElement( $butt_create );

		$butt_cancel = new XoopsFormButton( '', '', constant("_AM_{$MYDIRNAME}_CANCEL"), 'button' );
		$butt_cancel->setExtra('onclick="history.go(-1)"');
		$button_tray->addElement( $butt_cancel );
		}

	$button_tray->addElement( $xoopsGTicket->getTicketXoopsForm( __LINE__ ) );//GIJ
	$sform -> addElement( $button_tray );
	$sform -> display();
	unset( $hidden );
	echo "</fieldset>\n";
	xoops_cp_footer();
	}
Пример #15
0
     if ($ugroup['can_create_albums'] == 1) {
         $USER_DATA['can_create_albums'] = $ugroup['can_create_albums'];
     }
     if ($ugroup['pub_upl_need_approval'] == 0) {
         $USER_DATA['pub_upl_need_approval'] = $ugroup['pub_upl_need_approval'];
     }
     if ($ugroup['priv_upl_need_approval'] == 0) {
         $USER_DATA['priv_upl_need_approval'] = $ugroup['priv_upl_need_approval'];
     }
     #mcleines
     if ($ugroup['group_quota'] > $USER_DATA['group_quota']) {
         $USER_DATA['group_quota'] = $ugroup['group_quota'];
     }
 }
 // while
 $xoopsModule = XoopsModule::getByDirname('xcgal');
 if ($xoopsUser->isAdmin($xoopsModule->mid())) {
     define('USER_IS_ADMIN', 1);
 } else {
     define('USER_IS_ADMIN', 0);
 }
 //$USER_DATA = $xoopsDB->fetchArray($results);
 $USER_DATA['user_email'] = $xoopsUser->email();
 define('USER_ID', $xoopsUser->getVar('uid'));
 define('USER_NAME', $xoopsUser->uname());
 define('USER_CAN_SEND_ECARDS', (int) $USER_DATA['can_send_ecards']);
 define('USER_CAN_RATE_PICTURES', (int) $USER_DATA['can_rate_pictures']);
 define('USER_CAN_POST_COMMENTS', (int) $USER_DATA['can_post_comments']);
 define('USER_CAN_UPLOAD_PICTURES', (int) $USER_DATA['can_upload_pictures']);
 define('USER_CAN_CREATE_ALBUMS', (int) $USER_DATA['can_create_albums']);
 define('USER_CAN_SEE_FULL', 1);
Пример #16
0
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
// Author: D.J.(phppp) php_pp@hotmail.com                                    //
// URL: http://www.xoops.org.cn                                              //
// ------------------------------------------------------------------------- //
$module_handler =& xoops_gethandler('module');
$xoopsModule =& XoopsModule::getByDirname('xlanguage');
$moduleInfo =& $module_handler->get($xoopsModule->getVar('mid'));
$pathImageAdmin = $moduleInfo->getInfo('icons32');
$adminmenu = array();
$i = 1;
$adminmenu[$i]['title'] = _MI_XLANGUAGE_ADMENU_HOME;
$adminmenu[$i]['link'] = 'admin/index.php';
$adminmenu[$i]['icon'] = '../../' . $pathImageAdmin . '/home.png';
$i++;
$adminmenu[$i]['title'] = _MI_XLANGUAGE_ADMENU0;
$adminmenu[$i]['link'] = 'admin/main.php';
$adminmenu[$i]['icon'] = '../../' . $pathImageAdmin . '/manage.png';
$i++;
$adminmenu[$i]['title'] = _MI_XLANGUAGE_ADMENU1;
$adminmenu[$i]['link'] = 'admin/main.php?op=add&type=base';
$adminmenu[$i]['icon'] = '../../' . $pathImageAdmin . '/add.png';
Пример #17
0
<?php

// start hack by Trabis
if (!class_exists('ProtectorRegistry')) {
    exit('Registry not found');
}
$registry = ProtectorRegistry::getInstance();
$mydirname = $registry->getEntry('mydirname');
$mydirpath = $registry->getEntry('mydirpath');
$language = $registry->getEntry('language');
// end hack by Trabis
$module_handler = xoops_getHandler('module');
$xoopsModule = XoopsModule::getByDirname($mydirname);
$moduleInfo = $module_handler->get($xoopsModule->getVar('mid'));
$pathIcon32 = $moduleInfo->getInfo('icons32');
$constpref = '_MI_' . strtoupper($mydirname);
$adminmenu = array(array('title' => constant($constpref . '_ADMINHOME'), 'link' => 'admin/index.php', 'icon' => '../../' . $pathIcon32 . '/home.png'), array('title' => constant($constpref . '_ADMININDEX'), 'link' => 'admin/center.php?page=center', 'icon' => '../../' . $pathIcon32 . '/firewall.png'), array('title' => constant($constpref . '_ADVISORY'), 'link' => 'admin/advisory.php', 'icon' => '../../' . $pathIcon32 . '/security.png'), array('title' => constant($constpref . '_PREFIXMANAGER'), 'link' => 'admin/prefix_manager.php', 'icon' => '../../' . $pathIcon32 . '/manage.png'), array('title' => constant($constpref . '_ADMINABOUT'), 'link' => 'admin/about.php', 'icon' => '../../' . $pathIcon32 . '/about.png'));
$adminmenu4altsys = array(array('title' => constant($constpref . '_ADMENU_MYBLOCKSADMIN'), 'link' => 'admin/main.php?mode=admin&lib=altsys&page=myblocksadmin'), array('title' => _PREFERENCES, 'link' => 'admin/main.php?mode=admin&lib=altsys&page=mypreferences'));
Пример #18
0
} else {
    @($op = "default");
}
switch ($op) {
    // Display post
    case 'display_post':
        global $xoopsDB;
        $GLOBALS['xoopsLogger']->activated = false;
        include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
        include_once XOOPS_ROOT_PATH . '/class/xoopsmodule.php';
        include_once XOOPS_ROOT_PATH . '/modules/system/include/functions.php';
        $tables = array();
        // Count comments (approved only: com_status == XOOPS_COMMENT_ACTIVE)
        $tables[] = array('table_name' => 'xoopscomments', 'uid_column' => 'com_uid', 'criteria' => new Criteria('com_status', XOOPS_COMMENT_ACTIVE));
        // Count forum posts
        if (XoopsModule::getByDirname("newbb")) {
            $tables[] = array('table_name' => 'bb_posts', 'uid_column' => 'uid');
        }
        $uid = system_CleanVars($_REQUEST, 'uid', int);
        $total_posts = 0;
        foreach ($tables as $table) {
            $criteria = new CriteriaCompo();
            $criteria->add(new Criteria($table['uid_column'], $uid));
            if (!empty($table['criteria'])) {
                $criteria->add($table['criteria']);
            }
            $sql = "SELECT COUNT(*) AS total FROM " . $xoopsDB->prefix($table['table_name']) . ' ' . $criteria->renderWhere();
            if ($result = $xoopsDB->query($sql)) {
                if ($row = $xoopsDB->fetchArray($result)) {
                    $total_posts = $total_posts + $row['total'];
                }
Пример #19
0
//  ------------------------------------------------------------------------ 	//
function quoteHandling($text)
{
    return $text;
    //return str_replace("'","\'",$text);
}
include_once "../../../mainfile.php";
include_once XOOPS_ROOT_PATH . "/include/cp_header.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/include/xoopscodes.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
include_once XOOPS_ROOT_PATH . "/class/module.errorhandler.php";
$tableprefix = XOOPS_DB_PREFIX . "_";
$tableuser = $tableprefix . "users";
$thstyle = "style='text-align: center;' ";
$tdstyle[0] = "class='even' style='text-align:center;' ";
$tdstyle[1] = "class='odd' style='text-align:center;'";
$eh = new ErrorHandler();
if (is_object($xoopsUser)) {
    $xoopsModule = XoopsModule::getByDirname("approval");
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL . "/", 1, _NOPERM);
        exit;
    }
} else {
    redirect_header(XOOPS_URL . "/", 1, _NOPERM);
    exit;
}
$myts =& MyTextSanitizer::getInstance();
Пример #20
0
 * Licence: GNU
 */
// XOOPS2 - Xwords 0.42
// Presented by WEBMASTER @ KANPYO.NET, 2004.

$mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
$MYDIRNAME = strtoupper($mydirname);

include ( '../../../include/cp_header.php' );
include_once ( XOOPS_ROOT_PATH."/modules/$mydirname/include/functions.php" );
include_once ( XOOPS_ROOT_PATH."/class/xoopsmodule.php" );
include_once ( XOOPS_ROOT_PATH."/class/xoopstree.php" );
include_once ( XOOPS_ROOT_PATH."/class/xoopslists.php" );
include_once ( XOOPS_ROOT_PATH."/class/xoopsformloader.php" );

$xoopsModule = XoopsModule::getByDirname("$mydirname");
$cat_table = $xoopsDB -> prefix ("{$mydirname}_cat") ;
$ent_table = $xoopsDB -> prefix ("{$mydirname}_ent") ;

if ( file_exists(XOOPS_ROOT_PATH."/modules/$mydirname/language/".$xoopsConfig['language']."/main.php") ) 
	{
	include XOOPS_ROOT_PATH."/modules/$mydirname/language/".$xoopsConfig['language']."/main.php";
	}
else 
	{
	include XOOPS_ROOT_PATH."/modules/$mydirname/language/english/main.php";
	}

if( ! class_exists( 'XwordsTextSanitizer' ) )
	{
	include_once( XOOPS_ROOT_PATH . "/modules/$mydirname/class/xwords.textsanitizer.php" ) ;
Пример #21
0
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
// Author: Tobias Liegl (AKA CHAPI)                                          //
// Site: http://www.chapi.de                                                 //
// Project: The XOOPS Project                                                //
// ------------------------------------------------------------------------- //
include_once "../../../mainfile.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
include_once XOOPS_ROOT_PATH . "/include/cp_functions.php";
include_once XOOPS_ROOT_PATH . "/include/xoopscodes.php";
if (file_exists("../language/" . $xoopsConfig['language'] . "/modinfo.php")) {
    include "../language/" . $xoopsConfig['language'] . "/modinfo.php";
} else {
    include "../language/english/modinfo.php";
}
if ($xoopsUser) {
    $xoopsModule = XoopsModule::getByDirname(_MI_JSDL_DIR_NAME);
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL . "/", 3, _NOPERM);
        exit;
    }
} else {
    redirect_header(XOOPS_URL . "/", 3, _NOPERM);
    exit;
}
if (file_exists("../language/" . $xoopsConfig['language'] . "/admin.php")) {
    include "../language/" . $xoopsConfig['language'] . "/admin.php";
} else {
    include "../language/english/admin.php";
}
Пример #22
0
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
$module_handler =& xoops_gethandler('module');
$xoopsModule =& XoopsModule::getByDirname('contact');
$moduleInfo =& $module_handler->get($xoopsModule->getVar('mid'));
//$pathImageAdmin = XOOPS_URL .'/'. $moduleInfo->getInfo('dirmoduleadmin').'/images/admin';
$pathImageAdmin = $moduleInfo->getInfo('icons32');
$adminmenu = array();
$i = 1;
$adminmenu[$i]["title"] = _MI_CONTACT_MENU_00;
$adminmenu[$i]["link"] = "admin/index.php";
$adminmenu[$i]["desc"] = _MI_CONTACT_ADMIN_HOME_DESC;
$adminmenu[$i]["icon"] = '../../' . $pathImageAdmin . '/home.png';
$i++;
$adminmenu[$i]["title"] = _MI_CONTACT_ADMIN_ABOUT;
$adminmenu[$i]["link"] = "admin/about.php";
$adminmenu[$i]["desc"] = _MI_CONTACT_ADMIN_ABOUT_DESC;
$adminmenu[$i]["icon"] = '../../' . $pathImageAdmin . '/about.png';
Пример #23
0
}
//if (isset($fct) && $fct == "users") {
//	$xoopsOption['pagetype'] = "user";
//}
include "../../../mainfile.php";
// include "../../mainfile.php"; GIJ
include XOOPS_ROOT_PATH . "/include/cp_functions.php";
if (file_exists(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin.php")) {
    include XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin.php";
} else {
    include XOOPS_ROOT_PATH . "/modules/system/language/english/admin.php";
}
include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
$admintest = 0;
if (is_object($xoopsUser)) {
    $xoopsModule =& XoopsModule::getByDirname("system");
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL . '/user.php', 3, _NOPERM);
        exit;
    }
    $admintest = 1;
} else {
    redirect_header(XOOPS_URL . '/user.php', 3, _NOPERM);
    exit;
}
// include system category definitions
include_once XOOPS_ROOT_PATH . "/modules/system/constants.php";
$error = false;
if ($admintest != 0) {
    if (isset($fct) && $fct != '') {
        if (file_exists(XOOPS_ROOT_PATH . "/modules/system/admin/" . $fct . "/xoops_version.php")) {
}
$play_file = "play.gif";
$xoopsDB->queryF("\r\n\t\tUPDATE " . $xoopsDB->prefix('debaser_files') . " \r\n\t\tSET views = views+1 \r\n\t\tWHERE xfid = " . $id . "");
$addinfo = stripslashes($addinfo);
$title = stripslashes($title);
$dataAux = getDate($added);
$added = $dataAux['mday'] . '/' . $dataAux['mon'] . '/' . $dataAux['year'];
$xoopsTpl->assign(array('id' => $id, 'added' => $added, 'filename' => $filename, 'artist' => $artist, 'title' => $title, 'album' => $album, 'year' => $year, 'addinfo' => $myts->displayTarea($addinfo, 1, 1, 1, 1, 0), 'track' => $track, 'genre' => $genre, 'length' => $length, 'bitrate' => $bitrate, 'link' => $link, 'frequence' => $frequence, 'genreid' => $genreid, 'hits' => $hits, 'views' => $views, 'play_file' => $play_file, 'tocador' => $tocador));
if ($rating != 0.0) {
    $ratesong['rating'] = "" . _MD_DEBASER_RATING . ": " . $myts->stripSlashesGPC(number_format($rating, 2));
    $ratesong['votes'] = "" . _MD_DEBASER_VOTES . ": " . $myts->stripSlashesGPC($votes);
} else {
    $ratesong['rating'] = _MD_DEBASER_NOTRATED;
}
if ($xoopsUser) {
    $xoopsModule = XoopsModule::getByDirname('debaser');
    if ($xoopsUser->isAdmin($xoopsModule->mid())) {
        $xoopsTpl->assign('isxadmin', true);
    }
}
$xoopsTpl->assign('lang_comments', _COMMENTS);
$xoopsTpl->assign('ratesong', $ratesong);
if ($xoopsModuleConfig['guestvote'] == 1) {
    $xoopsTpl->assign('guestvote', true);
}
if ($xoopsUser) {
    $xoopsTpl->assign('guestvote', true);
}
/* determine if downloads are allowed or if download is a link */
if ($xoopsModuleConfig['debaserallowdown'] == 1) {
    $xoopsTpl->assign("allowyes", true);
Пример #25
0
// 2003/10/11 K.OHWADA
// easy to rename module and table
//   add conf.php

include("../../../mainfile.php");
include_once(XOOPS_ROOT_PATH."/class/xoopsmodule.php");
include(XOOPS_ROOT_PATH."/include/cp_functions.php");

include_once("../conf.php");	// add

if ( $xoopsUser ) {

// easy to rename module and table
//	$xoopsModule = XoopsModule::getByDirname("xfsection");
	$xoopsModule = XoopsModule::getByDirname($wfsModule);

	if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
		redirect_header(XOOPS_URL."/",3,_NOPERM);
		exit();
	}
} else {
	redirect_header(XOOPS_URL."/",3,_NOPERM);
	exit();
}
if ( file_exists("../language/".$xoopsConfig['language']."/admin.php") ) {
	include("../language/".$xoopsConfig['language']."/admin.php");
} else {
	include("../language/english/admin.php");
}
if ( file_exists("../language/".$xoopsConfig['language']."/main.php") ) {
Пример #26
0
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
// Author: Tobias Liegl (AKA CHAPI)                                          //
// Site: http://www.chapi.de                                                 //
// Project: The XOOPS Project                                                //
// ------------------------------------------------------------------------- //
include_once "../../../mainfile.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
include_once XOOPS_ROOT_PATH . "/include/cp_functions.php";
include_once XOOPS_ROOT_PATH . "/include/xoopscodes.php";
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
include '../../../include/cp_header.php';
if (file_exists("../language/" . $xoopsConfig['language'] . "/modinfo.php")) {
    include "../language/" . $xoopsConfig['language'] . "/modinfo.php";
} else {
    include "../language/english/modinfo.php";
}
if ($xoopsUser) {
    $xoopsModule = XoopsModule::getByDirname(_MI_JGRAPHICS_DIR_NAME);
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL . "/", 3, _NOPERM);
        exit;
    }
} else {
    redirect_header(XOOPS_URL . "/", 3, _NOPERM);
    exit;
}
Пример #27
0
<?php

// $Id: admin_header.php,v 1.2 Date: 06/01/2003, Author: Catzwolf Exp $
include "../../../mainfile.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
include XOOPS_ROOT_PATH . "/include/cp_functions.php";
if ($xoopsUser) {
    $xoopsModule = XoopsModule::getByDirname("wfsection");
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL . "/", 3, _NOPERM);
        exit;
    }
} else {
    redirect_header(XOOPS_URL . "/", 3, _NOPERM);
    exit;
}
if (file_exists("../language/" . $xoopsConfig['language'] . "/admin.php")) {
    include "../language/" . $xoopsConfig['language'] . "/admin.php";
} else {
    include "../language/english/admin.php";
}
if (file_exists("../language/" . $xoopsConfig['language'] . "/main.php")) {
    include "../language/" . $xoopsConfig['language'] . "/main.php";
} else {
    include "../language/english/main.php";
}
Пример #28
0
//                               "MP"                                        //
//                                                                           //
//                       http://lexode.info/mods                             //
//                                                                           //
//                                                                           //
//---------------------------------------------------------------------------//
include "../../../mainfile.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
include XOOPS_ROOT_PATH . "/include/cp_functions.php";
include '../../../include/cp_header.php';
include '../include/functions.php';
include_once XOOPS_ROOT_PATH . "/include/xoopscodes.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
include '../class/formselectuser.php';
include_once XOOPS_ROOT_PATH . '/modules/mpmanager/class/priv_msgs.php';
include_once XOOPS_ROOT_PATH . '/modules/mpmanager/class/priv_msgscat.php';
include_once XOOPS_ROOT_PATH . '/modules/mpmanager/class/priv_msgscont.php';
include_once XOOPS_ROOT_PATH . '/modules/mpmanager/class/priv_msgsopt.php';
include_once XOOPS_ROOT_PATH . '/modules/mpmanager/class/priv_msgsup.php';
if ($xoopsUser) {
    $xoopsModule = XoopsModule::getByDirname("mpmanager");
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL . "/", 3, _NOPERM);
        exit;
    }
} else {
    redirect_header(XOOPS_URL . "/", 3, _NOPERM);
    exit;
}
Пример #29
0
/**
 * @param $uid
 * @param $type
 */
function synchronize($uid, $type)
{
    global $xoopsDB;
    include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
    include_once XOOPS_ROOT_PATH . '/kernel/module.php';
    $tables = array();
    // Count comments (approved only: com_status == XOOPS_COMMENT_ACTIVE)
    $tables[] = array('table_name' => 'xoopscomments', 'uid_column' => 'com_uid', 'criteria' => new Criteria('com_status', XOOPS_COMMENT_ACTIVE));
    // Count Content posts
    if (XoopsModule::getByDirname('fmcontent')) {
        $tables[] = array('table_name' => 'fmcontent_content', 'uid_column' => 'content_uid');
    }
    // Count forum posts
    if (XoopsModule::getByDirname('newbb')) {
        $tables[] = array('table_name' => 'bb_posts', 'uid_column' => 'uid');
    }
    switch ($type) {
        case 'user':
            $total_posts = 0;
            foreach ($tables as $table) {
                $criteria = new CriteriaCompo();
                $criteria->add(new Criteria($table['uid_column'], $uid));
                if (!empty($table['criteria'])) {
                    $criteria->add($table['criteria']);
                }
                $sql = 'SELECT COUNT(*) AS total FROM ' . $xoopsDB->prefix($table['table_name']) . ' ' . $criteria->renderWhere();
                if ($result = $xoopsDB->query($sql)) {
                    if ($row = $xoopsDB->fetchArray($result)) {
                        $total_posts += $row['total'];
                    }
                }
            }
            $sql = 'UPDATE ' . $xoopsDB->prefix('users') . " SET posts = '" . $total_posts . "' WHERE uid = '" . $uid . "'";
            if (!($result = $xoopsDB->queryF($sql))) {
                redirect_header('admin.php?fct=users', 1, _AM_SYSTEM_USERS_CNUUSER);
            }
            break;
        case 'all users':
            $sql = 'SELECT uid FROM ' . $xoopsDB->prefix('users') . '';
            if (!($result = $xoopsDB->query($sql))) {
                redirect_header('admin.php?fct=users', 1, sprintf(_AM_SYSTEM_USERS_CNGUSERID, $uid));
            }
            while ($data = $xoopsDB->fetchArray($result)) {
                synchronize($data['uid'], 'user');
            }
            break;
    }
    // exit();
}
Пример #30
0
<?php

/**
 * $Id: admin header.php v 1.5 20 November 2003 Catwolf Exp $
 * Module: WF-Channel
 * Version: v1.0.2
 * Release Date: 20 November 2003
 * Author: Catzwolf
 * Licence: GNU
 */
include "../../../mainfile.php";
include '../../../include/cp_header.php';
include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
include_once XOOPS_ROOT_PATH . "/modules/jdocs/include/functions.php";
include XOOPS_ROOT_PATH . "/class/xoopstree.php";
include XOOPS_ROOT_PATH . "/class/xoopslists.php";
include XOOPS_ROOT_PATH . "/class/xoopsformloader.php";
if (is_object($xoopsUser)) {
    $xoopsModule = XoopsModule::getByDirname("jdocs");
    if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
        redirect_header(XOOPS_URL . "/", 3, _NOPERM);
        exit;
    }
} else {
    redirect_header(XOOPS_URL . "/", 1, _NOPERM);
    exit;
}
$myts =& MyTextSanitizer::getInstance();