Пример #1
0
 public function execute()
 {
     GWF_Website::plaintext();
     GWF3::setConfig('store_last_url', false);
     $lat = $this->module->lat();
     $lon = $this->module->lon();
     $descr = trim(Common::getGetString('pp_descr'));
     $descr = $descr === '' ? null : $descr;
     $id = Common::getGetInt('pp_id', 0);
     $user = GWF_User::getStaticOrGuest();
     $uid = $user->getID();
     if (!GWF_ProfilePOI::changeAllowed($id, $uid)) {
         $this->module->ajaxError('Permission error!');
     }
     $count = $id === 0 ? GWF_ProfilePOI::getPOICount($uid) : 0;
     $max_pois = $this->module->cfgAllowedPOIs();
     if ($count >= $max_pois) {
         $this->module->ajaxErr('err_poi_exceed');
     }
     $poi = new GWF_ProfilePOI(array('pp_id' => $id, 'pp_uid' => $uid, 'pp_lat' => $lat, 'pp_lon' => $lon, 'pp_descr' => $descr));
     $poi->replace();
     $data = $poi->getGDOData();
     $data['user_name'] = $user->getVar('user_name');
     die(json_encode($data));
 }
Пример #2
0
 public function execute()
 {
     GWF3::setConfig('store_last_url', false);
     if (false !== ($error = $this->sanitize())) {
         return $error;
     }
     return $this->imageButton();
 }
Пример #3
0
 public function execute()
 {
     $user = GWF_User::getStaticOrGuest();
     GWF_Website::addJavascriptInline($this->getInlineJS($user));
     $tVars = array('worlds' => $this->getWorlds($user));
     GWF3::setDesign('jqmsl4');
     return $this->module->template('shadowclient.tpl', $tVars);
 }
Пример #4
0
 public function execute()
 {
     GWF3::setConfig('store_last_url', false);
     if (false !== ($error = $this->validate())) {
         return $error;
     }
     return $this->templateGraph();
 }
Пример #5
0
 public function execute()
 {
     //		$iso = Common::getGet('iso', 'en');
     //		if (false === ($lang = GWF_Language::getByISO($iso))) {
     //			$lang = GWF_Language::getEnglish();
     //		}
     GWF3::setConfig('store_last_url', false);
     $lang = GWF_Language::getCurrentLanguage();
     return $this->templateFeed($lang);
 }
Пример #6
0
 public function execute()
 {
     GWF_Website::plaintext();
     GWF3::setConfig('store_last_url', false);
     $id = Common::getGetInt('pp_id');
     if (!GWF_ProfilePOI::changeAllowed($id, GWF_Session::getUserID())) {
         $this->module->ajaxError('Permission error!');
     }
     GDO::table('GWF_ProfilePOI')->deleteWhere("pp_id = {$id}");
     die("{$id}");
 }
Пример #7
0
 public function execute()
 {
     GWF3::setConfig('log_request', false);
     $back = array();
     $user = GWF_User::getStaticOrGuest();
     $back['news'] = (int) $this->module->getNewsCount();
     $back['pm'] = (int) WC_HTML::getUnreadPMCount($user);
     $back['links'] = (int) WC_HTML::getUnreadLinksCount($user);
     $back['forum'] = (int) WC_HTML::getUnreadThreadCount($user);
     return json_encode($back);
 }
Пример #8
0
 private static function initModules()
 {
     if (!Dog_Module::inited()) {
         self::initModulesDir('dog_module');
         if (GWF3::getConfig('env') === 'dev') {
             self::initModulesDir('dog_module_dev');
         }
         self::initModulesDir('dog_module_user_' . Dog::getUnixUsername());
         self::initModulesDir('dog_module_secret');
     }
 }
Пример #9
0
 public function execute()
 {
     GWF3::setConfig('store_last_url', false);
     if ('totalscore' === ($type = Common::getGet('type'))) {
         return $this->graphUserLevel('userhist_totalscore');
     }
     if ('rank' === ($type = Common::getGet('type'))) {
         return $this->graphUserLevel('userhist_rank');
     }
     return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__));
 }
