Skip to content

Instantly share code, notes, and snippets.

function page_title_error()
{
$favorite=@$this->content['favorite'];
if (isset($favorite))
$this->output('<form '.$favorite['form_tags'].'>');
echo 'Template: ' . $this->template . ' ';
switch ($this->template) {
case 'qa':
function title()
{
if (isset($this->content['title'])) {
$this->output($this->content['title']);
if (isset($this->content['q_view']['closed']) && !empty($this->content['q_view']['closed']))
$this->output(' [' . qa_lang_html('main/closed') . ']');
}
}
function q_item_title($q_item)
require_once QA_INCLUDE_DIR.'qa-db-selects.php';
require_once QA_INCLUDE_DIR.'qa-db-admin.php';
$query = "SHOW INDEX FROM ^messages WHERE key_name = 'tohidden'";
$result = qa_db_read_one_value(qa_db_query_sub($query), true);
$shouldRun = !isset($result);
if ($shouldRun) {
echo "Running the update...<br>";
qa_db_query_sub('DROP INDEX fromhidden on ^messages');
qa_db_query_sub('ALTER TABLE qa_messages ADD KEY fromhidden (fromhidden), ADD KEY tohidden (tohidden)');
function ranking($ranking)
{
$this->part_title($ranking);
$class=(@$ranking['type']=='users') ? 'qa-top-users' : 'qa-top-tags';
$rows=min($ranking['rows'], count($ranking['items']));
if ($rows>0) {
$this->output('<table class="'.$class.'-table">');
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR.'qa-db-selects.php';
$populartags=qa_db_single_select(qa_db_popular_tags_selectspec(0, (int)qa_opt('tag_cloud_count_tags')));
reset($populartags);
$maxcount=current($populartags);
$themeobject->output(
function stripAnchors($text) {
return preg_replace("/<a.*?>(.*?)?<\/a>/im", "$1", $text);
}
function post_meta($post, $class, $prefix=null, $separator='<br/>') {
$this->output('<span class="'.$class.'-meta">');
if (isset($prefix))
$this->output($prefix);
function doctype(){
if ($this->template === 'question' && isset($this->content['q_view'])) {
$this->addCategoryPrefixToTitleInList($this->content['q_view'], isset($this->content['title']));
}
qa_html_theme_base::doctype();
}
function addCategoryPrefixToTitleInList(&$q_item, $shouldChangeTitle) {
if (isset($q_item['raw']['categoryid'], $q_item['raw']['categoryname'], $q_item['title'])) {
$categoryId = $q_item['raw']['categoryid'];
<?php
/*
Plugin Name: On-Site-Notifications
Plugin URI: http://www.q2apro.com/plugins/on-site-notifications
Plugin Description: Facebook-like / Stackoverflow-like notifications on your question2answer forum that can replace all email-notifications.
Plugin Version: 1.0
Plugin Date: 2014-03-29
Plugin Author: q2apro.com
Plugin Author URI: http://www.q2apro.com/
Plugin License: GPLv3
@pupi1985
pupi1985 / qa-theme.php
Created November 11, 2014 17:47
Gmail SMTP email test using fsockopen
function doctype() {
if (qa_get_logged_in_handle() === 'admin') {
echo "Starting tests...<br>\n";
if(!fsockopen("www.google.com", 80, &$errno, &$errstr, 15))
echo "www.google.com 80 - $errstr ($errno)<br>\n";
else
echo "www.google.com 80 - ok<br>\n";
if(!fsockopen("smtp.gmail.com", 465, &$errno, &$errstr, 15))
echo "smtp.gmail.com 465 - $errstr ($errno)<br>\n";
@pupi1985
pupi1985 / gist:8c7870e90567c3b308be
Created April 16, 2015 03:03
Brute force tests
$permits = array(
QA_PERMIT_ALL => 'QA_PERMIT_ALL',
QA_PERMIT_USERS => 'QA_PERMIT_USERS',
QA_PERMIT_CONFIRMED => 'QA_PERMIT_CONFIRMED',
QA_PERMIT_POINTS => 'QA_PERMIT_POINTS',
QA_PERMIT_POINTS_CONFIRMED => 'QA_PERMIT_POINTS_CONFIRMED',
QA_PERMIT_APPROVED => 'QA_PERMIT_APPROVED',
QA_PERMIT_APPROVED_POINTS => 'QA_PERMIT_APPROVED_POINTS',
QA_PERMIT_EXPERTS => 'QA_PERMIT_EXPERTS',
QA_PERMIT_EDITORS => 'QA_PERMIT_EDITORS',