示例#1
0
 public function lista5()
 {
     $codi = $_SESSION['codi'];
     $cnx = new util();
     $cn = $cnx->getConexion();
     $res = $cn->prepare("call detinvestiga(:codi)");
     $res->bindParam(":codi", $codi);
     $res->execute();
     foreach ($res as $row) {
         $lista5[] = $row;
     }
     return $lista5;
 }
示例#2
0
 public function InserNos($cuer)
 {
     /*PARA INSERTAR LOS PRODUCTOS*/
     $cnx = new util();
     $cn = $cnx->getConexion();
     /*(:titu, :cuer)*/
     $res = $cn->prepare("call editaNos(:cuer)");
     /*AQUI ESTOY LLAMANDO AL PROCEDIMIENTO: INSERTAR PRODUCTOS, ENVIANDO DE PARAMETROS TITU Y CUER*/
     /*$res->bindParam(":titu", $tit);*/
     /*insertMis*/
     $res->bindParam(":cuer", $cuer);
     $res->execute();
 }
示例#3
0
 public function executeContact(sfWebRequest $request)
 {
     $this->checkUser();
     $vanity = $request->getParameter('username');
     $this->f = $request->getParameter('f');
     $c = new Criteria();
     $c->add(SfGuardUserProfilePeer::VANITY, $vanity, Criteria::EQUAL);
     $userProfile = SfGuardUserProfilePeer::doSelectOne($c);
     $this->forward404Unless($userProfile);
     $this->user = $userProfile->getsfGuardUser();
     $this->form = new UserContactForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('contact'));
         if ($this->form->isValid()) {
             if ($this->user->getProfile()->getMailsContacto() == 1) {
                 $codigo = util::generateUID();
                 $this->user->getProfile()->setCodigo($codigo);
                 $this->user->getProfile()->save();
                 $mailBody = $this->getPartial('contactMailBody', array('destinatario' => $this->user->getProfile()->getNombre(), 'remitente' => $this->getUser()->getProfile()->getNombre(), 'cuerpo' => $this->form->getValue('mensaje'), 'vanity' => $this->getUser()->getProfile()->getVanity(), 'codigo' => $codigo));
                 try {
                     VoMail::sendWithRet("Tienes un mensaje de " . $this->getUser()->getProfile()->getNombre() . "", $mailBody, $this->user->getUsername(), array('*****@*****.**' => 'no-reply Voota'), $this->getUser()->getUsername(), true);
                     return "SendSuccess";
                 } catch (Exception $e) {
                     return "SendFail";
                 }
             } else {
                 return "SendFail";
             }
         }
         return "SendSuccess";
     }
 }
 /**
  * Create new instance of handler.
  */
 public function __construct()
 {
     global $CFG;
     if (empty($CFG->session_memcached_save_path)) {
         $this->savepath = '';
     } else {
         $this->savepath = $CFG->session_memcached_save_path;
     }
     if (empty($this->savepath)) {
         $this->servers = array();
     } else {
         $this->servers = util::connection_string_to_memcache_servers($this->savepath);
     }
     if (empty($CFG->session_memcached_prefix)) {
         $this->prefix = ini_get('memcached.sess_prefix');
     } else {
         $this->prefix = $CFG->session_memcached_prefix;
     }
     if (!empty($CFG->session_memcached_acquire_lock_timeout)) {
         $this->acquiretimeout = (int) $CFG->session_memcached_acquire_lock_timeout;
     }
     if (!empty($CFG->session_memcached_lock_expire)) {
         $this->lockexpire = (int) $CFG->session_memcached_lock_expire;
     }
 }
示例#5
0
 public static function run()
 {
     if (!isset($_SERVER['REDIRECT_URL'])) {
         throw new Exception();
     }
     $_SERVER['REDIRECT_URL'] = substr($_SERVER['REDIRECT_URL'], strlen(config::prefix()));
     $path = explode('/', $_SERVER['REDIRECT_URL']);
     //array_shift($path);
     if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
         req::$controller = array_shift($path);
         if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
             req::$function = array_shift($path);
         }
     }
     unset($path);
     session::get_instance()->start();
     if (uuid::check(req::$controller)) {
         $obj = state::load(req::$controller);
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         call_user_func(array($obj, req::$function));
     } else {
         $obj = eval('return new ' . req::$controller . '_ctrl();');
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         util::redirect($obj, req::$function, $_GET);
     }
 }