Пример #10
0
 public function execute()
 {
     switch (substr(Common::getGetString('fancy'), 0, 4)) {
         case 'head':
             GWF_Website::addCSS(sprintf('/tpl/%s/css/fancy.css', GWF3::getDesign()));
             return GWF3::onDisplayHead();
         case 'foot':
             return GWF3::onDisplayFoot();
         default:
             return GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'fancy'));
     }
 }
Пример #11
0
 public static function getPlugins($name)
 {
     self::$PLUGIN = array();
     GWF_File::filewalker(self::getPlugDir(), array(__CLASS__, 'getPlugRec'), false, true, $name);
     if (GWF3::getConfig('env') === 'dev') {
         GWF_File::filewalker(self::getPlugDirDev(), array(__CLASS__, 'getPlugRec'), false, true, $name);
     }
     GWF_File::filewalker(self::getPlugDirUser(), array(__CLASS__, 'getPlugRec'), false, true, $name);
     GWF_File::filewalker(self::getPlugDirSecret(), array(__CLASS__, 'getPlugRec'), false, true, $name);
     usort(self::$PLUGIN, array(__CLASS__, 'sort_power_descending'));
     return self::$PLUGIN;
 }
Пример #12
0
 public function execute()
 {
     GWF_Website::plaintext();
     GWF3::setConfig('store_last_url', false);
     if (!$this->module->canReadPOIs()) {
         return $this->module->ajaxErr('err_poi_read_perm');
     }
     $minlat = $this->module->lat('minlat');
     $maxlat = $this->module->lat('maxlat');
     $minlon = $this->module->lon('minlon');
     $maxlon = $this->module->lon('maxlon');
     $where_perms = GWF_ProfilePOI::wherePermissions();
     $where_place = GWF_ProfilePOI::whereLocations($minlat, $maxlat, $minlon, $maxlon);
     $where = "({$where_perms}) AND ({$where_place})";
     $joins = array('users', 'profiles', 'whitelist');
     $result = GDO::table('GWF_ProfilePOI')->selectAll('pp_id, pp_uid, user_name, pp_lat, pp_lon, pp_descr', $where, '', $joins);
     die(json_encode($result));
 }
Пример #13
0
 public function execute()
 {
     GWF3::setConfig('log_request', false);
     $_GET['ajax'] = 1;
     $cut = time() - GWF_ONLINE_TIMEOUT;
     $user = new GWF_User();
     $table = GDO::table('GWF_Session');
     $profiles = '';
     if (false === ($result = $table->select('sess_user,user_name,user_options,user_level', "sess_time>={$cut}", 'user_name ASC', array('user')))) {
         return;
     }
     $guest = 0;
     $member = 0;
     $total = 0;
     $u_count = array();
     $u_users = array();
     while (false !== ($row = $table->fetch($result, GDO::ARRAY_A))) {
         $total++;
         $uid = $row['sess_user'];
         if ($uid == 0) {
             $guest++;
             continue;
         }
         $member++;
         $user->setGDOData($row);
         if ($user->isOptionEnabled(GWF_User::HIDE_ONLINE)) {
             continue;
         }
         if (isset($u_count[$uid])) {
             $u_count[$uid]++;
         } else {
             $u_count[$uid] = 1;
             $u_users[$uid] = $user->displayProfileLink();
         }
     }
     $table->free($result);
     foreach ($u_count as $uid => $cnt) {
         $multi = $cnt > 1 ? "(x{$cnt})" : '';
         $profiles .= ', ' . $u_users[$uid] . $multi;
     }
     $profiles = $profiles === '' ? '.' : ': ' . substr($profiles, 2) . '.';
     return sprintf('%s Online%s', $total, $profiles);
 }
