コード例 #1
0
 protected final function initializeAction()
 {
     //dont check permissions, but require minimal mode
     if (!ANWIKI_MODE_MINIMAL) {
         AnwDieCriticalError("not in minimal mode");
     }
 }
コード例 #2
0
ファイル: index.php プロジェクト: MenZil-Team/anwiki
        define('ANWIKI_MODE_MINIMAL', true);
    }
    require_once "engine.inc.php";
    //install redirect
    if (!file_exists(ANWIKI_INSTALL_LOCK) && AnwEnv::_GET('a') != 'install') {
        $sUrlInstall = AnwEnv::_SERVER('SCRIPT_URI') . '?a=install';
        header("Location: " . $sUrlInstall);
        print '<a href="' . AnwUtils::xQuote($sUrlInstall) . '">' . AnwUtils::xQuote($sUrlInstall) . '</a>';
        exit;
    }
    AnwDebug::startbench("preparing action", true);
    //load action code
    try {
        $sAction = strtolower(AnwEnv::_GET(AnwAction::GET_ACTIONNAME, "view"));
        $oAction = AnwAction::loadComponent($sAction);
    } catch (AnwException $e) {
        $sAction = "view";
        $oAction = AnwAction::loadComponent($sAction);
    }
    //security check
    if (ANWIKI_MODE_MINIMAL && !$oAction instanceof AnwActionMinimal) {
        AnwDieCriticalError("Unauthorized mode / bad URL");
    }
    $oAction->setAsCurrentAction();
    AnwDebug::log("Action : " . $sAction);
    AnwDebug::stopbench("preparing action");
    //run
    $oAction->runAndOutput();
} catch (AnwException $e) {
    errorApp($e);
}
コード例 #3
0
ファイル: class_env.php プロジェクト: MenZil-Team/anwiki
 static function getIp()
 {
     // hardcoded IP for batch mode
     if (ANWIKI_MODE_BATCH) {
         return "127.0.0.1";
     }
     //discover client IPs
     $asFoundIps = array();
     //don't look at proxy fields as it can easily be spoofed
     /*
     if ($bLookForProxy)
     {
     	$asFoundIps = array_reverse( explode(',', AnwEnv::_SERVER('HTTP_X_FORWARDED_FOR')) );
     	$asFoundIps[] = AnwEnv::_SERVER('HTTP_CLIENT_IP');
     	$asFoundIps[] = AnwEnv::_SERVER('HTTP_PROXY_USER');
     }
     */
     $asFoundIps[] = AnwEnv::_SERVER('REMOTE_ADDR');
     //pick up the first valid IP
     $sValidIp = null;
     foreach ($asFoundIps as $sFoundIp) {
         $sFoundIp = trim($sFoundIp);
         if (self::isValidIp($sFoundIp)) {
             $sValidIp = $sFoundIp;
         }
     }
     if (!$sValidIp) {
         AnwDieCriticalError("Unable to determine your IP address");
     }
     return $sValidIp;
 }
コード例 #4
0
 * 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 Anwiki.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * CurrentSession reserved for batch mode (no IP check).
 * @package Anwiki
 * @version $Id: class_currentsession-minimal.php 116 2009-02-07 11:09:11Z anw $
 * @copyright 2007-2009 Antoine Walter
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License 3
 */
if (!ANWIKI_MODE_BATCH || !defined("STDIN")) {
    AnwDieCriticalError("Bad execution mode");
}
class AnwCurrentSession
{
    //------------------------------------------------
    // ACCESSORS
    //------------------------------------------------
    static function getUser()
    {
        return new AnwUserBatch();
    }
    static function getLang()
    {
        return AnwComponent::globalCfgLangDefault();
    }
    /*static function getId()