Новости Joomla

Как тестировать Joomla PHP-разработчику? Компонент Patch tester.

👩‍💻 Как тестировать Joomla PHP-разработчику? Компонент Patch tester.Joomla - open source PHP-фреймворк с готовой админкой. Его основная разработка ведётся на GitHub. Для того, чтобы международному сообществу разработчиков было удобнее тестировать Pull Requests был создан компонент Patch Tester, который позволяет "накатить" на текущую установку Joomla именно те изменения, которые необходимо протестировать. На стороне инфраструктуры Joomla для каждого PR собираются готовые пакеты, в которых находится ядро + предложенные изменения. В каждом PR обычно находятся инструкции по тестированию: куда зайти, что нажать, ожидаемый результат. Тестировщики могут предположить дополнительные сценарии, исходя из своего опыта и найти баги, о которых сообщить разработчику. Или не найти, и тогда улучшение или исправление ошибки быстрее войдёт в ядро Joomla. Напомню, что для того, чтобы PR вошёл в ядро Joomla нужны минимум 2 положительных теста от 2 участников сообщества, кроме автора. Видео на YouTubeВидео на VK ВидеоВидео на RuTubeКомпонент на GitHub https://github.com/joomla-extensions/patchtester@joomlafeed#joomla #php #webdev #community

Вышел релиз Revo PageBuilder Toolkit for YOOtheme Pro 1.6

Вышел релиз Revo PageBuilder Toolkit for YOOtheme Pro 1.6.2PageBuilder Toolkit - это специализированный плагин для конструктора страниц Yootheme Pro, содержит набор различных утилит для ускорения процесса работы и отладки макета, множественные улучшения в интерфейсе, включая поддержку dark mode, подсказки, быстрая смена разрешения в окне просмотра и много чего еще.v.1.6.2 Что нового?- Индикатор статусов: теперь не просто показывает состояние запросов, но и делает автоматические попытки их отправки при кратковременных сбоях в сети, а если это не помогло, то переводит конструктор в ручной режим, что позволяет сохранит макет и настройки темы прежде чем вы потеряете все, что было сделано с момента последнего сохранения- Подсветка ошибок в макете: плагин анализирует код страницы и может автоматически подсвечивать data атрибуты с кучей мусора, которые попадают в код страницы при копипасте из Figma в TinyMCE (пригодится для старых макетов, в текущей работе плагин сам очищает код мусора). Также есть подсветка семантических ошибок сборки - дубли h1 тега на странице и вложенных друг в друга заголовков.- Улучшена поддержка будущего релиза Yootheme Pro 5 и редактора CodeMirror 6Плагин для русскоязычных пользователей доступен в каталоге расширений SovMart и распространяется за символическую плату (100р). Разработчики Joomla расширений и партнеры автора могут получить плагин бесплатно.Для работы плагина необходим конструктор страниц Yootheme Pro.Разработчик плагина - участник нашего сообщества Александр Судьбинов (@alexrevo), член официальной группы поддержки Yootheme Pro. Страница расширенияОписание на сайте автора@joomlafeed#joomla #yootheme

0 Пользователей и 1 Гость просматривают эту тему.
  • 11 Ответов
  • 6397 Просмотров
*

Ale31

  • Новичок
  • 7
  • 3 / 0
ads_manager 2.6 RC1 доработки
« : 04.02.2011, 21:49:22 »
крокозябры в конце обрезанных предложений в списке всех объявлений, символы ?, ромбики. Заодно если строки короткие, чтоб не добавлялись '...'
\components\com_adsmanager\views\list\tmpl\default.php
строка 194 исправляем на код
if (mb_strlen($content->ad_text,'UTF-8')>95) {$af_text = mb_substr($content->ad_text, 0, 95,'UTF-8')."...";} else {$af_text =$content->ad_text;}
*

Ale31

  • Новичок
  • 7
  • 3 / 0
Re: ads_manager 2.6 RC1 доработки
« Ответ #1 : 04.02.2011, 22:07:12 »
Встраиваем Капчу
по аналогии с 2.5

качаем отсюда http://joomlacode.org/gf/project/tincaptcha/frs/
устанавливаем плагин и компонент, включаем плагин

 
\components\com_adsmanager\controller.php
изменения со строки 332
\components\com_adsmanager\views\edit\tmpl\default.php
изменения со  строки 382
исправленные файлы во вложении


[вложение удалено Администратором]
*

mbgr

  • Захожу иногда
  • 88
  • 11 / 0
Re: ads_manager 2.6 RC1 доработки
« Ответ #2 : 13.02.2011, 23:09:32 »
Встраиваем Капчу
по аналогии с 2.5

качаем отсюда http://joomlacode.org/gf/project/tincaptcha/frs/
устанавливаем плагин и компонент, включаем плагин

 
\components\com_adsmanager\controller.php
изменения со строки 332
\components\com_adsmanager\views\edit\tmpl\default.php
изменения со  строки 382
исправленные файлы во вложении

У меня не работает. Не вводиш код все равно объявление добавляется.
*

saidrustam

  • Захожу иногда
  • 100
  • 7 / 0
Re: ads_manager 2.6 RC1 доработки
« Ответ #3 : 16.02.2011, 10:08:02 »
У меня тоже также. Автор помогите, здесь чтото не так. !
*

metacreo

  • Осваиваюсь на форуме
  • 14
  • 1 / 0
