コード例 #1
0
ファイル: filesmanager.php プロジェクト: Eximagen/3m
 public function initContent()
 {
     $module = new orderfiles();
     $this->var = $module->getconf();
     parent::initContent();
     global $smarty;
     $ext = explode(",", Configuration::get('OF_FTYPES'));
     $smarty->assign('extensions', $ext);
     if (isset($_POST['addfile'])) {
         if (isset($_POST['oid'])) {
             $order = new OrderCore($_POST['oid']);
             if ($order->id_customer == $this->context->customer->id) {
                 $this->insertphoto($_POST, $_FILES);
             }
         }
     }
     if (isset($_POST['savefile'])) {
         if ($_POST['pty'] == "order") {
             $module->updatefileorder($_POST['fid'], mysql_escape_string($_POST['description']), mysql_escape_string($_POST['title']));
         }
         if ($_POST['pty'] == "cart") {
             $module->updatefilecart($_POST['fid'], mysql_escape_string($_POST['description']), mysql_escape_string($_POST['title']));
         }
         if ($_POST['pty'] == "product") {
             $module->updatefileproduct($_POST['fid'], mysql_escape_string($_POST['description']), mysql_escape_string($_POST['title']));
         }
     }
     if (isset($_POST['delfile'])) {
         if (isset($_POST['oid'])) {
             $order = new OrderCore($_POST['oid']);
             if ($order->id_customer == $this->context->customer->id) {
                 $this->photodelete($_POST['fid'], $this->context->customer->id);
             }
         }
     }
     if (isset($_POST['delcartfile'])) {
         if (isset($_POST['fid'])) {
             $this->cartfiledelete($_POST['fid']);
         }
     }
     if (isset($_POST['delproductfile'])) {
         if (isset($_POST['fid'])) {
             $this->productfiledelete($_POST['fid']);
         }
     }
     if (isset($_POST['oid'])) {
         $order = new OrderCore($_POST['oid']);
         if ($order->id_customer == $this->context->customer->id) {
             $this->context->smarty->assign(array('mod' => $this, 'setup' => $this->var, 'order' => $order, 'idorder' => $_POST['oid'], 'files' => $this->get_files($_POST['oid'], $this->context->customer->id), 'link' => $this->context->link, 'customer' => $this->context->customer));
             $this->setTemplate('filesmanager.tpl');
         } else {
             $this->setTemplate('access-denied.tpl');
         }
     } else {
         $this->setTemplate('access-denied.tpl');
     }
 }