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


PHP isError函数代码示例

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


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

示例1: testLoadSkin

 function testLoadSkin()
 {
     $r = $this->_skinM->loadSkin('{what-an-id}');
     $this->assertTrue($r->is('SKINID_NOT_FOUND'));
     $r = $this->_skinM->loadSkin('{331d1a7c-bf6d-4527-8b1a-b0ee08077a76}');
     $this->assertFalse(isError($r));
     $this->assertEquals('skins_c/working', $this->_pAPI->smarty->compile_dir);
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:8,代码来源:skinmanager.class.test.php

示例2: testLoadLanguage

 function testLoadLanguage()
 {
     $r = $this->_i18n->loadLanguage('not_found', 'core/tests');
     $this->assertTrue(isError($r));
     $this->assertTrue($r->is('LANGUAGE_FILE_NOT_FOUND'));
     $r = $this->_i18n->loadLanguage('i18n_example', 'core/tests');
     $this->assertFalse(isError($r));
     $this->assertEquals('i18n_example', $this->_i18n->getLanguage());
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:9,代码来源:i18n.class.test.php

示例3: loadModuleFromConfig

 function loadModuleFromConfig($module, $config)
 {
     $mod = databaseLoadModule($module);
     if (isError($mod)) {
         return $mod;
     }
     $mOpts = $config[$module];
     $a = $mod->connect($mOpts['Host'], $mOpts['User'], $mOpts['Password'], $mOpts['DatabaseName']);
     if (isError($a)) {
         return $a;
     }
     $mod->setPrefix($mOpts['Prefix']);
     return $mod;
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:14,代码来源:base.php

示例4: testFindAllDrivers

 function testFindAllDrivers()
 {
     // non existing dir
     $r = DatabaseDriverManager::findAllDriversInDirectory('invalid');
     $this->assertTrue($r->is(new Error('PARAM_ISNOT_A_DIR', 'invalid')));
     // a file
     $r = DatabaseDriverManager::findAllDriversInDirectory('index.php');
     $this->assertTrue($r->is(new Error('PARAM_ISNOT_A_DIR', 'index.php')));
     // where morgos drivers are located
     $r = DatabaseDriverManager::findAllDriversInDirectory('core/dbdrivers');
     $this->assertFalse(isError($r));
     global $installedDrivers;
     $this->assertEquals($installedDrivers, DatabaseDriverManager::getAllInstalledDrivers());
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:14,代码来源:databasedrivermanager.class.test.php

示例5: getAllFields

 function getAllFields($tableName)
 {
     $tableName = $this->escapeString($tableName);
     $q = $this->query("SHOW COLUMNS FROM {$tableName}");
     if (!isError($q)) {
         $allFields = array();
         if ($q->numRows() > 0) {
             while ($row = $q->fetchArray()) {
                 $allFields[] = $row;
             }
         }
         return $allFields;
     } else {
         return $q;
     }
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:16,代码来源:xml.database.class.php

示例6: initFromDatabaseGroupIDandLanguageCode

 /**
  * Initializes the object.
  *
  * @param $groupID (int)
  * @param $lCode (string) the language code
  * @public
  */
 function initFromDatabaseGroupIDandLanguageCode($groupID, $lCode)
 {
     if (!is_numeric($groupID)) {
         return new Error('DATABASEOBJECT_SQL_INJECTION_FAILED', __FILE__, __LINE__);
     }
     $languageCode = $this->_db->escapeString($lCode);
     $fullTableName = $this->getFullTableName();
     $sql = "SELECT * FROM {$fullTableName} WHERE group_id='{$groupID}' AND language_code='{$languageCode}'";
     $q = $this->_db->query($sql);
     if (!isError($q)) {
         if ($this->_db->numRows($q) == 1) {
             $row = $this->_db->fetchArray($q);
             $this->initFromArray($row);
             $this->setField('ID', $row['translated_group_id']);
         } else {
             return new Error('TRANSLATEDGROUP_CANTFIND_GROUP', $groupID, $languageCode);
         }
     } else {
         return $q;
     }
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:28,代码来源:usertranslatedgroups.class.php

示例7: initFromDatabasePageIDandLanguageCode

 /**
  * Initializes the object for a page and translation.
  *
  * @param $pageID (int)
  * @param $languageCode (string)
  * @public
  */
 function initFromDatabasePageIDandLanguageCode($pageID, $languageCode)
 {
     if (!is_numeric($pageID)) {
         return new Error('DATABASEOBJECT_SQL_INJECTION_ATTACK_FAILED', __FILE__, __LINE__);
     }
     $languageCode = $this->db->escapeString($languageCode);
     $fTN = $this->getFullTableName();
     $sql = "SELECT * FROM {$fTN} WHERE {$pageID}='{$pageID}' AND languageCode='{$languageCode}'";
     $q = $this->db->query($sql);
     if (!isError($q)) {
         if ($this->db->numRows($q) == 1) {
             $row = $this->db->fetchArray($q);
             $this->initFromArray($row);
             $this->setOption('ID', $row['translatedPageID']);
         } else {
             return new Error('ERROR_TRANSLATEDPAGE_CANTFIND_PAGE', $pageID, $languageCode);
         }
     } else {
         return $q;
     }
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:28,代码来源:translatedpage.class.php

示例8: onForgotPassword

 function onForgotPassword($userAccount, $accountEmail)
 {
     $userM =& $this->_pluginAPI->getUserManager();
     $config =& $this->_pluginAPI->getConfigManager();
     $user = $userM->newUser();
     if ($userAccount != null && $accountEmail != null) {
         $r = new Error('USER_FILLIN_EMAIL_OR_LOGIN');
     } elseif ($userAccount != null) {
         $r = $user->initFromDatabaseLogin($userAccount);
     } elseif ($accountEmail != null) {
         $r = $user->initFromDatabaseEmail($accountEmail);
     } else {
         $r = new Error('USER_FILLIN_EMAIL_OR_LOGIN');
     }
     if (isError($r)) {
         return $r;
     }
     $newPassword = $user->resetPassword();
     $t =& $this->_pluginAPI->getI18NManager();
     $sm =& $this->_pluginAPI->getSmarty();
     $sm->assign('MorgOS_UserName', $user->getLogin());
     $sm->assign('MorgOS_Login', $user->getLogin());
     $sm->assign('MorgOS_NewPassword', $newPassword);
     $sm->assign('MorgOS_SiteTitle', $config->getStringItem('/site/title'));
     $sm->assign('MorgOS_SiteTeam', 'The ' . $config->getStringItem('/site/title') . ' Team');
     $this->sendUserMail($user->getEmail(), $t->translate('New password notification'), $sm->fetch('user/forgotpasswordmail.tpl'));
     $this->_pluginAPI->addMessage($t->translate('A new password is mailed to you.'), NOTICE);
     $this->_pluginAPI->executePreviousAction();
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:29,代码来源:users.class.php

示例9: fopen

        $email_to = $payer_email;
        $message = $buyer_success_message . "\n";
        if (in_array('1', $DigitalProduct)) {
            @mail($email_to, $subject, $message, $header);
            @copy("../sessions/{$custom}.dat", "../download_sessions/{$custom}.dat");
        }
        $fps = fopen("good_orders/{$txn_id}.txt", "w");
        fwrite($fps, $mail_Body . "\n");
        fclose($fps);
        exit;
    } else {
        unable();
    }
} elseif (strcmp($res, "INVALID") == 0) {
    fraud();
    isError();
}
function fraud()
{
    global $lang, $account_paypal, $url, $website_name, $ip, $charset;
    $_SESSION["abuseipn"]++;
    if ($_SESSION["abuseipn"] > 3) {
        $headrs = "From: {$website_name} <{$account_paypal}>\n";
        $headrs .= "Content-type: text/plain; charset={$charset}\n";
        $sendToMe = "{$account_paypal}";
        $errSub = $lang['ipn_instant_error'] . "\n";
        $errMessage = $lang['ipn_instant_error'] . "\n" . $lang['ipn_logged_ip'] . " " . $ip . "\n" . $lang['ipn_reasons'] . "\n" . $lang['ipn_payment_came_back_log'] . "\n" . "\n" . $lang['ipn_please_investigate'] . "\n" . $lang['ipn_instant_ipn'] . "\n";
        @mail($sendToMe, $errSub, $errMessage, $headrs);
        unset($_SESSION["abuseipn"]);
    }
    $dd = date("Y-m-d - H:i:s");
开发者ID:tmaski45,项目名称:tedmatuszewski.com,代码行数:31,代码来源:ipn.php

示例10: getCurrrentAdmins

 function getCurrrentAdmins()
 {
     $userM =& $this->_pluginAPI->getUserManager();
     $db =& $this->_pluginAPI->getDBModule();
     $tPrefix =& $db->getPrefix();
     $adminGroup = $userM->newGroup();
     $adminGroup->initFromDatabaseGenericName('administrator');
     $adminID = $adminGroup->getID();
     $sql = "SELECT userID FROM {$tPrefix}group_users WHERE groupID={$adminID}";
     $q = $db->query($sql);
     $admins = array();
     $currentUser = $userM->getCurrentUser();
     while ($row = $db->fetchArray($q)) {
         $admin = $userM->newUser();
         $a = $admin->initFromDatabaseID($row['userID']);
         if (isError($a)) {
             continue;
         }
         if ($admin->getID() == $currentUser->getID()) {
             $isCurrent = true;
         } else {
             $isCurrent = false;
         }
         $adminArray = array('Login' => $admin->getLogin(), 'ID' => $admin->getID(), 'IsCurrent' => $isCurrent);
         //$permissions = array ('UserManager'=>'Y', 'PluginManager'=>'N');
         //$adminArray['Permissions'] = $permissions;
         $admins[] = $adminArray;
     }
     return $admins;
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:30,代码来源:users.admin.plugin.php

示例11: addGroupToDatabase

 /**
  * Adds a group to the database
  *
  * @param $group (object group)
  */
 function addGroupToDatabase(&$group)
 {
     $gIR = $this->isGroupNameRegistered($group->getGenericName());
     if (!isError($gIR)) {
         if ($gIR == false) {
             return $group->addToDatabase();
         } else {
             $groupName = $group->getGenericName();
             return new Error('GROUPNAME_ALREADY_REGISTERED', $groupName);
         }
     } else {
         return $gIR;
     }
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:19,代码来源:usermanager.class.php

示例12: getSmsCount

 /**
  * HiLink::getSmsCount()
  * Returns number of messages in $box
  * @param string $box of: SMS_BOX_IN, SMS_BOX_OUT, SMS_BOX_DRAFT, SMS_BOX_DELETED, SMS_BOX_UNREAD
  * @return int or false on error
  */
 public function getSmsCount($box = 'default')
 {
     $ch = $this->init_curl($this->host . '/api/sms/sms-count', null, false);
     $ret = curl_exec($ch);
     curl_close($ch);
     $res = simplexml_load_string($ret);
     if (isError($res)) {
         return false;
     }
     switch ($box) {
         case 'in':
         case 'inbox':
         case 1:
         case SMS_BOX_IN:
             return "" . $res->LocalInbox;
         case 'out':
         case 'outbox':
         case 2:
         case SMS_BOX_OUT:
             return "" . $res->LocalOutbox;
         case 'draft':
         case 'drafts':
         case 3:
         case SMS_BOX_DRAFT:
             return "" . $res->LocalDraft;
         case 'deleted':
         case 4:
         case SMS_BOX_DELETED:
             return "" . $res->localDeleted;
         case 'unread':
         case 'new':
         case SMS_BOX_UNREAD:
             return "" . $res->LocalUnread;
         default:
             return array('inbox' => "" . $res->LocalInbox, 'outbox' => "" . $res->LocalOutbox, 'draft' => "" . $res->LocalDraft, 'deleted' => "" . $res->LocalDeleted, 'unread' => "" . $res->LocalUnread);
     }
 }
开发者ID:tom-2015,项目名称:Huawei-HiLink,代码行数:43,代码来源:hilink.class.php

示例13: onRegister

 function onRegister($login, $email, $password)
 {
     $uM =& $this->_pluginAPI->getUserManager();
     $u = $uM->newUser();
     $u->initFromArray(array('login' => $login, 'email' => $email, 'password' => md5($password)));
     $r = $uM->addUserToDatabase($u);
     if (!isError($r)) {
         $this->_pluginAPI->addMessage('Your account was succesfully created', NOTICE);
     } elseif ($r->is('USERMANAGER_LOGIN_EXISTS')) {
         $this->_pluginAPI->addMessage('This login is already used, try another one.', ERROR);
     } elseif ($r->is('USERMANAGER_EMAIL_EXISTS')) {
         $this->_pluginAPI->addMessage('This email is already used, try another one.', ERROR);
     } else {
         $this->_pluginAPI->addMessage('There was a problem with adding you to the database', ERROR);
     }
     $this->_pluginAPI->executePreviousAction();
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:17,代码来源:users.class.php

示例14: run

 /**
  * Runs the system and show a page (or redirect to another page)
  * @param $defaultAction (string)
  * @public
  */
 function run($defaultAction)
 {
     $this->loadSkin();
     $this->loadPlugins();
     $this->assignErrors();
     $a = $this->getActionToExecute($defaultAction);
     $action = $this->getActionFromName($a);
     if (isError($action)) {
         $this->error($action);
     }
     $user = $this->_userManager->getCurrentUser();
     $perms = $this->_actionManager->getActionRequiredPermissions($a);
     foreach ($perms as $perm) {
         if (!$user->hasPermission($perm)) {
             $this->error('USER_HASNOTPERMISSION_VIEWPAGE');
         }
     }
     if ($this->canUserViewPage($action)) {
         if ($action->getPageName()) {
             $page = $this->_pageManager->newPage();
             $page->initFromName($action->getPageName());
             if ($page->isAdminPage()) {
                 $this->_eventManager->triggerEvent('viewAnyAdminPage', array($page->getID()));
             } else {
                 $this->_eventManager->triggerEvent('viewPage', array($page->getID()));
             }
         }
         $r = $this->_actionManager->executeAction($a);
         if (isError($r)) {
             if ($r->is('ACTIONMANAGER_INVALID_INPUT')) {
                 $this->_pluginAPI->addMessage('Invalid input', ERROR);
                 $this->_pluginAPI->executePreviousAction();
             } else {
                 $this->error($r);
             }
         }
     } else {
         return new Error('USER_HASNOTPERMISSION_VIEWPAGE');
     }
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:45,代码来源:morgos.class.php

示例15: setPageVars

 function setPageVars($pageID, $pageLang)
 {
     $pM =& $this->_pluginAPI->getPageManager();
     $root = $pM->newPage();
     $root->initFromName('site');
     $page = $pM->newPage();
     $page->initFromDatabaseID($pageID);
     //echo $pageLang;
     $tPage = $page->getTranslation($pageLang);
     if (isError($tPage)) {
         return $tPage;
     }
     $sm =& $this->_pluginAPI->getSmarty();
     $sm->assign('MorgOS_CurrentPage_Title', $tPage->getTitle());
     $sm->assign('MorgOS_CurrentPage_Content', $tPage->getContent());
     $sm->assign('MorgOS_Site_HeaderImage', $this->getHeaderImageLink());
     $sm->assign('MorgOS_Copyright', 'Powered by MorgOS &copy; 2006');
     $sm->assign('MorgOS_Menu', $this->getMenuArray($page->getParentPage(), $pageLang));
     $sm->assign('MorgOS_RootMenu', $this->getMenuArray($root, $pageLang));
     $sm->assign('MorgOS_ExtraSidebar', '');
     $sm->assign('MorgOS_ExtraHead', '');
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:morgos-svn,代码行数:23,代码来源:viewpage.class.php


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