Пример #1
0
 private function getFile($name, $prepare = 1, $override = 0, $showit = 0)
 {
     global $dbh, $postvar, $getvar, $instance;
     $link = "../themes/" . THEME . "/" . $name;
     if (!file_exists($link) || $override == 1) {
         $link = INC . "/" . $name;
     }
     if (!file_exists($link)) {
         $link = "../install/" . $name;
     }
     if (!file_exists($link)) {
         $link = $name;
     }
     if (!file_exists($link) && INSTALL == 1) {
         $error['Error'] = "File doesn't exist!";
         $error['Path'] = $link;
         main::error($error);
     } else {
         if ($prepare) {
             return self::prepare(file_get_contents($link));
         } else {
             return file_get_contents($link);
         }
     }
 }
Пример #2
0
 /**
  * Constructor
  *
  * @param \phpbb\db\driver\driver_interface $db         Database object
  * @param \phpbb\user                       $user       User object
  * @param string                            $table_name Name of the table used to store data
  *
  * @access public
  */
 public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $table_name)
 {
     $this->db = $db;
     $this->user = $user;
     $this->transactions_log_table = $table_name;
     parent::__construct($db, $user, 'PPDE_DT', 'TRANSACTION', $table_name, array('item_id' => array('name' => 'transaction_id', 'type' => 'integer'), 'item_receiver_id' => array('name' => 'receiver_id', 'type' => 'string'), 'item_receiver_email' => array('name' => 'receiver_email', 'type' => 'string'), 'item_residence_country' => array('name' => 'residence_country', 'type' => 'string'), 'item_business' => array('name' => 'business', 'type' => 'string'), 'item_confirmed' => array('name' => 'confirmed', 'type' => 'boolean'), 'item_test_ipn' => array('name' => 'test_ipn', 'type' => 'boolean'), 'item_txn_id' => array('name' => 'txn_id', 'type' => 'string'), 'item_txn_type' => array('name' => 'txn_type', 'type' => 'string'), 'item_parent_txn_id' => array('name' => 'parent_txn_id', 'type' => 'string'), 'item_payer_email' => array('name' => 'payer_email', 'type' => 'string'), 'item_payer_id' => array('name' => 'payer_id', 'type' => 'string'), 'item_payer_status' => array('name' => 'payer_status', 'type' => 'string'), 'item_first_name' => array('name' => 'first_name', 'type' => 'string'), 'item_last_name' => array('name' => 'last_name', 'type' => 'string'), 'item_user_id' => array('name' => 'user_id', 'type' => 'integer'), 'item_custom' => array('name' => 'custom', 'type' => 'string'), 'item_item_name' => array('name' => 'item_name', 'type' => 'string'), 'item_item_number' => array('name' => 'item_number', 'type' => 'string'), 'item_mc_currency' => array('name' => 'mc_currency', 'type' => 'string'), 'item_mc_fee' => array('name' => 'mc_fee', 'type' => 'float'), 'item_mc_gross' => array('name' => 'mc_gross', 'type' => 'float'), 'item_net_amount' => array('name' => 'net_amount', 'type' => 'float'), 'item_payment_date' => array('name' => 'payment_date', 'type' => 'integer'), 'item_payment_status' => array('name' => 'payment_status', 'type' => 'string'), 'item_payment_type' => array('name' => 'payment_type', 'type' => 'string'), 'item_settle_amount' => array('name' => 'settle_amount', 'type' => 'float'), 'item_settle_currency' => array('name' => 'settle_currency', 'type' => 'string'), 'item_exchange_rate' => array('name' => 'exchange_rate', 'type' => 'string')));
 }