Re: ads_manager 2.6 RC1 доработки
« Ответ #4 : 16.02.2011, 17:51:57 »
Всё работает делайте вручную и внимательно.
немогу приложить обновлённые файлы :(  не позволяет форум:
Папка upload заполнена. Попробуйте файл меньшего размера или свяжитесь с Администратором.

 ;D 5кб всего
у меня на самопальном серве на никсе и то возможности побольше :(
\components\com_adsmanager\controller.php
Код
<?php

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );

jimport('joomla.application.component.controller');

JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_adsmanager'.DS.'tables');

define('JPATH_FRONT', JPATH_BASE );

/**
 * Content Component Controller
 *
 * @package Joomla
 * @subpackage Content
 * @since 1.5
 */
class AdsManagerController extends JController
{
function display()
{
global $mainframe;
$document = JFactory::getDocument();
$user = JFactory::getUser();

if ( ! JRequest::getCmd( 'view' ) ) {
$default = 'front';
JRequest::setVar('view', $default );
}

$viewName  = JRequest::getVar('view', 'front', 'default', 'cmd');
$type    = JRequest::getVar('format', 'html', 'default', 'cmd');
$view      = $this->getView($viewName,$type);

if ($viewName == "edit")
{
$this->write();
return;
}

$uri =& JFactory::getURI();
$baseurl = JURI::base();
$view->assign("baseurl",$baseurl);
$view->assignRef("baseurl",$baseurl);

if (($type == "html")&&(!defined( '_ADSMANAGER_CSS' ))) {
/** ensure that functions are declared only once */
define( '_ADSMANAGER_CSS', 1 );
$uri =& JFactory::getURI();
$baseurl = JURI::base();
$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$baseurl.'/components/com_adsmanager/css/adsmanager.css" type="text/css" media="screen" />');
}

$itemid = JRequest::getInt('Itemid', 0);
if ($itemid == 0)
{
$component =& JComponentHelper::getComponent('com_adsmanager');
          $menus  = &JApplication::getMenu('site', array());
        $items  = $menus->getItems('componentid', $component->id);
        if ($items)
        {
$itemid = $items[0]->id;       
        }

$view->assign("Itemid",$itemid);
$view->assignRef("Itemid",$itemid);

// Push a model into the view
$this->addModelPath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_adsmanager'.DS.'models');

$contentmodel = &$this->getModel( "content" );
$catmodel = &$this->getModel( "category" );
$positionmodel = &$this->getModel( "position" );
$columnmodel = &$this->getModel( "column" );
$fieldmodel     = &$this->getModel( "field" );
$usermodel = &$this->getModel( "user" );
$adsmanagermodel= &$this->getModel( "adsmanager" );
$configurationmodel = &$this->getModel( "configuration" );

if (!JError::isError( $contentmodel )) {
$view->setModel( $contentmodel, true );
}

$view->setModel( $contentmodel);
$view->setModel( $catmodel);
$view->setModel( $positionmodel);
$view->setModel( $columnmodel);
$view->setModel( $fieldmodel);
$view->setModel( $usermodel);
$view->setModel( $adsmanagermodel);
$view->setModel( $configurationmodel);

if (file_exists( JPATH_BASE .'/components/com_adsmanager/cron.php' ))
require_once( JPATH_BASE .'/components/com_adsmanager/cron.php' );
if ($last_cron_date != date("Ymd")){
$contentmodel->manage_expiration($itemid,$fieldmodel->getPlugins(),$configurationmodel->getConfiguration());
}

if ($viewName == "details") {
$contentid = JRequest::getInt( 'id', 0 );
$content = $contentmodel->getContent($contentid);
// increment views. views from ad author are not counted to prevent highclicking views of own ad
if ( $user->id <> $content->userid) {
$contentmodel->increaseHits($content->id);
}
}


if ($user->get('id'))
{
parent::display(false);
}
else if ($viewName == "list")
{
$cache =& JFactory::getCache( 'com_adsmanager' );
$method = array( $view, 'display' );

$conf = $configurationmodel->getConfiguration();

$tsearch = $mainframe->getUserStateFromRequest('com_adsmanager.front_content.tsearch','tsearch',"");
$limit   = $mainframe->getUserStateFromRequest('global.list.limit','limit',$mainframe->getCfg('list_limit'), 'int');
$order   = $mainframe->getUserStateFromRequest('com_adsmanager.front_content.order','order',0,'int');
$mode    = $mainframe->getUserStateFromRequest('com_adsmanager.front_content.mode','mode',$conf->display_expand);
$url =& $uri->toString();

echo $cache->call( $method, null,$url,$tsearch,$limit,$order,$mode). "\n";
}
else
{
parent::display(true);
}
}

function write()
{
global $mainframe;

$document = JFactory::getDocument();

// Set the default view name from the Request
$type = "html";

$uri =& JFactory::getURI();
$baseurl = JURI::base();

if (!defined( '_ADSMANAGER_CSS' )) {
/** ensure that functions are declared only once */
define( '_ADSMANAGER_CSS', 1 );
$uri =& JFactory::getURI();
$baseurl = JURI::base();
$mainframe->addCustomHeadTag('<link rel="stylesheet" href="'.$baseurl.'/components/com_adsmanager/css/adsmanager.css" type="text/css" media="screen" />');
}

// Push a model into the view
$this->addModelPath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_adsmanager'.DS.'models');
$configurationmodel = &$this->getModel( "configuration" );
$catmodel     = &$this->getModel( "category" );
$contentmodel = &$this->getModel( "content" );
$fieldmodel = &$this->getModel( "field" );
$usermodel = &$this->getModel( "user");

$user = JFactory::getUser();
$conf = $configurationmodel->getConfiguration();

$itemid = JRequest::getInt('Itemid', 0);
if ($itemid == 0)
{
$component =& JComponentHelper::getComponent('com_adsmanager');
          $menus  = &JApplication::getMenu('site', array());
        $items  = $menus->getItems('componentid', $component->id);
        if ($items)
        {
$itemid = $items[0]->id;       
        }



/* submission_type = 1 -> Account needed */
    if (($conf->submission_type == 1)&&($user->id == "0")) {
    $view = $this->getView("login",'html');
    $view->setModel( $contentmodel, true );
    $view->setModel( $catmodel );
$view->setModel( $configurationmodel );
$view->setModel( $fieldmodel );
$view->setModel( $usermodel );

$view->assign("Itemid",$itemid);
$view->assignRef("Itemid",$itemid);

    $view->display();
    }
    else
    {
    $contentid = JRequest::getInt( 'id', 0 );
    $nbcontents = $contentmodel->getNbContentsOfUser($user->id);
 
if (($contentid == 0)&&($user->id != "0")&&($conf->nb_ads_by_user != -1)&&($nbcontents >= $conf->nb_ads_by_user))
{
//REDIRECT
$redirect_text = sprintf(JText::_('ADSMANAGER_MAX_NUM_ADS_REACHED'),$conf->nb_ads_by_user);
$mainframe->redirect( 'index.php?option=com_adsmanager&view=list&Itemid='.$itemid, $redirect_text );
}
else
{
$view = $this->getView("edit",'html');
$view->setModel( $contentmodel, true );
$view->setModel( $catmodel );
$view->setModel( $configurationmodel );
$view->setModel( $fieldmodel );
$view->setModel( $usermodel );

$view->assign("Itemid",$itemid);
$view->assignRef("Itemid",$itemid);

$view->display();
}
    }
}

/**
* Saves the content item an edit form submit
*
* @todo
*/
function save()
{
global $mainframe;

// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );

$redirect_text = JText::_('ADSMANAGER_INSERT_SUCCESSFULL_PUBLISH');

$user = JFactory::getUser();
$content =& JTable::getInstance('content', 'Table');

$this->addModelPath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_adsmanager'.DS.'models');
$configurationmodel = &$this->getModel( "configuration" );
$contentmodel = &$this->getModel( "content" );
$usermodel = &$this->getModel( "user" );

$itemid = JRequest::getInt('Itemid', 0);

if ($itemid == 0)
{
$component =& JComponentHelper::getComponent('com_adsmanager');
          $menus  = &JApplication::getMenu('site', array());
        $items  = $menus->getItems('componentid', $component->id);
        if ($items)
        {
$itemid = $items[0]->id;       
        }



$conf = $configurationmodel->getConfiguration();

$id = JRequest::getInt( 'id', 0 );

if (($id == 0)&&($user->id != "0")&&($conf->nb_ads_by_user != -1))
{
$nb = $contentmodel->getNbContentsOfUser($user->id);
if ($nb >= $conf->nb_ads_by_user)
{
$redirect_text = sprintf(JTEXT::_('ADSMANAGER_MAX_NUM_ADS_REACHED'),$conf->nb_ads_by_user);
$mainframe->redirect( 'index.php?option=com_adsmanager&view=list&Itemid='.$itemid, $redirect_text );
}
}

// bind it to the table
if (!$content -> bind($_POST)) {
return JError::raiseWarning( 500, $row->getError() );
}

if (($content->id != 0)&&($content->id != "")) {
$isUpdateMode = 1;
$redirect_text = JText::_('ADSMANAGER_UPDATE_SUCCESSFULL');
}
else
$isUpdateMode = 0;

if ($isUpdateMode == 0)
{
if ($conf->auto_publish == 1)
{
$content->published = 1;
}
else
{
$content->published = 0;
$redirect_text = JText::_('ADSMANAGER_INSERT_SUCCESSFULL_CONFIRM');
}
}

if ($isUpdateMode == 0)
{
$content->date_created = date("Y-m-d");
$delta = $conf->ad_duration; 
$content->expiration_date = date("Y-m-d",mktime()+($delta*24*3600));
}

if (($conf->submission_type == 0)&&($user->id == 0))
{
$username = JRequest::getVar('username', "" );
$password = JRequest::getVar('password', ""  );
$email = JRequest::getVar('email', ""  );
$errorMsg = $usermodel->checkAccount($username,$password,$email,$userid,$conf);
if (isset($errorMsg))
{
$catid = JRequest::getInt('category', 0 );
$url = JRoute::_("index.php?option=com_adsmanager&task=write&catid=$catid&Itemid=$itemid");
echo "<form name='form' action='$url' method='post'>";
foreach($_POST as $key=>$val)
{
echo "<input type='hidden' name='$key' value='".htmlentities(stripslashes($val),ENT_QUOTES)."'>";
}
echo "<input type='hidden' name='errorMsg' value='$errorMsg'>";
echo '</form>';
echo '<script language="JavaScript">';
echo 'document.form.submit()';
echo '</script>';
return;
}

$content->userid = $userid;
}
else
{
$content->userid = $user->id;
}
// tincaptcha
$user =& JFactory::getUser();
if (JPluginHelper::isEnabled('system', 'tincaptcha') && $user->get('guest'))
{
$captchk = plgSystemTincaptcha::check(JRequest::getVar('captcha', '', 'post'));
if (($captchk !== true)&&($user->id == "0"))
{
JError::raiseWarning(0, $captchk);
         return false;
      }
  }
// tincaptcha
// store it in the db
if (!$content -> store()) {
return JError::raiseWarning( 500, $content->getError() );
}

$model = $this->getModel("field");
$plugins = $model->getPlugins();

$content->save($_POST,$_FILES,$conf,$this->getModel("adsmanager"),$plugins,$isUpdateMode);

$cache = & JFactory::getCache('com_adsmanager');
$cache->clean();

if ((($conf->send_email_on_new == 1)&&($isUpdateMode == 0))||
(($conf->send_email_on_update == 1)&&($isUpdateMode == 1)))
{
$config = &JFactory::getConfig();
$from = $config->getValue('mailfrom');
$fromname = $config->getValue('fromname');

$body = JRequest::getVar("ad_text", "" );
$body = str_replace(array("\r\n", "\n", "\r"), "<br />", $body);

$subject = JRequest::getVar("ad_headline", "" );
if( $isUpdateMode == 1)
$subject .= JText::_('ADSMANAGER_EMAIL_UPDATE')." ".$subject;
else
$subject .= JText::_('ADSMANAGER_EMAIL_NEW')." ".$subject;

// Send the e-mail to Administrator
if (!JUtility::sendMail($from, $fromname, $from, $subject, $body))
{
$this->setError(JText::_('ADSMANAGER_ERROR_SENDING_MAIL'));
return false;
}
}

$cache =& JFactory::getCache( 'com_adsmanager');
$cache->clean();

if ($conf->submission_type == 2)
$mainframe->redirect( 'index.php?option=com_adsmanager&view=list&Itemid='.$itemid, $redirect_text );
else if ($conf->comprofiler == 2)
$mainframe->redirect( 'index.php?option=com_comprofiler&task=userProfile&tab=AdsManagerTab', $redirect_text );
else
$mainframe->redirect( 'index.php?option=com_adsmanager&view=list&Itemid='.$itemid, $redirect_text );

}

function delete()
{
global $mainframe;

$itemid = JRequest::getInt('Itemid', 0);

if ($itemid == 0)
{
$component =& JComponentHelper::getComponent('com_adsmanager');
          $menus  = &JApplication::getMenu('site', array());
        $items  = $menus->getItems('componentid', $component->id);
        if ($items)
        {
$itemid = $items[0]->id;       
        }


$user = JFactory::getUser();
$this->addModelPath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_adsmanager'.DS.'models');
$configurationmodel = &$this->getModel( "configuration" );
$fieldmodel         = &$this->getModel( "field" );

$content =& JTable::getInstance('content', 'Table');

$id = JRequest::getInt('id', 0);
if ($id == 0) {
$mainframe->redirect( 'index.php?option=com_adsmanager&view=list&Itemid='.$itemid, "" );
}

$content->load($id);
if (($content == null)||($content->userid != $user->id))
$mainframe->redirect( 'index.php?option=com_adsmanager&view=list&Itemid='.$itemid, "" );

$conf = $configurationmodel->getConfiguration();
$plugins = $fieldmodel->getPlugins();

$content->delete($id,$conf,$plugins);

$cache =& JFactory::getCache( 'com_adsmanager');
$cache->clean();

$mainframe->redirect( 'index.php?option=com_adsmanager&view=list&Itemid='.$itemid, JText::_('ADSMANAGER_CONTENT_REMOVED') );
}

function sendmessage()
{
global $mainframe;
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );

$contentid = JRequest::getInt( 'contentid',0 );
$this->addModelPath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_adsmanager'.DS.'models');
$contentmodel = &$this->getModel( "content" );
$content = $contentmodel->getContent($contentid);

$itemid = JRequest::getInt('Itemid', 0);

if ($itemid == 0)
{
$component =& JComponentHelper::getComponent('com_adsmanager');
          $menus  = &JApplication::getMenu('site', array());
        $items  = $menus->getItems('componentid', $component->id);
        if ($items)
        {
$itemid = $items[0]->id;       
        }


if (isset($content))
{
$name = JRequest::getVar('name' , "" );
$email = JRequest::getVar('email', "" );
jimport('joomla.mail.helper');
if (!JMailHelper::isEmailAddress($email))
{
$this->setError(JText::_('INVALID_EMAIL_ADDRESS'));
$mainframe->redirect( 'index.php?option=com_adsmanager&view=details&catid='.$content->catid.'&id='.$contentid.'&Itemid='.$itemid, 'INVALID_EMAIL_ADDRESS' );
}
$subject = JRequest::getVar('title', "" );
$body = JRequest::getVar('body' , "" );
$body = str_replace(array("\r\n", "\n", "\r"), "<br />", $body);
if (get_magic_quotes_gpc() == true)
$body = stripslashes( $body );

$file = JRequest::getVar( 'attach_file',null,'FILES');
if ($file['tmp_name'] != "")
{
$directory = ini_get('upload_tmp_dir')."";
if ($directory == "")
$directory = ini_get('session.save_path')."";

$filename = $directory."/".basename($file['name']);
rename($file['tmp_name'], $filename);
if (!JUtility::sendMail($email,$name,$content->email,$subject,$body,1,NULL,NULL,$filename))
{
$this->setError(JText::_('ADSMANAGER_ERROR_SENDING_MAIL'));
$mainframe->redirect( 'index.php?option=com_adsmanager&view=details&catid='.$content->catid.'&id='.$contentid.'&Itemid='.$itemid, JText::_('ADSMANAGER_ERROR_SENDING_MAIL') );
}
}
else {
if (!JUtility::sendMail($email,$name,$content->email,$subject,$body,1))
{
$this->setError(JText::_('ADSMANAGER_ERROR_SENDING_MAIL'));
$mainframe->redirect( 'index.php?option=com_adsmanager&view=details&catid='.$content->catid.'&id='.$contentid.'&Itemid='.$itemid, JText::_('ADSMANAGER_ERROR_SENDING_MAIL') );
}
}
}
$mainframe->redirect( 'index.php?option=com_adsmanager&view=details&catid='.$content->catid.'&id='.$contentid.'&Itemid='.$itemid, JText::_('ADSMANAGER_EMAIL_SENT') );
}

function saveprofile()
{
global $mainframe;

// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );

$user  = JFactory::getUser();
$this->addModelPath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_adsmanager'.DS.'models');
$usermodel = &$this->getModel( "user" );

$itemid = JRequest::getInt('Itemid', 0);

if ($itemid == 0)
{
$component =& JComponentHelper::getComponent('com_adsmanager');
          $menus  = &JApplication::getMenu('site', array());
        $items  = $menus->getItems('componentid', $component->id);
        if ($items)
        {
$itemid = $items[0]->id;       
        }


$user->orig_password = $user->password;

$password   =  JRequest::getVar('password', "");
$verifyPass = JRequest::getVar('verifyPass', "");
if($password != "") {
if($verifyPass == $password) {
jimport('joomla.user.helper');
$salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword($password, $salt);
$user->password = $crypt.':'.$salt;
} else {
$mainframe->redirect( 'index.php?option=com_adsmanager&view=profile&Itemid='.$itemid, JText::_('_PASS_MATCH') );
exit();
}
} else {
// Restore 'original password'
$user->password = $row->orig_password;
}

$user->name = JRequest::getVar('name', "");
$user->username = JRequest::getVar('username', "");
$user->email = JRequest::getVar('email', "");

unset($user->orig_password); // prevent DB error!!

if (!$user->save()) {
$mainframe->redirect( 'index.php?option=com_adsmanager&view=profile&Itemid='.$itemid, $user->getError() );
}

$usermodel->updateProfileFields($user->id);

$mainframe->redirect( 'index.php?option=com_adsmanager&view=profile&Itemid='.$itemid, JText::_('ADSMANAGER_PROFILE_SAVED') );
}

function renew() {
global $mainframe;

$itemid = JRequest::getInt('Itemid', 0);

if ($itemid == 0)
{
$component =& JComponentHelper::getComponent('com_adsmanager');
          $menus  = &JApplication::getMenu('site', array());
        $items  = $menus->getItems('componentid', $component->id);
        if ($items)
        {
$itemid = $items[0]->id;       
        }

$contentid = JRequest::getInt('id', 0);

if (function_exists("renewPaidAd")) {
renewPaidAd($contentid,$itemid);

$cache =& JFactory::getCache( 'com_adsmanager');
$cache->clean();

$mainframe->redirect("index.php?option=com_adsmanager&Itemid=".$itemid,JText::_('ADSMANAGER_CONTENT_RESUBMIT'));
}
else
{
$this->addModelPath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_adsmanager'.DS.'models');
$contentmodel = &$this->getModel( "content" );

$confmodel = &$this->getModel( "configuration" );
$conf = $confmodel->getConfiguration();


$contentmodel->renewContent($contentid,$conf->ad_duration);

$cache =& JFactory::getCache( 'com_adsmanager');
$cache->clean();

$mainframe->redirect("index.php?option=com_adsmanager&Itemid=".$itemid,JText::_('ADSMANAGER_CONTENT_RESUBMIT'));
}
}
}
\components\com_adsmanager\views\edit\tmpl\default.php

Код
<?php 
if (isset($this->warning_text))
echo $this->warning_text;
if (isset($this->error_text))
echo $this->error_text;
echo JTEXT::_('ADSMANAGER_RULESREAD');
?>
<script type="text/javascript" src="<?php echo $this->baseurl;?>/includes/js/overlib_mini.js"></script>
<script type="text/javascript">
function CaracMax(texte, max)
{
if (texte.value.length >= max)
{
texte.value = texte.value.substr(0, max - 1) ;
}
}

function submitbutton(mfrm) {
var me = mfrm.elements;
var r = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-]", "i");
var r_num = new RegExp("[^0-9\.,]", "i");
var r_email = new RegExp("^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]{2,}[.][a-zA-Z]{2,3}$" ,"i");

var errorMSG = '';
var iserror=0;

<?php
if (function_exists("loadEditFormCheck")){
loadEditFormCheck();
}
?>

<?php if ($this->nbcats > 1)
{
?>
var form = document.adminForm;
var srcList = eval( 'form.selected_cats' );
var srcLen = srcList.length;
if (srcLen == 0)
{
errorMSG += ' <?php echo html_entity_decode(addslashes(JText::_('ADSMANAGER_FORM_CATEGORY')),ENT_QUOTES); ?> : <?php echo html_entity_decode(addslashes(JText::_('ADSMANAGER_REGWARN_ERROR')),ENT_QUOTES); ?>\n';
srcList.style.background = "red";
iserror=1;
}
else
{
for (var i=0; i < srcLen; i++) {
srcList.options[i].selected = true;
}
}
<?php
}
?>

if (mfrm.username && (r.exec(mfrm.username.value) || mfrm.username.value.length < 3)) {
errorMSG += mfrm.username.getAttribute('mosLabel').replace('&nbsp;',' ') + ' : <?php echo addslashes(html_entity_decode(sprintf( JText::_('ADSMANAGER_VALID_AZ09'), JText::_('ADSMANAGER_PROMPT_UNAME'), 4 ),ENT_QUOTES)); ?>\n';
mfrm.username.style.background = "red";
iserror=1;
}
if (mfrm.password && r.exec(mfrm.password.value)) {
errorMSG += mfrm.password.getAttribute('mosLabel').replace('&nbsp;',' ') + ' : <?php echo addslashes(html_entity_decode(sprintf( JText::_('ADSMANAGER_VALID_AZ09'), JText::_('ADSMANAGER_REGISTER_PASS'), 6 ),ENT_QUOTES)); ?>\n';
mfrm.password.style.background = "red";
iserror=1;
}

if (mfrm.email && !r_email.exec(mfrm.email.value) && mfrm.email.getAttribute('mosReq')) {
errorMSG += mfrm.email.getAttribute('mosLabel').replace('&nbsp;',' ') + ' : <?php echo html_entity_decode(addslashes(JText::_('ADSMANAGER_REGWARN_EMAIL')),ENT_QUOTES); ?>\n';
mfrm.email.style.background = "red";
iserror=1;
}

// loop through all input elements in form
for (var i=0; i < me.length; i++) {

if ((me[i].getAttribute('test') == 'number' ) && (r_num.exec(me[i].value))) {
errorMSG += me[i].getAttribute('mosLabel').replace('&nbsp;',' ') + ' : <?php echo html_entity_decode(addslashes(JText::_('ADSMANAGER_REGWARN_NUMBER')),ENT_QUOTES); ?>\n';
iserror=1;
}

// check if element is mandatory; here mosReq="1"
if ((me[i].getAttribute('mosReq') == 1)&&(me[i].style.visibility != 'hidden')) {
if (me[i].type == 'radio' || me[i].type == 'checkbox') {
var rOptions = me[me[i].getAttribute('name')];
var rChecked = 0;
if(rOptions.length > 1) {
for (var r=0; r < rOptions.length; r++) {
if (rOptions[r].checked) {
rChecked=1;
}
}
} else {
if (me[i].checked) {
rChecked=1;
}
}
if(rChecked==0) {
// add up all error messages
errorMSG += me[i].getAttribute('mosLabel').replace('&nbsp;',' ') + ' : <?php echo html_entity_decode(addslashes(JText::_('ADSMANAGER_REGWARN_ERROR')),ENT_QUOTES); ?>\n';
// notify user by changing background color, in this case to red
me[i].style.background = "red";
iserror=1;
}
}
if (me[i].value == '') {
// add up all error messages
errorMSG += me[i].getAttribute('mosLabel').replace('&nbsp;',' ') + ' : <?php echo html_entity_decode(addslashes(JText::_('ADSMANAGER_REGWARN_ERROR')),ENT_QUOTES); ?>\n';
// notify user by changing background color, in this case to red
me[i].style.background = "red";
iserror=1;
}
}
}

if(iserror==1) {
alert(errorMSG);
return false;
} else {
//Little hack to be able to return the selected_cats
<?php if ($this->nbcats > 1) { ?>
srcList.name = "selected_cats[]";
<?php } ?>
return true;
}
}

function updateFields() {
var form = document.adminForm;
var singlecat = 0;
var length = 0;

if ( typeof(document.adminForm.category )!= "undefined" ) {
singlecat = 1;
length = 1;
}
else
{
length = form.selected_cats.length;
}

<?php
foreach($this->fields as $field)
{
if (strpos($field->catsid, ",-1,") === false)
{
$name = $field->name;
if (($field->type == "multicheckbox")||($field->type == "multiselect"))
$name .= "[]";
?>
var input = document.getElementById('<?php echo $name;?>');
var trzone = document.getElementById('tr_<?php echo $field->name;?>');
if (((singlecat == 0)&&(length == 0))||
    ((singlecat == 1)&&(document.adminForm.category.value == 0)))
{
input.style.visibility = 'hidden';
trzone.style.visibility = 'hidden';
trzone.style.display = 'none';
}
else
{
for (var i=0; i < length; i++) {


var field_<?php echo $field->name;?> = '<?php echo $field->catsid;?>';
var temp;
if (singlecat == 0)
temp = form.selected_cats.options[i].value;
else
temp = document.adminForm.category.value;

var test = field_<?php echo $field->name;?>.indexOf( ","+temp+",", 0 );
if (test != -1)
{
input.style.visibility = 'visible';
trzone.style.visibility = 'visible';
trzone.style.display = '';
break;
}
else
{
input.style.visibility = 'hidden';
trzone.style.visibility = 'hidden';
trzone.style.display = 'none';
}
}
}
<?php
}
}
?>
}
</script>
<div id="adsmanager_writead_header">
<div id="writead_header1"><?php echo JTEXT::_('ADSMANAGER_HEADER1'); ?></div>
<div id="writead_header2"><?php echo JTEXT::_('ADSMANAGER_HEADER2'); ?></div>
</div>
<fieldset id="adsmanager_fieldset">
<!-- titel -->
  <legend>
<?php
if($this->isUpdateMode) {
   echo JTEXT::_('ADSMANAGER_CONTENT_EDIT');
}
else {
   echo JTEXT::_('ADSMANAGER_CONTENT_WRITE');
}
?>
</legend>
<!-- titel -->
  <!-- form -->
   <!-- category -->
   <table border='0'>
   <tr name='category'>
<td width="100"><?php echo JTEXT::_('ADSMANAGER_FORM_CATEGORY'); ?></td>
<td>
<?php
  $target = JROUTE::_("index.php?option=com_adsmanager&task=save&Itemid=".$this->Itemid);
  if ($this->nbcats == 1)
  {
$this->displaySingleCatChooser(@$this->content->id,$this->conf,"com_adsmanager",$this->cats,$this->catid,$this->Itemid);
?>
<form action="<?php echo $target;?>" method="post" name="adminForm" enctype="multipart/form-data" onsubmit="return submitbutton(this)">
<?php
echo "<input type='hidden' name='category' value='$this->catid' />";
  }
  else
  {
?>
<form action="<?php echo $target;?>" method="post" name="adminForm" enctype="multipart/form-data" onsubmit="return submitbutton(this)">
<?php
if (!isset($this->content->catsid))
$this->content->catsid = 0;
$this->displayMultipleCatsChooser($this->content->catsid,$this->cats,$this->conf,"com_adsmanager",$this->Itemid);
  }
?>
    </td></tr>
<!-- fields -->
<?php
if (($this->nbcats != 1)||(!isset($this->catid))||($this->catid != 0))
{
/* Submission_type == 0 -> Account Creation with ad posting */
if ($this->account_creation == 1)
{
echo "<tr><td colspan='2'>".JTEXT::_('ADSMANAGER_AUTOMATIC_ACCOUNT')."</td></tr>";
echo "<tr><td>".JTEXT::_('ADSMANAGER_UNAME')."</td>\n";
if (isset($this->content->username))
{
$username = $this->content->username;
$password = $this->content->password;
$email = $this->content->email;
$name = $this->content->name;
$style = 'style="background-color:#ff0000"';
}
else
{
$username = "";
$password = "";
$email = "";
$name =  "";
$style = "";
}

if (isset($this->content->firstname))
$firstname = $this->content->firstname;
else
$firstname = "";

if (isset($this->content->middlename))
$middlename = $this->content->middlename;
else
$middlename = "";

if ($this->conf->comprofiler > 0)
{
include_once( JPATH_BASE .'/administrator/components/com_comprofiler/ue_config.php' );
$namestyle = $ueConfig['name_style'];
}
else
$namestyle = 1;

echo "<td><input $style class='adsmanager_required' mosReq='1' id='username' type='text' mosLabel='".htmlspecialchars(JText::_('ADSMANAGER_UNAME'),ENT_QUOTES)."' name='username' size='20' maxlength='20' value='$username' /></td></tr>\n";

echo "<tr><td>".JText::_('ADSMANAGER_PASSWORD')."</td>\n";
echo "<td><input $style class='adsmanager_required' mosReq='1' id='password' type='password' mosLabel='".htmlspecialchars(JText::_('ADSMANAGER_PASS'),ENT_QUOTES)."' name='password' size='20' maxlength='20' value='$password' />\n</td></tr>";
$emailField = false;
$nameField = false;
for($i = 0,$total = count($this->fields);$i < $total;$i++)
{
if (($this->fields[$i]->name == "email")&&((strpos($this->fields[$i]->catsid, ",$this->catid,")!== false)||(strpos($this->fields[$i]->catsid, ",-1,")!== false)))
{
$emailField = true;
// Force required
$this->fields[$i]->required = 1;
}
else if (($this->fields[$i]->name == "name")&&((strpos($this->fields[$i]->catsid, ",$this->catid,")!== false)||(strpos($this->fields[$i]->catsid, ",-1,")!== false)))
{
$nameField = true;
// Force required
$this->fields[$i]->required = 1;
}
else if (($namestyle >= 2)&&($this->fields[$i]->name == "firstname")&&((strpos($this->fields[$i]->catsid, ",$this->catid,")!== false)||(strpos($this->fields[$i]->catsid, ",-1,")!== false)))
{
$firstnameField = true;
// Force required
$this->fields[$i]->required = 1;
}
else if( ($namestyle == 3)&&($this->fields[$i]->name == "middlename")&&((strpos($this->fields[$i]->catsid, ",$this->catid,")!== false)||(strpos($this->fields[$i]->catsid, ",-1,")!== false)))
{
$middlenameField = true;
// Force required
$this->fields[$i]->required = 1;
}
}
if (($namestyle >= 2)&&($firstnameField == false))
{
echo "<tr><td>".JText::_('ADSMANAGER_FNAME')."</td>\n";
echo "<td><input $style class='adsmanager_required' mosReq='1' id='firstname' type='text' mosLabel='".htmlspecialchars(JText::_('ADSMANAGER_FNAME'),ENT_QUOTES)."' name='firstname' size='20' maxlength='20' value='$firstname' /></td></tr>\n";
}
if ( ($namestyle == 3)&&($middlenameField == false))
{
echo "<tr><td>".JText::_('ADSMANAGER_MNAME')."</td>\n";
echo "<td><input $style class='adsmanager_required' mosReq='1' id='middlename' type='text' mosLabel='".htmlspecialchars(JText::_('ADSMANAGER_MNAME'),ENT_QUOTES)."' name='middlename' size='20' maxlength='20' value='$middlename' /></td></tr>\n";
}
if ($nameField == false)
{
echo "<tr><td>".JText::_('_NAME')."</td>\n";
echo "<td><input $style class='adsmanager_required' mosReq='1' id='name' type='text' mosLabel='".htmlspecialchars(JText::_('_NAME'),ENT_QUOTES)."' name='name' size='20' maxlength='20' value='$name' /></td></tr>\n";
}
if ($emailField == false)
{
echo "<tr><td>".JText::_('_EMAIL')."</td>\n";
echo "<td><input $style class='adsmanager_required' mosReq='1' id='email' type='text' mosLabel='".htmlspecialchars(JText::_('_EMAIL'),ENT_QUOTES)."' name='email' size='20' maxlength='20' value='$email' /></td></tr>\n";
}
}

/* Display Fields */
foreach($this->fields as $field)
{
echo $this->field->showFieldForm($field,$this->content,$this->default);
}
?>
<!-- fields -->
<!-- image -->
<?php
if ($this->conf->nb_images > 0)
{
echo "<tr><td colspan='2'>".JTEXT::_('ADSMANAGER_FORM_AD_IMAGE_TEXT');
echo "</td></tr>";
}

for($i = 1; $i < $this->conf->nb_images + 1; $i++)
{
$ext_name = chr(ord('a')+$i-1);
?>
<tr name="ad_picture<?php echo $i;?>"><td><?php echo JTEXT::_('ADSMANAGER_FORM_AD_PICTURE')." ".$i; ?></td>
<td><input id="ad_picture<?php echo $i;?>" type="file" name="ad_picture<?php echo $i;?>" />
<?php
if ($this->isUpdateMode) {
$pic = JPATH_BASE."/images/com_adsmanager/ads/".$this->content->id.$ext_name."_t.jpg";
if ( file_exists( $pic)) {
echo "<img src='".$this->baseurl."/images/com_adsmanager/ads/".$this->content->id.$ext_name."_t.jpg' align='top' border='0' alt='image".$this->content->id."' />";
echo "<input type='checkbox' name='cb_image$i' value='delete' />".JTEXT::_('ADSMANAGER_CONTENT_DELETE_IMAGE');
}
}
echo "</td></tr>";
}

if (function_exists("editPaidAd")){
editPaidAd($this->content,$this->isUpdateMode,$this->conf);
}
?>
<!-- buttons -->
<input type="hidden" name="gflag" value="0" />
<?php
if (isset($this->content->date_created))
echo "<input type='hidden' name='date_created' value='".$this->content->date_created."' />";

echo "<input type='hidden' name='isUpdateMode' value='".$this->isUpdateMode."' />";
echo "<input type='hidden' name='id' value='".@$this->content->id."' />";
?>
      <tr>
<td>
<?php $user = JFactory::getUser();
if
((JPluginHelper::isEnabled('system', 'tincaptcha'))&&($user->id == "0") )
{
echo
"</td>
<td colspan=\"2\"><br>&nbsp;<img name=\"captchaimg\" src=\"index.php?option=com_tincaptcha&task=captcha_display\" />&nbsp;&nbsp;<a href=\"javascript:void(0);\" onclick=\"document.images['captchaimg'].src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime();return false;\">Atnaujinti</a></td></tr>
<br><br><tr><td>".JText::_( 'Įveskte kodą' )."</td><td><input type=\"text\" name=\"captcha\" id=\"captcha\" size=\"10\" class=\"adsmanager_required\" value=\"\" />"
. "";
}
else {
if ($user->id != "0")
echo "" ;}
?>
       </td>
<td>
                    <tr>
      <td>&nbsp;</td>
      <td>
        </td>
      </tr>
            <tr>
      <td>&nbsp;</td>
      <td> <?php //tincaptcha ?>
<input type="submit" value="<?php echo JTEXT::_('ADSMANAGER_FORM_SUBMIT_TEXT'); ?>" />
<input type="button" onclick='window.location="<?php echo JROUTE::_("index.php?option=com_adsmanager&view=list&Itemid=".$this->Itemid); ?>"' value="<?php echo JTEXT::_('ADSMANAGER_FORM_CANCEL_TEXT'); ?>" />
        </td>
      </tr>
</tr>
<!-- buttons -->
<?php
}
?>
  <?php echo JHTML::_( 'form.token' ); ?>
  </form>
  <!-- form -->
</table>
</fieldset>
<script type="text/javascript">
updateFields();
</script>
« Последнее редактирование: 17.02.2011, 23:03:22 от metacreo »
*

mbgr

  • Захожу иногда
  • 88
  • 11 / 0
Re: ads_manager 2.6 RC1 доработки
« Ответ #5 : 16.02.2011, 23:30:27 »
не работает! скопировал-вставил и все равно не пашет
*

metacreo

  • Осваиваюсь на форуме
  • 14
  • 1 / 0
Re: ads_manager 2.6 RC1 доработки
« Ответ #6 : 17.02.2011, 00:33:43 »
всё пашет
что не пашет ?? конкретнее.. пожалуйста
у меня допустим всё пашет.. и не докажеш мне что у меня непашет :)))
*

mbgr

  • Захожу иногда
  • 88
  • 11 / 0
Re: ads_manager 2.6 RC1 доработки
« Ответ #7 : 17.02.2011, 20:58:42 »
всё пашет
что не пашет ?? конкретнее.. пожалуйста
у меня допустим всё пашет.. и не докажеш мне что у меня непашет :)))

