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


PHP PHPWS_Error::get方法代码示例

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


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

示例1: setTabs

 public function setTabs($tabs)
 {
     if (!is_array($tabs)) {
         return PHPWS_Error::get(CP_BAD_TABS, 'controlpanel', 'setTabs');
     }
     $this->tabs =& $tabs;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:7,代码来源:Panel.php

示例2: setTable

 public function setTable($table)
 {
     if (!PHPWS_DB::isTable($table)) {
         return PHPWS_Error::get(PHPWS_DB_NO_TABLE, 'core', __CLASS__ . '::' . __FUNCTION__);
     }
     $this->table = $table;
     return TRUE;
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:8,代码来源:Backup.php

示例3: archive

/**
 * @version $Id$
 * @author Adam Morton
 * @author Steven Levin
 */
function archive($formId = NULL)
{
    if (!isset($formId)) {
        $message = dgettext('phatform', 'No form ID was passed');
        return new PHPWS_Error('phatform', 'archive()', $message, 'continue', PHAT_DEBUG_MODE);
    }
    $archiveDir = PHPWS_HOME_DIR . 'files/phatform/archive/';
    $path = $archiveDir;
    clearstatcache();
    if (!is_dir($path)) {
        if (is_writeable($archiveDir)) {
            PHPWS_File::makeDir($path);
        } else {
            return PHPWS_Error::get(PHATFORM_ARCHIVE_PATH, 'phatform', 'Archive.php::archive', $path);
        }
    } else {
        if (!is_writeable($path)) {
            return PHPWS_Error::get(PHATFORM_ARCHIVE_PATH, 'phatform', 'Archive.php::archive()');
        }
    }
    $table = array();
    $time = time();
    $table[] = 'mod_phatform_forms';
    $table[] = 'mod_phatform_forms_seq';
    $table[] = 'mod_phatform_form_' . $formId;
    $table[] = 'mod_phatform_form_' . $formId . '_seq';
    $table[] = 'mod_phatform_multiselect';
    $table[] = 'mod_phatform_multiselect_seq';
    $table[] = 'mod_phatform_checkbox';
    $table[] = 'mod_phatform_checkbox_seq';
    $table[] = 'mod_phatform_dropbox';
    $table[] = 'mod_phatform_dropbox_seq';
    $table[] = 'mod_phatform_options';
    $table[] = 'mod_phatform_options_seq';
    $table[] = 'mod_phatform_radiobutton';
    $table[] = 'mod_phatform_radiobutton_seq';
    $table[] = 'mod_phatform_textarea';
    $table[] = 'mod_phatform_textarea_seq';
    $table[] = 'mod_phatform_textfield';
    $table[] = 'mod_phatform_textfield_seq';
    $step1 = explode('//', PHPWS_DSN);
    $step2 = explode('@', $step1[1]);
    $step3 = explode(':', $step2[0]);
    $step4 = explode('/', $step2[1]);
    $dbuser = $step3[0];
    $dbpass = $step3[1];
    $dbhost = $step4[0];
    $dbname = $step4[1];
    for ($i = 0; $i < sizeof($table); $i++) {
        $pipe = ' >> ';
        if ($i == 0) {
            $pipe = ' > ';
        }
        $goCode = 'mysqldump -h' . $dbhost . ' -u' . $dbuser . ' -p' . $dbpass . ' ' . $dbname . ' ' . $table[$i] . $pipe . $path . $formId . '.' . $time . '.phat';
        system($goCode);
    }
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:62,代码来源:Archive.php

示例4: write

 public static function write($name, $value, $time = 0)
 {
     if (empty($time)) {
         $time = time() + 31536000;
     }
     $time = (int) $time;
     $cookie_index = sprintf('%s[%s]', COOKIE_HASH, $name);
     if (!setcookie($cookie_index, $value, $time)) {
         return PHPWS_Error::get(COOKIE_SET_FAILED, 'core', 'PHPWS_Cookie::write');
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:11,代码来源:PHPWS_Cookie.php

示例5: save

 /**
  * Saves the cache content
  * @param string key     Name of cache key.
  * @param string content Content stored in the cache
  * @returns boolean TRUE on success, FALSE otherwise
  */
 public static function save($key, $content)
 {
     $key .= SITE_HASH . \Settings::get('Global', 'language');
     if (!PHPWS_Cache::isEnabled()) {
         return;
     }
     if (!is_string($content)) {
         return PHPWS_Error::get(PHPWS_VAR_TYPE, 'core', __CLASS__ . '::' . __FUNCTION__);
     }
     $cache = PHPWS_Cache::initCache();
     return $cache->save($content, md5($key));
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:18,代码来源:PHPWS_Cache.php

示例6: userOption

 public function userOption($module_title)
 {
     $module = new PHPWS_Module($module_title);
     $directory = $module->getDirectory();
     $final_file = $directory . 'inc/my_page.php';
     if (!is_file($final_file)) {
         PHPWS_Error::log(PHPWS_FILE_NOT_FOUND, 'users', 'userOption', $final_file);
         return dgettext('users', 'There was a problem with this module\'s My Page file.');
     }
     include $final_file;
     if (!function_exists('my_page')) {
         return PHPWS_Error::get(USER_MISSING_MY_PAGE, 'users', 'My_Page::userOption', $module_title);
     }
     $content = my_page();
     return $content;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:16,代码来源:My_Page.php

示例7: parse

 public function parse($xml_file, $die_on_error = true)
 {
     $file_contents = @file($xml_file);
     if (empty($file_contents)) {
         return PHPWS_Error::get(PHPWS_FILE_NOT_FOUND, 'core', 'XMLParser:parse', $xml_file);
     }
     foreach ($file_contents as $data) {
         $parse = xml_parse($this->xml, $data);
         if (!$parse) {
             if ($die_on_error) {
                 die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($this->xml)), xml_get_current_line_number($this->xml)));
                 xml_parser_free($this->xml);
             } else {
                 return PHPWS_Error::get(PHPWS_WRONG_TYPE, 'core', 'XMLParset:parse', $xml_file);
             }
         }
     }
     return true;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:19,代码来源:XMLParser.php

示例8: setOperator

 /**
  * Set operator after checking for compatibility
  * addWhere strtouppers the operator
  */
 public function setOperator($operator)
 {
     if (empty($operator)) {
         return false;
     }
     if (!PHPWS_DB::checkOperator($operator)) {
         return PHPWS_Error::get(PHPWS_DB_BAD_OP, 'core', 'PHPWS_DB::addWhere', _('DB Operator:') . $operator);
     }
     if ($operator == 'LIKE' || $operator == 'ILIKE') {
         $operator = $GLOBALS['PHPWS_DB']['lib']->getLike();
     } elseif ($operator == 'NOT LIKE' || $operator == 'NOT ILIKE') {
         $operator = 'NOT ' . $GLOBALS['PHPWS_DB']['lib']->getLike();
     } elseif ($operator == '~' || $operator == '~*' || $operator == 'REGEXP' || $operator == 'RLIKE') {
         $operator = $GLOBALS['PHPWS_DB']['lib']->getRegexp();
     } elseif ($operator == '!~' || $operator == '!~*' || $operator == 'NOT REGEXP' || $operator == 'NOT RLIKE') {
         $operator = $GLOBALS['PHPWS_DB']['lib']->getNotRegexp();
     }
     $this->operator = $operator;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:23,代码来源:PHPWS_DB_Where.php

示例9: loadTemplate

 public function loadTemplate()
 {
     PHPWS_Core::initCoreClass('XMLParser.php');
     $xml = new XMLParser($this->file);
     $xml->setContentOnly(true);
     if (PHPWS_Error::isError($xml->error)) {
         return $xml->error;
     }
     $result = $xml->format();
     if (empty($result['TEMPLATE'])) {
         return;
     }
     $this->data = $result['TEMPLATE'];
     if (!isset($this->data['TITLE'])) {
         $this->error[] = PHPWS_Error::get(PS_TPL_NO_TITLE, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
         return;
     }
     $this->title =& $this->data['TITLE'];
     if (isset($this->data['SUMMARY'])) {
         $this->summary =& $this->data['SUMMARY'];
     }
     if (empty($this->data['THUMBNAIL'])) {
         $this->error[] = PHPWS_Error::get(PS_TPL_NO_TN, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
         return;
     }
     $this->thumbnail =& $this->data['THUMBNAIL'];
     if (isset($this->data['STYLE'])) {
         $this->style =& $this->data['STYLE'];
     }
     if (empty($this->data['STRUCTURE']['SECTION'])) {
         $this->error[] = PHPWS_Error::get(PS_TPL_NO_SECTIONS, 'pagesmith', 'PS_Template::loadTemplate', $this->name);
         return;
     }
     $this->structure =& $this->data['STRUCTURE']['SECTION'];
     if (isset($this->data['FOLDERS'])) {
         if (is_array($this->data['FOLDERS']['NAME'])) {
             $this->folders =& $this->data['FOLDERS']['NAME'];
         } else {
             $this->folders = array($this->data['FOLDERS']['NAME']);
         }
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:42,代码来源:PS_Template.php

示例10: save

 public function save()
 {
     if (!$this->sheet_id) {
         return PHPWS_Error::get(SU_NO_SHEET_ID, 'signup', 'Signup_Slot::save');
     }
     $db = new PHPWS_DB('signup_slots');
     if (!$this->id) {
         $db->addWhere('sheet_id', $this->sheet_id);
         $db->addColumn('s_order', 'max');
         $max = $db->select('one');
         if (PHPWS_Error::isError($max)) {
             return $max;
         }
         if ($max >= 1) {
             $this->s_order = $max + 1;
         } else {
             $this->s_order = 1;
         }
         $db->reset();
     }
     return $db->saveObject($this);
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:22,代码来源:Slots.php

示例11: save

 /**
  * Save this PHAT_Radiobutton
  *
  * @return mixed  Content if going to getOptions stage, content for edit if first form not filled in properly,
  *                or PHPWS_Error on failure.
  * @access public
  */
 function save()
 {
     $error = FALSE;
     $label = $this->getLabel();
     if (!$_SESSION['PHAT_FormManager']->form->checkLabel($_REQUEST['PHAT_ElementName']) && strcasecmp($label, $_REQUEST['PHAT_ElementName']) != 0 || PHPWS_Error::isError($this->setLabel(PHPWS_DB::sqlFriendlyName($_REQUEST['PHAT_ElementName'])))) {
         $currentError = PHPWS_Error::get(PHATFORM_INVALID_NAME, 'phatform', 'PHAT_Radiobutton::save()');
         $error = TRUE;
     }
     $result = $this->setBlurb($_REQUEST['PHAT_ElementBlurb']);
     if (PHPWS_Error::isError($result)) {
         $currentError = $result;
         $error = TRUE;
     }
     if (isset($_REQUEST['PHAT_ElementRequired'])) {
         $this->setRequired(TRUE);
     } else {
         $this->setRequired(FALSE);
     }
     if ($error) {
         return $currentError;
     } else {
         if (is_numeric($_REQUEST['PHAT_ElementNumOptions']) && $_REQUEST['PHAT_ElementNumOptions'] > 0 || isset($_REQUEST['PHAT_OptionSet'])) {
             return $this->getOptions();
         } else {
             return PHPWS_Error::get(PHATFORM_ZERO_OPTIONS, 'phatform', 'PHAT_Radiobutton::save()');
         }
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:35,代码来源:Radiobutton.php

示例12: restrictView

 /**
  * added limitations to a select query to only pull rows that
  * the user is allowed to see. This function does does not work alone.
  * it requires a database object to already be started.
  *
  * The user module MUST be active for this function to work.
  * This Key function cannot be called without it.
  *
  * If the user is a deity or an unrestricted user, no change will be made
  * to your db object.
  *
  */
 public static function restrictView($db, $module = null, $check_dates = true, $source_table = null)
 {
     $now = time();
     if (empty($source_table)) {
         $source_table = $db->tables[0];
     }
     if ($source_table == 'phpws_key') {
         if (!isset($db->tables[1])) {
             return PHPWS_Error::get(KEY_RESTRICT_NO_TABLE, 'core', 'Key::restrictView');
         }
         $source_table = $db->tables[1];
         $key_table = true;
     } else {
         $key_table = false;
     }
     if (!$key_table) {
         $db->addJoin('left', $source_table, 'phpws_key', 'key_id', 'id');
     } else {
         $db->addJoin('left', 'phpws_key', $source_table, 'id', 'key_id');
     }
     $db->addWhere("{$source_table}.key_id", '0', null, null, 'base');
     $db->addWhere('phpws_key.active', 1, null, null, 'active');
     $db->groupIn('active', 'base');
     $db->setGroupConj('active', 'or');
     if (Current_User::isDeity() || isset($module) && Current_User::isUnrestricted($module)) {
         return;
     }
     if ($check_dates) {
         $db->addWhere('phpws_key.show_after', $now, '<', null, 'active');
         $db->addWhere('phpws_key.hide_after', $now, '>', null, 'active');
     }
     if (!Current_User::isLogged()) {
         $db->addWhere('phpws_key.restricted', 0, null, 'and', 'active');
         return;
     } else {
         $groups = Current_User::getGroups();
         if (empty($groups)) {
             return;
         }
         $db->addJoin('left', 'phpws_key', 'phpws_key_view', 'id', 'key_id');
         // if key only has a level 1 restriction, a logged user can view it
         $db->addWhere('phpws_key.restricted', KEY_LOGGED_RESTRICTED, '<=', null, 'restrict_1');
         $db->setGroupConj('restrict_1', 'and');
         // at level 2, the user must be in a group given view permissions
         $db->addWhere('phpws_key.restricted', KEY_GROUP_RESTRICTED, '=', null, 'restrict_2');
         $db->addWhere('phpws_key_view.group_id', $groups, 'in', null, 'restrict_2');
         $db->setGroupConj('restrict_2', 'or');
         if (empty($module)) {
             $levels = Current_User::getUnrestrictedLevels();
             if (!empty($levels)) {
                 $db->addWhere('phpws_key.module', $levels, null, null, 'permission');
                 $db->groupIn('permission', 'restrict_2');
             }
         }
         $db->groupIn('restrict_1', 'base');
         $db->groupIn('restrict_2', 'restrict_1');
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:70,代码来源:Key.php

示例13: get

 /**
  * Returns the content of the the pager object
  */
 public function get($return_blank_results = true)
 {
     $template = array();
     if (empty($this->display_rows)) {
         $result = $this->initialize();
         if (PHPWS_Error::isError($result)) {
             return $result;
         }
     }
     // Report ends the function call
     if ($this->report_type && $this->report_row) {
         $this->createReport();
         exit;
     }
     if (!isset($this->module)) {
         return PHPWS_Error::get(DBPAGER_MODULE_NOT_SET, 'core', 'DBPager::get');
     }
     if (!isset($this->template)) {
         return PHPWS_Error::get(DBPAGER_TEMPLATE_NOT_SET, 'core', 'DBPager::get');
     }
     $rows = $this->getPageRows();
     if (PHPWS_Error::isError($rows)) {
         return $rows;
     }
     if (isset($this->toggles)) {
         $max_tog = count($this->toggles);
     }
     $count = 0;
     $this->getNavigation($template);
     $this->getSortButtons($template);
     if (isset($rows)) {
         foreach ($rows as $rowitem) {
             if (isset($max_tog)) {
                 if ($max_tog == 1) {
                     if ($count % 2) {
                         $rowitem['TOGGLE'] = $this->toggles[0];
                     } else {
                         $rowitem['TOGGLE'] = null;
                     }
                     $count++;
                 } else {
                     $rowitem['TOGGLE'] = $this->toggles[$count];
                     $count++;
                     if ($count >= $max_tog) {
                         $count = 0;
                     }
                 }
             } else {
                 $rowitem['TOGGLE'] = null;
             }
             $template['listrows'][] = $rowitem;
         }
     } elseif (!$return_blank_results) {
         return null;
     } else {
         $template['EMPTY_MESSAGE'] = $this->empty_message;
     }
     DBPager::plugPageTags($template);
     $this->final_template =& $template;
     return PHPWS_Template::process($template, $this->module, $this->template);
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:64,代码来源:DBPager.php

示例14: move

 /**
  * Moves a box to a new location
  */
 public function move($dest)
 {
     if ($dest != 'move_box_up' && $dest != 'move_box_down' && $dest != 'move_box_top' && $dest != 'move_box_bottom' && $dest != 'restore') {
         $themeVars = $_SESSION['Layout_Settings']->getAllowedVariables();
         if (!in_array($dest, $themeVars)) {
             return PHPWS_Error::get(LAYOUT_BAD_THEME_VAR, 'layout', 'Layout_Box::move', $dest);
         }
         $themeVar = $this->theme_var;
         $this->setThemeVar($dest);
         $this->setBoxOrder(NULL);
         $this->save();
         $this->reorderBoxes($this->theme, $themeVar);
         return;
     }
     $db = new PHPWS_DB('layout_box');
     $db->addWhere('id', $this->id, '!=');
     $db->addWhere('theme', $this->theme);
     $db->addWhere('theme_var', $this->theme_var);
     $db->addOrder('box_order');
     $db->setIndexBy('box_order');
     $boxes = $db->getObjects('Layout_Box');
     if (empty($boxes)) {
         return NULL;
     }
     if (PHPWS_Error::isError($boxes)) {
         PHPWS_Error::log($boxes);
         return NULL;
     }
     switch ($dest) {
         case 'restore':
             $this->kill();
             $this->reorderBoxes($this->theme, $this->theme_var);
             Layout::resetBoxes();
             return;
             break;
         case 'move_box_up':
             if ($this->box_order == 1) {
                 $this->move('move_box_bottom');
                 return;
             } else {
                 $old_box =& $boxes[$this->box_order - 1];
                 $old_box->box_order++;
                 $this->box_order--;
                 if (!PHPWS_Error::logIfError($old_box->save())) {
                     PHPWS_Error::logIfError($this->save());
                 }
                 return;
             }
             break;
         case 'move_box_down':
             if ($this->box_order == count($boxes) + 1) {
                 $this->move('move_box_top');
                 return;
             } else {
                 $old_box =& $boxes[$this->box_order + 1];
                 $old_box->box_order--;
                 $this->box_order++;
                 if (!PHPWS_Error::logIfError($old_box->save())) {
                     PHPWS_Error::logIfError($this->save());
                 }
                 return;
             }
             break;
         case 'move_box_top':
             $this->box_order = 1;
             $this->save();
             $count = 2;
             break;
         case 'move_box_bottom':
             $this->box_order = count($boxes) + 1;
             $this->save();
             $count = 1;
             break;
     }
     foreach ($boxes as $box) {
         $box->box_order = $count;
         $box->save();
         $count++;
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:83,代码来源:Box.php

示例15: init

 public function init($file = true)
 {
     $title =& $this->title;
     if ($title == 'core') {
         $this->setDirectory(PHPWS_SOURCE_DIR . 'core/');
         // even if use_file is false, we get the version_http from the file
         $filename = PHPWS_SOURCE_DIR . 'core/boost/boost.php';
         if (!is_file($filename)) {
             $this->_error = PHPWS_Error::get(PHPWS_FILE_NOT_FOUND, 'core', 'PHPWS_Module::init', $filename);
         } else {
             include $filename;
         }
         if (!$file) {
             $db = new PHPWS_DB('core_version');
             $db->addColumn('version');
             $version = $db->select('one');
         }
         $this->_dependency = (bool) $dependency;
         $this->setVersion($version);
         $this->setRegister(false);
         $this->setImportSQL(true);
         $this->setProperName('Core');
         $this->setVersionHttp($version_http);
         $this->setAbout(true);
     } else {
         $this->setDirectory(PHPWS_SOURCE_DIR . "mod/{$title}/");
         if ($file == true) {
             $result = PHPWS_Module::initByFile();
         } else {
             $result = PHPWS_Module::initByDB();
         }
         if (PHPWS_Error::isError($result)) {
             $this->_error = $result;
         } elseif (empty($result)) {
             $this->_error = PHPWS_Error::get(PHPWS_NO_MOD_FOUND, 'core', 'PHPWS_Module::init', $title);
         }
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:38,代码来源:Module.php


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