当前位置: 首页>>代码示例>>PHP>>正文


PHP Jaws_Error::isError方法代码示例

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


在下文中一共展示了Jaws_Error::isError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetMoblog

 /**
  * Get entries as Moblog
  *
  * @access  public
  * @return  mixed   Returns an array of phoo entries in moblog format and Jaws_Error on error
  */
 function GetMoblog($album)
 {
     $table = Jaws_ORM::getInstance()->table('phoo_image_album');
     $table->select('phoo_album_id', 'filename', 'phoo_image.id', 'phoo_image.title', 'phoo_image.description', 'phoo_image.createtime');
     $table->join('phoo_image', 'phoo_image.id', 'phoo_image_album.phoo_image_id');
     $table->join('phoo_album', 'phoo_album.id', 'phoo_image_album.phoo_album_id');
     $table->where('phoo_image.published', true)->and();
     $table->where('phoo_album.id', $album);
     $table->orderBy('phoo_image.createtime desc');
     $limit = $this->gadget->registry->fetch('moblog_limit');
     if (Jaws_Error::isError($limit)) {
         return new Jaws_Error(_t('PHOO_ERROR_GETMOBLOG'));
     }
     $result = $table->limit($limit)->fetchAll();
     if (Jaws_Error::IsError($result)) {
         return new Jaws_Error(_t('PHOO_ERROR_GETMOBLOG'));
     }
     foreach ($result as $key => $image) {
         $result[$key]['name'] = $image['title'];
         $result[$key]['thumb'] = $this->GetThumbPath($image['filename']);
         $result[$key]['medium'] = $this->GetMediumPath($image['filename']);
         $result[$key]['image'] = $this->GetOriginalPath($image['filename']);
         $result[$key]['stripped_description'] = $image['description'];
     }
     return $result;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:32,代码来源:Moblog.php

示例2: GetGravatar

 /**
  * Gets gravatar avatar address
  *
  * @access  public
  * @param   string  $email  Email address
  * @param   int     $size   Avatar size
  * @return  string  Avatar image address
  */
 static function GetGravatar($email = '', $size = 48)
 {
     $theme = $GLOBALS['app']->GetTheme();
     if (file_exists($theme['path'] . 'default_avatar.png')) {
         $defaultImage = $theme['url'] . 'default_avatar.png';
     } else {
         $defaultImage = "gadgets/Users/Resources/images/photo{$size}px.png";
     }
     if (empty($email) || $GLOBALS['app']->Registry->fetch('use_gravatar', 'Settings') == 'no') {
         return $defaultImage;
     }
     $id = md5($email);
     $rating = $GLOBALS['app']->Registry->fetch('gravatar_rating', 'Settings');
     if (Jaws_Error::isError($rating)) {
         $rating = 'g';
     }
     if ($size > 128) {
         $size = 128;
     } elseif ($size < 0) {
         $size = 0;
     }
     $defaultImage = urlencode($GLOBALS['app']->getSiteURL('/' . $defaultImage));
     $gravatar = 'http://www.gravatar.com/avatar/' . md5(strtolower(trim($email)));
     $gravatar .= '?d=' . $defaultImage . '&amp;r=' . $rating . '&amp;s=' . $size;
     return $gravatar;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:34,代码来源:Gravatar.php

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

示例4: GetForums

 /**
  * Returns a list of  forums at a request level
  *
  * @access  public
  * @param   int     $gid                Group ID
  * @param   bool    $onlyPublished
  * @param   bool    $last_topic_detail
  * @return  mixed   Array with all the available forums or Jaws_Error on error
  */
 function GetForums($gid = false, $onlyAccessible = true, $onlyPublished = false, $last_topic_detail = false)
 {
     $table = Jaws_ORM::getInstance()->table('forums');
     if ($last_topic_detail) {
         $table->select('forums.id:integer', 'forums.title', 'forums.description', 'forums.fast_url', 'topics:integer', 'posts:integer', 'last_topic_id:integer', 'forums_topics.last_post_time', 'forums_topics.replies:integer', 'users.username', 'users.nickname', 'forums.locked:boolean', 'forums.published:boolean');
         $table->join('forums_topics', 'forums.last_topic_id', 'forums_topics.id', 'left');
         $table->join('users', 'forums_topics.last_post_uid', 'users.id', 'left');
     } else {
         $table->select('id:integer', 'title', 'description', 'fast_url', 'topics:integer', 'posts:integer', 'locked:boolean', 'published:boolean', 'gid:integer');
     }
     if (!empty($gid)) {
         $table->and()->where('gid', $gid);
     }
     if ($onlyPublished) {
         $table->and()->where('forums.published', true);
     }
     $result = $table->orderBy('forums.order asc')->fetchAll();
     if (Jaws_Error::isError($result)) {
         return array();
     }
     $forums = array();
     foreach ($result as $forum) {
         if ($this->gadget->GetPermission('ForumPublic', $forum['id'])) {
             $forums[] = $forum;
         }
     }
     return $forums;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:37,代码来源:Forums.php

示例5: OnlineUsers

 /**
  * Show online users list
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function OnlineUsers()
 {
     // Load the template
     $tpl = $this->gadget->template->load('Statistics.html');
     $tpl->SetBlock('OnlineUsers');
     $tpl->SetVariable('title', _t('USERS_ACTIONS_ONLINEUSERS'));
     $uniqueOnline = array();
     $sessions = $GLOBALS['app']->Session->GetSessions();
     if (!Jaws_Error::isError($sessions)) {
         foreach ($sessions as $session) {
             if (!empty($session['username'])) {
                 $tpl->SetBlock('OnlineUsers/user');
                 if (!array_key_exists($session['user'], $uniqueOnline)) {
                     $uniqueOnline[$session['user']] = true;
                     $tpl->SetVariable('username', $session['username']);
                     $tpl->SetVariable('nickname', $session['nickname']);
                     $tpl->SetVariable('url_user', $this->gadget->urlMap('Profile', array('user' => $session['username'])));
                     $tpl->ParseBlock('OnlineUsers/user');
                 }
             }
         }
     }
     if (empty($uniqueOnline)) {
         $tpl->SetBlock('OnlineUsers/no_online');
         $tpl->SetVariable('no_online', _t('USERS_ONLINE_NO_ONLINE'));
         $tpl->ParseBlock('OnlineUsers/no_online');
     }
     $tpl->ParseBlock('OnlineUsers');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:36,代码来源:Statistics.php

示例6: SiteActivity

 /**
  * Send data to parent site
  *
  * @access  public
  * @return  boolean
  */
 function SiteActivity()
 {
     // Load the template
     $tpl = $this->gadget->template->load('SiteActivity.html');
     $tpl->SetBlock('SiteActivity');
     $tpl->SetVariable('title', _t('SITEACTIVITY_ACTIONS_SITEACTIVITY'));
     $this->SetTitle(_t('SITEACTIVITY_ACTIONS_SITEACTIVITY'));
     $model = $this->gadget->model->load('SiteActivity');
     $filters = array();
     $today = getdate();
     $todayTime = mktime(0, 0, 0, $today['mon'], $today['mday'], $today['year']);
     $filters['domain'] = '-1';
     // fetch just own domain data
     $filters['from_date'] = $todayTime;
     // fetch today data
     $activities = $model->GetSiteActivities($filters);
     if (!Jaws_Error::isError($activities) && !empty($activities)) {
         $gadgetsActivities = array();
         $gadget = '';
         foreach ($activities as $activity) {
             if ($activity['gadget'] != $gadget) {
                 $gadget = $activity['gadget'];
             }
             $gadgetsActivities[$gadget][$activity['action']] = $activity['hits'];
         }
     }
     $saGadgets = $model->GetSiteActivityGadgets();
     if (count($saGadgets) > 0) {
         foreach ($saGadgets as $gadget => $gTitle) {
             // load gadget
             $objGadget = Jaws_Gadget::getInstance($gadget);
             if (Jaws_Error::IsError($objGadget)) {
                 continue;
             }
             // load hook
             $objHook = $objGadget->hook->load('SiteActivity');
             if (Jaws_Error::IsError($objHook)) {
                 continue;
             }
             // fetch gadget activity's action items
             $actions = $objHook->Execute();
             $tpl->SetBlock('SiteActivity/gadget');
             $tpl->SetVariable('gadget_title', $objGadget->title);
             foreach ($actions as $actionName => $actionTitle) {
                 $tpl->SetBlock('SiteActivity/gadget/action');
                 $tpl->SetVariable('action', $actionTitle);
                 $hits = isset($gadgetsActivities[$gadget][$actionName]) ? $gadgetsActivities[$gadget][$actionName] : 0;
                 $tpl->SetVariable('hits', $hits);
                 $tpl->ParseBlock('SiteActivity/gadget/action');
             }
             $tpl->ParseBlock('SiteActivity/gadget');
         }
     } else {
         $tpl->SetBlock('SiteActivity/no_activity');
         $tpl->SetVariable('no_activity', _t('SITEACTIVITY_ACTIONS_NOT_FIND_ACTIVITY'));
         $tpl->ParseBlock('SiteActivity/no_activity');
     }
     $tpl->ParseBlock('SiteActivity');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:66,代码来源:SiteActivity.php

示例7: UpdatePage

 /**
  * Updates the page
  *
  * @access  public
  * @param   int     $id         The ID of the page to update
  * @param   int     $group      The group of the page
  * @param   bool    $show_title Whether displays the title or not
  * @param   string  $title      The title of the page
  * @param   string  $content    The contents of the page
  * @param   string  $language   The language of the page
  * @param   string  $fast_url   The fast URL of the page
  * @param   string  $meta_keys  Meta keywords
  * @param   string  $meta_desc  Meta description
  * @param   string  $tags       Tags
  * @param   bool    $published  Whether the page is published or not
  * @param   bool    $auto       Whether its an auto saved page or not
  * @return  mixed   True on success or Jaws_Error on failure
  */
 function UpdatePage($id, $group, $show_title, $title, $content, $language, $fast_url, $meta_keys, $meta_desc, $tags, $published, $auto = false)
 {
     $fast_url = empty($fast_url) ? $title : $fast_url;
     $fast_url = $this->GetRealFastUrl($fast_url, 'static_pages', false);
     $page = $this->GetPage($id);
     if (Jaws_Error::isError($page)) {
         $GLOBALS['app']->Session->PushLastResponse(_t('STATICPAGE_ERROR_PAGE_NOT_FOUND'), RESPONSE_ERROR);
         return new Jaws_Error(_t('STATICPAGE_ERROR_PAGE_NOT_FOUND'));
     }
     $params['group_id'] = (int) $group;
     $params['base_language'] = $language;
     $params['fast_url'] = $fast_url;
     $params['show_title'] = (bool) $show_title;
     $params['updated'] = Jaws_DB::getInstance()->date();
     $spTable = Jaws_ORM::getInstance()->table('static_pages');
     $result = $spTable->update($params)->where('page_id', $id)->exec();
     if (Jaws_Error::IsError($result)) {
         return new Jaws_Error(_t('STATICPAGE_ERROR_PAGE_NOT_UPDATED'));
     }
     $tModel = $this->gadget->model->loadAdmin('Translation');
     $result = $tModel->UpdateTranslation($page['translation_id'], $title, $content, $language, $meta_keys, $meta_desc, $tags, $published);
     if (Jaws_Error::IsError($result)) {
         $GLOBALS['app']->Session->PushLastResponse(_t('STATICPAGE_ERROR_PAGE_NOT_UPDATED'), RESPONSE_ERROR);
         return new Jaws_Error(_t('STATICPAGE_ERROR_PAGE_NOT_UPDATED'));
     }
     $GLOBALS['app']->Session->PushLastResponse(_t('STATICPAGE_PAGE_UPDATED'), RESPONSE_NOTICE);
     return true;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:46,代码来源:Page.php

示例8: SmartBridge_Plugin

 /**
  * Main Constructor
  *
  * @access  public
  * @return  void
  */
 function SmartBridge_Plugin($plugin)
 {
     parent::Jaws_Plugin($plugin);
     $eg = $GLOBALS['app']->Registry->fetch('gadgets_enabled_items');
     if (Jaws_Error::isError($eg)) {
         $eg = array();
     }
     $this->_EnabledGadgets = explode(',', $eg);
 }
开发者ID:juniortux,项目名称:jaws,代码行数:15,代码来源:Plugin.php

示例9: Upgrade

 /**
  * Upgrades the gadget
  *
  * @access  public
  * @param   string  $old    Current version (in registry)
  * @param   string  $new    New version (in the $gadgetInfo file)
  * @return  bool    True
  */
 function Upgrade($old, $new)
 {
     // Update layout actions
     $layoutModel = Jaws_Gadget::getInstance('Layout')->model->loadAdmin('Layout');
     if (!Jaws_Error::isError($layoutModel)) {
         $layoutModel->EditGadgetLayoutAction('Shoutbox', 'Display', 'Comments', 'Comments');
     }
     return true;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:17,代码来源:Installer.php

示例10: 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 or Jaws_Error on Failure
  */
 function Upgrade($old, $new)
 {
     // Update layout actions
     $layoutModel = Jaws_Gadget::getInstance('Layout')->model->loadAdmin('Layout');
     if (!Jaws_Error::isError($layoutModel)) {
         $layoutModel->EditGadgetLayoutAction('Faq', 'ListCategories', 'ListCategories', 'Category');
     }
     return true;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:17,代码来源:Installer.php

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

示例12: SaveSettings

 /**
  * Update Settings
  *
  * @access  public
  * @return  array   Response array (notice or error)
  */
 function SaveSettings()
 {
     $this->gadget->CheckPermission('Settings');
     $configuration = jaws()->request->fetch('gadgets_drivers:array', 'post');
     $res = $this->gadget->registry->update('configuration', serialize($configuration));
     if (Jaws_Error::isError($res)) {
         return $GLOBALS['app']->Session->GetResponse($res->getMessage(), RESPONSE_ERROR);
     } else {
         return $GLOBALS['app']->Session->GetResponse(_t('NOTIFICATION_SETTINGS_UPDATED'), RESPONSE_NOTICE);
     }
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:17,代码来源:Settings.php

示例13: CreateTagCloud

 /**
  * Generates a tag cloud
  *
  * @access  public
  * @return  mixed   An array on success and Jaws_Error in case of errors
  */
 function CreateTagCloud()
 {
     $table = Jaws_ORM::getInstance()->table('blog_entrycat');
     $table->select('count(category_id) as howmany:integer', 'name', 'fast_url', 'category_id:integer');
     $table->join('blog_category', 'category_id', 'id');
     $res = $table->groupBy('category_id', 'name', 'fast_url')->orderBy('name')->fetchAll();
     if (Jaws_Error::isError($res)) {
         return new Jaws_Error(_t('BLOG_ERROR_TAGCLOUD_CREATION_FAILED'));
     }
     return $res;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:17,代码来源:Tags.php

示例14: 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 or Jaws_Error on Failure
  */
 function Upgrade($old, $new)
 {
     // Update layout actions
     $layoutModel = Jaws_Gadget::getInstance('Layout')->model->loadAdmin('Layout');
     if (!Jaws_Error::isError($layoutModel)) {
         $layoutModel->EditGadgetLayoutAction('Poll', 'Display', 'Poll', 'Poll');
         $layoutModel->EditGadgetLayoutAction('Poll', 'LastPoll', 'Poll', 'Poll');
         $layoutModel->EditGadgetLayoutAction('Poll', 'ListOfPolls', 'Polls', 'Polls');
     }
     return true;
 }
开发者ID:uda,项目名称:jaws,代码行数:19,代码来源:Installer.php

示例15: Execute

 /**
  * Returns an array with all available items the Menu gadget 
  * can use
  *
  * @access  public
  * @return  array   URLs array
  */
 function Execute()
 {
     $urls = array();
     $model = $this->gadget->model->load('Scripts');
     $scripts = $model->GetScripts();
     if (!Jaws_Error::isError($scripts)) {
         foreach ($scripts as $script) {
             $urls[] = array('url' => $this->gadget->urlMap('Execute', array('script' => $script)), 'title' => $script);
         }
     }
     return $urls;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:19,代码来源:Menu.php


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