forked from Wavyzz/dolibarr
Qual: File is not a class of a module
This commit is contained in:
@@ -1051,7 +1051,7 @@ class FormFile
|
|||||||
global $bc;
|
global $bc;
|
||||||
global $sortfield, $sortorder;
|
global $sortfield, $sortorder;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
|
||||||
$link = new Link($this->db);
|
$link = new Link($this->db);
|
||||||
$links = array();
|
$links = array();
|
||||||
if ($sortfield == "name") {
|
if ($sortfield == "name") {
|
||||||
@@ -1066,9 +1066,9 @@ class FormFile
|
|||||||
|
|
||||||
// Show list of associated links
|
// Show list of associated links
|
||||||
print_titre($langs->trans("LinkedFiles"));
|
print_titre($langs->trans("LinkedFiles"));
|
||||||
|
|
||||||
print '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">';
|
print '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">';
|
||||||
|
|
||||||
print '<table width="100%" class="liste">';
|
print '<table width="100%" class="liste">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre(
|
print_liste_field_titre(
|
||||||
@@ -1113,12 +1113,12 @@ class FormFile
|
|||||||
if ($nboflinks > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
if ($nboflinks > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
foreach ($links as $link)
|
foreach ($links as $link)
|
||||||
{
|
{
|
||||||
$var =! $var;
|
$var =! $var;
|
||||||
print '<tr ' . $bc[$var] . '>';
|
print '<tr ' . $bc[$var] . '>';
|
||||||
//edit mode
|
//edit mode
|
||||||
if ($action == 'update' && $selected === $link->id)
|
if ($action == 'update' && $selected === $link->id)
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||||
@@ -1157,7 +1157,7 @@ class FormFile
|
|||||||
}
|
}
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
if ($nboflinks == 0)
|
if ($nboflinks == 0)
|
||||||
{
|
{
|
||||||
print '<tr ' . $bc[$var] . '><td colspan="4">';
|
print '<tr ' . $bc[$var] . '><td colspan="4">';
|
||||||
print $langs->trans("NoLinkFound");
|
print $langs->trans("NoLinkFound");
|
||||||
@@ -1166,7 +1166,7 @@ class FormFile
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
return $nboflinks;
|
return $nboflinks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/link/class/link.class.php
|
* \file htdocs/core/class/link.class.php
|
||||||
* \ingroup link
|
* \ingroup link
|
||||||
* \brief File for link class
|
* \brief File for link class
|
||||||
*/
|
*/
|
||||||
@@ -39,6 +39,7 @@ class Link extends CommonObject
|
|||||||
public $objecttype;
|
public $objecttype;
|
||||||
public $objectid;
|
public $objectid;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@@ -102,9 +103,9 @@ class Link extends CommonObject
|
|||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface=new Interfaces($this->db);
|
$interface=new Interfaces($this->db);
|
||||||
$result=$interface->run_triggers('LINK_CREATE', $this, $user, $langs, $conf);
|
$result=$interface->run_triggers('LINK_CREATE', $this, $user, $langs, $conf);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors = $interface->errors;
|
$this->errors = $interface->errors;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
} else {
|
} else {
|
||||||
@@ -161,12 +162,12 @@ class Link extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::Update id = " . $this->id . " call_trigger = " . $call_trigger);
|
dol_syslog(get_class($this)."::Update id = " . $this->id . " call_trigger = " . $call_trigger);
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($this->url))
|
if (empty($this->url))
|
||||||
{
|
{
|
||||||
$this->error = $langs->trans("NoURL");
|
$this->error = $langs->trans("NoURL");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->url = clean_url($this->url,1);
|
$this->url = clean_url($this->url,1);
|
||||||
if (empty($this->label)) $this->label = basename($this->url);
|
if (empty($this->label)) $this->label = basename($this->url);
|
||||||
@@ -176,7 +177,7 @@ class Link extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "links SET ";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "links SET ";
|
||||||
$sql .= "entity = '" . $conf->entity ."'";
|
$sql .= "entity = '" . $conf->entity ."'";
|
||||||
$sql .= ", datea = '" . $this->db->idate(dol_now()) . "'";
|
$sql .= ", datea = '" . $this->db->idate(dol_now()) . "'";
|
||||||
$sql .= ", url = '" . $this->db->escape($this->url) . "'";
|
$sql .= ", url = '" . $this->db->escape($this->url) . "'";
|
||||||
$sql .= ", label = '" . $this->db->escape($this->label) . "'";
|
$sql .= ", label = '" . $this->db->escape($this->label) . "'";
|
||||||
@@ -184,25 +185,24 @@ class Link extends CommonObject
|
|||||||
$sql .= ", objectid = " . $this->objectid;
|
$sql .= ", objectid = " . $this->objectid;
|
||||||
$sql .= " WHERE rowid = '" . $this->id ."'";
|
$sql .= " WHERE rowid = '" . $this->id ."'";
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::update sql = " .$sql);
|
||||||
dol_syslog(get_class($this)."::Update sql = " .$sql);
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if ($call_trigger)
|
if ($call_trigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface = new Interfaces($this->db);
|
$interface = new Interfaces($this->db);
|
||||||
$result = $interface->run_triggers('LINK_MODIFY', $this, $user, $langs, $conf);
|
$result = $interface->run_triggers('LINK_MODIFY', $this, $user, $langs, $conf);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors = $interface->errors;
|
$this->errors = $interface->errors;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this) . "::Update success");
|
dol_syslog(get_class($this) . "::Update success");
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@@ -211,16 +211,16 @@ class Link extends CommonObject
|
|||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
{
|
{
|
||||||
// Doublon
|
// Doublon
|
||||||
$this->error = $langs->trans("ErrorDuplicateField");
|
$this->error = $langs->trans("ErrorDuplicateField");
|
||||||
$result = -1;
|
$result = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error = $langs->trans("Error sql = " . $sql);
|
$this->error = $langs->trans("Error sql = " . $sql);
|
||||||
dol_syslog(get_class($this) . "::Update fails update = " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::Update fails update = " . $this->error, LOG_ERR);
|
||||||
@@ -233,34 +233,39 @@ class Link extends CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads all links from database
|
* Loads all links from database
|
||||||
*
|
*
|
||||||
* @param array &$links array of Link objects to fill
|
* @param array &$links array of Link objects to fill
|
||||||
* @param string $objecttype type of the associated object in dolibarr
|
* @param string $objecttype type of the associated object in dolibarr
|
||||||
* @param int $objectid id of the associated object in dolibarr
|
* @param int $objectid id of the associated object in dolibarr
|
||||||
* @param string $sortfield field used to sort
|
* @param string $sortfield field used to sort
|
||||||
* @param string $sortorder sort order
|
* @param string $sortorder sort order
|
||||||
* @return 1 if ok, 0 if no records, -1 if error
|
* @return 1 if ok, 0 if no records, -1 if error
|
||||||
*
|
*
|
||||||
* */
|
* */
|
||||||
public function fetchAll(&$links, $objecttype, $objectid, $sortfield=null, $sortorder=null)
|
public function fetchAll(&$links, $objecttype, $objectid, $sortfield=null, $sortorder=null)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT rowid, entity, datea, url, label , objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
|
$sql = "SELECT rowid, entity, datea, url, label , objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
|
||||||
$sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid;
|
$sql .= " WHERE objecttype = '" . $objecttype . "' AND objectid = " . $objectid;
|
||||||
if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
|
if ($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
|
||||||
if ($sortfield) {
|
if ($sortfield) {
|
||||||
if (empty($sortorder)) {
|
if (empty($sortorder)) {
|
||||||
$sortorder = "ASC";
|
$sortorder = "ASC";
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY " . $sortfield . " " . $sortorder;
|
$sql .= " ORDER BY " . $sortfield . " " . $sortorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::fetchAll sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
dol_syslog(get_class($this)."::fetchAll " . $sql, LOG_DEBUG);
|
if ($resql)
|
||||||
if ($resql) {
|
{
|
||||||
$num = $this->db->num_rows($resql);
|
$num = $this->db->num_rows($resql);
|
||||||
dol_syslog(get_class($this)."::fetchAll " . $num . "records", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetchAll " . $num . "records", LOG_DEBUG);
|
||||||
if ($num > 0) {
|
if ($num > 0)
|
||||||
while ($obj = $this->db->fetch_object($resql)) {
|
{
|
||||||
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
|
{
|
||||||
$link = new Link($db);
|
$link = new Link($db);
|
||||||
$link->id = $obj->rowid;
|
$link->id = $obj->rowid;
|
||||||
$link->entity = $obj->entity;
|
$link->entity = $obj->entity;
|
||||||
@@ -281,25 +286,31 @@ class Link extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Loads a link from database
|
* Loads a link from database
|
||||||
* @param rowid id of link to load
|
*
|
||||||
* @return int 1 if ok, 0 if no record found, -1 if error
|
* @param int $rowid Id of link to load
|
||||||
*
|
* @return int 1 if ok, 0 if no record found, -1 if error
|
||||||
* */
|
*
|
||||||
|
**/
|
||||||
public function fetch($rowid=null)
|
public function fetch($rowid=null)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if (empty($rowid)) {
|
if (empty($rowid)) {
|
||||||
$rowid = $this->id;
|
$rowid = $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
|
$sql = "SELECT rowid, entity, datea, url, label, objecttype, objectid FROM " . MAIN_DB_PREFIX . "links";
|
||||||
$sql .= " WHERE rowid = " . $rowid;
|
$sql .= " WHERE rowid = " . $rowid;
|
||||||
if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
|
if($conf->entity != 0) $sql .= " AND entity = " . $conf->entity;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
dol_syslog(get_class($this)."::fetch " . $sql, LOG_DEBUG);
|
if ($resql)
|
||||||
if ($resql) {
|
{
|
||||||
if($this->db->num_rows($resql) > 0) {
|
if($this->db->num_rows($resql) > 0)
|
||||||
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
$this->entity = $obj->entity;
|
$this->entity = $obj->entity;
|
||||||
$this->datea = $this->db->jdate($obj->datea);
|
$this->datea = $this->db->jdate($obj->datea);
|
||||||
@@ -308,14 +319,14 @@ class Link extends CommonObject
|
|||||||
$this->objecttype = $obj->objecttype;
|
$this->objecttype = $obj->objecttype;
|
||||||
$this->objectid = $obj->objectid;
|
$this->objectid = $obj->objectid;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
}
|
||||||
$this->error = 'Fetch no link found for id = ' . $rowid;
|
else
|
||||||
dol_syslog($this->error, LOG_ERR);
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_syslog($this->db->error(), LOG_ERR);
|
$this->error=$this->db->lasterror();
|
||||||
$this->error=$this->db->error();
|
dol_syslog($this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -335,11 +346,12 @@ class Link extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Remove link
|
// Remove link
|
||||||
|
|
||||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "links";
|
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "links";
|
||||||
$sql.= " WHERE rowid = " . $this->id;
|
$sql.= " WHERE rowid = " . $this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete sql=" . $sql, LOG_DEBUG);
|
||||||
if (! $this->db->query($sql)) {
|
if (! $this->db->query($sql))
|
||||||
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
dol_syslog(get_class($this)."::delete error -4 " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::delete error -4 " . $this->error, LOG_ERR);
|
||||||
@@ -351,9 +363,9 @@ class Link extends CommonObject
|
|||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$interface=new Interfaces($this->db);
|
$interface=new Interfaces($this->db);
|
||||||
$result = $interface->run_triggers('LINK_DELETE', $this, $user, $langs, $conf);
|
$result = $interface->run_triggers('LINK_DELETE', $this, $user, $langs, $conf);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors = $interface->errors;
|
$this->errors = $interface->errors;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
}
|
}
|
||||||
@@ -1011,12 +1011,12 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
|||||||
// Define $destpath (path to file including filename) and $destfile (only filename)
|
// Define $destpath (path to file including filename) and $destfile (only filename)
|
||||||
$destpath=$upload_dir . "/" . $_FILES[$varfiles]['name'];
|
$destpath=$upload_dir . "/" . $_FILES[$varfiles]['name'];
|
||||||
$destfile=$_FILES[$varfiles]['name'];
|
$destfile=$_FILES[$varfiles]['name'];
|
||||||
if ($savingdocmask)
|
if ($savingdocmask)
|
||||||
{
|
{
|
||||||
$destpath=$upload_dir . "/" . preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
|
$destpath=$upload_dir . "/" . preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
|
||||||
$destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
|
$destfile=preg_replace('/__file__/',$_FILES[$varfiles]['name'],$savingdocmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
$resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles);
|
$resupload = dol_move_uploaded_file($_FILES[$varfiles]['tmp_name'], $destpath, $allowoverwrite, 0, $_FILES[$varfiles]['error'], 0, $varfiles);
|
||||||
if (is_numeric($resupload) && $resupload > 0)
|
if (is_numeric($resupload) && $resupload > 0)
|
||||||
{
|
{
|
||||||
@@ -1058,7 +1058,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
|||||||
}
|
}
|
||||||
} elseif ($link) {
|
} elseif ($link) {
|
||||||
if (dol_mkdir($upload_dir) >= 0) {
|
if (dol_mkdir($upload_dir) >= 0) {
|
||||||
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
|
||||||
$linkObject = new Link($db);
|
$linkObject = new Link($db);
|
||||||
$linkObject->entity = $conf->entity;
|
$linkObject->entity = $conf->entity;
|
||||||
$linkObject->url = $link;
|
$linkObject->url = $link;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
|
|||||||
} elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
|
} elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||||
if ($object->id) {
|
if ($object->id) {
|
||||||
$link = GETPOST('link', 'alpha');
|
$link = GETPOST('link', 'alpha');
|
||||||
if ($link)
|
if ($link)
|
||||||
{
|
{
|
||||||
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') {
|
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') {
|
||||||
$link = 'http://' . $link;
|
$link = 'http://' . $link;
|
||||||
@@ -37,13 +37,13 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
|
|||||||
|
|
||||||
|
|
||||||
// Delete file/link
|
// Delete file/link
|
||||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
if ($object->id)
|
if ($object->id)
|
||||||
{
|
{
|
||||||
$urlfile = GETPOST('urlfile', 'alpha');
|
$urlfile = GETPOST('urlfile', 'alpha');
|
||||||
$linkid = GETPOST('linkid', 'int');
|
$linkid = GETPOST('linkid', 'int');
|
||||||
if ($urlfile)
|
if ($urlfile)
|
||||||
{
|
{
|
||||||
$file = $upload_dir . "/" . $urlfile; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
$file = $upload_dir . "/" . $urlfile; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||||
|
|
||||||
@@ -53,10 +53,10 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
|||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors');
|
setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($linkid)
|
elseif ($linkid)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
|
||||||
$link = new Link($db);
|
$link = new Link($db);
|
||||||
$link->id = $linkid;
|
$link->id = $linkid;
|
||||||
$link->fetch();
|
$link->fetch();
|
||||||
@@ -71,29 +71,29 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
|||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
|
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha'))
|
elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha'))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/link/class/link.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
|
||||||
$langs->load('link');
|
$langs->load('link');
|
||||||
$link = new Link($db);
|
$link = new Link($db);
|
||||||
$link->id = GETPOST('linkid', 'int');
|
$link->id = GETPOST('linkid', 'int');
|
||||||
$f = $link->fetch();
|
$f = $link->fetch();
|
||||||
if ($f)
|
if ($f)
|
||||||
{
|
{
|
||||||
$link->url = GETPOST('link', 'alpha');
|
$link->url = GETPOST('link', 'alpha');
|
||||||
if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://')
|
if (substr($link->url, 0, 7) != 'http://' && substr($link->url, 0, 8) != 'https://')
|
||||||
{
|
{
|
||||||
$link->url = 'http://' . $link->url;
|
$link->url = 'http://' . $link->url;
|
||||||
}
|
}
|
||||||
$link->label = GETPOST('label', 'alpha');
|
$link->label = GETPOST('label', 'alpha');
|
||||||
$res = $link->update($user);
|
$res = $link->update($user);
|
||||||
if (!$res)
|
if (!$res)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("ErrorFailedToUpdateLink", $link->label));
|
setEventMessage($langs->trans("ErrorFailedToUpdateLink", $link->label));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//error fetching
|
//error fetching
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user