本文整理汇总了PHP中Jaws_DB类的典型用法代码示例。如果您正苦于以下问题:PHP Jaws_DB类的具体用法?PHP Jaws_DB怎么用?PHP Jaws_DB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Jaws_DB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: Execute
/**
* Returns an array with the results of a search
*
* @access public
* @param string $pSql Prepared search(WHERE) SQL
* @return array An array of entries that matches a certain pattern
*/
function Execute($pSql = '')
{
$params = array();
$sql = '
SELECT
[id],[name], [title], [description], [meta_keywords], [meta_description]
FROM [[tags]]
';
if ($GLOBALS['app']->Session->Logged()) {
$params['user'] = $GLOBALS['app']->Session->GetAttribute('user');
$wStr = '([user]=0 OR [user]={user})';
} else {
$wStr = '[user]=0';
}
$sql .= ' WHERE ' . $wStr;
$sql .= ' AND ' . $pSql;
$sql .= ' ORDER BY [id] desc';
$types = array('integer', 'text', 'text', 'text', 'text', 'text');
$result = Jaws_DB::getInstance()->queryAll($sql, $params, $types);
if (Jaws_Error::IsError($result)) {
return array();
}
$tags = array();
foreach ($result as $t) {
$tag = array();
$tag['title'] = $t['title'];
$url = $this->gadget->urlMap('ViewTag', array('tag' => $t['name']));
$tag['url'] = $url;
$tag['image'] = 'gadgets/Tags/Resources/images/logo.png';
$tag['snippet'] = $t['description'];
$tag['date'] = null;
$tags[$t['id']] = $tag;
}
return $tags;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:42,代码来源:Search.php
示例2: GetEnableBanners
/**
* Retrieve banners that can be visible
*
* @access public
* @param int $gid group ID
* @param int $random
* @return mixed An array of available banners or False on error
*/
function GetEnableBanners($gid = 0, $random = 0)
{
$bannersTable = Jaws_ORM::getInstance()->table('banners');
$bannersTable->select('id:integer', 'title', 'url', 'banner', 'template');
$bannersTable->where('published', true)->and()->where('random', $random)->and();
$bannersTable->openWhere('views_limitation', 0)->or();
$bannersTable->closeWhere('views', $bannersTable->expr('views_limitation'), '<')->and();
$bannersTable->openWhere('clicks_limitation', 0)->or();
$bannersTable->closeWhere('clicks', $bannersTable->expr('clicks_limitation'), '<')->and();
$bannersTable->openWhere('start_time', '', 'is null')->or();
$bannersTable->closeWhere('start_time', Jaws_DB::getInstance()->date(), '<=')->and();
$bannersTable->openWhere('stop_time', '', 'is null')->or();
$bannersTable->closeWhere('stop_time', Jaws_DB::getInstance()->date(), '>=');
if ($gid == 0) {
$bannersTable->orderBy('id asc');
} else {
$bannersTable->and()->where('gid', $gid);
$bannersTable->orderBy('id asc');
}
$res = $bannersTable->fetchAll();
if (Jaws_Error::IsError($res)) {
return false;
}
return $res;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:33,代码来源:Banners.php
示例3: Execute
/**
* Returns an array with the results of a search
*
* @access public
* @param string $pSql Prepared search(WHERE) SQL
* @return array An array of entries that matches a certain pattern
*/
function Execute($pSql = '')
{
$sql = '
SELECT
[id], [title], [description], [user_filename], [update_time]
FROM [[directory]]
WHERE
[hidden] = {hidden}
';
$sql .= ' AND ' . $pSql;
$sql .= ' ORDER BY id desc';
$params = array();
$params['hidden'] = false;
$types = array('text', 'text', 'text', 'integer');
$result = Jaws_DB::getInstance()->queryAll($sql, $params, $types);
if (Jaws_Error::IsError($result)) {
return array();
}
$date = Jaws_Date::getInstance();
$files = array();
foreach ($result as $p) {
$file = array();
$file['title'] = $p['title'];
$file['url'] = $this->gadget->urlMap('Directory', array('id' => $p['id']));
$file['image'] = 'gadgets/Directory/Resources/images/logo.png';
$file['snippet'] = $p['description'];
$file['date'] = $p['update_time'];
$stamp = $p['update_time'];
$files[$stamp] = $file;
}
return $files;
}
开发者ID:uda,项目名称:jaws,代码行数:39,代码来源:Search.php
示例4: Execute
/**
* Returns an array with the results of a search
*
* @access public
* @param string $pSql Prepared search (WHERE) SQL
* @return array An array of entries that matches a certain pattern
*/
function Execute($pSql = '')
{
// TODO: must be converted to Jaws_ORM
$sql = '
SELECT
[id], [title], [contents], [updatetime]
FROM [[blocks]]
';
$sql .= ' WHERE ' . $pSql;
$sql .= ' ORDER BY [createtime] desc';
$result = Jaws_DB::getInstance()->queryAll($sql);
if (Jaws_Error::IsError($result)) {
return array();
}
$date = Jaws_Date::getInstance();
$blocks = array();
foreach ($result as $r) {
$block = array();
$block['title'] = $r['title'];
$block['url'] = $this->gadget->urlMap('Block', array('id' => $r['id']));
$block['image'] = 'gadgets/Blocks/Resources/images/logo.png';
$block['snippet'] = $r['contents'];
$block['date'] = $date->ToISO($r['updatetime']);
$blocks[] = $block;
}
return $blocks;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:34,代码来源:Search.php
示例5: NewTerm
/**
* Adds a new term
*
* @acess public
* @param string $term Term
* @param string $fast_url
* @param string $desc Term's description
* @return mixed Returns true if term was added or Jaws_Error on error
*/
function NewTerm($term, $fast_url, $desc)
{
$fast_url = empty($fast_url) ? $term : $fast_url;
$fast_url = $this->GetRealFastUrl($fast_url, 'glossary');
$now = Jaws_DB::getInstance()->date();
$params['term'] = $term;
$params['fast_url'] = $fast_url;
$params['description'] = $desc;
$params['createtime'] = $now;
$params['updatetime'] = $now;
$glossaryTable = Jaws_ORM::getInstance()->table('glossary');
$result = $glossaryTable->insert($params)->exec();
if (Jaws_Error::IsError($result)) {
$GLOBALS['app']->Session->PushLastResponse(_t('GLOSSARY_ERROR_TERM_NOT_CREATED'), RESPONSE_ERROR);
return new Jaws_Error(_t('GLOSSARY_ERROR_TERM_NOT_CREATED'));
}
$GLOBALS['app']->Session->PushLastResponse(_t('GLOSSARY_TERM_ADDED'), RESPONSE_NOTICE);
$glossaryTable = Jaws_ORM::getInstance()->table('glossary');
$row = $glossaryTable->select('id:integer')->where('createtime', $now)->fetchRow();
if (Jaws_Error::IsError($row)) {
$GLOBALS['app']->Session->PushLastResponse(_t('GLOSSARY_ERROR_TERM_NOT_CREATED'), RESPONSE_ERROR);
return new Jaws_Error(_t('GLOSSARY_ERROR_TERM_NOT_CREATED'));
}
if (isset($row['id'])) {
return $row['id'];
}
return false;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:37,代码来源:Term.php
示例6: Execute
/**
* Returns an array with the results of a search
*
* @access public
* @param string $pSql Prepared search (WHERE) SQL
* @return mixed An array of entries that matches a certain pattern or False on error
*/
function Execute($pSql = '')
{
$sql = '
SELECT
[id], [term], [description], [createtime]
FROM [[glossary]]
';
$sql .= ' WHERE ' . $pSql;
$sql .= " ORDER BY [createtime] desc";
$result = Jaws_DB::getInstance()->queryAll($sql);
if (Jaws_Error::IsError($result)) {
return false;
}
$date = Jaws_Date::getInstance();
$entries = array();
foreach ($result as $r) {
$entry = array();
$entry['title'] = $r['term'];
$entry['url'] = $this->gadget->urlMap('ViewTerm', array('term' => $r['id']));
$entry['image'] = 'gadgets/Glossary/Resources/images/logo.png';
$entry['snippet'] = $r['description'];
$entry['date'] = $date->ToISO($r['createtime']);
$stamp = str_replace(array('-', ':', ' '), '', $r['createtime']);
$entries[$stamp] = $entry;
}
return $entries;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:34,代码来源:Search.php
示例7: NewTrackback
/**
* Create a new trackback
*
* @access public
* @param int $parent_id ID of the entry
* @param string $url URL of the trackback
* @param string $title Title of the trackback
* @param string $excerpt The Excerpt
* @param string $blog_name The name of the Blog
* @param string $ip The sender ip address
* @return mixed True if trackback was successfully added, if not, returns Jaws_Error
*/
function NewTrackback($parent_id, $url, $title, $excerpt, $blog_name, $ip)
{
if ($this->gadget->registry->fetch('trackback') == 'true') {
$model = $this->gadget->model->load('Posts');
if (!$model->DoesEntryExists($parent_id)) {
return new Jaws_Error(_t('BLOG_ERROR_DOES_NOT_EXISTS'));
}
// lets only load it if it's actually needed
$now = Jaws_DB::getInstance()->date();
$trackbackTable = Jaws_ORM::getInstance()->table('blog_trackback');
$trackbackTable->select('id:integer')->where('parent_id', $parent_id);
$id = $trackbackTable->and()->where('url', strip_tags($url))->fetchOne();
$trackData['title'] = strip_tags($title);
$trackData['excerpt'] = strip_tags($excerpt);
$trackData['blog_name'] = strip_tags($blog_name);
$trackData['updatetime'] = $now;
$trackbackTable = Jaws_ORM::getInstance()->table('blog_trackback');
if (!Jaws_Error::IsError($id) && !empty($id)) {
$trackbackTable->update($trackData)->where('id', $id);
} else {
$trackData['parent_id'] = $parent_id;
$trackData['url'] = strip_tags($url);
$trackData['ip'] = $ip;
$trackData['status'] = $this->gadget->registry->fetch('trackback_status');
$trackData['createtime'] = $now;
$trackbackTable->insert($trackData);
}
$result = $trackbackTable->exec();
if (Jaws_Error::IsError($result)) {
return new Jaws_Error(_t('BLOG_ERROR_TRACKBACK_NOT_ADDED'));
}
return true;
}
return true;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:47,代码来源:Trackbacks.php
示例8: Execute
/**
* Returns an array with the results of a search
*
* @access public
* @param string $pSql Prepared search (WHERE) SQL
* @return array An array of entries that matches a certain pattern
*/
function Execute($pSql = '')
{
$params = array('active' => true);
$sql = '
SELECT
[category],
[question],
[answer],
[faq_position],
[updatetime]
FROM [[faq]]
WHERE [published] = {active}
';
$sql .= ' AND ' . $pSql;
$sql .= ' ORDER BY [createtime] desc';
$result = Jaws_DB::getInstance()->queryAll($sql, $params);
if (Jaws_Error::IsError($result)) {
return array();
}
$questions = array();
$date = Jaws_Date::getInstance();
foreach ($result as $r) {
$question = array();
$question['title'] = $r['question'];
$question['url'] = $this->gadget->urlMap('ViewCategory', array('id' => $r['category'])) . '#Question' . $r['faq_position'];
$question['image'] = 'gadgets/Faq/Resources/images/logo.png';
$question['snippet'] = $r['answer'];
$question['date'] = $date->ToISO($r['updatetime']);
$questions[] = $question;
}
return $questions;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:39,代码来源:Search.php
示例9: Backup
/**
* Returns downloadable backup file
*
* @access public
* @return void
*/
function Backup()
{
$this->gadget->CheckPermission('Backup');
$tmpDir = sys_get_temp_dir();
$domain = preg_replace("/^(www.)|(:{$_SERVER['SERVER_PORT']})\$|[^a-z0-9\\-\\.]/", '', strtolower($_SERVER['HTTP_HOST']));
$nameArchive = $domain . '-' . date('Y-m-d') . '.tar.gz';
$pathArchive = $tmpDir . DIRECTORY_SEPARATOR . $nameArchive;
//Dump database data
$dbFileName = 'dbdump.xml';
$dbFilePath = $tmpDir . DIRECTORY_SEPARATOR . $dbFileName;
Jaws_DB::getInstance()->Dump($dbFilePath);
$files = array();
require_once PEAR_PATH . 'File/Archive.php';
$files[] = File_Archive::read(JAWS_DATA);
$files[] = File_Archive::read($dbFilePath, $dbFileName);
File_Archive::extract($files, File_Archive::toArchive($pathArchive, File_Archive::toFiles()));
Jaws_Utils::Delete($dbFilePath);
// browser must download file from server instead of cache
header("Expires: 0");
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
// force download dialog
header("Content-Type: application/force-download");
// set data type, size and filename
header("Content-Disposition: attachment; filename=\"{$nameArchive}\"");
header("Content-Transfer-Encoding: binary");
header('Content-Length: ' . @filesize($pathArchive));
@readfile($pathArchive);
Jaws_Utils::Delete($pathArchive);
}
开发者ID:Dulciane,项目名称:jaws,代码行数:36,代码来源:Backup.php
示例10: Execute
/**
* Returns an array with the results of a search
*
* @access public
* @param string $pSql Prepared search (WHERE) SQL
* @return array An array of entries that matches a certain pattern
*/
function Execute($pSql = '')
{
$sql = '
SELECT
[id], [title], [url], [description], [updatetime]
FROM [[linkdump_links]]
';
$sql .= ' WHERE ' . $pSql;
$sql .= ' ORDER BY [createtime] desc';
$result = Jaws_DB::getInstance()->queryAll($sql);
if (Jaws_Error::IsError($result)) {
return array();
}
$date = Jaws_Date::getInstance();
$links = array();
foreach ($result as $r) {
$link = array();
$link['title'] = $r['title'];
$link['url'] = $this->gadget->urlMap('Link', array('id' => $r['id']));
$link['outer'] = true;
$link['image'] = 'gadgets/LinkDump/Resources/images/logo.png';
$link['snippet'] = $r['description'];
$link['date'] = $date->ToISO($r['updatetime']);
$links[] = $link;
}
return $links;
}
开发者ID:juniortux,项目名称:jaws,代码行数:34,代码来源:Search.php
示例11: InsertContact
/**
* Sends email to user
*
* @access public
* @param string $name Name
* @param string $email Email address
* @param string $company
* @param string $url
* @param string $tel
* @param string $fax
* @param string $mobile
* @param string $address
* @param string $rcipient Rcipient ID
* @param string $subject Subject of message
* @param string $attachment Attachment filename
* @param string $message Message content
* @return bool True on Success or False on Failure
*/
function InsertContact($name, $email, $company, $url, $tel, $fax, $mobile, $address, $recipient, $subject, $attachment, $message)
{
$now = Jaws_DB::getInstance()->date();
$data = array();
$data['[user]'] = $GLOBALS['app']->Session->GetAttribute('user');
$data['ip'] = $_SERVER['REMOTE_ADDR'];
$data['name'] = $name;
$data['email'] = $email;
$data['company'] = $company;
$data['url'] = $url;
$data['tel'] = $tel;
$data['fax'] = $fax;
$data['mobile'] = $mobile;
$data['address'] = $address;
$data['recipient'] = (int) $recipient;
$data['subject'] = $subject;
$data['attachment'] = $attachment;
$data['msg_txt'] = $message;
$data['reply'] = '';
$data['reply_sent'] = 0;
$data['createtime'] = $now;
$data['updatetime'] = $now;
$cntctTable = Jaws_ORM::getInstance()->table('contacts');
$result = $cntctTable->insert($data)->exec();
if (Jaws_Error::IsError($result)) {
return false;
}
$GLOBALS['app']->Session->SetCookie('visitor_name', $name, 60 * 24 * 150);
$GLOBALS['app']->Session->SetCookie('visitor_email', $email, 60 * 24 * 150);
$GLOBALS['app']->Session->SetCookie('visitor_url', $url, 60 * 24 * 150);
return $result;
}
开发者ID:juniortux,项目名称:jaws,代码行数:50,代码来源:Contacts.php
示例12: Execute
/**
* Returns an array of the search results
*
* @access public
* @param string $pSql Prepared search(WHERE) SQL
* @return array Array of entries match a certain pattern
*/
function Execute($pSql = '')
{
$sql = '
SELECT
[id], [title], [quotation], [updatetime]
FROM [[quotes]]
WHERE [published] = {published}
';
$sql .= ' AND ' . $pSql;
$sql .= ' ORDER BY [id] desc';
$params = array();
$params['published'] = true;
$result = Jaws_DB::getInstance()->queryAll($sql, $params);
if (Jaws_Error::IsError($result)) {
return array();
}
$date = Jaws_Date::getInstance();
$quotations = array();
foreach ($result as $r) {
$quotation = array();
$quotation['title'] = $r['title'];
$quotation['url'] = $this->gadget->urlMap('ViewQuote', array('id' => $r['id']));
$quotation['image'] = 'gadgets/Quotes/Resources/images/logo.png';
$quotation['snippet'] = $r['quotation'];
$quotation['date'] = $date->ToISO($r['updatetime']);
$quotations[] = $quotation;
}
return $quotations;
}
开发者ID:juniortux,项目名称:jaws,代码行数:36,代码来源:Search.php
示例13: UpdateCategory
/**
* Updates a category entry
*
* @access public
* @param int $cid Category ID
* @param string $name Category name
* @param string $description Category description
* @param string $fast_url Category fast url
* @param string $meta_keywords Meta keywords of the category
* @param string $meta_desc Meta description of the category
* @return mixed True on success, Jaws_Error on failure
*/
function UpdateCategory($cid, $name, $description, $fast_url, $meta_keywords, $meta_desc)
{
if (!$this->gadget->GetPermission('CategoryManage', $cid)) {
$GLOBALS['app']->Session->PushLastResponse(_t('GLOBAL_ERROR_ACCESS_DENIED'), RESPONSE_ERROR);
return false;
}
$fast_url = empty($fast_url) ? $name : $fast_url;
$fast_url = $this->GetRealFastUrl($fast_url, 'blog_category', false);
$params['name'] = $name;
$params['description'] = $description;
$params['fast_url'] = $fast_url;
$params['meta_keywords'] = $meta_keywords;
$params['meta_description'] = $meta_desc;
$params['updatetime'] = Jaws_DB::getInstance()->date();
$catTable = Jaws_ORM::getInstance()->table('blog_category');
$result = $catTable->update($params)->where('id', $cid)->exec();
if (Jaws_Error::IsError($result)) {
$GLOBALS['app']->Session->PushLastResponse(_t('BLOG_ERROR_CATEGORY_NOT_UPDATED'), RESPONSE_ERROR);
return new Jaws_Error(_t('BLOG_ERROR_CATEGORY_NOT_UPDATED'));
}
if ($this->gadget->registry->fetch('generate_category_xml') == 'true') {
$model = $this->gadget->model->load('Feeds');
$catAtom = $model->GetCategoryAtomStruct($cid);
$model->MakeCategoryAtom($cid, $catAtom, true);
$model->MakeCategoryRSS($cid, $catAtom, true);
}
$GLOBALS['app']->Session->PushLastResponse(_t('BLOG_CATEGORY_UPDATED'), RESPONSE_NOTICE);
return true;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:41,代码来源:Categories.php
示例14: UpdateQuestion
/**
* Update a question
*
* @access public
* @param string $id Number of the question
* @param array $data Question data
* @return mixed True if question is succesfully updated, Jaws_Error if not
*/
function UpdateQuestion($id, $data)
{
$fast_url = empty($data['fast_url']) ? $data['question'] : $data['fast_url'];
$data['fast_url'] = $this->GetRealFastUrl($fast_url, 'faq');
$data['updatetime'] = Jaws_DB::getInstance()->date();
$faqTable = Jaws_ORM::getInstance()->table('faq');
return $faqTable->update($data)->where('id', $id)->exec();
}
开发者ID:uda,项目名称:jaws,代码行数:16,代码来源:Question.php
示例15: Uninstall
/**
* Uninstalls the gadget
*
* @access public
* @return mixed True on Success or Jaws_Error on Failure
*/
function Uninstall()
{
$result = Jaws_DB::getInstance()->dropTable('filebrowser');
if (Jaws_Error::IsError($result)) {
$errMsg = _t('GLOBAL_ERROR_GADGET_NOT_UNINSTALLED', $this->gadget->title);
return new Jaws_Error($errMsg);
}
return true;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:15,代码来源:Installer.php
示例16: Execute
/**
* Returns an array with the results of a search
*
* @access public
* @param string $pSql Prepared search (WHERE) SQL
* @return array An array of entries that matches a certain pattern
*/
function Execute($pSql = '')
{
$params = array('published' => true);
$sql = '
SELECT
[id],
[title],
[fast_url],
[summary],
[text],
[categories],
[createtime],
[updatetime]
FROM [[blog]]
WHERE
[published] = {published}
AND
[createtime] <= {now}
';
$sql .= ' AND ' . $pSql;
$sql .= ' ORDER BY [createtime] desc';
$params['now'] = Jaws_DB::getInstance()->date();
$params['published'] = true;
$result = Jaws_DB::getInstance()->queryAll($sql, $params);
if (Jaws_Error::IsError($result)) {
return array();
}
$date = Jaws_Date::getInstance();
$entries = array();
foreach ($result as $key => $r) {
$permission = true;
foreach (explode(",", $r['categories']) as $cat) {
if (!$this->gadget->GetPermission('CategoryAccess', $cat)) {
$permission = false;
}
}
if (!$permission) {
continue;
}
$entry = array();
$entry['title'] = $r['title'];
if (empty($r['fast_url'])) {
$url = $this->gadget->urlMap('SingleView', array('id' => $r['id']));
} else {
$url = $this->gadget->urlMap('SingleView', array('id' => $r['fast_url']));
}
$entry['url'] = $url;
//FIXME: Will be great if we can get the first image in "text"
$entry['image'] = 'gadgets/Blog/Resources/images/logo.png';
$entry['snippet'] = empty($r['summary']) ? $r['text'] : $r['summary'];
$entry['date'] = $date->ToISO($r['createtime']);
$stamp = str_replace(array('-', ':', ' '), '', $r['createtime']);
$entries[$stamp] = $entry;
}
return $entries;
}
开发者ID:juniortux,项目名称:jaws,代码行数:63,代码来源:Search.php
示例17: Run
/**
* Does any actions required to finish the stage, such as DB queries.
*
* @access public
* @return bool|Jaws_Error Either true on success, or a Jaws_Error
* containing the reason for failure.
*/
function Run()
{
// Connect to database
require_once JAWS_PATH . 'include/Jaws/DB.php';
$objDatabase = Jaws_DB::getInstance('default', $_SESSION['upgrade']['Database']);
if (Jaws_Error::IsError($objDatabase)) {
_log(JAWS_LOG_DEBUG, "There was a problem connecting to the database, please check the details and try again");
return new Jaws_Error(_t('UPGRADE_DB_RESPONSE_CONNECT_FAILED'), 0, JAWS_ERROR_WARNING);
}
// upgrade core database schema
$old_schema = JAWS_PATH . 'upgrade/Resources/schema/0.9.0.xml';
$new_schema = JAWS_PATH . 'upgrade/Resources/schema/schema.xml';
if (!file_exists($old_schema)) {
return new Jaws_Error(_t('GLOBAL_ERROR_SQLFILE_NOT_EXISTS', '0.9.0.xml'), 0, JAWS_ERROR_ERROR);
}
if (!file_exists($new_schema)) {
return new Jaws_Error(_t('GLOBAL_ERROR_SQLFILE_NOT_EXISTS', 'schema.xml'), 0, JAWS_ERROR_ERROR);
}
_log(JAWS_LOG_DEBUG, "Upgrading core schema");
$result = Jaws_DB::getInstance()->installSchema($new_schema, '', $old_schema);
if (Jaws_Error::isError($result)) {
_log(JAWS_LOG_ERROR, $result->getMessage());
if ($result->getCode() !== MDB2_ERROR_ALREADY_EXISTS) {
return new Jaws_Error($result->getMessage(), 0, JAWS_ERROR_ERROR);
}
}
// Create application
include_once JAWS_PATH . 'include/Jaws.php';
$GLOBALS['app'] = jaws();
$GLOBALS['app']->Registry->Init();
// Upgrading core gadgets
$gadgets = array('UrlMapper', 'Settings', 'ControlPanel', 'Policy', 'Layout', 'Users', 'Comments');
foreach ($gadgets as $gadget) {
$objGadget = Jaws_Gadget::getInstance($gadget);
if (Jaws_Error::IsError($objGadget)) {
_log(JAWS_LOG_DEBUG, "There was a problem loading core gadget: " . $gadget);
return $objGadget;
}
$installer = $objGadget->installer->load();
if (Jaws_Error::IsError($installer)) {
_log(JAWS_LOG_DEBUG, "There was a problem loading installer of core gadget: {$gadget}");
return $installer;
}
if (Jaws_Gadget::IsGadgetInstalled($gadget)) {
$result = $installer->UpgradeGadget();
} else {
continue;
//$result = $installer->InstallGadget();
}
if (Jaws_Error::IsError($result)) {
_log(JAWS_LOG_DEBUG, "There was a problem installing/upgrading core gadget: {$gadget}");
return $result;
}
}
return true;
}
开发者ID:Dulciane,项目名称:jaws,代码行数:63,代码来源:09To100.php
示例18: GetLastPoll
/**
* Gets the last visible poll
*
* @access public
* @return mixed An array with the last visible and returns Jaws_Error or false on error
*/
function GetLastPoll()
{
$now = Jaws_DB::getInstance()->date();
$table = Jaws_ORM::getInstance()->table('poll');
$table->select('id', 'gid', 'question', 'select_type', 'poll_type', 'result_view', 'start_time', 'stop_time', 'visible');
$table->where('visible', 1)->and();
$table->openWhere()->where('start_time', '', 'is null')->or();
$table->where('start_time', $now, '>=')->closeWhere()->and();
$table->openWhere()->where('stop_time', '', 'is null')->or();
$table->where('stop_time', $now, '<=')->closeWhere();
return $table->orderBy('id')->fetchRow();
}
开发者ID:Dulciane,项目名称:jaws,代码行数:18,代码来源:Poll.php
示例19: Display
/**
* Builds the upgrader page.
*
* @access public
* @return string A block of valid XHTML to display the status of old/current jaws versions
*/
function Display()
{
include_once JAWS_PATH . 'include/Jaws/DB.php';
$objDatabase = Jaws_DB::getInstance('default', $_SESSION['upgrade']['Database']);
require_once JAWS_PATH . 'include/Jaws.php';
$GLOBALS['app'] = jaws();
if (!isset($_SESSION['upgrade']['InstalledVersion'])) {
$_SESSION['upgrade']['InstalledVersion'] = $GLOBALS['app']->Registry->Init();
}
$GLOBALS['app']->loadPreferences(array('language' => $_SESSION['upgrade']['language']), false);
$supportedversions = array(array('version' => '1.2.0', 'stage' => '9'), array('version' => '1.1.1', 'stage' => '8'), array('version' => '1.1.0', 'stage' => '7'), array('version' => '1.0.0', 'stage' => '6'), array('version' => '0.9.3', 'stage' => null), array('version' => '0.9.2', 'stage' => null), array('version' => '0.9.1', 'stage' => null), array('version' => '0.9.0', 'stage' => null));
_log(JAWS_LOG_DEBUG, "Checking/Reporting previous missed installations");
$tpl = new Jaws_Template(false, false);
$tpl->Load('display.html', 'stages/Report/templates');
$tpl->SetBlock('Report');
$tpl->setVariable('lbl_info', _t('UPGRADE_REPORT_INFO', JAWS_VERSION));
$tpl->setVariable('lbl_message', _t('UPGRADE_REPORT_MESSAGE'));
$tpl->SetVariable('next', _t('GLOBAL_NEXT'));
$versions_to_upgrade = 0;
$_SESSION['upgrade']['stagedVersions'] = array();
foreach ($supportedversions as $supported) {
$tpl->SetBlock('Report/versions');
$tpl->SetBlock('Report/versions/version');
$tpl->SetVariable('description', $supported['version']);
$_SESSION['upgrade']['versions'][$supported['version']] = array('version' => $supported['version'], 'stage' => $supported['stage'], 'file' => isset($supported['file']) ? $supported['file'] : '', 'script' => isset($supported['script']) ? $supported['script'] : '');
if (version_compare($supported['version'], $_SESSION['upgrade']['InstalledVersion'], '<=')) {
if ($supported['version'] == JAWS_VERSION) {
$tpl->SetVariable('status', _t('UPGRADE_REPORT_NO_NEED_CURRENT'));
_log(JAWS_LOG_DEBUG, $supported['version'] . " does not requires upgrade(is current)");
} else {
$tpl->SetVariable('status', _t('UPGRADE_REPORT_NO_NEED'));
_log(JAWS_LOG_DEBUG, $supported['version'] . " does not requires upgrade");
}
$_SESSION['upgrade']['versions'][$supported['version']]['status'] = true;
} else {
$tpl->SetVariable('status', _t('UPGRADE_REPORT_NEED'));
$_SESSION['upgrade']['versions'][$supported['version']]['status'] = false;
$versions_to_upgrade++;
_log(JAWS_LOG_DEBUG, $supported['version'] . " requires upgrade");
$_SESSION['upgrade']['versions'][$supported['version']]['status'] = false;
}
if (!is_null($supported['stage'])) {
$_SESSION['upgrade']['stagedVersions'][] = $supported['version'];
}
$tpl->ParseBlock('Report/versions/version');
$tpl->ParseBlock('Report/versions');
}
$_SESSION['upgrade']['versions_to_upgrade'] = $versions_to_upgrade;
arsort($_SESSION['upgrade']['versions']);
krsort($_SESSION['upgrade']['stagedVersions']);
$tpl->ParseBlock('Report');
return $tpl->Get();
}
开发者ID:Dulciane,项目名称:jaws,代码行数:59,代码来源:Report.php
示例20: GetDBServerInfo
/**
* Gets database server information
*
* @access public
* @param int $iType Type of information
* @return string Database server information
*/
function GetDBServerInfo($iType = 0)
{
static $dbInfo;
if (!isset($dbInfo)) {
$dbInfo = Jaws_DB::getInstance()->getDatabaseInfo();
}
switch ($iType) {
case 0:
return $dbInfo['driver'] . '/' . (empty($dbInfo['version']) ? '-' : $dbInfo['version']);
case 1:
return $dbInfo['host'] . '/' . (empty($dbInfo['port']) ? '-' : $dbInfo['port']) . '/' . $dbInfo['name'] . '/' . (empty($dbInfo['prefix']) ? '-' : $dbInfo['prefix']);
}
}
开发者ID:juniortux,项目名称:jaws,代码行数:20,代码来源:SysInfo.php
注:本文中的Jaws_DB类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论