Exemple #1
0
function CreateAG($db, $ag_name, $ag_desc)
{
    $sql = "INSERT INTO acid_ag (ag_name, ag_desc) VALUES ('" . $ag_name . "','" . $ag_desc . "');";
    $db->baseExecute($sql, -1, -1, false);
    if ($db->baseErrorMessage() != "") {
        FatalError(gettext("Error Inserting new AG"));
    }
    $ag_id = $db->baseInsertID();
    /* The following code is a kludge and can cause errors.  Since it is not possible
     * to determine the last insert ID of the AG, we requery the DB to ascertain the ID
     * by matching on the ag_name and ag_desc.  -- rdd (1/23/2001)
     *
     * Modified code to only run the kludge if the dbtype is postgres.  Created a function
     * to use the actual insertid function if available and return -1 if no -- srh (02/01/2001)
     *
     * Transaction support is neccessary to get this absolutely correct, because using
     * an insert_id might break in a multi-user environment.  -- rdd (02/07/2001)
     */
    if ($ag_id == -1) {
        $tmp_sql = "SELECT ag_id FROM acid_ag WHERE ag_name='" . $ag_name . "' AND " . "ag_desc='" . $ag_desc . "'";
        if ($db->DB_type == "mssql") {
            $tmp_sql = "SELECT ag_id FROM acid_ag WHERE ag_name='" . $ag_name . "' AND " . "ag_desc LIKE '" . MssqlKludgeValue($ag_desc) . "'";
        }
        $tmp_result = $db->baseExecute($tmp_sql);
        $myrow = $tmp_result->baseFetchRow();
        $ag_id = $myrow[0];
        $tmp_result->baseFreeRows();
    }
    return $ag_id;
}
function GetInputData($KeyName, &$Value)
{
    if (!array_key_exists($KeyName, $_POST)) {
        FatalError("'{$KeyName}' value was not sent thru POST");
    }
    $Value = $_POST[$KeyName];
}
 public function Execute()
 {
     // the first guess at the file path of the script -- under
     // /scripts/
     $file = './scripts/' . implode('/', Doer::$_PARAMS);
     // if that doesn't work, try under the current theme
     if (!file_exists($file)) {
         $file = './themes/' . $this->theme . '/' . implode('/', Doer::$_PARAMS);
     }
     // if the script was found
     if (file_exists($file)) {
         // determine whether it is a CSS or JavaScript file
         if (substr($file, -4) == '.css') {
             $mimetype = 'text/css';
         } elseif (substr($file, -3) == '.js') {
             $mimetype = 'text/javascript';
         } else {
             FatalError('File <code>' . $file . '</code> not a valid script.');
         }
         // Make the page display as whatever type the script is
         header('Content-type:' . $mimetype);
         // Display the contents of the page and then exit
         die(file_get_contents($file));
     }
     // if the file doesn't exist, a 404 error will be shown
 }
Exemple #4
0
function form_passwd_post($raw,$data) {
	global $DBH;
	checkAccess();
	if ($data['f1']!=$data['f2']) return LocalError(WGSL("perr","Password error"));
	if ($data['uid']==0) FatalError(WGSL("euid","Unknown UID"));
	$db=dbfirst($DBH,'ewguser','id',$data['uid']);
	if ($db===false) FatalError(WGSL("euid","Unknown UID"));
	$x=WGPasswd($db['name'],false,$data['f1']);
	if ($x) WGToast(WGSL("pokc","Password changed")); else LocalError(WGSL("p2err","Password not changed"));
	$data['f1']='';
	$data['f2']='';
	WGSetActivity('main');
	return $data;
	}
Exemple #5
0
function database_connect()
{
    global $config;
    $resource = @mysql_pconnect($config['db']['hostname'], $config['db']['username'], $config['db']['password']);
    if ($resource) {
        if (@mysql_select_db($config['db']['name'])) {
            return $resource;
        } else {
            FatalError("Unable to select database");
        }
    } else {
        FatalError("Unable to connect to database");
    }
}
Exemple #6
0
function getLanguageList($par) {
	$dh=@opendir($_SERVER['DOCUMENT_ROOT'].'/etc/lang');
	if ($dh===false) FatalError("Can't open laguages directory");
	while($file = readdir($dh)) {
	        if (strpos("$file\n",".json\n")===false) continue;
	        $js = json_decode( @ file_get_contents( $_SERVER['DOCUMENT_ROOT'].'/etc/lang/'.$file) ,true);
		if (is_array($js)) {
		        list($a)=explode('.',$file,2);
		        $b= isset($js['LANG']) ? $js['LANG'] : $a;
			$par['v.'.$a] = $b; 
			} 
		}
	closedir($dh);
	return $par;	
	}