示例#6
0
文件: Command.php 项目: getkirby/cli
 protected function unzip($zip, $path)
 {
     // build the temporary folder path
     $tmp = $this->tmp(preg_replace('!.zip$!', '', $zip));
     // extract the zip file
     util::unzip($zip, $tmp);
     // get the list of directories within our tmp folder
     $dirs = glob($tmp . '/*');
     // get the source directory from the tmp folder
     if (isset($dirs[0]) && is_dir($dirs[0])) {
         $source = $dirs[0];
     } else {
         throw new RuntimeException('The source directory could not be found');
     }
     // create the folder if it does not exist yet
     if (!is_dir($path)) {
         mkdir($path);
     }
     // extract the content of the directory to the final path
     foreach ((array) array_diff(scandir($source), ['.', '..']) as $name) {
         if (!rename($source . '/' . $name, $path . '/' . $name)) {
             throw new RuntimeException($name . ' could not be copied');
         }
     }
     // remove the zip file
     util::remove($zip);
     // remove the temporary folder
     util::remove($tmp);
 }
示例#7
0
function wpgrade_callback_change_icon_params($params)
{
    //add new params in the right order
    $params = util::array_insert_after('size', $params, 'link', array('type' => 'text', 'name' => 'Link', 'options' => array(), 'admin_class' => 'span6'));
    $params = util::array_insert_after('link', $params, 'link_target_blank', array('type' => 'switch', 'name' => 'Open in new window', 'options' => array(), 'admin_class' => 'span5 push1'));
    return $params;
}
示例#8
0
文件: db.php 项目: jackyxie/phpspider
 public static function _init_mysql($config = array())
 {
     if (empty($config)) {
         // 记住不要把原来有的配置信息给强制换成$GLOBALS['config']['db'],否则换数据库会有问题
         self::$config = empty(self::$config) ? $GLOBALS['config']['db'] : self::$config;
     } else {
         self::$config = $config;
     }
     if (!self::$conn) {
         self::$conn = @mysqli_connect(self::$config['host'], self::$config['user'], self::$config['pass'], self::$config['name'], self::$config['port']);
         if (mysqli_connect_errno()) {
             self::$conn_fail++;
             $errmsg = 'Mysql Connect failed[' . self::$conn_fail . ']: ' . mysqli_connect_error();
             echo util::colorize(date("H:i:s") . " {$errmsg}\n\n", 'fail');
             log::add($errmsg, "Error");
             // 连接失败5次,中断进程
             if (self::$conn_fail >= 5) {
                 exit(250);
             }
             self::_init_mysql($config);
         } else {
             // 连接成功清零
             self::$conn_fail = 0;
             self::$worker_pid = function_exists('posix_getpid') ? posix_getpid() : 0;
             mysqli_query(self::$conn, " SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary, sql_mode='' ");
         }
     } else {
         $curr_pid = function_exists('posix_getpid') ? posix_getpid() : 0;
         // 如果父进程已经生成资源就释放重新生成,因为多进程不能共享连接资源
         if (self::$worker_pid != $curr_pid) {
             self::reset_connect();
         }
     }
 }
示例#9
0
文件: Update.php 项目: getkirby/cli
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($this->isInstalled() === false) {
         throw new RuntimeException('There seems to be no valid Kirby installation in this folder!');
     }
     $output->writeln('<info>Updating Kirby...</info>');
     $output->writeln('');
     // check if the panel is installed at all
     $hasPanel = is_dir($this->dir() . '/panel');
     // start updating the core
     $output->writeln('Updating the core...');
     // remove the old folder
     util::remove($this->dir() . '/kirby');
     // update the core
     $this->install(['repo' => 'getkirby/kirby', 'branch' => $input->getOption('dev') ? 'develop' : 'master', 'path' => $this->dir() . '/kirby', 'output' => $output]);
     // still has the old toolkit submodule
     if (is_dir($this->dir() . '/kirby/toolkit')) {
         // start updating the toolkit
         $output->writeln('Updating the toolkit...');
         // remove the toolkit folder first
         util::remove($this->dir() . '/kirby/toolkit');
         // update the toolkit
         $this->install(['repo' => 'getkirby/toolkit', 'branch' => $input->getOption('dev') ? 'develop' : 'master', 'path' => $this->dir() . '/kirby/toolkit', 'output' => $output]);
     }
     if ($hasPanel) {
         // start updating the panel
         $output->writeln('Updating the panel...');
         // remove the old panel folder first
         util::remove($this->dir() . '/panel');
         // update the panel
         $this->install(['repo' => 'getkirby/panel', 'branch' => $input->getOption('dev') ? 'develop' : 'master', 'path' => $this->dir() . '/panel', 'output' => $output]);
     }
     $output->writeln('<comment>Kirby has been updated to: ' . $this->version() . '!</comment>');
     $output->writeln('');
 }
