179 shaares
3 results
tagged
php
INSTALL
get mybb-1.8.19.tgz & put it in $path_install
domain="17112018.fr"
subdomain="forum"
path_install="/var/share/www/17112018.fr"
path="$path_install/forum"
version="1.8.19"
file_mybb="mybb-${version}"
cd "$path_install"
tar xzf "${file_mybb}.tgz"
ln -sv "$file_mybb" "$subdomain"
ln -sv "$file_mybb/Upload/" "$subdomain"
PRECONF
cp -a "$subdomain/htaccess.txt" "$subdomain/.htaccess"
sed -i '/Order Deny,Allow/d' "$subdomain/.htaccess"
sed -i 's/Deny from all/Require all denied/' "$subdomain/.htaccess"
# add subdomain in apache conf
nano /etc/apache2/sites-available/$domain.conf
sysars
a2ensite ${domain}.conf
SETUP
https://${subdomain}.${domain} # launch
POSTCONF
systemctl restart apache2.service
nano inc/config.php
chmod 666 "$subdomain/inc/config.php" "$subdomain/inc/settings.php"
chmod 777 "$subdomain/cache/" "$subdomain/cache/themes/" "$subdomain/uploads/" "$subdomain/uploads/avatars/"
phpquery
print informations about php version & modules
-v version -s sapi_name -M
-V # list all available versions of php client
-v $version -S # list all available sapi
-v $version -S $sapi -M # list all available modules
-v $version -s $sapi -m $module # return informations about module $module
tests the availability of the module
phpquery -q -v $version -s $sapi -m $module && echo YES
get content from links - for shaarli
// use DOMXPath
function file_get_contents_utf8($url) {
$content = file_get_contents($url);
return mb_convert_encoding($content, 'UTF-8',
mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
}
//if (empty($charset)) echo "EMPTY".'', PHP_EOL;
//$dom->loadHTMLFile($url, LIBXML_NOWARNING | LIBXML_NOERROR);
$url="http://code.ambau.ovh/snippets/bash_network.html";
$dom = new DOMDocument();
$html = file_get_contents_utf8($url);
$dom->loadHTML($html, LIBXML_NOWARNING | LIBXML_NOERROR);
$xpath = new DOMXPath($dom);
$html_data = array('title','tags','code');
// title
foreach($xpath->evaluate("//title") as $node) {
$html_data['title'] = $node->nodeValue;
}
// tags
foreach($xpath->evaluate("//body['class']") as $node) {
$html_data['tags'] = $node->getAttribute('class');
}
// description
foreach($xpath->evaluate("//code") as $node) {
$html_data['code'][] = $node->nodeValue;
}
// print
echo "".$html_data['title'].'', PHP_EOL;
echo "tags=".$html_data['tags'].'', PHP_EOL;
foreach($html_data['code'] as $code) echo ''.$code.'', PHP_EOL;
// use DOMDocument
$title = $dom->getElementsByTagName('title')->item(0);
if (!is_null($title)) echo ''.$title->nodeValue.'', PHP_EOL;
# tags
$node = $dom->getElementsByTagName('body')->item(0);
if ($node->hasAttribute('class')) {
$tags = $node->getAttribute('class');
echo "tags=$tags".'', PHP_EOL;
} else echo "no class attribute";
$code = ;
foreach ($dom->getElementsByTagName('code') as $node) { echo ''.$node->nodeValue.'', PHP_EOL; }