forked from Aspen-Discovery/aspen-discovery
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from AlexanderBlanchardAC/summon_new_features
Summon new features
- Loading branch information
Showing
18 changed files
with
270 additions
and
26 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions
4
code/web/interface/themes/responsive/images/summon.png:Zone.Identifier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ZoneTransfer] | ||
ZoneId=3 | ||
ReferrerUrl=https://www.google.com/ | ||
HostUrl=https://files.mtstatic.com/site_11811/55152/0?Expires=1708452791&Signature=O-eIysOYl-1drJTT2f6LTnuDXMhKycAnvuWBQT53Y5WC-uFeYwIE744-kFoVgc-gDsc1ODNBFX1G09SEdxs6NAzaBLFM1c9V0Xq3GZiKsUMivxIQC8YNpa9VHLWM0KE-snOgnMcGuuzuqvpFNAZA5J7FNpYuE~F2eWzOKKYIdhw_&Key-Pair-Id=APKAJ5Y6AV4GI7A555NA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
|
||
require_once ROOT_DIR . '/RecordDrivers/SummonRecordDriver.php'; | ||
|
||
class Summon_AccessOnline extends Action { | ||
|
||
private $recordDriver; | ||
|
||
function launch() { | ||
global $interface; | ||
$id = urldecode($_REQUEST['id']); | ||
|
||
$this->recordDriver = new SummonRecordDriver($id); | ||
|
||
if ($this->recordDriver->isValid()) { | ||
$activeIP = IPAddress::getActiveIp(); | ||
$subnet = IPAddress::getIPAddressForIp($activeIP); | ||
$okToAccess = false; | ||
if ($subnet != false && $subnet->authenticatedForSummon) { | ||
$okToAccess = UserAccount::isLoggedIn(); | ||
} | ||
|
||
if ($okToAccess) { | ||
require_once ROOT_DIR . '/sys/Summon/SummonRecordUsage.php'; | ||
$summonRecordUsage = new SummonRecordUsage(); | ||
global $aspenUsage; | ||
$summonRecordUsage->instance = $aspenUsage->getInstance(); | ||
$summonRecordUsage->summonId = $id; | ||
$summonRecordUsage->year = date('Y'); | ||
$summonRecordUsage->month = date('n'); | ||
if ($summonRecordUsage->find(true)) { | ||
$summonRecordUsage->timesUsed++; | ||
$ret = $summonRecordUsage->update(); | ||
if ($ret == 0) { | ||
echo("Unable to update times used"); | ||
} | ||
} else { | ||
$summonRecordUsage->timesViewedInSearch = 0; | ||
$summonRecordUsage->timesUsed = 1; | ||
$summonRecordUsage->insert(); | ||
} | ||
|
||
$userId = UserAccount::getActiveUserId(); | ||
if ($userId) { | ||
require_once ROOT_DIR . '/sys/Summon/UserSummonUsage.php'; | ||
$userSummonUsage = new UserSummonUsage(); | ||
global $aspenUsage; | ||
$userSummonUsage->instance = $aspenUsage->getInstance(); | ||
$userSummonUsage->userId = $userId; | ||
$userSummonUsage->year = date('Y'); | ||
$userSummonUsage->month = date('n'); | ||
|
||
if ($userSummonUsage->find(true)) { | ||
$userSummonUsage->usageCount++; | ||
$userSummonUsage->update(); | ||
} else { | ||
$userSummonUsage->usageCount = 1; | ||
$userSummonUsage->insert(); | ||
} | ||
} | ||
header('Location:' . $this->recordDriver->getRecordUrl()); | ||
die(); | ||
} else { | ||
require_once ROOT_DIR . '/services/MyAccount/Login.php'; | ||
$launchAction = new MyAccount_Login(); | ||
$_REQUEST['followupModule'] = 'Summon'; | ||
$_REQUEST['followUpAction'] = 'AccessOnline'; | ||
$_REQUEST['recordId'] = $id; | ||
|
||
$error_msg = translate([ | ||
'text' => 'You must be logged in to access content from Summon', | ||
'isPublicFacing' => true, | ||
]); | ||
$launchAction->launch($error_msg); | ||
} | ||
} else { | ||
$this->display('../Record/invalidRecord.tpl', 'Invalid Record', ''); | ||
die(); | ||
} | ||
} | ||
|
||
function getBreadcrumbs(): array { | ||
$breadcrumbs = []; | ||
if (!empty($this->lastSearch)) { | ||
$breadcrumbs[] = new Breadcrumb($this->lastSearch, 'Articles and Databases Search Results'); | ||
} | ||
$breadcrumbs[] = new Breadcrumb('', $this->recordDriver->getTitle()); | ||
return $breadcrumbs; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.