Пример #14
0
 public function execute()
 {
     # Don't store this url.
     GWF3::setConfig('store_last_url', false);
     # Load the Captcha class
     require GWF_CORE_PATH . 'inc/3p/Class_Captcha.php';
     # disable Logging
     GWF3::setConfig('log_request', false);
     # disable HTTP Caching
     GWF_HTTP::noCache();
     # Setup Font, Color, Size
     $aFonts = $this->module->cfgCaptchaFont();
     $rgbcolor = $this->module->cfgCaptchaBG();
     $width = $this->module->cfgCaptchaWidth();
     $height = $this->module->cfgCaptchaHeight();
     $oVisualCaptcha = new PhpCaptcha($aFonts, $width, $height, $rgbcolor);
     # Output the captcha
     die($oVisualCaptcha->Create('', Common::getGetString('chars', true)));
 }
Пример #15
0
 public function sendTheFile(GWF_Download $dl)
 {
     GWF3::setConfig('store_last_url', false);
     $realpath = $dl->getCustomDownloadPath();
     # http header
     $mime = $dl->getVar('dl_mime');
     # currently i am looking for pecl filetype?
     $mime = 'application/octet-stream';
     # not sure about...
     header("Content-Type: {$mime}");
     # about ... mime
     //		$name = $dl->getVar('dl_filename'); # filename is sane. No " is allowed in filename.
     $name = $dl->getCustomDownloadName();
     header("Content-Disposition: attachment; filename=\"{$name}\"");
     # drop attachment?
     $size = filesize($realpath);
     header("Content-Length: {$size}");
     # Print file and die
     echo file_get_contents($realpath);
     die(0);
 }
Пример #16
0
            break;
        case GWF_Form::SUBMIT:
            printf('<input type="submit" name="%s" value="%s" />' . PHP_EOL, $key, $data[1]);
            break;
        case GWF_Form::TIME:
        case GWF_Form::DATE:
        case GWF_Form::SELECT:
        case GWF_Form::SSTRING:
        case GWF_Form::HTML:
            printf('%s' . PHP_EOL, $data[1]);
            break;
            //		case GWF_Form::CAPTCHA:
            //			printf('<tr><td>%s</td><td>%s</td><td><img src="%sCaptcha/" onclick="this.src=\'%sCaptcha/?\'+(new Date()).getTime();" /></td></tr>'.PHP_EOL, GWF_HTML::lang('th_captcha1'), GWF_Button::tooltip(GWF_HTML::lang('tt_captcha1')), GWF_WEB_ROOT, GWF_WEB_ROOT);
            //			printf('<tr><td>%s</td><td>%s</td><td><input type="text" name="%s" value="%s" /></td></tr>'.PHP_EOL, GWF_HTML::lang('th_captcha2'), GWF_Button::tooltip(GWF_HTML::lang('tt_captcha2')), $key, $data[1]);
            //			break;
        //		case GWF_Form::CAPTCHA:
        //			printf('<tr><td>%s</td><td>%s</td><td><img src="%sCaptcha/" onclick="this.src=\'%sCaptcha/?\'+(new Date()).getTime();" /></td></tr>'.PHP_EOL, GWF_HTML::lang('th_captcha1'), GWF_Button::tooltip(GWF_HTML::lang('tt_captcha1')), GWF_WEB_ROOT, GWF_WEB_ROOT);
        //			printf('<tr><td>%s</td><td>%s</td><td><input type="text" name="%s" value="%s" /></td></tr>'.PHP_EOL, GWF_HTML::lang('th_captcha2'), GWF_Button::tooltip(GWF_HTML::lang('tt_captcha2')), $key, $data[1]);
        //			break;
        default:
            GWF3::logDie(sprintf('Your ' . __FILE__ . ' is missing datatype %d', $data[0]));
    }
    echo '</td>';
}
?>
			</tr>
		</tbody>
	</table>
	</form>
