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


PHP sys类代码示例

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


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

示例1: test_is_absolute_true

  function test_is_absolute_true()
  {
    $this->assertTrue(fs :: is_absolute('/test'));

    if(sys :: is_win32())
      $this->assertTrue(fs :: is_absolute('c:/test'));
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:fs_test.class.php

示例2: publications_userapi_getitemlinks

/**
 * utility function to pass individual item links to a caller
 *
 * @param $args['itemids'] array of item ids to get
 * @return array Array containing the itemlink(s) for the item(s).
 */
function publications_userapi_getitemlinks($args)
{
    $itemlinks = array();
    sys::import('xaraya.structures.query');
    $xartable = xarDB::getTables();
    $q = new Query('SELECT', $xartable['publications']);
    $q->addfield('id');
    $q->addfield('title');
    $q->addfield('description');
    $q->addfield('pubtype_id');
    $q->in('state', array(3, 4));
    if (!empty($args['itemids'])) {
        $itemids = explode(',', $args['itemids']);
        $q->in('id', $itemids);
    }
    $q->addorder('title');
    $q->run();
    $result = $q->output();
    if (empty($result)) {
        return $itemlinks;
    }
    foreach ($result as $item) {
        if (empty($item['title'])) {
            $item['title'] = xarML('Display Publication');
        }
        $itemlinks[$item['id']] = array('url' => xarModURL('publications', 'user', 'display', array('id' => $item['id'])), 'title' => $item['title'], 'label' => $item['description']);
    }
    return $itemlinks;
}
开发者ID:godboko,项目名称:modules,代码行数:35,代码来源:getitemlinks.php

示例3: calendar_userapi_getUserDateTimeInfo

function calendar_userapi_getUserDateTimeInfo()
{
    // dates come in as YYYYMMDD
    xarVarFetch('cal_date', 'str:4:8', $cal_date, xarLocaleFormatDate('%Y%m%d'));
    $data = array();
    $data['cal_date'] =& $cal_date;
    if (!preg_match('/([\\d]{4,4})([\\d]{2,2})?([\\d]{2,2})?/', $cal_date, $match)) {
        $year = xarLocaleFormateDate('Y');
        $month = xarLocaleFormateDate('m');
        $day = xarLocaleFormateDate('d');
    } else {
        $year = $match[1];
        if (isset($match[2])) {
            $month = $match[2];
        } else {
            $month = '01';
        }
        if (isset($match[3])) {
            $day = $match[3];
        } else {
            $day = '01';
        }
    }
    //$data['selected_date']   = (int) $year.$month.$day;
    $data['cal_day'] = (int) $day;
    $data['cal_month'] = (int) $month;
    $data['cal_year'] = (int) $year;
    //$data['selected_timestamp'] = gmmktime(0,0,0,$month,$day,$year);
    sys::import('xaraya.structures.datetime');
    $today = new XarDateTime();
    $usertz = xarModUserVars::get('roles', 'usertimezone', xarSession::getVar('role_id'));
    $useroffset = $today->getTZOffset($usertz);
    $data['now'] = getdate(time() + $useroffset);
    return $data;
}
开发者ID:godboko,项目名称:modules,代码行数:35,代码来源:getuserdatetimeinfo.php

示例4: shop_userapi_getproducts

/**
 *  Get products
 */
function shop_userapi_getproducts($args)
{
    $startnum = 1;
    extract($args);
    if (!xarSecurityCheck('ViewShop')) {
        return;
    }
    if (!isset($items_per_page)) {
        $items_per_page = xarModVars::get('shop', 'items_per_page');
    }
    $data['items_per_page'] = $items_per_page;
    // Load the DD master object class. This line will likely disappear in future versions
    sys::import('modules.dynamicdata.class.objects.master');
    sys::import('modules.dynamicdata.class.properties.master');
    // Get the object we'll be working with. Note this is a so called object list
    $mylist = DataObjectMaster::getObjectList(array('name' => 'shop_products'));
    $data['sort'] = xarMod::ApiFunc('shop', 'admin', 'sort', array('sortfield_fallback' => 'id', 'ascdesc_fallback' => 'ASC'));
    // We have some filters for the items
    $filters = array('startnum' => $startnum, 'status' => DataPropertyMaster::DD_DISPLAYSTATE_ACTIVE, 'sort' => $data['sort']);
    if (isset($where)) {
        $filters['where'] = $where;
    }
    // Get the items
    $products = $mylist->getItems($filters);
    // return the products
    $data['products'] = $products;
    // Return the template variables defined in this function
    return $data;
}
开发者ID:godboko,项目名称:modules,代码行数:32,代码来源:getproducts.php

示例5: error

function error($description, $error_place = '', $params = array())
{
    if (defined('DEVELOPER_ENVIROMENT')) {
        trigger_error('error', E_USER_WARNING);
        echo $description . '<br>' . $error_place . '<br><pre>';
        print_r($params);
        echo '</pre>';
    }
    debug::write_error($description, $error_place, $params);
    rollback_user_transaction();
    if (debug::is_console_enabled()) {
        echo debug::parse_html_console();
    } else {
        $message = '';
        if ($user_id = user::get_id()) {
            $message .= "user id:\t{$user_id}\nlogin:\t\t" . user::get_login() . "\ne-mail:\t\t" . user::get_email() . "\n";
        }
        $message .= "ip:\t\t" . sys::client_ip() . "\nrequest:\t" . REQUEST_URI . "\nerror:\t\t{$title}\ndescription:\t{$msg}";
        $mail = new mime_mail();
        $mail->set_body($message);
        $mail->build_message();
        $mail->send('developer', DEVELOPER_EMAIL, '', WEBSITE_EMAIL, $_SERVER['HTTP_HOST'] . ' internal error!');
    }
    ob_end_flush();
    exit;
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:26,代码来源:error.inc.php

示例6: write

 function write($log_file_data, $string)
 {
     $log_dir = $log_file_data[0];
     $log_name = $log_file_data[1];
     $file_name = $log_dir . $log_name;
     if (!is_dir($log_dir)) {
         fs::mkdir($log_dir, 0775, true);
     }
     $oldumask = @umask(0);
     $file_existed = @file_exists($file_name);
     $log_file = @fopen($file_name, 'a');
     if ($log_file) {
         $time = strftime("%b %d %Y %H:%M:%S", strtotime('now'));
         $notice = '[ ' . $time . " ]\n";
         $user =& user::instance();
         if (($user_id = $user->get_id()) != DEFAULT_USER_ID) {
             $notice .= '[ ' . $user_id . ' ] [ ' . $user->get_login() . ' ] [ ' . $user->get_email() . ' ] ';
         }
         $notice .= '[' . sys::client_ip() . '] [' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . "]\n" . $string . "\n\n";
         @fwrite($log_file, $notice);
         @fclose($log_file);
         if (!$file_existed) {
             @chmod($file_name, 0664);
         }
         @umask($oldumask);
         $result = true;
     } else {
         @umask($oldumask);
         $result = false;
         debug::write_error("Cannot open log file '{$file_name}' for writing\n" . "The web server must be allowed to modify the file.\n" . "File logging for '{$file_name}' is disabled.", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, false);
     }
     return $result;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:33,代码来源:log.class.php

示例7: load

 public function load()
 {
     $this->headline = Language::DirectTranslate("plugin_menulistwidget_menus");
     if (Cache::contains("menu", "widget_" . $_GET['dir'])) {
         $this->content = Cache::getData("menu", "widget_" . $_GET['dir']);
     } else {
         if (!isset($_GET['dir']) || substr($_GET['dir'], 0, 1) == '.') {
             $_GET['dir'] = "";
         }
         $template = new Template();
         $template->load("plugin_menulistwidget_menulist");
         $newmenuurl = UrlRewriting::GetUrlByAlias("admin/newmenu");
         $template->assign_var("NEWMENUURL", $newmenuurl);
         $menus = sys::getMenues($_GET['dir']);
         foreach ($menus as $menu) {
             $index = $template->add_loop_item("MENUS");
             $template->assign_loop_var("MENUS", $index, "ID", $menu->id);
             $template->assign_loop_var("MENUS", $index, "TITLE", $menu->name);
             $template->assign_loop_var("MENUS", $index, "PAGES", $menu->count);
             $editurl = UrlRewriting::GetUrlByAlias("admin/editmenu", "menu=" . $menu->id);
             $template->assign_loop_var("MENUS", $index, "EDITURL", $editurl);
             $deleteurl = UrlRewriting::GetUrlByAlias("admin/deletemenu", "menu=" . $menu->id);
             $template->assign_loop_var("MENUS", $index, "DELETEURL", $deleteurl);
         }
         if (!$menus) {
             $template->assign_var("NOMENUS", Language::DirectTranslate("plugin_menulistwidget_no_menus"));
         } else {
             $template->assign_var("NOMENUS", "");
         }
         $this->content = $template->getCode();
         Cache::setData("menu", "widget_" . $_GET['dir'], $this->content);
     }
 }
开发者ID:srueegger,项目名称:1zu12bB,代码行数:33,代码来源:menulistwidget.php

示例8: shop_user_viewcart

/**
 * View the cart
 */
function shop_user_viewcart()
{
    // If the user returns to the cart after taking other steps, unset any errors from earlier in the session.
    xarSession::delVar('errors');
    sys::import('modules.dynamicdata.class.objects.master');
    $subtotals = array();
    $products = array();
    $total = 0;
    // May want to display cust info with the cart...
    $cust = xarMod::APIFunc('shop', 'user', 'customerinfo');
    $data['cust'] = $cust;
    $shop = xarSession::getVar('shop');
    foreach ($shop as $pid => $val) {
        // If this post variable is set, we must need to update the quantity
        if (isset($_POST['qty' . $pid])) {
            unset($qty_new);
            // Have to unset this since we're in a foreach
            if (!xarVarFetch('qty' . $pid, 'isset', $qty_new, NULL, XARVAR_DONT_SET)) {
                return;
            }
            if ($qty_new == 0) {
                unset($shop[$pid]);
            } else {
                $shop[$pid]['qty'] = $qty_new;
            }
        }
        // If the quantity hasn't been set to zero, add it to the $products array...
        if (isset($shop[$pid])) {
            // Commas in the quantity seem to mess up our math
            $products[$pid]['qty'] = str_replace(',', '', $shop[$pid]['qty']);
            // Get the product info
            $object = DataObjectMaster::getObject(array('name' => 'shop_products'));
            $some_id = $object->getItem(array('itemid' => $pid));
            $values = $object->getFieldValues();
            $products[$pid]['title'] = xarVarPrepForDisplay($values['title']);
            $products[$pid]['price'] = $values['price'];
            $subtotal = $values['price'] * $products[$pid]['qty'];
            $subtotals[] = $subtotal;
            // so we can use array_sum() to add it all up
            if (substr($subtotal, 0, 1) == '.') {
                $subtotal = '0' . $subtotal;
            }
            $products[$pid]['subtotal'] = number_format($subtotal, 2);
        }
    }
    xarSession::setVar('shop', $shop);
    $total = array_sum($subtotals);
    // Add a zero to the front of the number if it starts with a decimal...
    if (substr($total, 0, 1) == '.') {
        $total = '0' . $total;
    }
    $total = number_format($total, 2);
    xarSession::setVar('products', $products);
    // update the session variable
    $data['products'] = $products;
    // don't want too much session stuff in the templates
    xarSession::setVar('total', $total);
    $data['total'] = $total;
    return $data;
}
开发者ID:godboko,项目名称:modules,代码行数:63,代码来源:viewcart.php

示例9: publications_adminapi_delete

/**
 * Publications Module
 *
 * @package modules
 * @subpackage publications module
 * @category Third Party Xaraya Module
 * @version 2.0.0
 * @copyright (C) 2011 Netspan AG
 * @license GPL {@link http://www.gnu.org/licenses/gpl.html}
 * @author Marc Lutolf <mfl@netspan.ch>
 */
function publications_adminapi_delete($args)
{
    // Get arguments from argument array
    extract($args);
    // Argument check
    if (!isset($itemid)) {
        $msg = xarML('Invalid #(1) for #(2) function #(3)() in module #(4)', 'publication ID', 'admin', 'delete', 'Publications');
        throw new BadParameterException(null, $msg);
    }
    $ids = !is_array($itemid) ? explode(',', $itemid) : $itemid;
    if (!isset($deletetype)) {
        $deletetype = 0;
    }
    sys::import('xaraya.structures.query');
    $table = xarDB::getTables();
    switch ($deletetype) {
        case 0:
        default:
            $q = new Query('UPDATE', $table['publications']);
            $q->addfield('state', 0);
            break;
        case 10:
            $q = new Query('DELETE', $table['publications']);
            break;
    }
    $q->in('id', $ids);
    if (!$q->run()) {
        return false;
    }
    return true;
}
开发者ID:godboko,项目名称:modules,代码行数:42,代码来源:delete.php

示例10: wurfl_init

/**
 * Initialize WURFL
 *
 */
function wurfl_init($args = array())
{
    if (!isset($args['mode'])) {
        $args['mode'] = 'performance';
    }
    sys::import('modules.wurfl.xarincludes.WURFL.Application');
    $resourcesDir = sys::code() . 'modules/wurfl/xarincludes/resources';
    $persistenceDir = $resourcesDir . '/storage/persistence';
    $cacheDir = $resourcesDir . '/storage/cache';
    // Create WURFL Configuration
    $wurflConfig = new WURFL_Configuration_InMemoryConfig();
    // Set location of the WURFL File
    $wurflConfig->wurflFile($resourcesDir . '/wurfl.xml');
    // Set the match mode for the API ('performance' or 'accuracy')
    $wurflConfig->matchMode($args['mode']);
    // Setup WURFL Persistence
    $wurflConfig->persistence('file', array('dir' => $persistenceDir));
    // Setup Caching
    $wurflConfig->cache('file', array('dir' => $cacheDir, 'expiration' => 36000));
    // Create a WURFL Manager Factory from the WURFL Configuration
    $wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);
    // Create a WURFL Manager
    /* @var $wurflManager WURFL_WURFLManager */
    $wurflManager = $wurflManagerFactory->create();
    return $wurflManager;
}
开发者ID:godboko,项目名称:modules,代码行数:30,代码来源:wurfl_init.php

示例11: test_is_absolute_true

  function test_is_absolute_true()
  {
    $this->assertTrue(fs :: is_absolute('/test'));

    if(sys :: os_type() == 'win32')
      $this->assertTrue(fs :: is_absolute('c:/test'));
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:fs_test.class.php

示例12: process_row

 function process_row($row, $line)
 {
     $data = array("folder" => $this->_folder);
     if (DEBUG) {
         print_r(array($line, $row));
     }
     foreach ($row as $key => $val) {
         if (isset($this->_fields[$this->_headers[$key]])) {
             $data[$this->_fields[$this->_headers[$key]]] = $val;
         }
     }
     if (DEBUG) {
         print_r($data);
     }
     $id = !empty($data["id"]) ? $data["id"] : -1;
     if ($this->_validate_only) {
         $result = $this->_sgsml->validate($data, $id);
     } else {
         $result = $this->_sgsml->update($data, $id);
     }
     sys::$db_queries = array();
     // reduce memory usage
     if (empty($result)) {
         // validate
         $this->out(".");
     } else {
         if (is_array($result)) {
             $message = sprintf("{t}line{/t} %s: %s", $line, self::err_to_str($result));
             $this->_errors[] = $message;
             $this->out("<span style='color:red; font-weight:bold;'>{t}Error{/t}:</span> " . q($message) . ", ");
         } else {
             $this->out("#" . $line . ": " . q($result) . ", ");
         }
     }
 }
开发者ID:drognisep,项目名称:Simple-Groupware,代码行数:35,代码来源:import.php

示例13: publications_user_view_pages

/**
 * Publications Module
 *
 * @package modules
 * @subpackage publications module
 * @category Third Party Xaraya Module
 * @version 2.0.0
 * @copyright (C) 2011 Netspan AG
 * @license GPL {@link http://www.gnu.org/licenses/gpl.html}
 * @author Marc Lutolf <mfl@netspan.ch>
 */
function publications_user_view_pages($args)
{
    extract($args);
    if (!xarSecurityCheck('ManagePublications')) {
        return;
    }
    // Accept a parameter to allow selection of a single tree.
    xarVarFetch('contains', 'id', $contains, 0, XARVAR_NOT_REQUIRED);
    $data = xarMod::apiFunc('publications', 'user', 'getpagestree', array('key' => 'index', 'dd_flag' => false, 'tree_contains_pid' => $contains));
    if (empty($data['pages'])) {
        // TODO: pass to template.
        return $data;
        //xarML('NO PAGES DEFINED');
    } else {
        $data['pages'] = xarMod::apiFunc('publications', 'tree', 'array_maptree', $data['pages']);
    }
    $data['contains'] = $contains;
    // Check modify and delete privileges on each page.
    // EditPage - allows basic changes, but no moving or renaming (good for sub-editors who manage content)
    // AddPage - new pages can be added (further checks may limit it to certain page types)
    // DeletePage - page can be renamed, moved and deleted
    if (!empty($data['pages'])) {
        // Bring in the access property for security checks
        sys::import('modules.dynamicdata.class.properties.master');
        $accessproperty = DataPropertyMaster::getProperty(array('name' => 'access'));
        $accessproperty->module = 'publications';
        $accessproperty->component = 'Page';
        foreach ($data['pages'] as $key => $page) {
            $thisinstance = $page['name'] . ':' . $page['ptid']['name'];
            // Do we have admin access?
            $args = array('instance' => $thisinstance, 'level' => 800);
            $adminaccess = $accessproperty->check($args);
            // Decide whether this page can be modified by the current user
            /*try {
                  $args = array(
                      'instance' => $thisinstance,
                      'group' => $page['access']['modify_access']['group'],
                      'level' => $page['access']['modify_access']['level'],
                  );
              } catch (Exception $e) {
                  $args = array();
              }*/
            $data['pages'][$key]['edit_allowed'] = $adminaccess || $accessproperty->check($args);
            /*
                        // Decide whether this page can be deleted by the current user
                       try {
                            $args = array(
                                'instance' => $thisinstance,
                                'group' => $page['access']['delete_access']['group'],
                                'level' => $page['access']['delete_access']['level'],
                            );
                        } catch (Exception $e) {
                            $args = array();
                        }*/
            $data['pages'][$key]['delete_allowed'] = $adminaccess || $accessproperty->check($args);
        }
    }
    return $data;
}
开发者ID:godboko,项目名称:modules,代码行数:70,代码来源:view_pages.php

示例14: switch

/**
 *  Factory method that allows the creation of new objects
 *  @version $Id: factory.php,v 1.5 2003/06/24 21:30:30 roger Exp $
 *  @param string $class the name of the object to create
 *  @return object the created object
 */
function &calendar_userapi_factory($class)
{
    static $calobject;
    static $icalobject;
    static $eventobject;
    static $importobject;
    static $exportobject;
    static $alarmobject;
    static $modinfo;
    if (!isset($modinfo)) {
        $modInfo =& xarMod::getInfo(xarMod::getRegID('calendar'));
    }
    switch (strtolower($class)) {
        case 'calendar':
            if (!isset($calobject)) {
                sys::import("modules.{$modInfo['osdirectory']}.class.calendar");
                $calobject =& new Calendar();
            }
            return $calobject;
            break;
        case 'ical_parser':
            if (!isset($icalobject)) {
                sys::import("modules.{$modInfo['osdirectory']}.class.ical_parser");
                $icalobject =& new iCal_Parser();
            }
            return $icalobject;
            break;
        case 'event':
            if (!isset($eventobject)) {
                sys::import("modules.{$modInfo['osdirectory']}.class.event");
                $eventobject =& new Event();
            }
            return $eventobject;
            break;
            /*
            case 'import':
                break;
            
            case 'export':
                break;
            
            case 'alarm':
                break;
            */
        /*
        case 'import':
            break;
        
        case 'export':
            break;
        
        case 'alarm':
            break;
        */
        default:
            return;
            break;
    }
}
开发者ID:godboko,项目名称:modules,代码行数:65,代码来源:factory.php

示例15: shop_user_newcustomer

/**
 *  Create a new customer
 */
function shop_user_newcustomer()
{
    if (!xarVarFetch('objectid', 'id', $data['objectid'], NULL, XARVAR_DONT_SET)) {
        return;
    }
    if (!xarVarFetch('returnurl', 'str', $returnurl, NULL, XARVAR_NOT_REQUIRED)) {
        return;
    }
    sys::import('modules.dynamicdata.class.objects.master');
    $rolesobject = DataObjectMaster::getObject(array('name' => 'roles_users'));
    $data['properties'] = $rolesobject->properties;
    // Check if we are in 'preview' mode from the input here - the rest is handled by checkInput()
    // Here we are testing for a button clicked, so we test for a string
    if (!xarVarFetch('preview', 'str', $data['preview'], NULL, XARVAR_DONT_SET)) {
        return;
    }
    // Check if we are submitting the form
    // Here we are testing for a hidden field we define as true on the template, so we can use a boolean (true/false)
    if (!xarVarFetch('confirm', 'bool', $data['confirm'], false, XARVAR_NOT_REQUIRED)) {
        return;
    }
    if ($data['confirm']) {
        // Check for a valid confirmation key. The value is automatically gotten from the template
        if (!xarSecConfirmAuthKey()) {
            return xarTplModule('privileges', 'user', 'errors', array('layout' => 'bad_author'));
        }
        // Get the data from the form and see if it is all valid
        // Either way the values are now stored in the object
        $isvalid = $rolesobject->properties['email']->checkInput();
        $isvalid2 = $rolesobject->properties['password']->checkInput();
        if (!$isvalid || !$isvalid2) {
            // Bad data: redisplay the form with the data we picked up and with error messages
            return xarTplModule('shop', 'user', 'newcustomer', $data);
        } else {
            $email = $rolesobject->properties['email']->getValue();
            $password = $rolesobject->properties['password']->getValue();
            $rolesobject->properties['name']->setValue($email);
            $rolesobject->properties['email']->setValue($email);
            $rolesobject->properties['uname']->setValue($email);
            $rolesobject->properties['password']->setValue($password);
            $rolesobject->properties['state']->setValue(3);
            $authmodule = (int) xarMod::getID('shop');
            $rolesobject->properties['authmodule']->setValue($authmodule);
            $uid = $rolesobject->createItem();
            $custobject = DataObjectMaster::getObject(array('name' => 'shop_customers'));
            $custobject->createItem(array('id' => $uid));
            if (isset($returnurl)) {
                xarMod::APIFunc('authsystem', 'user', 'login', array('uname' => $email, 'pass' => $password));
                xarResponse::redirect($returnurl);
            } else {
                xarResponse::redirect(xarModURL('shop'));
            }
            // Always add the next line even if processing never reaches it
            return true;
        }
    }
    // Return the template variables defined in this function
    return $data;
}
开发者ID:godboko,项目名称:modules,代码行数:62,代码来源:newcustomer.php


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