} else { setEventMessage($langs->trans("Error"), 'errors'); } } } /* * View */ $form = new Form($db); $title = $langs->trans('ModulesSystemTools'); llxHeader('', $title); print_fiche_titre($title, '', 'setup'); print $langs->trans("ProductVatMassChangeDesc") . '<br><br>'; if (empty($mysoc->country_code)) { $langs->load("errors"); $warnpicto = img_error($langs->trans("WarningMandatorySetupNotComplete")); print '<br><a href="' . DOL_URL_ROOT . '/admin/company.php?mainmenu=home">' . $warnpicto . ' ' . $langs->trans("WarningMandatorySetupNotComplete") . '</a>'; } else { $var = true; print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '" />'; print '<input type="hidden" name="action" value="convert" />'; print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; print '<td>' . $langs->trans("Parameters") . '</td>' . "\n"; print '<td align="right" width="60">' . $langs->trans("Value") . '</td>' . "\n"; print '</tr>' . "\n"; $var = !$var; print '<tr ' . $bc[$var] . '>' . "\n"; print '<td>' . $langs->trans("OldVATRates") . '</td>' . "\n"; print '<td width="60" align="right">' . "\n";
/** * Renvoi le libelle d'un statut donne * * @param int $statut Id statut * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ public static function libStatutDest($statut, $mode = 0) { global $langs; $langs->load('mails'); if ($mode == 0) { return $langs->trans($this->statut_dest[$statut]); } if ($mode == 1) { return $langs->trans($this->statut_dest[$statut]); } if ($mode == 2) { if ($statut == -1) { return $langs->trans("MailingStatusError") . ' ' . img_error(); } if ($statut == 1) { return $langs->trans("MailingStatusSent") . ' ' . img_picto($langs->trans("MailingStatusSent"), 'statut4'); } if ($statut == 2) { return $langs->trans("MailingStatusRead") . ' ' . img_picto($langs->trans("MailingStatusRead"), 'statut6'); } if ($statut == 3) { return $langs->trans("MailingStatusNotContact") . ' ' . img_picto($langs->trans("MailingStatusNotContact"), 'statut8'); } } if ($mode == 3) { if ($statut == -1) { return $langs->trans("MailingStatusError") . ' ' . img_error(); } if ($statut == 1) { return $langs->trans("MailingStatusSent") . ' ' . img_picto($langs->trans("MailingStatusSent"), 'statut4'); } if ($statut == 2) { return $langs->trans("MailingStatusRead") . ' ' . img_picto($langs->trans("MailingStatusRead"), 'statut6'); } if ($statut == 3) { return $langs->trans("MailingStatusNotContact") . ' ' . img_picto($langs->trans("MailingStatusNotContact"), 'statut8'); } } if ($mode == 4) { if ($statut == -1) { return $langs->trans("MailingStatusError") . ' ' . img_error(); } if ($statut == 1) { return $langs->trans("MailingStatusSent") . ' ' . img_picto($langs->trans("MailingStatusSent"), 'statut4'); } if ($statut == 2) { return $langs->trans("MailingStatusRead") . ' ' . img_picto($langs->trans("MailingStatusRead"), 'statut6'); } if ($statut == 3) { return $langs->trans("MailingStatusNotContact") . ' ' . img_picto($langs->trans("MailingStatusNotContact"), 'statut8'); } } if ($mode == 5) { if ($statut == -1) { return $langs->trans("MailingStatusError") . ' ' . img_error(); } if ($statut == 1) { return $langs->trans("MailingStatusSent") . ' ' . img_picto($langs->trans("MailingStatusSent"), 'statut4'); } if ($statut == 2) { return $langs->trans("MailingStatusRead") . ' ' . img_picto($langs->trans("MailingStatusRead"), 'statut6'); } if ($statut == 3) { return $langs->trans("MailingStatusNotContact") . ' ' . img_picto($langs->trans("MailingStatusNotContact"), 'statut8'); } } }
print '<td>'; if (empty($obj->picto)) { $obj->picto = 'generic'; } print img_object($langs->trans("Module") . ': ' . get_class($obj), $obj->picto) . ' ' . $obj->getDesc(); print '</td>'; try { $nbofrecipient = $obj->getNbOfRecipients(''); } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } print '<td align="center">'; if ($nbofrecipient >= 0) { print $nbofrecipient; } else { print $langs->trans("Error") . ' ' . img_error($obj->error); } print '</td>'; print '<td align="left">'; try { $filter = $obj->formFilter(); } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } if ($filter) { print $filter; } else { print $langs->trans("None"); } print '</td>'; print '<td align="right">';
print $form->select_date($db->jdate($task_time->task_date), 'timeline', '', '', '', "timespent_date"); } else { print dol_print_date($db->jdate($task_time->task_date), 'day'); } print '</td>'; // User print '<td>'; if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) { $contactsoftask = $object->getListContactId('internal'); if (!in_array($task_time->fk_user, $contactsoftask)) { $contactsoftask[] = $task_time->fk_user; } if (count($contactsoftask) > 0) { print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask); } else { print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . $langs->trans('FirstAddRessourceToAllocateTime'); } } else { $userstatic->id = $task_time->fk_user; $userstatic->lastname = $task_time->lastname; $userstatic->firstname = $task_time->firstname; print $userstatic->getNomUrl(1); } print '</td>'; // Note print '<td align="left">'; if ($_GET['action'] == 'editline' && $_GET['lineid'] == $task_time->rowid) { print '<textarea name="timespent_note_line" cols="80" rows="' . ROWS_2 . '">' . $task_time->note . '</textarea>'; } else { print dol_nl2br($task_time->note); }
$obj->import_close_file(); } else { print $langs->trans("ErrorFailedToOpenFile", $pathfile); } $db->rollback(); // We force rollback because this was just a simulation. // Show OK if (!count($arrayoferrors) && !count($arrayofwarnings)) { print img_picto($langs->trans("OK"), 'tick') . ' <b>' . $langs->trans("NoError") . '</b><br><br>'; } else { print $langs->trans("NbOfLinesOK", $nbok) . '</b><br><br>'; } // Show Errors //var_dump($arrayoferrors); if (count($arrayoferrors)) { print img_error() . ' <b>' . $langs->trans("ErrorsOnXLines", count($arrayoferrors)) . '</b><br>'; print '<table width="100%" class="border"><tr><td>'; foreach ($arrayoferrors as $key => $val) { $nboferrors++; if ($nboferrors > $maxnboferrors) { print $langs->trans("TooMuchErrors", count($arrayoferrors) - $nboferrors) . "<br>"; break; } print '* ' . $langs->trans("Line") . ' ' . $key . '<br>'; foreach ($val as $i => $err) { print ' > ' . $err['lib'] . '<br>'; } } print '</td></tr></table>'; print '<br>'; }
/** * Load data into info_box_contents array to show array later. * * @param int $max Maximum number of records to load * @param int $cachedelay Delay we accept for cache file * @return void */ function loadBox($max = 5, $cachedelay = 3600) { global $user, $langs, $conf; $langs->load("boxes"); $this->max = $max; // On recupere numero de param de la boite preg_match('/^([0-9]+) /', $this->paramdef, $reg); $site = $reg[1]; // Create dir nor required // documents/externalrss is created by module activation // documents/externalrss/tmp is created by rssparser // Get RSS feed $url = @constant("EXTERNAL_RSS_URLRSS_" . $site); $rssparser = new RssParser($this->db); $result = $rssparser->parser($url, $this->max, $cachedelay, $conf->externalrss->dir_temp); // INFO on channel $description = $rssparser->getDescription(); $link = $rssparser->getLink(); $title = $langs->trans("BoxTitleLastRssInfos", $max, @constant("EXTERNAL_RSS_TITLE_" . $site)); if ($result < 0 || !empty($rssparser->error)) { // Show warning $title .= " " . img_error($langs->trans("FailedToRefreshDataInfoNotUpToDate", $rssparser->getLastFetchDate() ? dol_print_date($rssparser->getLastFetchDate(), "dayhourtext") : $langs->trans("Unknown"))); $this->info_box_head = array('text' => $title, 'limit' => 0); } else { $this->info_box_head = array('text' => $title, 'sublink' => $link, 'subtext' => $langs->trans("LastRefreshDate") . ': ' . ($rssparser->getLastFetchDate() ? dol_print_date($rssparser->getLastFetchDate(), "dayhourtext") : $langs->trans("Unknown")), 'subpicto' => 'object_bookmark'); } // INFO on items $items = $rssparser->getItems(); //print '<pre>'.print_r($items,true).'</pre>'; $nbitems = count($items); for ($line = 0; $line < $max && $line < $nbitems; $line++) { $item = $items[$line]; // Feed common fields $href = $item['link']; $title = urldecode($item['title']); $date = $item['date_timestamp']; // date will be empty if conversion into timestamp failed if ($rssparser->getFormat() == 'rss') { if (!$date && isset($item['pubdate'])) { $date = $item['pubdate']; } if (!$date && isset($item['dc']['date'])) { $date = $item['dc']['date']; } //$item['dc']['language'] //$item['dc']['publisher'] } if ($rssparser->getFormat() == 'atom') { if (!$date && isset($item['issued'])) { $date = $item['issued']; } if (!$date && isset($item['modified'])) { $date = $item['modified']; } //$item['issued'] //$item['modified'] //$item['atom_content'] } if (is_numeric($date)) { $date = dol_print_date($date, "dayhour"); } $isutf8 = utf8_check($title); if (!$isutf8 && $conf->file->character_set_client == 'UTF-8') { $title = utf8_encode($title); } elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') { $title = utf8_decode($title); } $title = preg_replace("/([[:alnum:]])\\?([[:alnum:]])/", "\\1'\\2", $title); // Gere probleme des apostrophes mal codee/decodee par utf8 $title = preg_replace("/^\\s+/", "", $title); // Supprime espaces de debut $this->info_box_contents["{$href}"] = "{$title}"; $tooltip = $title; $description = !empty($item['description']) ? $item['description'] : ''; $isutf8 = utf8_check($description); if (!$isutf8 && $conf->file->character_set_client == 'UTF-8') { $description = utf8_encode($description); } elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') { $description = utf8_decode($description); } $description = preg_replace("/([[:alnum:]])\\?([[:alnum:]])/", "\\1'\\2", $description); $description = preg_replace("/^\\s+/", "", $description); $description = str_replace("\r\n", "", $description); $tooltip .= '<br>' . $description; $this->info_box_contents[$line][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => $href, 'tooltip' => $tooltip, 'target' => 'newrss'); $this->info_box_contents[$line][1] = array('td' => 'align="left"', 'text' => $title, 'url' => $href, 'tooltip' => $tooltip, 'maxlength' => 64, 'target' => 'newrss'); $this->info_box_contents[$line][2] = array('td' => 'align="right" nowrap="1"', 'text' => $date); } }
print $html->textwithpicto($nbemail,$text,1,'warning'); } else { print $nbemail; } print '</td>'; } // Last send print '<td align="center" nowrap="nowrap">'.dol_print_date($db->jdate($obj->date_envoi),'day').'</td>'; print '</td>'; // Status print '<td align="right" nowrap="nowrap">'; if ($filteremail) { if ($obj->sendstatut==-1) print $langs->trans("MailingStatusError").' '.img_error(); if ($obj->sendstatut==1) print $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); } else { print $email->LibStatut($obj->statut,5); } print '</td>'; print "</tr>\n"; $i++; } print "</table>"; $db->free($result); } else {
if ($obj->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) { $text = $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); print $form->textwithpicto($nbemail, $text, 1, 'warning'); } else { print $nbemail; } print '</td>'; } // Last send print '<td align="center" class="nowrap">' . dol_print_date($db->jdate($obj->date_envoi), 'day') . '</td>'; print '</td>'; // Status print '<td align="right" class="nowrap">'; if ($filteremail) { if ($obj->sendstatut == -1) { print $langs->trans("MailingStatusError") . ' ' . img_error(); } if ($obj->sendstatut == 1) { print $langs->trans("MailingStatusSent") . ' ' . img_picto($langs->trans("MailingStatusSent"), 'statut6'); } } else { print $email->LibStatut($obj->statut, 5); } print '</td>'; print "</tr>\n"; $i++; } print "</table>"; $db->free($result); } else { dol_print_error($db);
/** * Charge les donnees en memoire pour affichage ulterieur * @param $max Nombre maximum d'enregistrements a charger */ function loadBox($max=5) { global $user, $langs, $conf; $langs->load("boxes"); $this->max=$max; // On recupere numero de param de la boite preg_match('/^([0-9]+) /',$this->param,$reg); $site=$reg[1]; // Creation rep (pas besoin, on le cree apres recup flux) // documents/rss is created by module activation // documents/rss/tmp is created by magpie //$result=create_exdir($conf->externalrss->dir_temp); // Recupere flux RSS definie dans EXTERNAL_RSS_URLRSS_$site $url=@constant("EXTERNAL_RSS_URLRSS_".$site); //define('MAGPIE_DEBUG',1); $rss=fetch_rss($url); if (! is_object($rss)) { dol_syslog("FETCH_RSS site=".$site); dol_syslog("FETCH_RSS url=".$url); return -1; } // INFO sur le channel $description=$rss->channel['tagline']; $link=$rss->channel['link']; $title=$langs->trans("BoxTitleLastRssInfos",$max, @constant("EXTERNAL_RSS_TITLE_". $site)); if ($rss->ERROR) { // Affiche warning car il y a eu une erreur $title.=" ".img_error($langs->trans("FailedToRefreshDataInfoNotUpToDate",(isset($rss->date)?dol_print_date($rss->date,"dayhourtext"):$langs->trans("Unknown")))); $this->info_box_head = array('text' => $title,'limit' => 0); } else { $this->info_box_head = array('text' => $title, 'sublink' => $link, 'subtext'=>$langs->trans("LastRefreshDate").': '.(isset($rss->date)?dol_print_date($rss->date,"dayhourtext"):$langs->trans("Unknown")), 'subpicto'=>'object_bookmark'); } // INFO sur le elements for($i = 0; $i < $max && $i < sizeof($rss->items); $i++) { $item = $rss->items[$i]; // Magpierss common fields $href = $item['link']; $title = urldecode($item['title']); $date = $item['date_timestamp']; // date will be empty if conversion into timestamp failed if ($rss->is_rss()) // If RSS { if (! $date && isset($item['pubdate'])) $date=$item['pubdate']; if (! $date && isset($item['dc']['date'])) $date=$item['dc']['date']; //$item['dc']['language'] //$item['dc']['publisher'] } if ($rss->is_atom()) // If Atom { if (! $date && isset($item['issued'])) $date=$item['issued']; if (! $date && isset($item['modified'])) $date=$item['modified']; //$item['issued'] //$item['modified'] //$item['atom_content'] } if (is_numeric($date)) $date=dol_print_date($date,"dayhour"); $isutf8 = utf8_check($title); if (! $isutf8 && $conf->file->character_set_client == 'UTF-8') $title=utf8_encode($title); elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') $title=utf8_decode($title); $title=preg_replace("/([[:alnum:]])\?([[:alnum:]])/","\\1'\\2",$title); // Gere probleme des apostrophes mal codee/decodee par utf8 $title=preg_replace("/^\s+/","",$title); // Supprime espaces de debut $this->info_box_contents["$href"]="$title"; $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => $this->boximg, 'url' => $href, 'target' => 'newrss'); $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $title, 'url' => $href, 'maxlength' => 64, 'target' => 'newrss'); $this->info_box_contents[$i][2] = array('td' => 'align="right" nowrap="1"', 'text' => $date); } }
$TypeName = $Type === 'avatar' ? 'avatar' : 'second avatar'; } elseif ($Type === 'donoricon') { $MaxFileSize = 64 * 1024; // 64 kB $MaxImageHeight = 100; // pixels $TypeName = 'donor icon'; } $Height = image_height($FileType, $Data); if (strlen($Data) > $MaxFileSize || $Height > $MaxImageHeight) { // Sometimes the cached image we have isn't the actual image if ($Cached) { $Data2 = @file_get_contents($URL, 0, stream_context_create(array('http' => array('timeout' => 15)))); } else { $Data2 = $Data; } if (strlen($Data2) > $MaxFileSize || image_height($FileType, $Data2) > $MaxImageHeight) { require_once SERVER_ROOT . '/classes/mysql.class.php'; require_once SERVER_ROOT . '/classes/time.class.php'; $DBURL = db_string($URL); $AdminComment = ucfirst($TypeName) . " reset automatically (Size: " . number_format(strlen($Data) / 1024) . " kB, Height: " . $Height . "px). Used to be {$DBURL}"; $PrivMessage = SITE_NAME . " has the following requirements for {$TypeName}s:\n\n" . "[b]" . ucfirst($TypeName) . "s must not exceed " . $MaxFileSize / 1024 . " kB or be vertically longer than {$MaxImageHeight}px.[/b]\n\n" . "Your {$TypeName} at {$DBURL} has been found to exceed these rules. As such, it has been automatically reset. You are welcome to reinstate your {$TypeName} once it has been resized down to an acceptable size."; reset_image($UserID, $Type, $AdminComment, $PrivMessage); } } } if (!isset($FileType)) { img_error('timeout'); } header("Content-type: image/{$FileType}"); echo $Data;