объявление добавляется без ввода кода
*

metacreo

  • Осваиваюсь на форуме
  • 14
  • 1 / 0
Re: ads_manager 2.6 RC1 доработки
« Ответ #8 : 17.02.2011, 23:04:15 »
пезалейте  controller.php
*

sevsan

  • Новичок
  • 3
  • 0 / 0
Re: ads_manager 2.6 RC1 доработки
« Ответ #9 : 19.02.2011, 01:33:00 »
Ale31
У меня символы вопросов в ромбиках,сделал так как вы пишете,но ничего не изменилось. :( !
*

Lex

  • Завсегдатай
  • 1615
  • 274 / 1
Re: ads_manager 2.6 RC1 доработки
« Ответ #10 : 19.02.2011, 01:36:56 »
metacreo Зря ты в это дело ввязался. Проще поправить у всех все самому, чем объясниять как это сделать.
Жизнь заставила учиться.
В личке на вопросы не отвечаю.
*

melkiialex

  • Захожу иногда
  • 152
  • 0 / 0
Re: ads_manager 2.6 RC1 доработки
« Ответ #11 : 02.05.2011, 16:31:48 »
Все сделал по инструкции, но отсылает как с капчей так и без ввода текста.
Как исправить, что бы если введено не верное объявление не добавлялось.
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Одинаковые миниатюры в Ads_manager 2.6 rc

Автор realwhite

Ответов: 4
Просмотров: 1810
Последний ответ 24.03.2011, 23:35:49
от realwhite
Доработки Adsmanager

Автор Nishtiak

Ответов: 1
Просмотров: 1741
Последний ответ 22.02.2010, 18:25:38
от samson56633
Стандартный компонент поиска+поиск ads_manager

Автор deman_ru

Ответов: 2
Просмотров: 1981
Последний ответ 16.10.2009, 23:03:37
от Leech
Не отображаются категории во фронте ads_manager 2.5 RC2

Автор khet

Ответов: 3
Просмотров: 2078
Последний ответ 30.09.2009, 11:21:31
от everestrus