Пример #3
0
 public function run()
 {
     include main::getPluginDir() . '/libs/classes/aws-autoloader.php';
     $ad = $this->params['access_details'];
     main::log(lang::get('Start copy files to Amazon S3', false));
     $files = $this->params['files'];
     $dir = isset($ad['dir']) ? $ad['dir'] : '/';
     $credentials = new Aws\Common\Credentials\Credentials($ad['AccessKeyId'], $ad['SecretAccessKey']);
     $client = Aws\S3\S3Client::factory(array('credentials' => $credentials));
     try {
         $n = count($files);
         for ($i = 0; $i < $n; $i++) {
             $filePath = preg_replace('#[/\\\\]+#', '/', BACKUP_DIR . '/' . $dir . '/' . $files[$i]);
             $key = $dir ? $dir . '/' . basename($filePath) : basename($filePath);
             $key = ltrim(preg_replace('#[/\\\\]+#', '/', $key), '/');
             //if first will be '/', file not will be uploaded, but result will be ok
             $putRes = $client->putObject(array("Bucket" => $ad['bucket'], 'Key' => $key, 'Body' => fopen($filePath, 'r+')));
             if (isset($putRes['RequestId']) && !empty($putRes['RequestId'])) {
                 main::log(str_replace('%s', basename($filePath), lang::get("File(%s) Upload successfully to Amazon S3", false)));
             }
         }
         main::log(lang::get('End copy files to Amazon S3', false));
     } catch (Exception $e) {
         main::log('Error send to Amazon s3: ' . $e->getMessage());
         $this->setError($e->getMessage());
         return false;
     } catch (S3Exception $e) {
         main::log('Error send to Amazon s3: ' . $e->getMessage());
         $this->setError($e->getMessage());
         return false;
     }
     return true;
 }
Пример #4
0
 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     $client_data = $dbh->client($_SESSION['cuser']);
     $packages_data = $dbh->select("packages", array("id", "=", $client_data['pid']));
     $view_package_array['USER'] = $client_data['user'];
     $view_package_array['SIGNUP'] = main::convertdate("n/d/Y", $client_data['signup']);
     $view_package_array['DOMAIN'] = $client_data['domain'];
     $view_package_array['PACKAGE'] = $packages_data['name'] . " <a href = '?page=upgrade'>Change</a>";
     $view_package_array['DESCRIPTION'] = $packages_data['description'];
     if ($_POST) {
         if (crypto::passhash($postvar['currentpass'], $client_data['salt']) == $client_data['password']) {
             if ($postvar['newpass'] == $postvar['cpass']) {
                 $cmd = main::changeClientPassword($client_data['id'], $postvar['newpass']);
                 if ($cmd === true) {
                     main::errors("Details updated!");
                 } else {
                     main::errors((string) $cmd);
                 }
             } else {
                 main::errors("Your passwords don't match!");
             }
         } else {
             main::errors("Your current password wasn't correct!");
         }
     }
     echo style::replaceVar("tpl/client/view-package.tpl", $view_package_array);
 }
Пример #5
0
 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     if (!$dbh->config("delacc")) {
         die('This feature has been disabled.');
     } else {
         if ($_POST) {
             $user = $_SESSION['cuser'];
             $pass = $postvar['password'];
             $client = $dbh->client($user);
             unset($where);
             $where[] = array("is_paid", "=", "0", "AND");
             $where[] = array("uid", "=", $user);
             $balance_query = $dbh->select("invoices", $where, 0, "1", 1);
             if ($dbh->num_rows($balance_query) != 0) {
                 main::errors("You can't close your account with an outstanding balance.  Please contact an administrator for assistance or pay any unpaid invoices.");
             }
             if (crypto::passhash($pass, $client['salt']) == $client['password']) {
                 if (server::terminate($client['id'], "", 1)) {
                     main::errors("Your account has been cancelled successfully.");
                     session_destroy();
                 } else {
                     main::errors("Your account wasn't cancelled.  Please try again or contact your system administrator.");
                 }
             } else {
                 main::errors("The password entered is incorrect.");
             }
         }
         echo style::replaceVar("tpl/client/delete-account.tpl");
     }
 }
Пример #6
0
 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     if ($_POST) {
         check::empty_fields();
         if (!main::errors()) {
             $user = $dbh->staff($_SESSION['user']);
             if (!$user['password']) {
                 main::errors("Wrong username!?");
             } else {
                 if (crypto::passhash($postvar['old'], $user['salt']) == $user['password']) {
                     if ($postvar['new'] != $postvar['confirm']) {
                         main::errors("Your passwords don't match!");
                     } else {
                         $salt = crypto::salt();
                         $newpass = crypto::passhash($postvar['new'], $salt);
                         $update_staff = array("password" => $newpass, "salt" => $salt);
                         $dbh->update("staff", $update_staff, array("id", "=", $_SESSION['user']));
                         main::errors("Password changed!");
                     }
                 } else {
                     main::errors("Your old password was wrong!");
                 }
             }
         }
     }
     echo style::replaceVar("tpl/admin/change-admin-password.tpl");
 }
Пример #7
0
    function submit_paypal_post()
    {
        global $dbh, $postvar, $getvar, $instance;
        echo "<form action=" . $this->paypal_url . " method='post' name='frm'>";
        foreach ($this->fields as $a => $b) {
            if ($a == "amount") {
                if ($b == "0") {
                    $user_data = $dbh->select("users", array("id", "=", $_SESSION['cuser']));
                    $signup_date = date("m-d-Y", $user_data['signup']);
                    if ($signup_date == date("m-d-Y")) {
                        $noemail = "1";
                    }
                    invoice::set_paid($getvar['iid'], $noemail);
                    main::redirect("../client/?page=invoices");
                    exit;
                }
            }
            echo "<input type='hidden' name='" . $a . "' value='" . $b . "'>";
        }
        echo '</form>
		<script language="JavaScript">
		document.frm.submit();
		</script>';
        exit;
    }
Пример #8
0
 /**
  * Constructor
  *
  * @param \phpbb\db\driver\driver_interface $db         Database object
  * @param \phpbb\user                       $user       User object
  * @param string                            $table_name Name of the table used to store data
  *
  * @access public
  */
 public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $table_name)
 {
     $this->db = $db;
     $this->user = $user;
     $this->currency_table = $table_name;
     parent::__construct($db, $user, 'PPDE_DC', 'CURRENCY', $table_name, array('item_id' => array('name' => 'currency_id', 'type' => 'integer'), 'item_name' => array('name' => 'currency_name', 'type' => 'string'), 'item_iso_code' => array('name' => 'currency_iso_code', 'type' => 'string'), 'item_symbol' => array('name' => 'currency_symbol', 'type' => 'string'), 'item_on_left' => array('name' => 'currency_on_left', 'type' => 'boolean'), 'item_enable' => array('name' => 'currency_enable', 'type' => 'boolean'), 'item_order' => array('name' => 'currency_order', 'type' => 'integer')));
 }
Пример #9
0
 /**
  * Constructor
  *
  * @param \phpbb\config\config              $config     Config object
  * @param \phpbb\db\driver\driver_interface $db         Database object
  * @param \phpbb\user                       $user       User object
  * @param string                            $table_name Name of the table used to store data
  *
  * @access public
  */
 public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $table_name)
 {
     $this->config = $config;
     $this->db = $db;
     $this->user = $user;
     $this->donation_pages_table = $table_name;
     parent::__construct($db, $user, 'PPDE_DP', 'DONATION_PAGES', $table_name, array('item_id' => array('name' => 'page_id', 'type' => 'integer'), 'item_name' => array('name' => 'page_title', 'type' => 'string'), 'item_lang_id' => array('name' => 'page_lang_id', 'type' => 'integer'), 'item_content' => array('name' => 'page_content', 'type' => 'string'), 'item_content_bbcode_bitfield' => array('name' => 'page_content_bbcode_bitfield', 'type' => 'string'), 'item_content_bbcode_uid' => array('name' => 'page_content_bbcode_uid', 'type' => 'string'), 'item_content_bbcode_options' => array('name' => 'page_content_bbcode_options', 'type' => 'integer')));
 }
Пример #10
0
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new main();
         self::$instance->_init();
     }
     return self::$instance;
 }
Пример #11
0
 function __construct($data)
 {
     if (!$data) {
         main::log('ERROR', 'data not defined', true);
     }
     if (!is_array($data)) {
         main::log('ERROR', 'data is not an array', true);
     }
     $this->data = $data;
 }
Пример #12
0
 public function empty_fields($omit = array())
 {
     global $dbh, $postvar, $getvar, $instance;
     foreach ($postvar as $key => $value) {
         if ($value == "" && !$n && !in_array($key, $omit)) {
             main::errors("Please fill in all the fields!");
             $n++;
         }
     }
 }
Пример #13
0
 public static function loadLibs($libList)
 {
     foreach ($libList as $lib) {
         $libFile = wm_lib_path . $lib;
         if (!is_file($libFile)) {
             main::log('ERROR', 'inexistent lib file: ' . $lib, true);
         }
         require $libFile;
     }
 }
Пример #14
0
function getUpdates($telegram)
{
    date_default_timezone_set('Europe/Rome');
    $today = date("Y-m-d H:i:s");
    $db = new PDO(DB_NAME);
    $data = new getdata();
    $update_manager = new main();
    // Get all the new updates and set the new correct update_id
    $req = $telegram->getUpdates();
    for ($i = 0; $i < $telegram->UpdateCount(); $i++) {
        // You NEED to call serveUpdate before accessing the values of message in Telegram Class
        $telegram->serveUpdate($i);
        $text = $telegram->Text();
        $chat_id = $telegram->ChatID();
        $user_id = $telegram->User_id();
        $location = $telegram->Location();
        $reply_to_msg = $telegram->ReplyToMessage();
        $update_manager->shell($telegram, $db, $data, $text, $chat_id, $user_id, $location, $reply_to_msg);
    }
}
Пример #15
0
 public function incMysql()
 {
     include main::getPluginDir() . '/libs/classes/as3b-mysql.php';
     $db_param = $this->getDBParams();
     $mysql = new as3b_mysql();
     $mysql->user = $db_param['user'];
     $mysql->password = $db_param['pass'];
     $mysql->host = $db_param['host'];
     $mysql->db = $db_param['db'];
     $mysql->connect();
     return $mysql;
 }
Пример #16
0
 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     // An honest attempt to make this system a little less painful (for me)...
     if (array_key_exists("sub", $getvar) && !empty($getvar["sub"])) {
         $sub = "_" . strtolower($getvar["sub"]);
         if (method_exists($this, $sub)) {
             $this->{$sub}();
             return;
         }
         main::error(array(__FILE__ => "<code>\$this->{$sub}</code> isn't a method."));
     }
 }
Пример #17
0
 public function conf_perms()
 {
     if (is_writable(INC . "/conf.inc.php")) {
         if (main::perms(INC . "/conf.inc.php", 0444)) {
             main::errors("Configuration File made unwritable.");
         } else {
             main::errors("Failed to make the configuration file unwritable.");
         }
     } else {
         main::errors("Configuration File is already unwritable.");
     }
     echo style::replaceVar('tpl/admin/system/perms-tools.tpl');
 }
Пример #18
0
 public function run()
 {
     if (!function_exists('get_plugins')) {
         require_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     $plugin_name = array_pop(explode("/", main::getPluginDir()));
     $plugin_name2 = str_replace("-", "_", $plugin_name);
     $plugin = get_plugins("/{$plugin_name}");
     $pl_version = "";
     if (isset($plugin["{$plugin_name}.php"])) {
         $pl_version = $plugin["{$plugin_name}.php"]['Version'];
     }
     if (isset($plugin["{$plugin_name2}.php"])) {
         $pl_version = $plugin["{$plugin_name2}.php"]['Version'];
     }
     $data_return = array('reply' => 'pong', 'date' => array('time_zone' => date('O'), 'time' => time()), 'system_version' => $wp_version, 'plugin_version' => $pl_version, 'system' => 'wordpress');
     //get info for minimal requirements
     $data_return['php_version'] = @phpversion();
     $data_return['php_max_execution_time'] = @intval(ini_get('max_execution_time'));
     $data_return['php_memory_limit'] = @ini_get('memory_limit');
     $data_return['php_extensions'] = @implode(',', get_loaded_extensions());
     $data_return['php_disabled_functions'] = @ini_get('disable_functions');
     $data_return['php_max_execution_time_up'] = 0;
     $data_return['php_memory_limit_up'] = 0;
     $data_return['mysql_version'] = '';
     $data_return['suhosin_functions_blacklist'] = '';
     //try set new max time
     $newMaxExecutionTime = 3000;
     @set_time_limit($newMaxExecutionTime);
     if (@intval(ini_get('max_execution_time')) == $newMaxExecutionTime) {
         $data_return['php_max_execution_time_up'] = 1;
     }
     //try set new memory limit
     $newMemoryLimit = 256;
     @ini_set('memory_limit', $newMemoryLimit . 'M');
     if (@intval(ini_get('memory_limit')) == $newMemoryLimit) {
         $data_return['php_memory_limit_up'] = 1;
     }
     //try get mysql version
     $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD);
     if (!mysqli_connect_errno()) {
         $data_return['mysql_version'] = $mysqli->server_info;
     }
     //check suhosin
     if (extension_loaded('suhosin')) {
         $data_return['suhosin_functions_blacklist'] = @ini_get('suhosin.executor.func.blacklist');
     }
     $this->setResult($data_return);
 }
Пример #19
0
 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     $cats_query = $dbh->select("cats");
     if (!$dbh->num_rows($cats_query)) {
         echo "There are no knowledge base categories or articles!";
     } else {
         if ($getvar['cat']) {
             $cats_data = $dbh->select("cats", array("id", "=", $getvar['cat']));
             if (!$cats_data['id']) {
                 echo "That category doesn't exist!";
             } else {
                 echo main::sub('<img src="<ICONDIR>arrow_rotate_clockwise.png"><a href="?page=kb">Return To Category Selection</a>', '');
                 $articles_query = $dbh->select("articles", array("catid", "=", $getvar['cat']), 0, 0, 1);
                 if (!$dbh->num_rows($articles_query)) {
                     echo "There are no articles in this category!";
                 } else {
                     while ($articles_data = $dbh->fetch_array($articles_query)) {
                         $article_box_array['NAME'] = $articles_data['name'];
                         $article_box_array['ID'] = $articles_data['id'];
                         echo style::replaceVar("tpl/kb/article-box.tpl", $article_box_array);
                     }
                 }
             }
             return;
         }
         if ($getvar['art']) {
             $articles_data = $dbh->select("articles", array("id", "=", $getvar['art']));
             if (!$articles_data['id']) {
                 echo "That article doesn't exist!";
             } else {
                 $view_article_array['NAME'] = $articles_data['name'];
                 $view_article_array['CONTENT'] = $articles_data['content'];
                 $view_article_array['CATID'] = $articles_data['catid'];
                 echo style::replaceVar("tpl/kb/view-article.tpl", $view_article_array);
             }
             return;
         }
         //Show this by default.
         while ($cats_data = $dbh->fetch_array($cats_query)) {
             $category_box_array['NAME'] = $cats_data['name'];
             $category_box_array['DESCRIPTION'] = $cats_data['description'];
             $category_box_array['ID'] = $cats_data['id'];
             echo style::replaceVar("tpl/kb/category-box.tpl", $category_box_array);
         }
     }
 }
