public function logIPNResults($success) { if (!$this->ipn_log) { return; } // is logging turned off? // Timestamp $text = '[' . date('m/d/Y g:i A') . '] - '; // Success or failure being logged? if ($success) { $text .= "SUCCESS!\n"; } else { $text .= 'FAIL: ' . $this->last_error . "\n"; } // Log the POST variables $text .= "IPN POST Vars from Paypal:\n"; foreach ($this->ipn_data as $key => $value) { $text .= "{$key}={$value}, "; } // Log the response from the paypal server $text .= "\nIPN Response from Paypal Server:\n " . $this->ipn_response; $ftp = new File_FTP($this->registry); if ($ftp) { $logs = __SITE_PATH . '/../../uthando/logs'; if (!is_file($logs . '/' . $this->ipn_log_file)) { $this->makeLogFile(); } $ftp->chmod($ftp->uthando_dir . '/logs/' . $this->ipn_log_file, 0646); // Write to log file_put_contents($logs . '/' . $this->ipn_log_file, $text . "\n\n", FILE_APPEND); $ftp->chmod($ftp->uthando_dir . '/logs/' . $this->ipn_log_file, 0644); } }
$form->addElement('html', '<div id="configuration" class="morphtabs_panel"><div class="panel_content">'); require_once 'ushop/params/global.php'; require_once 'ushop/params/paypal.php'; $form->addElement('html', '</div></div>'); $form->addElement('html', '<div id="display" class="morphtabs_panel"><div class="panel_content">'); require_once 'ushop/params/frontend_display.php'; require_once 'ushop/params/admin_display.php'; $form->addElement('html', '</div></div>'); if ($form->validate()) { $menuBar = array(); // Apply form element filters. $form->freeze(); $values = $form->process(array(&$this, 'formValues')); $ushop_ini = new Admin_Config($this->registry, array('path' => $this->registry->ini_dir . '/ushop.ini.php')); if ($values['information']) { $ftp = new File_FTP($this->registry); foreach ($values['information'] as $key => $value) { $message = file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/tmp/' . $key . '.html', stripslashes(str_replace('\\r\\n', '', $value))); $ftp->put($_SERVER['DOCUMENT_ROOT'] . '/tmp/' . $key . '.html', $ftp->public_html . '/' . $this->registry->get('settings.resolve') . '/file/' . $key . '.html', true); unlink($_SERVER['DOCUMENT_ROOT'] . '/tmp/' . $key . '.html'); } unset($values['information']); $ftp->disconnect(); } foreach ($values as $section => $value) { foreach ($value as $key => $value) { $ushop_ini->set($key, $value, $section); } } $saved = $ushop_ini->save(); $menuBar['back'] = '/ushop/overview';
<?php // no direct access defined('PARENT_FILE') or die('Restricted access'); if ($this->authorize()) { $menuBar = array(); if ($this->registry->params['comfirm'] == 'delete') { // delete image file first. $login = $this->registry->admin_config->get('FTP'); $row = $this->getResult('image', $ushop->db_name . 'products', null, array('where' => 'product_id=' . $this->registry->params['id'])); $di = true; // set delete flag. if ($row) { $ftp = new File_FTP($this->registry); if ($ftp) { $delete = $ftp->rm($login['public_html'] . '/components/ushop/images/products/' . $row[0]->image); if (!$delete) { $di = false; } $ftp->disconnect(); } else { $di = false; } } else { $di = false; } $res = $this->remove($ushop->db_name . 'products', 'product_id=' . $this->registry->params['id']); if ($res) { $params['TYPE'] = 'pass'; $params['MESSAGE'] = '<h2>Product was successfully deleted.</h2>'; } else {
protected function unlink($file) { $file = realpath($file); if ($this->basedir == $file || strlen($this->basedir) >= strlen($file)) { return; } $ftp = new File_FTP($this->registry); $file_to_delete = $this->getFTPPath($ftp->public_html, $file); if (is_dir($file)) { $file_to_delete .= '/'; } try { if ($this->checkFile($file)) { $ftp->rm($file_to_delete, true); } } catch (Exception $e) { } }
public function save() { try { if ($this->path == null) { throw new ConfigException("Config::save() - ini path not set, error."); } $content = null; // PROTECTED_MODE-prefix if ($this->protected_mode) { $content .= "<?php\n; /*\n; -- BEGIN PROTECTED_MODE\n"; } // config-header $content .= "; This file was automatically generated by Config\n"; $content .= "; Do not edit this file by hand, use Config instead.\n"; $content .= "; Last modified: " . date('d M Y H:i s') . "\n"; // check if there are sections to process if ($this->process_sections) { foreach ($this->vars as $key => $elem) { $content .= "[" . $key . "]\n"; foreach ($elem as $key2 => $elem2) { if (is_array($elem2)) { foreach ($elem2 as $elem3) { $content .= $key2 . "[] = \"" . $elem3 . "\"\n"; } } else { $content .= $key2 . " = \"" . $elem2 . "\"\n"; } } } } else { foreach ($this->vars as $key => $elem) { $content .= $key . " = \"" . $elem . "\"\n"; } } // add PROTECTED_MODE-ending if ($this->protected_mode) { $content .= "\n; -- END PROTECTED_MODE\n; */\n?>\n"; } $ftp = new File_FTP($this->registry); $dir = preg_replace("/(.*?)" . str_replace("/", "\\/", $ftp->public_html) . "|(.*?)" . str_replace("/", "\\/", $ftp->uthando_dir) . "/", "", $this->path); if ($this->public_html) { $path = $ftp->public_html . $dir; } else { $path = $ftp->uthando_dir . $dir; } $ftp->chmod($path, 0646); if (!file_put_contents($this->path, $content)) { throw new ConfigException("Config::save() - Could not write to file('" . $this->path . "'), error."); } $ftp->chmod($path, 0644); $ftp->disconnect(); return true; } catch (ConfigException $e) { $this->registry->Error($e->getMessage()); return false; } }
} foreach ($files as $section => $values) { foreach ($values as $key => $value) { $value = str_replace('.js', '', $value); $template_files->set($key, $value, $section); } } $template_files->save(); $js->scripts = $template_files->get('mootools_js'); foreach ($js->scripts as $key => $files) { $js->scripts[$key] = $this->registry->config->get('web_url', 'SERVER') . $files; } $js->dbug = false; $js->compress_file = true; $cache_file = $_SERVER['DOCUMENT_ROOT'] . '/Common/tmp/UthandoJsCache.js'; $ftp = new File_FTP($this->registry); $script = $js->load_js(); file_put_contents($cache_file, $script); if ($template_name == 'admin') { $dir = explode('/', $_SERVER['DOCUMENT_ROOT']); $ftp->put($cache_file, $ftp->public_html . '/' . end($dir) . '/templates/' . $template_name . '/js/UthandoJsCache.js', true, FTP_ASCII); } else { $ftp->put($cache_file, $ftp->public_html . '/templates/' . $template_name . '/js/UthandoJsCache.js', true, FTP_ASCII); } $ftp->disconnect(); unlink($cache_file); } $menuBar = array('cancel' => '/admin/overview', 'save' => ''); $this->content .= $this->makeToolbar($menuBar, 24); $this->content .= '<form id="mooTemplate" method="post" action="' . $_SERVER['REQUEST_URI'] . '">'; $this->content .= '<select id="template_select" name="template">';
$form->addElement('html', '</div></div>'); $form->addElement('html', '<div id="configuration" class="morphtabs_panel"><div class="panel_content">'); require_once 'ushop/params/global.php'; require_once 'ushop/params/paypal.php'; $form->addElement('html', '</div></div>'); $form->addElement('html', '<div id="display" class="morphtabs_panel"><div class="panel_content">'); require_once 'ushop/params/frontend_display.php'; require_once 'ushop/params/admin_display.php'; $form->addElement('html', '</div></div>'); if ($form->validate()) { // Apply form element filters. $form->freeze(); $values = $form->process(array(&$this, 'formValues')); $ushop_ini = new Admin_Config($this->registry, array('path' => $this->registry->ini_dir . '/ushop.ini.php')); if ($values['information']) { $ftp = new File_FTP($this->registry); foreach ($values['information'] as $key => $value) { $message = file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/Common/tmp/' . $key . '.html', stripslashes(str_replace('\\r\\n', '', $value))); $ftp->put($_SERVER['DOCUMENT_ROOT'] . '/Common/tmp/' . $key . '.html', $login['public_html'] . '/components/ushop/html/' . $key . '.html', true); unlink($_SERVER['DOCUMENT_ROOT'] . '/Common/tmp/' . $key . '.html'); } unset($values['information']); $ftp->disconnect(); } foreach ($values as $section => $value) { foreach ($value as $key => $value) { $ushop_ini->set($key, $value, $section); } } $saved = $ushop_ini->save(); $menuBar['back'] = '/ushop/overview';
protected function unlink($file) { $file = realpath($file); if ($this->basedir == $file || strlen($this->basedir) >= strlen($file)) { return; } $ftp = new File_FTP($this->registry); $file_to_delete = $this->getFTPPath($ftp->public_html, $file); $dir = false; if (is_dir($file)) { $file_to_delete .= '/'; $dir = true; } try { if ($this->checkFile($file)) { $ftp->rm($file_to_delete, $dir ? true : false); } } catch (FTPException $e) { echo $e->getMessage(); } }