function refrCats($catname) { $db = JFactory::getDBO(); $user = JFactory::getUser(); $db->setQuery('SELECT cid' . ' FROM #__datsogallery_catg' . ' WHERE name = ' . $db->Quote($catname) . ' AND user_id = ' . $user->id); $catid = $db->loadResult(); $clist = ShowDropDownCategoryList($catid, 'catid', 'id="catname" style="width:340px" onchange="userCat(this.value);"'); echo $clist; }
function movePic($cid) { $app = JFactory::getApplication('administrator'); JToolBarHelper::title(JText::_('COM_DATSOGALLERY_MASS_MOVING_TITLE'), 'tb-move'); JToolBarHelper::custom('movepicres', 'dg-save.png', 'dg-save.png', JText::_('COM_DATSOGALLERY_SAVE'), false); JToolBarHelper::spacer(); JToolBarHelper::custom('', 'dg-cancel.png', 'dg-cancel.png', JText::_('COM_DATSOGALLERY_CANCEL'), false); $db =& JFactory::getDBO(); $catid = JRequest::getVar('catid', 0, '', 'int'); $cid = JRequest::getVar('cid', array(0), '', 'array'); if (count($cid) > 0) { $cids = implode(',', $cid); } $db->setQuery('SELECT * FROM #__datsogallery WHERE id IN (' . $cids . ')'); if ($db->query()) { $rows = $db->loadObjectList(); $options = array(JHTML::_('select.option', '1', JText::_('COM_DATSOGALLERY_SELECT_CATEGORY'))); $lists['catgs'] = ShowDropDownCategoryList($catid, 'catid', 'class="inputbox" size="1" '); datsogallery_html::movePic($rows, $lists); } }
function editPic($uid) { $app = JFactory::getApplication('site'); require JPATH_COMPONENT_ADMINISTRATOR . DS . 'config.datsogallery.php'; $db = JFactory::getDBO(); $user = JFactory::getUser(); $is_admin = array(7, 8); $userGroups = JAccess::getGroupsByUser($user->id, true); $doc = JFactory::getDocument(); $uri = JFactory::getURI(); $return = $uri->toString(); $url = 'index.php?option=com_users&view=login'; $url .= '&return=' . base64_encode($return); if (!$user->id) { $app->redirect($url, JText::_('You must login first')); } $menu = JSite::getMenu(); $ids = $menu->getItems('link', 'index.php?option=com_datsogallery&view=datsogallery'); $itemid = isset($ids[0]) ? '&Itemid=' . $ids[0]->id : ''; $doc->setTitle(JText::_('COM_DATSOGALLERY_EDIT')); $row = new DatsoImages($db); $row->load($uid); if ($row->owner_id != $user->id) { $app->redirect(JRoute::_("index.php?option=com_datsogallery&task=userpanel" . $itemid, false), JText::_('COM_DATSOGALLERY_NOT_ALOWED_EDIT_IMAGE')); } $clist = ShowDropDownCategoryList($row->catid, "catid", ' size="1" style="width:266px"'); ?> <script type="text/javascript"> function checkMe() { var form = document.adminForm; if (form.imgtitle.value == '') { alert("<?php echo JText::_('COM_DATSOGALLERY_MUST_HAVE_TITLE'); ?> "); return false; } else if (form.catid.value == 0) { alert("<?php echo JText::_('COM_DATSOGALLERY_MUST_SELECT_CATEGORY'); ?> "); return false; } else { form.submit(); } } </script> <div class="dg_head_background"><?php echo JText::_('COM_DATSOGALLERY_EDIT_PICTURE'); ?> </div> <form action="<?php echo JRoute::_("index.php?option=com_datsogallery&task=savepic" . $itemid); ?> " method="post" name="adminForm" onsubmit="checkform();"> <table cellpadding="0" cellspacing="8" border="0" width="100%" class="dg_body_background_edit_image"> <tr> <td width="20%" align="right"><?php echo JText::_('COM_DATSOGALLERY_TITLE'); ?> :</td> <td width="80%"><input class="inputbox" type="text" name="imgtitle" style="width:266px" value="<?php echo trim($row->imgtitle); ?> " /></td> </tr> <tr> <td valign="top" align="right"><?php echo JText::_('COM_DATSOGALLERY_CATEGORY'); ?> :</td> <td><?php echo $clist; ?> </td> </tr> <tr> <td valign="top" align="right"><?php echo JText::_('COM_DATSOGALLERY_DESCRIPTION'); ?> :</td> <td><textarea cols="35" rows="10" name="imgtext" style="width:266px"><?php echo trim($row->imgtext); ?> </textarea></td> </tr> <tr> <td valign="top" align="right"><?php echo JText::_('COM_DATSOGALLERY_AUTHOR'); ?> :</td> <td><input class="inputbox" type="text" name="imgauthor" value="<?php echo trim($row->imgauthor); ?> " style="width:266px" /></td> </tr> <tr> <td valign="top" align="right"><?php echo JText::_('COM_DATSOGALLERY_AUTHOR_URL'); ?> :</td> <td><input class="inputbox" type="text" name="imgauthorurl" value="<?php echo trim($row->imgauthorurl); ?> " style="width:266px" /></td> </tr> <?php if ($ad_comment_notify) { $yesno = array(JHTML::_('select.option', '0', JText::_('COM_DATSOGALLERY_NO')), JHTML::_('select.option', '1', JText::_('COM_DATSOGALLERY_YES'))); $yn_notify = JHTML::_('select.radiolist', $yesno, 'notify', 'class="inputbox"', 'value', 'text', $row->notify); $regex = '/(\\s|\\\\[rntv]{1})/'; $yn_notify = preg_replace("/\\<label(.*?)\\>/si", '', $yn_notify); $yn_notify = preg_replace("/<\\/label\\>/si", '', $yn_notify); ?> <tr> <td valign="top" align="right"><?php echo JText::_('COM_DATSOGALLERY_COMMENT_NOTIFY_ME'); ?> :</td> <td style="display: inline;vertical-align: middle"><?php echo preg_replace($regex, ' ', $yn_notify); ?> <input type="checkbox" name="notify_all" value="1" /> <?php echo JText::_('COM_DATSOGALLERY_ALL'); ?> <?php echo dgTip(JText::_('COM_DATSOGALLERY_COMMENT_NOTIFY_ME_TIP')); ?> </td> </tr> <?php } ?> <tr> <td valign="top" align="right"><?php echo JText::_('COM_DATSOGALLERY_PICTURE'); ?> :</td> <td><img src="<?php echo resize($row->imgoriginalname, $ad_thumbwidth, $ad_thumbheight, $ad_crop, $ad_cropratio, 0, $row->catid); ?> " <?php echo get_width_height($row->imgoriginalname, $ad_thumbwidth, $ad_thumbheight, $row->catid, $ad_cropratio); ?> class="dgimg" title="<?php echo JText::_('COM_DATSOGALLERY_PICTURE'); ?> " alt="" /></td> </tr> <tr> <td colspan="2" align="center"> <button class="dg_btn" onclick="checkMe();return false;"><span><span><?php echo JText::_('COM_DATSOGALLERY_SAVE'); ?> </span></span></button> <button class="dg_btn" onclick="javascript:history.go(-1);return false;"><span><span><?php echo JText::_('COM_DATSOGALLERY_CANCEL'); ?> </span></span></button> </td> </tr> </table> <input type="hidden" name="id" value="<?php echo $row->id; ?> " /> <?php echo JHTML::_('form.token'); ?> </form> <?php }