</div>
Пример #17
0
<?php 
chdir('../');
$worker_ip = 'YOUR.IP.GOES.HERE';
if (!is_readable('protected/config.php')) {
    die('Try install/wizard.php');
}
set_time_limit(0);
require_once 'protected/config.php';
require_once '../gwf3.class.php';
$gwf = new GWF3(getcwd(), array('website_init' => false, 'autoload_modules' => false, 'load_module' => false, 'load_config' => false, 'start_debug' => true, 'get_user' => false, 'do_logging' => false, 'log_request' => false, 'blocking' => false, 'no_session' => true, 'store_last_url' => false, 'ignore_user_abort' => true));
######################
### Security Check ###
######################
if (!GWF_IP6::isLocal()) {
    if ($_SERVER['REMOTE_ADDR'] !== $worker_ip) {
        GWF3::logDie(sprintf('You have no valid $worker_ip in %s line %s.', __FILE__, __LINE__));
    }
}
GWF_Debug::setDieOnError(false);
GWF_Language::initEnglish();
GWF_HTML::init();
GWF_Log::init(false, true, GWF_WWW_PATH . 'protected/logs');
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallFunctions.php';
if (false !== Common::getPost('core')) {
    $success = true;
    install_core(false, $success);
}
if (false !== Common::getPost('lang')) {
    install_createLanguage(true, true, false);
}
if (false !== Common::getPost('lang2')) {
Пример #18
0
 public static function setDesign($design)
 {
     self::$DESIGN = $design;
 }
Пример #19
0
            //				printf();
            printf('<tr><td colspan="%d">%s</td></tr>' . PHP_EOL, $cols, $data[2]);
            printf('<tr><td colspan="%d"><textarea id="%s" name="%s" cols="80" rows="8">%s</textarea></td></tr>' . PHP_EOL, $cols, $key, $key, $data[1]);
            break;
        case GWF_Form::VALIDATOR:
            break;
        case GWF_Form::FILE:
        case GWF_Form::FILE_OPT:
            printf('<tr><td>%s%s</td><td>%s</td><td><input type="file" name="%s" /></td></tr>' . PHP_EOL, $req, $data[2], $tt, $key);
            break;
        case GWF_Form::HTML:
            echo $data[1] . PHP_EOL;
            break;
        default:
            var_dump($data);
            GWF3::logDie(sprintf('Your tpl/formY.php is missing datatype %d', $data[0]));
    }
    ?>
		<?php 
}
?>
		</tbody>
	</table>
	</form>
	<?php 
