• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Jaws_Error类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Jaws_Error的典型用法代码示例。如果您正苦于以下问题:PHP Jaws_Error类的具体用法?PHP Jaws_Error怎么用?PHP Jaws_Error使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Jaws_Error类的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 = '')
 {
     $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


示例2: GetSettings

 /**
  * Get registry settings for Phoo
  *
  * @access  public
  * @return  mixed    array with the settings or Jaws_Error on error
  */
 function GetSettings()
 {
     $ret = array();
     $ret['default_action'] = $this->gadget->registry->fetch('default_action');
     $ret['resize_method'] = $this->gadget->registry->fetch('resize_method');
     $ret['moblog_album'] = $this->gadget->registry->fetch('moblog_album');
     $ret['moblog_limit'] = $this->gadget->registry->fetch('moblog_limit');
     $ret['photoblog_album'] = $this->gadget->registry->fetch('photoblog_album');
     $ret['photoblog_limit'] = $this->gadget->registry->fetch('photoblog_limit');
     $ret['allow_comments'] = $this->gadget->registry->fetch('allow_comments');
     $ret['published'] = $this->gadget->registry->fetch('published');
     $ret['show_exif_info'] = $this->gadget->registry->fetch('show_exif_info');
     $ret['keep_original'] = $this->gadget->registry->fetch('keep_original');
     $ret['thumbnail_limit'] = $this->gadget->registry->fetch('thumbnail_limit');
     $ret['comment_status'] = $this->gadget->registry->fetch('comment_status');
     $ret['use_antispam'] = $this->gadget->registry->fetch('use_antispam');
     $ret['albums_order_type'] = $this->gadget->registry->fetch('albums_order_type');
     $ret['photos_order_type'] = $this->gadget->registry->fetch('photos_order_type');
     foreach ($ret as $r) {
         if (Jaws_Error::IsError($r)) {
             if (isset($GLOBALS['app']->Session)) {
                 $GLOBALS['app']->Session->PushLastResponse(_t('PHOO_ERROR_CANT_FETCH_SETTINGS'), RESPONSE_ERROR);
             }
             return new Jaws_Error(_t('PHOO_ERROR_CANT_FETCH_SETTINGS'));
         }
     }
     return $ret;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:34,代码来源:Settings.php


示例3: image

 /**
  * Displays the captcha image
  *
  * @access  public
  * @param   int     $key    Captcha key
  * @return  mixed   Captcha raw image data
  */
 function image($key)
 {
     $value = Jaws_Utils::RandomText();
     $result = $this->update($key, $value);
     if (Jaws_Error::IsError($result)) {
         $value = '';
     }
     $bg = dirname(__FILE__) . '/resources/simple.bg.png';
     $im = imagecreatefrompng($bg);
     imagecolortransparent($im, imagecolorallocate($im, 255, 255, 255));
     // Write it in a random position..
     $darkgray = imagecolorallocate($im, 0x10, 0x70, 0x70);
     $x = 5;
     $y = 20;
     $text_length = strlen($value);
     for ($i = 0; $i < $text_length; $i++) {
         $fnt = rand(7, 10);
         $y = rand(6, 10);
         imagestring($im, $fnt, $x, $y, $value[$i], $darkgray);
         $x = $x + rand(15, 25);
     }
     header("Content-Type: image/png");
     ob_start();
     imagepng($im);
     $content = ob_get_contents();
     ob_end_clean();
     imagedestroy($im);
     return $content;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:36,代码来源:Simple.php


示例4: Auth

 /**
  * Authenticate user/password
  *
  * @access  public
  * @param   string  $user       User's name or email
  * @param   string  $password   User's password
  * @return  mixed   Array of user's information otherwise Jaws_Error
  */
 function Auth($user, $password)
 {
     if (!function_exists('imap_open')) {
         return Jaws_Error::raiseError('Undefined function imap_open()', __FUNCTION__);
     }
     $mbox = @imap_open('{' . $this->_Server . ':' . $this->_Port . ($this->_SSL ? '/imap/ssl' : '') . '}INBOX', $user, $password);
     if ($mbox) {
         @imap_close($mbox);
         $result = array();
         $result['id'] = strtolower('imap:' . $user);
         $result['internal'] = false;
         $result['username'] = $user;
         $result['superadmin'] = false;
         $result['internal'] = false;
         $result['groups'] = array();
         $result['nickname'] = $user;
         $result['concurrents'] = 0;
         $result['email'] = '';
         $result['url'] = '';
         $result['avatar'] = 'gadgets/Users/Resources/images/photo48px.png';
         $result['language'] = '';
         $result['theme'] = '';
         $result['editor'] = '';
         $result['timezone'] = null;
         return $result;
     }
     return Jaws_Error::raiseError(_t('GLOBAL_ERROR_LOGIN_WRONG'), __FUNCTION__);
 }
开发者ID:juniortux,项目名称:jaws,代码行数:36,代码来源:IMAP.php


示例5: 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


示例6: 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


示例7: Validate

 /**
  * Validates any data provided to the stage.
  *
  * @access  public
  * @return  bool|Jaws_Error  Returns either true on success, or a Jaws_Error
  *                          containing the reason for failure.
  */
 function Validate()
 {
     if ($_SESSION['install']['predefined']) {
         return true;
     }
     $request = Jaws_Request::getInstance();
     $postReq = $request->fetch(array('secure', 'customize'), 'post');
     $_SESSION['secure'] = !empty($postReq['secure']);
     $_SESSION['customize'] = !empty($postReq['customize']);
     // try to entering to secure transformation mode
     if ($_SESSION['secure'] && (!isset($_SESSION['pub_key']) || empty($_SESSION['pub_key']))) {
         require_once JAWS_PATH . 'include/Jaws/Crypt.php';
         $pkey = Jaws_Crypt::Generate_RSA_KeyPair(512);
         if (!Jaws_Error::isError($pkey)) {
             $_SESSION['pub_key'] = $pkey['pub_key'];
             $_SESSION['pvt_key'] = $pkey['pvt_key'];
         } else {
             return new Jaws_Error(_t('INSTALL_AUTH_ERROR_RSA_KEY_GENERATION'), 0, JAWS_ERROR_WARNING);
         }
     }
     $key_file = INSTALL_PATH . 'key.txt';
     if (file_exists($key_file)) {
         $key = trim(file_get_contents($key_file));
         if ($key === $_SESSION['install']['Authentication']['key']) {
             _log(JAWS_LOG_DEBUG, "Input log and session key match");
             return true;
         }
         _log(JAWS_LOG_DEBUG, "The key found doesn't match the one below, please check that you entered the key correctly");
         return new Jaws_Error(_t('INSTALL_AUTH_ERROR_KEY_MATCH', 'key.txt'), 0, JAWS_ERROR_WARNING);
     }
     _log(JAWS_LOG_DEBUG, "Your key file was not found, please make sure you created it, and the web server is able to read it.");
     return new Jaws_Error(_t('INSTALL_AUTH_ERROR_KEY_FILE', 'key.txt'), 0, JAWS_ERROR_WARNING);
 }
开发者ID:juniortux,项目名称:jaws,代码行数:40,代码来源:Authentication.php


示例8: LoginHistory

 /**
  *
  * @access  public
  * @return  string HTML content with menu and menu items
  */
 function LoginHistory($limit = 5)
 {
     if (!$GLOBALS['app']->Session->Logged()) {
         return false;
     }
     $logModel = Jaws_Gadget::getInstance('Logs')->model->load('Logs');
     $logs = $logModel->GetLogs(array('gadget' => 'Users', 'action' => 'Login', 'user' => $GLOBALS['app']->Session->GetAttribute('user')), $limit);
     if (Jaws_Error::IsError($logs) || empty($logs)) {
         return false;
     }
     $tpl = $this->gadget->template->load('LoginHistory.html');
     $tpl->SetBlock('history');
     $date = Jaws_Date::getInstance();
     $tpl->SetVariable('title', _t('LOGS_LOGIN_HISTORY'));
     foreach ($logs as $log) {
         $tpl->SetBlock('history/' . $log['status']);
         $tpl->SetVariable('ip', long2ip($log['ip']));
         $tpl->SetVariable('agent', $log['agent']);
         $tpl->SetVariable('status_title', _t('GLOBAL_HTTP_ERROR_TITLE_' . $log['status']));
         $tpl->SetVariable('date', $date->Format($log['insert_time'], 'd MN Y H:i'));
         $tpl->ParseBlock('history/' . $log['status']);
     }
     $tpl->ParseBlock('history');
     return $tpl->Get();
 }
开发者ID:juniortux,项目名称:jaws,代码行数:30,代码来源:History.php


示例9: UpdateUserRating

 /**
  * Update user rate of a reference item
  *
  * @access  public
  * @param   string  $gadget     Gadget name
  * @param   string  $action     Action name
  * @param   int     $reference  Reference
  * @param   int     $item       Rating item
  * @param   int     $rate       User rate(if null user old rate will be removed)
  * @return  mixed   Rate value or Jaws_Error on failure
  */
 function UpdateUserRating($gadget, $action, $reference, $item = 0, $rate = null)
 {
     $objORM = Jaws_ORM::getInstance();
     // fetch reference item from parent table(rating)
     $rid = $objORM->table('rating')->upsert(array('gadget' => $gadget, 'action' => $action, 'reference' => $reference, 'item' => $item))->where('gadget', $gadget)->and()->where('action', $action)->and()->where('reference', $reference)->and()->where('item', $item)->exec();
     if (Jaws_Error::IsError($rid)) {
         return $rid;
     }
     // insert/update user rate
     $uip = bin2hex(inet_pton($_SERVER['REMOTE_ADDR']));
     $objORM->beginTransaction();
     if (is_null($rate)) {
         // delete user rate
         $result = $objORM->table('rating_details')->delete()->where('rid', $rid)->and()->where('uip', $uip)->exec();
     } else {
         // update/insert user rate
         $result = $objORM->table('rating_details')->upsert(array('rid' => $rid, 'uip' => $uip, 'rate' => (int) $rate))->where('rid', $rid)->and()->where('uip', $uip)->exec();
     }
     if (Jaws_Error::IsError($result)) {
         return $result;
     }
     // update rating statistics
     $result = $objORM->table('rating')->update(array('rates_count' => Jaws_ORM::getInstance()->table('rating_details')->select('count(id)')->where('rid', $rid), 'rates_sum' => Jaws_ORM::getInstance()->table('rating_details')->select('sum(rate)')->where('rid', $rid), 'rates_avg' => Jaws_ORM::getInstance()->table('rating_details')->select('avg(rate)')->where('rid', $rid)))->where('id', $rid)->exec();
     if (Jaws_Error::IsError($result)) {
         return $result;
     }
     //commit transaction
     $objORM->commit();
     return true;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:41,代码来源:Rating.php


示例10: Random

 /**
  * Displays a random image from one of the galleries.
  *
  * @access  public
  * @param   int     $albumid    album ID
  * @return  string   XHTML template content
  * @see Phoo_Model::GetRandomImage()
  */
 function Random($albumid = null)
 {
     $model = $this->gadget->model->load('Random');
     $r = $model->GetRandomImage($albumid);
     if (Jaws_Error::IsError($r) || empty($r)) {
         return false;
     }
     $tpl = $this->gadget->template->load('Random.html');
     $tpl->SetBlock('random_image');
     $imgData = Jaws_Image::getimagesize(JAWS_DATA . 'phoo/' . $r['thumb']);
     if (!Jaws_Error::IsError($imgData)) {
         $tpl->SetVariable('width', $imgData[0]);
         $tpl->SetVariable('height', $imgData[1]);
     }
     $tpl->SetVariable('title', _t('PHOO_ACTIONS_RANDOM'));
     $tpl->SetVariable('url', $this->gadget->urlMap('ViewImage', array('id' => $r['id'], 'albumid' => $r['phoo_album_id'])));
     $tpl->SetVariable('name', $r['name']);
     $tpl->SetVariable('filename', $r['filename']);
     $tpl->SetVariable('thumb', $GLOBALS['app']->getDataURL('phoo/' . $r['thumb']));
     $tpl->SetVariable('medium', $GLOBALS['app']->getDataURL('phoo/' . $r['medium']));
     $tpl->SetVariable('image', $GLOBALS['app']->getDataURL('phoo/' . $r['image']));
     $tpl->SetVariable('img_desc', $r['stripped_description']);
     $tpl->ParseBlock('random_image');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:33,代码来源:Random.php


示例11: Attachment

 /**
  * Download post attachment
  *
  * @access  public
  * @return  string   Requested file content or HTML error page
  */
 function Attachment()
 {
     $rqst = jaws()->request->fetch(array('fid', 'tid', 'pid', 'attach'), 'get');
     $pModel = $this->gadget->model->load('Posts');
     $post = $pModel->GetPost($rqst['pid'], $rqst['tid'], $rqst['fid']);
     if (Jaws_Error::IsError($post)) {
         $this->SetActionMode('Attachment', 'normal', 'standalone');
         return Jaws_HTTPError::Get(500);
     }
     $aModel = $this->gadget->model->load('Attachments');
     $attachment = $aModel->GetAttachmentInfo($rqst['attach']);
     if (Jaws_Error::IsError($attachment)) {
         $this->SetActionMode('Attachment', 'normal', 'standalone');
         return Jaws_HTTPError::Get(500);
     }
     if (!empty($attachment)) {
         $filepath = JAWS_DATA . 'forums/' . $attachment['filename'];
         if (file_exists($filepath)) {
             // increase download hits
             $result = $aModel->HitAttachmentDownload($rqst['attach']);
             if (Jaws_Error::IsError($result)) {
                 // do nothing
             }
             if (Jaws_Utils::Download($filepath, $attachment['title'])) {
                 return;
             }
             $this->SetActionMode('Attachment', 'normal', 'standalone');
             return Jaws_HTTPError::Get(500);
         }
     }
     $this->SetActionMode('Attachment', 'normal', 'standalone');
     return Jaws_HTTPError::Get(404);
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:39,代码来源:Attachment.php


示例12: 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


示例13: Upgrade

 /**
  * Upgrades the gadget
  *
  * @access  public
  * @param   string  $old    Current version (in registry)
  * @param   string  $new    New version (in the $gadgetInfo file)
  * @return  mixed   True on success, Jaws_Error otherwise
  */
 function Upgrade($old, $new)
 {
     if (version_compare($old, '2.0.0', '<')) {
         $variables = array();
         $variables['logon_hours'] = str_pad('', 42, 'F');
         $result = $this->installSchema('schema.xml', $variables, '1.0.0.xml');
         if (Jaws_Error::IsError($result)) {
             return $result;
         }
         // update users passwords
         $usersTable = Jaws_ORM::getInstance()->table('users');
         $usersTable->update(array('password' => $usersTable->concat(array('{SSHA1}', 'text'), 'password')))->where($usersTable->length('password'), 32, '>')->exec();
         $usersTable->update(array('password' => $usersTable->concat(array('{MD5}', 'text'), 'password')))->where($usersTable->length('password'), 32)->exec();
         // ACL keys
         $this->gadget->acl->insert('ManageFriends');
         $this->gadget->acl->insert('AccessDashboard');
         $this->gadget->acl->insert('ManageDashboard');
     }
     if (version_compare($old, '2.1.0', '<')) {
         $this->gadget->registry->delete('anon_repetitive_email');
     }
     if (version_compare($old, '2.2.0', '<')) {
         $result = $this->installSchema('schema.xml', '', '2.1.0.xml');
         if (Jaws_Error::IsError($result)) {
             return $result;
         }
     }
     return true;
 }
开发者ID:uda,项目名称:jaws,代码行数:37,代码来源:Installer.php


示例14: PluginInfo

 /**
  * Builds UI for the plugin information
  *
  * @access  public
  * @param   string   $plugin  Plugin's name
  * @return  string   XHTML UI
  */
 function PluginInfo($plugin)
 {
     $objPlugin = $GLOBALS['app']->LoadPlugin($plugin);
     if (Jaws_Error::IsError($objPlugin)) {
         return $objPlugin->getMessage();
     }
     $tpl = $this->gadget->template->loadAdmin('Plugin.html');
     $tpl->SetBlock('info');
     $tpl->SetVariable('lbl_version', _t('COMPONENTS_VERSION') . ':');
     $tpl->SetVariable('lbl_example', _t('COMPONENTS_PLUGINS_USAGE') . ':');
     $tpl->SetVariable('lbl_accesskey', _t('COMPONENTS_PLUGINS_ACCESSKEY') . ':');
     $tpl->SetVariable('lbl_friendly', _t('COMPONENTS_PLUGINS_FRIENDLY') . ':');
     $tpl->SetVariable('accesskey', $objPlugin->GetAccessKey() ? $objPlugin->GetAccessKey() : _t('COMPONENTS_PLUGINS_NO_ACCESSKEY'));
     $tpl->SetVariable('friendly', $objPlugin->friendly ? _t('COMPONENTS_PLUGINS_FRIENDLY') : _t('COMPONENTS_PLUGINS_NOT_FRIENDLY'));
     $tpl->SetVariable('example', $objPlugin->example ? $objPlugin->example : _t('COMPONENTS_PLUGINS_NO_EXAMPLE'));
     $tpl->SetVariable('version', $objPlugin->version);
     $button =& Piwi::CreateWidget('Button', 'btn_install', _t('COMPONENTS_INSTALL'), STOCK_SAVE);
     $button->AddEvent(ON_CLICK, 'javascript:setupComponent();');
     $button->SetStyle('display:none');
     $tpl->SetVariable('install', $button->Get());
     $button =& Piwi::CreateWidget('Button', 'btn_uninstall', _t('COMPONENTS_UNINSTALL'), STOCK_DELETE);
     $button->AddEvent(ON_CLICK, 'javascript:setupComponent();');
     $button->SetStyle('display:none');
     $tpl->SetVariable('uninstall', $button->Get());
     $tpl->ParseBlock('info');
     return $tpl->Get();
 }
开发者ID:juniortux,项目名称:jaws,代码行数:34,代码来源:Plugins.php


示例15: PollResultsUI

 /**
  * Get the poll results
  *
  * @access  public
  * @param   int     $pid    Poll ID
  * @return  string  XHTML template content
  */
 function PollResultsUI($pid)
 {
     $tpl = $this->gadget->template->loadAdmin('Reports.html');
     $tpl->SetBlock('PollResults');
     $model = $this->gadget->model->load('Poll');
     $poll = $model->GetPoll($pid);
     if (Jaws_Error::IsError($poll)) {
         //we need to handle errors
         return '';
     }
     $answers = $model->GetPollAnswers($poll['id']);
     if (!Jaws_Error::IsError($answers)) {
         $total_votes = array_sum(array_map(create_function('$row', 'return $row["votes"];'), $answers));
         $tpl->SetVariable('lbl_total_votes', _t('POLL_REPORTS_TOTAL_VOTES'));
         $tpl->SetVariable('total_votes', $total_votes);
         foreach ($answers as $answer) {
             $tpl->SetBlock('PollResults/answer');
             $tpl->SetVariable('answer', $answer['answer']);
             $percent = $total_votes == 0 ? 0 : floor($answer['votes'] / $total_votes * 100);
             $tpl->SetVariable('percent', _t('POLL_REPORTS_PERCENT', $percent));
             $tpl->SetVariable('image_width', floor($percent * 1.5));
             $tpl->SetVariable('votes', $answer['votes']);
             $tpl->ParseBlock('PollResults/answer');
         }
     }
     $tpl->ParseBlock('PollResults');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:35,代码来源:Report.php


示例16: DeleteNote

 /**
  * Deletes passed note(s)
  *
  * @access  public
  * @return  mixed   Response array
  */
 function DeleteNote()
 {
     $id_set = jaws()->request->fetch('id_set');
     $id_set = explode(',', $id_set);
     if (empty($id_set)) {
         return $GLOBALS['app']->Session->GetResponse(_t('NOTEPAD_ERROR_NOTE_DELETE'), RESPONSE_ERROR);
     }
     // Verify notes & user
     $model = $this->gadget->model->load('Notepad');
     $user = (int) $GLOBALS['app']->Session->GetAttribute('user');
     $verified_nodes = $model->CheckNotes($id_set, $user);
     if (Jaws_Error::IsError($verified_nodes)) {
         return $GLOBALS['app']->Session->GetResponse(_t('NOTEPAD_ERROR_NOTE_DELETE'), RESPONSE_ERROR);
     }
     // No notes was verified
     if (empty($verified_nodes)) {
         return $GLOBALS['app']->Session->GetResponse(_t('NOTEPAD_ERROR_NO_PERMISSION'), RESPONSE_ERROR);
     }
     // Delete notes
     $res = $model->Delete($verified_nodes);
     if (Jaws_Error::IsError($res)) {
         return $GLOBALS['app']->Session->GetResponse(_t('NOTEPAD_ERROR_NOTE_DELETE'), RESPONSE_ERROR);
     }
     if (count($id_set) !== count($verified_nodes)) {
         $msg = _t('NOTEPAD_WARNING_DELETE_NOTES_FAILED');
         // FIXME: we are creating response twice
         $GLOBALS['app']->Session->PushResponse($msg, 'Notepad.Response', RESPONSE_WARNING);
         return $GLOBALS['app']->Session->GetResponse($msg, RESPONSE_WARNING);
     }
     $msg = count($id_set) === 1 ? _t('NOTEPAD_NOTICE_NOTE_DELETED') : _t('NOTEPAD_NOTICE_NOTES_DELETED');
     $GLOBALS['app']->Session->PushResponse($msg, 'Notepad.Response');
     return $GLOBALS['app']->Session->GetResponse($msg);
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:39,代码来源:Delete.php


示例17: OpenNote

 /**
  * Builds UI to display a single note
  *
  * @access  public
  * @return  string  XHTML UI
  */
 function OpenNote()
 {
     $id = (int) jaws()->request->fetch('id', 'get');
     $model = $this->gadget->model->load('Notepad');
     $user = (int) $GLOBALS['app']->Session->GetAttribute('user');
     $note = $model->GetNote($id, $user);
     if (Jaws_Error::IsError($note) || empty($note)) {
         return;
     }
     $this->AjaxMe('site_script.js');
     $tpl = $this->gadget->template->load('Open.html');
     $tpl->SetBlock('note');
     $tpl->SetVariable('id', $id);
     $tpl->SetVariable('note_title', $note['title']);
     $tpl->SetVariable('note_content', $this->gadget->ParseText($note['content'], 'Notepad'));
     // Actions
     if ($note['user'] == $user) {
         $tpl->SetBlock('note/actions');
         $tpl->SetVariable('lbl_edit', _t('GLOBAL_EDIT'));
         $tpl->SetVariable('lbl_share', _t('NOTEPAD_SHARE'));
         $tpl->SetVariable('lbl_delete', _t('GLOBAL_DELETE'));
         $tpl->SetVariable('confirmDelete', _t('NOTEPAD_WARNING_DELETE_NOTE'));
         $tpl->SetVariable('notepad_url', $this->gadget->urlMap('Notepad'));
         $tpl->SetVariable('url_edit', $this->gadget->urlMap('EditNote', array('id' => $id)));
         $tpl->SetVariable('url_share', $this->gadget->urlMap('ShareNote', array('id' => $id)));
         $tpl->ParseBlock('note/actions');
     }
     $tpl->ParseBlock('note');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:36,代码来源:Open.php


示例18: Execute

 /**
  * Returns an array with all available items the Menu gadget 
  * can use
  *
  * @access  public
  * @return  array   URLs array
  */
 function Execute()
 {
     $items = array();
     $items[] = array('url' => $this->gadget->urlMap('DefaultAction'), 'title' => $this->gadget->title);
     $items[] = array('url' => $this->gadget->urlMap('Archive'), 'title' => _t('BLOG_ARCHIVE'));
     $items[] = array('url' => $this->gadget->urlMap('CategoriesList'), 'title' => _t('BLOG_ACTIONS_CATEGORIESLIST'), 'title2' => _t('BLOG_CATEGORIES'));
     $items[] = array('url' => $this->gadget->urlMap('PopularPosts'), 'title' => _t('BLOG_POPULAR_POSTS'));
     $items[] = array('url' => $this->gadget->urlMap('PostsAuthors'), 'title' => _t('BLOG_POSTS_AUTHORS'));
     //Blog model
     $pModel = $this->gadget->model->load('Posts');
     $cModel = $this->gadget->model->load('Categories');
     $categories = $cModel->GetCategories();
     if (!Jaws_Error::IsError($categories)) {
         $max_size = 32;
         foreach ($categories as $cat) {
             $url = $this->gadget->urlMap('ShowCategory', array('id' => empty($cat['fast_url']) ? $cat['id'] : $cat['fast_url']));
             $items[] = array('url' => $url, 'title' => Jaws_UTF8::strlen($cat['name']) > $max_size ? Jaws_UTF8::substr($cat['name'], 0, $max_size) . '...' : $cat['name'], 'acl_key' => 'CategoryAccess', 'acl_subkey' => $cat['id']);
         }
     }
     $entries = $pModel->GetEntries('');
     if (!Jaws_Error::IsError($entries)) {
         $max_size = 32;
         foreach ($entries as $entry) {
             $url = $this->gadget->urlMap('SingleView', array('id' => empty($entry['fast_url']) ? $entry['id'] : $entry['fast_url']));
             $items[] = array('url' => $url, 'title' => Jaws_UTF8::strlen($entry['title']) > $max_size ? Jaws_UTF8::substr($entry['title'], 0, $max_size) . '...' : $entry['title']);
         }
     }
     return $items;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:36,代码来源:Menu.php


示例19: Display

 /**
  * Displays the emblems
  *
  * @access  public
  * @return  string   XHTML UI
  */
 function Display()
 {
     $tpl = $this->gadget->template->load('Emblems.html');
     $tpl->SetBlock('emblems');
     $tpl->SetVariable('title', _t('EMBLEMS_ACTION_TITLE'));
     $model = $this->gadget->model->load('Emblems');
     $emblems = $model->GetEmblems(true);
     if (!Jaws_Error::IsError($emblems)) {
         $site = urlencode(Jaws_Utils::getBaseURL('/', false));
         $page = urlencode(Jaws_Utils::getRequestURL(false));
         $name = urlencode($this->gadget->registry->fetch('site_name', 'Settings'));
         $slogan = urlencode($this->gadget->registry->fetch('site_slogan', 'Settings'));
         $title = $GLOBALS['app']->Layout->GetTitle();
         foreach ($emblems as $e) {
             $e['url'] = str_replace(array('{url}', '{base_url}', '{requested_url}', '{site_name}', '{site_slogan}', '{title}'), array($page, $site, $page, $name, $slogan, $title), $e['url']);
             $tpl->SetBlock('emblems/emblem');
             $tpl->SetVariable('id', $e['id']);
             $tpl->SetVariable('title', _t('EMBLEMS_TYPE_' . $e['type'], $e['title']));
             $tpl->SetVariable('image', $GLOBALS['app']->getDataURL('emblems/' . $e['image']));
             $tpl->SetVariable('url', $e['url']);
             $tpl->ParseBlock('emblems/emblem');
         }
     }
     $tpl->ParseBlock('emblems');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:32,代码来源:Emblems.php


示例20: Execute

 /**
  * Returns an array with the results of a tag content
  *
  * @access  public
  * @param   string  $action     Action name
  * @param   array   $references Array of References
  * @return  array   An array of entries that matches a certain pattern
  */
 function Execute($action, $references)
 {
     if (empty($action) || !is_array($references) || empty($references)) {
         return false;
     }
     $table = Jaws_ORM::getInstance()->table('linkdump_links');
     $table->select('id:integer', 'title', 'description', 'updatetime');
     $result = $table->where('id', $references, 'in')->fetchAll();
     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[$r['id']] = $link;
     }
     return $links;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:33,代码来源:Tags.php



注:本文中的Jaws_Error类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Jaws_Gadget类代码示例发布时间:2022-05-23
下一篇:
PHP Jaws_Date类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap