Class 'SQLiteDatabase' not found in includes\modules\ultimate_seo_urls5\cache_system\sqlite.php on line 99 - oscommerce

in oscommerce we used ULTIMATE Seo Urls 5 Plugin , in this we are facing a issue like When we go to
admin->
Configuration->Seo url5->select your chosen cache system we changed mysql to sqlite when changed home page client site shows Class 'SQLiteDatabase' not found in includes\modules\ultimate_seo_urls5\cache_system\sqlite.php on line 99
at this line i found
protected static function createDatabase() {
if ( !is_readable( self::$sqlite_db_file ) ) {
self::$db = new SQLiteDatabase( self::$sqlite_db_file, 0666, $error )
or trigger_error( 'Failed: ' . $error, E_USER_WARNING );
self::createTables();
} else {
self::$db = new SQLiteDatabase( self::$sqlite_db_file, 0666, $error )
or trigger_error( 'Failed: ' . $error, E_USER_WARNING );
}
}
this how to solve this

In file
includes\modules\ultimate_seo_urls5\cache_system\sqlite.php,
at line 99 Use
self::$db = new SQLite3( self::$sqlite_db_file, 0666, $error );
For both lines for php 5.4 and above
In file
includes/modules/ultimate_seo_urls5/main/usu5.php
at line no 308 use fetchArray() rather fetch() function.
$row = $result->fetchArray();
I have faced the same problem and corrected it by this way. oscommerce version 2.3

Related

My Opencart shows php warning undefined array key

I have a problem with a language extension I recently installed. Now I cannot login in the admin panel and I see these logs:
2022-12-30 16:30:17 - PHP Warning: Undefined array key "" in /var/www/html/opencart/admin-084AQ/controller/startup/language.php on line 21
2022-12-30 16:30:17 - PHP Warning: Trying to access array offset on value of type null in /var/www/html/opencart/admin-084AQ/controller/startup/language.php on line 21
2022-12-30 16:30:17 - PHP Warning: Undefined array key "" in /var/www/html/opencart/admin-084AQ/controller/startup/language.php on line 27
The language.php is:
<?php
namespace Opencart\Admin\Controller\Startup;
class Language extends \Opencart\System\Engine\Controller {
public function index(): void {
$language_data = [];
$this->load->model('localisation/language');
$results = $this->model_localisation_language->getLanguages();
foreach ($results as $result) $language_data[$result['code']] = $result;
// Language not available then use default
$code = $this->config->get('config_language_admin');
if (isset($this->request->cookie['language']) && array_key_exists($this->request->cookie['language'], $language_data)) {
$code = $this->request->cookie['language'];
}
// Set the config language_id
$this->config->set('config_language_id', $language_data[$code]['language_id']);
$this->config->set('config_language_admin', $code);
// Language
$language = new \Opencart\System\Library\Language($code);
if (!$language_data[$code]['extension']) {
$language->addPath(DIR_LANGUAGE);
} else {
$language->addPath(DIR_EXTENSION . $language_data[$code]['extension'] . '/admin/language/');
}
$language->load($code);
$this->registry->set('language', $language);
}
}
Opencart 4.0.1.1
PHP 8.0
Opencart expects the config_language_admin value in the key field of the oc_settings table. But it is most likely saved as config_admin_language there.
So the fix would be to rename config_admin_language to config_language_admin in the database.

Screen scraper script won't write to ouptut file

I can't get the Perl script below to write to the file output.html.
I doesn't need to be a CGI script yet, but that is the ultimate intention.
Can anyone tell me why it isn't writing any text to output.html?
#!/usr/bin/perl
#-----------------------------------------------------------------------
# This script should work as a CGI script, if I get it correctly.
# Most CGI scripts for Perl begin with the same line and must be
# stored in your servers cgi-bin directory. (I think this is set by
# your web server.
#
# This scripts will scrape news sites for stories about topics input
# by the users.
#
# Lara Landis
# Sinister Porpoise Computing
# 1/4/2018
# Personal Perl Project
#-----------------------------------------------------------------------
#global_sites = ();
print( "Starting program.\n" );
if ( !( -e "sitedata.txt" ) ) {
enter_site_info( #global_sites );
}
if ( !( -e "scrpdata.txt" ) ) {
print( "scrpdata.txt does not exist. Creating file now.\n" );
print( "Enter the search words you wish to search for below. Press Ctrl-D to finish.\n" );
open( SCRAPEFILE, ">scrpdata.txt" );
while ( $line = <STDIN> ) {
chop( $line );
print SCRAPEFILE ( "$line\n" );
}
close( SCRAPEFILE );
}
print( "Finished getting site data..." );
scrape_sites( #global_sites );
#----------------------------------------------------------------------
# This routine gets information from the user after the file has been
# created. It also has some basic checking to make sure that the lines
# fed to it are legimate domains. This is not an exhaustive list of
# all domains in existence.
#----------------------------------------------------------------------
sub enter_site_info {
my ( #sisites ) = #_;
$x = 1;
open( DATAFILE, ">sitedata.txt" ) || die( "Could not open datafile.\n" );
print( "Enter websites below. Press Crtl-D to finish.\n" );
while ( $x <= #sisites ) {
$sisites[$x] = <STDIN>;
print( "$sisites[$x] added.\n" );
print DATAFILE ( "$sisites[$x]\n" );
$x++;
}
close( DATAFILE );
return #sisites;
}
#----------------------------------------------------------------------
# If the file exists, just get the information from it. Read info in
# from the sites. Remember to create a global array for the sites
# data.
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# Get the text to find in the sites that are being scraped. This requires
# nested loops. It starts by going through the loops for the text to be
# scraped, and then it goes through each of the websites listend in the
# sitedata.txt file.
#-----------------------------------------------------------------------
sub scrape_sites {
my ( #ss_info ) = #_;
#gsi_info = ();
#toscrape = ();
$y = 1;
#---------------------------
# Working code to be altered
#---------------------------
print( "Getting site info..." );
$x = 1;
open( DATAFILE, "sitedata.txt" ) || die( "Can't open sitedata.txt.txt\n" );
while ( $gsi_info[$x] = <DATAFILE> ) {
chop( $gsi_info[$x] );
print( "$gsi_info[$x]\n" );
$x++;
}
close( DATAFILE );
open( SCRAPEFILE, "scrpdata.txt" ) || die( "Can't open scrpdata.txt\n" );
print( "Getting scrape data.\n" );
$y = 1;
while ( $toscrape[$y] = <SCRAPEFILE> ) {
chop( $toscrape[$y] );
$y++;
}
close( SCRAPEFILE );
print( "Now opening the output file.\n" );
$z = 1;
open( OUTPUT, ">output.html" );
print( "Now scraping sites.\n" );
while ( $z <= #gsi_info ) { #This loop contains SITES
system( "rm -f index.html.*" );
system( "wget $gsi_info[$z]" );
$z1 = 1;
print( "Searching site $gsi_info[$z] for $toscrape[$z1]\n" );
open( TEMPFILE, "$gsi_info[$z]" );
$comptext = <TEMPFILE>;
while ( $comptext =~ /$toscrape[z1]/ig ) { # This loop fetches data from the search terms
print( "Now scraping $gsi_info[$z] for $toscrape[$z1]\n" );
print OUTPUT ( "$toscrape[$z1]\n" );
$z1++;
}
close( TEMPFILE );
$z++;
}
close( OUTPUT );
return ( #gsi_info );
}
You're making assumptions about the current work directory that are often incorrect. You seem to assume the current work directory is the directory in which the script resides, but that's never guaranteed, and it's often / for CGI scripts.
"sitedata.txt"
should be
use FindBin qw( $RealBin );
"$RealBin/sitedata.txt"
There could also be a permission error. You should include the error cause ($!) in your error message when open fails so you know what is causing the problem!
While you're checking some, you're not checking all of your open or system calls. If they fail, the program will keep going without an error message telling you why.
You can add checks to all of these, but it's easy to forget. Instead, use autodie to do the checks for you.
You'll also want to use strict to ensure you haven't made any variable typos, and use warnings to warn you about small mistakes. See this answer for more.
Also #global_sites is empty so enter_site_info() isn't going to do anything. And scrape_sites() does nothing with its argument, #ss_info.
All of these things are helpful. Thank you. I found the problem. I was opening the wrong file. It was putting the error-checking in on the file that let me spot the error. It should have been
open (TEMPFILE, "index.html") || die ("Cannot open index.html\n");
I have taken as many of the suggestions as I remembered and included them in the code. I still need to implement the directory advice, but it should not be difficult.

Sending TWIG output to a zip in Symfony for Templating

I need to create a system that will be able to output a template (a zip with an index.html with all js, css, img etc files as required) based on a set of options (include menu 1, use small footer etc).
So I can put code blocks in so it would not be hard to actually output to the browser the required look, but what if I want to save the rendered html (and this means we would need to change the locations of files like js etc) to a zip instead?
Any ideas? At the moment I'm thinking it would all need to be processed in PHP anyhow (the controller) and TWIG may not be too helpful, but that would make it more complicated.
So I worked this one out, here is the controller to output the required twig zipped:
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
/**
* #Route("/{variableName}", name="homepage"})
*/
public function indexAction($variableName = "Default")
{
//do whatever you need to get the template correct
//send rendered TWIG to a variable
$renderedhtml = $this->render('default/index.html.twig', [
'variableName' => $variableName
])->getContent();
$zipName = "template.zip";
$main = $this->get('kernel')->getRootDir() . '/../web/workingdir/';
$vername = time(); //we use the exact time to get a unique dir name
//remove any projects older than a few minutes (5 in this case)
$dirHandle = opendir($main);
while($item = readdir($dirHandle)){
if(is_dir($main . $item) && $item != '.' && $item != '..') {
if ( ( ( $item + ( 60 * 5 ) ) < $vername ) ) {
system('/bin/rm -rf ' . escapeshellarg($main . $item));
}
}
}
//make the project dir and populate it with files (in this case just the template as index.html, you would want to copy all other files here though)
mkdir($main.$vername);
file_put_contents($main.$vername."/index.html", $renderedhtml);
//create the zip
$zip = new \ZipArchive();
$zip->open($zipName, \ZipArchive::CREATE);
$zip = $this->createZip($zip, $main.$vername);
$zip->close();
//get the zip ready to return
header('Content-Type', 'application/zip');
header('Content-disposition: attachment; filename="' . $zipName . '"');
header('Content-Length: ' . filesize($zipName));
readfile($zipName);
}
// Create a zip with zip object and root dir params (find and include sub-dirs with content)
private function createZip($zip, $source) {
$source = str_replace('\\', '/', realpath($source));
if (is_dir($source) === true) {
$files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source), \RecursiveIteratorIterator::SELF_FIRST);
foreach ($files as $file) {
$file = str_replace('\\', '/', $file);
if( in_array(substr($file, strrpos($file, '/')+1), array('.', '..')) )
continue;
$file = realpath($file);
if (is_dir($file) === true)
{
$zip->addEmptyDir(str_replace($source . '/', '', $file . '/'));
}
else if (is_file($file) === true)
{
$zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file));
}
}
}
return $zip;
}
}
Once you get it to this stage, you will just have to add any other required files into the working dir, but I think that could be done under a different issue, this one is about getting the website into a html in a zip.
Hope this helps someone.