if (isset($have_required)) {
    echo GWF_HTML::lang('form_required', array('*'));
}
?>
</div>
Пример #20
0
if (PHP_SAPI !== 'cli') {
    die('CLI Please');
}
# GWF_PATH
chdir('../../../');
require_once 'gwf3.class.php';
if (!defined('GWF_CONFIG_PATH')) {
    define('GWF_CONFIG_PATH', realpath(GWF_PATH . 'www/protected/config.php'));
    #TODO
}
# Is there a config file?
if (false === file_exists(GWF_CONFIG_PATH)) {
    $write_a_config = true;
    define('GWF_HAVE_CONFIG', true);
} else {
    GWF3::onLoadConfig(GWF_CONFIG_PATH);
}
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallWizard.php';
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallFunctions.php';
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallConfig.php';
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallWizardLanguage.php';
GWF_InstallWizardLanguage::init();
GWF_Log::init(false, true, GWF_PATH . '/protected/installlog');
$lang = new GWF_LangTrans(GWF_CORE_PATH . 'lang/install/install');
if (isset($write_a_config)) {
    GWF_InstallConfig::writeConfig($lang);
    echo 'I have written a default config to protected/config.php' . PHP_EOL;
    echo 'Please edit that config.php, before installing gwf3.' . PHP_EOL;
    die(0);
}
if (false === gdo_db()) {
Пример #21
0
 public function execute()
 {
     # Do not remember this "non 200" page
     GWF3::setConfig('store_last_url', false);
     return $this->templateError();
 }
Пример #22
0
<?php

chdir('../../');
apache_setenv('no-gzip', 1);
ini_set('zlib.output_compression', 0);
//ini_set('implicit_flush', 1);
#ob_implicit_flush();
require_once 'gwf3.class.php';
GWF3::onLoadConfig(GWF_CONFIG_PATH);
# Get the modules.
$modules = GWF_Module::loadModulesDB();
# Start session
if (false === GWF_Session::start(false)) {
    GWF3::LogDie('Session error. GWF not installed?');
}
# Init core templates and stuff
GWF_Language::init();
GWF_HTML::initCronjob();
# Yay, a http stream \o/
GWF_Javascript::streamHeader();
# Call Chat::AjaxStream
if (false === ($module = GWF_Module::getModule('Chat'))) {
    GWF3::logDie('MISSING MODULE');
}
$module->onLoadLanguage();
$module->onInclude();
$module->requestMethodB('AjaxStream');
Пример #23
0
 public static function getAllMethods(GWF_Module $module)
 {
     $back = array();
     $name = $module->getName();
     $path = GWF_CORE_PATH . "module/{$name}/method";
     if (!Common::isDir($path)) {
         return array();
     }
     if (false === ($dir = scandir($path))) {
         GWF3::logDie('Cannot access ' . $path . ' in ' . __METHOD__ . ' line ' . __LINE__);
     }
     foreach ($dir as $file) {
         # starts with .
         if ($file[0] === '.' || false === Common::endsWith($file, '.php')) {
             continue;
         }
         $path2 = $path . '/' . $file;
         if (Common::isFile($path2)) {
             if (false === ($method = $module->getMethod(substr($file, 0, -4)))) {
                 GWF3::logDie('NO METHOD for ' . $file);
             }
             $back[] = $method;
         }
     }
     return $back;
 }
Пример #24
0
<?php

if (defined('WC_HTML_HEAD__DEFINED')) {
    return;
}
$_GET['mo'] = 'WeChall';
$_GET['me'] = 'null';
require_once 'protected/config.php';
require_once '../gwf3.class.php';
$gwf = new GWF3(dirname(dirname(__FILE__) . '../'), array('init' => true, 'bootstrap' => false, 'website_init' => true, 'autoload_modules' => true, 'load_module' => false, 'load_config' => false, 'start_debug' => true, 'get_user' => true, 'do_logging' => true, 'log_request' => true, 'blocking' => !defined('GWF_SESSION_NOT_BLOCKING'), 'no_session' => false, 'store_last_url' => true, 'ignore_user_abort' => true));
if (false === ($wechall = GWF_Module::loadModuleDB('WeChall', true, true))) {
    die('GWF3/WC5 not installed?');
}
//$error = GWF_Module::startup();
if (defined('GWF_PAGE_TITLE')) {
    GWF_Website::setPageTitle(GWF_PAGE_TITLE);
    GWF_Website::setMetaDescr(GWF_PAGE_TITLE . ' challenge on WeChall');
    GWF_Website::setMetaTags(GWF_PAGE_TITLE . ', Challenge, WeChall');
}
# Include Needed Modules
//GWF_Module::getModule('Votes', true);
GWF_Module::loadModuleDB('Forum', true);
//GWF_Module::getModule('WeChall', true)->onLoadLanguage();
require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php';
//GWF_ForumBoard::init(true);
if (isset($_GET['ajax'])) {
    GWF_Website::plaintext();
    return;
}
$mb = WC_HTML::wantFooter() ? ' style="margin-bottom: -48px;"' : '';
# HTML Header
Пример #25
0
<?php

/*
 * This is an example how your index.php could look like
 */
# Security headers
header('X-Frame-Options: DENY');
header('content-security-policy: default-src \'self\'');
# Load config
require_once 'protected/config.php';
# <-- You might need to adjust this path.
# Init GDO and GWF core
require_once '%%GWFPATH%%gwf3.class.php';
# Init GWF
$gwf = new GWF3(getcwd(), array());
# Display page
echo $gwf->onDisplayPage();
Пример #26
0
 public function execute()
 {
     GWF3::setConfig('store_last_url', false);
     return $this->graph(Common::getGet('site'), Common::getGet('type'));
 }
Пример #27
0
# Require config
$config_file = $argv[1];
require_once '../../../www/protected/' . $config_file;
# and gwf
require_once '../../../gwf3.class.php';
$gwf = new GWF3(NULL, array('init' => true, 'bootstrap' => false, 'website_init' => false, 'autoload_modules' => false, 'load_module' => false, 'load_config' => false, 'start_debug' => true, 'get_user' => false, 'do_logging' => false, 'log_request' => false, 'blocking' => true, 'no_session' => true, 'store_last_url' => false, 'ignore_user_abort' => false, 'kick_banned_ip' => false, 'env' => isset($argv[5]) ? $argv[5] : 'prod', 'unix_user' => isset($argv[6]) ? $argv[6] : 'root'));
# That´s all of GWF3 we will share with the worker.
GWF_HTML::init();
GWF_Debug::setDieOnError(false);
GWF_Debug::setMailOnError(false);
$_GET['ajax'] = 1;
# And this is the worker process
require 'dog_include/Dog_WorkerThread.php';
$worker = new Dog_WorkerThread();
$worker->start();
# Parent resources
GWF_Log::init(false, GWF_Log::_DEFAULT - GWF_Log::BUFFERED, GWF_PATH . 'www/protected/logs/dog');
gdo_db();
# Dog please
require_once 'Dog.php';
Dog::setUnixUsername(GWF3::getConfig('unix_user'));
# Dog installer
if (isset($argv[2]) && $argv[2] === 'install') {
    require_once 'mini_install.php';
}
# Dog init
Dog_Init::init($worker);
# Dog l(a)unch
if (!defined('DOG_NO_LAUNCH') && Dog_Init::validate()) {
    Dog::mainloop();
}
Пример #28
0
/**
 * The GWF-Installation-Wizard
 * @author spaceone
 * @author gizmore
 */
header('Content-Type: text/html; charset=UTF-8');
# Load Install-Core
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallWizard.php';
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallConfig.php';
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallFunctions.php';
require_once GWF_CORE_PATH . 'inc/install/GWF_InstallWizardLanguage.php';
// define('GWF_INSTALLATION', true);
define('GWF_STEP', Common::getGetString('step', '0'));
define('GWF_LOGGING_PATH', getcwd() . '/protected/installog');
$gwf = new GWF3(getcwd(), array('website_init' => false, 'autoload_modules' => false, 'load_module' => false, 'load_config' => false, 'start_debug' => true, 'get_user' => false, 'do_logging' => true, 'log_request' => true, 'blocking' => false, 'no_session' => true, 'store_last_url' => false, 'ignore_user_abort' => true));
GWF_Debug::setDieOnError(false);
# Website init
GWF_InstallWizardLanguage::init();
GWF_HTML::init();
# Set install language
$il = new GWF_LangTrans(GWF_CORE_PATH . 'lang/install/install');
GWF_InstallWizard::setGWFIL($il);
# Design init
GWF3::setDesign('install');
GWF_Website::addCSS(GWF_WEB_ROOT . 'tpl/install/css/install.css');
GWF_Website::addCSS(GWF_WEB_ROOT . 'tpl/install/css/design.css');
GWF_Website::setPageTitle('GWF Install Wizard');
$tVars = array('gwfpath' => GWF_PATH, 'gwfwebpath' => GWF_WWW_PATH, 'step' => GWF_STEP, 'il' => $il, 'steps' => 11, 'timings' => GWF_DebugInfo::getTimings());
GWF_Template::addMainTvars($tVars);
if (false !== Common::getPost('create_admin')) {
Пример #29
0
 public static function getDesign()
 {
     return GWF3::getDesign();
 }