Exemple #7
0
function getThemeList($par) {
	$dh=@opendir($_SERVER['DOCUMENT_ROOT'].'/img/');
	if ($dh===false) FatalError("Can't open theme directory");
	while($file = readdir($dh)) {
	        if ($file[0]=='.') continue;
	        if (is_dir($_SERVER['DOCUMENT_ROOT'].'/img/'.$file)) {
		        $js = json_decode( @ file_get_contents( $_SERVER['DOCUMENT_ROOT'].'/img/'.$file.'/procset.json') , true);
			if (!is_array($js)) continue;
			$a = $file;
			$b = isset($js['themeInfo']['title']) ? $js['themeInfo']['title'] : $a; 
			$par['v.'.$a] = $b; 		
			}
	        }
	closedir($dh);
	return $par;	
	}
 public function IncludeTemplates()
 {
     global $_CONFIG;
     $t_arr = array();
     $main = '';
     foreach ($this->templates as $t) {
         if (file_exists('./templates/' . $t . '.html')) {
             $t_arr[] = './templates/' . $t . '.html';
         } elseif (file_exists('./themes/' . $this->theme . '/templates/' . $t . '.html')) {
             $t_arr[] = './themes/' . $this->theme . '/templates/' . $t . '.html';
         } else {
             FatalError('Could not find template file ' . $t);
         }
         $main .= Mocha::Parse(file_get_contents($t_arr[count($t_arr) - 1]));
     }
     Mocha::AddVariable('page_contents', $main);
 }
Exemple #9
0
function form_access_post($dta) {
	global $OUTJSON;
	global $CMD;
	global $WEBGUI;
	global $APPL;
	  
	$usr = WGSessionUser();
	if ($usr===false) FatalError("Access denied");
	if ($dta['f2']!=$dta['f3']) {
		WGSetActivity("error");
	        return;
		}
		
	$x = WGPasswd($usr['name'],$dta['f1'],$dta['f2']);
	
	if ($x==false) {
	        WGSetActivity("error");
	        return;
		}
		
	WGSetActivity("accessok");
	}               
