function getLatestVersion() { global $JVVERSION; if (isset($_SESSION['latest_version'])) { $latest_version = $_SESSION['latest_version']; } else { global $JVPRODUCTKEY; $req = 'type=product_name'; $req .= '&key=com_javoice'; $req .= '&jversion=1.6'; //$req .= '¤t_version='.$JVVERSION; $host = 'www.joomlart.com'; $path = '/forums/getlatestversion.php'; $URL = "http://{$host}{$path}"; $latest_version = ''; if (!function_exists('curl_version')) { if (stristr(ini_get('disable_functions'), "fsockopen")) { return; } else { $latest_version = @JAVoiceHelpers::socket_getdata($host, $path, $req); } } else { $latest_version = @JAVoiceHelpers::curl_getdata($URL, $req); } } $_SESSION['latest_version'] = $latest_version; return $latest_version; }
/** * This function dieplays email preference center. */ function display_email_notification_references() { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $this->assignRef('user', $user); $object = array(); $k = 0; $object[$k] = new stdClass(); $object[$k]->id = '#jav-mainbox-emailref'; $object[$k]->attr = 'html'; $object[$k]->content = $this->loadTemplate('emailref'); $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($object); exit; }
function saveIFrame() { $errors = array(); $id = $this->save($errors); $helper = new JAVoiceHelpers(); $objects = array(); if ($id) { $objects[] = $helper->parseProperty("reload", "#reload" . $item->id, 1); $message[] = JText::_("SAVE_DATA_SUCCESSFULLY"); $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, $message)); } else { $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $errors)); } $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($objects); exit; }
/** * Constructor */ function __construct($default = array()) { parent::__construct($default); if (!JAVoiceHelpers::checkPermission(array('core.admin'))) { JError::raiseWarning(1001, 'You have no permission this task'); $this->setRedirect('index.php?option=com_javoice&view=voice'); return FALSE; } $this->registerTask('apply', 'save'); }
function postflight($type, $parent) { if (version_compare(JVERSION, '3.0.0', '>')) { require_once JPATH_SITE . '/components/com_javoice/helpers/jahelper.php'; JAVoiceHelpers::Install_Db(); $messages = array(); // Import required modules jimport('joomla.installer.installer'); jimport('joomla.installer.helper'); jimport('joomla.filesystem.file'); // Get packages $p_dir = JPath::clean(JPATH_SITE . '/components/com_javoice/packages'); // Did you give us a valid directory? if (!is_dir($p_dir)) { $messages[] = JText::_('Package directory(Related modules, plugins) is missing'); } else { $subpackages = JFolder::files($p_dir); $result = true; $installer = new JInstaller(); if ($subpackages) { $app = JFactory::getApplication(); $templateDir = 'templates/' . $app->getTemplate(); foreach ($subpackages as $zpackage) { if (JFile::getExt($p_dir . DS . $zpackage) != "zip") { continue; } $subpackage = JInstallerHelper::unpack($p_dir . DS . $zpackage); if ($subpackage) { $type = JInstallerHelper::detectType($subpackage['dir']); if (!$type) { $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" /> <span style="color:#FF0000;">' . JText::_($zpackage . " Not valid package") . '</span>'; $result = false; } if (!$installer->install($subpackage['dir'])) { // There was an error installing the package $messages[] = '<img src="' . $templateDir . '/images/admin/publish_x.png" alt="" width="16" height="16" /> <span style="color:#FF0000;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Error')) . '</span>'; } else { $messages[] = '<img src="' . $templateDir . '/images/admin/tick.png" alt="" width="16" height="16" /> <span style="color:#00FF00;">' . JText::sprintf('Install %s: %s', $type . " " . JFile::getName($zpackage), JText::_('Success')) . '</span>'; } if (!is_file($subpackage['packagefile'])) { $subpackage['packagefile'] = $p_dir . DS . $subpackage['packagefile']; } if (is_dir($subpackage['extractdir'])) { JFolder::delete($subpackage['extractdir']); } if (is_file($subpackage['packagefile'])) { JFile::delete($subpackage['packagefile']); } } } } JFolder::delete($p_dir); } } }
function addnew() { global $javconfig; $tags = JRequest::getVar("taglist", ""); if ($tags) { $list = explode($javconfig['systems']->get('characters_separating_tags', ','), $tags); $model = $this->getModel('tags'); $post = array(); $tags = ""; $objects = array(); $helper = new JAVoiceHelpers(); $k = 0; foreach ($list as $i => $item) { $id = $model->checkExistTag($item); if (!$id) { $post["name"] = $item; $post["published"] = 1; $post["id"] = 0; if ($i == 0) { $tags .= $post["name"]; } else { $tags .= $javconfig['systems']->get('characters_separating_tags', ',') . $post["name"]; } $id = $model->save($post, 1); $object[$k] = new stdClass(); $object[$k]->id = $id; $object[$k]->type = $item; $k++; } else { $object[$k] = new stdClass(); $object[$k]->id = $id; $object[$k]->type = $item; $k++; } } $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($object); exit; } else { exit; } }
function setEmailNotificationReferences() { $db = JFactory::getDBO(); $user = JFactory::getUser(); if ($user->id) { $user->setParam('votedVoiceUpdateNotification', JRequest::getInt("votedVoiceUpdateNotification", 0)); $user->setParam('receive', JRequest::getInt("receive", 0)); $user->setParam('often', JRequest::getInt('often', 0)); $user->save(); } $object = array(); $k = 0; $object[$k] = new stdClass(); $object[$k]->id = '#jav-email-preference .jav-msg-successful'; $object[$k]->attr = 'html'; $object[$k]->content = JText::_('SAVING_SUCCESSFULL'); $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($object); exit; }
/** * Save categories record */ function save() { $option = JRequest::getCmd('option'); // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $content = JRequest::getVar('content', '', 'post', 'string', JREQUEST_ALLOWRAW); $file = JRequest::getVar('file', ''); $folder = JRequest::getVar('folder', ''); $template = JAVoiceHelpers::checkFileTemplate($file, 'html', $folder); if ($template) { $path = $template; } else { $path = JPATH_COMPONENT_SITE . DS . 'views' . DS . $folder . DS . 'tmpl' . DS . $file; } $msg = ''; if (JFile::exists($path)) { $res = JFile::write($path, $content); if ($res) { $msg = JText::_('SAVE_DATA_SUCCESSFULLY') . ': ' . $file; } else { JError::raiseWarning(1001, JText::_("ERROR_OCCURRED_DATA_NOT_SAVED") . " " . $file); } } else { JError::raiseWarning(1001, JText::_("FILE_NOT_FOUND_TO_EDIT")); } switch ($this->_task) { case 'apply': $this->setRedirect("index.php?option={$option}&view=customtmpl&task=edit&file={$file}&folder={$folder}", $msg); break; case 'save': default: $this->setRedirect("index.php?option={$option}&view=customtmpl", $msg); break; } return TRUE; }
//$editor =& JFactory::getEditor(); $mess = $this->mess; $user = JFactory::getUser(); $isAllowUpload = 0; if (isset($this->item) && $this->item->id) { $userAdd = JFactory::getUser($this->item->user_id); if ($this->is_attach_image) { $isAllowUpload = 1; } } else { if ($this->is_attach_image) { $isAllowUpload = 1; } } global $javconfig; $helper = new JAVoiceHelpers(); $listFile = $helper->preloadfile($this->item->id, "admin"); ?> <script type="text/javascript"> <?php if ($javconfig["systems"]->get("is_enable_tagging", 0)) { ?> var jav_tag_config = { tag_minimum_length:<?php echo $javconfig['systems']->get('tag_minimum_length', 4); ?> , tag_maximum_length:<?php echo $javconfig['systems']->get('tag_maximum_length', 4); ?> ,
* Author: J.O.O.M Solutions Co., Ltd * Websites: http://www.joomlart.com - http://www.joomlancers.com * ------------------------------------------------------------------------ */ defined('_JEXEC') or die('Restricted access'); global $javconfig; $Itemid = JRequest::getInt('Itemid'); if (!$Itemid) { $Itemid = JAVoiceHelpers::get_Itemid(array('option' => 'com_javoice', 'view' => 'items')); } $items = $this->items; $user = JFactory::getUser(); $model_status = JAVBModel::getInstance('voicetypesstatus', 'javoiceModel'); $list_status = $model_status->getListTreeStatus(); $sytem_comment = isset($javconfig['integrate']) ? $javconfig['integrate']->get('run_system', 'intensedebate') : 'intensedebate'; $helper = new JAVoiceHelpers(); $isSepecialUse = JAVoiceHelpers::checkPermissionAdmin(); if ($sytem_comment == 'jcomments') { $jcomment = JAVoiceHelpers::checkComponent('com_jcomments'); $this->jcomments = $jcomment; } elseif ($sytem_comment == 'jacomment') { $jacomment = JAVoiceHelpers::checkComponent('com_jacomment'); $this->jacomment = $jacomment; } if ($items) { if (isset($this->show_suggest) && $this->show_suggest) { if (JRequest::getVar("pagingtype", "") != "autoscroll") { ?> <h1><?php echo JText::_('ALREADY_EXISTS_SOME_IDEAS_SIMILAR_TO_YOUR_IDEAS'); ?>
function writeLogChange($old_stauts_id, $item) { $url = JURI::root(); $path = JPATH_COMPONENT_SITE . DS . "asset" . DS . "emails" . DS . "change"; $filename = $path . DS . 'emails_' . $item->id . "_" . time() . '.ini'; if (!file_exists($filename)) { $users = $this->getLog($item->id); if ($users) { if (intval($item->voice_type_status_id) != intval($old_stauts_id)) { $helper = new JAVoiceHelpers(); $mail = $helper->getEmailTemplate("Javnotify_to_user_item_change_status"); if (!$mail) { return FALSE; } $header = $helper->getEmailTemplate("mailheader"); $footer = $helper->getEmailTemplate("mailfooter"); $mailcontent = $header->emailcontent . "\n" . $mail->emailcontent . "\n\n" . $footer->emailcontent; $filters = $helper->getFilterConfig(); $model_item = JAVBModel::getInstance('items', 'javoiceModel'); $model_item->parseItem($item); $filters["ITEM_TITLE"] = $item->title; $link = $_SERVER['HTTP_HOST'] . str_replace($_SERVER['HTTP_HOST'], '', JRoute::_("index.php?option=com_javoice&view=items&layout=item&cid={$item->id}&type={$item->voice_types_id}&forums={$item->forums_id}")); $filters['ITEM_TITLE_WITH_LINK'] = "<a href=\"{$link}\">" . $item->title . "</a>"; $filters["ITEM_FORUM"] = $item->ftitle; $filters["ITEM_VOICE_TYPE"] = $item->ttitle; $filters["ITEM_DESCRIPTON"] = $item->content; $filters["ITEM_CREATE_DATE"] = date('d/M/Y', $item->create_date); $user = JFactory::getUser($item->user_id); $filters["ITEM_CREATE_BY"] = $user->username; $filters["ITEM_NUM_OF_VOTERS"] = $item->number_vote_up + $item->number_vote_down; $filters["ITEM_NUM_OF_VOTERS_DOWN"] = $item->number_vote_down . ", "; $filters["ITEM_TOTAL_VOTE_DOWN"] = $item->total_vote_down; $filters["ITEM_NUM_OF_VOTERS_UP"] = $item->number_vote_up . ", "; $filters["ITEM_TOTAL_VOTE_UP"] = $item->total_vote_up; $filters["ITEM_NEW_STATUS_WITH_COLOR"] = "<span style='background:{$item->class_css}'>" . $item->stitle . "</span>"; $filters["ITEM_NEW_STATUS"] = $item->stitle; $old_status = $this->getItem($old_stauts_id); if ($old_status->title == '') { $old_status->class_css = ''; $old_status->title = JText::_('HAVING_NO_STATUS'); } $filters["ITEM_OLD_STATUS"] = "<span style='background:{$old_status->class_css}'>" . $old_status->title . "</span>"; $subject = $mail->subject ? $mail->subject : ''; if (is_array($filters)) { foreach ($filters as $key => $value) { $subject = str_replace("{" . $key . "}", $value, $subject); $mailcontent = str_replace("{" . $key . "}", $value, $mailcontent); } } $details = ''; $mailcontent = str_replace("\n", "###", $mailcontent); $details .= "subject=" . $subject; $details .= "\nmailcontent={$mailcontent}"; $user = implode(",", $users); $details .= "\nuser_id={$user}"; $details .= "\nold_status_id=" . $old_stauts_id; $model_sendmail = JAVBModel::getInstance('sendmail', 'javoiceModel'); $model_sendmail->writeLogFileChange($details, $filename); } } } }
function menu() { global $JVVERSION; $latest_version = ''; $version_link = JAVoiceHelpers::get_Version_Link(); $layout = JRequest::getVar('layout', 'statistic'); $cid = JRequest::getVar('cid'); if (is_array($cid)) { JArrayHelper::toInteger($cid); $cid = $cid[0]; } $latest_version = $this->get('LatestVersion'); if ($latest_version) { $version_link['latest_version']['info'] = 'http://wiki.joomlart.com/wiki/JA_Voice/Overview'; $version_link['latest_version']['upgrade'] = 'http://www.joomlart.com/forums/downloads.php?do=cat&id=139'; $iLatest_version = str_replace('.', '', $latest_version); $iLatest_version = trim($iLatest_version); $iLatest_version = intval($iLatest_version); } else { $version_link['latest_version']['info'] = ''; $version_link['latest_version']['upgrade'] = ''; } //$xml = JFactory::getXMLParser( 'simple' ); $xml = new JSimpleXML(); $file = JPATH_COMPONENT . '/javoice.xml'; $xml->loadFile($file); $out = $xml->document; if ($out == false) { $current_version = $JVVERSION; } else { $allComments = $out->children(); foreach ($allComments as $blogpost) { if ($blogpost->name() == "version") { $current_version = $blogpost->data(); break; } } } $iCurrent_version = str_replace('.', '', $current_version); $iCurrent_version = trim($iCurrent_version); $iCurrent_version = intval($iCurrent_version); ?> <fieldset class="adminform"> <div class="submenu-box"> <div class="submenu-pad"> <ul id="submenu" class="configuration"> <li><a href="index.php?option=com_javoice&layout=statistic" class="<?php if ($layout == null || $layout == 'statistic') { echo 'active'; } ?> "> <?php echo JText::_('STATISTICS'); ?> </a></li> <li><a href="index.php?option=com_javoice&layout=supportandlicense" class="<?php if ($layout == 'supportandlicense' || $layout == 'verify') { echo 'active'; } ?> "> <?php echo JText::_('DOCUMENTATION_AND_SUPPORT'); ?> </a></li> <li style="float: right;line-height:30px;"> <?php if (empty($iLatest_version)) { echo JText::_('VERSION') . ' <b>' . $current_version . '</b>'; } elseif (!empty($iLatest_version) && $iLatest_version <= $iCurrent_version) { echo JText::_('YOUR_VERSION') . ': <b><a href="' . $version_link['current_version']['info'] . '" target="_blank">' . $current_version . '</a></b> ' . JText::_('LATEST_VERSION') . ': <b><a href="' . $version_link['latest_version']['info'] . '" target="_blank">' . $latest_version . '</a></b> <font color="Blue"> <i>(' . JText::_('SYSTEM_RUNNING_THE_LATEST_VERSION') . ')</i></font>'; } elseif (!empty($iLatest_version) && $iLatest_version > $iCurrent_version) { echo JText::_('YOUR_VERSION') . ': <b><a href="' . $version_link['current_version']['info'] . '" target="_blank">' . $current_version . '</a></b> ' . JText::_('LATEST_VERSION') . ': <b>'; echo isset($version_link['latest_version']) ? '<a href="' . $version_link['latest_version']['info'] . '" target="_blank">' . $latest_version . '</a>' : $latest_version; echo '</b> <span style="background-color:rgb(255,255,0);color:Red;font-weight:bold;">' . JText::_('NEW_VERSION_AVAILABLE') . '</span>'; if (isset($version_link['latest_version'])) { echo '<a target="_blank" href="' . $version_link['latest_version']['upgrade'] . '" title="' . JText::_('CLICK_HERE_TO_DOWNLOAD_LATEST_VERSION') . '">' . JText::_('UPGRADE_NOW') . '</a>'; } } ?> </li> </ul> <div class="clr"></div> </div> </div> <div class="clr"></div> </fieldset> <?php }
function sendMailChangeStatus() { $delete = FALSE; $model_sendmail = JModel::getInstance('sendmail', 'javoiceModel'); if ($model_sendmail->checkIn()) { $path = JPATH_COMPONENT_SITE . DS . "asset" . DS . "emails" . DS . "change"; $params = $model_sendmail->readFile($path); if ($params) { $user_id = $params->get('user_id', ''); if ($user_id != '') { $user_ids = explode(',', $user_id); } if ($user_ids) { $count = count($user_ids); if ($count > 0) { $helper = new JAVoiceHelpers(); $subject = $params->get('subject', ''); $mailcontent = $params->get('mailcontent', ''); $mailcontent = str_replace("###", "\n", $mailcontent); $n = 100; if (100 >= $count) { $n = $count; $delete = TRUE; } $del_user_ids = array(); for ($i = 0; $i < $n; $i++) { $del_user_ids[$i] = $user_ids[$i]; $user = JFactory::getUser($user_ids[$i]); $email = $user->email; $nameto = $user->username; $filters = array(); $filters['{USERS_USERNAME}'] = $user->username; $filters['{USERS_EMAIL}'] = $user->email; $link .= JRoute::_("index.php?option=com_javoice&view=users&uid={$user->id}&tab=2"); $filters['{EMAIL_PREFERENCE_LINK}'] = "<a href=\"{$link}\">" . JText::_("TURN_OFF_OR_EDIT_YOUR_EMAIL_NOTIFICATIONS") . "<a>"; $helper->sendmail($email, $nameto, $subject, $mailcontent, $filters, '', '', '', FALSE); } } else { $delete = TRUE; } } else { $delete = TRUE; } } else { $delete = TRUE; } if ($delete) { $model_sendmail->deleteFile(); } else { $new_user = array_diff($user_ids, $del_user_ids); $new_user = implode(",", $new_user); $params->set('user_id', $new_user); $content = $params->toString(); $model_sendmail->writeLogFileChange($content); } } }
/** * Display edit form */ function displayForm() { $option = JRequest::getCmd('option'); $file = JRequest::getVar('file', ''); $template = JAVoiceHelpers::checkFileTemplate($file); $content = ''; if ($template) { $content = JFile::read($template); } else { $filename = JPATH_COMPONENT_SITE . '/asset/css/' . $file; if (JFile::exists($filename)) { $content = JFile::read($filename); } } $this->assignRef('content', $content); $this->assignRef('file', $file); $this->assignRef('filename', $filename); $this->assignRef('option', $option); }
/** * Enter description here... * * @param unknown_type $key * @param unknown_type $action * @return unknown */ function verify_new_license_key($email = '', $payment_id = '', $action = true) { global $javconfig; $mainframe = JFactory::getApplication(); $db = JFactory::getDBO(); if (isset($_SESSION[md5($_SERVER['HTTP_HOST'] . 'javcheking')])) { unset($_SESSION[md5($_SERVER['HTTP_HOST'] . 'javcheking')]); } $domain = $_SERVER['HTTP_HOST']; $base = $mainframe->getSiteUrl(); if (!$email) { $email = $javconfig["license"]->get("email"); $payment_id = $javconfig["license"]->get("payment_id"); } if (!$email || !$domain) { return FALSE; } if (strtolower(substr($domain, 0, 3)) == 'www') { $domain = substr($domain, strpos($domain, '.') + 1); } $req = 'domain=' . $domain; //$req .= '&key=' . rawurlencode ( $key ); $req .= '&email=' . rawurlencode($email); $req .= '&payment_id=' . rawurlencode($payment_id); //$req .= '&base=' . rawurlencode ( $base ); $req .= '&action=verify_license_javoice'; $URL = "http://{$this->host}{$this->path}"; if (!function_exists('curl_version')) { if (!ini_get('allow_url_fopen')) { JError::raiseWarning(1, JText::_('YOUR_LICENSE_KEY_COULD_NOT_BE_VERIFIED_PLEASE_CHECK_YOUR_INTERNET_CONNECTION_AND_TRY_AGAIN_KINDLY_TRY_ANOTHER_METHOD_TO_CONTINUE_____JTEXT___OR_CONTACT_JOOMLART_FOR_FURTHER_ASSISTANCE')); return; } else { $result = JAVoiceHelpers::socket_getdata($this->host, $this->path, $req); } } else { $result = JAVoiceHelpers::curl_getdata($URL, $req); } if (!$result) { //Not connected to server if ($action) { JError::raiseWarning(1, JText::_('UNABLE_TO_CONNECT_TO_THE_SERVER_BY_JOOMLART_PLEASE_CHECK_YOUR_INTERNET_CONNECTION')); return; } else { if (isset($_SESSION[md5($_SERVER['HTTP_HOST'] . 'JAVOICE_UNVALID_LICENSE')])) { unset($_SESSION[md5($_SERVER['HTTP_HOST'] . 'JAVOICE_UNVALID_LICENSE')]); } if (isset($_SESSION[md5($_SERVER['HTTP_HOST'] . 'javcheking')])) { unset($_SESSION[md5($_SERVER['HTTP_HOST'] . 'javcheking')]); } return true; } } else { $result = json_decode($result, true); $statusMes = $result["status"]; switch ($statusMes) { case 'invalid_domain': $this->updateFail(); JError::raiseWarning(1, JText::_('YOUR_DOMAIN_IS_NOT_ACCEPTED_THEREFORE_THE_SYSTEM_WILL_BE_DISABLED_PLEASE_CONTACT') . ' <a href="http://joomlart.com">JoomlArt</a> ' . JText::_('FOR_FURTHER_ASSISTANCE')); return; break; case 'expired': $this->updateFail(); JError::raiseWarning(1, JText::_('YOUR_LICENSE_HAS_EXPIRED_THEREFORE_THE_SYSTEM_WILL_BE_DISABLED_PLEASE_CONTACT') . ' <a href="http://joomlart.com">JoomlArt</a> ' . JText::_('FOR_FURTHER_ASSISTANCE')); return; break; case 'invalid_payment_id': $this->updateFail(); JError::raiseWarning(1, JText::_('YOUR_PAYMENT_IS_NOT_CORRECTED_FOR_THIS_PRODUCT_PLEASE_CONTACT') . ' <a href="http://joomlart.com">JoomlArt</a> ' . JText::_('FOR_FURTHER_ASSISTANCE')); return; break; case 'payment_not_completed': $this->updateFail(); JError::raiseWarning(1, JText::_('YOUR_PAYMENT_IS_NOT_COMPLETED_PLEASE_CONTACT') . ' <a href="http://joomlart.com">JoomlArt</a> ' . JText::_('FOR_FURTHER_ASSISTANCE')); return; break; case 'disabled_domain': $this->updateFail(); JError::raiseWarning(1, JText::_('YOUR_DOMAIN_IS_DISABLED')); return; break; case 'limited_domain': $this->updateFail(); JError::raiseWarning(1, JText::_('LIMITED_DOMAIN')); return; break; case 'invalid_member': $this->updateFail(); JError::raiseWarning(1, JText::_('YOUR_PAYMENT_IS_NOT_CORRECTED_FOR_THIS_MEMBER_PLEASE_CONTACT') . ' <a href="http://joomlart.com">JoomlArt</a> ' . JText::_('FOR_FURTHER_ASSISTANCE')); return; break; case 'successful': $this->updateSuccess($payment_id, $email, $result["product_type"]); $mainframe->redirect('index.php?option=com_javoice&view=voice&layout=supportandlicense'); break; case 'error': default: JError::raiseWarning(1, JText::_('HAVE_AN_ERROR_WHEN_PROCESSING_PLEASE_TRY_AGAIN')); return; break; } } return; }
if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } JLoader::register('JAVBController', JPATH_COMPONENT . '/controllers/controller.php'); JLoader::register('JAVBView', JPATH_COMPONENT . '/views/view.php'); JLoader::register('JAVBModel', JPATH_COMPONENT . '/models/model.php'); if (version_compare(JVERSION, '3.0', 'ge')) { require_once JPATH_COMPONENT . "/asset/simplexml.php"; } /* * Make sure the user is authorized to view this page */ /* Require Helper */ require_once JPATH_SITE . '/components/com_javoice/helpers/jahelper.php'; $GLOBALS['javconfig'] = array(); $JAVoiceHelpers = new JAVoiceHelpers(); $JAVoiceHelpers->get_config_system(); require_once JPATH_COMPONENT_ADMINISTRATOR . '/asset/jaconstants.php'; // Require the base controller require_once JPATH_COMPONENT . '/controller.php'; //Require the submenu for component //require_once (JPATH_COMPONENT.'/views/jaview/view.html.php'); if (!defined('JAVOICE_GLOBAL_SKIN')) { // load mootool JHTML::_('behavior.framework', true); $document = JFactory::getDocument(); $document->addScript('//code.jquery.com/jquery-1.8.3.min.js'); $document->addStyleSheet(JURI::root() . 'administrator/components/com_javoice/asset/css/ja.voice.css'); if (version_compare(JVERSION, '3.0', 'ge')) { $document->addStyleSheet(JUri::root() . 'administrator/components/com_javoice/asset/css/ja.voice.j3x.css'); }
jimport('joomla.application.component.model'); jimport('joomla.utilities.date'); jimport('joomla.application.component.controller'); JLoader::register('JAVBModel', JPATH_COMPONENT_ADMINISTRATOR . '/models/model.php'); JLoader::register('JAVFController', JPATH_COMPONENT . '/controllers/controller.php'); JLoader::register('JAVBView', JPATH_COMPONENT_ADMINISTRATOR . '/views/view.php'); JTable::addIncludePath(JPATH_SITE . '/administrator/components/com_javoice/tables'); JAVBModel::addIncludePath(JPATH_SITE . '/components/com_javoice/models'); /* Require Helper */ require_once JPATH_SITE . '/components/com_javoice/helpers/jahelper.php'; $GLOBALS['javconfig'] = array(); JAVoiceHelpers::get_config_system(); global $javconfig; require_once JPATH_COMPONENT_SITE . '/asset/cron/cron.php'; if (isset($javconfig['systems']) && $javconfig['systems']->get('is_turn_off_javoice', 0)) { if (!JAVoiceHelpers::check_access()) { return; } } if (!isset($_SESSION['JAV_LAST_VISITED'])) { if (isset($_COOKIE['JAV_LAST_VISITED'])) { $_SESSION['JAV_LAST_VISITED'] = $_COOKIE['JAV_LAST_VISITED']; } else { $_SESSION['JAV_LAST_VISITED'] = strtotime(date("Y-m-d") . " -3 days"); } setcookie('JAV_LAST_VISITED', time()); } if (!defined('JAVOICE_GLOBAL_CSS')) { $mainframe = JFactory::getApplication(); JHTML::stylesheet('components/com_javoice/asset/css/ja.voice.css'); if (file_exists(JPATH_BASE . '/templates/' . $mainframe->getTemplate() . '/css/ja.voice.css')) {
* ------------------------------------------------------------------------ * JA Voice Package for Joomla 2.5 & 3.x * ------------------------------------------------------------------------ * Copyright (C) 2004-2011 J.O.O.M Solutions Co., Ltd. All Rights Reserved. * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html * Author: J.O.O.M Solutions Co., Ltd * Websites: http://www.joomlart.com - http://www.joomlancers.com * ------------------------------------------------------------------------ */ // no direct access defined('_JEXEC') or die('Restricted access'); JHTML::stylesheet('components/com_javoice/asset/css/ja.widget.css'); if ($this->types) { $type_default = $this->types[0]; $jav_tab_active = 0; $Itemid = JAVoiceHelpers::get_Itemid(array('option' => 'com_javoice', 'view' => 'items')); $url_login = JRoute::_("index.php?option=com_javoice&view=items&task=ja_login&tmpl=component"); $base_url = JRoute::_("index.php?option=com_javoice&view=items&type={$jav_tab_active}"); $base_url = base64_encode($base_url); ?> <script type="text/javascript" charset="utf-8"> //<![CDATA[ var jav_tab_active = <?php echo $jav_tab_active; ?> ; var jav_base_url = '<?php echo JURI::base(); ?> '; var jav_base_url_login = '<?php
function delete_admin_response($responseID) { $response = $this->getAdmin_response(array($responseID)); $row = $this->getItem(array($response->item_id)); $db = JFactory::getDBO(); $query = "DELETE FROM #__jav_admin_responses WHERE id={$responseID}"; $db->setQuery($query); if ($db->query()) { /* Add JomSocial:: activity Stream*/ if ($response->user_id) { $title = sprintf(JText::_('JOMSOCIAL_ACTIVITI_STREAM_TITLE_REMOVE_REPLY'), $row->id, $row->voice_types_id, $row->forums_id, $row->title); JAVoiceHelpers::JomSocial_addActivityStream($response->user_id, $title, $row->id, 'removereply'); } /* End*/ } }
function edit($item = null) { $isgroup = 0; $isedit = 0; if ($this->getLayout() == 'group') { $isgroup = 1; } $model = $this->getModel('voicetypesstatus'); if (!$item) { $item = $this->get('Item'); if ($item->id > 0) { $isedit = 1; } if (JAVoiceHelpers::isPostBack()) { $post = JRequest::get('request', JREQUEST_ALLOWHTML); $item->bind($post); } } $items_voice_type = 0; if ($isedit) { $modelitems = JAVBModel::getInstance('items', 'javoiceModel'); $items_voice_type = $modelitems->getTotal(" AND i.voice_type_status_id = {$item->id} "); } if (!$isedit) { $voice_types_id = JRequest::getInt('voice_types_id', 0); if ($voice_types_id) { $item->voice_types_id = $voice_types_id; } } JFilterOutput::objectHTMLSafe($item, ENT_QUOTES, ''); $tree = $model->displaySelect($item->voice_types_id, $item->parent_id, " id='parent_id' name='parent_id' class=\"inputbox\" "); $modelvoicetypes = JAVBModel::getInstance('voicetypes', 'javoiceModel'); $voicetypes = $modelvoicetypes->getItems(''); if (!is_array($voicetypes)) { $voicetypes = array(); } $urlrequeststatus = "index.php?tmpl=component&option=com_javoice&view=voicetypesstatus&task=changestatusbyvoicetypeid&isparent=1"; $onchange = "onchange=\"changeStatus('{$urlrequeststatus}',this.value)\";"; if ($isgroup) { $onchange = ''; } $disable = ''; if ($isedit) { if ($items_voice_type > 0 || $isgroup) { $disable = ' disabled="disabled" '; } } $displayVoicetypes = JHTML::_('select.genericlist', $voicetypes, 'voice_types_id', "class=\"inputbox\" style=\"height:22px\" {$disable} {$onchange} ", 'id', 'title', $item->voice_types_id); $this->assign('displayVoicetypes', $displayVoicetypes); $number = JRequest::getVar('number', 0); $this->assignRef('isgroup', $isgroup); $this->assignRef('item', $item); $this->assignRef('tree', $tree); $this->assignRef('number', $number); }
function show_edit() { global $javconfig; $user = JFactory::getUser(); $model = $this->getModel(); if (!JAVoiceHelpers::checkPermissionAdmin()) { $isAllowRegisterEdit = 0; //print_r($javconfig["systems"]->get("is_edit_delete_voice",1));die(); if ($javconfig["systems"]->get("is_edit_delete_voice", 0)) { $item = $model->getItem(); $userE = JFactory::getUser(); $userEId = $userE->get('id'); if ($userEId == $item->user_id) { $timeE = $javconfig["systems"]->get("time_for_edit_voice", 900); if ($timeE != -1 || time() < $item->create_date + $timeE) { $isAllowRegisterEdit = 1; } } } if (!$isAllowRegisterEdit) { echo JText::_('YOU_DONT_PERMISSION'); exit; } } $type_id = JRequest::getInt('type'); $type = $model->getVoiceType($type_id); $this->assignRef('type', $type); $modelforums = JAVBModel::getInstance('forums', 'javoiceModel'); $fids = '0'; $tem = $modelforums->getForumByPermissionVote(); if (!$tem) { ?> <!-- --> <div class="jav-msg-error jav-notpermission"> <?php echo JText::_('SORRY_YOU_DONT_PERMISSION_TO_EDIT_THIS'); ?> <?php echo $type->title; ?> </div> <?php exit; } $fids = implode(',', $tem); $model = $this->getModel(); $item = $model->getItem(); $this->assignRef('item', $item); $where_more = " and f.id in ({$fids}) and vt.voice_types_id='{$type_id}'"; $join = " INNER JOIN #__jav_forums_has_voice_types as vt ON vt.forums_id=f.id"; $forums = $modelforums->getItems($where_more, 50, 0, 'f.ordering', '', $join); $displayForums = JHTML::_('select.genericlist', $forums, 'forums_id', "class=\"inputbox\" size=\"1\" ", 'id', 'title', $item->forums_id); $this->assignRef('displayForums', $displayForums); $this->assign("is_show_embed_video", $javconfig['plugin']->get('is_show_embed_video', 0)); $this->assign("enable_smileys", $javconfig['plugin']->get('enable_smileys', 0)); $this->assign("enable_bbcode", $javconfig['plugin']->get('enable_bbcode', 0)); $this->assign("enable_after_the_deadline", $javconfig['plugin']->get('enable_after_the_deadline', 0)); $this->assign("is_attach_image", $javconfig['plugin']->get('is_attach_image', 0)); $this->assign("total_attach_file", $javconfig['plugin']->get('total_attach_file', 0)); $this->assign("max_size_attach_file", $javconfig['plugin']->get('max_size_attach_file', 0)); $this->assign("is_enable_captcha", $javconfig['plugin']->get('is_enable_captcha', 0)); $this->assign("is_enable_captcha_user", $javconfig['plugin']->get('is_enable_captcha_user', 0)); echo $html = $this->loadTemplate('form_edit'); exit; }
function saveIFrame() { $post = JRequest::get('request', JREQUEST_ALLOWHTML); $number = $post['number']; $errors = array(); $id = $this->save($errors); $helper = new JAVoiceHelpers(); $objects = array(); if ($id) { $model = $this->getModel('forums'); $item = $model->getItem(); if ($post['id'] == '0') { $objects[] = $helper->parseProperty("reload", "#reload" . $item->id, 1); } else { $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(0, JText::_("SAVE_DATA_SUCCESSFULLY"))); } $objects[] = $helper->parseProperty("html", "#title" . $item->id, $item->title); $objects[] = $helper->parsePropertyPublish("html", "#publish" . $item->id, $item->published, $number); $modelvoicetypes = JAVBModel::getInstance('voicetypes', 'javoiceModel'); $where = " AND ft.forums_id = {$item->id}"; $joins = " INNER JOIN #__jav_forums_has_voice_types as ft ON t.id = ft.voice_types_id"; $voicetypes = $modelvoicetypes->getDyamicItems($where, 't.title', 0, 0, 't.title', $joins); $strVoice = ''; if ($voicetypes) { $strVoice = implode(", ", $voicetypes); } $item->strvoice = $strVoice; $objects[] = $helper->parseProperty("html", "#voice-types-" . $item->id, $item->strvoice); $objects[] = $helper->parseProperty("value", "#order" . $item->id, $item->ordering); //$objects [] = $helper->parsePropertyPublisha ( $item->id, $item->published ); } else { $objects[] = $helper->parseProperty("html", "#system-message", $helper->message(1, $errors)); } $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($objects); exit; }
<tr> <td width="100%"> <center> <fieldset> <legend><?php echo JText::_('LICENSE_INFORMATION'); ?> </legend> <table align="center" class="admintable" width="50%"> <tr> <td class="key" align="left"><?php echo JText::_('LICENSE_TYPE'); ?> :</td> <td align="left"><?php echo isset($javconfig['license']) && $javconfig['license']->get('type') ? JAVoiceHelpers::get_license_type() : JText::_('NA'); ?> </td> </tr> <tr> <td class="key" align="left"><?php echo JText::_('LICENSE_FOR_DOMAINS'); ?> :</td> <td align="left"><?php echo isset($javconfig['license']) && $javconfig['license']->get('domains') ? $javconfig['license']->get('domains') : JText::_('NA'); ?> </td> </tr> <tr> <td class="key" align="left">
/** * Enter description here... * * @param unknown_type $item */ function edit($item = null) { $model = $this->getModel(); $number = JRequest::getVar('numbet', 0); $postBack = JAVoiceHelpers::isPostBack(); if (!$item) { $item = $this->get('Item'); if ($postBack) { $post = JRequest::get('request', JREQUEST_ALLOWHTML); $item->bind($post); $item->gids_view_selected = $post['gids_view']; $item->gids_post_selected = $post['gids_post']; $item->gids_vote_selected = $post['gids_vote']; } else { $item->gids_post_selected = array(); if ($item->gids_post != '') { $item->gids_post_selected = explode("\n", $item->gids_post); } $item->gids_view_selected = array(); if ($item->gids_view != '') { $item->gids_view_selected = explode("\n", $item->gids_view); } $item->gids_vote_selected = array(); } } $modelvoicetypes = JAVBModel::getInstance('voicetypes', 'javoiceModel'); $modelvoicetypesstatus = JAVBModel::getInstance('voicetypesstatus', 'javoiceModel'); $voicetypes = $modelvoicetypes->getItems('', ' t.ordering'); if ($postBack) { $model->parseVoiceTypePostBack($post, $voicetypes); } else { $model->parseVoiceTypes($item->id, $voicetypes); } $lists = $modelvoicetypesstatus->displaySelectList($voicetypes, JText::_("DO_NOT_USE_STATUS")); $ordering = $model->getOrdering($item); $gtree = JAVoiceHelpers::getGroupUser(); //$gtree = $acl->get_group_children_tree ( null, 'USERS', false ); $model->parseGroupUser($gtree, 1); $this->assignRef('item', $item); $this->assignRef('gtree', $gtree); $this->assignRef('voicetypes', $voicetypes); $this->assignRef('lists', $lists); $this->assignRef('ordering', $ordering); $this->assignRef('number', $number); }
function save() { global $javconfig; $model = $this->getModel('tags'); $post["name"] = JRequest::getVar("name", ""); $post["published"] = JRequest::getInt("published", 1); $post["id"] = JRequest::getInt("id", 0); if (strlen($post["name"]) < $javconfig["systems"]->get("tag_minimum_length", 10)) { $helper = new JAVoiceHelpers(); $errors = JText::_("LENG_OF_TAG") . " '" . $post["name"] . "' " . JText::_("IS_VERY_SHORT"); $objects[] = $helper->parseProperty("-javmsg-", "alert", $errors); $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($objects); exit; } else { if (strlen($post["name"]) > $javconfig["systems"]->get("tag_maximum_length", 100)) { $helper = new JAVoiceHelpers(); $errors = JText::_("LENG_OF_TAG") . " '" . $post["name"] . "' " . JText::_("IS_VERY_LONG"); $objects[] = $helper->parseProperty("-javmsg-", "alert", $errors); $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($objects); exit; } else { $model = $this->getModel('tags'); if ($model->checkExistTag($post["name"], $post["id"])) { $helper = new JAVoiceHelpers(); $errors = JText::_("TAG_NAME_ALREADY_EXIST"); $objects[] = $helper->parseProperty("-javmsg-", "alert", $errors); $helper = new JAVoiceHelpers(); echo $helper->parse_JSON_new($objects); exit; } $model->save($post); } } }
?> ','<?php echo JText::_('CLOSE'); ?> ');return false;"><?php echo JText::_('HELP'); ?> </a> </td> </tr> <tr> <td colspan="2"> <?php $note = JText::_("FOURMS_CAN_BE_UNDERSTOOD_AS_CATEGORIES_YOU_CAN_SET_UNLIMITED_FORUMS__SET_ACCESS_PERMISSION_FOR_EACH_FORUM"); JAVoiceHelpers::displayNote($note, 'forums'); ?> </td> </tr> </table> <table class="adminlist"> <thead> <tr> <th width="10" align="left"> # </th>
* Author: J.O.O.M Solutions Co., Ltd * Websites: http://www.joomlart.com - http://www.joomlancers.com * ------------------------------------------------------------------------ */ defined('_JEXEC') or die('Restricted access'); $Itemid = JRequest::getInt('Itemid'); if (!$this->types) { return; } $currentUserInfo = JFactory::getUser(); JHTML::stylesheet('components/com_javoice/asset/js/atd/ja.voice.css'); $isShowCaptcha = 0; if (($currentUserInfo->guest && $this->is_enable_captcha || !$currentUserInfo->guest && $this->is_enable_captcha_user) && $currentUserInfo->get('aid') < 2) { $isShowCaptcha = 1; } $helper = new JAVoiceHelpers(); $currentLayout = JRequest::getVar("layout", "form"); global $javconfig; if ($currentLayout == "form") { ?> <script type="text/javascript" charset="utf-8"> //<![CDATA[ jQuery(document).ready(function($){ jav_init(); }); var jav_base_url = '<?php echo JURI::base(); ?> '; var jav_vote_total = <?php echo $this->votes_left;
echo JText::_('HELP'); ?> ','<?php echo JText::_('CLOSE'); ?> ');return false;"><?php echo JText::_('HELP'); ?> </a> </td> </tr> <tr> <td colspan="2"> <?php $note = JText::_("BASED_ON_YOUR_NEEDS_VOICES_TYPE_CAN_BE_DIFFERENT_THE_MOST_POPULAR_AND_RECOMMENDED_TYPES_FOR_JA_VOICE_ARE_SUGGESTION_QUESTIONS_PROBLEM_PRAISES"); JAVoiceHelpers::displayNote($note, 'voicetype'); ?> </td> </tr> </table> <table class="adminlist"> <thead> <tr> <th width="10" align="left"> # </th>
function editpermissions($params) { $mainframe = JFactory::getApplication(); $items = array(); $option = 'permissions'; $helper = new JAVoiceHelpers(); //$postback = $helper->isPostBack (); $model = JAVBModel::getInstance('permissions', 'javoiceModel'); $lists = $model->_getVars(); $where = ""; $lists['groupname'] = JRequest::getInt("groupname", 0); if ($lists['groupname']) { $where = ' AND map2.group_id = ' . $lists['groupname']; } $searchName = JRequest::getVar("search", ""); if ($searchName) { $where .= " AND a.username LIKE '%{$searchName}%'"; } $listUser = $params->get('permissions'); if ($listUser) { $where .= " AND a.id NOT IN(" . $listUser . ")"; } //if ($postback) { $items = $model->getItems($where); //} $this->assign('items', $items); $groupUser = $helper->getGroupUser('', 'groupname', 'class="inputbox" size="1"', $lists['groupname'], 1); $groupUser = JHTML::_('select.genericlist', $groupUser, 'groupname', 'class="inputbox" size="1"', 'value', 'text', $lists['groupname']); $this->assign('groupUser', $groupUser); //$this->assign ( 'postback', $postback ); $this->assign('lists', $lists); $this->assign('params', $params); $this->assign('items', $items); }
function export() { $cid = JRequest::getVar('cid', array(), '', 'array'); JArrayHelper::toInteger($cid, array(0)); if (!$cid) { JError::raiseWarning(1, JText::_('PLEASE_SELECT_EMAIL_TEMPLATE')); return $this->setRedirect("index.php?option=com_javocie&view=emailtemplates"); } $cid = implode(',', $cid); $model = $this->getModel('emailtemplates'); $items = $model->getItemsbyWhere($cid); if (!$items) { JError::raiseWarning(1, JText::_('PLEASE_SELECT_EMAIL_TEMPLATE')); return $this->setRedirect("index.php?option=com_javocie&view=emailtemplates"); } $content = ''; foreach ($items as $item) { $content .= JAVoiceHelpers::temp_export($item); } $filename = 'javoice_email_templates.ini'; $ctype = "text/plain"; if ($content) { header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); // required for certain browsers header("Content-Type: {$ctype}; name=\"" . basename($filename) . "\";"); header("Content-Disposition: attachment; filename=\"" . basename($filename) . "\";"); header("Content-Transfer-Encoding: utf-8"); header("Content-Length: " . strlen($content)); echo $content; exit; } else { JError::raiseWarning(1, JText::_('CONTENT_IS_EMPTY')); return $this->setRedirect("index.php?option=com_javocie&view=emailtemplates"); } }