示例#10
0
 public static function process()
 {
     $security = new Security();
     $security->verifyPre();
     $data = stream_get_contents(fopen('php://input', 'r'));
     $compressedSize = strlen($data);
     $security->verifyCompressedData($data, $compressedSize);
     $data = @gzdecode($data);
     $uncompressedSize = strlen($data);
     $security->validateData($data, $uncompressedSize);
     $json = json_decode($data, true);
     $security->validateJson($json);
     if (isset($json['icon'])) {
         $img = self::getServerIcon($json['icon']);
         $json['icon'] = $img;
         Log::info("Valid Image: {$img}");
         $data = json_encode($json);
         $uncompressedSize = strlen($data);
     } else {
     }
     $key = util::uuid(false);
     $cacheFile = Cache::getFile($key);
     Log::info("Uploaded {$uncompressedSize} bytes as {$key} to {$cacheFile}");
     Cache::put($key, $data);
     header("Location: " . BASE_URL_VIEW . "/?id={$key}");
     self::output("Compressed Size: {$compressedSize}\nUncompressed Size: {$uncompressedSize}\nRaw Upload: " . BASE_URL_VIEW . "/?id={$key}&raw=1");
 }
示例#11
0
 public function doSignIn()
 {
     $prompt = null;
     $email = null;
     $password = null;
     if ($_POST) {
         $email = util::request("email", "P");
         $password = util::request("password", "P");
         if (empty($email)) {
             $prompt = "邮箱不能为空";
         } else {
             if (empty($password)) {
                 $prompt = "密码不能为空";
             } else {
                 $isOk = true;
                 //$this->load("user")->checkUser();
                 if ($isOk) {
                     util::redirect("http://cgi.daotianhudong.com/?c=admin&a=index");
                 } else {
                     $prompt = "用户名或密码错误";
                 }
             }
         }
     }
     $template = resource::getView('admin');
     $template->assign("prompt", $prompt);
     $template->assign("email", $email);
     $template->assign("password", $password);
     $template->display('signin.tpl');
 }
示例#12
0
function __autoload($autoload)
{
    if (file_exists(util::base() . '/application/' . $autoload . '.php')) {
        include util::base() . '/application/' . $autoload . '.php';
    } elseif (file_exists(util::base() . '/system/' . $autoload . '.php')) {
        include util::base() . '/system/' . $autoload . '.php';
    }
}
 public static function error_report_array($arr)
 {
     $fp = fopen('./' . errorHandler::uuid() . '.log', 'wb');
     $res = "";
     util::printArray($res, $arr);
     fwrite($fp, $res);
     fclose($fp);
 }
示例#14
0
文件: view.php 项目: netserva/www
 public function nav1() : string
 {
     error_log(__METHOD__);
     $a = util::nav($this->g->nav1);
     array_shift($a);
     return '
   <nav>' . $this->nav($a);
 }
示例#15
0
 public static function printArray(&$res, $array)
 {
     foreach ($array as $key => $value) {
         $res .= "{$key} => {$value}";
         if (is_array($value)) {
             util::printArray($res, $value);
         }
     }
 }
示例#16
0
 public function nuevamisi($cuer)
 {
     /*PARA INSERTAR LOS PRODUCTOS*/
     $cnx = new util();
     $cn = $cnx->getConexion();
     /*(:titu, :cuer)*/
     $res = $cn->prepare("call editaMis(:cuer)");
     /*AQUI ESTOY LLAMANDO AL PROCEDIMIENTO: INSERTAR PRODUCTOS, ENVIANDO DE PARAMETROS TITU Y CUER*/
     /*$res->bindParam(":titu", $tit);*/
     /*insertMis*/
     $res->bindParam(":cuer", $cuer);
     $res->execute();
     /*
           foreach ($res as $row){
                $img=$row[1];
            }
            return $img;*/
 }
