Ejemplo n.º 1
0
 public static function importData($tablePrefix)
 {
     $errors = array();
     $sqlFile = self::ipFile('Plugin/Install/sql/data.sql');
     $fh = fopen($sqlFile, 'r');
     $sql = fread($fh, utf8_decode(filesize($sqlFile)));
     fclose($fh);
     $sql = str_replace("INSERT INTO `ip_", "INSERT INTO `" . $tablePrefix, $sql);
     $sql = str_replace("[[[[version]]]]", ipApplication()->getVersion(), $sql);
     $sql = str_replace("[[[[dbversion]]]]", \Ip\Internal\Update\Model::getDbVersion(), $sql);
     $sql = str_replace("[[[[time]]]]", date('Y-m-d H:i:s'), $sql);
     $sql = str_replace("[[[[timestamp]]]]", time(), $sql);
     ipDb()->execute($sql);
     return $errors;
 }
Ejemplo n.º 2
0
/**
 * Get security token string. Used to prevent XSRF attacks.
 *
 * Security token is a long random string generated for currently browsing user.
 * @return string Security token string.
 */
function ipSecurityToken()
{
    return ipApplication()->getSecurityToken();
}