コード例 #1
0
ファイル: dataonly.php プロジェクト: OptimalInternet/uCore
 public static function process()
 {
     $type = isset($_GET['dataonly-type']) ? $_GET['dataonly-type'] : NULL;
     if (!$type || !isset(self::$types[$type])) {
         utopia::UseTemplate();
         utopia::PageNotFound();
         return;
     }
     $qs = $_GET;
     unset($qs['__ajax']);
     unset($qs['dataonly-type']);
     $cm = utopia::GetCurrentModule();
     if (!self::IsAllowed($cm)) {
         // redirect to module
         $obj = utopia::GetInstance($cm);
         header('Location: ' . $obj->GetURL($qs));
         return;
     }
     try {
         // try to access it dataonly, if it fails for any reason, break out of , redirect
         call_user_func(self::$types[$type]);
     } catch (Exception $e) {
         $obj = utopia::GetInstance($cm);
         header('Location: ' . $obj->GetURL($qs));
         return;
     }
 }
コード例 #2
0
 static function RunPopup()
 {
     utopia::SetTitle('Browse Media');
     uEvents::RemoveCallback('ProcessDomDocument', 'uAdminBar::ProcessDomDocument');
     utopia::UseTemplate(TEMPLATE_BLANK);
     utopia::$noSnip = true;
     $o = utopia::GetInstance('fileManager');
     $o->_RunModule();
 }
コード例 #3
0
ファイル: users.php プロジェクト: OptimalInternet/uCore
 public function RunModule()
 {
     $obj = utopia::GetInstance('uUsersList');
     $obj->BypassSecurity(true);
     $rec = $obj->LookupRecord(array('role' => -1, 'validated' => 1), true);
     $obj->BypassSecurity(false);
     if ($rec) {
         header('Location: ' . PATH_REL_CORE);
         die;
     }
     utopia::UseTemplate(TEMPLATE_ADMIN);
     if (isset($_POST['db_pw'])) {
         if ($_POST['db_pw'] === SQL_PASSWORD) {
             $_SESSION['db_admin_authed'] = true;
         } else {
             uNotices::AddNotice('Sorry, you did not enter the database password correctly.', NOTICE_TYPE_WARNING);
         }
     }
     if (!isset($_SESSION['db_admin_authed'])) {
         // first confirm db password
         echo '<p>No Site Administrator has been set up.</p><p>You can set one up now by confirming the database password:</p>';
         echo '<form action="" method="POST">';
         echo '<input type="password" name="db_pw" />';
         echo '<input type="submit" value="Confirm" />';
         echo '</form>';
         return;
     }
     // now register user
     $regObj = utopia::GetInstance('uRegisterUser');
     $user_id = $regObj->RegisterForm();
     // login as this user, then perform the update
     if ($user_id) {
         // now set this users role
         $regObj->UpdateField('role', -1, $user_id);
         unset($_SESSION['db_admin_authed']);
         uNotices::AddNotice('Admin user has now been set up.');
         uVerifyEmail::VerifyAccount($user_id);
         header('Location: ' . PATH_REL_CORE);
         die;
     }
     if ($_POST && isset($_POST['username'])) {
         $rec = $obj->LookupRecord(array('username' => $_POST['username']), true);
         uVerifyEmail::VerifyAccount($rec['user_id']);
     }
 }
コード例 #4
0
ファイル: initialise.php プロジェクト: OptimalInternet/uCore
    $row['module_name']::Initialise();
    timer_end('Init: ' . $row['module_name']);
}
timer_end('Static Initialise');
uConfig::DefineConfig();
uConfig::ValidateConfig();
uEvents::TriggerEvent('ConfigDefined');
timer_start('Before Init');
uEvents::TriggerEvent('BeforeInit');
timer_end('Before Init');
timer_start('Table Initialise');
uTableDef::TableExists(null);
// cache table exists
$allmodules = utopia::GetModulesOf('uTableDef');
foreach ($allmodules as $row) {
    // must run second due to requiring GLOB_MOD to be setup fully
    timer_start('Init: ' . $row['module_name']);
    $obj = utopia::GetInstance($row['module_name']);
    $obj->AssertTable();
    // setup Parents
    timer_end('Init: ' . $row['module_name']);
}
timer_end('Table Initialise');
define('INIT_COMPLETE', TRUE);
timer_start('After Init');
uEvents::TriggerEvent('InitComplete');
uEvents::TriggerEvent('AfterInit');
timer_end('After Init');
if ($_SERVER['HTTP_HOST'] !== 'cli') {
    utopia::UseTemplate(TEMPLATE_DEFAULT);
}
コード例 #5
0
ファイル: setup.php プロジェクト: OptimalInternet/uCore
 static function DownMaintenance()
 {
     $rc = '/' . ltrim(preg_replace('/^' . preg_quote(PATH_REL_ROOT, '/') . '/', '', PATH_REL_CORE), '/');
     utopia::UseTemplate($rc . 'themes/install');
     header("HTTP/1.0 503 Service Unavailable", true, 503);
     utopia::SetTitle('Website Down For Maintenance');
     echo '<h1>We Will Be Back Soon</h1>';
     echo '<p>We are currently unavailable while we make upgrades to improve our service to you.  We&#39;ll return very soon.</p>';
     echo '<p>We apologise for the inconvenience and appreciate your patience.<p>';
     echo '<h2>Thank you!</h2>';
     utopia::Finish();
 }
コード例 #6
0
ファイル: cms.php プロジェクト: OptimalInternet/uCore
 public static function assertContent()
 {
     $o = utopia::GetInstance(__CLASS__);
     if (self::$asserted) {
         return;
     }
     self::$asserted = true;
     $rec = self::findPage();
     if (!$rec) {
         if (utopia::GetCurrentModule() == __CLASS__) {
             utopia::PageNotFound();
         }
         return;
     }
     $canEdit = uEvents::TriggerEvent('CanAccessModule', 'uCMS_Edit') !== FALSE;
     if (!$canEdit && !$rec['is_published']) {
         utopia::PageNotFound();
     }
     if (!isset($_GET['preview']) && !isset($_GET['edit']) && !$rec['is_published']) {
         utopia::PageNotFound();
     }
     echo '<div class="cms-' . $rec['cms_id'] . '">{content}</div>';
     utopia::SetVar('cms_id', $rec['cms_id']);
     utopia::SetVar('cms_parent_id', $rec['parent']);
     $path = $o->GetCmsParents($rec['cms_id']);
     utopia::SetVar('cms_parents', $path);
     utopia::SetVar('cms_root_id', reset($path));
     utopia::SetDescription($rec['description']);
     if (!utopia::UsingTemplate() || utopia::UsingTemplate(TEMPLATE_BLANK)) {
         return;
     }
     utopia::UseTemplate(self::GetTemplate($rec['cms_id']));
 }