示例#17
0
 public function render()
 {
     echo '<input';
     echo ' type="hidden"';
     echo ' id="' . $this->name . '"';
     echo ' name="' . $this->name . '"';
     echo ' value="' . util::html($this->value) . '"';
     echo ' />';
 }
示例#18
0
 public static function error($msg)
 {
     $out_sta = $out_end = "";
     if (!util::is_win()) {
         $out_sta = "";
         $out_end = "";
     }
     $msg = $out_sta . $msg . $out_end . "\n";
     self::msg($msg);
 }
示例#19
0
 public static function authenticateGameEditor($pack)
 {
     if (!users::authenticateUser($pack)) {
         return false;
     }
     if (dbconnection::queryObject("SELECT * FROM user_games WHERE user_id = '{$pack->user_id}' AND game_id = '{$pack->game_id}'")) {
         return true;
     }
     util::errorLog("Failed Game Editor Authentication!");
     return false;
 }
示例#20
0
 public function testAction()
 {
     require $_SERVER['DOCUMENT_ROOT'] . '/school' . '/model/courseItem.php';
     $item = new courseItem();
     $arg = array('Course', 'Course_ID');
     require $_SERVER['DOCUMENT_ROOT'] . '/school' . '/controller/util.php';
     $Util = new util();
     echo property_exists($item, 'Course_ID');
     if (!property_exists($item, 'haha')) {
         echo 'false';
         //	exit();
     }
     $Util->argCheck($arg, $_GET);
     foreach ($arg as $tmp) {
         $item->{$tmp} = $_GET[$tmp];
     }
     foreach ($arg as $tmp) {
         echo $item->{$tmp};
     }
 }
示例#21
0
 public static function load($uuid)
 {
     if (!uuid::check($uuid)) {
         throw new Exception('expected uuid');
     }
     list($key, $obj) = unserialize(file_get_contents(util::base() . '/state/' . $uuid));
     if (state::key() !== $key) {
         throw new Exception('permission denied');
     }
     return $obj;
 }
示例#22
0
文件: view.php 项目: netserva/www
 public function head() : string
 {
     error_log(__METHOD__);
     $n = util::nav($this->g->nav1)[0];
     return '
 <header>
   <h1>
     <a href="' . $n[1] . '">' . $n[0] . '</a>
   </h1>
   <nav>' . $this->g->out['nav1'] . $this->g->out['nav2'] . '</nav>
 </header>';
 }
示例#23
0
 /**
  * image_compress
  * @param string $url,$prefix;int  $width,$height
  * @return array $result
  */
 function image_compress($url, $prefix = 's_', $width = 80, $height = 60, $suffix = '')
 {
     global $lang;
     $result = array('result' => false, 'tempurl' => '', 'msg' => 'something Wrong');
     if (!file_exists($url)) {
         $result['msg'] = $url . 'img is not exist';
         return $result;
     }
     $urlinfo = pathinfo($url);
     $ext = strtolower($urlinfo['extension']);
     $tempurl = $urlinfo['dirname'] . '/' . $prefix . substr($urlinfo['basename'], 0, -1 - strlen($ext)) . $suffix . '.' . $ext;
     if (!util::isimage($ext)) {
         $result['msg'] = 'img must be gif|jpg|jpeg|png';
         return $result;
     }
     $ext = $ext == 'jpg' ? 'jpeg' : $ext;
     $createfunc = 'imagecreatefrom' . $ext;
     $imagefunc = 'image' . $ext;
     if (function_exists($createfunc)) {
         list($actualWidth, $actualHeight) = getimagesize($url);
         if ($actualWidth < $width && $actualHeight < $height) {
             copy($url, $tempurl);
             $result['tempurl'] = $tempurl;
             $result['result'] = true;
             return $result;
         }
         if ($actualWidth < $actualHeight) {
             $width = round($height / $actualHeight * $actualWidth);
         } else {
             $height = round($width / $actualWidth * $actualHeight);
         }
         $tempimg = imagecreatetruecolor($width, $height);
         $img = $createfunc($url);
         imagecopyresampled($tempimg, $img, 0, 0, 0, 0, $width, $height, $actualWidth, $actualHeight);
         $result['result'] = $ext == 'png' ? $imagefunc($tempimg, $tempurl) : $imagefunc($tempimg, $tempurl, 80);
         imagedestroy($tempimg);
         imagedestroy($img);
         if (file_exists($tempurl)) {
             $result['tempurl'] = $tempurl;
         } else {
             $result['tempurl'] = $url;
         }
     } else {
         copy($url, $tempurl);
         if (file_exists($tempurl)) {
             $result['result'] = true;
             $result['tempurl'] = $tempurl;
         } else {
             $result['tempurl'] = $url;
         }
     }
     return $result;
 }