Пример #20
0
 private function local()
 {
     $this->files = readDirectrory(BACKUP_DIR . '/' . $this->params['name'], array('.zip'));
     include main::getPluginDir() . '/libs/pclzip.lib.php';
     if (($n = count($this->files)) > 0) {
         for ($i = 0; $i < $n; $i++) {
             main::log(str_replace('%s', basename($this->files[$i]), lang::get("Data decompression: %s", false)));
             $this->archive = new PclZip($this->files[$i]);
             $file_in_zip = $this->archive->extract(PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER);
         }
         if (file_exists(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql')) {
             main::log(lang::get("Run process restore Database", false));
             $mysql = $this->incMysql();
             $mysql->restore(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql');
             main::log(lang::get("Stopped process restore Database", false));
             main::remove(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql');
         }
     }
 }
Пример #21
0
 /**
  * Main Constructor
  *
  * @access	public
  * @param	string	Project file or folder
  * @param	string	[Optional] Folder to save the report
  * @return	void
  */
 public function __construct($projectPath, $reportFolder = null)
 {
     $this->startTime = time();
     if (empty($projectPath)) {
         throw new \Exception(__METHOD__ . ": Project path given was empty.");
     }
     $this->projectPath = $projectPath;
     $reportFolder = main::getRealPath($reportFolder);
     if ($reportFolder !== false) {
         $this->reportFolder = $reportFolder;
     } else {
         $this->reportFolder = PHP7MAR_DIR . DIRECTORY_SEPARATOR . 'reports' . DIRECTORY_SEPARATOR;
     }
     $this->fullFilePath = $this->reportFolder . date('Y-m-d H.i.s ') . basename($this->projectPath, '.php') . ".md";
     $this->file = fopen($this->fullFilePath, 'w+');
     register_shutdown_function([$this, 'onShutdown']);
     $this->add(date('c', $this->startTime), 0, 1);
     $this->add("Scanning {$this->projectPath}", 0, 1);
 }
Пример #22
0
 public function import()
 {
     global $dbh, $postvar, $getvar, $instance;
     if (!$_POST) {
         $servers_query = $dbh->select("servers", array("type", "=", "zpanel"), 0, 0, 1);
         while ($servers_data = $dbh->fetch_array($servers_query)) {
             $values[] = array($servers_data['name'], $servers_data['id']);
         }
         $zpanel_array['DROPDOWN'] = main::dropdown("server", $values);
         echo style::replaceVar("tpl/admin/import/zpanel.tpl", $zpanel_array);
     } elseif ($_POST) {
         $postvar['server'] = $postvar['server'];
         //Hack to make sure we post the 'server' field as it doesn't post if it's empty.
         check::empty_fields();
         if (main::errors()) {
             echo "<ERRORS>";
         } else {
             $n = 0;
             include INC . "/servers/zpanel.php";
             $zpanel = new zpanel($postvar['server']);
             $zpanel_accounts = $zpanel->listaccs($postvar['server']);
             foreach ($zpanel_accounts as $zpanel_data) {
                 $packages_data = $dbh->select("packages", array("backend", "=", $zpanel_data['package']));
                 $users_data = $dbh->select("users", array("user", "=", $zpanel_data['user']));
                 if (!$packages_data['id']) {
                     $packages_insert = array("name" => $zpanel_data['package'], "backend" => $zpanel_data['package'], "description" => "Imported from ZPanel: " . $zpanel_data['package'], "type" => "free", "server" => $postvar['server'], "admin" => "1");
                     $dbh->insert("packages", $packages_insert);
                 }
                 $new_packages_data = $dbh->select("packages", array("backend", "=", $zpanel_data['package']));
                 if (!$users_data['id']) {
                     $salt = crypto::salt();
                     $newpass = crypto::passhash(rand(), $salt);
                     $users_insert = array("user" => $zpanel_data['user'], "zpanel_uid" => $zpanel_data['user'], "email" => $zpanel_data['user'], "password" => $zpanel_data['user'], "salt" => $zpanel_data['user'], "signup" => $zpanel_data['user'], "status" => $zpanel_data['user'], "domain" => $zpanel_data['user'], "pid" => $zpanel_data['user']);
                     $dbh->insert("users", $users_insert);
                     $dbh->insert("users_bak", $users_insert);
                     $n++;
                 }
             }
             echo $n . " Accounts have been imported";
         }
     }
 }
Пример #23
0
 public function create($uid, $amount, $due, $notes)
 {
     global $dbh, $postvar, $getvar, $instance;
     $client = $dbh->client($uid);
     $emailtemp = email::emailTemplate("new-invoice");
     $newinvoice_array['USER'] = $client['user'];
     $newinvoice_array['AMOUNT'] = main::addzeros($amount);
     $newinvoice_array['LINK'] = $dbh->config("url") . "/client/?page=invoices";
     $newinvoice_array['DUE'] = main::convertdate("n/d/Y", $due, $uid);
     $is_paid = $newinvoice_array['AMOUNT'] == "0.00" ? "1" : "0";
     email::send($client['email'], $emailtemp['subject'], $emailtemp['content'], $newinvoice_array);
     unset($where);
     $where[] = array("amount", "=", "0", "OR");
     $where[] = array("amount", "=", "0.00");
     $dbh->update("invoices", array("is_paid" => "1"), $where);
     //This way people won't see unpaid invoices for $0.
     $invoices_insert = array("uid" => $uid, "amount" => $amount, "created" => time(), "due" => $due, "notes" => $notes, "pay_now" => $amount, "is_paid" => $is_paid);
     $response = $dbh->insert("invoices", $invoices_insert);
     return $response;
 }
Пример #24
0
 private function EditTemplate($tpl, $ext)
 {
     global $dbh, $postvar, $getvar, $instance;
     $filetochange = INC . "/../themes/" . $dbh->config('theme') . "/" . $tpl . "." . $ext;
     if ($_POST) {
         file_put_contents($filetochange, stripslashes(str_replace(array("&lt;IMG>", "-%-INFO-%-"), array("<IMG>", "%INFO%"), $postvar['contents'])));
         main::errors($tpl . '.' . $ext . ' Modified.');
     }
     $tpl_editor_array['CONTENT'] = str_replace(array("<IMG>", "%INFO%"), array("&lt;IMG>", "-%-INFO-%-"), htmlentities(file_get_contents($filetochange)));
     if (is_writable($filetochange)) {
         $tpl_editor_array['NOTICE'] = '';
     } else {
         $tpl_editor_array['NOTICE'] = style::notice(false, "In order to make changes to this file, please make it writable.");
     }
     return style::replaceVar('tpl/admin/lof/' . $tpl . '-editor.tpl', $tpl_editor_array);
 }
Пример #25
0
$pass2 = $_POST['passwort_E2'];
$klar = $_POST['klartext'];
$fremd = $_POST['fremdtext'];
$firsttimer = FALSE;
if ($klar == "") {
    $klar = $default_text = JTEXT::_('DEFAULTTEXT');
    $firsttime = TRUE;
}
if ($pass1 == "") {
    $pass1 = "example";
}
if ($pass2 == "") {
    $pass2 = "keyword";
}
include_once $pfad . '/main.php';
$chiff = new main();
$form = file_get_contents($pfad . '/form.template');
$chiff->setKey1Einschub($pass1);
$chiff->setKey2Einschub($pass2);
$crypt = $fremd;
$encrypt = $klar;
if (isset($_POST['decode'])) {
    $encrypt = strtoupper($chiff->getEnCrypt(strtolower($fremd)));
}
if (isset($_POST['encode'])) {
    $crypt = strtoupper($chiff->getCrypt(strtolower($klar)));
}
if (!isset($_POST['decode']) && !isset($_POST['encode']) && $firsttime == TRUE) {
    $crypt = strtoupper($chiff->getCrypt(strtolower($klar)));
}
$form = str_replace('{-orgtxt-}', $encrypt, $form);
Пример #26
0
<?php

include 'functions.php';
$function = new main();
if (isset($_POST["login"])) {
    $a[1] = $_POST["name"];
    $a[2] = $_POST["pass"];
    if ($a[1] != "" && $a[2] != "") {
        $function->login($a[1], $a[2]);
        $fun = $_SESSION["name"];
        if ($_SESSION["name"]) {
            echo '<script>window.location="indes.php";</script>';
        } else {
            echo '<script>alert("not sec");</script>';
        }
    } else {
        echo '<script>alert("please fill all the details");</script>';
    }
}
if (isset($_POST["reg"])) {
    $a[1] = $_POST["name"];
    $a[] = $_POST["pass"];
    if ($a[1] != "" && $a[2] != "") {
        if ($function->register($a[1], $a[2]) > 0) {
            echo '<script>alert("name already exist");</script>';
        } else {
            echo '<script>alert("register sucessfully");</script>';
        }
    } else {
        echo '<script>alert("please fill all the details");</script>';
    }
 public function asignaractividadPS()
 {
     $obj = new asignacionactividadEU();
     $main = new main();
     $data = array();
     $semestre_ultimo = $this->mostrar_semestre_ultimo();
     $facultad_pro = $obj->facultad_profesor($_SESSION['idusuario']);
     $tiene = $obj->detec_asignado($_REQUEST['idevento']);
     $profes = $main->get_datos_profesores_por_facultad($_REQUEST['idevento'], $semestre_ultimo, $facultad_pro['CodigoDptoAcad']);
     $alumn = $obj->get_alum_fac($_REQUEST['idevento']);
     if (empty($tiene)) {
         $obj->insert_profesor_ini($_REQUEST['idevento'], $profes);
         $obj->insertar_alumnos_ini($_REQUEST['idevento'], $alumn);
     }
     $data['profesores'] = $main->get_datos_profesores_por_facultad($_REQUEST['idevento'], $semestre_ultimo, $facultad_pro['CodigoDptoAcad']);
     $prof_select = $data['profesores'];
     foreach ($prof_select as $key => $value) {
         $data['cargo'][$value['CodigoProfesor']] = $this->Select(array('id' => 'cargo_' . $value['CodigoProfesor'], 'name' => 'cargo_[]', 'table' => 'cargo_asistencia_evento', 'code' => $value['id_cargo']));
     }
     //        $data['cargo'] = $this->Select(array('id' => 'id_cargo', 'name' => 'id_cargo', 'table' => 'cargo_asistencia_evento', 'code' => 3));
     $data['alumnosps'] = $obj->get_datos_alumnnos_activi_PS($_REQUEST['idevento']);
     $alumno_selet = $data['alumnosps'];
     foreach ($alumno_selet as $key => $value) {
         $data['cargoA'][$value['CodigoAlumno']] = $this->Select(array('id' => 'cargo_A', 'name' => 'cargo[]', 'table' => 'cargo_asistencia_evento', 'code' => $value['id_cargo']));
     }
     //        $data['profasig'] = $obj->get_prof_asignado($_REQUEST['idevento']);
     $data['externos'] = $obj->get_datos_externo_PS($_REQUEST['idevento']);
     $exter = $data['externos'];
     foreach ($exter as $key => $value) {
         $data['cargoE'][$value['id_externos']] = $this->Select(array('id' => 'cargo_' . $value['id_externos'], 'name' => 'cargote[]', 'table' => 'cargo_asistencia_evento', 'code' => $value['id_cargo']));
     }
     $data['idevento'] = $_REQUEST['idevento'];
     $data['evento'] = $_REQUEST['evento'];
     $view = new View();
     $view->setData($data);
     $view->setTemplate('../view/asignacionactividadEU/asignacion_PS.php');
     echo $view->renderPartial();
 }
Пример #28
0
<?php

include $_SERVER["DOCUMENT_ROOT"] . "/Lib/php/func.object.php";
include $_SERVER["DOCUMENT_ROOT"] . "/Lib/php/main.object.php";
$main = new main();
if (!isset($_GET["page"]) || $_GET["page"] == "") {
    $page = "83";
} else {
    $page = $_GET["page"];
}
$topics = $main->get_record($main->pre . "pages", $page, "topics");
$sql_q = "SELECT * FROM " . $main->pre . "pages WHERE publ='0' AND topics='{$topics}' AND pages=''";
$sql_res = $main->q($sql_q);
$rows = mysql_fetch_array($sql_res);
$pages_name = $rows["pages_name"];
if ($page == "catalog" && isset($id) && !isset($cid)) {
    $title = $main->upfirst($main->get_record($main->pre . "pages", $id, "pages_name"));
    $keywords = "";
    $description = "";
} elseif ($page == "catalog" && isset($id) && isset($cid)) {
    $title = $main->upfirst($main->get_record("catalog_" . $id, $cid, "cat_title"));
    $keywords = "";
    $description = "";
} elseif ($page == "search") {
    $title = "Поиск";
    $keywords = "";
    $description = "";
    $page_name = "Поиск";
} elseif ($page == "299") {
    isset($gpage) && $gpage !== "" ? $gpagename = " - " . $main->get_record("photosgal", $gpage, "galname") : ($gpagename = "");
    $page_name = "Фотогалерея" . $gpagename;
Пример #29
0
 public function client($id = 0)
 {
     if (!$id) {
         $id = $_SESSION['cuser'];
     }
     $id = $this->strip($id);
     $users_query = $this->select("users", array("id", "=", $id), 0, 0, 1);
     if ($this->num_rows($users_query) == 0) {
         $error['Error'] = "Couldn't retrieve client data!";
         $error['Username'] = $id;
         main::error($error);
     } else {
         $all_values = $this->fetch_array($users_query);
         return $all_values;
     }
 }
Пример #30
0
 $input1 = $_POST['input1'];
 $change = false;
 $delete = false;
 if (isset($_POST['input2'])) {
     $input2 = $_POST['input2'];
 }
 if (isset($_POST['change'])) {
     $change = $_POST['change'];
 }
 if (isset($_POST['delete'])) {
     $delete = true;
 }
 require_once "config.php";
 require_once "lib/classes.php";
 $sql = new sql();
 $main = new main();
 if (!$change && !$delete) {
     switch ($type) {
         case 1:
             $query = "INSERT INTO `bt_priority` (`name`,`color`) VALUES ('" . $input1 . "','" . $input2 . "')";
             break;
         case 2:
             $query = "INSERT INTO `bt_section` (`name`) VALUES ('" . $input1 . "')";
             break;
         case 3:
             $query = "INSERT INTO `bt_subtype` (`name`) VALUES ('" . $input1 . "')";
             break;
         case 4:
             $query = "INSERT INTO `bt_status` (`name`) VALUES ('" . $input1 . "')";
             break;
         default: