Example #1
0
 /**
  * save profile
  *
  * @return int
  */
 function saveProfile()
 {
     global $app;
     $user =& JFactory::getUser();
     $logUser = new CofiUser($user->id);
     $this->_headline = JText::_('COFI_PROFILE_SAVED');
     // redirect	link
     $redirectLink = JRoute::_("index.php?option=com_discussions&view=profile");
     // check if user is logged in - maybe session has timed out
     if ($user->guest) {
         // if user is not logged in, kick him back to index page
         $app->redirect($redirectLink, JText::_('COFI_PROFILE_NOT_SAVED'), "message");
     }
     $db =& $this->getDBO();
     // delete Avatar
     if ($this->_delete_avatar == 1) {
         del_image($this->_userid, "avatar", JPATH_BASE, $db);
     }
     // avatar upload
     if (isset($_FILES['avatar']) and !$_FILES['avatar']['error']) {
         add_image($this->_userid, "avatar", JPATH_BASE, $db);
     }
     $sql = "UPDATE " . $db->nameQuote('#__discussions_users') . " SET" . " signature = " . $db->Quote($this->_signature) . ", zipcode = " . $db->Quote($this->_zipcode) . ", city = " . $db->Quote($this->_city) . ", country = " . $db->Quote($this->_country) . ", website = " . $db->Quote($this->_website) . ", twitter = " . $db->Quote($this->_twitter) . ", facebook = " . $db->Quote($this->_facebook) . ", flickr = " . $db->Quote($this->_flickr) . ", youtube = " . $db->Quote($this->_youtube) . ", show_online_status = " . $db->Quote($this->_show_online_status) . " WHERE id = '" . $user->id . "'";
     $db->setQuery($sql);
     $db->query();
     $app->redirect($redirectLink, JText::_('COFI_PROFILE_HAS_BEEN_SAVED'), "notice");
     return 0;
     // save OK
 }
include '/../queries/delete_queries.php';
/* Operations */
if (isset($_GET['del'])) {
    switch ($_GET['del']) {
        case 0:
            del_nav_item($connection);
            break;
        case 1:
            del_sub_nav_item($connection);
            break;
        case 2:
            del_youtube($connection);
            break;
        case 3:
            del_image($connection);
            break;
        case 4:
            del_section($connection);
            break;
        default:
            print '[["ERROR"]["Delete had an invalid ID"]]';
    }
}
function remove_section_youtubes($connection, $id)
{
    $delete_youtubes_by_section_id_stmt = delete_youtubes_by_section_id_stmt($connection);
    $delete_youtubes_by_section_id_stmt->bind_param("i", $id);
    catch_execution_error($delete_youtubes_by_section_id_stmt->execute(), $connection);
}
function remove_youtube($connection, $id)
 public function delimg()
 {
     $id = I('get.id');
     if (empty($id)) {
         $this->error(L('_ID_NOT_NULL_'));
     }
     //删除本地文件
     $result = del_image($id);
     if ($result !== false) {
         $this->success('删除成功');
     } else {
         $this->error(L('_DELETE_FAIL_'));
     }
 }