How to pass project number to manifest.json

I am building a web push WordPress plugin and I want to pass project number from form input field to manifest.json file
which is included in index.php as
<link rel="manifest" href="/manifest.json">
Disclaimer: I'm the author of this plugin.
Instead of building your own from scratch, you could contribute to the already existing https://github.com/mozilla/wp-web-push.
If you want to build your own, you can check the source of that plugin out to see how we have implemented it.
We've built a class to handle it: https://github.com/marco-c/wp-web-app-manifest-generator.
You cannot pass any param to the manifest.json. You must genarate it as a static file when the form is submitted.
Here's the code that we have used for the Pushpad plugin:
if (file_exists ( ABSPATH . 'manifest.json' )) {
$oldManifestJson = file_get_contents ( ABSPATH . 'manifest.json' );
} else {
$oldManifestJson = '{}';
}
$data = json_decode ( $oldManifestJson, true );
$data ['gcm_sender_id'] = $settings ['gcm_sender_id'];
$data ['gcm_user_visible_only'] = true;
$newManifestJson = json_encode ( $data );
if ( is_writable ( ABSPATH . 'manifest.json' ) || !file_exists ( ABSPATH . 'manifest.json' ) && is_writable ( ABSPATH ) ) {
file_put_contents ( ABSPATH . 'manifest.json', $newManifestJson );
} else {
// display an error
}

Fatal error: Call to a member function getUserStateFromRequest() on a non-object in administrator\components\com_jquarks\models\quizzes.php on line 60

i am using joomla 2.5 and i want to create some tests for my students, so that's why i just downloaded JQuarks plugin and installed. But when i go to Components/JQuarks through administration panel it shows me this error!!
Fatal error: Call to a member function getUserStateFromRequest() on a non-object in administrator\components\com_jquarks\models\quizzes.php on line 60
So, i go to on line 60 .
Here's the code:
function getQuizzes()
{
if (empty( $this->_quizzes ))
{
global $mainframe ;
$context = 'com_jquarks.quizzes.list.' ;
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
$limitstart = $mainframe->getUserStateFromRequest( $context.'limitstart', 'limitstart', 0, 'int') ;
$this->_filter_order = $mainframe->getUserStateFromRequest( $context.'filter_order', 'filter_order', 'title', 'cmd' );
$this->_filter_order_Dir = $mainframe->getUserStateFromRequest( $context.'filter_order_Dir', 'filter_order_Dir', '', 'word' );
$orderby = '' ;
if($this->_filter_order_Dir) {
$orderby = ' ORDER BY '.$this->_filter_order.' '.$this->_filter_order_Dir ;
}
$query = ' SELECT quizzes.*, g.name AS groupname' .
' FROM #__jquarks_quizzes AS quizzes' .
' LEFT JOIN #__groups AS g ON g.id = quizzes.access_id' .
$orderby ;
$total = $this->_getListCount($query) ;
jimport('joomla.html.pagination') ;
$this->_pageNav = new JPagination( $total, $limitstart, $limit ) ;
$this->_db->setQuery($query) ;
$this->_quizzes = $this->_getList( $query, $this->_pageNav->limitstart, $this->_pageNav->limit );
if ($this->_db->getErrorNum()) {
return false;
}
}
return $this->_quizzes ;
}
Please help to fix this problem!!!
Thanks in advance.
I fixed a problem. Problem is the version of the Jquarks plugin was 0.2.4 and my joomla's version is 2.5. So i looked up from internet ,JQuarks 0.2.4 is for joomla 1.5 version not for joomla 2.5 . Then i just downloaded another plugin called ARI Quiz Lite to create some exams for my students. This plugin is for joomla 1.5,2.5 and 3.0 . Now its working.....:)