示例#24
0
文件: Index.php 项目: getkirby/cli
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $file = $this->dir() . '/index.php';
     if (file_exists($file)) {
         throw new RuntimeException('The index.php file already exists. Please remove the old one it first.');
     }
     $download = util::download('https://raw.githubusercontent.com/getkirby/starterkit/master/index.php');
     file_put_contents($file, $download);
     $output->writeln('');
     $output->writeln('<comment>The index.php has been installed!</comment>');
     $output->writeln('');
 }
示例#25
0
文件: crud.php 项目: netserva/www
 public function __construct(View $t)
 {
     error_log(__METHOD__);
     util::acl($this->acl);
     $this->t = $t;
     $this->g = $t->g;
     $this->o = $t->g->in['o'];
     $this->in = util::esc($this->in);
     db::$tbl = $this->o;
     $this->b = $this->{$t->g->in['m']}();
     //        $this->b .= $this->{$t->g->in['m']}();
 }
示例#26
0
 public function get($id)
 {
     $data = Cache::get($id);
     if (!$data) {
         $data = $this->requestUrl('http://paste.ubuntu.com/' . intval($id));
         if (preg_match_all('/<pre>(.*?)<\\/pre>/msi', $data, $m)) {
             $data = $m[1][1];
         }
     } else {
     }
     return util::sanitize($data);
 }
示例#27
0
 public function render($value)
 {
     echo '<input';
     echo ' type="radio"';
     if ($value == $this->value) {
         echo ' checked="checked"';
     }
     echo ' id="' . $this->name . '"';
     echo ' name="' . util::html($this->name) . '"';
     echo ' value="' . util::html($value) . '"';
     echo ' />';
 }
示例#28
0
 /**
  * Function start function server JSON RPC.
  * @access  public
  * @static
  */
 public static function start()
 {
     // checks if a JSON-RCP request has been received.
     if ($_SERVER['REQUEST_METHOD'] != 'POST' || empty($_SERVER['CONTENT_TYPE']) || !preg_match('/application\\/json/i', $_SERVER['CONTENT_TYPE'])) {
         // If cross Domain true.
         if (config::sys('crossDomain') == 1) {
             header('Access-Control-Allow-Origin: *');
             header('Access-Control-Request-Method: POST');
             header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
         }
         // class html startTmpl.
         html::startTmpl();
     } else {
         // reads the input data.
         $request = json_decode(file_get_contents('php://input'), true);
         // Gestion error.
         try {
             // Si app-maintenance.
             if (config::sys('off') != 1) {
                 // Exception.
                 throw new Exception('SERV-ERROR-OFFLINE-MESSAGE');
             }
             // method post.
             $reqConMethod = explode('_', $request['method']);
             // Controleur.
             $control = util::filtre($reqConMethod[0]);
             // Action.
             $action = util::filtre($reqConMethod[1]);
             // Load.
             load::auto('controleur_' . $control);
             // forward_static_call_array.
             if ($result = @forward_static_call_array(array($control, $action), $request['params'])) {
                 // Succes. Array.
                 $response = array('id' => $request['id'], 'result' => $result, 'jsonrpc' => $request['jsonrpc'], 'error' => NULL);
             } else {
                 throw new Exception('SERV-ERROR-INVALID-PARAM-OR-METHODE');
             }
         } catch (Exception $e) {
             // JSON RPC Error. Array.
             $response = array('id' => $request['id'], 'result' => NULL, 'jsonrpc' => $request['jsonrpc'], 'error' => $e->getMessage());
         }
         // output the response.
         header('content-type: text/javascript');
         // If cross Domain true.
         if (config::sys('crossDomain') == 1) {
             header('Access-Control-Allow-Origin: *');
             header('Access-Control-Request-Method: POST');
             header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
         }
         // Print request.
         print json_encode($response);
     }
 }
