本文整理汇总了PHP中Sobi::Date方法的典型用法代码示例。如果您正苦于以下问题:PHP Sobi::Date方法的具体用法?PHP Sobi::Date怎么用?PHP Sobi::Date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sobi
的用法示例。
在下文中一共展示了Sobi::Date方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addRepo
private function addRepo()
{
if (!SPFactory::mainframe()->checkToken()) {
Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::WARNING, 0, __LINE__, __FILE__);
$this->response(Sobi::Url('extensions.browse'), SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), false, SPC::ERROR_MSG);
exit;
}
$connection = SPFactory::Instance('services.remote');
$repo = trim(preg_replace('/[^a-zA-Z0-9\\.\\-\\_]/', null, SPRequest::string('repository')));
$ssl = $connection->certificate($repo);
if (isset($ssl['err'])) {
SPFactory::mainframe()->cleanBuffer()->customHeader();
//$response = sprintf( 'The connection could not be validated (error number %s). %s', $ssl[ 'err' ], $ssl[ 'msg' ] );
$response = SPLang::e('NOT_VALIDATED', $ssl['err'], $ssl['msg']);
echo json_encode(array('message' => array('type' => SPC::ERROR_MSG, 'text' => $response)));
exit;
} else {
$cert = array();
$file = SPFactory::Instance('base.fs.file', SPLoader::path('etc.repos.' . str_replace('.', '_', $repo), 'front', false, 'xml'));
$cert['url'] = 'https://' . $repo;
$cert['certificate']['serialNumber'] = $ssl['serialNumber'];
$cert['certificate']['validFrom'] = Sobi::Date($ssl['validFrom_time_t']);
$cert['certificate']['validTo'] = Sobi::Date($ssl['validTo_time_t']);
$cert['certificate']['subject'] = $ssl['subject'];
$cert['certificate']['issuer'] = $ssl['issuer'];
$cert['certificate']['hash'] = $ssl['hash'];
$def = SPFactory::Instance('types.array', $cert);
$file->content($def->toXML($cert, 'repository'));
$file->save();
/** @var $view SPExtensionsView */
$view =& SPFactory::View('extensions', true)->assign($this->_task, 'task')->assign($cert['certificate'], 'certificate')->determineTemplate('extensions', 'certificate');
ob_start();
$view->display();
$response = ob_get_contents();
$response = str_replace('id="SobiPro"', 'id="SpRepoModal"', $response);
SPFactory::mainframe()->cleanBuffer()->customHeader();
echo json_encode(array('message' => array('type' => SPC::INFO_MSG, 'response' => $response)));
exit;
}
}