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


PHP ArrayData::WriteArray方法代码示例

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


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

示例1: getPDFPrefs

 function getPDFPrefs()
 {
     global $sql, $eArrayStorage;
     if (!is_object($eArrayStorage)) {
         e107_require_once(e_HANDLER . 'arraystorage_class.php');
         $eArrayStorage = new ArrayData();
     }
     if (!is_object($sql)) {
         $sql = new db();
     }
     $num_rows = $sql->db_Select('core', '*', "e107_name='pdf' ");
     if ($num_rows == 0) {
         $tmp = $this->getDefaultPDFPrefs();
         $tmp2 = $eArrayStorage->WriteArray($tmp);
         $sql->db_Insert('core', "'pdf', '" . $tmp2 . "' ");
         $sql->db_Select('core', '*', "e107_name='pdf' ");
     }
     $row = $sql->db_Fetch();
     $pdfPref = $eArrayStorage->ReadArray($row['e107_value']);
     return $pdfPref;
 }
开发者ID:notzen,项目名称:e107,代码行数:21,代码来源:e107pdf.php

示例2: add

 function add($vars)
 {
     $tp = e107::getParser();
     $sql = e107::getDb();
     $pmsize = 0;
     $attachlist = '';
     $pm_options = '';
     $ret = '';
     $addOutbox = TRUE;
     $maxSendNow = varset($this->pmPrefs['pm_max_send'], 100);
     // Maximum number of PMs to send without queueing them
     if (isset($vars['pm_from'])) {
         // Doing bulk send off cron task
         $info = array();
         foreach ($vars as $k => $v) {
             if (strpos($k, 'pm_') === 0) {
                 $info[$k] = $v;
                 unset($vars[$k]);
             }
         }
         $addOutbox = FALSE;
         // Don't add to outbox - was done earlier
     } else {
         // Send triggered by user - may be immediate or bulk dependent on number of recipients
         $vars['options'] = '';
         if (isset($vars['receipt']) && $vars['receipt']) {
             $pm_options .= '+rr+';
         }
         if (isset($vars['uploaded'])) {
             foreach ($vars['uploaded'] as $u) {
                 if (!isset($u['error']) || !$u['error']) {
                     $pmsize += $u['size'];
                     $a_list[] = $u['name'];
                 }
             }
             $attachlist = implode(chr(0), $a_list);
         }
         $pmsize += strlen($vars['pm_message']);
         $pm_subject = trim($tp->toDB($vars['pm_subject']));
         $pm_message = trim($tp->toDB($vars['pm_message']));
         if (!$pm_subject && !$pm_message && !$attachlist) {
             // Error - no subject, no message body and no uploaded files
             return LAN_PM_65;
         }
         // Most of the pm info is fixed - just need to set the 'to' user on each send
         $info = array('pm_from' => $vars['from_id'], 'pm_sent' => time(), 'pm_read' => 0, 'pm_subject' => $pm_subject, 'pm_text' => $pm_message, 'pm_sent_del' => 0, 'pm_read_del' => 0, 'pm_attachments' => $attachlist, 'pm_option' => $pm_options, 'pm_size' => $pmsize);
     }
     if (isset($vars['to_userclass']) || isset($vars['to_array'])) {
         if (isset($vars['to_userclass'])) {
             $toclass = e107::getUserClass()->uc_get_classname($vars['pm_userclass']);
             $tolist = $this->get_users_inclass($vars['pm_userclass']);
             $ret .= LAN_PM_38 . ": {$toclass}<br />";
             $class = TRUE;
         } else {
             $tolist = $vars['to_array'];
             $class = FALSE;
         }
         // Sending multiple PMs here. If more than some number ($maxSendNow), need to split into blocks.
         if (count($tolist) > $maxSendNow) {
             $totalSend = count($tolist);
             $targets = array_chunk($tolist, $maxSendNow);
             // Split into a number of lists, each with the maximum number of elements (apart from the last block, of course)
             unset($tolist);
             $array = new ArrayData();
             $pmInfo = $info;
             $genInfo = array('gen_type' => 'pm_bulk', 'gen_datestamp' => time(), 'gen_user_id' => USERID, 'gen_ip' => '');
             for ($i = 0; $i < count($targets) - 1; $i++) {
                 // Save the list in the 'generic' table
                 $pmInfo['to_array'] = $targets[$i];
                 // Should be in exactly the right format
                 $genInfo['gen_intdata'] = count($targets[$i]);
                 $genInfo['gen_chardata'] = $array->WriteArray($pmInfo, TRUE);
                 $sql->insert('generic', array('data' => $genInfo, '_FIELD_TYPES' => array('gen_chardata' => 'string')));
                 // Don't want any of the clever sanitising now
             }
             $toclass .= ' [' . $totalSend . ']';
             $tolist = $targets[count($targets) - 1];
             // Send the residue now (means user probably isn't kept hanging around too long if sending lots)
             unset($targets);
         }
         foreach ($tolist as $u) {
             set_time_limit(30);
             $info['pm_to'] = intval($u['user_id']);
             // Sending to a single user now
             if ($pmid = $sql->insert('private_msg', $info)) {
                 $info['pm_id'] = $pmid;
                 e107::getEvent()->trigger('user_pm_sent', $info);
                 unset($info['pm_id']);
                 // prevent it from being used on the next record.
                 if ($class == FALSE) {
                     $toclass .= $u['user_name'] . ', ';
                 }
                 if (check_class($this->pmPrefs['notify_class'], $u['user_class'])) {
                     $vars['to_info'] = $u;
                     $this->pm_send_notify($u['user_id'], $vars, $pmid, count($a_list));
                 }
             } else {
                 $ret .= LAN_PM_39 . ": {$u['user_name']} <br />";
                 e107::getMessage()->addDebug($sql->getLastErrorText());
             }
//.........这里部分代码省略.........
开发者ID:armpit,项目名称:e107,代码行数:101,代码来源:pm_class.php

示例3: targetToDb

 /**
  * Generate an array of mail recipient data which can be passed directly to the DB routines.
  * Only valid DB fields are copied
  * Combining/splitting of fields is done as necessary
  * (This is essentially the translation between internal storage format and db storage format. If
  * the DB format changes, only this routine and its counterpart should need changing)
  *
  * @param $data - array of email target-related data in internal format
  * @param $addMissing - if TRUE, undefined fields are added
  *
  * @return void
  */
 public function targetToDb(&$data, $addMissing = FALSE)
 {
     // Direct correspondence at present (apart from needing to convert potential array $data['mail_target_info']) - but could change
     $res = array();
     foreach ($this->dbTypes['mail_recipients'] as $f => $v) {
         if (isset($data[$f])) {
             $res[$f] = $data[$f];
         } elseif ($addMissing) {
             $res[$f] = '';
         }
     }
     if (isset($data['mail_target_info']) && is_array($data['mail_target_info'])) {
         $array = new ArrayData();
         $tmp = $array->WriteArray($data['mail_target_info'], TRUE);
         $res['mail_target_info'] = $tmp;
     }
     return $res;
 }
开发者ID:notzen,项目名称:e107,代码行数:30,代码来源:mail_manager_class.php

示例4: readTree

 /**
  *	Ensure the tree of userclass data is stored in our object ($this->class_tree).
  *	Only read if its either not present, or the $force flag is set.
  *	Data is cached if enabled
  *
  *	@param boolean $force - set to TRUE to force a re-read of the info regardless.
  *	@return none
  */
 public function readTree($force = FALSE)
 {
     if (isset($this->class_tree) && count($this->class_tree) && !$force) {
         return;
     }
     $e107 = e107::getInstance();
     $this->class_tree = array();
     $this->class_parents = array();
     $array = new ArrayData();
     if ($temp = $e107->ecache->retrieve_sys(UC_CACHE_TAG)) {
         $this->class_tree = $array->ReadArray($temp);
         unset($temp);
     } else {
         $this->sql_r->db_Select('userclass_classes', '*', "ORDER BY userclass_parent", 'nowhere');
         // The order statement should give a consistent return
         while ($row = $this->sql_r->db_Fetch(MYSQL_ASSOC)) {
             $this->class_tree[$row['userclass_id']] = $row;
             $this->class_tree[$row['userclass_id']]['class_children'] = array();
             // Create the child array in case needed
         }
         // Add in any fixed classes that aren't already defined
         foreach ($this->fixed_classes as $c => $d) {
             if (!isset($this->class_tree[$c])) {
                 switch ($c) {
                     case e_UC_ADMIN:
                     case e_UC_MAINADMIN:
                         $this->class_tree[$c]['userclass_parent'] = e_UC_NOBODY;
                         break;
                     case e_UC_NEWUSER:
                         $this->class_tree[$c]['userclass_parent'] = e_UC_MEMBER;
                         break;
                     default:
                         $this->class_tree[$c]['userclass_parent'] = e_UC_PUBLIC;
                 }
                 $this->class_tree[$c]['userclass_id'] = $c;
                 $this->class_tree[$c]['userclass_name'] = $d;
                 $this->class_tree[$c]['userclass_description'] = 'Fixed class';
                 $this->class_tree[$c]['userclass_visibility'] = e_UC_PUBLIC;
                 $this->class_tree[$c]['userclass_editclass'] = e_UC_MAINADMIN;
                 $this->class_tree[$c]['userclass_accum'] = $c;
                 $this->class_tree[$c]['userclass_type'] = UC_TYPE_STD;
             }
         }
         $userCache = $array->WriteArray($this->class_tree, FALSE);
         $e107->ecache->set_sys(UC_CACHE_TAG, $userCache);
         unset($userCache);
     }
     // Now build the tree.
     // There are just two top-level classes - 'Everybody' and 'Nobody'
     $this->class_parents[e_UC_PUBLIC] = e_UC_PUBLIC;
     $this->class_parents[e_UC_NOBODY] = e_UC_NOBODY;
     foreach ($this->class_tree as $uc) {
         if ($uc['userclass_id'] != e_UC_PUBLIC && $uc['userclass_id'] != e_UC_NOBODY) {
             if (!isset($this->class_tree[$uc['userclass_parent']])) {
                 echo "Orphaned class record: ID=" . $uc['userclass_id'] . " Name=" . $uc['userclass_name'] . "  Parent=" . $uc['userclass_parent'] . "<br />";
             } else {
                 // Add to array
                 $this->class_tree[$uc['userclass_parent']]['class_children'][] = $uc['userclass_id'];
             }
         }
     }
 }
开发者ID:notzen,项目名称:e107,代码行数:70,代码来源:userclass_class.php

示例5: recurse_pref

    $url_prefix = substr($_SERVER['PHP_SELF'], strlen($e_HTTP), strrpos($_SERVER['PHP_SELF'], "/") + 1 - strlen($e_HTTP));
    $num_levels = substr_count($url_prefix, "/");
    $link_prefix = '';
    for ($i = 1; $i <= $num_levels; $i++) {
        $link_prefix .= "../";
    }
    define("e_ADMIN", $e_HTTP . $admin_directory . "/");
    define("e_SELF", "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
    define("e_QUERY", preg_replace("#&|/?PHPSESSID.*#i", "", $_SERVER['QUERY_STRING']));
    define('e_BASE', $link_prefix);
    $e_path = !strpos($_SERVER['SCRIPT_FILENAME'], ".php") ? $_SERVER['PATH_TRANSLATED'] : $_SERVER['SCRIPT_FILENAME'];
    define("e_PATH", $e_path);
    $pref_language = "English";
    include_once "../../" . $LANGUAGES_DIRECTORY . "English/lan_prefs.php";
    require_once "../../" . $FILES_DIRECTORY . "def_e107_prefs.php";
    $PrefOutput = $eArrayStorage->WriteArray($pref);
    mysql_query("DELETE FROM " . $mySQLprefix . "core WHERE e107_name='SitePrefs' OR e107_name='SitePrefs_Backup'");
    if (!mysql_query("INSERT INTO " . $mySQLprefix . "core VALUES ('SitePrefs', '{$PrefOutput}')")) {
        $message = "Rebuild failed ...";
        $END = TRUE;
    } else {
        mysql_query("INSERT INTO " . $mySQLprefix . "core VALUES ('SitePrefs_Backup', '{$PrefOutput}')");
        $message = "Core reset. <br /><br /><a href='../../index.php'>Click here to continue</a>";
        $END = TRUE;
    }
}
function recurse_pref($ppost)
{
    $search = array("\"", "'", "\\", '\\"', "\\'", "\$", "?");
    $replace = array("&quot;", "&#39;", "&#92;", "&quot;", "&#39;", "&#036;", "&copy;");
    foreach ($ppost as $key => $value) {
开发者ID:notzen,项目名称:e107,代码行数:31,代码来源:resetcore.php


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