Exemple #10
0
<?
$usr = WGSessionUser();
if ($usr===false) FatalError("Access denied");
WGSetTitle(WGSL("chg","Change password").": {$usr['name']}");
?><div class="WGWActivity" data-wgid="access">
<br><img src="<%<APPPATH>%>/icon.png" alt=""><br>Loading...<br>
</div>
<div class="WGWActivity" data-wgid="accessok">
<br><img src="<%<APPPATH>%>/icon.png" alt=""><br>
<%<chgd_h>%>.<br>
<a href="#_close()" class="WGButton" data-wgpox="-8,-8">Ok</a>
</div>
<div class="WGWActivity SysAppLogonErr" data-wgid="error">
<br><img src="<%<APPPATH>%>/icon.png" alt=""><br>
<%<error_h>%>:<br>
<%<perr_h>%>.
<a href="#main" class="WGButton" data-wgpox="-8,-8"><%<retry_h>%></a>
</div>
Exemple #11
0
function MakeLibDir()
{
    global $fbcmdPrefs;
    global $isWindows;
    global $isSudo;
    global $sudoUser;
    $dir = $fbcmdPrefs['install_lib_dir'];
    if (!file_exists($dir)) {
        if (mkdir($dir, octdec($fbcmdPrefs['install_lib_mkdir_mode']), true)) {
            Trace("creating directory [{$dir}]");
        } else {
            print "Error: cound not create directory: [{$dir}]\n";
            FatalError();
        }
    }
    if (!$isWindows) {
        if ($isSudo) {
            if (isset($sudoUser)) {
                if (chown($dir, $sudoUser)) {
                    Trace("chown [{$dir}] [{$sudoUser}]");
                } else {
                    print "error chown: [{$dir}] [{$sudoUser}] (non-fatal)\n";
                }
            }
            if (chmod($dir, octdec($fbcmdPrefs['install_lib_mkdir_mode']))) {
                Trace("chmod [{$dir}]");
            } else {
                print "error chmod: [{$dir}] (non-fatal)\n";
            }
        }
    }
}
    FatalError(sprintf(errArgCountNotMatch, $argc));
}
$Action = $argv[1];
if (!in_array($Action, array('block', 'unblock'))) {
    FatalError(sprintf(errInvalidInputData, "action = '{$Action}'"));
}
// Get nickname and extract vBulletin user ID
$Nickname = $argv[2];
$arrUser = $db->query_first("SELECT userid\n\t\t\t\t\t\t\t   FROM " . TABLE_PREFIX . "user\n\t\t\t\t\t\t\t   WHERE username = '******'");
if (!$arrUser) {
    FatalError(sprintf(errInvalidInputData, "user '{$Nickname}' is not registered in vBulletin"));
}
$UserID = (int) $arrUser['userid'];
if ($Action == 'block') {
    if ($argc < 5) {
        FatalError(sprintf(errArgCountNotMatch, $argc));
    }
    $ReasonMessage = $argv[3];
    $BannedUserTitle = $argv[4];
}
/* Manage vBulletin */
$arrUser = $db->query_first("SELECT *\t\t   \t\n\t\t\t\t\t\t\t  FROM " . TABLE_PREFIX . "user\n\t\t\t\t\t\t\t  WHERE userid = {$UserID}");
$objUser =& datamanager_init('User', $vbulletin, ERRTYPE_SILENT);
$objUser->set_existing($arrUser);
if ($Action == 'block') {
    $BanPeriod = 0;
    // Ban forever, until we explicitly unblock the user
    // check to see if there is already a ban record for this user in the userban table
    if ($check = $db->query_first("SELECT userid \n\t\t\t\t\t\t\t   \t   FROM " . TABLE_PREFIX . "userban \n\t\t\t\t\t\t\t   \t   WHERE userid = {$UserID}")) {
        $db->query_write("UPDATE " . TABLE_PREFIX . "userban \n\t\t\t\t\t\t  SET bandate = " . TIMENOW . ",\n\t\t\t\t\t\t\t  liftdate = 0,\n\t\t\t\t\t\t\t  adminid = 0,\n\t\t\t\t\t\t\t  reason = '{$ReasonMessage}'\n\t\t\t\t\t\t  WHERE userid = {$UserID}");
    } else {
// Save the data
$vbulletin->userinfo['userid'] = $UserID = $UserData->save();
if (!$UserID) {
    FatalError("Error: \$UserData->save() returned [{$UserID}]\n");
}
unset($UserData);
if ($IsAdmin) {
    // Set administrator permissions
    $User = $db->query_first("\n\t\tSELECT user.userid, \n\t\t\t   user.username, administrator.*,\n\t\t\t  IF(administrator.userid IS NULL, 0, 1) AS isadministrator\n\t\tFROM " . TABLE_PREFIX . "user AS user\n\t\tLEFT JOIN " . TABLE_PREFIX . "administrator AS administrator ON(administrator.userid = user.userid)\n\t\tWHERE user.userid = " . $UserID);
    if (!$User) {
        FatalError("Cannot set administrator permissions: no user with ID [{$UserID}]");
    }
    $admindm =& datamanager_init('Admin', $vbulletin, ERRTYPE_CP);
    $admindm->set_existing($User);
    // Set permissions array (grant all priviledges)
    $AdminPermissions = array("canadminsettings" => 1, "canadminstyles" => 1, "canadminlanguages" => 1, "canadminforums" => 1, "canadminthreads" => 1, "canadmincalendars" => 1, "canadminusers" => 1, "canadminpermissions" => 1, "canadminfaq" => 1, "canadminimages" => 1, "canadminbbcodes" => 1, "canadmincron" => 1, "canadminmaintain" => 1, "canadminplugins" => 1);
    foreach ($AdminPermissions as $key => $value) {
        $admindm->set_bitfield('adminpermissions', $key, $value);
    }
    $admindm->set('cssprefs', '');
    // set default admin panel skin
    $admindm->pre_save();
    if (!empty($admindm->errors)) {
        $errorlist = '';
        foreach ($admindm->errors as $index => $error) {
            $errorlist .= "<li>{$error}</li>\n";
        }
        FatalError($errorlist);
    }
    $admindm->save();
}
Exemple #14
0
             if ($db->baseErrorMessage() != "") {
                 FatalError(gettext("Error deleting packet list for the AG:") . " " . $sql);
             }
             /* Delete the AG */
             $sql = "DELETE FROM acid_ag WHERE ag_id='" . $ag_id . "'";
             $db->baseExecute($sql, -1, -1, false);
             if ($db->baseErrorMessage() != "") {
                 FatalError(gettext("Error deleting the AG") . $sql);
             }
         } else {
             if ($ag_action == "clear_confirm") {
                 /* Delete the packet list associated with the AG */
                 $sql = "DELETE FROM acid_ag_alert WHERE ag_id='" . $ag_id . "'";
                 $db->baseExecute($sql, -1, -1, false);
                 if ($db->baseErrorMessage() != "") {
                     FatalError(gettext("Error deleting packet list for the AG:") . " " . $sql);
                 }
                 $ag_action = "view";
             }
         }
     }
 }
 if ($ag_action == "delete_confirm") {
     ErrorMessage("<strong>" . gettext("DELETED successfully") . "</strong>");
     $ag_action = "view";
     $ag_name = $ag_desc = "<em>" . gettext("information deleted") . "</em>";
 } else {
     /* Re-Query the information to print the AG info out */
     if ($ag_id > 0) {
         $sql = "SELECT ag_id, ag_name, ag_desc FROM acid_ag WHERE ag_id='" . $ag_id . "'";
     } else {
Exemple #15
0
<?
$po = WGParseFile($APPL['file']['path']);
if (!$po['D'] and !$po['F']) return;
if (!WGisAllowed($po['w'])) FatalError("Access denied");

$js=@file_get_contents($po['f']);

if ($js===false) FatalError("Invalid Link");
$js=trim($js,"\t\r\n ");
if ($js=='') FatalError("Invalid Link");

$CMD[] = array(
	'api'	=>	'shell',
	'data'	=>	$js)
	; 	 
?>
Exemple #16
0
<?
if (!setWindowDialog()) FatalError("This program cannot be run in window mode");
$ff=array();

$fnt= EWGGetFonts();
foreach($fnt['font'] as $li) {
	$ff[] = $li['face'];
	}	

foreach(array(
	'Verdana',
	'Helvetica, sans-serif',	
	'sans-serif', 	
	'Times, serif', 	
	'Times New Roman, serif', 	
	'serif', 	
	'Courier New, monospace', 	
	'Courier, monospace', 	
	'Fixed, monospace', 	
	'monospace', 	
	'cursive', 	
	'fantasy')
	as $li) $ff[] = $li;
	 
?>
<!--@COORD
	text	8	8
	sel 	76	8
	tsize	65	20
	ssize	100	20
-->
Exemple #17
0
<?
$po = WGParseFile($APPL['file']['path']);
if (!$po['F']) return;
$st=@file_get_contents($po['f']);
$st=json_decode($st,true);
if (!is_array($st)) FatalError("Invalid stream info file");

$t=str_replace(array(".youtube\n","\n"),'',$APPL['file']['filename']."\n");
if (isset($st['t'])) $t=$st['t'];

Window($t,"/bin/mime/ico/youtube.png",580,360);
?><div style="width: 561px; height: 316px; margin: auto; padding-top: 4px;">
<iframe width="560" height="315" src="https://www.youtube.com/embed/<?php 
echo htmlspecialchars($st['v'], ENT_QUOTES);
?>
" frameborder="0" allowfullscreen></iframe>
</div>
<?
endWin();
?>
<?php

// The configuration for the site
// The config array, with all of the config values. They are all turned
// into template variables by /index.php. They can be edited by your
// page, since that doesn't happen until after the page is executed.
$_CONFIG = array('default_theme' => 'basic', 'site_title' => 'Testing SMS', 'site_subtitle' => 'Where we test the SMS!', 'copyright' => '&copy; You, ' . date('Y', time()));
// if the includes directory doesn't exist, show a Fatal Error message
if (!file_exists('./include/')) {
    FatalError('Necessary directory <code>./include/</code> does not exist');
}
// get all of the include files
$s = scandir('./include/');
foreach ($s as $f) {
    if (!is_dir($f) && substr($f, -8) == '.inc.php') {
        require_once './include/' . $f;
    }
}
// the class containing stuff about the file being included,
// plus the text that is going to be written
class Doer
{
    // the actual URL of the file you're including
    public static $_FILE = '';
    // the parameters from the URL
    public static $_PARAMS = array();
    // an array of the filepath
    public static $_LINK = array();
    // append this to the beginning of links to make sure they
    // lead to the right place
    public static $_BACKUP = '';
Exemple #19
0
function form_running_post($rawData,$data) {
	global $ini;
	global $DBERROR;
	global $DBH;
	global $WEBGUI;
	
	if (@$ini['webgui']['cansetup']!='webgui') FatalError("Setup Bloccato");
	
	$path = $_SERVER['DOCUMENT_ROOT'].$WEBGUI['rvar']['APPPATH'];
	
	$DBERROR=catchDBError;
                
	if ($data['dbp1']!=$data['dbp2']) return LocalError("Le password del database non coincidono.");
	if ($data['rp1']!=$data['rp2']) return LocalError("Le password di root non coincidono.");
	
	$x = $_SERVER['DOCUMENT_ROOT'].'/etc/InstallHash';
	if (file_exists($x)) {
		$x = @file_get_contents($x);
		if ($x===false) FatalError("Non riesco a leggere `InstallHash`");
		list($a,$b)=@explode(' ',$x,2);
		$x = $a.' '.$data['root'].':'.$data['rp1'];
		$x = md5($x);
		$b=strtolower($b);
		if ($b!=$x) return LocalError("La login e la password di root non coincidono con quelle precedentemente segnalate nel file `InstallHash`\nRimuovere il file oppure usare le credenziali corrette.");		
		}
	
	$ini['db'] = array(
	     'mysql'=> ($data['mysql'] ? $data['mysql'] : '127.0.0.1') ,
		 'db'	=> $data['db'],
		 'dblog'=> $data['dbl'],
		 'dbpas'=> $data['dbp1'])
		 ;
	
	$ini['db']['ok'] = true;
	dbopen($DBH);
	if ($ini['db']['ok']==false) return LocalError("Errore accesso database: {$ini['db']['err']}");
	unset($ini['db']['ok']);
	unset($ini['db']['err']);
	if (!isset($ini['webgui'])) $ini['webgui']=array();
	$ini['webgui']['title'] = $data['title'];
	unset($ini['webgui']['autoexec']);
	if (isset($ini['webgui']['install-autoexec'])) {
		$ini['webgui']['autoexec']=$ini['webgui']['install-autoexec'];
		unset($ini['webgui']['install-autoexec']);	
		}
	
	unset($ini['allowdir']);
		
	$a = array(
	        'etc',
	        'etc/conf.d',
	        'etc/desktop.json',
	        'etc/start.json',
	        'etc/mime.json',
	        'etc/mimehome.json',
	        'etc/server.php',
	        'tmp',
	        'var/cache',
	        'var/cache/font.json',
	        'var/cache/font.css',
	        'home',
	        'usr',
	        'bin/app/grp',
	        'bin/usr',
	        'bin/dlg',
	        'bin/dll',
	        'bin/font',
	        'bin/mod',
	        'bin/php',
	        'bin/theme',
	        'bin/wgx',
	        'bin/mime',
	        'bin/mime/ico')
		;
		
	foreach($a as $b) {
	        $c=$_SERVER['DOCUMENT_ROOT'].'/'.$b;
	        if (@file_exists($c) and @chmod($c,0770)==false ) return LocalError("Non riesco ad impostare i permessi su $b");
	        }

	$dh=@opendir($path.'etc');
	if ($dh===false) FatalError("Non trovo la directory skel file di installazione {$path}etc");
	while($f=readdir($dh)) {
		if (is_dir( $path.'etc/'.$f ) or $f[0]=='.') continue;
		$dt = @file_get_contents($path.'etc/'.$f);
		if ($dt===false) return LocalError("Non riesco a leggere `$f`");
		
	        if (@file_put_contents( $_SERVER['DOCUMENT_ROOT'].'/etc/'.$f , $dt ) == false ) return LocalError("No riesco a copiare: $f");
		}
	closedir($dh);
	
	$dh=@opendir($path.'setup');
	if ($dh===false) FatalError("Non trovo la directory skel file di installazione {$path}setup");
	$lst=array();
	while($f=readdir($dh)) {
		$tf=$path.'setup/'.$f;
		if (is_dir( $tf ) or $f[0]=='.') continue;
		
		if (preg_match('/\.sql$/',$f)!=0) {
			$a = intval($f);
			$lst[$a]=@file_get_contents($tf);
			if ($lst[$a]===false) return LocalError("Non riesco a leggere `$tf`");
			}
		}
	closedir($dh);
	ksort($lst);
	
	$ini['db']['ok']=true;
	$ini['db']['err']='';
	
	foreach($lst as $db) {
		dbquery($DBH,$db);
		if ($ini['db']['ok']==false) return LocalError("Errore Query SQL: ".$ini['db']['err']); 
		}
	
	$x=WGCreateUser($data['root'],$data['rp1'],'root',array('root' => true));
	if ($x==false) LocalError("Non riesco a creare l'utente root.");
	
	unset($ini['db']['ok']);
	unset($ini['db']['err']);
	unset($ini['logon']);
	unset($ini['auth']);	
		
	if ($data['accesmode']==1) {
	        $ini['auth'] = array( 'realm' => $data['title']!='' ? $data['title'] : 'WebGui8') ;
	    } 
		
	if ($data['accesmode']==2) {
			$ini['logon']=array('enabled'=>1);
		} 
	
	$t0 = str_pad($data['debug'],4,'0');
	$ini['debug'] = array(
	        'debug'	=>	$t0[0],
	        'log'	=>	$t0[1],
	        'showid'=>	$t0[2],
	        'args'	=>	$t0[3])
		;
	
	$ini['webgui']['cookie'] = $data['cookie']!=0 ? '1' : '0';
		
	$fs =$path.'setup/server.conf';
	if (file_exists($fs)) {
	        $i = @parse_ini_file($fs,true);
	        if ($i===false) return LoaclError("Non riesco a leggere correttamente il file di installazione `$fs`");
	        foreach($i as $k => $st) {
		        if (!isset($ini[$k])) $ini[$k]=array();
		        foreach($st as $k1 => $v1) {
		        	$ini[$k][$k1]=$v1;
				}
			}
		}
	
	$fs=$path.'setup/install.php';
	if (file_exists($fs)) WGRequirePHP($fs,$data);
		
	unset($ini['webgui']['cansetup']);
	
	$i=';) <'.'? exit; ?'.'>';
	$i.="\n";
	foreach($ini as $k => $li) {
	        $i.="[{$k}]\n";
	        foreach($li as $vk => $vv) {
	        	if (!is_numeric($vv)) $vv='"'.addcslashes($vv,"\t\r\n\\\"`'").'"';
			$i.="{$vk}={$vv}\n";		
			}
		$i.="\n";
		}
	
	$fs=$_SERVER['DOCUMENT_ROOT'].'/etc/server.php';
	if ( file_put_contents($fs,$i)==false) return LocalError("Non riesco a scrivere su `$fs`");
	
	EWGCacheFont();
	
	WGSetActivity('setup');	
}
Exemple #20
0
		if (!$f) FatalError("Invalid executor file name");
		if (!$f['F'] and !$f['D']) FatalError("Executor not found `".print_r($APPL['executor'],true)."`");
		$APPL['bin'] = $f;
		if ($f['F']) { 
			if ($f['extension']=='php') {
				WGRequirePHP($f['f']);
				} else if ($f['extension']=='json') {
					$js=@file_get_contents($f);
					$js=json_decode($f,true);
					if (!is_array($js)) FatalError("Invalid executor json `".$APPL['executor']."`");
					Window($f['filename']);
					$WEBGUI['win']=array_merge($WEBGUI['win'],$js);
					$js=null;
					unset($js['hdc']);
					endWin(); 
					} else FatalError("Unknown executor type `".$APPL['executor']."`");
			} else if ($f['D']) execApp($f['w'],$JSON['t']);
		}
	if (is_array($ini['db']) && !$DBH) dbclose($DBH);			
	retGUI();
	}

/// GET

$startFile=false;

if (@$_SERVER['REQUEST_URI']=='/logout.php' or @$_SERVER['REDIRECT_URL']=='/logout.php') {
			header("HTTP/1.1 200 Ok",true,200);
			header("Content-Type: text/plain; charset=UTF-8",true,200);
			@session_destroy();
			exit("Logout");
function FatalError($ErrorMessage)
{
    echo "<br /><p>Fatal error: <b>{$ErrorMessage}</b></p><br />";
    exit($ErrorMessage);
}
if ($argc < 3) {
    FatalError(sprintf(errArgCountNotMatch, $argc));
}
$isAdmin = $argv[1];
for ($argIndex = 2; $argIndex <= $argc - 1; $argIndex++) {
    $userID = $argv[$argIndex];
    if ($isAdmin) {
        modules_update($userID, '', '', 1);
    } else {
        if ($userID != (int) $userID) {
            FatalError(sprintf(errInvalidInputData, " invalid member ID: [{$userID}]"));
        }
        modules_update($userID);
        // User will be added if he does not exist
        $resCheckAction = checkAction($userID, ACTION_ID_USE_CHAT);
        if ($resCheckAction[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
            modules_block($userID, 'chat');
        } else {
            modules_unblock($userID, 'chat');
        }
        $resCheckAction = checkAction($userID, ACTION_ID_USE_FORUM);
        if ($resCheckAction[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED) {
            modules_block($userID, 'forum');
        } else {
            modules_unblock($userID, 'forum');
        }
Exemple #22
0
function execApp($ex,$action=AJ_SHELL) {
	global $CMD;
	global $OUTJSON;
	global $APPL;
	global $DBH;
	global $JSON;
	global $WEBGUI;	
	global $WGData;
	
	if (!is_array($ex)) $ex = WGParseFile($ex);
	if ($ex===false) FatalError("Invalid file");
	if (!$ex['D']) FatalError("E5 Invalid application");
	
	$lang=$_SESSION['WGLang'] ? $_SESSION['WGLang'] : '_D_';
		
	$rvar = array(
		'FILE'	=> $ex['w'],
		'PATH'	=> pathinfo($ex['w'],PATHINFO_DIRNAME),
		'URL'	=> @$JSON['url'])
		;
	
	if ($ex['D']) $rvar['APPPATH']=rtrim($ex['w'],'/').'/'; else $rvar['APPPATH']=rtrim($rvar['PATH'],'/').'/';
	
	$mf = json_decode( @file_get_contents($ex['f'].'/manifest.json') , true);
	if (!is_array($mf)) FatalError("Invalid Manifest");
	
	$x = $ex['f'].'/lang';
	if (file_exists($x) and is_dir($x)) {
		list($y)=explode('-',$lang,2);
		foreach(array($lang,$y,'_D_') as $kf) {
			$y = $x . '/'. $kf.'.json';
			
			if (file_exists($y)) {
				$x = @file_get_contents($y);
				$x = json_decode($x,true);
				if (!is_array($x)) FatalError("Can't load lang `$kf`");
				$rvar=array_merge($rvar,$x);
				$x=null;
				break;
				}
			}
		}
	
	$WEBGUI['rvar']=$rvar;
	
	$x = $ex['f'].'/'.$mf['ico'];
	if (file_exists($x)) $x=$ex['w'].'/'.$mf['ico']; else $x=null;
	
	//--form

	endWin();
	
	Window(
		$mf['title'], 
		$x, 
		$mf['w'] ? $mf['w'] : 320 ,
		$mf['h'] ? $mf['h'] : 240 )
		;
	
	if (@$mf['autoResize']) WGAutoResizeWin();
	
	if (isset($mf['winType'])) {
		if (is_numeric($mf['winType'])) $WEBGUI['win']['winType']=$mf['winType']; else {
			if ($mf['winType']=='nosize') $WEBGUI['win']['winType'] = WIN_NOSIZE;
			if ($mf['winType']=='dialog') $WEBGUI['win']['winType'] = WIN_DIALOG;
			if ($mf['winType']=='normal') $WEBGUI['win']['winType'] = WIN_NORMAL;
			if ($mf['winType']=='popup') $WEBGUI['win']['winType'] = WIN_POPUP;
			}
		}
		
	if (isset($mf['pox'])) {
			if (!is_numeric($mf['pox'])) {
				if ($mf['pox']=='center') 
					$mf['pox']=POX_CENTER; 
					else if ($mf['pox']=='rev') 
					$mf['pox']=POX_RB;
					else $mf['pox']=POX_NORMAL;
				}
			setWindowPox(
			$mf['pox'],
			isset($mf['x']) ? $mf['x'] : false,
			isset($mf['y']) ? $mf['y'] : false)
			;
		}
	
	if ($action == AJ_SHELL or $action == AJ_DIALOG) {
		$hdc=WGSNew($ex['w'], isset($mf['name']) ? $mf['name'] : false);
		$APPL['hdc']=$hdc;
		$APPL['asNew']=true;
		$APPL['url']=$ex['w']; 
		} else $hdc=$APPL['hdc'];
		
	setWindowContext($hdc,$mf['name'] ? $mf['name'] : false,$ex['w']);
		
	$WEBGUI['win']['data'] = WGSLoad($hdc,$ex['w'],isset($mf['name']) ? $mf['name'] : false);

	if (is_array($rvar) and ($action==AJ_SHELL or $action==AJ_DIALOG)) {
		if (isset($rvar['win']) and is_array($rvar['win'])) $WEBGUI['win']['winLang'] = $rvar['win'];
		if (file_exists($ex['f'].'/style.css')) WGWinCss($ex['w'].'/style.css',$rvar);
		if (isset($rvar['_title'])) $WEBGUI['win']['title'] = $rvar['_title'];
		}
			
	$f = $ex['f'].'/event.php';
	if (file_exists($f)) {
		WGRequirePHP($f,$rvar);
		
		$fn=false;
		
		if ($action==AJ_POST) {
			$fn='form_'.@$JSON['frm'].'_post';
			if (!function_exists($fn)) $fn='form_'.$APPL['act'].'_post'; 
			$WEBGUI['win']['data'][$APPL['act']]=$JSON['par'];
			}
			
		if ($action==AJ_WINAJAX) $fn='ajax_'.$APPL['api'];
		if ($action==AJ_EVENT) $fn='event_'.$APPL['api'];
		if (($action==AJ_SHELL || $action==AJ_DIALOG) && $APPL['act']!='') $fn='load_'.$APPL['act'];
		if (($action==AJ_SHELL || $action==AJ_DIALOG) && $APPL['act']=='') $fn='winMain';
		
		if ($fn and function_exists($fn)) {
			if (isset($WEBGUI['form']) and isset($JSON['frm']) and $JSON['frm']!='') {
				if (!isset($WEBGUI['form'][ $JSON['frm'] ])) FatalError("Unknown form `".$JSON['frm']."`");
				$formData=$JSON['par'];
				$err = WGFormCheck($WEBGUI['form'][ $JSON['frm'] ], $formData);
				if ($err) {
					foreach($WEBGUI['form'][ $JSON['frm']]['obj'] as $t0) {
						if ($t0['n']==$err) {
							FatalError( isset($t0['par']['err']) ? $t0['par']['err'] : "Invalid value for `".$t0['c']."`");
							}
						}
					FatalError("Invalid value for `$err`");
					}
				WGDestroyCaptcha($WEBGUI['form'][ $JSON['frm'] ]);
				} else {
					$formData=@$JSON['par']; 
				}
			$pr=$fn(@$JSON['par'],$formData);
			
			if ($action==AJ_POST and $pr) $OUTJSON['postReply']=$pr;
			if ($action==AJ_WINAJAX and $pr) $OUTJSON['ajaxReturn'] = $pr;
			}
				
		}
	
	$formFile=$ex['f'].'/form.conf';
	if (file_exists($formFile)) {
		$X = @file_get_contents($formFile);
		if ($X===false) FatalError("Can't read form.conf");
		$X = WGReplacer($X,$rvar);
		$WEBGUI['form'] = WGFormParser($X,$action);
		$X=null;
		$formFile=true;
		} else $formFile=false;
		
	if ($action == AJ_SHELL || $action == AJ_DIALOG) {
		
		$f = $ex['f'].'/app.js';
		if (file_exists($f)) winJS( @file_get_contents($f) );
	
		$f = $ex['f'].'/data.json';
		if (file_exists($f)) {
			$WEBGUI['win']['data'] = json_decode(@file_get_contents($f),true);
			if (!is_array($WEBGUI['win']['data'])) FatalError("Invalid `data.json` structure/syntax");
			}
			
		$f = $ex['f'].'/layout.php';
		if (file_exists($f)) WGRequirePHP($f,$rvar);
		
		if (isset($WEBGUI['form'])) {
			foreach($WEBGUI['form'] as $X) WGFormActivity($X);
			$X=null;
			}
			
		$f = $ex['f'].'/app.ejs';
		if (file_exists($f)) {
			$f = @file_get_contents($f);
			if ($f===false) FatalError("Can't load EJS");
			$f = WGReplacer($f,$rvar);
			$f=explode("\n",$f);
			WGParseEJSTag($f);
			} else {
			$f = $ex['f'].'/event.json';	
			if (file_exists($f)) {
				$js=@file_get_contents($f);
				$js=json_decode($js,true);
				if (!is_array($js)) FatalError("Can't load application.\nBad JSON sctructure in event.json");
				$WEBGUI['win']['event']=$js;
				$js=null;
				}
			}
		
		if (function_exists('layout_create')) layout_create();
		}	
		
	endWin();
	}
Exemple #23
0
<? 
$ini=WGGetIni();
if (@$ini['webgui']['cansetup']!='webgui') FatalError("Setup locked"); 

?>
 <div class="WGWActivity" data-wgid="error">
	<div class="setupLoader setupError">
		<div>
		<img src="<%<APPPATH_H>%>img/error.png" alt=""><br>
		<b>Errore:</b><br>
		Qualcosa è andato storto.<br>
		<span data-wgid="erro"></span><br>
		</div>
	</div>
	<a href="#main" class="WGButton" data-wgpox="-8,-8">Riprova</a>
</div>

<div class="WGWActivity" data-wgid="running">
	<div class="setupLoader">
		<div>
		<img src="<%<APPPATH_H>%>img/wgloading.gif" alt=""><br>
		Istallazione in corso<br>
		Attendere...
		</div>
	</div>
</div>

<div class="WGWActivity" data-wgid="setup">
	<div class="setupLoader">
		<div>
		<img src="<%<APPPATH_H>%>img/setup.png" alt=""><br>