示例#29
0
function enviaemail($para = "", $texto = "", $assunto = "")
{
    //  require_once('system/libs/phpmailer/class.phpmailer.php');
    //header('Content-Type: text/html; charset=utf-8');
    $mail = new PHPMailer();
    $mail->IsSMTP();
    // set mailer to use SMTP
    $mail->Host = SMTPHOST;
    // specify main and backup server
    $mail->SMTPAuth = true;
    // turn on SMTP authentication
    $mail->Username = SMTPUSER;
    // SMTP username
    $mail->Password = SMTPPASS;
    // SMTP password
    $mail->Port = SMTPPORT;
    $mail->From = SMTPFROM;
    $mail->FromName = SMTPFROMNAME;
    //$mail->AddAddress("*****@*****.**", "Josh Adams");
    $mail->AddAddress($para);
    // name is optional
    $mail->AddReplyTo(SMTPFROMNAME, "Information Fox");
    $mail->WordWrap = 50;
    // set word wrap to 50 characters
    //$mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments
    //$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
    $mail->IsHTML(true);
    // set email format to HTML
    $mail->Subject = $assunto;
    $mail->Body = $texto;
    // $mail->AltBody = "This is the body in plain text for non-HTML mail clients";
    if (!$mail->Send()) {
        //echo "Message could not be sent. <p>";
        //echo "Mailer Error: " . $mail->ErrorInfo;
        $util = new util();
        $util->debug_no_log('Erro ao enviar o email ' . $mail->ErrorInfo);
        exit;
    }
    // echo "Message has been sent";
}
示例#30
0
 function doupload()
 {
     @header('Content-type: text/html; charset=' . WIKI_CHARSET);
     $did = $this->post['did'] ? $this->post['did'] : 0;
     if (!$this->setting['attachment_open']) {
         exit;
     }
     $okfile = '';
     $this->setting['coin_download'] = isset($this->setting['coin_download']) ? $this->setting['coin_download'] : 10;
     $count = count($_FILES['attachment']['name']);
     for ($i = 0; $i < $count; $i++) {
         if (!(bool) $_FILES['attachment']['name'][$i]) {
             continue;
         }
         $size = $_FILES['attachment']['size'][$i] / 1024;
         $name = $_FILES['attachment']['name'][$i];
         $attachment_type = $_ENV['attachment']->get_attachment_type();
         $filetype = strtolower(substr($name, strrpos($name, ".") + 1));
         if ($attachment_type[0] != '*' && !in_array($filetype, $attachment_type)) {
             echo '<script>parent.Attachment.error("' . $name . ': ' . $this->view->lang['attachTypeError'] . '");</script>';
             continue;
         }
         if ($size > $this->setting['attachment_size'] || empty($size)) {
             echo '<script>parent.Attachment.error("' . $name . ': ' . $this->view->lang['attachSizeError2'] . '");</script>';
             continue;
         }
         $destfile = 'data/attachment/' . date('y-m') . '/' . date('Y-m-d') . '_' . util::random(10) . '.attach';
         file::createaccessfile('data/attachment/' . date('y-m') . '/');
         $result = file::uploadfile($_FILES['attachment']['tmp_name'][$i], $destfile, $this->setting['attachment_size'], 0);
         if ($result) {
             $okfile .= $name . '|';
             $coindown = $this->post['coin_download'][$i];
             if (empty($coindown) || !is_numeric($coindown)) {
                 $coindown = 0;
             } else {
                 if (0 > $coindown) {
                     $coindown = 0;
                 } else {
                     if ($this->setting['coin_download'] < $coindown) {
                         $coindown = $this->setting['coin_download'];
                     }
                 }
             }
             $_ENV['attachment']->add_attachment($this->user['uid'], $did, $name, $destfile, $this->post['attachmentdesc'][$i], $filetype, 0, $coindown);
         }
     }
     echo '<script>';
     if ($okfile) {
         echo 'parent.Attachment.addok("' . $okfile . '");';
     }
     echo '</script>';
 }