<?php
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2011 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
private $do_sql;
private $index;
- private $data = array();
+ protected $data = array();
private $user_functions = array();
private $field_desc = array();
return true;
}
- private function getValue($line, $key, $action)
+ static public function getValue($line, $key, $action, $relation = null)
{
if (@array_key_exists($action, $line)) {
$value = $line[$action];
} elseif (is_callable($action, false)) {
- $value = call_user_func($action, $line, $key);
+ $value = call_user_func($action, $line, $key, $relation);
} else {
$value = $action;
}
return $value;
}
- private function makeAssoc($line, $relation)
+ protected function makeAssoc($line, $relation)
{
$ops = array();
foreach ($relation as $key=>$ref) {
- $ops[$key] = $this->getValue($line, $key, $ref);
+ $ops[$key] = $this->getValue($line, $key, $ref, $relation);
}
return $ops;
}
{
$ops = array();
foreach ($relation as $key=>$ref) {
- $value = $this->getValue($line, $key, $ref);
+ $value = $this->getValue($line, $key, $ref, $relation);
if (!is_null($value) && $value != 'NULL') {
$value = "'" . addslashes($value) . "'";
}
}
/** Handle insertion form
- * @param $page PlatalPage to process
+ * @param $page PlPage to process
* @param $url URI of the page
* @param $field Editable fields
*/
- public function apply(&$page, $url, $fields = null)
+ public function apply($page, $url, $fields = null)
{
$sesfields = array('csv_value', 'csv_user_value', 'csv_cond_field',
'csv_update', 'csv_action', 'csv_cond_field',
$fields[] = $key;
}
if ($current == 'valid' && Env::has('csv_valid')) {
+ S::assert_xsrf_token();
$this->run($_SESSION['csv_action'], $insert, $update);
$page->assign('csv_done', true);
$this->cleanSession($sesfields);
}
}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
?>