Archive for 四月, 2011

uniqid

uniqid
产生只一的值。
语法: string uniqid(string prefix);
返回值: 字符串
函数种类: 编码处理
内容说明 
本函数会依据当时的毫秒以及指定的前置字符串产生一个独一无二的字符串。参数 prefix 为前置的字符串,最多可达 114 字符。

echo uniqid();可以看到uniqid始终是一个不断变化的长度为13的十六进制数。
<?php
echo hexdec(uniqid())/(time()+microtime()); 
?>
输出基本上在1048576左右。
可以断定,uniqid就是当前时间精确到微秒再乘以1048576(2的20次幂)最后转换为十六进制得到的。

 

1 Comment more...

typo3 feuser md5

  1. if (TYPO3_MODE == ‘BE’) {
    $TCA[‘fe_users’][‘columns’][‘password’][‘config’][‘eval’] = ‘md5,nospace,required,password’;
    }
  2. class.t3lib_userauth.php  1189行 $loginData[‘uident’] = md5($loginData[‘uident_text’]);

typo3用户自动登录

Typo3 4,5,6

$loginData = array(
'uname' => $user['username'], //usernmae
'uident' => $user['password'], //password (加密后)
'status' => 'login'
);
$GLOBALS['TSFE']->fe_user->checkPid=0; //do not use a particular pid
$info= $GLOBALS['TSFE']->fe_user->getAuthInfoArray();
$user2=$GLOBALS['TSFE']->fe_user->fetchUserRecord($info['db_user'],$loginData['uname']);
//print_r($user2);
$ok=$GLOBALS['TSFE']->fe_user->compareUident($user2,$loginData);
if($ok) {
//login successfull
$GLOBALS['TSFE']->fe_user->createUserSession($user2);
$GLOBALS["TSFE"]->fe_user->loginSessionStarted = TRUE;
$GLOBALS["TSFE"]->fe_user->user = $GLOBALS["TSFE"]->fe_user->fetchUserSession();
}

Typo3 7

$GLOBALS['TSFE']->fe_user->createUserSession($userinfo);
$GLOBALS['TSFE']->fe_user->setAndSaveSessionData('login', 'success');
1 Comment more...

CSV export length

CSV field’s value will be cut to 100 length. It’s fixed in /typo3/class.db.list.extra.inc, line 732, so you can write a XCLASS to change it. good luck!

1 Comment more...

phpExcel常用方法详解

操作excel

1.header

header(“Content-Type:application/vnd.ms-excel”);
header(“Content-Disposition:attachment;filename=product.xls”);
header(“Pragma:no-cache”);
header(“Expires:0”); (continue reading…)


Record tree for TCA

Extension Key: cps_tcatree required plugin: Developer library ( cps_devlib )

Installation / Quick start

Changes in ext_tables.php

For each table you want to display as a tree you have to define a new key “treeParentField” which defines the field in which the relation is stored. This field can be either a comma separated list of uids or a mm-relation field.
(continue reading…)


Fluid User Manual

This chapter describes all things the users of the templating system needs to know. After you’ve read the introduction, you can dive into the concepts of Fluid which are relevant to you.

The chapter starts with an overview of basic concepts, continues with using layouts, and finishes with how to write your own view helpers. (continue reading…)


FLUIDTEMPLATE Content Object

With TYPO3 v4.5 the TypoScript Content Object FLUIDTEMPLATE is available.
It works similar to the regular TEMPLATE cObject but instead of the marker and subpart based templates it expects a Fluid style templates.

Note: Currently the extensions Fluid and Extbase have to be installed for this Content Object to work. (continue reading…)


Extbase/Fluid features and improvements

With TYPO3 4.5 LTS, a new version of Extbase and Fluid is shipped, which contains several major features like Dependency Injection and Fluid Widgets. This article gives an overview about the improvements in Extbase and Fluid, with links to more detailed information. (continue reading…)

1 Comment more...

Prepared queries are the way to go!

Prepared queries are now part of the TYPO3 database API. The API is mostly based on PDO’s method naming and currently supports SELECT queries. Read on to learn how to take advantage of this enhanced API for your own extensions. (continue reading…)


Copyright © 1996-2010 Add Lives. All rights reserved.
iDream theme by Templates Next | Powered by WordPress